1 // SPDX-License-Identifier: GPL-2.0-only
3 * arch/arm/plat-iop/i2c.c
5 * Author: Nicolas Pitre <nico@cam.org>
6 * Copyright (C) 2001 MontaVista Software, Inc.
7 * Copyright (C) 2004 Intel Corporation.
11 #include <linux/init.h>
12 #include <linux/major.h>
14 #include <linux/platform_device.h>
15 #include <linux/serial.h>
16 #include <linux/tty.h>
17 #include <linux/serial_core.h>
19 #include <linux/gpio/machine.h>
20 #include <asm/pgtable.h>
22 #include <asm/mach/map.h>
23 #include <asm/setup.h>
24 #include <asm/memory.h>
25 #include <mach/hardware.h>
26 #include <asm/hardware/iop3xx.h>
27 #include <asm/mach/arch.h>
29 #ifdef CONFIG_ARCH_IOP32X
30 #define IRQ_IOP3XX_I2C_0 IRQ_IOP32X_I2C_0
31 #define IRQ_IOP3XX_I2C_1 IRQ_IOP32X_I2C_1
33 #ifdef CONFIG_ARCH_IOP33X
34 #define IRQ_IOP3XX_I2C_0 IRQ_IOP33X_I2C_0
35 #define IRQ_IOP3XX_I2C_1 IRQ_IOP33X_I2C_1
39 * Each of the I2C busses have corresponding GPIO lines, and the driver
40 * need to access these directly to drive the bus low at times.
43 struct gpiod_lookup_table iop3xx_i2c0_gpio_lookup = {
44 .dev_id = "IOP3xx-I2C.0",
46 GPIO_LOOKUP("gpio-iop", 7, "scl", GPIO_ACTIVE_HIGH),
47 GPIO_LOOKUP("gpio-iop", 6, "sda", GPIO_ACTIVE_HIGH),
52 struct gpiod_lookup_table iop3xx_i2c1_gpio_lookup = {
53 .dev_id = "IOP3xx-I2C.1",
55 GPIO_LOOKUP("gpio-iop", 5, "scl", GPIO_ACTIVE_HIGH),
56 GPIO_LOOKUP("gpio-iop", 4, "sda", GPIO_ACTIVE_HIGH),
61 static struct resource iop3xx_i2c0_resources[] = {
65 .flags = IORESOURCE_MEM,
68 .start = IRQ_IOP3XX_I2C_0,
69 .end = IRQ_IOP3XX_I2C_0,
70 .flags = IORESOURCE_IRQ,
74 struct platform_device iop3xx_i2c0_device = {
78 .resource = iop3xx_i2c0_resources,
82 static struct resource iop3xx_i2c1_resources[] = {
86 .flags = IORESOURCE_MEM,
89 .start = IRQ_IOP3XX_I2C_1,
90 .end = IRQ_IOP3XX_I2C_1,
91 .flags = IORESOURCE_IRQ,
95 struct platform_device iop3xx_i2c1_device = {
99 .resource = iop3xx_i2c1_resources,