static void __init h3_init_smc91x(void) { omap_cfg_reg(W15_1710_GPIO40); if (omap_request_gpio(40) < 0) { printk("Error requesting gpio 40 for smc91x irq\n"); return; } omap_set_gpio_edge_ctrl(40, OMAP_GPIO_FALLING_EDGE); }
static void __init innovator_init_smc91x(void) { if (cpu_is_omap1510()) { fpga_write(fpga_read(OMAP1510_FPGA_RST) & ~1, OMAP1510_FPGA_RST); udelay(750); } else { if ((omap_request_gpio(0)) < 0) { printk("Error requesting gpio 0 for smc91x irq\n"); return; } omap_set_gpio_edge_ctrl(0, OMAP_GPIO_RISING_EDGE); } }
/* * All of the FPGA interrupt request inputs except for the touchscreen are * edge-sensitive; the touchscreen is level-sensitive. The edge-sensitive * interrupts are acknowledged as a side-effect of reading the interrupt * status register from the FPGA. The edge-sensitive interrupt inputs * cause a problem with level interrupt requests, such as Ethernet. The * problem occurs when a level interrupt request is asserted while its * interrupt input is masked in the FPGA, which results in a missed * interrupt. * * In an attempt to workaround the problem with missed interrupts, the * mask_ack routine for all of the FPGA interrupts has been changed from * fpga_mask_ack_irq() to fpga_ack_irq() so that the specific FPGA interrupt * being serviced is left unmasked. We can do this because the FPGA cascade * interrupt is installed with the SA_INTERRUPT flag, which leaves all * interrupts masked at the CPU while an FPGA interrupt handler executes. * * Limited testing indicates that this workaround appears to be effective * for the smc9194 Ethernet driver used on the Innovator. It should work * on other FPGA interrupts as well, but any drivers that explicitly mask * interrupts at the interrupt controller via disable_irq/enable_irq * could pose a problem. */ void fpga_init_irq(void) { int i; __raw_writeb(0, OMAP1510_FPGA_IMR_LO); __raw_writeb(0, OMAP1510_FPGA_IMR_HI); __raw_writeb(0, INNOVATOR_FPGA_IMR2); for (i = IH_FPGA_BASE; i < (IH_FPGA_BASE + NR_FPGA_IRQS); i++) { if (i == INT_FPGA_TS) { /* * The touchscreen interrupt is level-sensitive, so * we'll use the regular mask_ack routine for it. */ set_irq_chip(i, &omap_fpga_irq_ack); } else { /* * All FPGA interrupts except the touchscreen are * edge-sensitive, so we won't mask them. */ set_irq_chip(i, &omap_fpga_irq); } set_irq_handler(i, do_level_IRQ); set_irq_flags(i, IRQF_VALID); } /* * The FPGA interrupt line is connected to GPIO13. Claim this pin for * the ARM. * * NOTE: For general GPIO/MPUIO access and interrupts, please see * gpio.[ch] */ omap_request_gpio(13); omap_set_gpio_direction(13, 1); omap_set_gpio_edge_ctrl(13, OMAP_GPIO_RISING_EDGE); set_irq_chained_handler(INT_FPGA, innovator_fpga_IRQ_demux); }
/* no error returns, they'd just make bus scanning stop */ static int isp1301_probe(struct i2c_adapter *bus, int address, int kind) { int status; struct isp1301 *isp; struct i2c_client *i2c; if (the_transceiver) return 0; isp = kzalloc(sizeof *isp, GFP_KERNEL); if (!isp) return 0; INIT_WORK(&isp->work, isp1301_work, isp); init_timer(&isp->timer); isp->timer.function = isp1301_timer; isp->timer.data = (unsigned long) isp; isp->irq = -1; isp->client.addr = address; i2c_set_clientdata(&isp->client, isp); isp->client.adapter = bus; isp->client.driver = &isp1301_driver; strlcpy(isp->client.name, DRIVER_NAME, I2C_NAME_SIZE); i2c = &isp->client; /* if this is a true probe, verify the chip ... */ if (kind < 0) { status = isp1301_get_u16(isp, ISP1301_VENDOR_ID); if (status != I2C_VENDOR_ID_PHILIPS) { dev_dbg(&bus->dev, "addr %d not philips id: %d\n", address, status); goto fail1; } status = isp1301_get_u16(isp, ISP1301_PRODUCT_ID); if (status != I2C_PRODUCT_ID_PHILIPS_1301) { dev_dbg(&bus->dev, "%d not isp1301, %d\n", address, status); goto fail1; } } status = i2c_attach_client(i2c); if (status < 0) { dev_dbg(&bus->dev, "can't attach %s to device %d, err %d\n", DRIVER_NAME, address, status); fail1: kfree(isp); return 0; } isp->i2c_release = i2c->dev.release; i2c->dev.release = isp1301_release; /* initial development used chiprev 2.00 */ status = i2c_smbus_read_word_data(i2c, ISP1301_BCD_DEVICE); dev_info(&i2c->dev, "chiprev %x.%02x, driver " DRIVER_VERSION "\n", status >> 8, status & 0xff); /* make like power-on reset */ isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, MC1_MASK); isp1301_set_bits(isp, ISP1301_MODE_CONTROL_2, MC2_BI_DI); isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_2, ~MC2_BI_DI); isp1301_set_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_DM_PULLDOWN | OTG1_DP_PULLDOWN); isp1301_clear_bits(isp, ISP1301_OTG_CONTROL_1, ~(OTG1_DM_PULLDOWN | OTG1_DP_PULLDOWN)); isp1301_clear_bits(isp, ISP1301_INTERRUPT_LATCH, ~0); isp1301_clear_bits(isp, ISP1301_INTERRUPT_FALLING, ~0); isp1301_clear_bits(isp, ISP1301_INTERRUPT_RISING, ~0); #ifdef CONFIG_USB_OTG status = otg_bind(isp); if (status < 0) { dev_dbg(&i2c->dev, "can't bind OTG\n"); goto fail2; } #endif if (machine_is_omap_h2()) { /* full speed signaling by default */ isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SPEED_REG); isp1301_set_bits(isp, ISP1301_MODE_CONTROL_2, MC2_SPD_SUSP_CTRL); /* IRQ wired at M14 */ omap_cfg_reg(M14_1510_GPIO2); isp->irq = OMAP_GPIO_IRQ(2); omap_request_gpio(2); omap_set_gpio_direction(2, 1); omap_set_gpio_edge_ctrl(2, OMAP_GPIO_FALLING_EDGE); } status = request_irq(isp->irq, isp1301_irq, IRQF_SAMPLE_RANDOM, DRIVER_NAME, isp); if (status < 0) { dev_dbg(&i2c->dev, "can't get IRQ %d, err %d\n", isp->irq, status); #ifdef CONFIG_USB_OTG fail2: #endif i2c_detach_client(i2c); goto fail1; } isp->otg.dev = &isp->client.dev; isp->otg.label = DRIVER_NAME; isp->otg.set_host = isp1301_set_host, isp->otg.set_peripheral = isp1301_set_peripheral, isp->otg.set_power = isp1301_set_power, isp->otg.start_srp = isp1301_start_srp, isp->otg.start_hnp = isp1301_start_hnp, enable_vbus_draw(isp, 0); power_down(isp); the_transceiver = isp; #ifdef CONFIG_USB_OTG update_otg1(isp, isp1301_get_u8(isp, ISP1301_INTERRUPT_SOURCE)); update_otg2(isp, isp1301_get_u8(isp, ISP1301_OTG_STATUS)); #endif dump_regs(isp, __FUNCTION__); #ifdef VERBOSE mod_timer(&isp->timer, jiffies + TIMER_JIFFIES); dev_dbg(&i2c->dev, "scheduled timer, %d min\n", TIMER_MINUTES); #endif status = otg_set_transceiver(&isp->otg); if (status < 0) dev_err(&i2c->dev, "can't register transceiver, %d\n", status); return 0; }