static int __init gumstix_init(void) { printk("gumstix_init: Initialising board...\n"); pxa_map_io(); pxa_generic_init(); /* Set up nPWE */ pxa_gpio_mode(GPIO49_nPWE_MD); /* Set up the chip selects */ pxa_gpio_mode(GPIO15_nCS_1_MD); (void) platform_add_devices(devices, ARRAY_SIZE(devices)); pxa_gpio_func(36, GPIO_MODE, GPIO_IN); /* Set rising edge detect for GPIO 36 */ GFER(36) &= ~GPIO_BIT(36); GRER(36) |= (GPIO_BIT(36)); /* We assume that the bootloader has set up the rest for us */ // set_irq_type(IBOX_ETH_IRQ, IRQT_RISING); return 0; }
static void pxa_mask_muxed_gpio(unsigned int irq) { int gpio = irq - IRQ_GPIO(2) + 2; __clear_bit(gpio, GPIO_IRQ_mask); GRER(gpio) &= ~GPIO_bit(gpio); GFER(gpio) &= ~GPIO_bit(gpio); }
static void pxa_unmask_muxed_gpio(unsigned int irq) { int gpio = irq - IRQ_GPIO(2) + 2; int idx = gpio >> 5; __set_bit(gpio, GPIO_IRQ_mask); GRER(gpio) = GPIO_IRQ_rising_edge[idx] & GPIO_IRQ_mask[idx]; GFER(gpio) = GPIO_IRQ_falling_edge[idx] & GPIO_IRQ_mask[idx]; }
static int __init ibox_init(void) { pxa_map_io(); pxa_generic_init(); /* initialise I2C and give a slave address */ i2c_init(0xFF); (void) platform_add_devices(devices, ARRAY_SIZE(devices)); pxa_gpio_func(21, GPIO_MODE, GPIO_IN); /* Set rising edge detect for GPIO 21 */ GFER(21) &= ~GPIO_BIT(21); GRER(21) |= (GPIO_BIT(21)); // set_irq_type(IBOX_ETH_IRQ, IRQT_RISING); return 0; }
static int pxa_gpio_irq_type(unsigned int irq, unsigned int type) { int gpio, idx; gpio = IRQ_TO_GPIO(irq); idx = gpio >> 5; if (type == IRQT_PROBE) { /* Don't mess with enabled GPIOs using preconfigured edges or GPIOs set to alternate function or to output during probe */ if ((GPIO_IRQ_rising_edge[idx] | GPIO_IRQ_falling_edge[idx] | GPDR(gpio)) & GPIO_bit(gpio)) return 0; if (GAFR(gpio) & (0x3 << (((gpio) & 0xf)*2))) return 0; type = __IRQT_RISEDGE | __IRQT_FALEDGE; } /* printk(KERN_DEBUG "IRQ%d (GPIO%d): ", irq, gpio); */ pxa_gpio_mode(gpio | GPIO_IN); if (type & __IRQT_RISEDGE) { /* printk("rising "); */ __set_bit (gpio, GPIO_IRQ_rising_edge); } else __clear_bit (gpio, GPIO_IRQ_rising_edge); if (type & __IRQT_FALEDGE) { /* printk("falling "); */ __set_bit (gpio, GPIO_IRQ_falling_edge); } else __clear_bit (gpio, GPIO_IRQ_falling_edge); /* printk("edges\n"); */ GRER(gpio) = GPIO_IRQ_rising_edge[idx] & GPIO_IRQ_mask[idx]; GFER(gpio) = GPIO_IRQ_falling_edge[idx] & GPIO_IRQ_mask[idx]; return 0; }