Esempio n. 1
0
static unsigned int sdslot_status(struct device *dev)
{
	unsigned int status;

	// For Diamond devices the MMC (MoviNAND) is built-in and always connected
	if (machine_is_htcdiamond() || machine_is_htcdiamond_cdma()) {
		return 1;
	}

	status = (unsigned int)gpio_get_value(mmc_pdata.sdcard_status_gpio);
	return (!status);
}
Esempio n. 2
0
// Get the short AMSS Version ( like 6120 )
unsigned int get_amss_version(void)
{
    char amss_ver[20];
    char amss_dump[20];
    char *dot1, *dot2;
    int len = 0;
    uint32_t ver_base = 0;

    /* Detection doesn't work on 'old' CDMA, there's no
     * version string to be found anywhere in SHARED_RAM_BASE
     */
    if (machine_is_htcdiamond_cdma() || machine_is_htcraphael_cdma() || machine_is_htcraphael_cdma500())
        return 6150;
    else if (machine_is_htcleo())
        ver_base = 0xef230;
    else
        ver_base = 0xfc030;

    // Dump AMMS version
    *(unsigned int *) (amss_dump + 0x0) = readl(MSM_SHARED_RAM_BASE + ver_base + 0x0);
    *(unsigned int *) (amss_dump + 0x4) = readl(MSM_SHARED_RAM_BASE + ver_base + 0x4);
    *(unsigned int *) (amss_dump + 0x8) = readl(MSM_SHARED_RAM_BASE + ver_base + 0x8);
    *(unsigned int *) (amss_dump + 0xc) = readl(MSM_SHARED_RAM_BASE + ver_base + 0xc);
    *(unsigned int *) (amss_dump + 0x10) = readl(MSM_SHARED_RAM_BASE + ver_base + 0x10);
    amss_dump[19] = '\0';
    dot1 = strchr(amss_dump, '.');
    if(dot1 == NULL) {	// CDMA
        dot1 = strchr(amss_dump, '-');
        if(dot1 == NULL)
            return 0;
        strncpy(amss_ver, dot1+1, 4);
        amss_ver[4] = '\0';
        return  simple_strtoul(amss_ver, NULL, 10);
    }
    else { // GSM
        len = (dot1-amss_dump);
        strncpy(amss_ver, amss_dump, len);
        dot1 = strchr(dot1+1, '.');
        if(dot1 == NULL)
            return 0;
        dot2 = strchr(dot1+1, '.');
        if(dot2 == NULL)
            return 0;
        strncpy(amss_ver+len, dot1+1, (dot2-dot1)-1);
        len+= (int)(dot2-dot1)-1;
        amss_ver[len] = '\0';
        return  simple_strtoul(amss_ver, NULL, 10);
    }
}