diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-12 14:51:39 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-12 14:51:39 -0500 |
commit | d01e4afdbb65e030fd6f1f96c30a558e2eb0f279 (patch) | |
tree | 02ef82b2740cf93a98199eded5ef765fa6e03052 /drivers/i2c | |
parent | 8287361abca36504da813638310d2547469283eb (diff) | |
parent | 794b175fc0c0c4844dbb7b137a73bbfd01f6c608 (diff) |
Merge tag 'cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC cleanups on various subarchitectures from Olof Johansson:
"Cleanup patches for various ARM platforms and some of their associated
drivers. There's also a branch in here that enables Freescale i.MX to
be part of the multiplatform support -- the first "big" SoC that is
moved over (more multiplatform work comes in a separate branch later
during the merge window)."
Conflicts fixed as per Olof, including a silent semantic one in
arch/arm/mach-omap2/board-generic.c (omap_prcm_restart() was renamed to
omap3xxx_restart(), and a new user of the old name was added).
* tag 'cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (189 commits)
ARM: omap: fix typo on timer cleanup
ARM: EXYNOS: Remove unused regs-mem.h file
ARM: EXYNOS: Remove unused non-dt support for dwmci controller
ARM: Kirkwood: Use hw_pci.ops instead of hw_pci.scan
ARM: OMAP3: cm-t3517: use GPTIMER for system clock
ARM: OMAP2+: timer: remove CONFIG_OMAP_32K_TIMER
ARM: SAMSUNG: use devm_ functions for ADC driver
ARM: EXYNOS: no duplicate mask/unmask in eint0_15
ARM: S3C24XX: SPI clock channel setup is fixed for S3C2443
ARM: EXYNOS: Remove i2c0 resource information and setting of device names
ARM: Kirkwood: checkpatch cleanups
ARM: Kirkwood: Fix sparse warnings.
ARM: Kirkwood: Remove unused includes
ARM: kirkwood: cleanup lsxl board includes
ARM: integrator: use BUG_ON where possible
ARM: integrator: push down SC dependencies
ARM: integrator: delete static UART1 mapping
ARM: integrator: delete SC mapping on the CP
ARM: integrator: remove static CP syscon mapping
ARM: integrator: remove static AP syscon mapping
...
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-imx.c | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 2ef162d148cb..b9734747d610 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c | |||
@@ -52,8 +52,6 @@ | |||
52 | #include <linux/of_device.h> | 52 | #include <linux/of_device.h> |
53 | #include <linux/of_i2c.h> | 53 | #include <linux/of_i2c.h> |
54 | #include <linux/pinctrl/consumer.h> | 54 | #include <linux/pinctrl/consumer.h> |
55 | |||
56 | #include <mach/hardware.h> | ||
57 | #include <linux/platform_data/i2c-imx.h> | 55 | #include <linux/platform_data/i2c-imx.h> |
58 | 56 | ||
59 | /** Defines ******************************************************************** | 57 | /** Defines ******************************************************************** |
@@ -115,6 +113,11 @@ static u16 __initdata i2c_clk_div[50][2] = { | |||
115 | { 3072, 0x1E }, { 3840, 0x1F } | 113 | { 3072, 0x1E }, { 3840, 0x1F } |
116 | }; | 114 | }; |
117 | 115 | ||
116 | enum imx_i2c_type { | ||
117 | IMX1_I2C, | ||
118 | IMX21_I2C, | ||
119 | }; | ||
120 | |||
118 | struct imx_i2c_struct { | 121 | struct imx_i2c_struct { |
119 | struct i2c_adapter adapter; | 122 | struct i2c_adapter adapter; |
120 | struct clk *clk; | 123 | struct clk *clk; |
@@ -124,13 +127,33 @@ struct imx_i2c_struct { | |||
124 | unsigned int disable_delay; | 127 | unsigned int disable_delay; |
125 | int stopped; | 128 | int stopped; |
126 | unsigned int ifdr; /* IMX_I2C_IFDR */ | 129 | unsigned int ifdr; /* IMX_I2C_IFDR */ |
130 | enum imx_i2c_type devtype; | ||
131 | }; | ||
132 | |||
133 | static struct platform_device_id imx_i2c_devtype[] = { | ||
134 | { | ||
135 | .name = "imx1-i2c", | ||
136 | .driver_data = IMX1_I2C, | ||
137 | }, { | ||
138 | .name = "imx21-i2c", | ||
139 | .driver_data = IMX21_I2C, | ||
140 | }, { | ||
141 | /* sentinel */ | ||
142 | } | ||
127 | }; | 143 | }; |
144 | MODULE_DEVICE_TABLE(platform, imx_i2c_devtype); | ||
128 | 145 | ||
129 | static const struct of_device_id i2c_imx_dt_ids[] = { | 146 | static const struct of_device_id i2c_imx_dt_ids[] = { |
130 | { .compatible = "fsl,imx1-i2c", }, | 147 | { .compatible = "fsl,imx1-i2c", .data = &imx_i2c_devtype[IMX1_I2C], }, |
148 | { .compatible = "fsl,imx21-i2c", .data = &imx_i2c_devtype[IMX21_I2C], }, | ||
131 | { /* sentinel */ } | 149 | { /* sentinel */ } |
132 | }; | 150 | }; |
133 | 151 | ||
152 | static inline int is_imx1_i2c(struct imx_i2c_struct *i2c_imx) | ||
153 | { | ||
154 | return i2c_imx->devtype == IMX1_I2C; | ||
155 | } | ||
156 | |||
134 | /** Functions for IMX I2C adapter driver *************************************** | 157 | /** Functions for IMX I2C adapter driver *************************************** |
135 | *******************************************************************************/ | 158 | *******************************************************************************/ |
136 | 159 | ||
@@ -223,7 +246,7 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx) | |||
223 | temp &= ~(I2CR_MSTA | I2CR_MTX); | 246 | temp &= ~(I2CR_MSTA | I2CR_MTX); |
224 | writeb(temp, i2c_imx->base + IMX_I2C_I2CR); | 247 | writeb(temp, i2c_imx->base + IMX_I2C_I2CR); |
225 | } | 248 | } |
226 | if (cpu_is_mx1()) { | 249 | if (is_imx1_i2c(i2c_imx)) { |
227 | /* | 250 | /* |
228 | * This delay caused by an i.MXL hardware bug. | 251 | * This delay caused by an i.MXL hardware bug. |
229 | * If no (or too short) delay, no "STOP" bit will be generated. | 252 | * If no (or too short) delay, no "STOP" bit will be generated. |
@@ -465,6 +488,8 @@ static struct i2c_algorithm i2c_imx_algo = { | |||
465 | 488 | ||
466 | static int __init i2c_imx_probe(struct platform_device *pdev) | 489 | static int __init i2c_imx_probe(struct platform_device *pdev) |
467 | { | 490 | { |
491 | const struct of_device_id *of_id = of_match_device(i2c_imx_dt_ids, | ||
492 | &pdev->dev); | ||
468 | struct imx_i2c_struct *i2c_imx; | 493 | struct imx_i2c_struct *i2c_imx; |
469 | struct resource *res; | 494 | struct resource *res; |
470 | struct imxi2c_platform_data *pdata = pdev->dev.platform_data; | 495 | struct imxi2c_platform_data *pdata = pdev->dev.platform_data; |
@@ -497,6 +522,10 @@ static int __init i2c_imx_probe(struct platform_device *pdev) | |||
497 | return -ENOMEM; | 522 | return -ENOMEM; |
498 | } | 523 | } |
499 | 524 | ||
525 | if (of_id) | ||
526 | pdev->id_entry = of_id->data; | ||
527 | i2c_imx->devtype = pdev->id_entry->driver_data; | ||
528 | |||
500 | /* Setup i2c_imx driver structure */ | 529 | /* Setup i2c_imx driver structure */ |
501 | strlcpy(i2c_imx->adapter.name, pdev->name, sizeof(i2c_imx->adapter.name)); | 530 | strlcpy(i2c_imx->adapter.name, pdev->name, sizeof(i2c_imx->adapter.name)); |
502 | i2c_imx->adapter.owner = THIS_MODULE; | 531 | i2c_imx->adapter.owner = THIS_MODULE; |
@@ -593,7 +622,8 @@ static struct platform_driver i2c_imx_driver = { | |||
593 | .name = DRIVER_NAME, | 622 | .name = DRIVER_NAME, |
594 | .owner = THIS_MODULE, | 623 | .owner = THIS_MODULE, |
595 | .of_match_table = i2c_imx_dt_ids, | 624 | .of_match_table = i2c_imx_dt_ids, |
596 | } | 625 | }, |
626 | .id_table = imx_i2c_devtype, | ||
597 | }; | 627 | }; |
598 | 628 | ||
599 | static int __init i2c_adap_imx_init(void) | 629 | static int __init i2c_adap_imx_init(void) |