Linux Audio

Check our new training course

Loading...
v5.9
 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/page.h>
21#include <asm/mach/map.h>
22#include <asm/setup.h>
23#include <asm/memory.h>
24#include <asm/mach/arch.h>
25
26#include "hardware.h"
27#include "iop3xx.h"
28#include "irqs.h"
29
30/*
31 * Each of the I2C busses have corresponding GPIO lines, and the driver
32 * need to access these directly to drive the bus low at times.
33 */
34
35struct gpiod_lookup_table iop3xx_i2c0_gpio_lookup = {
36	.dev_id = "IOP3xx-I2C.0",
37	.table = {
38		GPIO_LOOKUP("gpio-iop", 7, "scl", GPIO_ACTIVE_HIGH),
39		GPIO_LOOKUP("gpio-iop", 6, "sda", GPIO_ACTIVE_HIGH),
40		{ }
41	},
42};
43
44struct gpiod_lookup_table iop3xx_i2c1_gpio_lookup = {
45	.dev_id = "IOP3xx-I2C.1",
46	.table = {
47		GPIO_LOOKUP("gpio-iop", 5, "scl", GPIO_ACTIVE_HIGH),
48		GPIO_LOOKUP("gpio-iop", 4, "sda", GPIO_ACTIVE_HIGH),
49		{ }
50	},
51};
52
53static struct resource iop3xx_i2c0_resources[] = {
54	[0] = {
55		.start	= 0xfffff680,
56		.end	= 0xfffff697,
57		.flags	= IORESOURCE_MEM,
58	},
59	[1] = {
60		.start	= IRQ_IOP32X_I2C_0,
61		.end	= IRQ_IOP32X_I2C_0,
62		.flags	= IORESOURCE_IRQ,
63	},
64};
65
66struct platform_device iop3xx_i2c0_device = {
67	.name		= "IOP3xx-I2C",
68	.id		= 0,
69	.num_resources	= 2,
70	.resource	= iop3xx_i2c0_resources,
71};
72
73
74static struct resource iop3xx_i2c1_resources[] = {
75	[0] = {
76		.start	= 0xfffff6a0,
77		.end	= 0xfffff6b7,
78		.flags	= IORESOURCE_MEM,
79	},
80	[1] = {
81		.start	= IRQ_IOP32X_I2C_1,
82		.end	= IRQ_IOP32X_I2C_1,
83		.flags	= IORESOURCE_IRQ,
84	}
85};
86
87struct platform_device iop3xx_i2c1_device = {
88	.name		= "IOP3xx-I2C",
89	.id		= 1,
90	.num_resources	= 2,
91	.resource	= iop3xx_i2c1_resources,
92};
v6.2
 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/page.h>
21#include <asm/mach/map.h>
22#include <asm/setup.h>
23#include <asm/memory.h>
24#include <asm/mach/arch.h>
25
26#include "hardware.h"
27#include "iop3xx.h"
28#include "irqs.h"
29
30/*
31 * Each of the I2C busses have corresponding GPIO lines, and the driver
32 * need to access these directly to drive the bus low at times.
33 */
34
35struct gpiod_lookup_table iop3xx_i2c0_gpio_lookup = {
36	.dev_id = "IOP3xx-I2C.0",
37	.table = {
38		GPIO_LOOKUP("gpio-iop", 7, "scl", GPIO_ACTIVE_HIGH),
39		GPIO_LOOKUP("gpio-iop", 6, "sda", GPIO_ACTIVE_HIGH),
40		{ }
41	},
42};
43
44struct gpiod_lookup_table iop3xx_i2c1_gpio_lookup = {
45	.dev_id = "IOP3xx-I2C.1",
46	.table = {
47		GPIO_LOOKUP("gpio-iop", 5, "scl", GPIO_ACTIVE_HIGH),
48		GPIO_LOOKUP("gpio-iop", 4, "sda", GPIO_ACTIVE_HIGH),
49		{ }
50	},
51};
52
53static struct resource iop3xx_i2c0_resources[] = {
54	[0] = {
55		.start	= 0xfffff680,
56		.end	= 0xfffff697,
57		.flags	= IORESOURCE_MEM,
58	},
59	[1] = {
60		.start	= IRQ_IOP32X_I2C_0,
61		.end	= IRQ_IOP32X_I2C_0,
62		.flags	= IORESOURCE_IRQ,
63	},
64};
65
66struct platform_device iop3xx_i2c0_device = {
67	.name		= "IOP3xx-I2C",
68	.id		= 0,
69	.num_resources	= 2,
70	.resource	= iop3xx_i2c0_resources,
71};
72
73
74static struct resource iop3xx_i2c1_resources[] = {
75	[0] = {
76		.start	= 0xfffff6a0,
77		.end	= 0xfffff6b7,
78		.flags	= IORESOURCE_MEM,
79	},
80	[1] = {
81		.start	= IRQ_IOP32X_I2C_1,
82		.end	= IRQ_IOP32X_I2C_1,
83		.flags	= IORESOURCE_IRQ,
84	}
85};
86
87struct platform_device iop3xx_i2c1_device = {
88	.name		= "IOP3xx-I2C",
89	.id		= 1,
90	.num_resources	= 2,
91	.resource	= iop3xx_i2c1_resources,
92};