spi-topcliff-pch: Fix issue for transmitting over 4KByte
[zen-stable.git] / arch / arm / plat-mxc / devices / platform-imx-i2c.c
blob19ad580c0be348fb16d8bf93e3eb664b6ef1d431
1 /*
2 * Copyright (C) 2009-2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9 #include <mach/hardware.h>
10 #include <mach/devices-common.h>
12 #define imx_imx_i2c_data_entry_single(soc, _id, _hwid, _size) \
13 { \
14 .id = _id, \
15 .iobase = soc ## _I2C ## _hwid ## _BASE_ADDR, \
16 .iosize = _size, \
17 .irq = soc ## _INT_I2C ## _hwid, \
20 #define imx_imx_i2c_data_entry(soc, _id, _hwid, _size) \
21 [_id] = imx_imx_i2c_data_entry_single(soc, _id, _hwid, _size)
23 #ifdef CONFIG_SOC_IMX1
24 const struct imx_imx_i2c_data imx1_imx_i2c_data __initconst =
25 imx_imx_i2c_data_entry_single(MX1, 0, , SZ_4K);
26 #endif /* ifdef CONFIG_SOC_IMX1 */
28 #ifdef CONFIG_SOC_IMX21
29 const struct imx_imx_i2c_data imx21_imx_i2c_data __initconst =
30 imx_imx_i2c_data_entry_single(MX21, 0, , SZ_4K);
31 #endif /* ifdef CONFIG_SOC_IMX21 */
33 #ifdef CONFIG_SOC_IMX25
34 const struct imx_imx_i2c_data imx25_imx_i2c_data[] __initconst = {
35 #define imx25_imx_i2c_data_entry(_id, _hwid) \
36 imx_imx_i2c_data_entry(MX25, _id, _hwid, SZ_16K)
37 imx25_imx_i2c_data_entry(0, 1),
38 imx25_imx_i2c_data_entry(1, 2),
39 imx25_imx_i2c_data_entry(2, 3),
41 #endif /* ifdef CONFIG_SOC_IMX25 */
43 #ifdef CONFIG_SOC_IMX27
44 const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst = {
45 #define imx27_imx_i2c_data_entry(_id, _hwid) \
46 imx_imx_i2c_data_entry(MX27, _id, _hwid, SZ_4K)
47 imx27_imx_i2c_data_entry(0, 1),
48 imx27_imx_i2c_data_entry(1, 2),
50 #endif /* ifdef CONFIG_SOC_IMX27 */
52 #ifdef CONFIG_SOC_IMX31
53 const struct imx_imx_i2c_data imx31_imx_i2c_data[] __initconst = {
54 #define imx31_imx_i2c_data_entry(_id, _hwid) \
55 imx_imx_i2c_data_entry(MX31, _id, _hwid, SZ_4K)
56 imx31_imx_i2c_data_entry(0, 1),
57 imx31_imx_i2c_data_entry(1, 2),
58 imx31_imx_i2c_data_entry(2, 3),
60 #endif /* ifdef CONFIG_SOC_IMX31 */
62 #ifdef CONFIG_SOC_IMX35
63 const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst = {
64 #define imx35_imx_i2c_data_entry(_id, _hwid) \
65 imx_imx_i2c_data_entry(MX35, _id, _hwid, SZ_4K)
66 imx35_imx_i2c_data_entry(0, 1),
67 imx35_imx_i2c_data_entry(1, 2),
68 imx35_imx_i2c_data_entry(2, 3),
70 #endif /* ifdef CONFIG_SOC_IMX35 */
72 #ifdef CONFIG_SOC_IMX50
73 const struct imx_imx_i2c_data imx50_imx_i2c_data[] __initconst = {
74 #define imx50_imx_i2c_data_entry(_id, _hwid) \
75 imx_imx_i2c_data_entry(MX50, _id, _hwid, SZ_4K)
76 imx50_imx_i2c_data_entry(0, 1),
77 imx50_imx_i2c_data_entry(1, 2),
78 imx50_imx_i2c_data_entry(2, 3),
80 #endif /* ifdef CONFIG_SOC_IMX51 */
82 #ifdef CONFIG_SOC_IMX51
83 const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst = {
84 #define imx51_imx_i2c_data_entry(_id, _hwid) \
85 imx_imx_i2c_data_entry(MX51, _id, _hwid, SZ_4K)
86 imx51_imx_i2c_data_entry(0, 1),
87 imx51_imx_i2c_data_entry(1, 2),
89 .id = 2,
90 .iobase = MX51_HSI2C_DMA_BASE_ADDR,
91 .iosize = SZ_16K,
92 .irq = MX51_INT_HS_I2C,
95 #endif /* ifdef CONFIG_SOC_IMX51 */
97 #ifdef CONFIG_SOC_IMX53
98 const struct imx_imx_i2c_data imx53_imx_i2c_data[] __initconst = {
99 #define imx53_imx_i2c_data_entry(_id, _hwid) \
100 imx_imx_i2c_data_entry(MX53, _id, _hwid, SZ_4K)
101 imx53_imx_i2c_data_entry(0, 1),
102 imx53_imx_i2c_data_entry(1, 2),
103 imx53_imx_i2c_data_entry(2, 3),
105 #endif /* ifdef CONFIG_SOC_IMX53 */
107 struct platform_device *__init imx_add_imx_i2c(
108 const struct imx_imx_i2c_data *data,
109 const struct imxi2c_platform_data *pdata)
111 struct resource res[] = {
113 .start = data->iobase,
114 .end = data->iobase + data->iosize - 1,
115 .flags = IORESOURCE_MEM,
116 }, {
117 .start = data->irq,
118 .end = data->irq,
119 .flags = IORESOURCE_IRQ,
123 return imx_add_platform_device("imx-i2c", data->id,
124 res, ARRAY_SIZE(res),
125 pdata, sizeof(*pdata));