Lines Matching +full:mmp +full:- +full:gpio
1 // SPDX-License-Identifier: GPL-2.0-only
8 * Copyright (C) 2004-2005 Deep Blue Solutions Ltd.
13 * Jan 2003: Fixed several bugs concerning interrupt handling [Kai-Uwe Bloem]
14 * Jan 2003: added limited signal handling [Kai-Uwe Bloem]
23 #include <linux/gpio/consumer.h>
34 #include <linux/platform_data/i2c-pxa.h>
59 #define ICR_A3700_FM (1 << 16) /* fast mode for armada-3700 */
60 #define ICR_A3700_HS (1 << 17) /* high speed mode for armada-3700 */
61 #define ICR_GPIOEN (1 << 19) /* enable GPIO mode for SCL in HS */
92 * looking at a multi-master environment
96 #define NO_SLAVE (-ENXIO)
97 #define BUS_ERROR (-EREMOTEIO)
98 #define XFER_NAKED (-ECONNREFUSED)
99 #define I2C_RETRY (-2000) /* an error has occurred retry transmit */
207 { .compatible = "mrvl,pxa-i2c", .data = (void *)REGS_PXA2XX },
209 { .compatible = "mrvl,mmp-twsi", .data = (void *)REGS_PXA910 },
210 { .compatible = "marvell,armada-3700-i2c", .data = (void *)REGS_A3700 },
216 { "pxa2xx-i2c", REGS_PXA2XX },
217 { "pxa3xx-pwri2c", REGS_PXA3XX },
218 { "ce4100-i2c", REGS_CE4100 },
219 { "pxa910-i2c", REGS_PXA910 },
220 { "armada-3700-i2c", REGS_A3700 },
273 #define _IBMR(i2c) ((i2c)->reg_ibmr)
274 #define _IDBR(i2c) ((i2c)->reg_idbr)
275 #define _ICR(i2c) ((i2c)->reg_icr)
276 #define _ISR(i2c) ((i2c)->reg_isr)
277 #define _ISAR(i2c) ((i2c)->reg_isar)
278 #define _ILCR(i2c) ((i2c)->reg_ilcr)
279 #define _IWCR(i2c) ((i2c)->reg_iwcr)
299 while (num--) { in decode_bits()
300 const char *str = val & bits->mask ? bits->set : bits->unset; in decode_bits()
356 dev_dbg(&i2c->adap.dev, "state:%s:%d: ISR=%08x, ICR=%08x, IBMR=%02x\n", fname, lno, in i2c_pxa_show_state()
365 struct device *dev = &i2c->adap.dev; in i2c_pxa_scream_blue_murder()
368 i2c->req_slave_addr >> 1, why); in i2c_pxa_scream_blue_murder()
370 i2c->msg_num, i2c->msg_idx, i2c->msg_ptr); in i2c_pxa_scream_blue_murder()
375 for (i = 0; i < i2c->irqlogidx; i++) in i2c_pxa_scream_blue_murder()
376 pr_cont(" [%03x:%05x]", i2c->isrlog[i], i2c->icrlog[i]); in i2c_pxa_scream_blue_murder()
403 dev_dbg(&i2c->adap.dev, "%s: called in slave mode\n", __func__); in i2c_pxa_abort()
418 i --; in i2c_pxa_abort()
438 if (!timeout--) in i2c_pxa_wait_bus_not_busy()
456 dev_dbg(&i2c->adap.dev, "%s: %ld: ISR=%08x, ICR=%08x, IBMR=%02x\n", in i2c_pxa_wait_master()
461 dev_dbg(&i2c->adap.dev, "%s: Slave detected\n", __func__); in i2c_pxa_wait_master()
472 dev_dbg(&i2c->adap.dev, "%s: done\n", __func__); in i2c_pxa_wait_master()
480 dev_dbg(&i2c->adap.dev, "%s: did not free\n", __func__); in i2c_pxa_wait_master()
488 dev_dbg(&i2c->adap.dev, "setting to bus master\n"); in i2c_pxa_set_master()
491 dev_dbg(&i2c->adap.dev, "%s: unit is busy\n", __func__); in i2c_pxa_set_master()
493 dev_dbg(&i2c->adap.dev, "%s: error: unit busy\n", __func__); in i2c_pxa_set_master()
513 dev_dbg(&i2c->adap.dev, "%s: %ld: ISR=%08x, ICR=%08x, IBMR=%02x\n", in i2c_pxa_wait_slave()
520 dev_dbg(&i2c->adap.dev, "%s: done\n", __func__); in i2c_pxa_wait_slave()
528 dev_dbg(&i2c->adap.dev, "%s: did not free\n", __func__); in i2c_pxa_wait_slave()
552 dev_err(&i2c->adap.dev, "%s: wait timedout\n", in i2c_pxa_set_slave()
562 dev_dbg(&i2c->adap.dev, "ICR now %08x, ISR %08x\n", readl(_ICR(i2c)), readl(_ISR(i2c))); in i2c_pxa_set_slave()
577 if (i2c->reg_isar && IS_ENABLED(CONFIG_I2C_PXA_SLAVE)) in i2c_pxa_do_reset()
578 writel(i2c->slave_addr, _ISAR(i2c)); in i2c_pxa_do_reset()
581 writel(I2C_ICR_INIT | (i2c->fast_mode ? i2c->fm_mask : 0), _ICR(i2c)); in i2c_pxa_do_reset()
582 writel(readl(_ICR(i2c)) | (i2c->high_mode ? i2c->hs_mask : 0), _ICR(i2c)); in i2c_pxa_do_reset()
585 dev_info(&i2c->adap.dev, "Enabling slave mode\n"); in i2c_pxa_do_reset()
622 if (i2c->slave != NULL) in i2c_pxa_slave_txempty()
623 i2c_slave_event(i2c->slave, I2C_SLAVE_READ_PROCESSED, in i2c_pxa_slave_txempty()
635 if (i2c->slave != NULL) in i2c_pxa_slave_rxfull()
636 i2c_slave_event(i2c->slave, I2C_SLAVE_WRITE_RECEIVED, &byte); in i2c_pxa_slave_rxfull()
646 dev_dbg(&i2c->adap.dev, "SAD, mode is slave-%cx\n", in i2c_pxa_slave_start()
649 if (i2c->slave != NULL) { in i2c_pxa_slave_start()
653 i2c_slave_event(i2c->slave, I2C_SLAVE_READ_REQUESTED, in i2c_pxa_slave_start()
657 i2c_slave_event(i2c->slave, I2C_SLAVE_WRITE_REQUESTED, in i2c_pxa_slave_start()
676 timeout--; in i2c_pxa_slave_start()
679 dev_err(&i2c->adap.dev, "timeout waiting for SCL high\n"); in i2c_pxa_slave_start()
690 dev_dbg(&i2c->adap.dev, "ISR: SSD (Slave Stop)\n"); in i2c_pxa_slave_stop()
692 if (i2c->slave != NULL) in i2c_pxa_slave_stop()
693 i2c_slave_event(i2c->slave, I2C_SLAVE_STOP, NULL); in i2c_pxa_slave_stop()
696 dev_dbg(&i2c->adap.dev, "ISR: SSD (Slave Stop) acked\n"); in i2c_pxa_slave_stop()
699 * If we have a master-mode message waiting, in i2c_pxa_slave_stop()
702 if (i2c->msg) in i2c_pxa_slave_stop()
708 struct pxa_i2c *i2c = slave->adapter->algo_data; in i2c_pxa_slave_reg()
710 if (i2c->slave) in i2c_pxa_slave_reg()
711 return -EBUSY; in i2c_pxa_slave_reg()
713 if (!i2c->reg_isar) in i2c_pxa_slave_reg()
714 return -EAFNOSUPPORT; in i2c_pxa_slave_reg()
716 i2c->slave = slave; in i2c_pxa_slave_reg()
717 i2c->slave_addr = slave->addr; in i2c_pxa_slave_reg()
719 writel(i2c->slave_addr, _ISAR(i2c)); in i2c_pxa_slave_reg()
726 struct pxa_i2c *i2c = slave->adapter->algo_data; in i2c_pxa_slave_unreg()
728 WARN_ON(!i2c->slave); in i2c_pxa_slave_unreg()
730 i2c->slave_addr = I2C_PXA_SLAVE_ADDR; in i2c_pxa_slave_unreg()
731 writel(i2c->slave_addr, _ISAR(i2c)); in i2c_pxa_slave_unreg()
733 i2c->slave = NULL; in i2c_pxa_slave_unreg()
771 timeout--; in i2c_pxa_slave_start()
774 dev_err(&i2c->adap.dev, "timeout waiting for SCL high\n"); in i2c_pxa_slave_start()
784 if (i2c->msg) in i2c_pxa_slave_stop()
800 i2c->req_slave_addr = i2c_8bit_addr_from_msg(i2c->msg); in i2c_pxa_start_message()
801 writel(i2c->req_slave_addr, _IDBR(i2c)); in i2c_pxa_start_message()
831 spin_lock_irq(&i2c->lock); in i2c_pxa_send_mastercode()
832 i2c->highmode_enter = true; in i2c_pxa_send_mastercode()
833 writel(i2c->master_code, _IDBR(i2c)); in i2c_pxa_send_mastercode()
839 spin_unlock_irq(&i2c->lock); in i2c_pxa_send_mastercode()
840 time_left = wait_event_timeout(i2c->wait, in i2c_pxa_send_mastercode()
841 i2c->highmode_enter == false, HZ * 1); in i2c_pxa_send_mastercode()
843 i2c->highmode_enter = false; in i2c_pxa_send_mastercode()
849 * i2c_pxa_master_complete - complete the message and wake up.
853 i2c->msg_ptr = 0; in i2c_pxa_master_complete()
854 i2c->msg = NULL; in i2c_pxa_master_complete()
855 i2c->msg_idx ++; in i2c_pxa_master_complete()
856 i2c->msg_num = 0; in i2c_pxa_master_complete()
858 i2c->msg_idx = ret; in i2c_pxa_master_complete()
859 if (!i2c->use_pio) in i2c_pxa_master_complete()
860 wake_up(&i2c->wait); in i2c_pxa_master_complete()
888 (!((i2c->msg->flags & I2C_M_IGNORE_NAK) && in i2c_pxa_irq_txempty()
893 * I2C bus error - either the device NAK'd us, or in i2c_pxa_irq_txempty()
898 if (i2c->msg_ptr == 0 && i2c->msg_idx == 0) in i2c_pxa_irq_txempty()
909 if (i2c->msg_ptr == i2c->msg->len - 1 && in i2c_pxa_irq_txempty()
910 i2c->msg_idx == i2c->msg_num - 1) in i2c_pxa_irq_txempty()
914 } else if (i2c->msg_ptr < i2c->msg->len) { in i2c_pxa_irq_txempty()
918 writel(i2c->msg->buf[i2c->msg_ptr++], _IDBR(i2c)); in i2c_pxa_irq_txempty()
926 if ((i2c->msg_ptr == i2c->msg->len) && in i2c_pxa_irq_txempty()
927 ((i2c->msg->flags & I2C_M_STOP) || in i2c_pxa_irq_txempty()
928 (i2c->msg_idx == i2c->msg_num - 1))) in i2c_pxa_irq_txempty()
931 } else if (i2c->msg_idx < i2c->msg_num - 1) { in i2c_pxa_irq_txempty()
935 i2c->msg_ptr = 0; in i2c_pxa_irq_txempty()
936 i2c->msg_idx ++; in i2c_pxa_irq_txempty()
937 i2c->msg++; in i2c_pxa_irq_txempty()
944 if (i2c->msg->flags & I2C_M_NOSTART) in i2c_pxa_irq_txempty()
950 i2c->req_slave_addr = i2c_8bit_addr_from_msg(i2c->msg); in i2c_pxa_irq_txempty()
951 writel(i2c->req_slave_addr, _IDBR(i2c)); in i2c_pxa_irq_txempty()
959 if (i2c->msg->len == 0) in i2c_pxa_irq_txempty()
964 i2c->icrlog[i2c->irqlogidx-1] = icr; in i2c_pxa_irq_txempty()
977 i2c->msg->buf[i2c->msg_ptr++] = readl(_IDBR(i2c)); in i2c_pxa_irq_rxfull()
979 if (i2c->msg_ptr < i2c->msg->len) { in i2c_pxa_irq_rxfull()
984 if (i2c->msg_ptr == i2c->msg->len - 1) in i2c_pxa_irq_rxfull()
992 i2c->icrlog[i2c->irqlogidx-1] = icr; in i2c_pxa_irq_rxfull()
1008 dev_dbg(&i2c->adap.dev, "%s: ISR=%08x, ICR=%08x, IBMR=%02x\n", in i2c_pxa_handler()
1013 if (i2c->irqlogidx < ARRAY_SIZE(i2c->isrlog)) in i2c_pxa_handler()
1014 i2c->isrlog[i2c->irqlogidx++] = isr; in i2c_pxa_handler()
1033 } else if (i2c->msg && (!i2c->highmode_enter)) { in i2c_pxa_handler()
1038 } else if ((isr & ISR_ITE) && i2c->highmode_enter) { in i2c_pxa_handler()
1039 i2c->highmode_enter = false; in i2c_pxa_handler()
1040 wake_up(&i2c->wait); in i2c_pxa_handler()
1061 dev_err(&i2c->adap.dev, "i2c_pxa: timeout waiting for bus free\n"); in i2c_pxa_do_xfer()
1062 i2c_recover_bus(&i2c->adap); in i2c_pxa_do_xfer()
1071 dev_err(&i2c->adap.dev, "i2c_pxa_set_master: error %d\n", ret); in i2c_pxa_do_xfer()
1075 if (i2c->high_mode) { in i2c_pxa_do_xfer()
1078 dev_err(&i2c->adap.dev, "i2c_pxa_send_mastercode timeout\n"); in i2c_pxa_do_xfer()
1083 spin_lock_irq(&i2c->lock); in i2c_pxa_do_xfer()
1085 i2c->msg = msg; in i2c_pxa_do_xfer()
1086 i2c->msg_num = num; in i2c_pxa_do_xfer()
1087 i2c->msg_idx = 0; in i2c_pxa_do_xfer()
1088 i2c->msg_ptr = 0; in i2c_pxa_do_xfer()
1089 i2c->irqlogidx = 0; in i2c_pxa_do_xfer()
1093 spin_unlock_irq(&i2c->lock); in i2c_pxa_do_xfer()
1098 time_left = wait_event_timeout(i2c->wait, i2c->msg_num == 0, HZ * 5); in i2c_pxa_do_xfer()
1102 * We place the return code in i2c->msg_idx. in i2c_pxa_do_xfer()
1104 ret = i2c->msg_idx; in i2c_pxa_do_xfer()
1106 if (!time_left && i2c->msg_num) { in i2c_pxa_do_xfer()
1108 i2c_recover_bus(&i2c->adap); in i2c_pxa_do_xfer()
1127 if (++i >= i2c->adap.retries) in i2c_pxa_internal_xfer()
1131 dev_dbg(&i2c->adap.dev, "Retrying transmission\n"); in i2c_pxa_internal_xfer()
1136 ret = -EREMOTEIO; in i2c_pxa_internal_xfer()
1145 struct pxa_i2c *i2c = adap->algo_data; in i2c_pxa_xfer()
1165 /* Non-interrupt mode support */
1174 while (timeout-- && readl(_ISR(i2c)) & (ISR_IBB | ISR_UB)) in i2c_pxa_pio_set_master()
1179 dev_err(&i2c->adap.dev, in i2c_pxa_pio_set_master()
1202 i2c->msg = msg; in i2c_pxa_do_pio_xfer()
1203 i2c->msg_num = num; in i2c_pxa_do_pio_xfer()
1204 i2c->msg_idx = 0; in i2c_pxa_do_pio_xfer()
1205 i2c->msg_ptr = 0; in i2c_pxa_do_pio_xfer()
1206 i2c->irqlogidx = 0; in i2c_pxa_do_pio_xfer()
1210 while (i2c->msg_num > 0 && --timeout) { in i2c_pxa_do_pio_xfer()
1218 * We place the return code in i2c->msg_idx. in i2c_pxa_do_pio_xfer()
1220 ret = i2c->msg_idx; in i2c_pxa_do_pio_xfer()
1234 struct pxa_i2c *i2c = adap->algo_data; in i2c_pxa_pio_xfer()
1258 struct device_node *np = pdev->dev.of_node; in i2c_pxa_probe_dt()
1260 if (!pdev->dev.of_node) in i2c_pxa_probe_dt()
1263 /* For device tree we always use the dynamic or alias-assigned ID */ in i2c_pxa_probe_dt()
1264 i2c->adap.nr = -1; in i2c_pxa_probe_dt()
1266 i2c->use_pio = of_property_read_bool(np, "mrvl,i2c-polling"); in i2c_pxa_probe_dt()
1267 i2c->fast_mode = of_property_read_bool(np, "mrvl,i2c-fast-mode"); in i2c_pxa_probe_dt()
1269 *i2c_types = (enum pxa_i2c_types)device_get_match_data(&pdev->dev); in i2c_pxa_probe_dt()
1278 struct i2c_pxa_platform_data *plat = dev_get_platdata(&pdev->dev); in i2c_pxa_probe_pdata()
1281 *i2c_types = id->driver_data; in i2c_pxa_probe_pdata()
1283 i2c->use_pio = plat->use_pio; in i2c_pxa_probe_pdata()
1284 i2c->fast_mode = plat->fast_mode; in i2c_pxa_probe_pdata()
1285 i2c->high_mode = plat->high_mode; in i2c_pxa_probe_pdata()
1286 i2c->master_code = plat->master_code; in i2c_pxa_probe_pdata()
1287 if (!i2c->master_code) in i2c_pxa_probe_pdata()
1288 i2c->master_code = 0xe; in i2c_pxa_probe_pdata()
1289 i2c->rate = plat->rate; in i2c_pxa_probe_pdata()
1296 struct pxa_i2c *i2c = adap->algo_data; in i2c_pxa_prepare_recovery()
1303 gpiod_set_value(i2c->recovery.scl_gpiod, ibmr & IBMR_SCLS); in i2c_pxa_prepare_recovery()
1304 gpiod_set_value(i2c->recovery.sda_gpiod, ibmr & IBMR_SDAS); in i2c_pxa_prepare_recovery()
1306 WARN_ON(pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_recovery)); in i2c_pxa_prepare_recovery()
1311 struct pxa_i2c *i2c = adap->algo_data; in i2c_pxa_unprepare_recovery()
1320 dev_dbg(&i2c->adap.dev, in i2c_pxa_unprepare_recovery()
1325 WARN_ON(pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_default)); in i2c_pxa_unprepare_recovery()
1327 dev_dbg(&i2c->adap.dev, "recovery: IBMR 0x%08x ISR 0x%08x\n", in i2c_pxa_unprepare_recovery()
1335 struct i2c_bus_recovery_info *bri = &i2c->recovery; in i2c_pxa_init_recovery()
1336 struct device *dev = i2c->adap.dev.parent; in i2c_pxa_init_recovery()
1347 i2c->pinctrl = devm_pinctrl_get(dev); in i2c_pxa_init_recovery()
1348 if (PTR_ERR(i2c->pinctrl) == -ENODEV) in i2c_pxa_init_recovery()
1349 i2c->pinctrl = NULL; in i2c_pxa_init_recovery()
1350 if (IS_ERR(i2c->pinctrl)) in i2c_pxa_init_recovery()
1351 return PTR_ERR(i2c->pinctrl); in i2c_pxa_init_recovery()
1353 if (!i2c->pinctrl) in i2c_pxa_init_recovery()
1356 i2c->pinctrl_default = pinctrl_lookup_state(i2c->pinctrl, in i2c_pxa_init_recovery()
1358 i2c->pinctrl_recovery = pinctrl_lookup_state(i2c->pinctrl, "recovery"); in i2c_pxa_init_recovery()
1360 if (IS_ERR(i2c->pinctrl_default) || IS_ERR(i2c->pinctrl_recovery)) { in i2c_pxa_init_recovery()
1362 PTR_ERR(i2c->pinctrl_default), in i2c_pxa_init_recovery()
1363 PTR_ERR(i2c->pinctrl_recovery)); in i2c_pxa_init_recovery()
1371 bri->scl_gpiod = devm_gpiod_get(dev, "scl", GPIOD_OUT_HIGH_OPEN_DRAIN); in i2c_pxa_init_recovery()
1372 if (bri->scl_gpiod == ERR_PTR(-EPROBE_DEFER)) in i2c_pxa_init_recovery()
1373 return -EPROBE_DEFER; in i2c_pxa_init_recovery()
1374 if (IS_ERR(bri->scl_gpiod)) { in i2c_pxa_init_recovery()
1375 dev_info(dev, "missing scl gpio recovery information: %pe\n", in i2c_pxa_init_recovery()
1376 bri->scl_gpiod); in i2c_pxa_init_recovery()
1384 gpiod_direction_output(bri->scl_gpiod, 0); in i2c_pxa_init_recovery()
1386 bri->sda_gpiod = devm_gpiod_get(dev, "sda", GPIOD_OUT_HIGH_OPEN_DRAIN); in i2c_pxa_init_recovery()
1390 gpiod_direction_output(bri->scl_gpiod, 1); in i2c_pxa_init_recovery()
1392 if (bri->sda_gpiod == ERR_PTR(-EPROBE_DEFER)) in i2c_pxa_init_recovery()
1393 return -EPROBE_DEFER; in i2c_pxa_init_recovery()
1395 if (IS_ERR(bri->sda_gpiod)) { in i2c_pxa_init_recovery()
1396 dev_info(dev, "missing sda gpio recovery information: %pe\n", in i2c_pxa_init_recovery()
1397 bri->sda_gpiod); in i2c_pxa_init_recovery()
1401 bri->prepare_recovery = i2c_pxa_prepare_recovery; in i2c_pxa_init_recovery()
1402 bri->unprepare_recovery = i2c_pxa_unprepare_recovery; in i2c_pxa_init_recovery()
1403 bri->recover_bus = i2c_generic_scl_recovery; in i2c_pxa_init_recovery()
1405 i2c->adap.bus_recovery_info = bri; in i2c_pxa_init_recovery()
1410 * by the pinmux change caused by claiming the GPIO. Work around that in i2c_pxa_init_recovery()
1411 * by switching pinctrl to the GPIO state here. We do it this way to in i2c_pxa_init_recovery()
1414 pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_recovery); in i2c_pxa_init_recovery()
1416 return pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_default); in i2c_pxa_init_recovery()
1421 struct i2c_pxa_platform_data *plat = dev_get_platdata(&dev->dev); in i2c_pxa_probe()
1427 i2c = devm_kzalloc(&dev->dev, sizeof(struct pxa_i2c), GFP_KERNEL); in i2c_pxa_probe()
1429 return -ENOMEM; in i2c_pxa_probe()
1432 i2c->adap.nr = dev->id; in i2c_pxa_probe()
1433 i2c->adap.owner = THIS_MODULE; in i2c_pxa_probe()
1434 i2c->adap.retries = 5; in i2c_pxa_probe()
1435 i2c->adap.algo_data = i2c; in i2c_pxa_probe()
1436 i2c->adap.dev.parent = &dev->dev; in i2c_pxa_probe()
1438 i2c->adap.dev.of_node = dev->dev.of_node; in i2c_pxa_probe()
1441 i2c->reg_base = devm_platform_get_and_ioremap_resource(dev, 0, &res); in i2c_pxa_probe()
1442 if (IS_ERR(i2c->reg_base)) in i2c_pxa_probe()
1443 return PTR_ERR(i2c->reg_base); in i2c_pxa_probe()
1459 spin_lock_init(&i2c->lock); in i2c_pxa_probe()
1460 init_waitqueue_head(&i2c->wait); in i2c_pxa_probe()
1462 strscpy(i2c->adap.name, "pxa_i2c-i2c", sizeof(i2c->adap.name)); in i2c_pxa_probe()
1464 i2c->clk = devm_clk_get(&dev->dev, NULL); in i2c_pxa_probe()
1465 if (IS_ERR(i2c->clk)) in i2c_pxa_probe()
1466 return dev_err_probe(&dev->dev, PTR_ERR(i2c->clk), in i2c_pxa_probe()
1469 i2c->reg_ibmr = i2c->reg_base + pxa_reg_layout[i2c_type].ibmr; in i2c_pxa_probe()
1470 i2c->reg_idbr = i2c->reg_base + pxa_reg_layout[i2c_type].idbr; in i2c_pxa_probe()
1471 i2c->reg_icr = i2c->reg_base + pxa_reg_layout[i2c_type].icr; in i2c_pxa_probe()
1472 i2c->reg_isr = i2c->reg_base + pxa_reg_layout[i2c_type].isr; in i2c_pxa_probe()
1473 i2c->fm_mask = pxa_reg_layout[i2c_type].fm; in i2c_pxa_probe()
1474 i2c->hs_mask = pxa_reg_layout[i2c_type].hs; in i2c_pxa_probe()
1477 i2c->reg_isar = i2c->reg_base + pxa_reg_layout[i2c_type].isar; in i2c_pxa_probe()
1480 i2c->reg_ilcr = i2c->reg_base + pxa_reg_layout[i2c_type].ilcr; in i2c_pxa_probe()
1481 i2c->reg_iwcr = i2c->reg_base + pxa_reg_layout[i2c_type].iwcr; in i2c_pxa_probe()
1484 i2c->iobase = res->start; in i2c_pxa_probe()
1485 i2c->iosize = resource_size(res); in i2c_pxa_probe()
1487 i2c->irq = irq; in i2c_pxa_probe()
1489 i2c->slave_addr = I2C_PXA_SLAVE_ADDR; in i2c_pxa_probe()
1490 i2c->highmode_enter = false; in i2c_pxa_probe()
1493 i2c->adap.class = plat->class; in i2c_pxa_probe()
1496 if (i2c->high_mode) { in i2c_pxa_probe()
1497 if (i2c->rate) { in i2c_pxa_probe()
1498 clk_set_rate(i2c->clk, i2c->rate); in i2c_pxa_probe()
1500 i2c->adap.name, clk_get_rate(i2c->clk)); in i2c_pxa_probe()
1503 i2c->adap.name); in i2c_pxa_probe()
1506 clk_prepare_enable(i2c->clk); in i2c_pxa_probe()
1508 if (i2c->use_pio) { in i2c_pxa_probe()
1509 i2c->adap.algo = &i2c_pxa_pio_algorithm; in i2c_pxa_probe()
1511 i2c->adap.algo = &i2c_pxa_algorithm; in i2c_pxa_probe()
1512 ret = devm_request_irq(&dev->dev, irq, i2c_pxa_handler, in i2c_pxa_probe()
1514 dev_name(&dev->dev), i2c); in i2c_pxa_probe()
1516 dev_err(&dev->dev, "failed to request irq: %d\n", ret); in i2c_pxa_probe()
1523 ret = i2c_add_numbered_adapter(&i2c->adap); in i2c_pxa_probe()
1530 dev_info(&i2c->adap.dev, " PXA I2C adapter, slave address %d\n", in i2c_pxa_probe()
1531 i2c->slave_addr); in i2c_pxa_probe()
1533 dev_info(&i2c->adap.dev, " PXA I2C adapter\n"); in i2c_pxa_probe()
1538 clk_disable_unprepare(i2c->clk); in i2c_pxa_probe()
1546 i2c_del_adapter(&i2c->adap); in i2c_pxa_remove()
1548 clk_disable_unprepare(i2c->clk); in i2c_pxa_remove()
1555 clk_disable(i2c->clk); in i2c_pxa_suspend_noirq()
1564 clk_enable(i2c->clk); in i2c_pxa_resume_noirq()
1579 .name = "pxa2xx-i2c",