Commit 956f74ab authored by Syed Mohammed Khasim's avatar Syed Mohammed Khasim Committed by Tony Lindgren

ARM: OMAP: Add support for high-speed I2C init

Omap2430 has additional support for high-speed I2C.

This patch moves I2C speed parameter (from module) to platform data.
Also added basic High Speed support based on I2C bus speed.
Signed-off-by: default avatarSyed Mohammed Khasim  <x0khasim@ti.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 06bd4952
...@@ -192,6 +192,78 @@ static struct omap_board_config_kernel sdp2430_config[] = { ...@@ -192,6 +192,78 @@ static struct omap_board_config_kernel sdp2430_config[] = {
{OMAP_TAG_UART, &sdp2430_uart_config}, {OMAP_TAG_UART, &sdp2430_uart_config},
}; };
#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
#define OMAP2_I2C_BASE1 0x48070000
#define OMAP2_I2C_BASE2 0x48072000
#define OMAP2_I2C_INT1 56
#define OMAP2_I2C_INT2 57
static u32 omap2_i2c1_clkrate = 400;
static u32 omap2_i2c2_clkrate = 2600;
static struct resource i2c_resources1[] = {
{
.start = OMAP2_I2C_BASE1,
.end = OMAP2_I2C_BASE1 + 0x3f,
.flags = IORESOURCE_MEM,
},
{
.start = OMAP2_I2C_INT1,
.flags = IORESOURCE_IRQ,
},
};
static struct resource i2c_resources2[] = {
{
.start = OMAP2_I2C_BASE2,
.end = OMAP2_I2C_BASE2 + 0x3f,
.flags = IORESOURCE_MEM,
},
{
.start = OMAP2_I2C_INT2,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device omap_i2c_device1 = {
.name = "i2c_omap",
.id = 1,
.num_resources = ARRAY_SIZE(i2c_resources1),
.resource = i2c_resources1,
.dev = {
.platform_data = &omap2_i2c1_clkrate,
},
};
static struct platform_device omap_i2c_device2 = {
.name = "i2c_omap",
.id = 2,
.num_resources = ARRAY_SIZE(i2c_resources2),
.resource = i2c_resources2,
.dev = {
.platform_data = &omap2_i2c2_clkrate,
},
};
static void omap_init_i2c(void)
{
(void) platform_device_register(&omap_i2c_device2);
(void) platform_device_register(&omap_i2c_device1);
}
#else
static void omap_init_i2c(void) {}
#endif
static int __init omap2430_i2c_init(void)
{
omap_init_i2c();
return 0;
}
static void __init omap_2430sdp_init(void) static void __init omap_2430sdp_init(void)
{ {
platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices)); platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices));
...@@ -205,6 +277,8 @@ static void __init omap_2430sdp_map_io(void) ...@@ -205,6 +277,8 @@ static void __init omap_2430sdp_map_io(void)
omap2_map_common_io(); omap2_map_common_io();
} }
arch_initcall(omap2430_i2c_init);
MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board") MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
/* Maintainer: Syed Khasim - Texas Instruments Inc */ /* Maintainer: Syed Khasim - Texas Instruments Inc */
.phys_io = 0x48000000, .phys_io = 0x48000000,
......
...@@ -1761,7 +1761,8 @@ static struct clk i2c2_fck = { ...@@ -1761,7 +1761,8 @@ static struct clk i2c2_fck = {
}; };
static struct clk i2chs2_fck = { static struct clk i2chs2_fck = {
.name = "i2chs2_fck", .name = "i2chs_fck",
.id = 2,
.parent = &func_96m_ck, .parent = &func_96m_ck,
.flags = CLOCK_IN_OMAP243X, .flags = CLOCK_IN_OMAP243X,
.enable_reg = (void __iomem *)&CM_FCLKEN2_CORE, .enable_reg = (void __iomem *)&CM_FCLKEN2_CORE,
...@@ -1790,7 +1791,8 @@ static struct clk i2c1_fck = { ...@@ -1790,7 +1791,8 @@ static struct clk i2c1_fck = {
}; };
static struct clk i2chs1_fck = { static struct clk i2chs1_fck = {
.name = "i2chs1_fck", .name = "i2chs_fck",
.id = 1,
.parent = &func_96m_ck, .parent = &func_96m_ck,
.flags = CLOCK_IN_OMAP243X, .flags = CLOCK_IN_OMAP243X,
.enable_reg = (void __iomem *)&CM_FCLKEN2_CORE, .enable_reg = (void __iomem *)&CM_FCLKEN2_CORE,
......
...@@ -25,11 +25,13 @@ ...@@ -25,11 +25,13 @@
#include <asm/arch/gpio.h> #include <asm/arch/gpio.h>
#include <asm/arch/eac.h> #include <asm/arch/eac.h>
#if !defined(CONFIG_ARCH_OMAP243X)
#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE) #if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
#define OMAP2_I2C_BASE2 0x48072000 #define OMAP2_I2C_BASE2 0x48072000
#define OMAP2_I2C_INT2 57 #define OMAP2_I2C_INT2 57
static u32 omap2_i2c2_clkrate = 100;
static struct resource i2c_resources2[] = { static struct resource i2c_resources2[] = {
{ {
.start = OMAP2_I2C_BASE2, .start = OMAP2_I2C_BASE2,
...@@ -47,6 +49,9 @@ static struct platform_device omap_i2c_device2 = { ...@@ -47,6 +49,9 @@ static struct platform_device omap_i2c_device2 = {
.id = 2, .id = 2,
.num_resources = ARRAY_SIZE(i2c_resources2), .num_resources = ARRAY_SIZE(i2c_resources2),
.resource = i2c_resources2, .resource = i2c_resources2,
.dev = {
.platform_data = &omap2_i2c2_clkrate,
},
}; };
/* See also arch/arm/plat-omap/devices.c for first I2C on 24xx */ /* See also arch/arm/plat-omap/devices.c for first I2C on 24xx */
...@@ -56,10 +61,9 @@ static void omap_init_i2c(void) ...@@ -56,10 +61,9 @@ static void omap_init_i2c(void)
if (machine_is_omap_h4()) if (machine_is_omap_h4())
return; return;
if (!cpu_is_omap2430()) { omap_cfg_reg(J15_24XX_I2C2_SCL);
omap_cfg_reg(J15_24XX_I2C2_SCL); omap_cfg_reg(H19_24XX_I2C2_SDA);
omap_cfg_reg(H19_24XX_I2C2_SDA);
}
(void) platform_device_register(&omap_i2c_device2); (void) platform_device_register(&omap_i2c_device2);
} }
...@@ -67,6 +71,7 @@ static void omap_init_i2c(void) ...@@ -67,6 +71,7 @@ static void omap_init_i2c(void)
static void omap_init_i2c(void) {} static void omap_init_i2c(void) {}
#endif
#endif #endif
#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE) #if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
...@@ -241,7 +246,9 @@ static int __init omap2_init_devices(void) ...@@ -241,7 +246,9 @@ static int __init omap2_init_devices(void)
/* please keep these calls, and their implementations above, /* please keep these calls, and their implementations above,
* in alphabetical order so they're easier to sort through. * in alphabetical order so they're easier to sort through.
*/ */
omap_init_i2c(); if (!cpu_is_omap2430()) {
omap_init_i2c();
}
omap_init_mbox(); omap_init_mbox();
omap_init_mcspi(); omap_init_mcspi();
omap_init_sti(); omap_init_sti();
......
...@@ -89,6 +89,7 @@ static inline void omap_init_dsp(void) { } ...@@ -89,6 +89,7 @@ static inline void omap_init_dsp(void) { }
#endif /* CONFIG_OMAP_DSP */ #endif /* CONFIG_OMAP_DSP */
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
#if !defined(CONFIG_ARCH_OMAP243X)
#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE) #if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
#define OMAP1_I2C_BASE 0xfffb3800 #define OMAP1_I2C_BASE 0xfffb3800
...@@ -97,6 +98,8 @@ static inline void omap_init_dsp(void) { } ...@@ -97,6 +98,8 @@ static inline void omap_init_dsp(void) { }
#define OMAP1_I2C_INT INT_I2C #define OMAP1_I2C_INT INT_I2C
#define OMAP2_I2C_INT1 56 #define OMAP2_I2C_INT1 56
static u32 omap2_i2c1_clkrate = 100;
static struct resource i2c_resources1[] = { static struct resource i2c_resources1[] = {
{ {
.start = 0, .start = 0,
...@@ -116,12 +119,15 @@ static struct platform_device omap_i2c_device1 = { ...@@ -116,12 +119,15 @@ static struct platform_device omap_i2c_device1 = {
.id = 1, .id = 1,
.num_resources = ARRAY_SIZE(i2c_resources1), .num_resources = ARRAY_SIZE(i2c_resources1),
.resource = i2c_resources1, .resource = i2c_resources1,
.dev = {
.platform_data = &omap2_i2c1_clkrate,
},
}; };
/* See also arch/arm/mach-omap2/devices.c for second I2C on 24xx */ /* See also arch/arm/mach-omap2/devices.c for second I2C on 24xx */
static void omap_init_i2c(void) static void omap_init_i2c(void)
{ {
if (cpu_is_omap24xx()) { if (cpu_is_omap242x()) {
i2c_resources1[0].start = OMAP2_I2C_BASE1; i2c_resources1[0].start = OMAP2_I2C_BASE1;
i2c_resources1[0].end = OMAP2_I2C_BASE1 + OMAP_I2C_SIZE; i2c_resources1[0].end = OMAP2_I2C_BASE1 + OMAP_I2C_SIZE;
i2c_resources1[1].start = OMAP2_I2C_INT1; i2c_resources1[1].start = OMAP2_I2C_INT1;
...@@ -151,7 +157,7 @@ static void omap_init_i2c(void) ...@@ -151,7 +157,7 @@ static void omap_init_i2c(void)
#else #else
static inline void omap_init_i2c(void) {} static inline void omap_init_i2c(void) {}
#endif #endif
#endif
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
#if defined(CONFIG_KEYBOARD_OMAP) || defined(CONFIG_KEYBOARD_OMAP_MODULE) #if defined(CONFIG_KEYBOARD_OMAP) || defined(CONFIG_KEYBOARD_OMAP_MODULE)
...@@ -258,6 +264,7 @@ static struct omap_mmc_conf mmc2_conf; ...@@ -258,6 +264,7 @@ static struct omap_mmc_conf mmc2_conf;
static u64 mmc2_dmamask = 0xffffffff; static u64 mmc2_dmamask = 0xffffffff;
static struct resource mmc2_resources[] = { static struct resource mmc2_resources[] = {
{ {
.start = OMAP_MMC2_BASE, .start = OMAP_MMC2_BASE,
...@@ -519,7 +526,9 @@ static int __init omap_init_devices(void) ...@@ -519,7 +526,9 @@ static int __init omap_init_devices(void)
omap_init_uwire(); omap_init_uwire();
omap_init_wdt(); omap_init_wdt();
omap_init_rng(); omap_init_rng();
omap_init_i2c(); if (!cpu_is_omap2430()) {
omap_init_i2c();
}
return 0; return 0;
} }
arch_initcall(omap_init_devices); arch_initcall(omap_init_devices);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment