aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2010-11-30 17:45:49 -0500
committerTony Lindgren <tony@atomide.com>2010-11-30 17:45:49 -0500
commit55a4e78952286d498d89a399d845e7cfaa8ddd56 (patch)
treef5d67bdaa07b36009476d2e1bdcde8b7dc0c6e3d /arch
parent9c7bc451e41abf78b0fd856a9f916f7d39e26297 (diff)
parent27b1fec2caa668c162cd1a862c69e087df277fae (diff)
Merge branch 'pm-hwmod-i2c' of ssh://master.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm into omap-for-linus
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/cm-regbits-24xx.h4
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c145
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c155
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c233
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c237
-rw-r--r--arch/arm/mach-omap2/prm-regbits-34xx.h3
-rw-r--r--arch/arm/plat-omap/i2c.c124
-rw-r--r--arch/arm/plat-omap/include/plat/i2c.h13
-rw-r--r--arch/arm/plat-omap/include/plat/l4_3xxx.h24
9 files changed, 858 insertions, 80 deletions
diff --git a/arch/arm/mach-omap2/cm-regbits-24xx.h b/arch/arm/mach-omap2/cm-regbits-24xx.h
index da51cc3ed7eb..9a106c04c4a0 100644
--- a/arch/arm/mach-omap2/cm-regbits-24xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-24xx.h
@@ -126,8 +126,12 @@
126#define OMAP24XX_ST_HDQ_MASK (1 << 23) 126#define OMAP24XX_ST_HDQ_MASK (1 << 23)
127#define OMAP2420_ST_I2C2_SHIFT 20 127#define OMAP2420_ST_I2C2_SHIFT 20
128#define OMAP2420_ST_I2C2_MASK (1 << 20) 128#define OMAP2420_ST_I2C2_MASK (1 << 20)
129#define OMAP2430_ST_I2CHS1_SHIFT 19
130#define OMAP2430_ST_I2CHS1_MASK (1 << 19)
129#define OMAP2420_ST_I2C1_SHIFT 19 131#define OMAP2420_ST_I2C1_SHIFT 19
130#define OMAP2420_ST_I2C1_MASK (1 << 19) 132#define OMAP2420_ST_I2C1_MASK (1 << 19)
133#define OMAP2430_ST_I2CHS2_SHIFT 20
134#define OMAP2430_ST_I2CHS2_MASK (1 << 20)
131#define OMAP24XX_ST_MCBSP2_SHIFT 16 135#define OMAP24XX_ST_MCBSP2_SHIFT 16
132#define OMAP24XX_ST_MCBSP2_MASK (1 << 16) 136#define OMAP24XX_ST_MCBSP2_MASK (1 << 16)
133#define OMAP24XX_ST_MCBSP1_SHIFT 15 137#define OMAP24XX_ST_MCBSP1_SHIFT 15
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index adf6e3632a2b..a1a3dd6303b4 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -16,11 +16,13 @@
16#include <plat/cpu.h> 16#include <plat/cpu.h>
17#include <plat/dma.h> 17#include <plat/dma.h>
18#include <plat/serial.h> 18#include <plat/serial.h>
19#include <plat/i2c.h>
20#include <plat/omap24xx.h>
19 21
20#include "omap_hwmod_common_data.h" 22#include "omap_hwmod_common_data.h"
21 23
22#include "prm-regbits-24xx.h"
23#include "cm-regbits-24xx.h" 24#include "cm-regbits-24xx.h"
25#include "prm-regbits-24xx.h"
24 26
25/* 27/*
26 * OMAP2420 hardware module integration data 28 * OMAP2420 hardware module integration data
@@ -77,6 +79,8 @@ static struct omap_hwmod omap2420_l4_wkup_hwmod;
77static struct omap_hwmod omap2420_uart1_hwmod; 79static struct omap_hwmod omap2420_uart1_hwmod;
78static struct omap_hwmod omap2420_uart2_hwmod; 80static struct omap_hwmod omap2420_uart2_hwmod;
79static struct omap_hwmod omap2420_uart3_hwmod; 81static struct omap_hwmod omap2420_uart3_hwmod;
82static struct omap_hwmod omap2420_i2c1_hwmod;
83static struct omap_hwmod omap2420_i2c2_hwmod;
80 84
81/* L4_CORE -> L4_WKUP interface */ 85/* L4_CORE -> L4_WKUP interface */
82static struct omap_hwmod_ocp_if omap2420_l4_core__l4_wkup = { 86static struct omap_hwmod_ocp_if omap2420_l4_core__l4_wkup = {
@@ -139,6 +143,45 @@ static struct omap_hwmod_ocp_if omap2_l4_core__uart3 = {
139 .user = OCP_USER_MPU | OCP_USER_SDMA, 143 .user = OCP_USER_MPU | OCP_USER_SDMA,
140}; 144};
141 145
146/* I2C IP block address space length (in bytes) */
147#define OMAP2_I2C_AS_LEN 128
148
149/* L4 CORE -> I2C1 interface */
150static struct omap_hwmod_addr_space omap2420_i2c1_addr_space[] = {
151 {
152 .pa_start = 0x48070000,
153 .pa_end = 0x48070000 + OMAP2_I2C_AS_LEN - 1,
154 .flags = ADDR_TYPE_RT,
155 },
156};
157
158static struct omap_hwmod_ocp_if omap2420_l4_core__i2c1 = {
159 .master = &omap2420_l4_core_hwmod,
160 .slave = &omap2420_i2c1_hwmod,
161 .clk = "i2c1_ick",
162 .addr = omap2420_i2c1_addr_space,
163 .addr_cnt = ARRAY_SIZE(omap2420_i2c1_addr_space),
164 .user = OCP_USER_MPU | OCP_USER_SDMA,
165};
166
167/* L4 CORE -> I2C2 interface */
168static struct omap_hwmod_addr_space omap2420_i2c2_addr_space[] = {
169 {
170 .pa_start = 0x48072000,
171 .pa_end = 0x48072000 + OMAP2_I2C_AS_LEN - 1,
172 .flags = ADDR_TYPE_RT,
173 },
174};
175
176static struct omap_hwmod_ocp_if omap2420_l4_core__i2c2 = {
177 .master = &omap2420_l4_core_hwmod,
178 .slave = &omap2420_i2c2_hwmod,
179 .clk = "i2c2_ick",
180 .addr = omap2420_i2c2_addr_space,
181 .addr_cnt = ARRAY_SIZE(omap2420_i2c2_addr_space),
182 .user = OCP_USER_MPU | OCP_USER_SDMA,
183};
184
142/* Slave interfaces on the L4_CORE interconnect */ 185/* Slave interfaces on the L4_CORE interconnect */
143static struct omap_hwmod_ocp_if *omap2420_l4_core_slaves[] = { 186static struct omap_hwmod_ocp_if *omap2420_l4_core_slaves[] = {
144 &omap2420_l3_main__l4_core, 187 &omap2420_l3_main__l4_core,
@@ -150,6 +193,8 @@ static struct omap_hwmod_ocp_if *omap2420_l4_core_masters[] = {
150 &omap2_l4_core__uart1, 193 &omap2_l4_core__uart1,
151 &omap2_l4_core__uart2, 194 &omap2_l4_core__uart2,
152 &omap2_l4_core__uart3, 195 &omap2_l4_core__uart3,
196 &omap2420_l4_core__i2c1,
197 &omap2420_l4_core__i2c2
153}; 198};
154 199
155/* L4 CORE */ 200/* L4 CORE */
@@ -418,6 +463,100 @@ static struct omap_hwmod omap2420_uart3_hwmod = {
418 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420), 463 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
419}; 464};
420 465
466/* I2C common */
467static struct omap_hwmod_class_sysconfig i2c_sysc = {
468 .rev_offs = 0x00,
469 .sysc_offs = 0x20,
470 .syss_offs = 0x10,
471 .sysc_flags = SYSC_HAS_SOFTRESET,
472 .sysc_fields = &omap_hwmod_sysc_type1,
473};
474
475static struct omap_hwmod_class i2c_class = {
476 .name = "i2c",
477 .sysc = &i2c_sysc,
478};
479
480static struct omap_i2c_dev_attr i2c_dev_attr;
481
482/* I2C1 */
483
484static struct omap_hwmod_irq_info i2c1_mpu_irqs[] = {
485 { .irq = INT_24XX_I2C1_IRQ, },
486};
487
488static struct omap_hwmod_dma_info i2c1_sdma_reqs[] = {
489 { .name = "tx", .dma_req = OMAP24XX_DMA_I2C1_TX },
490 { .name = "rx", .dma_req = OMAP24XX_DMA_I2C1_RX },
491};
492
493static struct omap_hwmod_ocp_if *omap2420_i2c1_slaves[] = {
494 &omap2420_l4_core__i2c1,
495};
496
497static struct omap_hwmod omap2420_i2c1_hwmod = {
498 .name = "i2c1",
499 .mpu_irqs = i2c1_mpu_irqs,
500 .mpu_irqs_cnt = ARRAY_SIZE(i2c1_mpu_irqs),
501 .sdma_reqs = i2c1_sdma_reqs,
502 .sdma_reqs_cnt = ARRAY_SIZE(i2c1_sdma_reqs),
503 .main_clk = "i2c1_fck",
504 .prcm = {
505 .omap2 = {
506 .module_offs = CORE_MOD,
507 .prcm_reg_id = 1,
508 .module_bit = OMAP2420_EN_I2C1_SHIFT,
509 .idlest_reg_id = 1,
510 .idlest_idle_bit = OMAP2420_ST_I2C1_SHIFT,
511 },
512 },
513 .slaves = omap2420_i2c1_slaves,
514 .slaves_cnt = ARRAY_SIZE(omap2420_i2c1_slaves),
515 .class = &i2c_class,
516 .dev_attr = &i2c_dev_attr,
517 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
518 .flags = HWMOD_16BIT_REG,
519};
520
521/* I2C2 */
522
523static struct omap_hwmod_irq_info i2c2_mpu_irqs[] = {
524 { .irq = INT_24XX_I2C2_IRQ, },
525};
526
527static struct omap_hwmod_dma_info i2c2_sdma_reqs[] = {
528 { .name = "tx", .dma_req = OMAP24XX_DMA_I2C2_TX },
529 { .name = "rx", .dma_req = OMAP24XX_DMA_I2C2_RX },
530};
531
532static struct omap_hwmod_ocp_if *omap2420_i2c2_slaves[] = {
533 &omap2420_l4_core__i2c2,
534};
535
536static struct omap_hwmod omap2420_i2c2_hwmod = {
537 .name = "i2c2",
538 .mpu_irqs = i2c2_mpu_irqs,
539 .mpu_irqs_cnt = ARRAY_SIZE(i2c2_mpu_irqs),
540 .sdma_reqs = i2c2_sdma_reqs,
541 .sdma_reqs_cnt = ARRAY_SIZE(i2c2_sdma_reqs),
542 .main_clk = "i2c2_fck",
543 .prcm = {
544 .omap2 = {
545 .module_offs = CORE_MOD,
546 .prcm_reg_id = 1,
547 .module_bit = OMAP2420_EN_I2C2_SHIFT,
548 .idlest_reg_id = 1,
549 .idlest_idle_bit = OMAP2420_ST_I2C2_SHIFT,
550 },
551 },
552 .slaves = omap2420_i2c2_slaves,
553 .slaves_cnt = ARRAY_SIZE(omap2420_i2c2_slaves),
554 .class = &i2c_class,
555 .dev_attr = &i2c_dev_attr,
556 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
557 .flags = HWMOD_16BIT_REG,
558};
559
421static __initdata struct omap_hwmod *omap2420_hwmods[] = { 560static __initdata struct omap_hwmod *omap2420_hwmods[] = {
422 &omap2420_l3_main_hwmod, 561 &omap2420_l3_main_hwmod,
423 &omap2420_l4_core_hwmod, 562 &omap2420_l4_core_hwmod,
@@ -428,6 +567,8 @@ static __initdata struct omap_hwmod *omap2420_hwmods[] = {
428 &omap2420_uart1_hwmod, 567 &omap2420_uart1_hwmod,
429 &omap2420_uart2_hwmod, 568 &omap2420_uart2_hwmod,
430 &omap2420_uart3_hwmod, 569 &omap2420_uart3_hwmod,
570 &omap2420_i2c1_hwmod,
571 &omap2420_i2c2_hwmod,
431 NULL, 572 NULL,
432}; 573};
433 574
@@ -435,5 +576,3 @@ int __init omap2420_hwmod_init(void)
435{ 576{
436 return omap_hwmod_init(omap2420_hwmods); 577 return omap_hwmod_init(omap2420_hwmods);
437} 578}
438
439
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index 12d939e456cf..7cf0d3ab2a4a 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -16,6 +16,8 @@
16#include <plat/cpu.h> 16#include <plat/cpu.h>
17#include <plat/dma.h> 17#include <plat/dma.h>
18#include <plat/serial.h> 18#include <plat/serial.h>
19#include <plat/i2c.h>
20#include <plat/omap24xx.h>
19 21
20#include "omap_hwmod_common_data.h" 22#include "omap_hwmod_common_data.h"
21 23
@@ -77,6 +79,47 @@ static struct omap_hwmod omap2430_l4_wkup_hwmod;
77static struct omap_hwmod omap2430_uart1_hwmod; 79static struct omap_hwmod omap2430_uart1_hwmod;
78static struct omap_hwmod omap2430_uart2_hwmod; 80static struct omap_hwmod omap2430_uart2_hwmod;
79static struct omap_hwmod omap2430_uart3_hwmod; 81static struct omap_hwmod omap2430_uart3_hwmod;
82static struct omap_hwmod omap2430_i2c1_hwmod;
83static struct omap_hwmod omap2430_i2c2_hwmod;
84
85/* I2C IP block address space length (in bytes) */
86#define OMAP2_I2C_AS_LEN 128
87
88/* L4 CORE -> I2C1 interface */
89static struct omap_hwmod_addr_space omap2430_i2c1_addr_space[] = {
90 {
91 .pa_start = 0x48070000,
92 .pa_end = 0x48070000 + OMAP2_I2C_AS_LEN - 1,
93 .flags = ADDR_TYPE_RT,
94 },
95};
96
97static struct omap_hwmod_ocp_if omap2430_l4_core__i2c1 = {
98 .master = &omap2430_l4_core_hwmod,
99 .slave = &omap2430_i2c1_hwmod,
100 .clk = "i2c1_ick",
101 .addr = omap2430_i2c1_addr_space,
102 .addr_cnt = ARRAY_SIZE(omap2430_i2c1_addr_space),
103 .user = OCP_USER_MPU | OCP_USER_SDMA,
104};
105
106/* L4 CORE -> I2C2 interface */
107static struct omap_hwmod_addr_space omap2430_i2c2_addr_space[] = {
108 {
109 .pa_start = 0x48072000,
110 .pa_end = 0x48072000 + OMAP2_I2C_AS_LEN - 1,
111 .flags = ADDR_TYPE_RT,
112 },
113};
114
115static struct omap_hwmod_ocp_if omap2430_l4_core__i2c2 = {
116 .master = &omap2430_l4_core_hwmod,
117 .slave = &omap2430_i2c2_hwmod,
118 .clk = "i2c2_ick",
119 .addr = omap2430_i2c2_addr_space,
120 .addr_cnt = ARRAY_SIZE(omap2430_i2c2_addr_space),
121 .user = OCP_USER_MPU | OCP_USER_SDMA,
122};
80 123
81/* L4_CORE -> L4_WKUP interface */ 124/* L4_CORE -> L4_WKUP interface */
82static struct omap_hwmod_ocp_if omap2430_l4_core__l4_wkup = { 125static struct omap_hwmod_ocp_if omap2430_l4_core__l4_wkup = {
@@ -418,6 +461,114 @@ static struct omap_hwmod omap2430_uart3_hwmod = {
418 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430), 461 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
419}; 462};
420 463
464/* I2C common */
465static struct omap_hwmod_class_sysconfig i2c_sysc = {
466 .rev_offs = 0x00,
467 .sysc_offs = 0x20,
468 .syss_offs = 0x10,
469 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
470 .sysc_fields = &omap_hwmod_sysc_type1,
471};
472
473static struct omap_hwmod_class i2c_class = {
474 .name = "i2c",
475 .sysc = &i2c_sysc,
476};
477
478static struct omap_i2c_dev_attr i2c_dev_attr;
479
480/* I2C1 */
481
482static struct omap_i2c_dev_attr i2c1_dev_attr = {
483 .fifo_depth = 8, /* bytes */
484};
485
486static struct omap_hwmod_irq_info i2c1_mpu_irqs[] = {
487 { .irq = INT_24XX_I2C1_IRQ, },
488};
489
490static struct omap_hwmod_dma_info i2c1_sdma_reqs[] = {
491 { .name = "tx", .dma_req = OMAP24XX_DMA_I2C1_TX },
492 { .name = "rx", .dma_req = OMAP24XX_DMA_I2C1_RX },
493};
494
495static struct omap_hwmod_ocp_if *omap2430_i2c1_slaves[] = {
496 &omap2430_l4_core__i2c1,
497};
498
499static struct omap_hwmod omap2430_i2c1_hwmod = {
500 .name = "i2c1",
501 .mpu_irqs = i2c1_mpu_irqs,
502 .mpu_irqs_cnt = ARRAY_SIZE(i2c1_mpu_irqs),
503 .sdma_reqs = i2c1_sdma_reqs,
504 .sdma_reqs_cnt = ARRAY_SIZE(i2c1_sdma_reqs),
505 .main_clk = "i2chs1_fck",
506 .prcm = {
507 .omap2 = {
508 /*
509 * NOTE: The CM_FCLKEN* and CM_ICLKEN* for
510 * I2CHS IP's do not follow the usual pattern.
511 * prcm_reg_id alone cannot be used to program
512 * the iclk and fclk. Needs to be handled using
513 * additonal flags when clk handling is moved
514 * to hwmod framework.
515 */
516 .module_offs = CORE_MOD,
517 .prcm_reg_id = 1,
518 .module_bit = OMAP2430_EN_I2CHS1_SHIFT,
519 .idlest_reg_id = 1,
520 .idlest_idle_bit = OMAP2430_ST_I2CHS1_SHIFT,
521 },
522 },
523 .slaves = omap2430_i2c1_slaves,
524 .slaves_cnt = ARRAY_SIZE(omap2430_i2c1_slaves),
525 .class = &i2c_class,
526 .dev_attr = &i2c1_dev_attr,
527 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
528};
529
530/* I2C2 */
531
532static struct omap_i2c_dev_attr i2c2_dev_attr = {
533 .fifo_depth = 8, /* bytes */
534};
535
536static struct omap_hwmod_irq_info i2c2_mpu_irqs[] = {
537 { .irq = INT_24XX_I2C2_IRQ, },
538};
539
540static struct omap_hwmod_dma_info i2c2_sdma_reqs[] = {
541 { .name = "tx", .dma_req = OMAP24XX_DMA_I2C2_TX },
542 { .name = "rx", .dma_req = OMAP24XX_DMA_I2C2_RX },
543};
544
545static struct omap_hwmod_ocp_if *omap2430_i2c2_slaves[] = {
546 &omap2430_l4_core__i2c2,
547};
548
549static struct omap_hwmod omap2430_i2c2_hwmod = {
550 .name = "i2c2",
551 .mpu_irqs = i2c2_mpu_irqs,
552 .mpu_irqs_cnt = ARRAY_SIZE(i2c2_mpu_irqs),
553 .sdma_reqs = i2c2_sdma_reqs,
554 .sdma_reqs_cnt = ARRAY_SIZE(i2c2_sdma_reqs),
555 .main_clk = "i2chs2_fck",
556 .prcm = {
557 .omap2 = {
558 .module_offs = CORE_MOD,
559 .prcm_reg_id = 1,
560 .module_bit = OMAP2430_EN_I2CHS2_SHIFT,
561 .idlest_reg_id = 1,
562 .idlest_idle_bit = OMAP2430_ST_I2CHS2_SHIFT,
563 },
564 },
565 .slaves = omap2430_i2c2_slaves,
566 .slaves_cnt = ARRAY_SIZE(omap2430_i2c2_slaves),
567 .class = &i2c_class,
568 .dev_attr = &i2c2_dev_attr,
569 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
570};
571
421static __initdata struct omap_hwmod *omap2430_hwmods[] = { 572static __initdata struct omap_hwmod *omap2430_hwmods[] = {
422 &omap2430_l3_main_hwmod, 573 &omap2430_l3_main_hwmod,
423 &omap2430_l4_core_hwmod, 574 &omap2430_l4_core_hwmod,
@@ -428,6 +579,8 @@ static __initdata struct omap_hwmod *omap2430_hwmods[] = {
428 &omap2430_uart1_hwmod, 579 &omap2430_uart1_hwmod,
429 &omap2430_uart2_hwmod, 580 &omap2430_uart2_hwmod,
430 &omap2430_uart3_hwmod, 581 &omap2430_uart3_hwmod,
582 &omap2430_i2c1_hwmod,
583 &omap2430_i2c2_hwmod,
431 NULL, 584 NULL,
432}; 585};
433 586
@@ -435,5 +588,3 @@ int __init omap2430_hwmod_init(void)
435{ 588{
436 return omap_hwmod_init(omap2430_hwmods); 589 return omap_hwmod_init(omap2430_hwmods);
437} 590}
438
439
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index cb97ecf0a3f6..a8bed843079c 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -18,6 +18,9 @@
18#include <plat/cpu.h> 18#include <plat/cpu.h>
19#include <plat/dma.h> 19#include <plat/dma.h>
20#include <plat/serial.h> 20#include <plat/serial.h>
21#include <plat/l4_3xxx.h>
22#include <plat/i2c.h>
23#include <plat/omap34xx.h>
21 24
22#include "omap_hwmod_common_data.h" 25#include "omap_hwmod_common_data.h"
23 26
@@ -39,6 +42,9 @@ static struct omap_hwmod omap3xxx_l3_main_hwmod;
39static struct omap_hwmod omap3xxx_l4_core_hwmod; 42static struct omap_hwmod omap3xxx_l4_core_hwmod;
40static struct omap_hwmod omap3xxx_l4_per_hwmod; 43static struct omap_hwmod omap3xxx_l4_per_hwmod;
41static struct omap_hwmod omap3xxx_wd_timer2_hwmod; 44static struct omap_hwmod omap3xxx_wd_timer2_hwmod;
45static struct omap_hwmod omap3xxx_i2c1_hwmod;
46static struct omap_hwmod omap3xxx_i2c2_hwmod;
47static struct omap_hwmod omap3xxx_i2c3_hwmod;
42 48
43/* L3 -> L4_CORE interface */ 49/* L3 -> L4_CORE interface */
44static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_core = { 50static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_core = {
@@ -169,6 +175,84 @@ static struct omap_hwmod_ocp_if omap3_l4_per__uart4 = {
169 .user = OCP_USER_MPU | OCP_USER_SDMA, 175 .user = OCP_USER_MPU | OCP_USER_SDMA,
170}; 176};
171 177
178/* I2C IP block address space length (in bytes) */
179#define OMAP2_I2C_AS_LEN 128
180
181/* L4 CORE -> I2C1 interface */
182static struct omap_hwmod_addr_space omap3xxx_i2c1_addr_space[] = {
183 {
184 .pa_start = 0x48070000,
185 .pa_end = 0x48070000 + OMAP2_I2C_AS_LEN - 1,
186 .flags = ADDR_TYPE_RT,
187 },
188};
189
190static struct omap_hwmod_ocp_if omap3_l4_core__i2c1 = {
191 .master = &omap3xxx_l4_core_hwmod,
192 .slave = &omap3xxx_i2c1_hwmod,
193 .clk = "i2c1_ick",
194 .addr = omap3xxx_i2c1_addr_space,
195 .addr_cnt = ARRAY_SIZE(omap3xxx_i2c1_addr_space),
196 .fw = {
197 .omap2 = {
198 .l4_fw_region = OMAP3_L4_CORE_FW_I2C1_REGION,
199 .l4_prot_group = 7,
200 .flags = OMAP_FIREWALL_L4,
201 }
202 },
203 .user = OCP_USER_MPU | OCP_USER_SDMA,
204};
205
206/* L4 CORE -> I2C2 interface */
207static struct omap_hwmod_addr_space omap3xxx_i2c2_addr_space[] = {
208 {
209 .pa_start = 0x48072000,
210 .pa_end = 0x48072000 + OMAP2_I2C_AS_LEN - 1,
211 .flags = ADDR_TYPE_RT,
212 },
213};
214
215static struct omap_hwmod_ocp_if omap3_l4_core__i2c2 = {
216 .master = &omap3xxx_l4_core_hwmod,
217 .slave = &omap3xxx_i2c2_hwmod,
218 .clk = "i2c2_ick",
219 .addr = omap3xxx_i2c2_addr_space,
220 .addr_cnt = ARRAY_SIZE(omap3xxx_i2c2_addr_space),
221 .fw = {
222 .omap2 = {
223 .l4_fw_region = OMAP3_L4_CORE_FW_I2C2_REGION,
224 .l4_prot_group = 7,
225 .flags = OMAP_FIREWALL_L4,
226 }
227 },
228 .user = OCP_USER_MPU | OCP_USER_SDMA,
229};
230
231/* L4 CORE -> I2C3 interface */
232static struct omap_hwmod_addr_space omap3xxx_i2c3_addr_space[] = {
233 {
234 .pa_start = 0x48060000,
235 .pa_end = 0x48060000 + OMAP2_I2C_AS_LEN - 1,
236 .flags = ADDR_TYPE_RT,
237 },
238};
239
240static struct omap_hwmod_ocp_if omap3_l4_core__i2c3 = {
241 .master = &omap3xxx_l4_core_hwmod,
242 .slave = &omap3xxx_i2c3_hwmod,
243 .clk = "i2c3_ick",
244 .addr = omap3xxx_i2c3_addr_space,
245 .addr_cnt = ARRAY_SIZE(omap3xxx_i2c3_addr_space),
246 .fw = {
247 .omap2 = {
248 .l4_fw_region = OMAP3_L4_CORE_FW_I2C3_REGION,
249 .l4_prot_group = 7,
250 .flags = OMAP_FIREWALL_L4,
251 }
252 },
253 .user = OCP_USER_MPU | OCP_USER_SDMA,
254};
255
172/* Slave interfaces on the L4_CORE interconnect */ 256/* Slave interfaces on the L4_CORE interconnect */
173static struct omap_hwmod_ocp_if *omap3xxx_l4_core_slaves[] = { 257static struct omap_hwmod_ocp_if *omap3xxx_l4_core_slaves[] = {
174 &omap3xxx_l3_main__l4_core, 258 &omap3xxx_l3_main__l4_core,
@@ -179,6 +263,9 @@ static struct omap_hwmod_ocp_if *omap3xxx_l4_core_masters[] = {
179 &omap3xxx_l4_core__l4_wkup, 263 &omap3xxx_l4_core__l4_wkup,
180 &omap3_l4_core__uart1, 264 &omap3_l4_core__uart1,
181 &omap3_l4_core__uart2, 265 &omap3_l4_core__uart2,
266 &omap3_l4_core__i2c1,
267 &omap3_l4_core__i2c2,
268 &omap3_l4_core__i2c3,
182}; 269};
183 270
184/* L4 CORE */ 271/* L4 CORE */
@@ -315,6 +402,18 @@ static struct omap_hwmod_class_sysconfig omap3xxx_wd_timer_sysc = {
315 .sysc_fields = &omap_hwmod_sysc_type1, 402 .sysc_fields = &omap_hwmod_sysc_type1,
316}; 403};
317 404
405/* I2C common */
406static struct omap_hwmod_class_sysconfig i2c_sysc = {
407 .rev_offs = 0x00,
408 .sysc_offs = 0x20,
409 .syss_offs = 0x10,
410 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
411 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
412 SYSC_HAS_AUTOIDLE),
413 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
414 .sysc_fields = &omap_hwmod_sysc_type1,
415};
416
318static struct omap_hwmod_class omap3xxx_wd_timer_hwmod_class = { 417static struct omap_hwmod_class omap3xxx_wd_timer_hwmod_class = {
319 .name = "wd_timer", 418 .name = "wd_timer",
320 .sysc = &omap3xxx_wd_timer_sysc, 419 .sysc = &omap3xxx_wd_timer_sysc,
@@ -509,6 +608,137 @@ static struct omap_hwmod omap3xxx_uart4_hwmod = {
509 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3630ES1), 608 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3630ES1),
510}; 609};
511 610
611static struct omap_hwmod_class i2c_class = {
612 .name = "i2c",
613 .sysc = &i2c_sysc,
614};
615
616/* I2C1 */
617
618static struct omap_i2c_dev_attr i2c1_dev_attr = {
619 .fifo_depth = 8, /* bytes */
620};
621
622static struct omap_hwmod_irq_info i2c1_mpu_irqs[] = {
623 { .irq = INT_24XX_I2C1_IRQ, },
624};
625
626static struct omap_hwmod_dma_info i2c1_sdma_reqs[] = {
627 { .name = "tx", .dma_req = OMAP24XX_DMA_I2C1_TX },
628 { .name = "rx", .dma_req = OMAP24XX_DMA_I2C1_RX },
629};
630
631static struct omap_hwmod_ocp_if *omap3xxx_i2c1_slaves[] = {
632 &omap3_l4_core__i2c1,
633};
634
635static struct omap_hwmod omap3xxx_i2c1_hwmod = {
636 .name = "i2c1",
637 .mpu_irqs = i2c1_mpu_irqs,
638 .mpu_irqs_cnt = ARRAY_SIZE(i2c1_mpu_irqs),
639 .sdma_reqs = i2c1_sdma_reqs,
640 .sdma_reqs_cnt = ARRAY_SIZE(i2c1_sdma_reqs),
641 .main_clk = "i2c1_fck",
642 .prcm = {
643 .omap2 = {
644 .module_offs = CORE_MOD,
645 .prcm_reg_id = 1,
646 .module_bit = OMAP3430_EN_I2C1_SHIFT,
647 .idlest_reg_id = 1,
648 .idlest_idle_bit = OMAP3430_ST_I2C1_SHIFT,
649 },
650 },
651 .slaves = omap3xxx_i2c1_slaves,
652 .slaves_cnt = ARRAY_SIZE(omap3xxx_i2c1_slaves),
653 .class = &i2c_class,
654 .dev_attr = &i2c1_dev_attr,
655 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
656};
657
658/* I2C2 */
659
660static struct omap_i2c_dev_attr i2c2_dev_attr = {
661 .fifo_depth = 8, /* bytes */
662};
663
664static struct omap_hwmod_irq_info i2c2_mpu_irqs[] = {
665 { .irq = INT_24XX_I2C2_IRQ, },
666};
667
668static struct omap_hwmod_dma_info i2c2_sdma_reqs[] = {
669 { .name = "tx", .dma_req = OMAP24XX_DMA_I2C2_TX },
670 { .name = "rx", .dma_req = OMAP24XX_DMA_I2C2_RX },
671};
672
673static struct omap_hwmod_ocp_if *omap3xxx_i2c2_slaves[] = {
674 &omap3_l4_core__i2c2,
675};
676
677static struct omap_hwmod omap3xxx_i2c2_hwmod = {
678 .name = "i2c2",
679 .mpu_irqs = i2c2_mpu_irqs,
680 .mpu_irqs_cnt = ARRAY_SIZE(i2c2_mpu_irqs),
681 .sdma_reqs = i2c2_sdma_reqs,
682 .sdma_reqs_cnt = ARRAY_SIZE(i2c2_sdma_reqs),
683 .main_clk = "i2c2_fck",
684 .prcm = {
685 .omap2 = {
686 .module_offs = CORE_MOD,
687 .prcm_reg_id = 1,
688 .module_bit = OMAP3430_EN_I2C2_SHIFT,
689 .idlest_reg_id = 1,
690 .idlest_idle_bit = OMAP3430_ST_I2C2_SHIFT,
691 },
692 },
693 .slaves = omap3xxx_i2c2_slaves,
694 .slaves_cnt = ARRAY_SIZE(omap3xxx_i2c2_slaves),
695 .class = &i2c_class,
696 .dev_attr = &i2c2_dev_attr,
697 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
698};
699
700/* I2C3 */
701
702static struct omap_i2c_dev_attr i2c3_dev_attr = {
703 .fifo_depth = 64, /* bytes */
704};
705
706static struct omap_hwmod_irq_info i2c3_mpu_irqs[] = {
707 { .irq = INT_34XX_I2C3_IRQ, },
708};
709
710static struct omap_hwmod_dma_info i2c3_sdma_reqs[] = {
711 { .name = "tx", .dma_req = OMAP34XX_DMA_I2C3_TX },
712 { .name = "rx", .dma_req = OMAP34XX_DMA_I2C3_RX },
713};
714
715static struct omap_hwmod_ocp_if *omap3xxx_i2c3_slaves[] = {
716 &omap3_l4_core__i2c3,
717};
718
719static struct omap_hwmod omap3xxx_i2c3_hwmod = {
720 .name = "i2c3",
721 .mpu_irqs = i2c3_mpu_irqs,
722 .mpu_irqs_cnt = ARRAY_SIZE(i2c3_mpu_irqs),
723 .sdma_reqs = i2c3_sdma_reqs,
724 .sdma_reqs_cnt = ARRAY_SIZE(i2c3_sdma_reqs),
725 .main_clk = "i2c3_fck",
726 .prcm = {
727 .omap2 = {
728 .module_offs = CORE_MOD,
729 .prcm_reg_id = 1,
730 .module_bit = OMAP3430_EN_I2C3_SHIFT,
731 .idlest_reg_id = 1,
732 .idlest_idle_bit = OMAP3430_ST_I2C3_SHIFT,
733 },
734 },
735 .slaves = omap3xxx_i2c3_slaves,
736 .slaves_cnt = ARRAY_SIZE(omap3xxx_i2c3_slaves),
737 .class = &i2c_class,
738 .dev_attr = &i2c3_dev_attr,
739 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
740};
741
512static __initdata struct omap_hwmod *omap3xxx_hwmods[] = { 742static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
513 &omap3xxx_l3_main_hwmod, 743 &omap3xxx_l3_main_hwmod,
514 &omap3xxx_l4_core_hwmod, 744 &omap3xxx_l4_core_hwmod,
@@ -521,6 +751,9 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
521 &omap3xxx_uart2_hwmod, 751 &omap3xxx_uart2_hwmod,
522 &omap3xxx_uart3_hwmod, 752 &omap3xxx_uart3_hwmod,
523 &omap3xxx_uart4_hwmod, 753 &omap3xxx_uart4_hwmod,
754 &omap3xxx_i2c1_hwmod,
755 &omap3xxx_i2c2_hwmod,
756 &omap3xxx_i2c3_hwmod,
524 NULL, 757 NULL,
525}; 758};
526 759
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 7274db4de487..0d5c6eb7e4c1 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -383,6 +383,238 @@ static struct omap_hwmod omap44xx_l4_wkup_hwmod = {
383}; 383};
384 384
385/* 385/*
386 * 'i2c' class
387 * multimaster high-speed i2c controller
388 */
389
390static struct omap_hwmod_class_sysconfig omap44xx_i2c_sysc = {
391 .sysc_offs = 0x0010,
392 .syss_offs = 0x0090,
393 .sysc_flags = (SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
394 SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SOFTRESET |
395 SYSC_HAS_AUTOIDLE),
396 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
397 .sysc_fields = &omap_hwmod_sysc_type1,
398};
399
400static struct omap_hwmod_class omap44xx_i2c_hwmod_class = {
401 .name = "i2c",
402 .sysc = &omap44xx_i2c_sysc,
403};
404
405/* i2c1 */
406static struct omap_hwmod omap44xx_i2c1_hwmod;
407static struct omap_hwmod_irq_info omap44xx_i2c1_irqs[] = {
408 { .irq = 56 + OMAP44XX_IRQ_GIC_START },
409};
410
411static struct omap_hwmod_dma_info omap44xx_i2c1_sdma_reqs[] = {
412 { .name = "tx", .dma_req = 26 + OMAP44XX_DMA_REQ_START },
413 { .name = "rx", .dma_req = 27 + OMAP44XX_DMA_REQ_START },
414};
415
416static struct omap_hwmod_addr_space omap44xx_i2c1_addrs[] = {
417 {
418 .pa_start = 0x48070000,
419 .pa_end = 0x480700ff,
420 .flags = ADDR_TYPE_RT
421 },
422};
423
424/* l4_per -> i2c1 */
425static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c1 = {
426 .master = &omap44xx_l4_per_hwmod,
427 .slave = &omap44xx_i2c1_hwmod,
428 .clk = "l4_div_ck",
429 .addr = omap44xx_i2c1_addrs,
430 .addr_cnt = ARRAY_SIZE(omap44xx_i2c1_addrs),
431 .user = OCP_USER_MPU | OCP_USER_SDMA,
432};
433
434/* i2c1 slave ports */
435static struct omap_hwmod_ocp_if *omap44xx_i2c1_slaves[] = {
436 &omap44xx_l4_per__i2c1,
437};
438
439static struct omap_hwmod omap44xx_i2c1_hwmod = {
440 .name = "i2c1",
441 .class = &omap44xx_i2c_hwmod_class,
442 .flags = HWMOD_INIT_NO_RESET,
443 .mpu_irqs = omap44xx_i2c1_irqs,
444 .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_i2c1_irqs),
445 .sdma_reqs = omap44xx_i2c1_sdma_reqs,
446 .sdma_reqs_cnt = ARRAY_SIZE(omap44xx_i2c1_sdma_reqs),
447 .main_clk = "i2c1_fck",
448 .prcm = {
449 .omap4 = {
450 .clkctrl_reg = OMAP4430_CM_L4PER_I2C1_CLKCTRL,
451 },
452 },
453 .slaves = omap44xx_i2c1_slaves,
454 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c1_slaves),
455 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
456};
457
458/* i2c2 */
459static struct omap_hwmod omap44xx_i2c2_hwmod;
460static struct omap_hwmod_irq_info omap44xx_i2c2_irqs[] = {
461 { .irq = 57 + OMAP44XX_IRQ_GIC_START },
462};
463
464static struct omap_hwmod_dma_info omap44xx_i2c2_sdma_reqs[] = {
465 { .name = "tx", .dma_req = 28 + OMAP44XX_DMA_REQ_START },
466 { .name = "rx", .dma_req = 29 + OMAP44XX_DMA_REQ_START },
467};
468
469static struct omap_hwmod_addr_space omap44xx_i2c2_addrs[] = {
470 {
471 .pa_start = 0x48072000,
472 .pa_end = 0x480720ff,
473 .flags = ADDR_TYPE_RT
474 },
475};
476
477/* l4_per -> i2c2 */
478static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c2 = {
479 .master = &omap44xx_l4_per_hwmod,
480 .slave = &omap44xx_i2c2_hwmod,
481 .clk = "l4_div_ck",
482 .addr = omap44xx_i2c2_addrs,
483 .addr_cnt = ARRAY_SIZE(omap44xx_i2c2_addrs),
484 .user = OCP_USER_MPU | OCP_USER_SDMA,
485};
486
487/* i2c2 slave ports */
488static struct omap_hwmod_ocp_if *omap44xx_i2c2_slaves[] = {
489 &omap44xx_l4_per__i2c2,
490};
491
492static struct omap_hwmod omap44xx_i2c2_hwmod = {
493 .name = "i2c2",
494 .class = &omap44xx_i2c_hwmod_class,
495 .flags = HWMOD_INIT_NO_RESET,
496 .mpu_irqs = omap44xx_i2c2_irqs,
497 .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_i2c2_irqs),
498 .sdma_reqs = omap44xx_i2c2_sdma_reqs,
499 .sdma_reqs_cnt = ARRAY_SIZE(omap44xx_i2c2_sdma_reqs),
500 .main_clk = "i2c2_fck",
501 .prcm = {
502 .omap4 = {
503 .clkctrl_reg = OMAP4430_CM_L4PER_I2C2_CLKCTRL,
504 },
505 },
506 .slaves = omap44xx_i2c2_slaves,
507 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c2_slaves),
508 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
509};
510
511/* i2c3 */
512static struct omap_hwmod omap44xx_i2c3_hwmod;
513static struct omap_hwmod_irq_info omap44xx_i2c3_irqs[] = {
514 { .irq = 61 + OMAP44XX_IRQ_GIC_START },
515};
516
517static struct omap_hwmod_dma_info omap44xx_i2c3_sdma_reqs[] = {
518 { .name = "tx", .dma_req = 24 + OMAP44XX_DMA_REQ_START },
519 { .name = "rx", .dma_req = 25 + OMAP44XX_DMA_REQ_START },
520};
521
522static struct omap_hwmod_addr_space omap44xx_i2c3_addrs[] = {
523 {
524 .pa_start = 0x48060000,
525 .pa_end = 0x480600ff,
526 .flags = ADDR_TYPE_RT
527 },
528};
529
530/* l4_per -> i2c3 */
531static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c3 = {
532 .master = &omap44xx_l4_per_hwmod,
533 .slave = &omap44xx_i2c3_hwmod,
534 .clk = "l4_div_ck",
535 .addr = omap44xx_i2c3_addrs,
536 .addr_cnt = ARRAY_SIZE(omap44xx_i2c3_addrs),
537 .user = OCP_USER_MPU | OCP_USER_SDMA,
538};
539
540/* i2c3 slave ports */
541static struct omap_hwmod_ocp_if *omap44xx_i2c3_slaves[] = {
542 &omap44xx_l4_per__i2c3,
543};
544
545static struct omap_hwmod omap44xx_i2c3_hwmod = {
546 .name = "i2c3",
547 .class = &omap44xx_i2c_hwmod_class,
548 .flags = HWMOD_INIT_NO_RESET,
549 .mpu_irqs = omap44xx_i2c3_irqs,
550 .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_i2c3_irqs),
551 .sdma_reqs = omap44xx_i2c3_sdma_reqs,
552 .sdma_reqs_cnt = ARRAY_SIZE(omap44xx_i2c3_sdma_reqs),
553 .main_clk = "i2c3_fck",
554 .prcm = {
555 .omap4 = {
556 .clkctrl_reg = OMAP4430_CM_L4PER_I2C3_CLKCTRL,
557 },
558 },
559 .slaves = omap44xx_i2c3_slaves,
560 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c3_slaves),
561 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
562};
563
564/* i2c4 */
565static struct omap_hwmod omap44xx_i2c4_hwmod;
566static struct omap_hwmod_irq_info omap44xx_i2c4_irqs[] = {
567 { .irq = 62 + OMAP44XX_IRQ_GIC_START },
568};
569
570static struct omap_hwmod_dma_info omap44xx_i2c4_sdma_reqs[] = {
571 { .name = "tx", .dma_req = 123 + OMAP44XX_DMA_REQ_START },
572 { .name = "rx", .dma_req = 124 + OMAP44XX_DMA_REQ_START },
573};
574
575static struct omap_hwmod_addr_space omap44xx_i2c4_addrs[] = {
576 {
577 .pa_start = 0x48350000,
578 .pa_end = 0x483500ff,
579 .flags = ADDR_TYPE_RT
580 },
581};
582
583/* l4_per -> i2c4 */
584static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c4 = {
585 .master = &omap44xx_l4_per_hwmod,
586 .slave = &omap44xx_i2c4_hwmod,
587 .clk = "l4_div_ck",
588 .addr = omap44xx_i2c4_addrs,
589 .addr_cnt = ARRAY_SIZE(omap44xx_i2c4_addrs),
590 .user = OCP_USER_MPU | OCP_USER_SDMA,
591};
592
593/* i2c4 slave ports */
594static struct omap_hwmod_ocp_if *omap44xx_i2c4_slaves[] = {
595 &omap44xx_l4_per__i2c4,
596};
597
598static struct omap_hwmod omap44xx_i2c4_hwmod = {
599 .name = "i2c4",
600 .class = &omap44xx_i2c_hwmod_class,
601 .flags = HWMOD_INIT_NO_RESET,
602 .mpu_irqs = omap44xx_i2c4_irqs,
603 .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_i2c4_irqs),
604 .sdma_reqs = omap44xx_i2c4_sdma_reqs,
605 .sdma_reqs_cnt = ARRAY_SIZE(omap44xx_i2c4_sdma_reqs),
606 .main_clk = "i2c4_fck",
607 .prcm = {
608 .omap4 = {
609 .clkctrl_reg = OMAP4430_CM_L4PER_I2C4_CLKCTRL,
610 },
611 },
612 .slaves = omap44xx_i2c4_slaves,
613 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c4_slaves),
614 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
615};
616
617/*
386 * 'mpu_bus' class 618 * 'mpu_bus' class
387 * instance(s): mpu_private 619 * instance(s): mpu_private
388 */ 620 */
@@ -826,6 +1058,11 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
826 &omap44xx_l4_cfg_hwmod, 1058 &omap44xx_l4_cfg_hwmod,
827 &omap44xx_l4_per_hwmod, 1059 &omap44xx_l4_per_hwmod,
828 &omap44xx_l4_wkup_hwmod, 1060 &omap44xx_l4_wkup_hwmod,
1061 /* i2c class */
1062 &omap44xx_i2c1_hwmod,
1063 &omap44xx_i2c2_hwmod,
1064 &omap44xx_i2c3_hwmod,
1065 &omap44xx_i2c4_hwmod,
829 /* mpu_bus class */ 1066 /* mpu_bus class */
830 &omap44xx_mpu_private_hwmod, 1067 &omap44xx_mpu_private_hwmod,
831 1068
diff --git a/arch/arm/mach-omap2/prm-regbits-34xx.h b/arch/arm/mach-omap2/prm-regbits-34xx.h
index 9e63cb743a97..ec1a710db9ce 100644
--- a/arch/arm/mach-omap2/prm-regbits-34xx.h
+++ b/arch/arm/mach-omap2/prm-regbits-34xx.h
@@ -101,8 +101,11 @@
101#define OMAP3430_GRPSEL_MCSPI3_MASK (1 << 20) 101#define OMAP3430_GRPSEL_MCSPI3_MASK (1 << 20)
102#define OMAP3430_GRPSEL_MCSPI2_MASK (1 << 19) 102#define OMAP3430_GRPSEL_MCSPI2_MASK (1 << 19)
103#define OMAP3430_GRPSEL_MCSPI1_MASK (1 << 18) 103#define OMAP3430_GRPSEL_MCSPI1_MASK (1 << 18)
104#define OMAP3430_GRPSEL_I2C3_SHIFT 17
104#define OMAP3430_GRPSEL_I2C3_MASK (1 << 17) 105#define OMAP3430_GRPSEL_I2C3_MASK (1 << 17)
106#define OMAP3430_GRPSEL_I2C2_SHIFT 16
105#define OMAP3430_GRPSEL_I2C2_MASK (1 << 16) 107#define OMAP3430_GRPSEL_I2C2_MASK (1 << 16)
108#define OMAP3430_GRPSEL_I2C1_SHIFT 15
106#define OMAP3430_GRPSEL_I2C1_MASK (1 << 15) 109#define OMAP3430_GRPSEL_I2C1_MASK (1 << 15)
107#define OMAP3430_GRPSEL_UART2_MASK (1 << 14) 110#define OMAP3430_GRPSEL_UART2_MASK (1 << 14)
108#define OMAP3430_GRPSEL_UART1_MASK (1 << 13) 111#define OMAP3430_GRPSEL_UART1_MASK (1 << 13)
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index a5ce4f0aad35..a5bff9ce7cbe 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -27,18 +27,18 @@
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/i2c.h> 28#include <linux/i2c.h>
29#include <linux/i2c-omap.h> 29#include <linux/i2c-omap.h>
30#include <linux/slab.h>
31#include <linux/err.h>
32#include <linux/clk.h>
30 33
31#include <mach/irqs.h> 34#include <mach/irqs.h>
32#include <plat/mux.h> 35#include <plat/mux.h>
33#include <plat/i2c.h> 36#include <plat/i2c.h>
34#include <plat/omap-pm.h> 37#include <plat/omap-pm.h>
38#include <plat/omap_device.h>
35 39
36#define OMAP_I2C_SIZE 0x3f 40#define OMAP_I2C_SIZE 0x3f
37#define OMAP1_I2C_BASE 0xfffb3800 41#define OMAP1_I2C_BASE 0xfffb3800
38#define OMAP2_I2C_BASE1 0x48070000
39#define OMAP2_I2C_BASE2 0x48072000
40#define OMAP2_I2C_BASE3 0x48060000
41#define OMAP4_I2C_BASE4 0x48350000
42 42
43static const char name[] = "i2c_omap"; 43static const char name[] = "i2c_omap";
44 44
@@ -55,15 +55,6 @@ static const char name[] = "i2c_omap";
55 55
56static struct resource i2c_resources[][2] = { 56static struct resource i2c_resources[][2] = {
57 { I2C_RESOURCE_BUILDER(0, 0) }, 57 { I2C_RESOURCE_BUILDER(0, 0) },
58#if defined(CONFIG_ARCH_OMAP2PLUS)
59 { I2C_RESOURCE_BUILDER(OMAP2_I2C_BASE2, 0) },
60#endif
61#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
62 { I2C_RESOURCE_BUILDER(OMAP2_I2C_BASE3, 0) },
63#endif
64#if defined(CONFIG_ARCH_OMAP4)
65 { I2C_RESOURCE_BUILDER(OMAP4_I2C_BASE4, 0) },
66#endif
67}; 58};
68 59
69#define I2C_DEV_BUILDER(bus_id, res, data) \ 60#define I2C_DEV_BUILDER(bus_id, res, data) \
@@ -77,18 +68,11 @@ static struct resource i2c_resources[][2] = {
77 }, \ 68 }, \
78 } 69 }
79 70
80static struct omap_i2c_bus_platform_data i2c_pdata[ARRAY_SIZE(i2c_resources)]; 71#define MAX_OMAP_I2C_HWMOD_NAME_LEN 16
72#define OMAP_I2C_MAX_CONTROLLERS 4
73static struct omap_i2c_bus_platform_data i2c_pdata[OMAP_I2C_MAX_CONTROLLERS];
81static struct platform_device omap_i2c_devices[] = { 74static struct platform_device omap_i2c_devices[] = {
82 I2C_DEV_BUILDER(1, i2c_resources[0], &i2c_pdata[0]), 75 I2C_DEV_BUILDER(1, i2c_resources[0], &i2c_pdata[0]),
83#if defined(CONFIG_ARCH_OMAP2PLUS)
84 I2C_DEV_BUILDER(2, i2c_resources[1], &i2c_pdata[1]),
85#endif
86#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
87 I2C_DEV_BUILDER(3, i2c_resources[2], &i2c_pdata[2]),
88#endif
89#if defined(CONFIG_ARCH_OMAP4)
90 I2C_DEV_BUILDER(4, i2c_resources[3], &i2c_pdata[3]),
91#endif
92}; 76};
93 77
94#define OMAP_I2C_CMDLINE_SETUP (BIT(31)) 78#define OMAP_I2C_CMDLINE_SETUP (BIT(31))
@@ -109,35 +93,20 @@ static int __init omap_i2c_nr_ports(void)
109 return ports; 93 return ports;
110} 94}
111 95
112/* Shared between omap2 and 3 */ 96static inline int omap1_i2c_add_bus(int bus_id)
113static resource_size_t omap2_i2c_irq[3] __initdata = {
114 INT_24XX_I2C1_IRQ,
115 INT_24XX_I2C2_IRQ,
116 INT_34XX_I2C3_IRQ,
117};
118
119static resource_size_t omap4_i2c_irq[4] __initdata = {
120 OMAP44XX_IRQ_I2C1,
121 OMAP44XX_IRQ_I2C2,
122 OMAP44XX_IRQ_I2C3,
123 OMAP44XX_IRQ_I2C4,
124};
125
126static inline int omap1_i2c_add_bus(struct platform_device *pdev, int bus_id)
127{ 97{
128 struct omap_i2c_bus_platform_data *pd; 98 struct platform_device *pdev;
129 struct resource *res; 99 struct omap_i2c_bus_platform_data *pdata;
130 100
131 pd = pdev->dev.platform_data;
132 res = pdev->resource;
133 res[0].start = OMAP1_I2C_BASE;
134 res[0].end = res[0].start + OMAP_I2C_SIZE;
135 res[1].start = INT_I2C;
136 omap1_i2c_mux_pins(bus_id); 101 omap1_i2c_mux_pins(bus_id);
137 102
103 pdev = &omap_i2c_devices[bus_id - 1];
104 pdata = &i2c_pdata[bus_id - 1];
105
138 return platform_device_register(pdev); 106 return platform_device_register(pdev);
139} 107}
140 108
109
141/* 110/*
142 * XXX This function is a temporary compatibility wrapper - only 111 * XXX This function is a temporary compatibility wrapper - only
143 * needed until the I2C driver can be converted to call 112 * needed until the I2C driver can be converted to call
@@ -148,52 +117,57 @@ static void omap_pm_set_max_mpu_wakeup_lat_compat(struct device *dev, long t)
148 omap_pm_set_max_mpu_wakeup_lat(dev, t); 117 omap_pm_set_max_mpu_wakeup_lat(dev, t);
149} 118}
150 119
151static inline int omap2_i2c_add_bus(struct platform_device *pdev, int bus_id) 120static struct omap_device_pm_latency omap_i2c_latency[] = {
152{ 121 [0] = {
153 struct resource *res; 122 .deactivate_func = omap_device_idle_hwmods,
154 resource_size_t *irq; 123 .activate_func = omap_device_enable_hwmods,
124 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
125 },
126};
155 127
156 res = pdev->resource; 128static inline int omap2_i2c_add_bus(int bus_id)
129{
130 int l;
131 struct omap_hwmod *oh;
132 struct omap_device *od;
133 char oh_name[MAX_OMAP_I2C_HWMOD_NAME_LEN];
134 struct omap_i2c_bus_platform_data *pdata;
157 135
158 if (!cpu_is_omap44xx()) 136 omap2_i2c_mux_pins(bus_id);
159 irq = omap2_i2c_irq;
160 else
161 irq = omap4_i2c_irq;
162 137
163 if (bus_id == 1) { 138 l = snprintf(oh_name, MAX_OMAP_I2C_HWMOD_NAME_LEN, "i2c%d", bus_id);
164 res[0].start = OMAP2_I2C_BASE1; 139 WARN(l >= MAX_OMAP_I2C_HWMOD_NAME_LEN,
165 res[0].end = res[0].start + OMAP_I2C_SIZE; 140 "String buffer overflow in I2C%d device setup\n", bus_id);
141 oh = omap_hwmod_lookup(oh_name);
142 if (!oh) {
143 pr_err("Could not look up %s\n", oh_name);
144 return -EEXIST;
166 } 145 }
167 146
168 res[1].start = irq[bus_id - 1]; 147 pdata = &i2c_pdata[bus_id - 1];
169 omap2_i2c_mux_pins(bus_id);
170
171 /* 148 /*
172 * When waiting for completion of a i2c transfer, we need to 149 * When waiting for completion of a i2c transfer, we need to
173 * set a wake up latency constraint for the MPU. This is to 150 * set a wake up latency constraint for the MPU. This is to
174 * ensure quick enough wakeup from idle, when transfer 151 * ensure quick enough wakeup from idle, when transfer
175 * completes. 152 * completes.
153 * Only omap3 has support for constraints
176 */ 154 */
177 if (cpu_is_omap34xx()) { 155 if (cpu_is_omap34xx())
178 struct omap_i2c_bus_platform_data *pd; 156 pdata->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat;
179 157 od = omap_device_build(name, bus_id, oh, pdata,
180 pd = pdev->dev.platform_data; 158 sizeof(struct omap_i2c_bus_platform_data),
181 pd->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat; 159 omap_i2c_latency, ARRAY_SIZE(omap_i2c_latency), 0);
182 } 160 WARN(IS_ERR(od), "Could not build omap_device for %s\n", name);
183 161
184 return platform_device_register(pdev); 162 return PTR_ERR(od);
185} 163}
186 164
187static int __init omap_i2c_add_bus(int bus_id) 165static int __init omap_i2c_add_bus(int bus_id)
188{ 166{
189 struct platform_device *pdev;
190
191 pdev = &omap_i2c_devices[bus_id - 1];
192
193 if (cpu_class_is_omap1()) 167 if (cpu_class_is_omap1())
194 return omap1_i2c_add_bus(pdev, bus_id); 168 return omap1_i2c_add_bus(bus_id);
195 else 169 else
196 return omap2_i2c_add_bus(pdev, bus_id); 170 return omap2_i2c_add_bus(bus_id);
197} 171}
198 172
199/** 173/**
diff --git a/arch/arm/plat-omap/include/plat/i2c.h b/arch/arm/plat-omap/include/plat/i2c.h
index 36a0befd6168..878d632c4092 100644
--- a/arch/arm/plat-omap/include/plat/i2c.h
+++ b/arch/arm/plat-omap/include/plat/i2c.h
@@ -36,6 +36,19 @@ static inline int omap_register_i2c_bus(int bus_id, u32 clkrate,
36} 36}
37#endif 37#endif
38 38
39/**
40 * i2c_dev_attr - OMAP I2C controller device attributes for omap_hwmod
41 * @fifo_depth: total controller FIFO size (in bytes)
42 * @flags: differences in hardware support capability
43 *
44 * @fifo_depth represents what exists on the hardware, not what is
45 * actually configured at runtime by the device driver.
46 */
47struct omap_i2c_dev_attr {
48 u8 fifo_depth;
49 u8 flags;
50};
51
39void __init omap1_i2c_mux_pins(int bus_id); 52void __init omap1_i2c_mux_pins(int bus_id);
40void __init omap2_i2c_mux_pins(int bus_id); 53void __init omap2_i2c_mux_pins(int bus_id);
41 54
diff --git a/arch/arm/plat-omap/include/plat/l4_3xxx.h b/arch/arm/plat-omap/include/plat/l4_3xxx.h
new file mode 100644
index 000000000000..5e1949375422
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/l4_3xxx.h
@@ -0,0 +1,24 @@
1/*
2 * arch/arm/plat-omap/include/mach/l4_3xxx.h - L4 firewall definitions
3 *
4 * Copyright (C) 2009 Nokia Corporation
5 * Paul Walmsley
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 */
13#ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_L4_3XXX_H
14#define __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_L4_3XXX_H
15
16/* L4 CORE */
17#define OMAP3_L4_CORE_FW_I2C1_REGION 21
18#define OMAP3_L4_CORE_FW_I2C1_TA_REGION 22
19#define OMAP3_L4_CORE_FW_I2C2_REGION 23
20#define OMAP3_L4_CORE_FW_I2C2_TA_REGION 24
21#define OMAP3_L4_CORE_FW_I2C3_REGION 73
22#define OMAP3_L4_CORE_FW_I2C3_TA_REGION 74
23
24#endif