Skip to content

Commit b207422

Browse files
geertuhorms
authored andcommitted
ARM: shmobile: kzm9g legacy: Set i2c clks_per_count to 2
On sh73a0/kzm9g-legacy, probing of the i2c masters fails with: i2c-sh_mobile i2c-sh_mobile.0: timing values out of range: L/H=0x208/0x1bf sh_mobile: probe of i2c-sh_mobile.0 failed with error -22 According to the datasheet, the transfer rate is derived from the HP clock (which runs at 104 MHz) divided by two. Hence i2c_sh_mobile_platform_data.clks_per_count should be set to two. Now probing succeeds, and i2c works: i2c-sh_mobile i2c-sh_mobile.0: I2C adapter 0 with bus speed 100000 Hz (L/H=0x104/0xe0) Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
1 parent f114040 commit b207422

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

‎arch/arm/mach-shmobile/setup-sh73a0.c‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <linux/of_platform.h>
2727
#include <linux/delay.h>
2828
#include <linux/input.h>
29+
#include <linux/i2c/i2c-sh_mobile.h>
2930
#include <linux/io.h>
3031
#include <linux/serial_sci.h>
3132
#include <linux/sh_dma.h>
@@ -192,39 +193,58 @@ static struct resource i2c4_resources[] = {
192193
},
193194
};
194195

196+
static struct i2c_sh_mobile_platform_data i2c_platform_data = {
197+
.clks_per_count = 2,
198+
};
199+
195200
static struct platform_device i2c0_device = {
196201
.name = "i2c-sh_mobile",
197202
.id = 0,
198203
.resource = i2c0_resources,
199204
.num_resources = ARRAY_SIZE(i2c0_resources),
205+
.dev = {
206+
.platform_data = &i2c_platform_data,
207+
},
200208
};
201209

202210
static struct platform_device i2c1_device = {
203211
.name = "i2c-sh_mobile",
204212
.id = 1,
205213
.resource = i2c1_resources,
206214
.num_resources = ARRAY_SIZE(i2c1_resources),
215+
.dev = {
216+
.platform_data = &i2c_platform_data,
217+
},
207218
};
208219

209220
static struct platform_device i2c2_device = {
210221
.name = "i2c-sh_mobile",
211222
.id = 2,
212223
.resource = i2c2_resources,
213224
.num_resources = ARRAY_SIZE(i2c2_resources),
225+
.dev = {
226+
.platform_data = &i2c_platform_data,
227+
},
214228
};
215229

216230
static struct platform_device i2c3_device = {
217231
.name = "i2c-sh_mobile",
218232
.id = 3,
219233
.resource = i2c3_resources,
220234
.num_resources = ARRAY_SIZE(i2c3_resources),
235+
.dev = {
236+
.platform_data = &i2c_platform_data,
237+
},
221238
};
222239

223240
static struct platform_device i2c4_device = {
224241
.name = "i2c-sh_mobile",
225242
.id = 4,
226243
.resource = i2c4_resources,
227244
.num_resources = ARRAY_SIZE(i2c4_resources),
245+
.dev = {
246+
.platform_data = &i2c_platform_data,
247+
},
228248
};
229249

230250
static const struct sh_dmae_slave_config sh73a0_dmae_slaves[] = {

0 commit comments

Comments
 (0)