aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/i2c.c
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2012-12-12 19:10:45 -0500
committerOlof Johansson <olof@lixom.net>2012-12-12 19:10:45 -0500
commit9c7466b217af784280d9fc841bbd559ef3bf33e9 (patch)
treec21ee243e48912201b4041fbf3f9bd9165603bd8 /arch/arm/plat-omap/i2c.c
parent4a76411ea3f1da9032e031f8fff8894b97d141b2 (diff)
parent48d224d1efec98b0b78e511150b4f5752beceb7c (diff)
ARM: arm-soc: Merge branch 'next/pm2' into next/pm
Another smaller branch merged into next/pm before pull request. Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm/plat-omap/i2c.c')
-rw-r--r--arch/arm/plat-omap/i2c.c30
1 files changed, 4 insertions, 26 deletions
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index be6deb7c12ec..f9df624d108c 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -31,34 +31,13 @@
31#include <linux/err.h> 31#include <linux/err.h>
32#include <linux/clk.h> 32#include <linux/clk.h>
33 33
34#include <mach/irqs.h> 34#include <plat/i2c.h>
35
36#include "../mach-omap1/soc.h"
37#include "../mach-omap2/soc.h"
38
39#include "i2c.h"
40 35
41#define OMAP_I2C_MAX_CONTROLLERS 4 36#define OMAP_I2C_MAX_CONTROLLERS 4
42static struct omap_i2c_bus_platform_data i2c_pdata[OMAP_I2C_MAX_CONTROLLERS]; 37static struct omap_i2c_bus_platform_data i2c_pdata[OMAP_I2C_MAX_CONTROLLERS];
43 38
44#define OMAP_I2C_CMDLINE_SETUP (BIT(31)) 39#define OMAP_I2C_CMDLINE_SETUP (BIT(31))
45 40
46static int __init omap_i2c_nr_ports(void)
47{
48 int ports = 0;
49
50 if (cpu_class_is_omap1())
51 ports = 1;
52 else if (cpu_is_omap24xx())
53 ports = 2;
54 else if (cpu_is_omap34xx())
55 ports = 3;
56 else if (cpu_is_omap44xx())
57 ports = 4;
58
59 return ports;
60}
61
62/** 41/**
63 * omap_i2c_bus_setup - Process command line options for the I2C bus speed 42 * omap_i2c_bus_setup - Process command line options for the I2C bus speed
64 * @str: String of options 43 * @str: String of options
@@ -72,12 +51,11 @@ static int __init omap_i2c_nr_ports(void)
72 */ 51 */
73static int __init omap_i2c_bus_setup(char *str) 52static int __init omap_i2c_bus_setup(char *str)
74{ 53{
75 int ports;
76 int ints[3]; 54 int ints[3];
77 55
78 ports = omap_i2c_nr_ports();
79 get_options(str, 3, ints); 56 get_options(str, 3, ints);
80 if (ints[0] < 2 || ints[1] < 1 || ints[1] > ports) 57 if (ints[0] < 2 || ints[1] < 1 ||
58 ints[1] > OMAP_I2C_MAX_CONTROLLERS)
81 return 0; 59 return 0;
82 i2c_pdata[ints[1] - 1].clkrate = ints[2]; 60 i2c_pdata[ints[1] - 1].clkrate = ints[2];
83 i2c_pdata[ints[1] - 1].clkrate |= OMAP_I2C_CMDLINE_SETUP; 61 i2c_pdata[ints[1] - 1].clkrate |= OMAP_I2C_CMDLINE_SETUP;
@@ -122,7 +100,7 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
122{ 100{
123 int err; 101 int err;
124 102
125 BUG_ON(bus_id < 1 || bus_id > omap_i2c_nr_ports()); 103 BUG_ON(bus_id < 1 || bus_id > OMAP_I2C_MAX_CONTROLLERS);
126 104
127 if (info) { 105 if (info) {
128 err = i2c_register_board_info(bus_id, info, len); 106 err = i2c_register_board_info(bus_id, info, len);