static int __init bus_init(void) { struct bit_data *bit = &bit_data; unsigned long flags; int ret; if (machine_is_assabet() || machine_is_pangolin()) { bit->sda = GPIO_GPIO15; bit->scl = GPIO_GPIO18; bit->l3_mode = GPIO_GPIO17; } if (machine_is_h3600() || machine_is_h3100()) { bit->sda = GPIO_GPIO14; bit->scl = GPIO_GPIO16; bit->l3_mode = GPIO_GPIO15; } if (machine_is_stork()) { bit->sda = GPIO_GPIO15; bit->scl = GPIO_GPIO18; bit->l3_mode = GPIO_GPIO17; } if (!bit->sda) return -ENODEV; /* * Default level for L3 mode is low. * We set SCL and SDA high (i2c idle state). */ local_irq_save(flags); GPDR &= ~(bit->scl | bit->sda); GPCR = bit->l3_mode | bit->scl | bit->sda; GPDR |= bit->l3_mode; local_irq_restore(flags); if (machine_is_assabet()) { /* * Release reset on UCB1300, ADI7171 and UDA1341. We * need to do this here so that we can communicate on * the I2C/L3 buses. */ ASSABET_BCR_set(ASSABET_BCR_CODEC_RST); mdelay(1); ASSABET_BCR_clear(ASSABET_BCR_CODEC_RST); mdelay(1); ASSABET_BCR_set(ASSABET_BCR_CODEC_RST); } ret = i2c_init(bit); if (ret == 0 && bit->l3_mode) { ret = l3_init(bit); if (ret) i2c_exit(); } return ret; }
static void __exit bus_exit(void) { l3_exit(); i2c_exit(); }