diff options
author | Jingchang Lu <b35083@freescale.com> | 2013-08-07 05:05:43 -0400 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2013-08-15 10:14:50 -0400 |
commit | ad90efae1b9203baeb0f6fd668e6c61c2377bd5f (patch) | |
tree | 575cc9b933551265bab15dc4e9634823b645f38a /drivers/i2c | |
parent | 4b775022f6fdcfba6d219f46b2606e77a0dc38d9 (diff) |
i2c: imx: Add Vybrid VF610 I2C controller support
Add Freescale Vybrid VF610 I2C controller support to
imx I2C driver framework.
Signed-off-by: Jason Jin <Jason.jin@freescale.com>
Signed-off-by: Jingchang Lu <b35083@freescale.com>
Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-imx.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index ce31196bb5e7..9c0f8bda692a 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c | |||
@@ -79,6 +79,7 @@ | |||
79 | #define IMX_I2C_I2DR 0x04 /* i2c transfer data */ | 79 | #define IMX_I2C_I2DR 0x04 /* i2c transfer data */ |
80 | 80 | ||
81 | #define IMX_I2C_REGSHIFT 2 | 81 | #define IMX_I2C_REGSHIFT 2 |
82 | #define VF610_I2C_REGSHIFT 0 | ||
82 | 83 | ||
83 | /* Bits of IMX I2C registers */ | 84 | /* Bits of IMX I2C registers */ |
84 | #define I2SR_RXAK 0x01 | 85 | #define I2SR_RXAK 0x01 |
@@ -140,9 +141,29 @@ static struct imx_i2c_clk_pair imx_i2c_clk_div[] = { | |||
140 | { 3072, 0x1E }, { 3840, 0x1F } | 141 | { 3072, 0x1E }, { 3840, 0x1F } |
141 | }; | 142 | }; |
142 | 143 | ||
144 | /* Vybrid VF610 clock divider, register value pairs */ | ||
145 | static struct imx_i2c_clk_pair vf610_i2c_clk_div[] = { | ||
146 | { 20, 0x00 }, { 22, 0x01 }, { 24, 0x02 }, { 26, 0x03 }, | ||
147 | { 28, 0x04 }, { 30, 0x05 }, { 32, 0x09 }, { 34, 0x06 }, | ||
148 | { 36, 0x0A }, { 40, 0x07 }, { 44, 0x0C }, { 48, 0x0D }, | ||
149 | { 52, 0x43 }, { 56, 0x0E }, { 60, 0x45 }, { 64, 0x12 }, | ||
150 | { 68, 0x0F }, { 72, 0x13 }, { 80, 0x14 }, { 88, 0x15 }, | ||
151 | { 96, 0x19 }, { 104, 0x16 }, { 112, 0x1A }, { 128, 0x17 }, | ||
152 | { 136, 0x4F }, { 144, 0x1C }, { 160, 0x1D }, { 176, 0x55 }, | ||
153 | { 192, 0x1E }, { 208, 0x56 }, { 224, 0x22 }, { 228, 0x24 }, | ||
154 | { 240, 0x1F }, { 256, 0x23 }, { 288, 0x5C }, { 320, 0x25 }, | ||
155 | { 384, 0x26 }, { 448, 0x2A }, { 480, 0x27 }, { 512, 0x2B }, | ||
156 | { 576, 0x2C }, { 640, 0x2D }, { 768, 0x31 }, { 896, 0x32 }, | ||
157 | { 960, 0x2F }, { 1024, 0x33 }, { 1152, 0x34 }, { 1280, 0x35 }, | ||
158 | { 1536, 0x36 }, { 1792, 0x3A }, { 1920, 0x37 }, { 2048, 0x3B }, | ||
159 | { 2304, 0x3C }, { 2560, 0x3D }, { 3072, 0x3E }, { 3584, 0x7A }, | ||
160 | { 3840, 0x3F }, { 4096, 0x7B }, { 5120, 0x7D }, { 6144, 0x7E }, | ||
161 | }; | ||
162 | |||
143 | enum imx_i2c_type { | 163 | enum imx_i2c_type { |
144 | IMX1_I2C, | 164 | IMX1_I2C, |
145 | IMX21_I2C, | 165 | IMX21_I2C, |
166 | VF610_I2C, | ||
146 | }; | 167 | }; |
147 | 168 | ||
148 | struct imx_i2c_hwdata { | 169 | struct imx_i2c_hwdata { |
@@ -186,6 +207,16 @@ static const struct imx_i2c_hwdata imx21_i2c_hwdata = { | |||
186 | 207 | ||
187 | }; | 208 | }; |
188 | 209 | ||
210 | static struct imx_i2c_hwdata vf610_i2c_hwdata = { | ||
211 | .devtype = VF610_I2C, | ||
212 | .regshift = VF610_I2C_REGSHIFT, | ||
213 | .clk_div = vf610_i2c_clk_div, | ||
214 | .ndivs = ARRAY_SIZE(vf610_i2c_clk_div), | ||
215 | .i2sr_clr_opcode = I2SR_CLR_OPCODE_W1C, | ||
216 | .i2cr_ien_opcode = I2CR_IEN_OPCODE_0, | ||
217 | |||
218 | }; | ||
219 | |||
189 | static struct platform_device_id imx_i2c_devtype[] = { | 220 | static struct platform_device_id imx_i2c_devtype[] = { |
190 | { | 221 | { |
191 | .name = "imx1-i2c", | 222 | .name = "imx1-i2c", |
@@ -202,6 +233,7 @@ MODULE_DEVICE_TABLE(platform, imx_i2c_devtype); | |||
202 | static const struct of_device_id i2c_imx_dt_ids[] = { | 233 | static const struct of_device_id i2c_imx_dt_ids[] = { |
203 | { .compatible = "fsl,imx1-i2c", .data = &imx1_i2c_hwdata, }, | 234 | { .compatible = "fsl,imx1-i2c", .data = &imx1_i2c_hwdata, }, |
204 | { .compatible = "fsl,imx21-i2c", .data = &imx21_i2c_hwdata, }, | 235 | { .compatible = "fsl,imx21-i2c", .data = &imx21_i2c_hwdata, }, |
236 | { .compatible = "fsl,vf610-i2c", .data = &vf610_i2c_hwdata, }, | ||
205 | { /* sentinel */ } | 237 | { /* sentinel */ } |
206 | }; | 238 | }; |
207 | MODULE_DEVICE_TABLE(of, i2c_imx_dt_ids); | 239 | MODULE_DEVICE_TABLE(of, i2c_imx_dt_ids); |