aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2010-09-29 17:10:12 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2010-11-09 12:26:08 -0500
commit2004290f55f03c52e22044a5843928cf0f6cc56a (patch)
tree0d76f6dcc7e269304819f0f9178933c5673e8486 /arch/arm/mach-omap2
parentc8ddb2713c624f432fa5fe3c7ecffcdda46ea0d4 (diff)
OMAP2xxx: hwmod: add I2C hwmods for OMAP2420, 2430
Add hwmod structures for I2C controllers on OMAP2420/2430. NOTE: I2C module on OMAP2420 has 16bit registers and causes imprecise aborts if 32bits are read/written to it. Use the HWMOD_16BIT_REG flag to notify the hmwod framework of this hard requirement so that __raw_writew/readw is used to read /write the mdoule registers. Signed-off-by: Paul Walmsley <paul@pwsan.com> Signed-off-by: Rajendra Nayak <rnayak@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-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
3 files changed, 299 insertions, 5 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