Exemplo n.º 1
0
uint32 nmi_get_chipid(void)
{
    static uint32 chipid = 0;

    if (chipid == 0) {
        //uint32 revid;
        uint32 rfrevid;

        if((nm_read_reg_with_ret(0x1000, &chipid)) != M2M_SUCCESS) {
            chipid = 0;
            return 0;
        }
        //if((ret = nm_read_reg_with_ret(0x11fc, &revid)) != M2M_SUCCESS) {
        //	return 0;
        //}
        if((nm_read_reg_with_ret(0x13f4, &rfrevid)) != M2M_SUCCESS) {
            chipid = 0;
            return 0;
        }

        if (chipid == 0x1002a0)  {
            if (rfrevid == 0x1) { /* 1002A0 */
            } else { /* if (rfrevid == 0x2) */
                /* 1002A1 */
                chipid = 0x1002a1;
            }
        } else if(chipid == 0x1002b0) {
            if(rfrevid == 3) { /* 1002B0 */
            } else if(rfrevid == 4) { /* 1002B1 */
                chipid = 0x1002b1;
            } else { /* if(rfrevid == 5) */
                /* 1002B2 */
                chipid = 0x1002b2;
            }
        } else {
        }
//#define PROBE_FLASH
#ifdef PROBE_FLASH
        if(chipid) {
            UWORD32 flashid;

            flashid = probe_spi_flash();
            if(flashid == 0x1230ef) {
                chipid &= ~(0x0f0000);
                chipid |= 0x050000;
            }
            if(flashid == 0xc21320c2) {
                chipid &= ~(0x0f0000);
                chipid |= 0x050000;
            }
        }
#else
        /*M2M is by default have SPI flash*/
        chipid &= ~(0x0f0000);
        chipid |= 0x050000;
#endif /* PROBE_FLASH */
    }
    return chipid;
}
Exemplo n.º 2
0
uint32 nmi_get_chipid(void)
{
	static uint32 chipid = 0;

	if (chipid == 0) {
		//uint32 revid;
		uint32 rfrevid;

		if((nm_read_reg_with_ret(0x1000, &chipid)) != M2M_SUCCESS) {
			chipid = 0;
			return 0;
		}
		//if((ret = nm_read_reg_with_ret(0x11fc, &revid)) != M2M_SUCCESS) {
		//	return 0;
		//}
		if((nm_read_reg_with_ret(0x13f4, &rfrevid)) != M2M_SUCCESS) {
			chipid = 0;
			return 0;
		}

		if (chipid == 0x1002a0)  {
			if (rfrevid == 0x1) { /* 1002A0 */
			} else /* if (rfrevid == 0x2) */ { /* 1002A1 */
				chipid = 0x1002a1;
			}
		} else if(chipid == 0x1002b0) {
			if(rfrevid == 3) { /* 1002B0 */
			} else if(rfrevid == 4) { /* 1002B1 */
				chipid = 0x1002b1;
			} else /* if(rfrevid == 5) */ { /* 1002B2 */
				chipid = 0x1002b2;
			}
		} else if(chipid == 0x1000f0) {
			/* For 3400, the WiFi chip ID register reads 0x1000f0.
			 * Therefore using BT chip ID register here which should read 0x3000D0
			 */
#define	rBT_CHIP_ID_REG	 (0x3b0000)
			if((nm_read_reg_with_ret(rBT_CHIP_ID_REG, &chipid)) != M2M_SUCCESS) {
				chipid = 0;
				return 0;
			}
			return chipid;
		}
//#define PROBE_FLASH
#ifdef PROBE_FLASH
		if(chipid) {
			UWORD32 flashid;

			flashid = probe_spi_flash();
			if(flashid == 0x1230ef) {
				chipid &= ~(0x0f0000);
				chipid |= 0x050000;
			}
			if(flashid == 0xc21320c2) {
				chipid &= ~(0x0f0000);
				chipid |= 0x050000;
			}
		}
#else
		/*M2M is by default have SPI flash*/
		chipid &= ~(0x0f0000);
		chipid |= 0x050000;
#endif /* PROBE_FLASH */
	}
	return chipid;
}