aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2012-10-08 12:11:22 -0400
committerTony Lindgren <tony@atomide.com>2012-10-17 14:36:50 -0400
commit3a8761c0272c961c707e5af2eb0179adf3ef7e14 (patch)
tree101b61bd1bc57de37c52587ecaff1da4e84d7742 /arch/arm/mach-omap2
parent8599e7c58786e3aef0bdb0fa093fd5150ae8a9bc (diff)
ARM: OMAP: Split plat-omap/i2c.c into mach-omap1 and mach-omap2
There's no need to keep the device related things in the common i2c.c as omap2+ is using hwmod. Split the code to mach-omap1 and mach-omap2 parts and only leave common code to plat-omap/i2c.c. Note that as omap1 only has one i2c controller, we can now remove the old device related macros. Reviewed-by: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/board-rm680.c1
-rw-r--r--arch/arm/mach-omap2/common.h4
-rw-r--r--arch/arm/mach-omap2/i2c.c50
-rw-r--r--arch/arm/mach-omap2/i2c.h42
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c5
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c5
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_33xx_data.c4
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c4
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c3
-rw-r--r--arch/arm/mach-omap2/twl-common.c1
10 files changed, 108 insertions, 11 deletions
diff --git a/arch/arm/mach-omap2/board-rm680.c b/arch/arm/mach-omap2/board-rm680.c
index 208a7a239db5..d42ecfe56096 100644
--- a/arch/arm/mach-omap2/board-rm680.c
+++ b/arch/arm/mach-omap2/board-rm680.c
@@ -22,7 +22,6 @@
22#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24 24
25#include <plat/i2c.h>
26#include <plat/usb.h> 25#include <plat/usb.h>
27#include "gpmc.h" 26#include "gpmc.h"
28#include "common.h" 27#include "common.h"
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 7045e4d61ac3..a68b421b3f86 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -28,7 +28,9 @@
28 28
29#include <linux/irq.h> 29#include <linux/irq.h>
30#include <linux/delay.h> 30#include <linux/delay.h>
31#include <linux/i2c.h>
31#include <linux/i2c/twl.h> 32#include <linux/i2c/twl.h>
33#include <linux/i2c-omap.h>
32 34
33#include <asm/proc-fns.h> 35#include <asm/proc-fns.h>
34 36
@@ -36,6 +38,8 @@
36#include <plat/serial.h> 38#include <plat/serial.h>
37#include <plat/common.h> 39#include <plat/common.h>
38 40
41#include "i2c.h"
42
39#define OMAP_INTC_START NR_IRQS 43#define OMAP_INTC_START NR_IRQS
40 44
41#ifdef CONFIG_SOC_OMAP2420 45#ifdef CONFIG_SOC_OMAP2420
diff --git a/arch/arm/mach-omap2/i2c.c b/arch/arm/mach-omap2/i2c.c
index fc57e67b321f..9f12f63ec54d 100644
--- a/arch/arm/mach-omap2/i2c.c
+++ b/arch/arm/mach-omap2/i2c.c
@@ -19,11 +19,12 @@
19 * 19 *
20 */ 20 */
21 21
22#include <plat/i2c.h>
23#include "common.h" 22#include "common.h"
24#include <plat/omap_hwmod.h> 23#include <plat/omap_hwmod.h>
24#include <plat/omap_device.h>
25 25
26#include "mux.h" 26#include "mux.h"
27#include "i2c.h"
27 28
28/* In register I2C_CON, Bit 15 is the I2C enable bit */ 29/* In register I2C_CON, Bit 15 is the I2C enable bit */
29#define I2C_EN BIT(15) 30#define I2C_EN BIT(15)
@@ -33,7 +34,9 @@
33/* Maximum microseconds to wait for OMAP module to softreset */ 34/* Maximum microseconds to wait for OMAP module to softreset */
34#define MAX_MODULE_SOFTRESET_WAIT 10000 35#define MAX_MODULE_SOFTRESET_WAIT 10000
35 36
36void __init omap2_i2c_mux_pins(int bus_id) 37#define MAX_OMAP_I2C_HWMOD_NAME_LEN 16
38
39static void __init omap2_i2c_mux_pins(int bus_id)
37{ 40{
38 char mux_name[sizeof("i2c2_scl.i2c2_scl")]; 41 char mux_name[sizeof("i2c2_scl.i2c2_scl")];
39 42
@@ -104,3 +107,46 @@ int omap_i2c_reset(struct omap_hwmod *oh)
104 107
105 return 0; 108 return 0;
106} 109}
110
111static const char name[] = "omap_i2c";
112
113int __init omap_i2c_add_bus(struct omap_i2c_bus_platform_data *i2c_pdata,
114 int bus_id)
115{
116 int l;
117 struct omap_hwmod *oh;
118 struct platform_device *pdev;
119 char oh_name[MAX_OMAP_I2C_HWMOD_NAME_LEN];
120 struct omap_i2c_bus_platform_data *pdata;
121 struct omap_i2c_dev_attr *dev_attr;
122
123 omap2_i2c_mux_pins(bus_id);
124
125 l = snprintf(oh_name, MAX_OMAP_I2C_HWMOD_NAME_LEN, "i2c%d", bus_id);
126 WARN(l >= MAX_OMAP_I2C_HWMOD_NAME_LEN,
127 "String buffer overflow in I2C%d device setup\n", bus_id);
128 oh = omap_hwmod_lookup(oh_name);
129 if (!oh) {
130 pr_err("Could not look up %s\n", oh_name);
131 return -EEXIST;
132 }
133
134 pdata = i2c_pdata;
135 /*
136 * pass the hwmod class's CPU-specific knowledge of I2C IP revision in
137 * use, and functionality implementation flags, up to the OMAP I2C
138 * driver via platform data
139 */
140 pdata->rev = oh->class->rev;
141
142 dev_attr = (struct omap_i2c_dev_attr *)oh->dev_attr;
143 pdata->flags = dev_attr->flags;
144
145 pdev = omap_device_build(name, bus_id, oh, pdata,
146 sizeof(struct omap_i2c_bus_platform_data),
147 NULL, 0, 0);
148 WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name);
149
150 return PTR_RET(pdev);
151}
152
diff --git a/arch/arm/mach-omap2/i2c.h b/arch/arm/mach-omap2/i2c.h
new file mode 100644
index 000000000000..81dbb992a6bc
--- /dev/null
+++ b/arch/arm/mach-omap2/i2c.h
@@ -0,0 +1,42 @@
1/*
2 * Helper module for board specific I2C bus registration
3 *
4 * Copyright (C) 2009 Nokia Corporation.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 *
20 */
21
22#include "../plat-omap/i2c.h"
23
24#ifndef __MACH_OMAP2_I2C_H
25#define __MACH_OMAP2_I2C_H
26
27/**
28 * i2c_dev_attr - OMAP I2C controller device attributes for omap_hwmod
29 * @fifo_depth: total controller FIFO size (in bytes)
30 * @flags: differences in hardware support capability
31 *
32 * @fifo_depth represents what exists on the hardware, not what is
33 * actually configured at runtime by the device driver.
34 */
35struct omap_i2c_dev_attr {
36 u8 fifo_depth;
37 u32 flags;
38};
39
40int omap_i2c_reset(struct omap_hwmod *oh);
41
42#endif /* __MACH_OMAP2_I2C_H */
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index 80bbbee57649..95a0053b6ae1 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -12,12 +12,12 @@
12 * XXX handle crossbar/shared link difference for L3? 12 * XXX handle crossbar/shared link difference for L3?
13 * XXX these should be marked initdata for multi-OMAP kernels 13 * XXX these should be marked initdata for multi-OMAP kernels
14 */ 14 */
15
16#include <linux/i2c-omap.h>
15#include <linux/platform_data/spi-omap2-mcspi.h> 17#include <linux/platform_data/spi-omap2-mcspi.h>
16 18
17#include <plat/omap_hwmod.h> 19#include <plat/omap_hwmod.h>
18#include <plat-omap/dma-omap.h> 20#include <plat-omap/dma-omap.h>
19#include <plat/serial.h>
20#include <plat/i2c.h>
21#include <plat/dmtimer.h> 21#include <plat/dmtimer.h>
22#include "l3_2xxx.h" 22#include "l3_2xxx.h"
23#include "l4_2xxx.h" 23#include "l4_2xxx.h"
@@ -26,6 +26,7 @@
26 26
27#include "cm-regbits-24xx.h" 27#include "cm-regbits-24xx.h"
28#include "prm-regbits-24xx.h" 28#include "prm-regbits-24xx.h"
29#include "i2c.h"
29#include "mmc.h" 30#include "mmc.h"
30#include "wd_timer.h" 31#include "wd_timer.h"
31 32
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index dff04f948a2f..a6c24aea28b6 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -12,13 +12,13 @@
12 * XXX handle crossbar/shared link difference for L3? 12 * XXX handle crossbar/shared link difference for L3?
13 * XXX these should be marked initdata for multi-OMAP kernels 13 * XXX these should be marked initdata for multi-OMAP kernels
14 */ 14 */
15
16#include <linux/i2c-omap.h>
15#include <linux/platform_data/asoc-ti-mcbsp.h> 17#include <linux/platform_data/asoc-ti-mcbsp.h>
16#include <linux/platform_data/spi-omap2-mcspi.h> 18#include <linux/platform_data/spi-omap2-mcspi.h>
17 19
18#include <plat/omap_hwmod.h> 20#include <plat/omap_hwmod.h>
19#include <plat-omap/dma-omap.h> 21#include <plat-omap/dma-omap.h>
20#include <plat/serial.h>
21#include <plat/i2c.h>
22#include <plat/dmtimer.h> 22#include <plat/dmtimer.h>
23#include "mmc.h" 23#include "mmc.h"
24#include "l3_2xxx.h" 24#include "l3_2xxx.h"
@@ -27,6 +27,7 @@
27#include "omap_hwmod_common_data.h" 27#include "omap_hwmod_common_data.h"
28#include "prm-regbits-24xx.h" 28#include "prm-regbits-24xx.h"
29#include "cm-regbits-24xx.h" 29#include "cm-regbits-24xx.h"
30#include "i2c.h"
30#include "wd_timer.h" 31#include "wd_timer.h"
31 32
32/* 33/*
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
index 44a661882a7e..cb7c393c08de 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
@@ -14,11 +14,12 @@
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 */ 15 */
16 16
17#include <linux/i2c-omap.h>
18
17#include <plat/omap_hwmod.h> 19#include <plat/omap_hwmod.h>
18#include <plat/cpu.h> 20#include <plat/cpu.h>
19#include <linux/platform_data/gpio-omap.h> 21#include <linux/platform_data/gpio-omap.h>
20#include <linux/platform_data/spi-omap2-mcspi.h> 22#include <linux/platform_data/spi-omap2-mcspi.h>
21#include <plat/i2c.h>
22 23
23#include "omap_hwmod_common_data.h" 24#include "omap_hwmod_common_data.h"
24 25
@@ -26,6 +27,7 @@
26#include "cm33xx.h" 27#include "cm33xx.h"
27#include "prm33xx.h" 28#include "prm33xx.h"
28#include "prm-regbits-33xx.h" 29#include "prm-regbits-33xx.h"
30#include "i2c.h"
29#include "mmc.h" 31#include "mmc.h"
30 32
31/* 33/*
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 2aaf3ce80626..14451217dac2 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -14,6 +14,8 @@
14 * 14 *
15 * XXX these should be marked initdata for multi-OMAP kernels 15 * XXX these should be marked initdata for multi-OMAP kernels
16 */ 16 */
17
18#include <linux/i2c-omap.h>
17#include <linux/power/smartreflex.h> 19#include <linux/power/smartreflex.h>
18#include <linux/platform_data/gpio-omap.h> 20#include <linux/platform_data/gpio-omap.h>
19 21
@@ -22,7 +24,6 @@
22#include <plat/serial.h> 24#include <plat/serial.h>
23#include "l3_3xxx.h" 25#include "l3_3xxx.h"
24#include "l4_3xxx.h" 26#include "l4_3xxx.h"
25#include <plat/i2c.h>
26#include <linux/platform_data/asoc-ti-mcbsp.h> 27#include <linux/platform_data/asoc-ti-mcbsp.h>
27#include <linux/platform_data/spi-omap2-mcspi.h> 28#include <linux/platform_data/spi-omap2-mcspi.h>
28#include <plat/dmtimer.h> 29#include <plat/dmtimer.h>
@@ -36,6 +37,7 @@
36#include "cm-regbits-34xx.h" 37#include "cm-regbits-34xx.h"
37 38
38#include "dma.h" 39#include "dma.h"
40#include "i2c.h"
39#include "mmc.h" 41#include "mmc.h"
40#include "wd_timer.h" 42#include "wd_timer.h"
41 43
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index f47a57fa1f3a..2c736cd2bea1 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -21,9 +21,9 @@
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/platform_data/gpio-omap.h> 22#include <linux/platform_data/gpio-omap.h>
23#include <linux/power/smartreflex.h> 23#include <linux/power/smartreflex.h>
24#include <linux/i2c-omap.h>
24 25
25#include <plat/omap_hwmod.h> 26#include <plat/omap_hwmod.h>
26#include <plat/i2c.h>
27#include <plat-omap/dma-omap.h> 27#include <plat-omap/dma-omap.h>
28#include <linux/platform_data/spi-omap2-mcspi.h> 28#include <linux/platform_data/spi-omap2-mcspi.h>
29#include <linux/platform_data/asoc-ti-mcbsp.h> 29#include <linux/platform_data/asoc-ti-mcbsp.h>
@@ -36,6 +36,7 @@
36#include "cm2_44xx.h" 36#include "cm2_44xx.h"
37#include "prm44xx.h" 37#include "prm44xx.h"
38#include "prm-regbits-44xx.h" 38#include "prm-regbits-44xx.h"
39#include "i2c.h"
39#include "mmc.h" 40#include "mmc.h"
40#include "wd_timer.h" 41#include "wd_timer.h"
41 42
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index 635e109f5ad3..1a0739d397f3 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -26,7 +26,6 @@
26#include <linux/regulator/machine.h> 26#include <linux/regulator/machine.h>
27#include <linux/regulator/fixed.h> 27#include <linux/regulator/fixed.h>
28 28
29#include <plat/i2c.h>
30#include <plat/usb.h> 29#include <plat/usb.h>
31 30
32#include "soc.h" 31#include "soc.h"