aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2010-10-08 13:20:40 -0400
committerTony Lindgren <tony@atomide.com>2010-10-08 13:20:40 -0400
commitbc3caae8a191c712d8ae666d0b8d18807bfe2b14 (patch)
tree7b338ebba2f1fdbcee3785789bf9f4a74d93aa94 /arch
parent73c5ef126f40b0b872e5964ff65dbe792eeec493 (diff)
parent69758ab7a1e2de5636a2188d5357dd03140bf1d8 (diff)
Merge branch 'pm-hwmods' 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-omap1/devices.c27
-rw-r--r--arch/arm/mach-omap2/Kconfig11
-rw-r--r--arch/arm/mach-omap2/board-3630sdp.c1
-rw-r--r--arch/arm/mach-omap2/board-zoom-peripherals.c1
-rw-r--r--arch/arm/mach-omap2/clock3xxx_data.c22
-rw-r--r--arch/arm/mach-omap2/cm-regbits-34xx.h2
-rw-r--r--arch/arm/mach-omap2/devices.c39
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c257
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c257
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c319
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c368
-rw-r--r--arch/arm/mach-omap2/pm34xx.c17
-rw-r--r--arch/arm/mach-omap2/prcm-common.h5
-rw-r--r--arch/arm/mach-omap2/prm-regbits-34xx.h1
-rw-r--r--arch/arm/mach-omap2/serial.c555
-rw-r--r--arch/arm/plat-omap/common.c16
-rw-r--r--arch/arm/plat-omap/devices.c41
-rw-r--r--arch/arm/plat-omap/include/plat/common.h1
-rw-r--r--arch/arm/plat-omap/include/plat/dma.h2
-rw-r--r--arch/arm/plat-omap/include/plat/irqs.h2
-rw-r--r--arch/arm/plat-omap/include/plat/omap-serial.h129
21 files changed, 1736 insertions, 337 deletions
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 2c9a030c559..63d68cf908a 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -275,3 +275,30 @@ static int __init omap1_init_devices(void)
275} 275}
276arch_initcall(omap1_init_devices); 276arch_initcall(omap1_init_devices);
277 277
278#if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
279
280static struct resource wdt_resources[] = {
281 {
282 .start = 0xfffeb000,
283 .end = 0xfffeb07F,
284 .flags = IORESOURCE_MEM,
285 },
286};
287
288static struct platform_device omap_wdt_device = {
289 .name = "omap_wdt",
290 .id = -1,
291 .num_resources = ARRAY_SIZE(wdt_resources),
292 .resource = wdt_resources,
293};
294
295static int __init omap_init_wdt(void)
296{
297 if (!cpu_is_omap16xx())
298 return;
299
300 platform_device_register(&omap_wdt_device);
301 return 0;
302}
303subsys_initcall(omap_init_wdt);
304#endif
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 1c4b2377862..91dd215d05f 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -11,9 +11,8 @@ config ARCH_OMAP2PLUS_TYPICAL
11 select PM_RUNTIME 11 select PM_RUNTIME
12 select VFP 12 select VFP
13 select NEON if ARCH_OMAP3 || ARCH_OMAP4 13 select NEON if ARCH_OMAP3 || ARCH_OMAP4
14 select SERIAL_8250 14 select SERIAL_OMAP
15 select SERIAL_CORE_CONSOLE 15 select SERIAL_OMAP_CONSOLE
16 select SERIAL_8250_CONSOLE
17 select I2C 16 select I2C
18 select I2C_OMAP 17 select I2C_OMAP
19 select MFD 18 select MFD
@@ -222,12 +221,18 @@ config MACH_OMAP_ZOOM2
222 depends on ARCH_OMAP3 221 depends on ARCH_OMAP3
223 default y 222 default y
224 select OMAP_PACKAGE_CBB 223 select OMAP_PACKAGE_CBB
224 select SERIAL_8250
225 select SERIAL_CORE_CONSOLE
226 select SERIAL_8250_CONSOLE
225 227
226config MACH_OMAP_ZOOM3 228config MACH_OMAP_ZOOM3
227 bool "OMAP3630 Zoom3 board" 229 bool "OMAP3630 Zoom3 board"
228 depends on ARCH_OMAP3 230 depends on ARCH_OMAP3
229 default y 231 default y
230 select OMAP_PACKAGE_CBP 232 select OMAP_PACKAGE_CBP
233 select SERIAL_8250
234 select SERIAL_CORE_CONSOLE
235 select SERIAL_8250_CONSOLE
231 236
232config MACH_CM_T35 237config MACH_CM_T35
233 bool "CompuLab CM-T35 module" 238 bool "CompuLab CM-T35 module"
diff --git a/arch/arm/mach-omap2/board-3630sdp.c b/arch/arm/mach-omap2/board-3630sdp.c
index 2b2e0efd557..3ef092f839c 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -208,7 +208,6 @@ static struct flash_partitions sdp_flash_partitions[] = {
208static void __init omap_sdp_init(void) 208static void __init omap_sdp_init(void)
209{ 209{
210 omap3_mux_init(board_mux, OMAP_PACKAGE_CBP); 210 omap3_mux_init(board_mux, OMAP_PACKAGE_CBP);
211 omap_serial_init();
212 zoom_peripherals_init(); 211 zoom_peripherals_init();
213 board_smc91x_init(); 212 board_smc91x_init();
214 board_flash_init(sdp_flash_partitions, chip_sel_sdp); 213 board_flash_init(sdp_flash_partitions, chip_sel_sdp);
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
index 073fd9b4c36..239c1f0eb94 100644
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -285,4 +285,5 @@ void __init zoom_peripherals_init(void)
285 omap_i2c_init(); 285 omap_i2c_init();
286 usb_musb_init(&musb_board_data); 286 usb_musb_init(&musb_board_data);
287 enable_board_wakeup_source(); 287 enable_board_wakeup_source();
288 omap_serial_init();
288} 289}
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
index c73906d1745..ba01ec0cae4 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -2465,6 +2465,16 @@ static struct clk uart3_fck = {
2465 .recalc = &followparent_recalc, 2465 .recalc = &followparent_recalc,
2466}; 2466};
2467 2467
2468static struct clk uart4_fck = {
2469 .name = "uart4_fck",
2470 .ops = &clkops_omap2_dflt_wait,
2471 .parent = &per_48m_fck,
2472 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2473 .enable_bit = OMAP3630_EN_UART4_SHIFT,
2474 .clkdm_name = "per_clkdm",
2475 .recalc = &followparent_recalc,
2476};
2477
2468static struct clk gpt2_fck = { 2478static struct clk gpt2_fck = {
2469 .name = "gpt2_fck", 2479 .name = "gpt2_fck",
2470 .ops = &clkops_omap2_dflt_wait, 2480 .ops = &clkops_omap2_dflt_wait,
@@ -2715,6 +2725,16 @@ static struct clk uart3_ick = {
2715 .recalc = &followparent_recalc, 2725 .recalc = &followparent_recalc,
2716}; 2726};
2717 2727
2728static struct clk uart4_ick = {
2729 .name = "uart4_ick",
2730 .ops = &clkops_omap2_dflt_wait,
2731 .parent = &per_l4_ick,
2732 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2733 .enable_bit = OMAP3630_EN_UART4_SHIFT,
2734 .clkdm_name = "per_clkdm",
2735 .recalc = &followparent_recalc,
2736};
2737
2718static struct clk gpt9_ick = { 2738static struct clk gpt9_ick = {
2719 .name = "gpt9_ick", 2739 .name = "gpt9_ick",
2720 .ops = &clkops_omap2_dflt_wait, 2740 .ops = &clkops_omap2_dflt_wait,
@@ -3349,6 +3369,7 @@ static struct omap_clk omap3xxx_clks[] = {
3349 CLK(NULL, "per_96m_fck", &per_96m_fck, CK_3XXX), 3369 CLK(NULL, "per_96m_fck", &per_96m_fck, CK_3XXX),
3350 CLK(NULL, "per_48m_fck", &per_48m_fck, CK_3XXX), 3370 CLK(NULL, "per_48m_fck", &per_48m_fck, CK_3XXX),
3351 CLK(NULL, "uart3_fck", &uart3_fck, CK_3XXX), 3371 CLK(NULL, "uart3_fck", &uart3_fck, CK_3XXX),
3372 CLK(NULL, "uart4_fck", &uart4_fck, CK_36XX),
3352 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_3XXX), 3373 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_3XXX),
3353 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_3XXX), 3374 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_3XXX),
3354 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_3XXX), 3375 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_3XXX),
@@ -3372,6 +3393,7 @@ static struct omap_clk omap3xxx_clks[] = {
3372 CLK(NULL, "gpio2_ick", &gpio2_ick, CK_3XXX), 3393 CLK(NULL, "gpio2_ick", &gpio2_ick, CK_3XXX),
3373 CLK(NULL, "wdt3_ick", &wdt3_ick, CK_3XXX), 3394 CLK(NULL, "wdt3_ick", &wdt3_ick, CK_3XXX),
3374 CLK(NULL, "uart3_ick", &uart3_ick, CK_3XXX), 3395 CLK(NULL, "uart3_ick", &uart3_ick, CK_3XXX),
3396 CLK(NULL, "uart4_ick", &uart4_ick, CK_36XX),
3375 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_3XXX), 3397 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_3XXX),
3376 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_3XXX), 3398 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_3XXX),
3377 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_3XXX), 3399 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_3XXX),
diff --git a/arch/arm/mach-omap2/cm-regbits-34xx.h b/arch/arm/mach-omap2/cm-regbits-34xx.h
index fe82b79d5f3..4f959a7d881 100644
--- a/arch/arm/mach-omap2/cm-regbits-34xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-34xx.h
@@ -649,6 +649,8 @@
649#define OMAP3430_ST_MCBSP2_MASK (1 << 0) 649#define OMAP3430_ST_MCBSP2_MASK (1 << 0)
650 650
651/* CM_AUTOIDLE_PER */ 651/* CM_AUTOIDLE_PER */
652#define OMAP3630_AUTO_UART4_MASK (1 << 18)
653#define OMAP3630_AUTO_UART4_SHIFT 18
652#define OMAP3430_AUTO_GPIO6_MASK (1 << 17) 654#define OMAP3430_AUTO_GPIO6_MASK (1 << 17)
653#define OMAP3430_AUTO_GPIO6_SHIFT 17 655#define OMAP3430_AUTO_GPIO6_SHIFT 17
654#define OMAP3430_AUTO_GPIO5_MASK (1 << 16) 656#define OMAP3430_AUTO_GPIO5_MASK (1 << 16)
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 9bd4b345245..5eb0b58b2e9 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -15,6 +15,7 @@
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/clk.h> 17#include <linux/clk.h>
18#include <linux/err.h>
18 19
19#include <mach/hardware.h> 20#include <mach/hardware.h>
20#include <mach/irqs.h> 21#include <mach/irqs.h>
@@ -28,6 +29,8 @@
28#include <mach/gpio.h> 29#include <mach/gpio.h>
29#include <plat/mmc.h> 30#include <plat/mmc.h>
30#include <plat/dma.h> 31#include <plat/dma.h>
32#include <plat/omap_hwmod.h>
33#include <plat/omap_device.h>
31 34
32#include "mux.h" 35#include "mux.h"
33 36
@@ -930,3 +933,39 @@ static int __init omap2_init_devices(void)
930 return 0; 933 return 0;
931} 934}
932arch_initcall(omap2_init_devices); 935arch_initcall(omap2_init_devices);
936
937#if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
938struct omap_device_pm_latency omap_wdt_latency[] = {
939 [0] = {
940 .deactivate_func = omap_device_idle_hwmods,
941 .activate_func = omap_device_enable_hwmods,
942 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
943 },
944};
945
946static int __init omap_init_wdt(void)
947{
948 int id = -1;
949 struct omap_device *od;
950 struct omap_hwmod *oh;
951 char *oh_name = "wd_timer2";
952 char *dev_name = "omap_wdt";
953
954 if (!cpu_class_is_omap2())
955 return 0;
956
957 oh = omap_hwmod_lookup(oh_name);
958 if (!oh) {
959 pr_err("Could not look up wd_timer%d hwmod\n", id);
960 return -EINVAL;
961 }
962
963 od = omap_device_build(dev_name, id, oh, NULL, 0,
964 omap_wdt_latency,
965 ARRAY_SIZE(omap_wdt_latency), 0);
966 WARN(IS_ERR(od), "Cant build omap_device for %s:%s.\n",
967 dev_name, oh->name);
968 return 0;
969}
970subsys_initcall(omap_init_wdt);
971#endif
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index 3cc768e8bc0..adf6e3632a2 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -15,10 +15,12 @@
15#include <mach/irqs.h> 15#include <mach/irqs.h>
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 19
19#include "omap_hwmod_common_data.h" 20#include "omap_hwmod_common_data.h"
20 21
21#include "prm-regbits-24xx.h" 22#include "prm-regbits-24xx.h"
23#include "cm-regbits-24xx.h"
22 24
23/* 25/*
24 * OMAP2420 hardware module integration data 26 * OMAP2420 hardware module integration data
@@ -33,6 +35,7 @@ static struct omap_hwmod omap2420_mpu_hwmod;
33static struct omap_hwmod omap2420_iva_hwmod; 35static struct omap_hwmod omap2420_iva_hwmod;
34static struct omap_hwmod omap2420_l3_main_hwmod; 36static struct omap_hwmod omap2420_l3_main_hwmod;
35static struct omap_hwmod omap2420_l4_core_hwmod; 37static struct omap_hwmod omap2420_l4_core_hwmod;
38static struct omap_hwmod omap2420_wd_timer2_hwmod;
36 39
37/* L3 -> L4_CORE interface */ 40/* L3 -> L4_CORE interface */
38static struct omap_hwmod_ocp_if omap2420_l3_main__l4_core = { 41static struct omap_hwmod_ocp_if omap2420_l3_main__l4_core = {
@@ -71,6 +74,9 @@ static struct omap_hwmod omap2420_l3_main_hwmod = {
71}; 74};
72 75
73static struct omap_hwmod omap2420_l4_wkup_hwmod; 76static struct omap_hwmod omap2420_l4_wkup_hwmod;
77static struct omap_hwmod omap2420_uart1_hwmod;
78static struct omap_hwmod omap2420_uart2_hwmod;
79static struct omap_hwmod omap2420_uart3_hwmod;
74 80
75/* L4_CORE -> L4_WKUP interface */ 81/* L4_CORE -> L4_WKUP interface */
76static struct omap_hwmod_ocp_if omap2420_l4_core__l4_wkup = { 82static struct omap_hwmod_ocp_if omap2420_l4_core__l4_wkup = {
@@ -79,6 +85,60 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__l4_wkup = {
79 .user = OCP_USER_MPU | OCP_USER_SDMA, 85 .user = OCP_USER_MPU | OCP_USER_SDMA,
80}; 86};
81 87
88/* L4 CORE -> UART1 interface */
89static struct omap_hwmod_addr_space omap2420_uart1_addr_space[] = {
90 {
91 .pa_start = OMAP2_UART1_BASE,
92 .pa_end = OMAP2_UART1_BASE + SZ_8K - 1,
93 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
94 },
95};
96
97static struct omap_hwmod_ocp_if omap2_l4_core__uart1 = {
98 .master = &omap2420_l4_core_hwmod,
99 .slave = &omap2420_uart1_hwmod,
100 .clk = "uart1_ick",
101 .addr = omap2420_uart1_addr_space,
102 .addr_cnt = ARRAY_SIZE(omap2420_uart1_addr_space),
103 .user = OCP_USER_MPU | OCP_USER_SDMA,
104};
105
106/* L4 CORE -> UART2 interface */
107static struct omap_hwmod_addr_space omap2420_uart2_addr_space[] = {
108 {
109 .pa_start = OMAP2_UART2_BASE,
110 .pa_end = OMAP2_UART2_BASE + SZ_1K - 1,
111 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
112 },
113};
114
115static struct omap_hwmod_ocp_if omap2_l4_core__uart2 = {
116 .master = &omap2420_l4_core_hwmod,
117 .slave = &omap2420_uart2_hwmod,
118 .clk = "uart2_ick",
119 .addr = omap2420_uart2_addr_space,
120 .addr_cnt = ARRAY_SIZE(omap2420_uart2_addr_space),
121 .user = OCP_USER_MPU | OCP_USER_SDMA,
122};
123
124/* L4 PER -> UART3 interface */
125static struct omap_hwmod_addr_space omap2420_uart3_addr_space[] = {
126 {
127 .pa_start = OMAP2_UART3_BASE,
128 .pa_end = OMAP2_UART3_BASE + SZ_1K - 1,
129 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
130 },
131};
132
133static struct omap_hwmod_ocp_if omap2_l4_core__uart3 = {
134 .master = &omap2420_l4_core_hwmod,
135 .slave = &omap2420_uart3_hwmod,
136 .clk = "uart3_ick",
137 .addr = omap2420_uart3_addr_space,
138 .addr_cnt = ARRAY_SIZE(omap2420_uart3_addr_space),
139 .user = OCP_USER_MPU | OCP_USER_SDMA,
140};
141
82/* Slave interfaces on the L4_CORE interconnect */ 142/* Slave interfaces on the L4_CORE interconnect */
83static struct omap_hwmod_ocp_if *omap2420_l4_core_slaves[] = { 143static struct omap_hwmod_ocp_if *omap2420_l4_core_slaves[] = {
84 &omap2420_l3_main__l4_core, 144 &omap2420_l3_main__l4_core,
@@ -87,6 +147,9 @@ static struct omap_hwmod_ocp_if *omap2420_l4_core_slaves[] = {
87/* Master interfaces on the L4_CORE interconnect */ 147/* Master interfaces on the L4_CORE interconnect */
88static struct omap_hwmod_ocp_if *omap2420_l4_core_masters[] = { 148static struct omap_hwmod_ocp_if *omap2420_l4_core_masters[] = {
89 &omap2420_l4_core__l4_wkup, 149 &omap2420_l4_core__l4_wkup,
150 &omap2_l4_core__uart1,
151 &omap2_l4_core__uart2,
152 &omap2_l4_core__uart3,
90}; 153};
91 154
92/* L4 CORE */ 155/* L4 CORE */
@@ -165,12 +228,206 @@ static struct omap_hwmod omap2420_iva_hwmod = {
165 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420) 228 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
166}; 229};
167 230
231/* l4_wkup -> wd_timer2 */
232static struct omap_hwmod_addr_space omap2420_wd_timer2_addrs[] = {
233 {
234 .pa_start = 0x48022000,
235 .pa_end = 0x4802207f,
236 .flags = ADDR_TYPE_RT
237 },
238};
239
240static struct omap_hwmod_ocp_if omap2420_l4_wkup__wd_timer2 = {
241 .master = &omap2420_l4_wkup_hwmod,
242 .slave = &omap2420_wd_timer2_hwmod,
243 .clk = "mpu_wdt_ick",
244 .addr = omap2420_wd_timer2_addrs,
245 .addr_cnt = ARRAY_SIZE(omap2420_wd_timer2_addrs),
246 .user = OCP_USER_MPU | OCP_USER_SDMA,
247};
248
249/*
250 * 'wd_timer' class
251 * 32-bit watchdog upward counter that generates a pulse on the reset pin on
252 * overflow condition
253 */
254
255static struct omap_hwmod_class_sysconfig omap2420_wd_timer_sysc = {
256 .rev_offs = 0x0000,
257 .sysc_offs = 0x0010,
258 .syss_offs = 0x0014,
259 .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_SOFTRESET |
260 SYSC_HAS_AUTOIDLE),
261 .sysc_fields = &omap_hwmod_sysc_type1,
262};
263
264static struct omap_hwmod_class omap2420_wd_timer_hwmod_class = {
265 .name = "wd_timer",
266 .sysc = &omap2420_wd_timer_sysc,
267};
268
269/* wd_timer2 */
270static struct omap_hwmod_ocp_if *omap2420_wd_timer2_slaves[] = {
271 &omap2420_l4_wkup__wd_timer2,
272};
273
274static struct omap_hwmod omap2420_wd_timer2_hwmod = {
275 .name = "wd_timer2",
276 .class = &omap2420_wd_timer_hwmod_class,
277 .main_clk = "mpu_wdt_fck",
278 .prcm = {
279 .omap2 = {
280 .prcm_reg_id = 1,
281 .module_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
282 .module_offs = WKUP_MOD,
283 .idlest_reg_id = 1,
284 .idlest_idle_bit = OMAP24XX_ST_MPU_WDT_SHIFT,
285 },
286 },
287 .slaves = omap2420_wd_timer2_slaves,
288 .slaves_cnt = ARRAY_SIZE(omap2420_wd_timer2_slaves),
289 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
290};
291
292/* UART */
293
294static struct omap_hwmod_class_sysconfig uart_sysc = {
295 .rev_offs = 0x50,
296 .sysc_offs = 0x54,
297 .syss_offs = 0x58,
298 .sysc_flags = (SYSC_HAS_SIDLEMODE |
299 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
300 SYSC_HAS_AUTOIDLE),
301 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
302 .sysc_fields = &omap_hwmod_sysc_type1,
303};
304
305static struct omap_hwmod_class uart_class = {
306 .name = "uart",
307 .sysc = &uart_sysc,
308};
309
310/* UART1 */
311
312static struct omap_hwmod_irq_info uart1_mpu_irqs[] = {
313 { .irq = INT_24XX_UART1_IRQ, },
314};
315
316static struct omap_hwmod_dma_info uart1_sdma_reqs[] = {
317 { .name = "rx", .dma_req = OMAP24XX_DMA_UART1_RX, },
318 { .name = "tx", .dma_req = OMAP24XX_DMA_UART1_TX, },
319};
320
321static struct omap_hwmod_ocp_if *omap2420_uart1_slaves[] = {
322 &omap2_l4_core__uart1,
323};
324
325static struct omap_hwmod omap2420_uart1_hwmod = {
326 .name = "uart1",
327 .mpu_irqs = uart1_mpu_irqs,
328 .mpu_irqs_cnt = ARRAY_SIZE(uart1_mpu_irqs),
329 .sdma_reqs = uart1_sdma_reqs,
330 .sdma_reqs_cnt = ARRAY_SIZE(uart1_sdma_reqs),
331 .main_clk = "uart1_fck",
332 .prcm = {
333 .omap2 = {
334 .module_offs = CORE_MOD,
335 .prcm_reg_id = 1,
336 .module_bit = OMAP24XX_EN_UART1_SHIFT,
337 .idlest_reg_id = 1,
338 .idlest_idle_bit = OMAP24XX_EN_UART1_SHIFT,
339 },
340 },
341 .slaves = omap2420_uart1_slaves,
342 .slaves_cnt = ARRAY_SIZE(omap2420_uart1_slaves),
343 .class = &uart_class,
344 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
345};
346
347/* UART2 */
348
349static struct omap_hwmod_irq_info uart2_mpu_irqs[] = {
350 { .irq = INT_24XX_UART2_IRQ, },
351};
352
353static struct omap_hwmod_dma_info uart2_sdma_reqs[] = {
354 { .name = "rx", .dma_req = OMAP24XX_DMA_UART2_RX, },
355 { .name = "tx", .dma_req = OMAP24XX_DMA_UART2_TX, },
356};
357
358static struct omap_hwmod_ocp_if *omap2420_uart2_slaves[] = {
359 &omap2_l4_core__uart2,
360};
361
362static struct omap_hwmod omap2420_uart2_hwmod = {
363 .name = "uart2",
364 .mpu_irqs = uart2_mpu_irqs,
365 .mpu_irqs_cnt = ARRAY_SIZE(uart2_mpu_irqs),
366 .sdma_reqs = uart2_sdma_reqs,
367 .sdma_reqs_cnt = ARRAY_SIZE(uart2_sdma_reqs),
368 .main_clk = "uart2_fck",
369 .prcm = {
370 .omap2 = {
371 .module_offs = CORE_MOD,
372 .prcm_reg_id = 1,
373 .module_bit = OMAP24XX_EN_UART2_SHIFT,
374 .idlest_reg_id = 1,
375 .idlest_idle_bit = OMAP24XX_EN_UART2_SHIFT,
376 },
377 },
378 .slaves = omap2420_uart2_slaves,
379 .slaves_cnt = ARRAY_SIZE(omap2420_uart2_slaves),
380 .class = &uart_class,
381 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
382};
383
384/* UART3 */
385
386static struct omap_hwmod_irq_info uart3_mpu_irqs[] = {
387 { .irq = INT_24XX_UART3_IRQ, },
388};
389
390static struct omap_hwmod_dma_info uart3_sdma_reqs[] = {
391 { .name = "rx", .dma_req = OMAP24XX_DMA_UART3_RX, },
392 { .name = "tx", .dma_req = OMAP24XX_DMA_UART3_TX, },
393};
394
395static struct omap_hwmod_ocp_if *omap2420_uart3_slaves[] = {
396 &omap2_l4_core__uart3,
397};
398
399static struct omap_hwmod omap2420_uart3_hwmod = {
400 .name = "uart3",
401 .mpu_irqs = uart3_mpu_irqs,
402 .mpu_irqs_cnt = ARRAY_SIZE(uart3_mpu_irqs),
403 .sdma_reqs = uart3_sdma_reqs,
404 .sdma_reqs_cnt = ARRAY_SIZE(uart3_sdma_reqs),
405 .main_clk = "uart3_fck",
406 .prcm = {
407 .omap2 = {
408 .module_offs = CORE_MOD,
409 .prcm_reg_id = 2,
410 .module_bit = OMAP24XX_EN_UART3_SHIFT,
411 .idlest_reg_id = 2,
412 .idlest_idle_bit = OMAP24XX_EN_UART3_SHIFT,
413 },
414 },
415 .slaves = omap2420_uart3_slaves,
416 .slaves_cnt = ARRAY_SIZE(omap2420_uart3_slaves),
417 .class = &uart_class,
418 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
419};
420
168static __initdata struct omap_hwmod *omap2420_hwmods[] = { 421static __initdata struct omap_hwmod *omap2420_hwmods[] = {
169 &omap2420_l3_main_hwmod, 422 &omap2420_l3_main_hwmod,
170 &omap2420_l4_core_hwmod, 423 &omap2420_l4_core_hwmod,
171 &omap2420_l4_wkup_hwmod, 424 &omap2420_l4_wkup_hwmod,
172 &omap2420_mpu_hwmod, 425 &omap2420_mpu_hwmod,
173 &omap2420_iva_hwmod, 426 &omap2420_iva_hwmod,
427 &omap2420_wd_timer2_hwmod,
428 &omap2420_uart1_hwmod,
429 &omap2420_uart2_hwmod,
430 &omap2420_uart3_hwmod,
174 NULL, 431 NULL,
175}; 432};
176 433
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index 4526628ed28..12d939e456c 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -15,10 +15,12 @@
15#include <mach/irqs.h> 15#include <mach/irqs.h>
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 19
19#include "omap_hwmod_common_data.h" 20#include "omap_hwmod_common_data.h"
20 21
21#include "prm-regbits-24xx.h" 22#include "prm-regbits-24xx.h"
23#include "cm-regbits-24xx.h"
22 24
23/* 25/*
24 * OMAP2430 hardware module integration data 26 * OMAP2430 hardware module integration data
@@ -33,6 +35,7 @@ static struct omap_hwmod omap2430_mpu_hwmod;
33static struct omap_hwmod omap2430_iva_hwmod; 35static struct omap_hwmod omap2430_iva_hwmod;
34static struct omap_hwmod omap2430_l3_main_hwmod; 36static struct omap_hwmod omap2430_l3_main_hwmod;
35static struct omap_hwmod omap2430_l4_core_hwmod; 37static struct omap_hwmod omap2430_l4_core_hwmod;
38static struct omap_hwmod omap2430_wd_timer2_hwmod;
36 39
37/* L3 -> L4_CORE interface */ 40/* L3 -> L4_CORE interface */
38static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = { 41static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = {
@@ -71,6 +74,9 @@ static struct omap_hwmod omap2430_l3_main_hwmod = {
71}; 74};
72 75
73static struct omap_hwmod omap2430_l4_wkup_hwmod; 76static struct omap_hwmod omap2430_l4_wkup_hwmod;
77static struct omap_hwmod omap2430_uart1_hwmod;
78static struct omap_hwmod omap2430_uart2_hwmod;
79static struct omap_hwmod omap2430_uart3_hwmod;
74 80
75/* L4_CORE -> L4_WKUP interface */ 81/* L4_CORE -> L4_WKUP interface */
76static struct omap_hwmod_ocp_if omap2430_l4_core__l4_wkup = { 82static struct omap_hwmod_ocp_if omap2430_l4_core__l4_wkup = {
@@ -79,6 +85,60 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__l4_wkup = {
79 .user = OCP_USER_MPU | OCP_USER_SDMA, 85 .user = OCP_USER_MPU | OCP_USER_SDMA,
80}; 86};
81 87
88/* L4 CORE -> UART1 interface */
89static struct omap_hwmod_addr_space omap2430_uart1_addr_space[] = {
90 {
91 .pa_start = OMAP2_UART1_BASE,
92 .pa_end = OMAP2_UART1_BASE + SZ_8K - 1,
93 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
94 },
95};
96
97static struct omap_hwmod_ocp_if omap2_l4_core__uart1 = {
98 .master = &omap2430_l4_core_hwmod,
99 .slave = &omap2430_uart1_hwmod,
100 .clk = "uart1_ick",
101 .addr = omap2430_uart1_addr_space,
102 .addr_cnt = ARRAY_SIZE(omap2430_uart1_addr_space),
103 .user = OCP_USER_MPU | OCP_USER_SDMA,
104};
105
106/* L4 CORE -> UART2 interface */
107static struct omap_hwmod_addr_space omap2430_uart2_addr_space[] = {
108 {
109 .pa_start = OMAP2_UART2_BASE,
110 .pa_end = OMAP2_UART2_BASE + SZ_1K - 1,
111 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
112 },
113};
114
115static struct omap_hwmod_ocp_if omap2_l4_core__uart2 = {
116 .master = &omap2430_l4_core_hwmod,
117 .slave = &omap2430_uart2_hwmod,
118 .clk = "uart2_ick",
119 .addr = omap2430_uart2_addr_space,
120 .addr_cnt = ARRAY_SIZE(omap2430_uart2_addr_space),
121 .user = OCP_USER_MPU | OCP_USER_SDMA,
122};
123
124/* L4 PER -> UART3 interface */
125static struct omap_hwmod_addr_space omap2430_uart3_addr_space[] = {
126 {
127 .pa_start = OMAP2_UART3_BASE,
128 .pa_end = OMAP2_UART3_BASE + SZ_1K - 1,
129 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
130 },
131};
132
133static struct omap_hwmod_ocp_if omap2_l4_core__uart3 = {
134 .master = &omap2430_l4_core_hwmod,
135 .slave = &omap2430_uart3_hwmod,
136 .clk = "uart3_ick",
137 .addr = omap2430_uart3_addr_space,
138 .addr_cnt = ARRAY_SIZE(omap2430_uart3_addr_space),
139 .user = OCP_USER_MPU | OCP_USER_SDMA,
140};
141
82/* Slave interfaces on the L4_CORE interconnect */ 142/* Slave interfaces on the L4_CORE interconnect */
83static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = { 143static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = {
84 &omap2430_l3_main__l4_core, 144 &omap2430_l3_main__l4_core,
@@ -104,6 +164,9 @@ static struct omap_hwmod omap2430_l4_core_hwmod = {
104/* Slave interfaces on the L4_WKUP interconnect */ 164/* Slave interfaces on the L4_WKUP interconnect */
105static struct omap_hwmod_ocp_if *omap2430_l4_wkup_slaves[] = { 165static struct omap_hwmod_ocp_if *omap2430_l4_wkup_slaves[] = {
106 &omap2430_l4_core__l4_wkup, 166 &omap2430_l4_core__l4_wkup,
167 &omap2_l4_core__uart1,
168 &omap2_l4_core__uart2,
169 &omap2_l4_core__uart3,
107}; 170};
108 171
109/* Master interfaces on the L4_WKUP interconnect */ 172/* Master interfaces on the L4_WKUP interconnect */
@@ -165,12 +228,206 @@ static struct omap_hwmod omap2430_iva_hwmod = {
165 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430) 228 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
166}; 229};
167 230
231/* l4_wkup -> wd_timer2 */
232static struct omap_hwmod_addr_space omap2430_wd_timer2_addrs[] = {
233 {
234 .pa_start = 0x49016000,
235 .pa_end = 0x4901607f,
236 .flags = ADDR_TYPE_RT
237 },
238};
239
240static struct omap_hwmod_ocp_if omap2430_l4_wkup__wd_timer2 = {
241 .master = &omap2430_l4_wkup_hwmod,
242 .slave = &omap2430_wd_timer2_hwmod,
243 .clk = "mpu_wdt_ick",
244 .addr = omap2430_wd_timer2_addrs,
245 .addr_cnt = ARRAY_SIZE(omap2430_wd_timer2_addrs),
246 .user = OCP_USER_MPU | OCP_USER_SDMA,
247};
248
249/*
250 * 'wd_timer' class
251 * 32-bit watchdog upward counter that generates a pulse on the reset pin on
252 * overflow condition
253 */
254
255static struct omap_hwmod_class_sysconfig omap2430_wd_timer_sysc = {
256 .rev_offs = 0x0,
257 .sysc_offs = 0x0010,
258 .syss_offs = 0x0014,
259 .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_SOFTRESET |
260 SYSC_HAS_AUTOIDLE),
261 .sysc_fields = &omap_hwmod_sysc_type1,
262};
263
264static struct omap_hwmod_class omap2430_wd_timer_hwmod_class = {
265 .name = "wd_timer",
266 .sysc = &omap2430_wd_timer_sysc,
267};
268
269/* wd_timer2 */
270static struct omap_hwmod_ocp_if *omap2430_wd_timer2_slaves[] = {
271 &omap2430_l4_wkup__wd_timer2,
272};
273
274static struct omap_hwmod omap2430_wd_timer2_hwmod = {
275 .name = "wd_timer2",
276 .class = &omap2430_wd_timer_hwmod_class,
277 .main_clk = "mpu_wdt_fck",
278 .prcm = {
279 .omap2 = {
280 .prcm_reg_id = 1,
281 .module_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
282 .module_offs = WKUP_MOD,
283 .idlest_reg_id = 1,
284 .idlest_idle_bit = OMAP24XX_ST_MPU_WDT_SHIFT,
285 },
286 },
287 .slaves = omap2430_wd_timer2_slaves,
288 .slaves_cnt = ARRAY_SIZE(omap2430_wd_timer2_slaves),
289 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
290};
291
292/* UART */
293
294static struct omap_hwmod_class_sysconfig uart_sysc = {
295 .rev_offs = 0x50,
296 .sysc_offs = 0x54,
297 .syss_offs = 0x58,
298 .sysc_flags = (SYSC_HAS_SIDLEMODE |
299 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
300 SYSC_HAS_AUTOIDLE),
301 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
302 .sysc_fields = &omap_hwmod_sysc_type1,
303};
304
305static struct omap_hwmod_class uart_class = {
306 .name = "uart",
307 .sysc = &uart_sysc,
308};
309
310/* UART1 */
311
312static struct omap_hwmod_irq_info uart1_mpu_irqs[] = {
313 { .irq = INT_24XX_UART1_IRQ, },
314};
315
316static struct omap_hwmod_dma_info uart1_sdma_reqs[] = {
317 { .name = "rx", .dma_req = OMAP24XX_DMA_UART1_RX, },
318 { .name = "tx", .dma_req = OMAP24XX_DMA_UART1_TX, },
319};
320
321static struct omap_hwmod_ocp_if *omap2430_uart1_slaves[] = {
322 &omap2_l4_core__uart1,
323};
324
325static struct omap_hwmod omap2430_uart1_hwmod = {
326 .name = "uart1",
327 .mpu_irqs = uart1_mpu_irqs,
328 .mpu_irqs_cnt = ARRAY_SIZE(uart1_mpu_irqs),
329 .sdma_reqs = uart1_sdma_reqs,
330 .sdma_reqs_cnt = ARRAY_SIZE(uart1_sdma_reqs),
331 .main_clk = "uart1_fck",
332 .prcm = {
333 .omap2 = {
334 .module_offs = CORE_MOD,
335 .prcm_reg_id = 1,
336 .module_bit = OMAP24XX_EN_UART1_SHIFT,
337 .idlest_reg_id = 1,
338 .idlest_idle_bit = OMAP24XX_EN_UART1_SHIFT,
339 },
340 },
341 .slaves = omap2430_uart1_slaves,
342 .slaves_cnt = ARRAY_SIZE(omap2430_uart1_slaves),
343 .class = &uart_class,
344 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
345};
346
347/* UART2 */
348
349static struct omap_hwmod_irq_info uart2_mpu_irqs[] = {
350 { .irq = INT_24XX_UART2_IRQ, },
351};
352
353static struct omap_hwmod_dma_info uart2_sdma_reqs[] = {
354 { .name = "rx", .dma_req = OMAP24XX_DMA_UART2_RX, },
355 { .name = "tx", .dma_req = OMAP24XX_DMA_UART2_TX, },
356};
357
358static struct omap_hwmod_ocp_if *omap2430_uart2_slaves[] = {
359 &omap2_l4_core__uart2,
360};
361
362static struct omap_hwmod omap2430_uart2_hwmod = {
363 .name = "uart2",
364 .mpu_irqs = uart2_mpu_irqs,
365 .mpu_irqs_cnt = ARRAY_SIZE(uart2_mpu_irqs),
366 .sdma_reqs = uart2_sdma_reqs,
367 .sdma_reqs_cnt = ARRAY_SIZE(uart2_sdma_reqs),
368 .main_clk = "uart2_fck",
369 .prcm = {
370 .omap2 = {
371 .module_offs = CORE_MOD,
372 .prcm_reg_id = 1,
373 .module_bit = OMAP24XX_EN_UART2_SHIFT,
374 .idlest_reg_id = 1,
375 .idlest_idle_bit = OMAP24XX_EN_UART2_SHIFT,
376 },
377 },
378 .slaves = omap2430_uart2_slaves,
379 .slaves_cnt = ARRAY_SIZE(omap2430_uart2_slaves),
380 .class = &uart_class,
381 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
382};
383
384/* UART3 */
385
386static struct omap_hwmod_irq_info uart3_mpu_irqs[] = {
387 { .irq = INT_24XX_UART3_IRQ, },
388};
389
390static struct omap_hwmod_dma_info uart3_sdma_reqs[] = {
391 { .name = "rx", .dma_req = OMAP24XX_DMA_UART3_RX, },
392 { .name = "tx", .dma_req = OMAP24XX_DMA_UART3_TX, },
393};
394
395static struct omap_hwmod_ocp_if *omap2430_uart3_slaves[] = {
396 &omap2_l4_core__uart3,
397};
398
399static struct omap_hwmod omap2430_uart3_hwmod = {
400 .name = "uart3",
401 .mpu_irqs = uart3_mpu_irqs,
402 .mpu_irqs_cnt = ARRAY_SIZE(uart3_mpu_irqs),
403 .sdma_reqs = uart3_sdma_reqs,
404 .sdma_reqs_cnt = ARRAY_SIZE(uart3_sdma_reqs),
405 .main_clk = "uart3_fck",
406 .prcm = {
407 .omap2 = {
408 .module_offs = CORE_MOD,
409 .prcm_reg_id = 2,
410 .module_bit = OMAP24XX_EN_UART3_SHIFT,
411 .idlest_reg_id = 2,
412 .idlest_idle_bit = OMAP24XX_EN_UART3_SHIFT,
413 },
414 },
415 .slaves = omap2430_uart3_slaves,
416 .slaves_cnt = ARRAY_SIZE(omap2430_uart3_slaves),
417 .class = &uart_class,
418 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
419};
420
168static __initdata struct omap_hwmod *omap2430_hwmods[] = { 421static __initdata struct omap_hwmod *omap2430_hwmods[] = {
169 &omap2430_l3_main_hwmod, 422 &omap2430_l3_main_hwmod,
170 &omap2430_l4_core_hwmod, 423 &omap2430_l4_core_hwmod,
171 &omap2430_l4_wkup_hwmod, 424 &omap2430_l4_wkup_hwmod,
172 &omap2430_mpu_hwmod, 425 &omap2430_mpu_hwmod,
173 &omap2430_iva_hwmod, 426 &omap2430_iva_hwmod,
427 &omap2430_wd_timer2_hwmod,
428 &omap2430_uart1_hwmod,
429 &omap2430_uart2_hwmod,
430 &omap2430_uart3_hwmod,
174 NULL, 431 NULL,
175}; 432};
176 433
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 5d8eb58ba5e..cb97ecf0a3f 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -17,10 +17,12 @@
17#include <mach/irqs.h> 17#include <mach/irqs.h>
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 21
21#include "omap_hwmod_common_data.h" 22#include "omap_hwmod_common_data.h"
22 23
23#include "prm-regbits-34xx.h" 24#include "prm-regbits-34xx.h"
25#include "cm-regbits-34xx.h"
24 26
25/* 27/*
26 * OMAP3xxx hardware module integration data 28 * OMAP3xxx hardware module integration data
@@ -36,6 +38,7 @@ static struct omap_hwmod omap3xxx_iva_hwmod;
36static struct omap_hwmod omap3xxx_l3_main_hwmod; 38static struct omap_hwmod omap3xxx_l3_main_hwmod;
37static struct omap_hwmod omap3xxx_l4_core_hwmod; 39static struct omap_hwmod omap3xxx_l4_core_hwmod;
38static struct omap_hwmod omap3xxx_l4_per_hwmod; 40static struct omap_hwmod omap3xxx_l4_per_hwmod;
41static struct omap_hwmod omap3xxx_wd_timer2_hwmod;
39 42
40/* L3 -> L4_CORE interface */ 43/* L3 -> L4_CORE interface */
41static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_core = { 44static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_core = {
@@ -82,6 +85,10 @@ static struct omap_hwmod omap3xxx_l3_main_hwmod = {
82}; 85};
83 86
84static struct omap_hwmod omap3xxx_l4_wkup_hwmod; 87static struct omap_hwmod omap3xxx_l4_wkup_hwmod;
88static struct omap_hwmod omap3xxx_uart1_hwmod;
89static struct omap_hwmod omap3xxx_uart2_hwmod;
90static struct omap_hwmod omap3xxx_uart3_hwmod;
91static struct omap_hwmod omap3xxx_uart4_hwmod;
85 92
86/* L4_CORE -> L4_WKUP interface */ 93/* L4_CORE -> L4_WKUP interface */
87static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = { 94static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = {
@@ -90,6 +97,78 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = {
90 .user = OCP_USER_MPU | OCP_USER_SDMA, 97 .user = OCP_USER_MPU | OCP_USER_SDMA,
91}; 98};
92 99
100/* L4 CORE -> UART1 interface */
101static struct omap_hwmod_addr_space omap3xxx_uart1_addr_space[] = {
102 {
103 .pa_start = OMAP3_UART1_BASE,
104 .pa_end = OMAP3_UART1_BASE + SZ_8K - 1,
105 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
106 },
107};
108
109static struct omap_hwmod_ocp_if omap3_l4_core__uart1 = {
110 .master = &omap3xxx_l4_core_hwmod,
111 .slave = &omap3xxx_uart1_hwmod,
112 .clk = "uart1_ick",
113 .addr = omap3xxx_uart1_addr_space,
114 .addr_cnt = ARRAY_SIZE(omap3xxx_uart1_addr_space),
115 .user = OCP_USER_MPU | OCP_USER_SDMA,
116};
117
118/* L4 CORE -> UART2 interface */
119static struct omap_hwmod_addr_space omap3xxx_uart2_addr_space[] = {
120 {
121 .pa_start = OMAP3_UART2_BASE,
122 .pa_end = OMAP3_UART2_BASE + SZ_1K - 1,
123 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
124 },
125};
126
127static struct omap_hwmod_ocp_if omap3_l4_core__uart2 = {
128 .master = &omap3xxx_l4_core_hwmod,
129 .slave = &omap3xxx_uart2_hwmod,
130 .clk = "uart2_ick",
131 .addr = omap3xxx_uart2_addr_space,
132 .addr_cnt = ARRAY_SIZE(omap3xxx_uart2_addr_space),
133 .user = OCP_USER_MPU | OCP_USER_SDMA,
134};
135
136/* L4 PER -> UART3 interface */
137static struct omap_hwmod_addr_space omap3xxx_uart3_addr_space[] = {
138 {
139 .pa_start = OMAP3_UART3_BASE,
140 .pa_end = OMAP3_UART3_BASE + SZ_1K - 1,
141 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
142 },
143};
144
145static struct omap_hwmod_ocp_if omap3_l4_per__uart3 = {
146 .master = &omap3xxx_l4_per_hwmod,
147 .slave = &omap3xxx_uart3_hwmod,
148 .clk = "uart3_ick",
149 .addr = omap3xxx_uart3_addr_space,
150 .addr_cnt = ARRAY_SIZE(omap3xxx_uart3_addr_space),
151 .user = OCP_USER_MPU | OCP_USER_SDMA,
152};
153
154/* L4 PER -> UART4 interface */
155static struct omap_hwmod_addr_space omap3xxx_uart4_addr_space[] = {
156 {
157 .pa_start = OMAP3_UART4_BASE,
158 .pa_end = OMAP3_UART4_BASE + SZ_1K - 1,
159 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
160 },
161};
162
163static struct omap_hwmod_ocp_if omap3_l4_per__uart4 = {
164 .master = &omap3xxx_l4_per_hwmod,
165 .slave = &omap3xxx_uart4_hwmod,
166 .clk = "uart4_ick",
167 .addr = omap3xxx_uart4_addr_space,
168 .addr_cnt = ARRAY_SIZE(omap3xxx_uart4_addr_space),
169 .user = OCP_USER_MPU | OCP_USER_SDMA,
170};
171
93/* Slave interfaces on the L4_CORE interconnect */ 172/* Slave interfaces on the L4_CORE interconnect */
94static struct omap_hwmod_ocp_if *omap3xxx_l4_core_slaves[] = { 173static struct omap_hwmod_ocp_if *omap3xxx_l4_core_slaves[] = {
95 &omap3xxx_l3_main__l4_core, 174 &omap3xxx_l3_main__l4_core,
@@ -98,6 +177,8 @@ static struct omap_hwmod_ocp_if *omap3xxx_l4_core_slaves[] = {
98/* Master interfaces on the L4_CORE interconnect */ 177/* Master interfaces on the L4_CORE interconnect */
99static struct omap_hwmod_ocp_if *omap3xxx_l4_core_masters[] = { 178static struct omap_hwmod_ocp_if *omap3xxx_l4_core_masters[] = {
100 &omap3xxx_l4_core__l4_wkup, 179 &omap3xxx_l4_core__l4_wkup,
180 &omap3_l4_core__uart1,
181 &omap3_l4_core__uart2,
101}; 182};
102 183
103/* L4 CORE */ 184/* L4 CORE */
@@ -119,6 +200,8 @@ static struct omap_hwmod_ocp_if *omap3xxx_l4_per_slaves[] = {
119 200
120/* Master interfaces on the L4_PER interconnect */ 201/* Master interfaces on the L4_PER interconnect */
121static struct omap_hwmod_ocp_if *omap3xxx_l4_per_masters[] = { 202static struct omap_hwmod_ocp_if *omap3xxx_l4_per_masters[] = {
203 &omap3_l4_per__uart3,
204 &omap3_l4_per__uart4,
122}; 205};
123 206
124/* L4 PER */ 207/* L4 PER */
@@ -197,6 +280,235 @@ static struct omap_hwmod omap3xxx_iva_hwmod = {
197 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430) 280 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
198}; 281};
199 282
283/* l4_wkup -> wd_timer2 */
284static struct omap_hwmod_addr_space omap3xxx_wd_timer2_addrs[] = {
285 {
286 .pa_start = 0x48314000,
287 .pa_end = 0x4831407f,
288 .flags = ADDR_TYPE_RT
289 },
290};
291
292static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__wd_timer2 = {
293 .master = &omap3xxx_l4_wkup_hwmod,
294 .slave = &omap3xxx_wd_timer2_hwmod,
295 .clk = "wdt2_ick",
296 .addr = omap3xxx_wd_timer2_addrs,
297 .addr_cnt = ARRAY_SIZE(omap3xxx_wd_timer2_addrs),
298 .user = OCP_USER_MPU | OCP_USER_SDMA,
299};
300
301/*
302 * 'wd_timer' class
303 * 32-bit watchdog upward counter that generates a pulse on the reset pin on
304 * overflow condition
305 */
306
307static struct omap_hwmod_class_sysconfig omap3xxx_wd_timer_sysc = {
308 .rev_offs = 0x0000,
309 .sysc_offs = 0x0010,
310 .syss_offs = 0x0014,
311 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_EMUFREE |
312 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
313 SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY),
314 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
315 .sysc_fields = &omap_hwmod_sysc_type1,
316};
317
318static struct omap_hwmod_class omap3xxx_wd_timer_hwmod_class = {
319 .name = "wd_timer",
320 .sysc = &omap3xxx_wd_timer_sysc,
321};
322
323/* wd_timer2 */
324static struct omap_hwmod_ocp_if *omap3xxx_wd_timer2_slaves[] = {
325 &omap3xxx_l4_wkup__wd_timer2,
326};
327
328static struct omap_hwmod omap3xxx_wd_timer2_hwmod = {
329 .name = "wd_timer2",
330 .class = &omap3xxx_wd_timer_hwmod_class,
331 .main_clk = "wdt2_fck",
332 .prcm = {
333 .omap2 = {
334 .prcm_reg_id = 1,
335 .module_bit = OMAP3430_EN_WDT2_SHIFT,
336 .module_offs = WKUP_MOD,
337 .idlest_reg_id = 1,
338 .idlest_idle_bit = OMAP3430_ST_WDT2_SHIFT,
339 },
340 },
341 .slaves = omap3xxx_wd_timer2_slaves,
342 .slaves_cnt = ARRAY_SIZE(omap3xxx_wd_timer2_slaves),
343 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
344};
345
346/* UART common */
347
348static struct omap_hwmod_class_sysconfig uart_sysc = {
349 .rev_offs = 0x50,
350 .sysc_offs = 0x54,
351 .syss_offs = 0x58,
352 .sysc_flags = (SYSC_HAS_SIDLEMODE |
353 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
354 SYSC_HAS_AUTOIDLE),
355 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
356 .sysc_fields = &omap_hwmod_sysc_type1,
357};
358
359static struct omap_hwmod_class uart_class = {
360 .name = "uart",
361 .sysc = &uart_sysc,
362};
363
364/* UART1 */
365
366static struct omap_hwmod_irq_info uart1_mpu_irqs[] = {
367 { .irq = INT_24XX_UART1_IRQ, },
368};
369
370static struct omap_hwmod_dma_info uart1_sdma_reqs[] = {
371 { .name = "tx", .dma_req = OMAP24XX_DMA_UART1_TX, },
372 { .name = "rx", .dma_req = OMAP24XX_DMA_UART1_RX, },
373};
374
375static struct omap_hwmod_ocp_if *omap3xxx_uart1_slaves[] = {
376 &omap3_l4_core__uart1,
377};
378
379static struct omap_hwmod omap3xxx_uart1_hwmod = {
380 .name = "uart1",
381 .mpu_irqs = uart1_mpu_irqs,
382 .mpu_irqs_cnt = ARRAY_SIZE(uart1_mpu_irqs),
383 .sdma_reqs = uart1_sdma_reqs,
384 .sdma_reqs_cnt = ARRAY_SIZE(uart1_sdma_reqs),
385 .main_clk = "uart1_fck",
386 .prcm = {
387 .omap2 = {
388 .module_offs = CORE_MOD,
389 .prcm_reg_id = 1,
390 .module_bit = OMAP3430_EN_UART1_SHIFT,
391 .idlest_reg_id = 1,
392 .idlest_idle_bit = OMAP3430_EN_UART1_SHIFT,
393 },
394 },
395 .slaves = omap3xxx_uart1_slaves,
396 .slaves_cnt = ARRAY_SIZE(omap3xxx_uart1_slaves),
397 .class = &uart_class,
398 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
399};
400
401/* UART2 */
402
403static struct omap_hwmod_irq_info uart2_mpu_irqs[] = {
404 { .irq = INT_24XX_UART2_IRQ, },
405};
406
407static struct omap_hwmod_dma_info uart2_sdma_reqs[] = {
408 { .name = "tx", .dma_req = OMAP24XX_DMA_UART2_TX, },
409 { .name = "rx", .dma_req = OMAP24XX_DMA_UART2_RX, },
410};
411
412static struct omap_hwmod_ocp_if *omap3xxx_uart2_slaves[] = {
413 &omap3_l4_core__uart2,
414};
415
416static struct omap_hwmod omap3xxx_uart2_hwmod = {
417 .name = "uart2",
418 .mpu_irqs = uart2_mpu_irqs,
419 .mpu_irqs_cnt = ARRAY_SIZE(uart2_mpu_irqs),
420 .sdma_reqs = uart2_sdma_reqs,
421 .sdma_reqs_cnt = ARRAY_SIZE(uart2_sdma_reqs),
422 .main_clk = "uart2_fck",
423 .prcm = {
424 .omap2 = {
425 .module_offs = CORE_MOD,
426 .prcm_reg_id = 1,
427 .module_bit = OMAP3430_EN_UART2_SHIFT,
428 .idlest_reg_id = 1,
429 .idlest_idle_bit = OMAP3430_EN_UART2_SHIFT,
430 },
431 },
432 .slaves = omap3xxx_uart2_slaves,
433 .slaves_cnt = ARRAY_SIZE(omap3xxx_uart2_slaves),
434 .class = &uart_class,
435 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
436};
437
438/* UART3 */
439
440static struct omap_hwmod_irq_info uart3_mpu_irqs[] = {
441 { .irq = INT_24XX_UART3_IRQ, },
442};
443
444static struct omap_hwmod_dma_info uart3_sdma_reqs[] = {
445 { .name = "tx", .dma_req = OMAP24XX_DMA_UART3_TX, },
446 { .name = "rx", .dma_req = OMAP24XX_DMA_UART3_RX, },
447};
448
449static struct omap_hwmod_ocp_if *omap3xxx_uart3_slaves[] = {
450 &omap3_l4_per__uart3,
451};
452
453static struct omap_hwmod omap3xxx_uart3_hwmod = {
454 .name = "uart3",
455 .mpu_irqs = uart3_mpu_irqs,
456 .mpu_irqs_cnt = ARRAY_SIZE(uart3_mpu_irqs),
457 .sdma_reqs = uart3_sdma_reqs,
458 .sdma_reqs_cnt = ARRAY_SIZE(uart3_sdma_reqs),
459 .main_clk = "uart3_fck",
460 .prcm = {
461 .omap2 = {
462 .module_offs = OMAP3430_PER_MOD,
463 .prcm_reg_id = 1,
464 .module_bit = OMAP3430_EN_UART3_SHIFT,
465 .idlest_reg_id = 1,
466 .idlest_idle_bit = OMAP3430_EN_UART3_SHIFT,
467 },
468 },
469 .slaves = omap3xxx_uart3_slaves,
470 .slaves_cnt = ARRAY_SIZE(omap3xxx_uart3_slaves),
471 .class = &uart_class,
472 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
473};
474
475/* UART4 */
476
477static struct omap_hwmod_irq_info uart4_mpu_irqs[] = {
478 { .irq = INT_36XX_UART4_IRQ, },
479};
480
481static struct omap_hwmod_dma_info uart4_sdma_reqs[] = {
482 { .name = "rx", .dma_req = OMAP36XX_DMA_UART4_RX, },
483 { .name = "tx", .dma_req = OMAP36XX_DMA_UART4_TX, },
484};
485
486static struct omap_hwmod_ocp_if *omap3xxx_uart4_slaves[] = {
487 &omap3_l4_per__uart4,
488};
489
490static struct omap_hwmod omap3xxx_uart4_hwmod = {
491 .name = "uart4",
492 .mpu_irqs = uart4_mpu_irqs,
493 .mpu_irqs_cnt = ARRAY_SIZE(uart4_mpu_irqs),
494 .sdma_reqs = uart4_sdma_reqs,
495 .sdma_reqs_cnt = ARRAY_SIZE(uart4_sdma_reqs),
496 .main_clk = "uart4_fck",
497 .prcm = {
498 .omap2 = {
499 .module_offs = OMAP3430_PER_MOD,
500 .prcm_reg_id = 1,
501 .module_bit = OMAP3630_EN_UART4_SHIFT,
502 .idlest_reg_id = 1,
503 .idlest_idle_bit = OMAP3630_EN_UART4_SHIFT,
504 },
505 },
506 .slaves = omap3xxx_uart4_slaves,
507 .slaves_cnt = ARRAY_SIZE(omap3xxx_uart4_slaves),
508 .class = &uart_class,
509 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3630ES1),
510};
511
200static __initdata struct omap_hwmod *omap3xxx_hwmods[] = { 512static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
201 &omap3xxx_l3_main_hwmod, 513 &omap3xxx_l3_main_hwmod,
202 &omap3xxx_l4_core_hwmod, 514 &omap3xxx_l4_core_hwmod,
@@ -204,6 +516,11 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
204 &omap3xxx_l4_wkup_hwmod, 516 &omap3xxx_l4_wkup_hwmod,
205 &omap3xxx_mpu_hwmod, 517 &omap3xxx_mpu_hwmod,
206 &omap3xxx_iva_hwmod, 518 &omap3xxx_iva_hwmod,
519 &omap3xxx_wd_timer2_hwmod,
520 &omap3xxx_uart1_hwmod,
521 &omap3xxx_uart2_hwmod,
522 &omap3xxx_uart3_hwmod,
523 &omap3xxx_uart4_hwmod,
207 NULL, 524 NULL,
208}; 525};
209 526
@@ -211,5 +528,3 @@ int __init omap3xxx_hwmod_init(void)
211{ 528{
212 return omap_hwmod_init(omap3xxx_hwmods); 529 return omap_hwmod_init(omap3xxx_hwmods);
213} 530}
214
215
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index e20b0eebc6d..7274db4de48 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -452,6 +452,365 @@ static struct omap_hwmod omap44xx_mpu_hwmod = {
452 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 452 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
453}; 453};
454 454
455/*
456 * 'wd_timer' class
457 * 32-bit watchdog upward counter that generates a pulse on the reset pin on
458 * overflow condition
459 */
460
461static struct omap_hwmod_class_sysconfig omap44xx_wd_timer_sysc = {
462 .rev_offs = 0x0000,
463 .sysc_offs = 0x0010,
464 .syss_offs = 0x0014,
465 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_EMUFREE |
466 SYSC_HAS_SOFTRESET),
467 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
468 .sysc_fields = &omap_hwmod_sysc_type1,
469};
470
471/*
472 * 'uart' class
473 * universal asynchronous receiver/transmitter (uart)
474 */
475
476static struct omap_hwmod_class_sysconfig omap44xx_uart_sysc = {
477 .rev_offs = 0x0050,
478 .sysc_offs = 0x0054,
479 .syss_offs = 0x0058,
480 .sysc_flags = (SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
481 SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
482 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
483 .sysc_fields = &omap_hwmod_sysc_type1,
484};
485
486static struct omap_hwmod_class omap44xx_wd_timer_hwmod_class = {
487 .name = "wd_timer",
488 .sysc = &omap44xx_wd_timer_sysc,
489};
490
491/* wd_timer2 */
492static struct omap_hwmod omap44xx_wd_timer2_hwmod;
493static struct omap_hwmod_irq_info omap44xx_wd_timer2_irqs[] = {
494 { .irq = 80 + OMAP44XX_IRQ_GIC_START },
495};
496
497static struct omap_hwmod_addr_space omap44xx_wd_timer2_addrs[] = {
498 {
499 .pa_start = 0x4a314000,
500 .pa_end = 0x4a31407f,
501 .flags = ADDR_TYPE_RT
502 },
503};
504
505static struct omap_hwmod_class omap44xx_uart_hwmod_class = {
506 .name = "uart",
507 .sysc = &omap44xx_uart_sysc,
508};
509
510/* uart1 */
511static struct omap_hwmod omap44xx_uart1_hwmod;
512static struct omap_hwmod_irq_info omap44xx_uart1_irqs[] = {
513 { .irq = 72 + OMAP44XX_IRQ_GIC_START },
514};
515
516static struct omap_hwmod_dma_info omap44xx_uart1_sdma_reqs[] = {
517 { .name = "tx", .dma_req = 48 + OMAP44XX_DMA_REQ_START },
518 { .name = "rx", .dma_req = 49 + OMAP44XX_DMA_REQ_START },
519};
520
521static struct omap_hwmod_addr_space omap44xx_uart1_addrs[] = {
522 {
523 .pa_start = 0x4806a000,
524 .pa_end = 0x4806a0ff,
525 .flags = ADDR_TYPE_RT
526 },
527};
528
529/* l4_per -> uart1 */
530static struct omap_hwmod_ocp_if omap44xx_l4_per__uart1 = {
531 .master = &omap44xx_l4_per_hwmod,
532 .slave = &omap44xx_uart1_hwmod,
533 .clk = "l4_div_ck",
534 .addr = omap44xx_uart1_addrs,
535 .addr_cnt = ARRAY_SIZE(omap44xx_uart1_addrs),
536 .user = OCP_USER_MPU | OCP_USER_SDMA,
537};
538
539/* uart1 slave ports */
540static struct omap_hwmod_ocp_if *omap44xx_uart1_slaves[] = {
541 &omap44xx_l4_per__uart1,
542};
543
544static struct omap_hwmod omap44xx_uart1_hwmod = {
545 .name = "uart1",
546 .class = &omap44xx_uart_hwmod_class,
547 .mpu_irqs = omap44xx_uart1_irqs,
548 .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_uart1_irqs),
549 .sdma_reqs = omap44xx_uart1_sdma_reqs,
550 .sdma_reqs_cnt = ARRAY_SIZE(omap44xx_uart1_sdma_reqs),
551 .main_clk = "uart1_fck",
552 .prcm = {
553 .omap4 = {
554 .clkctrl_reg = OMAP4430_CM_L4PER_UART1_CLKCTRL,
555 },
556 },
557 .slaves = omap44xx_uart1_slaves,
558 .slaves_cnt = ARRAY_SIZE(omap44xx_uart1_slaves),
559 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
560};
561
562/* uart2 */
563static struct omap_hwmod omap44xx_uart2_hwmod;
564static struct omap_hwmod_irq_info omap44xx_uart2_irqs[] = {
565 { .irq = 73 + OMAP44XX_IRQ_GIC_START },
566};
567
568static struct omap_hwmod_dma_info omap44xx_uart2_sdma_reqs[] = {
569 { .name = "tx", .dma_req = 50 + OMAP44XX_DMA_REQ_START },
570 { .name = "rx", .dma_req = 51 + OMAP44XX_DMA_REQ_START },
571};
572
573static struct omap_hwmod_addr_space omap44xx_uart2_addrs[] = {
574 {
575 .pa_start = 0x4806c000,
576 .pa_end = 0x4806c0ff,
577 .flags = ADDR_TYPE_RT
578 },
579};
580
581/* l4_wkup -> wd_timer2 */
582static struct omap_hwmod_ocp_if omap44xx_l4_wkup__wd_timer2 = {
583 .master = &omap44xx_l4_wkup_hwmod,
584 .slave = &omap44xx_wd_timer2_hwmod,
585 .clk = "l4_wkup_clk_mux_ck",
586 .addr = omap44xx_wd_timer2_addrs,
587 .addr_cnt = ARRAY_SIZE(omap44xx_wd_timer2_addrs),
588 .user = OCP_USER_MPU | OCP_USER_SDMA,
589};
590
591/* wd_timer2 slave ports */
592static struct omap_hwmod_ocp_if *omap44xx_wd_timer2_slaves[] = {
593 &omap44xx_l4_wkup__wd_timer2,
594};
595
596static struct omap_hwmod omap44xx_wd_timer2_hwmod = {
597 .name = "wd_timer2",
598 .class = &omap44xx_wd_timer_hwmod_class,
599 .mpu_irqs = omap44xx_wd_timer2_irqs,
600 .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_wd_timer2_irqs),
601 .main_clk = "wd_timer2_fck",
602 .prcm = {
603 .omap4 = {
604 .clkctrl_reg = OMAP4430_CM_WKUP_WDT2_CLKCTRL,
605 },
606 },
607 .slaves = omap44xx_wd_timer2_slaves,
608 .slaves_cnt = ARRAY_SIZE(omap44xx_wd_timer2_slaves),
609 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
610};
611
612/* wd_timer3 */
613static struct omap_hwmod omap44xx_wd_timer3_hwmod;
614static struct omap_hwmod_irq_info omap44xx_wd_timer3_irqs[] = {
615 { .irq = 36 + OMAP44XX_IRQ_GIC_START },
616};
617
618static struct omap_hwmod_addr_space omap44xx_wd_timer3_addrs[] = {
619 {
620 .pa_start = 0x40130000,
621 .pa_end = 0x4013007f,
622 .flags = ADDR_TYPE_RT
623 },
624};
625
626/* l4_per -> uart2 */
627static struct omap_hwmod_ocp_if omap44xx_l4_per__uart2 = {
628 .master = &omap44xx_l4_per_hwmod,
629 .slave = &omap44xx_uart2_hwmod,
630 .clk = "l4_div_ck",
631 .addr = omap44xx_uart2_addrs,
632 .addr_cnt = ARRAY_SIZE(omap44xx_uart2_addrs),
633 .user = OCP_USER_MPU | OCP_USER_SDMA,
634};
635
636/* uart2 slave ports */
637static struct omap_hwmod_ocp_if *omap44xx_uart2_slaves[] = {
638 &omap44xx_l4_per__uart2,
639};
640
641static struct omap_hwmod omap44xx_uart2_hwmod = {
642 .name = "uart2",
643 .class = &omap44xx_uart_hwmod_class,
644 .mpu_irqs = omap44xx_uart2_irqs,
645 .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_uart2_irqs),
646 .sdma_reqs = omap44xx_uart2_sdma_reqs,
647 .sdma_reqs_cnt = ARRAY_SIZE(omap44xx_uart2_sdma_reqs),
648 .main_clk = "uart2_fck",
649 .prcm = {
650 .omap4 = {
651 .clkctrl_reg = OMAP4430_CM_L4PER_UART2_CLKCTRL,
652 },
653 },
654 .slaves = omap44xx_uart2_slaves,
655 .slaves_cnt = ARRAY_SIZE(omap44xx_uart2_slaves),
656 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
657};
658
659/* uart3 */
660static struct omap_hwmod omap44xx_uart3_hwmod;
661static struct omap_hwmod_irq_info omap44xx_uart3_irqs[] = {
662 { .irq = 74 + OMAP44XX_IRQ_GIC_START },
663};
664
665static struct omap_hwmod_dma_info omap44xx_uart3_sdma_reqs[] = {
666 { .name = "tx", .dma_req = 52 + OMAP44XX_DMA_REQ_START },
667 { .name = "rx", .dma_req = 53 + OMAP44XX_DMA_REQ_START },
668};
669
670static struct omap_hwmod_addr_space omap44xx_uart3_addrs[] = {
671 {
672 .pa_start = 0x48020000,
673 .pa_end = 0x480200ff,
674 .flags = ADDR_TYPE_RT
675 },
676};
677
678/* l4_abe -> wd_timer3 */
679static struct omap_hwmod_ocp_if omap44xx_l4_abe__wd_timer3 = {
680 .master = &omap44xx_l4_abe_hwmod,
681 .slave = &omap44xx_wd_timer3_hwmod,
682 .clk = "ocp_abe_iclk",
683 .addr = omap44xx_wd_timer3_addrs,
684 .addr_cnt = ARRAY_SIZE(omap44xx_wd_timer3_addrs),
685 .user = OCP_USER_MPU,
686};
687
688/* l4_abe -> wd_timer3 (dma) */
689static struct omap_hwmod_addr_space omap44xx_wd_timer3_dma_addrs[] = {
690 {
691 .pa_start = 0x49030000,
692 .pa_end = 0x4903007f,
693 .flags = ADDR_TYPE_RT
694 },
695};
696
697/* l4_per -> uart3 */
698static struct omap_hwmod_ocp_if omap44xx_l4_per__uart3 = {
699 .master = &omap44xx_l4_per_hwmod,
700 .slave = &omap44xx_uart3_hwmod,
701 .clk = "l4_div_ck",
702 .addr = omap44xx_uart3_addrs,
703 .addr_cnt = ARRAY_SIZE(omap44xx_uart3_addrs),
704 .user = OCP_USER_MPU | OCP_USER_SDMA,
705};
706
707/* uart3 slave ports */
708static struct omap_hwmod_ocp_if *omap44xx_uart3_slaves[] = {
709 &omap44xx_l4_per__uart3,
710};
711
712static struct omap_hwmod omap44xx_uart3_hwmod = {
713 .name = "uart3",
714 .class = &omap44xx_uart_hwmod_class,
715 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET),
716 .mpu_irqs = omap44xx_uart3_irqs,
717 .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_uart3_irqs),
718 .sdma_reqs = omap44xx_uart3_sdma_reqs,
719 .sdma_reqs_cnt = ARRAY_SIZE(omap44xx_uart3_sdma_reqs),
720 .main_clk = "uart3_fck",
721 .prcm = {
722 .omap4 = {
723 .clkctrl_reg = OMAP4430_CM_L4PER_UART3_CLKCTRL,
724 },
725 },
726 .slaves = omap44xx_uart3_slaves,
727 .slaves_cnt = ARRAY_SIZE(omap44xx_uart3_slaves),
728 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
729};
730
731/* uart4 */
732static struct omap_hwmod omap44xx_uart4_hwmod;
733static struct omap_hwmod_irq_info omap44xx_uart4_irqs[] = {
734 { .irq = 70 + OMAP44XX_IRQ_GIC_START },
735};
736
737static struct omap_hwmod_dma_info omap44xx_uart4_sdma_reqs[] = {
738 { .name = "tx", .dma_req = 54 + OMAP44XX_DMA_REQ_START },
739 { .name = "rx", .dma_req = 55 + OMAP44XX_DMA_REQ_START },
740};
741
742static struct omap_hwmod_addr_space omap44xx_uart4_addrs[] = {
743 {
744 .pa_start = 0x4806e000,
745 .pa_end = 0x4806e0ff,
746 .flags = ADDR_TYPE_RT
747 },
748};
749
750static struct omap_hwmod_ocp_if omap44xx_l4_abe__wd_timer3_dma = {
751 .master = &omap44xx_l4_abe_hwmod,
752 .slave = &omap44xx_wd_timer3_hwmod,
753 .clk = "ocp_abe_iclk",
754 .addr = omap44xx_wd_timer3_dma_addrs,
755 .addr_cnt = ARRAY_SIZE(omap44xx_wd_timer3_dma_addrs),
756 .user = OCP_USER_SDMA,
757};
758
759/* wd_timer3 slave ports */
760static struct omap_hwmod_ocp_if *omap44xx_wd_timer3_slaves[] = {
761 &omap44xx_l4_abe__wd_timer3,
762 &omap44xx_l4_abe__wd_timer3_dma,
763};
764
765static struct omap_hwmod omap44xx_wd_timer3_hwmod = {
766 .name = "wd_timer3",
767 .class = &omap44xx_wd_timer_hwmod_class,
768 .mpu_irqs = omap44xx_wd_timer3_irqs,
769 .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_wd_timer3_irqs),
770 .main_clk = "wd_timer3_fck",
771 .prcm = {
772 .omap4 = {
773 .clkctrl_reg = OMAP4430_CM1_ABE_WDT3_CLKCTRL,
774 },
775 },
776 .slaves = omap44xx_wd_timer3_slaves,
777 .slaves_cnt = ARRAY_SIZE(omap44xx_wd_timer3_slaves),
778 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
779};
780
781/* l4_per -> uart4 */
782static struct omap_hwmod_ocp_if omap44xx_l4_per__uart4 = {
783 .master = &omap44xx_l4_per_hwmod,
784 .slave = &omap44xx_uart4_hwmod,
785 .clk = "l4_div_ck",
786 .addr = omap44xx_uart4_addrs,
787 .addr_cnt = ARRAY_SIZE(omap44xx_uart4_addrs),
788 .user = OCP_USER_MPU | OCP_USER_SDMA,
789};
790
791/* uart4 slave ports */
792static struct omap_hwmod_ocp_if *omap44xx_uart4_slaves[] = {
793 &omap44xx_l4_per__uart4,
794};
795
796static struct omap_hwmod omap44xx_uart4_hwmod = {
797 .name = "uart4",
798 .class = &omap44xx_uart_hwmod_class,
799 .mpu_irqs = omap44xx_uart4_irqs,
800 .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_uart4_irqs),
801 .sdma_reqs = omap44xx_uart4_sdma_reqs,
802 .sdma_reqs_cnt = ARRAY_SIZE(omap44xx_uart4_sdma_reqs),
803 .main_clk = "uart4_fck",
804 .prcm = {
805 .omap4 = {
806 .clkctrl_reg = OMAP4430_CM_L4PER_UART4_CLKCTRL,
807 },
808 },
809 .slaves = omap44xx_uart4_slaves,
810 .slaves_cnt = ARRAY_SIZE(omap44xx_uart4_slaves),
811 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
812};
813
455static __initdata struct omap_hwmod *omap44xx_hwmods[] = { 814static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
456 /* dmm class */ 815 /* dmm class */
457 &omap44xx_dmm_hwmod, 816 &omap44xx_dmm_hwmod,
@@ -472,6 +831,15 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
472 831
473 /* mpu class */ 832 /* mpu class */
474 &omap44xx_mpu_hwmod, 833 &omap44xx_mpu_hwmod,
834 /* wd_timer class */
835 &omap44xx_wd_timer2_hwmod,
836 &omap44xx_wd_timer3_hwmod,
837
838 /* uart class */
839 &omap44xx_uart1_hwmod,
840 &omap44xx_uart2_hwmod,
841 &omap44xx_uart3_hwmod,
842 &omap44xx_uart4_hwmod,
475 NULL, 843 NULL,
476}; 844};
477 845
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index ac572aaebb0..e57c9aeeefe 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -388,6 +388,7 @@ void omap_sram_idle(void)
388 /* PER */ 388 /* PER */
389 if (per_next_state < PWRDM_POWER_ON) { 389 if (per_next_state < PWRDM_POWER_ON) {
390 omap_uart_prepare_idle(2); 390 omap_uart_prepare_idle(2);
391 omap_uart_prepare_idle(3);
391 omap2_gpio_prepare_for_idle(per_next_state); 392 omap2_gpio_prepare_for_idle(per_next_state);
392 if (per_next_state == PWRDM_POWER_OFF) 393 if (per_next_state == PWRDM_POWER_OFF)
393 omap3_per_save_context(); 394 omap3_per_save_context();
@@ -459,6 +460,7 @@ void omap_sram_idle(void)
459 if (per_prev_state == PWRDM_POWER_OFF) 460 if (per_prev_state == PWRDM_POWER_OFF)
460 omap3_per_restore_context(); 461 omap3_per_restore_context();
461 omap_uart_resume_idle(2); 462 omap_uart_resume_idle(2);
463 omap_uart_resume_idle(3);
462 } 464 }
463 465
464 /* Disable IO-PAD and IO-CHAIN wakeup */ 466 /* Disable IO-PAD and IO-CHAIN wakeup */
@@ -676,6 +678,14 @@ static void __init omap3_d2d_idle(void)
676 678
677static void __init prcm_setup_regs(void) 679static void __init prcm_setup_regs(void)
678{ 680{
681 u32 omap3630_auto_uart4_mask = cpu_is_omap3630() ?
682 OMAP3630_AUTO_UART4_MASK : 0;
683 u32 omap3630_en_uart4_mask = cpu_is_omap3630() ?
684 OMAP3630_EN_UART4_MASK : 0;
685 u32 omap3630_grpsel_uart4_mask = cpu_is_omap3630() ?
686 OMAP3630_GRPSEL_UART4_MASK : 0;
687
688
679 /* XXX Reset all wkdeps. This should be done when initializing 689 /* XXX Reset all wkdeps. This should be done when initializing
680 * powerdomains */ 690 * powerdomains */
681 prm_write_mod_reg(0, OMAP3430_IVA2_MOD, PM_WKDEP); 691 prm_write_mod_reg(0, OMAP3430_IVA2_MOD, PM_WKDEP);
@@ -762,6 +772,7 @@ static void __init prcm_setup_regs(void)
762 CM_AUTOIDLE); 772 CM_AUTOIDLE);
763 773
764 cm_write_mod_reg( 774 cm_write_mod_reg(
775 omap3630_auto_uart4_mask |
765 OMAP3430_AUTO_GPIO6_MASK | 776 OMAP3430_AUTO_GPIO6_MASK |
766 OMAP3430_AUTO_GPIO5_MASK | 777 OMAP3430_AUTO_GPIO5_MASK |
767 OMAP3430_AUTO_GPIO4_MASK | 778 OMAP3430_AUTO_GPIO4_MASK |
@@ -838,14 +849,16 @@ static void __init prcm_setup_regs(void)
838 OMAP3430_DSS_MOD, PM_WKEN); 849 OMAP3430_DSS_MOD, PM_WKEN);
839 850
840 /* Enable wakeups in PER */ 851 /* Enable wakeups in PER */
841 prm_write_mod_reg(OMAP3430_EN_GPIO2_MASK | OMAP3430_EN_GPIO3_MASK | 852 prm_write_mod_reg(omap3630_en_uart4_mask |
853 OMAP3430_EN_GPIO2_MASK | OMAP3430_EN_GPIO3_MASK |
842 OMAP3430_EN_GPIO4_MASK | OMAP3430_EN_GPIO5_MASK | 854 OMAP3430_EN_GPIO4_MASK | OMAP3430_EN_GPIO5_MASK |
843 OMAP3430_EN_GPIO6_MASK | OMAP3430_EN_UART3_MASK | 855 OMAP3430_EN_GPIO6_MASK | OMAP3430_EN_UART3_MASK |
844 OMAP3430_EN_MCBSP2_MASK | OMAP3430_EN_MCBSP3_MASK | 856 OMAP3430_EN_MCBSP2_MASK | OMAP3430_EN_MCBSP3_MASK |
845 OMAP3430_EN_MCBSP4_MASK, 857 OMAP3430_EN_MCBSP4_MASK,
846 OMAP3430_PER_MOD, PM_WKEN); 858 OMAP3430_PER_MOD, PM_WKEN);
847 /* and allow them to wake up MPU */ 859 /* and allow them to wake up MPU */
848 prm_write_mod_reg(OMAP3430_GRPSEL_GPIO2_MASK | 860 prm_write_mod_reg(omap3630_grpsel_uart4_mask |
861 OMAP3430_GRPSEL_GPIO2_MASK |
849 OMAP3430_GRPSEL_GPIO3_MASK | 862 OMAP3430_GRPSEL_GPIO3_MASK |
850 OMAP3430_GRPSEL_GPIO4_MASK | 863 OMAP3430_GRPSEL_GPIO4_MASK |
851 OMAP3430_GRPSEL_GPIO5_MASK | 864 OMAP3430_GRPSEL_GPIO5_MASK |
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
index 995b7edbf18..298a22a754e 100644
--- a/arch/arm/mach-omap2/prcm-common.h
+++ b/arch/arm/mach-omap2/prcm-common.h
@@ -382,6 +382,9 @@
382#define OMAP3430_EN_MPU_SHIFT 1 382#define OMAP3430_EN_MPU_SHIFT 1
383 383
384/* CM_FCLKEN_PER, CM_ICLKEN_PER, PM_WKEN_PER shared bits */ 384/* CM_FCLKEN_PER, CM_ICLKEN_PER, PM_WKEN_PER shared bits */
385
386#define OMAP3630_EN_UART4_MASK (1 << 18)
387#define OMAP3630_EN_UART4_SHIFT 18
385#define OMAP3430_EN_GPIO6_MASK (1 << 17) 388#define OMAP3430_EN_GPIO6_MASK (1 << 17)
386#define OMAP3430_EN_GPIO6_SHIFT 17 389#define OMAP3430_EN_GPIO6_SHIFT 17
387#define OMAP3430_EN_GPIO5_MASK (1 << 16) 390#define OMAP3430_EN_GPIO5_MASK (1 << 16)
@@ -422,6 +425,8 @@
422#define OMAP3430_EN_MCBSP2_SHIFT 0 425#define OMAP3430_EN_MCBSP2_SHIFT 0
423 426
424/* CM_IDLEST_PER, PM_WKST_PER shared bits */ 427/* CM_IDLEST_PER, PM_WKST_PER shared bits */
428#define OMAP3630_ST_UART4_SHIFT 18
429#define OMAP3630_ST_UART4_MASK (1 << 18)
425#define OMAP3430_ST_GPIO6_SHIFT 17 430#define OMAP3430_ST_GPIO6_SHIFT 17
426#define OMAP3430_ST_GPIO6_MASK (1 << 17) 431#define OMAP3430_ST_GPIO6_MASK (1 << 17)
427#define OMAP3430_ST_GPIO5_SHIFT 16 432#define OMAP3430_ST_GPIO5_SHIFT 16
diff --git a/arch/arm/mach-omap2/prm-regbits-34xx.h b/arch/arm/mach-omap2/prm-regbits-34xx.h
index 7fd6023edf9..9e63cb743a9 100644
--- a/arch/arm/mach-omap2/prm-regbits-34xx.h
+++ b/arch/arm/mach-omap2/prm-regbits-34xx.h
@@ -122,6 +122,7 @@
122#define OMAP3430_MEMRETSTATE_MASK (1 << 8) 122#define OMAP3430_MEMRETSTATE_MASK (1 << 8)
123 123
124/* PM_MPUGRPSEL_PER, PM_IVA2GRPSEL_PER shared bits */ 124/* PM_MPUGRPSEL_PER, PM_IVA2GRPSEL_PER shared bits */
125#define OMAP3630_GRPSEL_UART4_MASK (1 << 18)
125#define OMAP3430_GRPSEL_GPIO6_MASK (1 << 17) 126#define OMAP3430_GRPSEL_GPIO6_MASK (1 << 17)
126#define OMAP3430_GRPSEL_GPIO5_MASK (1 << 16) 127#define OMAP3430_GRPSEL_GPIO5_MASK (1 << 16)
127#define OMAP3430_GRPSEL_GPIO4_MASK (1 << 15) 128#define OMAP3430_GRPSEL_GPIO4_MASK (1 << 15)
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 566e991ede8..0bcc9df0c03 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -19,19 +19,30 @@
19 */ 19 */
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/serial_8250.h>
23#include <linux/serial_reg.h> 22#include <linux/serial_reg.h>
24#include <linux/clk.h> 23#include <linux/clk.h>
25#include <linux/io.h> 24#include <linux/io.h>
26#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/platform_device.h>
27#include <linux/slab.h>
28#include <linux/serial_8250.h>
29#include <linux/pm_runtime.h>
30
31#ifdef CONFIG_SERIAL_OMAP
32#include <plat/omap-serial.h>
33#endif
27 34
28#include <plat/common.h> 35#include <plat/common.h>
29#include <plat/board.h> 36#include <plat/board.h>
30#include <plat/clock.h> 37#include <plat/clock.h>
31#include <plat/control.h> 38#include <plat/control.h>
39#include <plat/dma.h>
40#include <plat/omap_hwmod.h>
41#include <plat/omap_device.h>
32 42
33#include "prm.h" 43#include "prm.h"
34#include "pm.h" 44#include "pm.h"
45#include "cm.h"
35#include "prm-regbits-34xx.h" 46#include "prm-regbits-34xx.h"
36 47
37#define UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV 0x52 48#define UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV 0x52
@@ -48,6 +59,8 @@
48 */ 59 */
49#define DEFAULT_TIMEOUT 0 60#define DEFAULT_TIMEOUT 0
50 61
62#define MAX_UART_HWMOD_NAME_LEN 16
63
51struct omap_uart_state { 64struct omap_uart_state {
52 int num; 65 int num;
53 int can_sleep; 66 int can_sleep;
@@ -58,14 +71,21 @@ struct omap_uart_state {
58 void __iomem *wk_en; 71 void __iomem *wk_en;
59 u32 wk_mask; 72 u32 wk_mask;
60 u32 padconf; 73 u32 padconf;
74 u32 dma_enabled;
61 75
62 struct clk *ick; 76 struct clk *ick;
63 struct clk *fck; 77 struct clk *fck;
64 int clocked; 78 int clocked;
65 79
66 struct plat_serial8250_port *p; 80 int irq;
81 int regshift;
82 int irqflags;
83 void __iomem *membase;
84 resource_size_t mapbase;
85
67 struct list_head node; 86 struct list_head node;
68 struct platform_device pdev; 87 struct omap_hwmod *oh;
88 struct platform_device *pdev;
69 89
70 u32 errata; 90 u32 errata;
71#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM) 91#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
@@ -83,75 +103,47 @@ struct omap_uart_state {
83}; 103};
84 104
85static LIST_HEAD(uart_list); 105static LIST_HEAD(uart_list);
106static u8 num_uarts;
86 107
87static struct plat_serial8250_port serial_platform_data0[] = { 108/*
88 { 109 * Since these idle/enable hooks are used in the idle path itself
89 .irq = 72, 110 * which has interrupts disabled, use the non-locking versions of
90 .flags = UPF_BOOT_AUTOCONF, 111 * the hwmod enable/disable functions.
91 .iotype = UPIO_MEM, 112 */
92 .regshift = 2, 113static int uart_idle_hwmod(struct omap_device *od)
93 .uartclk = OMAP24XX_BASE_BAUD * 16, 114{
94 }, { 115 _omap_hwmod_idle(od->hwmods[0]);
95 .flags = 0
96 }
97};
98 116
99static struct plat_serial8250_port serial_platform_data1[] = { 117 return 0;
100 { 118}
101 .irq = 73,
102 .flags = UPF_BOOT_AUTOCONF,
103 .iotype = UPIO_MEM,
104 .regshift = 2,
105 .uartclk = OMAP24XX_BASE_BAUD * 16,
106 }, {
107 .flags = 0
108 }
109};
110 119
111static struct plat_serial8250_port serial_platform_data2[] = { 120static int uart_enable_hwmod(struct omap_device *od)
112 { 121{
113 .irq = 74, 122 _omap_hwmod_enable(od->hwmods[0]);
114 .flags = UPF_BOOT_AUTOCONF, 123
115 .iotype = UPIO_MEM, 124 return 0;
116 .regshift = 2, 125}
117 .uartclk = OMAP24XX_BASE_BAUD * 16,
118 }, {
119 .flags = 0
120 }
121};
122 126
123static struct plat_serial8250_port serial_platform_data3[] = { 127static struct omap_device_pm_latency omap_uart_latency[] = {
124 { 128 {
125 .irq = 70, 129 .deactivate_func = uart_idle_hwmod,
126 .flags = UPF_BOOT_AUTOCONF, 130 .activate_func = uart_enable_hwmod,
127 .iotype = UPIO_MEM, 131 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
128 .regshift = 2, 132 },
129 .uartclk = OMAP24XX_BASE_BAUD * 16,
130 }, {
131 .flags = 0
132 }
133}; 133};
134 134
135void __init omap2_set_globals_uart(struct omap_globals *omap2_globals)
136{
137 serial_platform_data0[0].mapbase = omap2_globals->uart1_phys;
138 serial_platform_data1[0].mapbase = omap2_globals->uart2_phys;
139 serial_platform_data2[0].mapbase = omap2_globals->uart3_phys;
140 serial_platform_data3[0].mapbase = omap2_globals->uart4_phys;
141}
142
143static inline unsigned int __serial_read_reg(struct uart_port *up, 135static inline unsigned int __serial_read_reg(struct uart_port *up,
144 int offset) 136 int offset)
145{ 137{
146 offset <<= up->regshift; 138 offset <<= up->regshift;
147 return (unsigned int)__raw_readb(up->membase + offset); 139 return (unsigned int)__raw_readb(up->membase + offset);
148} 140}
149 141
150static inline unsigned int serial_read_reg(struct plat_serial8250_port *up, 142static inline unsigned int serial_read_reg(struct omap_uart_state *uart,
151 int offset) 143 int offset)
152{ 144{
153 offset <<= up->regshift; 145 offset <<= uart->regshift;
154 return (unsigned int)__raw_readb(up->membase + offset); 146 return (unsigned int)__raw_readb(uart->membase + offset);
155} 147}
156 148
157static inline void __serial_write_reg(struct uart_port *up, int offset, 149static inline void __serial_write_reg(struct uart_port *up, int offset,
@@ -161,11 +153,11 @@ static inline void __serial_write_reg(struct uart_port *up, int offset,
161 __raw_writeb(value, up->membase + offset); 153 __raw_writeb(value, up->membase + offset);
162} 154}
163 155
164static inline void serial_write_reg(struct plat_serial8250_port *p, int offset, 156static inline void serial_write_reg(struct omap_uart_state *uart, int offset,
165 int value) 157 int value)
166{ 158{
167 offset <<= p->regshift; 159 offset <<= uart->regshift;
168 __raw_writeb(value, p->membase + offset); 160 __raw_writeb(value, uart->membase + offset);
169} 161}
170 162
171/* 163/*
@@ -173,14 +165,12 @@ static inline void serial_write_reg(struct plat_serial8250_port *p, int offset,
173 * properly. Note that the TX watermark initialization may not be needed 165 * properly. Note that the TX watermark initialization may not be needed
174 * once the 8250.c watermark handling code is merged. 166 * once the 8250.c watermark handling code is merged.
175 */ 167 */
168
176static inline void __init omap_uart_reset(struct omap_uart_state *uart) 169static inline void __init omap_uart_reset(struct omap_uart_state *uart)
177{ 170{
178 struct plat_serial8250_port *p = uart->p; 171 serial_write_reg(uart, UART_OMAP_MDR1, 0x07);
179 172 serial_write_reg(uart, UART_OMAP_SCR, 0x08);
180 serial_write_reg(p, UART_OMAP_MDR1, 0x07); 173 serial_write_reg(uart, UART_OMAP_MDR1, 0x00);
181 serial_write_reg(p, UART_OMAP_SCR, 0x08);
182 serial_write_reg(p, UART_OMAP_MDR1, 0x00);
183 serial_write_reg(p, UART_OMAP_SYSC, (0x02 << 3) | (1 << 2) | (1 << 0));
184} 174}
185 175
186#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3) 176#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3)
@@ -197,24 +187,23 @@ static inline void __init omap_uart_reset(struct omap_uart_state *uart)
197static void omap_uart_mdr1_errataset(struct omap_uart_state *uart, u8 mdr1_val, 187static void omap_uart_mdr1_errataset(struct omap_uart_state *uart, u8 mdr1_val,
198 u8 fcr_val) 188 u8 fcr_val)
199{ 189{
200 struct plat_serial8250_port *p = uart->p;
201 u8 timeout = 255; 190 u8 timeout = 255;
202 191
203 serial_write_reg(p, UART_OMAP_MDR1, mdr1_val); 192 serial_write_reg(uart, UART_OMAP_MDR1, mdr1_val);
204 udelay(2); 193 udelay(2);
205 serial_write_reg(p, UART_FCR, fcr_val | UART_FCR_CLEAR_XMIT | 194 serial_write_reg(uart, UART_FCR, fcr_val | UART_FCR_CLEAR_XMIT |
206 UART_FCR_CLEAR_RCVR); 195 UART_FCR_CLEAR_RCVR);
207 /* 196 /*
208 * Wait for FIFO to empty: when empty, RX_FIFO_E bit is 0 and 197 * Wait for FIFO to empty: when empty, RX_FIFO_E bit is 0 and
209 * TX_FIFO_E bit is 1. 198 * TX_FIFO_E bit is 1.
210 */ 199 */
211 while (UART_LSR_THRE != (serial_read_reg(p, UART_LSR) & 200 while (UART_LSR_THRE != (serial_read_reg(uart, UART_LSR) &
212 (UART_LSR_THRE | UART_LSR_DR))) { 201 (UART_LSR_THRE | UART_LSR_DR))) {
213 timeout--; 202 timeout--;
214 if (!timeout) { 203 if (!timeout) {
215 /* Should *never* happen. we warn and carry on */ 204 /* Should *never* happen. we warn and carry on */
216 dev_crit(&uart->pdev.dev, "Errata i202: timedout %x\n", 205 dev_crit(&uart->pdev->dev, "Errata i202: timedout %x\n",
217 serial_read_reg(p, UART_LSR)); 206 serial_read_reg(uart, UART_LSR));
218 break; 207 break;
219 } 208 }
220 udelay(1); 209 udelay(1);
@@ -224,23 +213,22 @@ static void omap_uart_mdr1_errataset(struct omap_uart_state *uart, u8 mdr1_val,
224static void omap_uart_save_context(struct omap_uart_state *uart) 213static void omap_uart_save_context(struct omap_uart_state *uart)
225{ 214{
226 u16 lcr = 0; 215 u16 lcr = 0;
227 struct plat_serial8250_port *p = uart->p;
228 216
229 if (!enable_off_mode) 217 if (!enable_off_mode)
230 return; 218 return;
231 219
232 lcr = serial_read_reg(p, UART_LCR); 220 lcr = serial_read_reg(uart, UART_LCR);
233 serial_write_reg(p, UART_LCR, 0xBF); 221 serial_write_reg(uart, UART_LCR, 0xBF);
234 uart->dll = serial_read_reg(p, UART_DLL); 222 uart->dll = serial_read_reg(uart, UART_DLL);
235 uart->dlh = serial_read_reg(p, UART_DLM); 223 uart->dlh = serial_read_reg(uart, UART_DLM);
236 serial_write_reg(p, UART_LCR, lcr); 224 serial_write_reg(uart, UART_LCR, lcr);
237 uart->ier = serial_read_reg(p, UART_IER); 225 uart->ier = serial_read_reg(uart, UART_IER);
238 uart->sysc = serial_read_reg(p, UART_OMAP_SYSC); 226 uart->sysc = serial_read_reg(uart, UART_OMAP_SYSC);
239 uart->scr = serial_read_reg(p, UART_OMAP_SCR); 227 uart->scr = serial_read_reg(uart, UART_OMAP_SCR);
240 uart->wer = serial_read_reg(p, UART_OMAP_WER); 228 uart->wer = serial_read_reg(uart, UART_OMAP_WER);
241 serial_write_reg(p, UART_LCR, 0x80); 229 serial_write_reg(uart, UART_LCR, 0x80);
242 uart->mcr = serial_read_reg(p, UART_MCR); 230 uart->mcr = serial_read_reg(uart, UART_MCR);
243 serial_write_reg(p, UART_LCR, lcr); 231 serial_write_reg(uart, UART_LCR, lcr);
244 232
245 uart->context_valid = 1; 233 uart->context_valid = 1;
246} 234}
@@ -248,7 +236,6 @@ static void omap_uart_save_context(struct omap_uart_state *uart)
248static void omap_uart_restore_context(struct omap_uart_state *uart) 236static void omap_uart_restore_context(struct omap_uart_state *uart)
249{ 237{
250 u16 efr = 0; 238 u16 efr = 0;
251 struct plat_serial8250_port *p = uart->p;
252 239
253 if (!enable_off_mode) 240 if (!enable_off_mode)
254 return; 241 return;
@@ -261,29 +248,30 @@ static void omap_uart_restore_context(struct omap_uart_state *uart)
261 if (uart->errata & UART_ERRATA_i202_MDR1_ACCESS) 248 if (uart->errata & UART_ERRATA_i202_MDR1_ACCESS)
262 omap_uart_mdr1_errataset(uart, 0x07, 0xA0); 249 omap_uart_mdr1_errataset(uart, 0x07, 0xA0);
263 else 250 else
264 serial_write_reg(p, UART_OMAP_MDR1, 0x7); 251 serial_write_reg(uart, UART_OMAP_MDR1, 0x7);
265 serial_write_reg(p, UART_LCR, 0xBF); /* Config B mode */ 252 serial_write_reg(uart, UART_LCR, 0xBF); /* Config B mode */
266 efr = serial_read_reg(p, UART_EFR); 253 efr = serial_read_reg(uart, UART_EFR);
267 serial_write_reg(p, UART_EFR, UART_EFR_ECB); 254 serial_write_reg(uart, UART_EFR, UART_EFR_ECB);
268 serial_write_reg(p, UART_LCR, 0x0); /* Operational mode */ 255 serial_write_reg(uart, UART_LCR, 0x0); /* Operational mode */
269 serial_write_reg(p, UART_IER, 0x0); 256 serial_write_reg(uart, UART_IER, 0x0);
270 serial_write_reg(p, UART_LCR, 0xBF); /* Config B mode */ 257 serial_write_reg(uart, UART_LCR, 0xBF); /* Config B mode */
271 serial_write_reg(p, UART_DLL, uart->dll); 258 serial_write_reg(uart, UART_DLL, uart->dll);
272 serial_write_reg(p, UART_DLM, uart->dlh); 259 serial_write_reg(uart, UART_DLM, uart->dlh);
273 serial_write_reg(p, UART_LCR, 0x0); /* Operational mode */ 260 serial_write_reg(uart, UART_LCR, 0x0); /* Operational mode */
274 serial_write_reg(p, UART_IER, uart->ier); 261 serial_write_reg(uart, UART_IER, uart->ier);
275 serial_write_reg(p, UART_LCR, 0x80); 262 serial_write_reg(uart, UART_LCR, 0x80);
276 serial_write_reg(p, UART_MCR, uart->mcr); 263 serial_write_reg(uart, UART_MCR, uart->mcr);
277 serial_write_reg(p, UART_LCR, 0xBF); /* Config B mode */ 264 serial_write_reg(uart, UART_LCR, 0xBF); /* Config B mode */
278 serial_write_reg(p, UART_EFR, efr); 265 serial_write_reg(uart, UART_EFR, efr);
279 serial_write_reg(p, UART_LCR, UART_LCR_WLEN8); 266 serial_write_reg(uart, UART_LCR, UART_LCR_WLEN8);
280 serial_write_reg(p, UART_OMAP_SCR, uart->scr); 267 serial_write_reg(uart, UART_OMAP_SCR, uart->scr);
281 serial_write_reg(p, UART_OMAP_WER, uart->wer); 268 serial_write_reg(uart, UART_OMAP_WER, uart->wer);
282 serial_write_reg(p, UART_OMAP_SYSC, uart->sysc); 269 serial_write_reg(uart, UART_OMAP_SYSC, uart->sysc);
283 if (uart->errata & UART_ERRATA_i202_MDR1_ACCESS) 270 if (uart->errata & UART_ERRATA_i202_MDR1_ACCESS)
284 omap_uart_mdr1_errataset(uart, 0x00, 0xA1); 271 omap_uart_mdr1_errataset(uart, 0x00, 0xA1);
285 else 272 else
286 serial_write_reg(p, UART_OMAP_MDR1, 0x00); /* UART 16x mode */ 273 /* UART 16x mode */
274 serial_write_reg(uart, UART_OMAP_MDR1, 0x00);
287} 275}
288#else 276#else
289static inline void omap_uart_save_context(struct omap_uart_state *uart) {} 277static inline void omap_uart_save_context(struct omap_uart_state *uart) {}
@@ -295,8 +283,7 @@ static inline void omap_uart_enable_clocks(struct omap_uart_state *uart)
295 if (uart->clocked) 283 if (uart->clocked)
296 return; 284 return;
297 285
298 clk_enable(uart->ick); 286 omap_device_enable(uart->pdev);
299 clk_enable(uart->fck);
300 uart->clocked = 1; 287 uart->clocked = 1;
301 omap_uart_restore_context(uart); 288 omap_uart_restore_context(uart);
302} 289}
@@ -310,8 +297,7 @@ static inline void omap_uart_disable_clocks(struct omap_uart_state *uart)
310 297
311 omap_uart_save_context(uart); 298 omap_uart_save_context(uart);
312 uart->clocked = 0; 299 uart->clocked = 0;
313 clk_disable(uart->ick); 300 omap_device_idle(uart->pdev);
314 clk_disable(uart->fck);
315} 301}
316 302
317static void omap_uart_enable_wakeup(struct omap_uart_state *uart) 303static void omap_uart_enable_wakeup(struct omap_uart_state *uart)
@@ -349,18 +335,24 @@ static void omap_uart_disable_wakeup(struct omap_uart_state *uart)
349} 335}
350 336
351static void omap_uart_smart_idle_enable(struct omap_uart_state *uart, 337static void omap_uart_smart_idle_enable(struct omap_uart_state *uart,
352 int enable) 338 int enable)
353{ 339{
354 struct plat_serial8250_port *p = uart->p; 340 u8 idlemode;
355 u16 sysc;
356 341
357 sysc = serial_read_reg(p, UART_OMAP_SYSC) & 0x7; 342 if (enable) {
358 if (enable) 343 /**
359 sysc |= 0x2 << 3; 344 * Errata 2.15: [UART]:Cannot Acknowledge Idle Requests
360 else 345 * in Smartidle Mode When Configured for DMA Operations.
361 sysc |= 0x1 << 3; 346 */
347 if (uart->dma_enabled)
348 idlemode = HWMOD_IDLEMODE_FORCE;
349 else
350 idlemode = HWMOD_IDLEMODE_SMART;
351 } else {
352 idlemode = HWMOD_IDLEMODE_NO;
353 }
362 354
363 serial_write_reg(p, UART_OMAP_SYSC, sysc); 355 omap_hwmod_set_slave_idlemode(uart->oh, idlemode);
364} 356}
365 357
366static void omap_uart_block_sleep(struct omap_uart_state *uart) 358static void omap_uart_block_sleep(struct omap_uart_state *uart)
@@ -377,7 +369,7 @@ static void omap_uart_block_sleep(struct omap_uart_state *uart)
377 369
378static void omap_uart_allow_sleep(struct omap_uart_state *uart) 370static void omap_uart_allow_sleep(struct omap_uart_state *uart)
379{ 371{
380 if (device_may_wakeup(&uart->pdev.dev)) 372 if (device_may_wakeup(&uart->pdev->dev))
381 omap_uart_enable_wakeup(uart); 373 omap_uart_enable_wakeup(uart);
382 else 374 else
383 omap_uart_disable_wakeup(uart); 375 omap_uart_disable_wakeup(uart);
@@ -472,6 +464,7 @@ int omap_uart_can_sleep(void)
472 * UART will not idle or sleep for its timeout period. 464 * UART will not idle or sleep for its timeout period.
473 * 465 *
474 **/ 466 **/
467/* static int first_interrupt; */
475static irqreturn_t omap_uart_interrupt(int irq, void *dev_id) 468static irqreturn_t omap_uart_interrupt(int irq, void *dev_id)
476{ 469{
477 struct omap_uart_state *uart = dev_id; 470 struct omap_uart_state *uart = dev_id;
@@ -483,7 +476,6 @@ static irqreturn_t omap_uart_interrupt(int irq, void *dev_id)
483 476
484static void omap_uart_idle_init(struct omap_uart_state *uart) 477static void omap_uart_idle_init(struct omap_uart_state *uart)
485{ 478{
486 struct plat_serial8250_port *p = uart->p;
487 int ret; 479 int ret;
488 480
489 uart->can_sleep = 0; 481 uart->can_sleep = 0;
@@ -495,7 +487,7 @@ static void omap_uart_idle_init(struct omap_uart_state *uart)
495 omap_uart_smart_idle_enable(uart, 0); 487 omap_uart_smart_idle_enable(uart, 0);
496 488
497 if (cpu_is_omap34xx()) { 489 if (cpu_is_omap34xx()) {
498 u32 mod = (uart->num == 2) ? OMAP3430_PER_MOD : CORE_MOD; 490 u32 mod = (uart->num > 1) ? OMAP3430_PER_MOD : CORE_MOD;
499 u32 wk_mask = 0; 491 u32 wk_mask = 0;
500 u32 padconf = 0; 492 u32 padconf = 0;
501 493
@@ -514,6 +506,10 @@ static void omap_uart_idle_init(struct omap_uart_state *uart)
514 wk_mask = OMAP3430_ST_UART3_MASK; 506 wk_mask = OMAP3430_ST_UART3_MASK;
515 padconf = 0x19e; 507 padconf = 0x19e;
516 break; 508 break;
509 case 3:
510 wk_mask = OMAP3630_ST_UART4_MASK;
511 padconf = 0x0d2;
512 break;
517 } 513 }
518 uart->wk_mask = wk_mask; 514 uart->wk_mask = wk_mask;
519 uart->padconf = padconf; 515 uart->padconf = padconf;
@@ -546,9 +542,9 @@ static void omap_uart_idle_init(struct omap_uart_state *uart)
546 uart->padconf = 0; 542 uart->padconf = 0;
547 } 543 }
548 544
549 p->irqflags |= IRQF_SHARED; 545 uart->irqflags |= IRQF_SHARED;
550 ret = request_irq(p->irq, omap_uart_interrupt, IRQF_SHARED, 546 ret = request_threaded_irq(uart->irq, NULL, omap_uart_interrupt,
551 "serial idle", (void *)uart); 547 IRQF_SHARED, "serial idle", (void *)uart);
552 WARN_ON(ret); 548 WARN_ON(ret);
553} 549}
554 550
@@ -558,11 +554,17 @@ void omap_uart_enable_irqs(int enable)
558 struct omap_uart_state *uart; 554 struct omap_uart_state *uart;
559 555
560 list_for_each_entry(uart, &uart_list, node) { 556 list_for_each_entry(uart, &uart_list, node) {
561 if (enable) 557 if (enable) {
562 ret = request_irq(uart->p->irq, omap_uart_interrupt, 558 pm_runtime_put_sync(&uart->pdev->dev);
563 IRQF_SHARED, "serial idle", (void *)uart); 559 ret = request_threaded_irq(uart->irq, NULL,
564 else 560 omap_uart_interrupt,
565 free_irq(uart->p->irq, (void *)uart); 561 IRQF_SHARED,
562 "serial idle",
563 (void *)uart);
564 } else {
565 pm_runtime_get_noresume(&uart->pdev->dev);
566 free_irq(uart->irq, (void *)uart);
567 }
566 } 568 }
567} 569}
568 570
@@ -570,10 +572,9 @@ static ssize_t sleep_timeout_show(struct device *dev,
570 struct device_attribute *attr, 572 struct device_attribute *attr,
571 char *buf) 573 char *buf)
572{ 574{
573 struct platform_device *pdev = container_of(dev, 575 struct platform_device *pdev = to_platform_device(dev);
574 struct platform_device, dev); 576 struct omap_device *odev = to_omap_device(pdev);
575 struct omap_uart_state *uart = container_of(pdev, 577 struct omap_uart_state *uart = odev->hwmods[0]->dev_attr;
576 struct omap_uart_state, pdev);
577 578
578 return sprintf(buf, "%u\n", uart->timeout / HZ); 579 return sprintf(buf, "%u\n", uart->timeout / HZ);
579} 580}
@@ -582,10 +583,9 @@ static ssize_t sleep_timeout_store(struct device *dev,
582 struct device_attribute *attr, 583 struct device_attribute *attr,
583 const char *buf, size_t n) 584 const char *buf, size_t n)
584{ 585{
585 struct platform_device *pdev = container_of(dev, 586 struct platform_device *pdev = to_platform_device(dev);
586 struct platform_device, dev); 587 struct omap_device *odev = to_omap_device(pdev);
587 struct omap_uart_state *uart = container_of(pdev, 588 struct omap_uart_state *uart = odev->hwmods[0]->dev_attr;
588 struct omap_uart_state, pdev);
589 unsigned int value; 589 unsigned int value;
590 590
591 if (sscanf(buf, "%u", &value) != 1) { 591 if (sscanf(buf, "%u", &value) != 1) {
@@ -608,48 +608,11 @@ static DEVICE_ATTR(sleep_timeout, 0644, sleep_timeout_show,
608#define DEV_CREATE_FILE(dev, attr) WARN_ON(device_create_file(dev, attr)) 608#define DEV_CREATE_FILE(dev, attr) WARN_ON(device_create_file(dev, attr))
609#else 609#else
610static inline void omap_uart_idle_init(struct omap_uart_state *uart) {} 610static inline void omap_uart_idle_init(struct omap_uart_state *uart) {}
611static void omap_uart_block_sleep(struct omap_uart_state *uart) {}
611#define DEV_CREATE_FILE(dev, attr) 612#define DEV_CREATE_FILE(dev, attr)
612#endif /* CONFIG_PM */ 613#endif /* CONFIG_PM */
613 614
614static struct omap_uart_state omap_uart[] = { 615#ifndef CONFIG_SERIAL_OMAP
615 {
616 .pdev = {
617 .name = "serial8250",
618 .id = PLAT8250_DEV_PLATFORM,
619 .dev = {
620 .platform_data = serial_platform_data0,
621 },
622 },
623 }, {
624 .pdev = {
625 .name = "serial8250",
626 .id = PLAT8250_DEV_PLATFORM1,
627 .dev = {
628 .platform_data = serial_platform_data1,
629 },
630 },
631 }, {
632 .pdev = {
633 .name = "serial8250",
634 .id = PLAT8250_DEV_PLATFORM2,
635 .dev = {
636 .platform_data = serial_platform_data2,
637 },
638 },
639 },
640#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
641 {
642 .pdev = {
643 .name = "serial8250",
644 .id = 3,
645 .dev = {
646 .platform_data = serial_platform_data3,
647 },
648 },
649 },
650#endif
651};
652
653/* 616/*
654 * Override the default 8250 read handler: mem_serial_in() 617 * Override the default 8250 read handler: mem_serial_in()
655 * Empty RX fifo read causes an abort on omap3630 and omap4 618 * Empty RX fifo read causes an abort on omap3630 and omap4
@@ -682,71 +645,44 @@ static void serial_out_override(struct uart_port *up, int offset, int value)
682 } 645 }
683 __serial_write_reg(up, offset, value); 646 __serial_write_reg(up, offset, value);
684} 647}
648#endif
649
685void __init omap_serial_early_init(void) 650void __init omap_serial_early_init(void)
686{ 651{
687 int i, nr_ports; 652 int i = 0;
688 char name[16];
689 653
690 if (!(cpu_is_omap3630() || cpu_is_omap4430())) 654 do {
691 nr_ports = 3; 655 char oh_name[MAX_UART_HWMOD_NAME_LEN];
692 else 656 struct omap_hwmod *oh;
693 nr_ports = ARRAY_SIZE(omap_uart); 657 struct omap_uart_state *uart;
694 658
695 /* 659 snprintf(oh_name, MAX_UART_HWMOD_NAME_LEN,
696 * Make sure the serial ports are muxed on at this point. 660 "uart%d", i + 1);
697 * You have to mux them off in device drivers later on 661 oh = omap_hwmod_lookup(oh_name);
698 * if not needed. 662 if (!oh)
699 */ 663 break;
700 664
701 for (i = 0; i < nr_ports; i++) { 665 uart = kzalloc(sizeof(struct omap_uart_state), GFP_KERNEL);
702 struct omap_uart_state *uart = &omap_uart[i]; 666 if (WARN_ON(!uart))
703 struct platform_device *pdev = &uart->pdev; 667 return;
704 struct device *dev = &pdev->dev; 668
705 struct plat_serial8250_port *p = dev->platform_data; 669 uart->oh = oh;
670 uart->num = i++;
671 list_add_tail(&uart->node, &uart_list);
672 num_uarts++;
706 673
707 /* Don't map zero-based physical address */
708 if (p->mapbase == 0) {
709 dev_warn(dev, "no physical address for uart#%d,"
710 " so skipping early_init...\n", i);
711 continue;
712 }
713 /* 674 /*
714 * Module 4KB + L4 interconnect 4KB 675 * NOTE: omap_hwmod_init() has not yet been called,
715 * Static mapping, never released 676 * so no hwmod functions will work yet.
716 */ 677 */
717 p->membase = ioremap(p->mapbase, SZ_8K);
718 if (!p->membase) {
719 dev_err(dev, "ioremap failed for uart%i\n", i + 1);
720 continue;
721 }
722
723 sprintf(name, "uart%d_ick", i + 1);
724 uart->ick = clk_get(NULL, name);
725 if (IS_ERR(uart->ick)) {
726 dev_err(dev, "Could not get uart%d_ick\n", i + 1);
727 uart->ick = NULL;
728 }
729
730 sprintf(name, "uart%d_fck", i+1);
731 uart->fck = clk_get(NULL, name);
732 if (IS_ERR(uart->fck)) {
733 dev_err(dev, "Could not get uart%d_fck\n", i + 1);
734 uart->fck = NULL;
735 }
736
737 /* FIXME: Remove this once the clkdev is ready */
738 if (!cpu_is_omap44xx()) {
739 if (!uart->ick || !uart->fck)
740 continue;
741 }
742
743 uart->num = i;
744 p->private_data = uart;
745 uart->p = p;
746 678
747 if (cpu_is_omap44xx()) 679 /*
748 p->irq += 32; 680 * During UART early init, device need to be probed
749 } 681 * to determine SoC specific init before omap_device
682 * is ready. Therefore, don't allow idle here
683 */
684 uart->oh->flags |= HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET;
685 } while (1);
750} 686}
751 687
752/** 688/**
@@ -763,53 +699,135 @@ void __init omap_serial_early_init(void)
763void __init omap_serial_init_port(int port) 699void __init omap_serial_init_port(int port)
764{ 700{
765 struct omap_uart_state *uart; 701 struct omap_uart_state *uart;
766 struct platform_device *pdev; 702 struct omap_hwmod *oh;
767 struct device *dev; 703 struct omap_device *od;
768 704 void *pdata = NULL;
769 BUG_ON(port < 0); 705 u32 pdata_size = 0;
770 BUG_ON(port >= ARRAY_SIZE(omap_uart)); 706 char *name;
771 707#ifndef CONFIG_SERIAL_OMAP
772 uart = &omap_uart[port]; 708 struct plat_serial8250_port ports[2] = {
773 pdev = &uart->pdev; 709 {},
774 dev = &pdev->dev; 710 {.flags = 0},
711 };
712 struct plat_serial8250_port *p = &ports[0];
713#else
714 struct omap_uart_port_info omap_up;
715#endif
775 716
776 /* Don't proceed if there's no clocks available */ 717 if (WARN_ON(port < 0))
777 if (unlikely(!uart->ick || !uart->fck)) { 718 return;
778 WARN(1, "%s: can't init uart%d, no clocks available\n", 719 if (WARN_ON(port >= num_uarts))
779 kobject_name(&dev->kobj), port);
780 return; 720 return;
781 }
782
783 omap_uart_enable_clocks(uart);
784
785 omap_uart_reset(uart);
786 omap_uart_idle_init(uart);
787 721
788 list_add_tail(&uart->node, &uart_list); 722 list_for_each_entry(uart, &uart_list, node)
723 if (port == uart->num)
724 break;
789 725
790 if (WARN_ON(platform_device_register(pdev))) 726 oh = uart->oh;
791 return; 727 uart->dma_enabled = 0;
728#ifndef CONFIG_SERIAL_OMAP
729 name = "serial8250";
792 730
793 if ((cpu_is_omap34xx() && uart->padconf) || 731 /*
794 (uart->wk_en && uart->wk_mask)) { 732 * !! 8250 driver does not use standard IORESOURCE* It
795 device_init_wakeup(dev, true); 733 * has it's own custom pdata that can be taken from
796 DEV_CREATE_FILE(dev, &dev_attr_sleep_timeout); 734 * the hwmod resource data. But, this needs to be
797 } 735 * done after the build.
736 *
737 * ?? does it have to be done before the register ??
738 * YES, because platform_device_data_add() copies
739 * pdata, it does not use a pointer.
740 */
741 p->flags = UPF_BOOT_AUTOCONF;
742 p->iotype = UPIO_MEM;
743 p->regshift = 2;
744 p->uartclk = OMAP24XX_BASE_BAUD * 16;
745 p->irq = oh->mpu_irqs[0].irq;
746 p->mapbase = oh->slaves[0]->addr->pa_start;
747 p->membase = omap_hwmod_get_mpu_rt_va(oh);
748 p->irqflags = IRQF_SHARED;
749 p->private_data = uart;
798 750
799 /* 751 /*
800 * omap44xx: Never read empty UART fifo 752 * omap44xx: Never read empty UART fifo
801 * omap3xxx: Never read empty UART fifo on UARTs 753 * omap3xxx: Never read empty UART fifo on UARTs
802 * with IP rev >=0x52 754 * with IP rev >=0x52
803 */ 755 */
756 uart->regshift = p->regshift;
757 uart->membase = p->membase;
804 if (cpu_is_omap44xx()) 758 if (cpu_is_omap44xx())
805 uart->errata |= UART_ERRATA_FIFO_FULL_ABORT; 759 uart->errata |= UART_ERRATA_FIFO_FULL_ABORT;
806 else if ((serial_read_reg(uart->p, UART_OMAP_MVER) & 0xFF) 760 else if ((serial_read_reg(uart, UART_OMAP_MVER) & 0xFF)
807 >= UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV) 761 >= UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV)
808 uart->errata |= UART_ERRATA_FIFO_FULL_ABORT; 762 uart->errata |= UART_ERRATA_FIFO_FULL_ABORT;
809 763
810 if (uart->errata & UART_ERRATA_FIFO_FULL_ABORT) { 764 if (uart->errata & UART_ERRATA_FIFO_FULL_ABORT) {
811 uart->p->serial_in = serial_in_override; 765 p->serial_in = serial_in_override;
812 uart->p->serial_out = serial_out_override; 766 p->serial_out = serial_out_override;
767 }
768
769 pdata = &ports[0];
770 pdata_size = 2 * sizeof(struct plat_serial8250_port);
771#else
772
773 name = DRIVER_NAME;
774
775 omap_up.dma_enabled = uart->dma_enabled;
776 omap_up.uartclk = OMAP24XX_BASE_BAUD * 16;
777 omap_up.mapbase = oh->slaves[0]->addr->pa_start;
778 omap_up.membase = omap_hwmod_get_mpu_rt_va(oh);
779 omap_up.irqflags = IRQF_SHARED;
780 omap_up.flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ;
781
782 pdata = &omap_up;
783 pdata_size = sizeof(struct omap_uart_port_info);
784#endif
785
786 if (WARN_ON(!oh))
787 return;
788
789 od = omap_device_build(name, uart->num, oh, pdata, pdata_size,
790 omap_uart_latency,
791 ARRAY_SIZE(omap_uart_latency), false);
792 WARN(IS_ERR(od), "Could not build omap_device for %s: %s.\n",
793 name, oh->name);
794
795 uart->irq = oh->mpu_irqs[0].irq;
796 uart->regshift = 2;
797 uart->mapbase = oh->slaves[0]->addr->pa_start;
798 uart->membase = omap_hwmod_get_mpu_rt_va(oh);
799 uart->pdev = &od->pdev;
800
801 oh->dev_attr = uart;
802
803 /*
804 * Because of early UART probing, UART did not get idled
805 * on init. Now that omap_device is ready, ensure full idle
806 * before doing omap_device_enable().
807 */
808 omap_hwmod_idle(uart->oh);
809
810 omap_device_enable(uart->pdev);
811 omap_uart_idle_init(uart);
812 omap_uart_reset(uart);
813 omap_hwmod_enable_wakeup(uart->oh);
814 omap_device_idle(uart->pdev);
815
816 /*
817 * Need to block sleep long enough for interrupt driven
818 * driver to start. Console driver is in polling mode
819 * so device needs to be kept enabled while polling driver
820 * is in use.
821 */
822 if (uart->timeout)
823 uart->timeout = (30 * HZ);
824 omap_uart_block_sleep(uart);
825 uart->timeout = DEFAULT_TIMEOUT;
826
827 if ((cpu_is_omap34xx() && uart->padconf) ||
828 (uart->wk_en && uart->wk_mask)) {
829 device_init_wakeup(&od->pdev.dev, true);
830 DEV_CREATE_FILE(&od->pdev.dev, &dev_attr_sleep_timeout);
813 } 831 }
814 832
815 /* Enable the MDR1 errata for OMAP3 */ 833 /* Enable the MDR1 errata for OMAP3 */
@@ -826,13 +844,8 @@ void __init omap_serial_init_port(int port)
826 */ 844 */
827void __init omap_serial_init(void) 845void __init omap_serial_init(void)
828{ 846{
829 int i, nr_ports; 847 struct omap_uart_state *uart;
830
831 if (!(cpu_is_omap3630() || cpu_is_omap4430()))
832 nr_ports = 3;
833 else
834 nr_ports = ARRAY_SIZE(omap_uart);
835 848
836 for (i = 0; i < nr_ports; i++) 849 list_for_each_entry(uart, &uart_list, node)
837 omap_serial_init_port(i); 850 omap_serial_init_port(uart->num);
838} 851}
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 7d668b3b536..947de3fb93f 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -257,7 +257,6 @@ static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
257 omap2_set_globals_sdrc(omap2_globals); 257 omap2_set_globals_sdrc(omap2_globals);
258 omap2_set_globals_control(omap2_globals); 258 omap2_set_globals_control(omap2_globals);
259 omap2_set_globals_prcm(omap2_globals); 259 omap2_set_globals_prcm(omap2_globals);
260 omap2_set_globals_uart(omap2_globals);
261} 260}
262 261
263#endif 262#endif
@@ -272,9 +271,6 @@ static struct omap_globals omap242x_globals = {
272 .ctrl = OMAP2420_CTRL_BASE, 271 .ctrl = OMAP2420_CTRL_BASE,
273 .prm = OMAP2420_PRM_BASE, 272 .prm = OMAP2420_PRM_BASE,
274 .cm = OMAP2420_CM_BASE, 273 .cm = OMAP2420_CM_BASE,
275 .uart1_phys = OMAP2_UART1_BASE,
276 .uart2_phys = OMAP2_UART2_BASE,
277 .uart3_phys = OMAP2_UART3_BASE,
278}; 274};
279 275
280void __init omap2_set_globals_242x(void) 276void __init omap2_set_globals_242x(void)
@@ -293,9 +289,6 @@ static struct omap_globals omap243x_globals = {
293 .ctrl = OMAP243X_CTRL_BASE, 289 .ctrl = OMAP243X_CTRL_BASE,
294 .prm = OMAP2430_PRM_BASE, 290 .prm = OMAP2430_PRM_BASE,
295 .cm = OMAP2430_CM_BASE, 291 .cm = OMAP2430_CM_BASE,
296 .uart1_phys = OMAP2_UART1_BASE,
297 .uart2_phys = OMAP2_UART2_BASE,
298 .uart3_phys = OMAP2_UART3_BASE,
299}; 292};
300 293
301void __init omap2_set_globals_243x(void) 294void __init omap2_set_globals_243x(void)
@@ -314,10 +307,6 @@ static struct omap_globals omap3_globals = {
314 .ctrl = OMAP343X_CTRL_BASE, 307 .ctrl = OMAP343X_CTRL_BASE,
315 .prm = OMAP3430_PRM_BASE, 308 .prm = OMAP3430_PRM_BASE,
316 .cm = OMAP3430_CM_BASE, 309 .cm = OMAP3430_CM_BASE,
317 .uart1_phys = OMAP3_UART1_BASE,
318 .uart2_phys = OMAP3_UART2_BASE,
319 .uart3_phys = OMAP3_UART3_BASE,
320 .uart4_phys = OMAP3_UART4_BASE, /* Only on 3630 */
321}; 310};
322 311
323void __init omap2_set_globals_3xxx(void) 312void __init omap2_set_globals_3xxx(void)
@@ -341,10 +330,6 @@ static struct omap_globals omap4_globals = {
341 .prm = OMAP4430_PRM_BASE, 330 .prm = OMAP4430_PRM_BASE,
342 .cm = OMAP4430_CM_BASE, 331 .cm = OMAP4430_CM_BASE,
343 .cm2 = OMAP4430_CM2_BASE, 332 .cm2 = OMAP4430_CM2_BASE,
344 .uart1_phys = OMAP4_UART1_BASE,
345 .uart2_phys = OMAP4_UART2_BASE,
346 .uart3_phys = OMAP4_UART3_BASE,
347 .uart4_phys = OMAP4_UART4_BASE,
348}; 333};
349 334
350void __init omap2_set_globals_443x(void) 335void __init omap2_set_globals_443x(void)
@@ -352,7 +337,6 @@ void __init omap2_set_globals_443x(void)
352 omap2_set_globals_tap(&omap4_globals); 337 omap2_set_globals_tap(&omap4_globals);
353 omap2_set_globals_control(&omap4_globals); 338 omap2_set_globals_control(&omap4_globals);
354 omap2_set_globals_prcm(&omap4_globals); 339 omap2_set_globals_prcm(&omap4_globals);
355 omap2_set_globals_uart(&omap4_globals);
356} 340}
357#endif 341#endif
358 342
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index d1920be7833..8e88e0e5d52 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -232,46 +232,6 @@ static void omap_init_uwire(void)
232static inline void omap_init_uwire(void) {} 232static inline void omap_init_uwire(void) {}
233#endif 233#endif
234 234
235/*-------------------------------------------------------------------------*/
236
237#if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
238
239static struct resource wdt_resources[] = {
240 {
241 .flags = IORESOURCE_MEM,
242 },
243};
244
245static struct platform_device omap_wdt_device = {
246 .name = "omap_wdt",
247 .id = -1,
248 .num_resources = ARRAY_SIZE(wdt_resources),
249 .resource = wdt_resources,
250};
251
252static void omap_init_wdt(void)
253{
254 if (cpu_is_omap16xx())
255 wdt_resources[0].start = 0xfffeb000;
256 else if (cpu_is_omap2420())
257 wdt_resources[0].start = 0x48022000; /* WDT2 */
258 else if (cpu_is_omap2430())
259 wdt_resources[0].start = 0x49016000; /* WDT2 */
260 else if (cpu_is_omap343x())
261 wdt_resources[0].start = 0x48314000; /* WDT2 */
262 else if (cpu_is_omap44xx())
263 wdt_resources[0].start = 0x4a314000;
264 else
265 return;
266
267 wdt_resources[0].end = wdt_resources[0].start + 0x4f;
268
269 (void) platform_device_register(&omap_wdt_device);
270}
271#else
272static inline void omap_init_wdt(void) {}
273#endif
274
275/* 235/*
276 * This gets called after board-specific INIT_MACHINE, and initializes most 236 * This gets called after board-specific INIT_MACHINE, and initializes most
277 * on-chip peripherals accessible on this board (except for few like USB): 237 * on-chip peripherals accessible on this board (except for few like USB):
@@ -300,7 +260,6 @@ static int __init omap_init_devices(void)
300 omap_init_rng(); 260 omap_init_rng();
301 omap_init_mcpdm(); 261 omap_init_mcpdm();
302 omap_init_uwire(); 262 omap_init_uwire();
303 omap_init_wdt();
304 return 0; 263 return 0;
305} 264}
306arch_initcall(omap_init_devices); 265arch_initcall(omap_init_devices);
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
index 2d8f98d7ae5..a9d69a09920 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -67,7 +67,6 @@ void omap2_set_globals_tap(struct omap_globals *);
67void omap2_set_globals_sdrc(struct omap_globals *); 67void omap2_set_globals_sdrc(struct omap_globals *);
68void omap2_set_globals_control(struct omap_globals *); 68void omap2_set_globals_control(struct omap_globals *);
69void omap2_set_globals_prcm(struct omap_globals *); 69void omap2_set_globals_prcm(struct omap_globals *);
70void omap2_set_globals_uart(struct omap_globals *);
71 70
72void omap3_map_io(void); 71void omap3_map_io(void);
73 72
diff --git a/arch/arm/plat-omap/include/plat/dma.h b/arch/arm/plat-omap/include/plat/dma.h
index af3a03941ad..098f154f5d4 100644
--- a/arch/arm/plat-omap/include/plat/dma.h
+++ b/arch/arm/plat-omap/include/plat/dma.h
@@ -319,6 +319,8 @@
319#define OMAP34XX_DMA_USIM_TX 79 /* S_DMA_78 */ 319#define OMAP34XX_DMA_USIM_TX 79 /* S_DMA_78 */
320#define OMAP34XX_DMA_USIM_RX 80 /* S_DMA_79 */ 320#define OMAP34XX_DMA_USIM_RX 80 /* S_DMA_79 */
321 321
322#define OMAP36XX_DMA_UART4_TX 81 /* S_DMA_80 */
323#define OMAP36XX_DMA_UART4_RX 82 /* S_DMA_81 */
322/*----------------------------------------------------------------------------*/ 324/*----------------------------------------------------------------------------*/
323 325
324#define OMAP1_DMA_TOUT_IRQ (1 << 0) 326#define OMAP1_DMA_TOUT_IRQ (1 << 0)
diff --git a/arch/arm/plat-omap/include/plat/irqs.h b/arch/arm/plat-omap/include/plat/irqs.h
index c01d9f08a19..65e20a68671 100644
--- a/arch/arm/plat-omap/include/plat/irqs.h
+++ b/arch/arm/plat-omap/include/plat/irqs.h
@@ -345,6 +345,8 @@
345#define INT_34XX_MMC3_IRQ 94 345#define INT_34XX_MMC3_IRQ 94
346#define INT_34XX_GPT12_IRQ 95 346#define INT_34XX_GPT12_IRQ 95
347 347
348#define INT_36XX_UART4_IRQ 80
349
348#define INT_35XX_HECC0_IRQ 24 350#define INT_35XX_HECC0_IRQ 24
349#define INT_35XX_HECC1_IRQ 28 351#define INT_35XX_HECC1_IRQ 28
350#define INT_35XX_EMAC_C0_RXTHRESH_IRQ 67 352#define INT_35XX_EMAC_C0_RXTHRESH_IRQ 67
diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h
new file mode 100644
index 00000000000..0d6f076cf74
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/omap-serial.h
@@ -0,0 +1,129 @@
1/*
2 * Driver for OMAP-UART controller.
3 * Based on drivers/serial/8250.c
4 *
5 * Copyright (C) 2010 Texas Instruments.
6 *
7 * Authors:
8 * Govindraj R <govindraj.raja@ti.com>
9 * Thara Gopinath <thara@ti.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 */
16
17#ifndef __OMAP_SERIAL_H__
18#define __OMAP_SERIAL_H__
19
20#include <linux/serial_core.h>
21#include <linux/platform_device.h>
22
23#include <plat/control.h>
24#include <plat/mux.h>
25
26#define DRIVER_NAME "omap-hsuart"
27
28/*
29 * Use tty device name as ttyO, [O -> OMAP]
30 * in bootargs we specify as console=ttyO0 if uart1
31 * is used as console uart.
32 */
33#define OMAP_SERIAL_NAME "ttyO"
34
35#define OMAP_MDR1_DISABLE 0x07
36#define OMAP_MDR1_MODE13X 0x03
37#define OMAP_MDR1_MODE16X 0x00
38#define OMAP_MODE13X_SPEED 230400
39
40/*
41 * LCR = 0XBF: Switch to Configuration Mode B.
42 * In configuration mode b allow access
43 * to EFR,DLL,DLH.
44 * Reference OMAP TRM Chapter 17
45 * Section: 1.4.3 Mode Selection
46 */
47#define OMAP_UART_LCR_CONF_MDB 0XBF
48
49/* WER = 0x7F
50 * Enable module level wakeup in WER reg
51 */
52#define OMAP_UART_WER_MOD_WKUP 0X7F
53
54/* Enable XON/XOFF flow control on output */
55#define OMAP_UART_SW_TX 0x04
56
57/* Enable XON/XOFF flow control on input */
58#define OMAP_UART_SW_RX 0x04
59
60#define OMAP_UART_SYSC_RESET 0X07
61#define OMAP_UART_TCR_TRIG 0X0F
62#define OMAP_UART_SW_CLR 0XF0
63#define OMAP_UART_FIFO_CLR 0X06
64
65#define OMAP_UART_DMA_CH_FREE -1
66
67#define RX_TIMEOUT (3 * HZ)
68#define OMAP_MAX_HSUART_PORTS 4
69
70#define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
71
72struct omap_uart_port_info {
73 bool dma_enabled; /* To specify DMA Mode */
74 unsigned int uartclk; /* UART clock rate */
75 void __iomem *membase; /* ioremap cookie or NULL */
76 resource_size_t mapbase; /* resource base */
77 unsigned long irqflags; /* request_irq flags */
78 upf_t flags; /* UPF_* flags */
79};
80
81struct uart_omap_dma {
82 u8 uart_dma_tx;
83 u8 uart_dma_rx;
84 int rx_dma_channel;
85 int tx_dma_channel;
86 dma_addr_t rx_buf_dma_phys;
87 dma_addr_t tx_buf_dma_phys;
88 unsigned int uart_base;
89 /*
90 * Buffer for rx dma.It is not required for tx because the buffer
91 * comes from port structure.
92 */
93 unsigned char *rx_buf;
94 unsigned int prev_rx_dma_pos;
95 int tx_buf_size;
96 int tx_dma_used;
97 int rx_dma_used;
98 spinlock_t tx_lock;
99 spinlock_t rx_lock;
100 /* timer to poll activity on rx dma */
101 struct timer_list rx_timer;
102 int rx_buf_size;
103 int rx_timeout;
104};
105
106struct uart_omap_port {
107 struct uart_port port;
108 struct uart_omap_dma uart_dma;
109 struct platform_device *pdev;
110
111 unsigned char ier;
112 unsigned char lcr;
113 unsigned char mcr;
114 unsigned char fcr;
115 unsigned char efr;
116
117 int use_dma;
118 /*
119 * Some bits in registers are cleared on a read, so they must
120 * be saved whenever the register is read but the bits will not
121 * be immediately processed.
122 */
123 unsigned int lsr_break_flag;
124 unsigned char msr_saved_flags;
125 char name[20];
126 unsigned long port_activity;
127};
128
129#endif /* __OMAP_SERIAL_H__ */