Exemplo n.º 1
0
static void geode_mfgpt_detect(void)
{
    int i;
    u16 val;

    timers = 0;

    if (disable) {
        printk(KERN_INFO "geode-mfgpt:  MFGPT support is disabled\n");
        goto done;
    }

    if (!geode_get_dev_base(GEODE_DEV_MFGPT)) {
        printk(KERN_INFO "geode-mfgpt:  MFGPT LBAR is not set up\n");
        goto done;
    }

    for (i = 0; i < MFGPT_MAX_TIMERS; i++) {
        val = geode_mfgpt_read(i, MFGPT_REG_SETUP);
        if (!(val & MFGPT_SETUP_SETUP)) {
            mfgpt_timers[i].avail = 1;
            timers++;
        }
    }

done:
    printk(KERN_INFO "geode-mfgpt:  %d MFGPT timers available.\n", timers);
}
Exemplo n.º 2
0
void geode_gpio_setup_event(unsigned int gpio, int pair, int pme)
{
	u32 base = geode_get_dev_base(GEODE_DEV_GPIO);
	u32 offset, shift, val;

	if (gpio >= 24)
		offset = GPIO_MAP_W;
	else if (gpio >= 16)
		offset = GPIO_MAP_Z;
	else if (gpio >= 8)
		offset = GPIO_MAP_Y;
	else
		offset = GPIO_MAP_X;

	shift = (gpio % 8) * 4;

	val = inl(base + offset);

	/* Clear whatever was there before */
	val &= ~(0xF << shift);

	/* And set the new value */

	val |= ((pair & 7) << shift);

	/* Set the PME bit if this is a PME event */

	if (pme)
		val |= (1 << (shift + 3));

	outl(val, base + offset);
}
Exemplo n.º 3
0
int geode_gpio_isset(unsigned int gpio, unsigned int reg)
{
	u32 base = geode_get_dev_base(GEODE_DEV_GPIO);

	if (!base)
		return 0;

	if (gpio < 16)
		return (inl(base + reg) & (1 << gpio)) ? 1 : 0;
	else
		return (inl(base + 0x80 + reg) & (1 << (gpio - 16))) ? 1 : 0;
}
Exemplo n.º 4
0
void geode_gpio_clear(unsigned int gpio, unsigned int reg)
{
	u32 base = geode_get_dev_base(GEODE_DEV_GPIO);

	if (!base)
		return;

	if (gpio < 16)
		outl(1 << (gpio + 16), base + reg);
	else
		outl(1 << gpio, base + 0x80 + reg);
}