]> git.ipfire.org Git - people/ms/linux.git/blob - arch/arm/plat-iop/i2c.c
Merge branch 'i2c/for-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
[people/ms/linux.git] / arch / arm / plat-iop / i2c.c
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * arch/arm/plat-iop/i2c.c
4 *
5 * Author: Nicolas Pitre <nico@cam.org>
6 * Copyright (C) 2001 MontaVista Software, Inc.
7 * Copyright (C) 2004 Intel Corporation.
8 */
9
10 #include <linux/mm.h>
11 #include <linux/init.h>
12 #include <linux/major.h>
13 #include <linux/fs.h>
14 #include <linux/platform_device.h>
15 #include <linux/serial.h>
16 #include <linux/tty.h>
17 #include <linux/serial_core.h>
18 #include <linux/io.h>
19 #include <linux/gpio/machine.h>
20 #include <asm/pgtable.h>
21 #include <asm/page.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>
28
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
32 #endif
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
36 #endif
37
38 /*
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.
41 */
42
43 struct gpiod_lookup_table iop3xx_i2c0_gpio_lookup = {
44 .dev_id = "IOP3xx-I2C.0",
45 .table = {
46 GPIO_LOOKUP("gpio-iop", 7, "scl", GPIO_ACTIVE_HIGH),
47 GPIO_LOOKUP("gpio-iop", 6, "sda", GPIO_ACTIVE_HIGH),
48 { }
49 },
50 };
51
52 struct gpiod_lookup_table iop3xx_i2c1_gpio_lookup = {
53 .dev_id = "IOP3xx-I2C.1",
54 .table = {
55 GPIO_LOOKUP("gpio-iop", 5, "scl", GPIO_ACTIVE_HIGH),
56 GPIO_LOOKUP("gpio-iop", 4, "sda", GPIO_ACTIVE_HIGH),
57 { }
58 },
59 };
60
61 static struct resource iop3xx_i2c0_resources[] = {
62 [0] = {
63 .start = 0xfffff680,
64 .end = 0xfffff697,
65 .flags = IORESOURCE_MEM,
66 },
67 [1] = {
68 .start = IRQ_IOP3XX_I2C_0,
69 .end = IRQ_IOP3XX_I2C_0,
70 .flags = IORESOURCE_IRQ,
71 },
72 };
73
74 struct platform_device iop3xx_i2c0_device = {
75 .name = "IOP3xx-I2C",
76 .id = 0,
77 .num_resources = 2,
78 .resource = iop3xx_i2c0_resources,
79 };
80
81
82 static struct resource iop3xx_i2c1_resources[] = {
83 [0] = {
84 .start = 0xfffff6a0,
85 .end = 0xfffff6b7,
86 .flags = IORESOURCE_MEM,
87 },
88 [1] = {
89 .start = IRQ_IOP3XX_I2C_1,
90 .end = IRQ_IOP3XX_I2C_1,
91 .flags = IORESOURCE_IRQ,
92 }
93 };
94
95 struct platform_device iop3xx_i2c1_device = {
96 .name = "IOP3xx-I2C",
97 .id = 1,
98 .num_resources = 2,
99 .resource = iop3xx_i2c1_resources,
100 };