diff options
author | Tony Lindgren <tony@atomide.com> | 2012-10-08 12:11:22 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2012-10-17 14:36:50 -0400 |
commit | 3a8761c0272c961c707e5af2eb0179adf3ef7e14 (patch) | |
tree | 101b61bd1bc57de37c52587ecaff1da4e84d7742 /arch/arm/mach-omap1/i2c.c | |
parent | 8599e7c58786e3aef0bdb0fa093fd5150ae8a9bc (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-omap1/i2c.c')
-rw-r--r-- | arch/arm/mach-omap1/i2c.c | 59 |
1 files changed, 57 insertions, 2 deletions
diff --git a/arch/arm/mach-omap1/i2c.c b/arch/arm/mach-omap1/i2c.c index a0551a6d7451..a6f465a44642 100644 --- a/arch/arm/mach-omap1/i2c.c +++ b/arch/arm/mach-omap1/i2c.c | |||
@@ -19,11 +19,25 @@ | |||
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <plat/i2c.h> | 22 | #include <linux/i2c-omap.h> |
23 | #include <mach/mux.h> | 23 | #include <mach/mux.h> |
24 | #include <plat/cpu.h> | 24 | #include <plat/cpu.h> |
25 | 25 | ||
26 | void __init omap1_i2c_mux_pins(int bus_id) | 26 | #include "../plat-omap/i2c.h" |
27 | |||
28 | #define OMAP_I2C_SIZE 0x3f | ||
29 | #define OMAP1_I2C_BASE 0xfffb3800 | ||
30 | #define OMAP1_INT_I2C (32 + 4) | ||
31 | |||
32 | static const char name[] = "omap_i2c"; | ||
33 | |||
34 | static struct resource i2c_resources[2] = { | ||
35 | }; | ||
36 | |||
37 | static struct platform_device omap_i2c_devices[1] = { | ||
38 | }; | ||
39 | |||
40 | static void __init omap1_i2c_mux_pins(int bus_id) | ||
27 | { | 41 | { |
28 | if (cpu_is_omap7xx()) { | 42 | if (cpu_is_omap7xx()) { |
29 | omap_cfg_reg(I2C_7XX_SDA); | 43 | omap_cfg_reg(I2C_7XX_SDA); |
@@ -33,3 +47,44 @@ void __init omap1_i2c_mux_pins(int bus_id) | |||
33 | omap_cfg_reg(I2C_SCL); | 47 | omap_cfg_reg(I2C_SCL); |
34 | } | 48 | } |
35 | } | 49 | } |
50 | |||
51 | int __init omap_i2c_add_bus(struct omap_i2c_bus_platform_data *pdata, | ||
52 | int bus_id) | ||
53 | { | ||
54 | struct platform_device *pdev; | ||
55 | struct resource *res; | ||
56 | |||
57 | omap1_i2c_mux_pins(bus_id); | ||
58 | |||
59 | pdev = &omap_i2c_devices[bus_id - 1]; | ||
60 | pdev->id = bus_id; | ||
61 | pdev->name = name; | ||
62 | pdev->num_resources = ARRAY_SIZE(i2c_resources); | ||
63 | res = i2c_resources; | ||
64 | res[0].start = OMAP1_I2C_BASE; | ||
65 | res[0].end = res[0].start + OMAP_I2C_SIZE; | ||
66 | res[0].flags = IORESOURCE_MEM; | ||
67 | res[1].start = OMAP1_INT_I2C; | ||
68 | res[1].flags = IORESOURCE_IRQ; | ||
69 | pdev->resource = res; | ||
70 | |||
71 | /* all OMAP1 have IP version 1 register set */ | ||
72 | pdata->rev = OMAP_I2C_IP_VERSION_1; | ||
73 | |||
74 | /* all OMAP1 I2C are implemented like this */ | ||
75 | pdata->flags = OMAP_I2C_FLAG_NO_FIFO | | ||
76 | OMAP_I2C_FLAG_SIMPLE_CLOCK | | ||
77 | OMAP_I2C_FLAG_16BIT_DATA_REG | | ||
78 | OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK; | ||
79 | |||
80 | /* how the cpu bus is wired up differs for 7xx only */ | ||
81 | |||
82 | if (cpu_is_omap7xx()) | ||
83 | pdata->flags |= OMAP_I2C_FLAG_BUS_SHIFT_1; | ||
84 | else | ||
85 | pdata->flags |= OMAP_I2C_FLAG_BUS_SHIFT_2; | ||
86 | |||
87 | pdev->dev.platform_data = pdata; | ||
88 | |||
89 | return platform_device_register(pdev); | ||
90 | } | ||