aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2012-05-11 02:41:06 -0400
committerOlof Johansson <olof@lixom.net>2012-05-11 02:41:06 -0400
commitb335d89cd455ef89c734b9a25de1ab0e745363eb (patch)
treeecffb7e92f5eaf9c3f316729d4efb665d600c916 /arch/arm/mach-omap2
parent620340cad8e1d331f4002ded12ee4e284de869c9 (diff)
parentbfd17879866b36e95c58721da070d9f2ac7f8901 (diff)
Merge tag 'omap-devel-hwmod-data-for-v3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into next/pm
Data changes related to omap hwmod By Paul Walmsley (4) and others via Paul Walmsley (1) and Tony Lindgren (1) * tag 'omap-devel-hwmod-data-for-v3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: ARM: OMAP2+: WDTIMER integration: fix !PM boot crash, disarm timer after hwmod reset ARM: OMAP2/3: hwmod data: Add 32k-sync timer data to hwmod database ARM: OMAP4: hwmod_data: Name the common irq for McBSP ports ARM: OMAP4: hwmod data: I2C: add flag for context restore ARM: OMAP3: hwmod_data: Rename the common irq for McBSP ports ARM: OMAP2xxx: hwmod data: add HDQ/1-wire hwmod ARM: OMAP3: hwmod data: add HDQ/1-wire hwmod ARM: OMAP2+: hwmod data: add HDQ/1-wire hwmod shared data ARM: OMAP2+: HDQ1W: add custom reset function ARM: OMAP2420: hwmod data: Add MMC hwmod data for 2420
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/Makefile5
-rw-r--r--arch/arm/mach-omap2/hdq1w.c72
-rw-r--r--arch/arm/mach-omap2/io.c18
-rw-r--r--arch/arm/mach-omap2/msdi.c88
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c112
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c47
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c9
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c22
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c23
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c94
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c12
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_common_data.h5
-rw-r--r--arch/arm/mach-omap2/wd_timer.c45
-rw-r--r--arch/arm/mach-omap2/wd_timer.h1
14 files changed, 522 insertions, 31 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index d8604a3e490e..385c083d24b2 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -4,7 +4,7 @@
4 4
5# Common support 5# Common support
6obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer.o pm.o \ 6obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer.o pm.o \
7 common.o gpio.o dma.o wd_timer.o display.o i2c.o 7 common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o
8 8
9omap-2-3-common = irq.o sdrc.o 9omap-2-3-common = irq.o sdrc.o
10hwmod-common = omap_hwmod.o \ 10hwmod-common = omap_hwmod.o \
@@ -189,6 +189,9 @@ ifneq ($(CONFIG_TIDSPBRIDGE),)
189obj-y += dsp.o 189obj-y += dsp.o
190endif 190endif
191 191
192# OMAP2420 MSDI controller integration support ("MMC")
193obj-$(CONFIG_SOC_OMAP2420) += msdi.o
194
192# Specific board support 195# Specific board support
193obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o 196obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o
194obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o 197obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o
diff --git a/arch/arm/mach-omap2/hdq1w.c b/arch/arm/mach-omap2/hdq1w.c
new file mode 100644
index 000000000000..297ebe03f09c
--- /dev/null
+++ b/arch/arm/mach-omap2/hdq1w.c
@@ -0,0 +1,72 @@
1/*
2 * IP block integration code for the HDQ1W/1-wire IP block
3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 * Paul Walmsley
6 *
7 * Based on the I2C reset code in arch/arm/mach-omap2/i2c.c by
8 * Avinash.H.M <avinashhm@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * version 2 as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22 * 02110-1301 USA
23 */
24
25#include <plat/omap_hwmod.h>
26#include <plat/hdq1w.h>
27
28#include "common.h"
29
30/* Maximum microseconds to wait for OMAP module to softreset */
31#define MAX_MODULE_SOFTRESET_WAIT 10000
32
33/**
34 * omap_hdq1w_reset - reset the OMAP HDQ1W module
35 * @oh: struct omap_hwmod *
36 *
37 * OCP soft reset the HDQ1W IP block. Section 20.6.1.4 "HDQ1W/1-Wire
38 * Software Reset" of the OMAP34xx Technical Reference Manual Revision
39 * ZR (SWPU223R) does not include the rather important fact that, for
40 * the reset to succeed, the HDQ1W module's internal clock gate must be
41 * programmed to allow the clock to propagate to the rest of the
42 * module. In this sense, it's rather similar to the I2C custom reset
43 * function. Returns 0.
44 */
45int omap_hdq1w_reset(struct omap_hwmod *oh)
46{
47 u32 v;
48 int c = 0;
49
50 /* Write to the SOFTRESET bit */
51 omap_hwmod_softreset(oh);
52
53 /* Enable the module's internal clocks */
54 v = omap_hwmod_read(oh, HDQ_CTRL_STATUS_OFFSET);
55 v |= 1 << HDQ_CTRL_STATUS_CLOCKENABLE_SHIFT;
56 omap_hwmod_write(v, oh, HDQ_CTRL_STATUS_OFFSET);
57
58 /* Poll on RESETDONE bit */
59 omap_test_timeout((omap_hwmod_read(oh,
60 oh->class->sysc->syss_offs)
61 & SYSS_RESETDONE_MASK),
62 MAX_MODULE_SOFTRESET_WAIT, c);
63
64 if (c == MAX_MODULE_SOFTRESET_WAIT)
65 pr_warning("%s: %s: softreset failed (waited %d usec)\n",
66 __func__, oh->name, MAX_MODULE_SOFTRESET_WAIT);
67 else
68 pr_debug("%s: %s: softreset in %d usec\n", __func__,
69 oh->name, c);
70
71 return 0;
72}
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 065bd768987c..fafcc35b970c 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -363,24 +363,6 @@ static void __init omap_hwmod_init_postsetup(void)
363#endif 363#endif
364 omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state); 364 omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state);
365 365
366 /*
367 * Set the default postsetup state for unusual modules (like
368 * MPU WDT).
369 *
370 * The postsetup_state is not actually used until
371 * omap_hwmod_late_init(), so boards that desire full watchdog
372 * coverage of kernel initialization can reprogram the
373 * postsetup_state between the calls to
374 * omap2_init_common_infra() and omap_sdrc_init().
375 *
376 * XXX ideally we could detect whether the MPU WDT was currently
377 * enabled here and make this conditional
378 */
379 postsetup_state = _HWMOD_STATE_DISABLED;
380 omap_hwmod_for_each_by_class("wd_timer",
381 _set_hwmod_postsetup_state,
382 &postsetup_state);
383
384 omap_pm_if_early_init(); 366 omap_pm_if_early_init();
385} 367}
386 368
diff --git a/arch/arm/mach-omap2/msdi.c b/arch/arm/mach-omap2/msdi.c
new file mode 100644
index 000000000000..ef2a6924731a
--- /dev/null
+++ b/arch/arm/mach-omap2/msdi.c
@@ -0,0 +1,88 @@
1/*
2 * MSDI IP block reset
3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 * Paul Walmsley
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 *
21 * XXX What about pad muxing?
22 */
23
24#include <linux/kernel.h>
25
26#include <plat/omap_hwmod.h>
27#include <plat/mmc.h>
28
29#include "common.h"
30
31/*
32 * MSDI_CON_OFFSET: offset in bytes of the MSDI IP block's CON register
33 * from the IP block's base address
34 */
35#define MSDI_CON_OFFSET 0x0c
36
37/* Register bitfields in the CON register */
38#define MSDI_CON_POW_MASK BIT(11)
39#define MSDI_CON_CLKD_MASK (0x3f << 0)
40#define MSDI_CON_CLKD_SHIFT 0
41
42/* Maximum microseconds to wait for OMAP module to softreset */
43#define MAX_MODULE_SOFTRESET_WAIT 10000
44
45/* MSDI_TARGET_RESET_CLKD: clock divisor to use throughout the reset */
46#define MSDI_TARGET_RESET_CLKD 0x3ff
47
48/**
49 * omap_msdi_reset - reset the MSDI IP block
50 * @oh: struct omap_hwmod *
51 *
52 * The MSDI IP block on OMAP2420 has to have both the POW and CLKD
53 * fields set inside its CON register for a reset to complete
54 * successfully. This is not documented in the TRM. For CLKD, we use
55 * the value that results in the lowest possible clock rate, to attempt
56 * to avoid disturbing any cards.
57 */
58int omap_msdi_reset(struct omap_hwmod *oh)
59{
60 u16 v = 0;
61 int c = 0;
62
63 /* Write to the SOFTRESET bit */
64 omap_hwmod_softreset(oh);
65
66 /* Enable the MSDI core and internal clock */
67 v |= MSDI_CON_POW_MASK;
68 v |= MSDI_TARGET_RESET_CLKD << MSDI_CON_CLKD_SHIFT;
69 omap_hwmod_write(v, oh, MSDI_CON_OFFSET);
70
71 /* Poll on RESETDONE bit */
72 omap_test_timeout((omap_hwmod_read(oh, oh->class->sysc->syss_offs)
73 & SYSS_RESETDONE_MASK),
74 MAX_MODULE_SOFTRESET_WAIT, c);
75
76 if (c == MAX_MODULE_SOFTRESET_WAIT)
77 pr_warning("%s: %s: softreset failed (waited %d usec)\n",
78 __func__, oh->name, MAX_MODULE_SOFTRESET_WAIT);
79 else
80 pr_debug("%s: %s: softreset in %d usec\n", __func__,
81 oh->name, c);
82
83 /* Disable the MSDI internal clock */
84 v &= ~MSDI_CON_CLKD_MASK;
85 omap_hwmod_write(v, oh, MSDI_CON_OFFSET);
86
87 return 0;
88}
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index 2c087ffc6a92..a7640d1b215e 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -23,6 +23,7 @@
23#include <plat/dmtimer.h> 23#include <plat/dmtimer.h>
24#include <plat/l3_2xxx.h> 24#include <plat/l3_2xxx.h>
25#include <plat/l4_2xxx.h> 25#include <plat/l4_2xxx.h>
26#include <plat/mmc.h>
26 27
27#include "omap_hwmod_common_data.h" 28#include "omap_hwmod_common_data.h"
28 29
@@ -239,6 +240,67 @@ static struct omap_hwmod omap2420_mcbsp2_hwmod = {
239 }, 240 },
240}; 241};
241 242
243static struct omap_hwmod_class_sysconfig omap2420_msdi_sysc = {
244 .rev_offs = 0x3c,
245 .sysc_offs = 0x64,
246 .syss_offs = 0x68,
247 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
248 .sysc_fields = &omap_hwmod_sysc_type1,
249};
250
251static struct omap_hwmod_class omap2420_msdi_hwmod_class = {
252 .name = "msdi",
253 .sysc = &omap2420_msdi_sysc,
254 .reset = &omap_msdi_reset,
255};
256
257/* msdi1 */
258static struct omap_hwmod_irq_info omap2420_msdi1_irqs[] = {
259 { .irq = 83 },
260 { .irq = -1 }
261};
262
263static struct omap_hwmod_dma_info omap2420_msdi1_sdma_reqs[] = {
264 { .name = "tx", .dma_req = 61 }, /* OMAP24XX_DMA_MMC1_TX */
265 { .name = "rx", .dma_req = 62 }, /* OMAP24XX_DMA_MMC1_RX */
266 { .dma_req = -1 }
267};
268
269static struct omap_hwmod omap2420_msdi1_hwmod = {
270 .name = "msdi1",
271 .class = &omap2420_msdi_hwmod_class,
272 .mpu_irqs = omap2420_msdi1_irqs,
273 .sdma_reqs = omap2420_msdi1_sdma_reqs,
274 .main_clk = "mmc_fck",
275 .prcm = {
276 .omap2 = {
277 .prcm_reg_id = 1,
278 .module_bit = OMAP2420_EN_MMC_SHIFT,
279 .module_offs = CORE_MOD,
280 .idlest_reg_id = 1,
281 .idlest_idle_bit = OMAP2420_ST_MMC_SHIFT,
282 },
283 },
284 .flags = HWMOD_16BIT_REG,
285};
286
287/* HDQ1W/1-wire */
288static struct omap_hwmod omap2420_hdq1w_hwmod = {
289 .name = "hdq1w",
290 .mpu_irqs = omap2_hdq1w_mpu_irqs,
291 .main_clk = "hdq_fck",
292 .prcm = {
293 .omap2 = {
294 .module_offs = CORE_MOD,
295 .prcm_reg_id = 1,
296 .module_bit = OMAP24XX_EN_HDQ_SHIFT,
297 .idlest_reg_id = 1,
298 .idlest_idle_bit = OMAP24XX_ST_HDQ_SHIFT,
299 },
300 },
301 .class = &omap2_hdq1w_class,
302};
303
242/* 304/*
243 * interfaces 305 * interfaces
244 */ 306 */
@@ -428,6 +490,53 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__mcbsp2 = {
428 .user = OCP_USER_MPU | OCP_USER_SDMA, 490 .user = OCP_USER_MPU | OCP_USER_SDMA,
429}; 491};
430 492
493static struct omap_hwmod_addr_space omap2420_msdi1_addrs[] = {
494 {
495 .pa_start = 0x4809c000,
496 .pa_end = 0x4809c000 + SZ_128 - 1,
497 .flags = ADDR_TYPE_RT,
498 },
499 { }
500};
501
502/* l4_core -> msdi1 */
503static struct omap_hwmod_ocp_if omap2420_l4_core__msdi1 = {
504 .master = &omap2xxx_l4_core_hwmod,
505 .slave = &omap2420_msdi1_hwmod,
506 .clk = "mmc_ick",
507 .addr = omap2420_msdi1_addrs,
508 .user = OCP_USER_MPU | OCP_USER_SDMA,
509};
510
511/* l4_core -> hdq1w interface */
512static struct omap_hwmod_ocp_if omap2420_l4_core__hdq1w = {
513 .master = &omap2xxx_l4_core_hwmod,
514 .slave = &omap2420_hdq1w_hwmod,
515 .clk = "hdq_ick",
516 .addr = omap2_hdq1w_addr_space,
517 .user = OCP_USER_MPU | OCP_USER_SDMA,
518 .flags = OMAP_FIREWALL_L4 | OCPIF_SWSUP_IDLE,
519};
520
521
522/* l4_wkup -> 32ksync_counter */
523static struct omap_hwmod_addr_space omap2420_counter_32k_addrs[] = {
524 {
525 .pa_start = 0x48004000,
526 .pa_end = 0x4800401f,
527 .flags = ADDR_TYPE_RT
528 },
529 { }
530};
531
532static struct omap_hwmod_ocp_if omap2420_l4_wkup__counter_32k = {
533 .master = &omap2xxx_l4_wkup_hwmod,
534 .slave = &omap2xxx_counter_32k_hwmod,
535 .clk = "sync_32k_ick",
536 .addr = omap2420_counter_32k_addrs,
537 .user = OCP_USER_MPU | OCP_USER_SDMA,
538};
539
431static struct omap_hwmod_ocp_if *omap2420_hwmod_ocp_ifs[] __initdata = { 540static struct omap_hwmod_ocp_if *omap2420_hwmod_ocp_ifs[] __initdata = {
432 &omap2xxx_l3_main__l4_core, 541 &omap2xxx_l3_main__l4_core,
433 &omap2xxx_mpu__l3_main, 542 &omap2xxx_mpu__l3_main,
@@ -468,6 +577,9 @@ static struct omap_hwmod_ocp_if *omap2420_hwmod_ocp_ifs[] __initdata = {
468 &omap2420_l4_core__mailbox, 577 &omap2420_l4_core__mailbox,
469 &omap2420_l4_core__mcbsp1, 578 &omap2420_l4_core__mcbsp1,
470 &omap2420_l4_core__mcbsp2, 579 &omap2420_l4_core__mcbsp2,
580 &omap2420_l4_core__msdi1,
581 &omap2420_l4_core__hdq1w,
582 &omap2420_l4_wkup__counter_32k,
471 NULL, 583 NULL,
472}; 584};
473 585
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index 71d9f8824f9d..4d7264981230 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -528,6 +528,23 @@ static struct omap_hwmod omap2430_mmc2_hwmod = {
528 .class = &omap2430_mmc_class, 528 .class = &omap2430_mmc_class,
529}; 529};
530 530
531/* HDQ1W/1-wire */
532static struct omap_hwmod omap2430_hdq1w_hwmod = {
533 .name = "hdq1w",
534 .mpu_irqs = omap2_hdq1w_mpu_irqs,
535 .main_clk = "hdq_fck",
536 .prcm = {
537 .omap2 = {
538 .module_offs = CORE_MOD,
539 .prcm_reg_id = 1,
540 .module_bit = OMAP24XX_EN_HDQ_SHIFT,
541 .idlest_reg_id = 1,
542 .idlest_idle_bit = OMAP24XX_ST_HDQ_SHIFT,
543 },
544 },
545 .class = &omap2_hdq1w_class,
546};
547
531/* 548/*
532 * interfaces 549 * interfaces
533 */ 550 */
@@ -838,6 +855,34 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp5 = {
838 .user = OCP_USER_MPU | OCP_USER_SDMA, 855 .user = OCP_USER_MPU | OCP_USER_SDMA,
839}; 856};
840 857
858/* l4_core -> hdq1w */
859static struct omap_hwmod_ocp_if omap2430_l4_core__hdq1w = {
860 .master = &omap2xxx_l4_core_hwmod,
861 .slave = &omap2430_hdq1w_hwmod,
862 .clk = "hdq_ick",
863 .addr = omap2_hdq1w_addr_space,
864 .user = OCP_USER_MPU | OCP_USER_SDMA,
865 .flags = OMAP_FIREWALL_L4 | OCPIF_SWSUP_IDLE,
866};
867
868/* l4_wkup -> 32ksync_counter */
869static struct omap_hwmod_addr_space omap2430_counter_32k_addrs[] = {
870 {
871 .pa_start = 0x49020000,
872 .pa_end = 0x4902001f,
873 .flags = ADDR_TYPE_RT
874 },
875 { }
876};
877
878static struct omap_hwmod_ocp_if omap2430_l4_wkup__counter_32k = {
879 .master = &omap2xxx_l4_wkup_hwmod,
880 .slave = &omap2xxx_counter_32k_hwmod,
881 .clk = "sync_32k_ick",
882 .addr = omap2430_counter_32k_addrs,
883 .user = OCP_USER_MPU | OCP_USER_SDMA,
884};
885
841static struct omap_hwmod_ocp_if *omap2430_hwmod_ocp_ifs[] __initdata = { 886static struct omap_hwmod_ocp_if *omap2430_hwmod_ocp_ifs[] __initdata = {
842 &omap2xxx_l3_main__l4_core, 887 &omap2xxx_l3_main__l4_core,
843 &omap2xxx_mpu__l3_main, 888 &omap2xxx_mpu__l3_main,
@@ -886,6 +931,8 @@ static struct omap_hwmod_ocp_if *omap2430_hwmod_ocp_ifs[] __initdata = {
886 &omap2430_l4_core__mcbsp3, 931 &omap2430_l4_core__mcbsp3,
887 &omap2430_l4_core__mcbsp4, 932 &omap2430_l4_core__mcbsp4,
888 &omap2430_l4_core__mcbsp5, 933 &omap2430_l4_core__mcbsp5,
934 &omap2430_l4_core__hdq1w,
935 &omap2430_l4_wkup__counter_32k,
889 NULL, 936 NULL,
890}; 937};
891 938
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c
index 04637fabadd2..cbb4ef6544ad 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c
@@ -171,3 +171,12 @@ struct omap_hwmod_addr_space omap2_mcbsp1_addrs[] = {
171 }, 171 },
172 { } 172 { }
173}; 173};
174
175struct omap_hwmod_addr_space omap2_hdq1w_addr_space[] = {
176 {
177 .pa_start = 0x480b2000,
178 .pa_end = 0x480b2fff,
179 .flags = ADDR_TYPE_RT,
180 },
181 { }
182};
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
index f08e442af397..102d76e9e9ea 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
@@ -2,6 +2,7 @@
2 * omap_hwmod_2xxx_3xxx_ipblock_data.c - common IP block data for OMAP2/3 2 * omap_hwmod_2xxx_3xxx_ipblock_data.c - common IP block data for OMAP2/3
3 * 3 *
4 * Copyright (C) 2011 Nokia Corporation 4 * Copyright (C) 2011 Nokia Corporation
5 * Copyright (C) 2012 Texas Instruments, Inc.
5 * Paul Walmsley 6 * Paul Walmsley
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
@@ -12,6 +13,7 @@
12#include <plat/serial.h> 13#include <plat/serial.h>
13#include <plat/dma.h> 14#include <plat/dma.h>
14#include <plat/common.h> 15#include <plat/common.h>
16#include <plat/hdq1w.h>
15 17
16#include <mach/irqs.h> 18#include <mach/irqs.h>
17 19
@@ -302,3 +304,23 @@ struct omap_hwmod_irq_info omap2_mcspi2_mpu_irqs[] = {
302 { .irq = -1 } 304 { .irq = -1 }
303}; 305};
304 306
307struct omap_hwmod_class_sysconfig omap2_hdq1w_sysc = {
308 .rev_offs = 0x0,
309 .sysc_offs = 0x14,
310 .syss_offs = 0x18,
311 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE |
312 SYSS_HAS_RESET_STATUS),
313 .sysc_fields = &omap_hwmod_sysc_type1,
314};
315
316struct omap_hwmod_class omap2_hdq1w_class = {
317 .name = "hdq1w",
318 .sysc = &omap2_hdq1w_sysc,
319 .reset = &omap_hdq1w_reset,
320};
321
322struct omap_hwmod_irq_info omap2_hdq1w_mpu_irqs[] = {
323 { .irq = 58, },
324 { .irq = -1 }
325};
326
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
index 45aaa07e3025..83eafd96ecaa 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
@@ -89,7 +89,8 @@ static struct omap_hwmod_class_sysconfig omap2xxx_wd_timer_sysc = {
89struct omap_hwmod_class omap2xxx_wd_timer_hwmod_class = { 89struct omap_hwmod_class omap2xxx_wd_timer_hwmod_class = {
90 .name = "wd_timer", 90 .name = "wd_timer",
91 .sysc = &omap2xxx_wd_timer_sysc, 91 .sysc = &omap2xxx_wd_timer_sysc,
92 .pre_shutdown = &omap2_wd_timer_disable 92 .pre_shutdown = &omap2_wd_timer_disable,
93 .reset = &omap2_wd_timer_reset,
93}; 94};
94 95
95/* 96/*
@@ -732,3 +733,23 @@ struct omap_hwmod omap2xxx_mcspi2_hwmod = {
732 .class = &omap2xxx_mcspi_class, 733 .class = &omap2xxx_mcspi_class,
733 .dev_attr = &omap_mcspi2_dev_attr, 734 .dev_attr = &omap_mcspi2_dev_attr,
734}; 735};
736
737
738static struct omap_hwmod_class omap2xxx_counter_hwmod_class = {
739 .name = "counter",
740};
741
742struct omap_hwmod omap2xxx_counter_32k_hwmod = {
743 .name = "counter_32k",
744 .main_clk = "func_32k_ck",
745 .prcm = {
746 .omap2 = {
747 .module_offs = WKUP_MOD,
748 .prcm_reg_id = 1,
749 .module_bit = OMAP24XX_ST_32KSYNC_SHIFT,
750 .idlest_reg_id = 1,
751 .idlest_idle_bit = OMAP24XX_ST_32KSYNC_SHIFT,
752 },
753 },
754 .class = &omap2xxx_counter_hwmod_class,
755};
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 0c65079c2b69..fd48797fa95a 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -418,7 +418,8 @@ static struct omap_hwmod_class_sysconfig i2c_sysc = {
418static struct omap_hwmod_class omap3xxx_wd_timer_hwmod_class = { 418static struct omap_hwmod_class omap3xxx_wd_timer_hwmod_class = {
419 .name = "wd_timer", 419 .name = "wd_timer",
420 .sysc = &omap3xxx_wd_timer_sysc, 420 .sysc = &omap3xxx_wd_timer_sysc,
421 .pre_shutdown = &omap2_wd_timer_disable 421 .pre_shutdown = &omap2_wd_timer_disable,
422 .reset = &omap2_wd_timer_reset,
422}; 423};
423 424
424static struct omap_hwmod omap3xxx_wd_timer2_hwmod = { 425static struct omap_hwmod omap3xxx_wd_timer2_hwmod = {
@@ -1075,7 +1076,7 @@ static struct omap_hwmod_class omap3xxx_mcbsp_hwmod_class = {
1075 1076
1076/* mcbsp1 */ 1077/* mcbsp1 */
1077static struct omap_hwmod_irq_info omap3xxx_mcbsp1_irqs[] = { 1078static struct omap_hwmod_irq_info omap3xxx_mcbsp1_irqs[] = {
1078 { .name = "irq", .irq = 16 }, 1079 { .name = "common", .irq = 16 },
1079 { .name = "tx", .irq = 59 }, 1080 { .name = "tx", .irq = 59 },
1080 { .name = "rx", .irq = 60 }, 1081 { .name = "rx", .irq = 60 },
1081 { .irq = -1 } 1082 { .irq = -1 }
@@ -1100,7 +1101,7 @@ static struct omap_hwmod omap3xxx_mcbsp1_hwmod = {
1100 1101
1101/* mcbsp2 */ 1102/* mcbsp2 */
1102static struct omap_hwmod_irq_info omap3xxx_mcbsp2_irqs[] = { 1103static struct omap_hwmod_irq_info omap3xxx_mcbsp2_irqs[] = {
1103 { .name = "irq", .irq = 17 }, 1104 { .name = "common", .irq = 17 },
1104 { .name = "tx", .irq = 62 }, 1105 { .name = "tx", .irq = 62 },
1105 { .name = "rx", .irq = 63 }, 1106 { .name = "rx", .irq = 63 },
1106 { .irq = -1 } 1107 { .irq = -1 }
@@ -1130,7 +1131,7 @@ static struct omap_hwmod omap3xxx_mcbsp2_hwmod = {
1130 1131
1131/* mcbsp3 */ 1132/* mcbsp3 */
1132static struct omap_hwmod_irq_info omap3xxx_mcbsp3_irqs[] = { 1133static struct omap_hwmod_irq_info omap3xxx_mcbsp3_irqs[] = {
1133 { .name = "irq", .irq = 22 }, 1134 { .name = "common", .irq = 22 },
1134 { .name = "tx", .irq = 89 }, 1135 { .name = "tx", .irq = 89 },
1135 { .name = "rx", .irq = 90 }, 1136 { .name = "rx", .irq = 90 },
1136 { .irq = -1 } 1137 { .irq = -1 }
@@ -1160,7 +1161,7 @@ static struct omap_hwmod omap3xxx_mcbsp3_hwmod = {
1160 1161
1161/* mcbsp4 */ 1162/* mcbsp4 */
1162static struct omap_hwmod_irq_info omap3xxx_mcbsp4_irqs[] = { 1163static struct omap_hwmod_irq_info omap3xxx_mcbsp4_irqs[] = {
1163 { .name = "irq", .irq = 23 }, 1164 { .name = "common", .irq = 23 },
1164 { .name = "tx", .irq = 54 }, 1165 { .name = "tx", .irq = 54 },
1165 { .name = "rx", .irq = 55 }, 1166 { .name = "rx", .irq = 55 },
1166 { .irq = -1 } 1167 { .irq = -1 }
@@ -1191,7 +1192,7 @@ static struct omap_hwmod omap3xxx_mcbsp4_hwmod = {
1191 1192
1192/* mcbsp5 */ 1193/* mcbsp5 */
1193static struct omap_hwmod_irq_info omap3xxx_mcbsp5_irqs[] = { 1194static struct omap_hwmod_irq_info omap3xxx_mcbsp5_irqs[] = {
1194 { .name = "irq", .irq = 27 }, 1195 { .name = "common", .irq = 27 },
1195 { .name = "tx", .irq = 81 }, 1196 { .name = "tx", .irq = 81 },
1196 { .name = "rx", .irq = 82 }, 1197 { .name = "rx", .irq = 82 },
1197 { .irq = -1 } 1198 { .irq = -1 }
@@ -1980,6 +1981,56 @@ static struct omap_hwmod omap3xxx_usb_tll_hs_hwmod = {
1980 }, 1981 },
1981}; 1982};
1982 1983
1984static struct omap_hwmod omap3xxx_hdq1w_hwmod = {
1985 .name = "hdq1w",
1986 .mpu_irqs = omap2_hdq1w_mpu_irqs,
1987 .main_clk = "hdq_fck",
1988 .prcm = {
1989 .omap2 = {
1990 .module_offs = CORE_MOD,
1991 .prcm_reg_id = 1,
1992 .module_bit = OMAP3430_EN_HDQ_SHIFT,
1993 .idlest_reg_id = 1,
1994 .idlest_idle_bit = OMAP3430_ST_HDQ_SHIFT,
1995 },
1996 },
1997 .class = &omap2_hdq1w_class,
1998};
1999
2000/*
2001 * '32K sync counter' class
2002 * 32-bit ordinary counter, clocked by the falling edge of the 32 khz clock
2003 */
2004static struct omap_hwmod_class_sysconfig omap3xxx_counter_sysc = {
2005 .rev_offs = 0x0000,
2006 .sysc_offs = 0x0004,
2007 .sysc_flags = SYSC_HAS_SIDLEMODE,
2008 .idlemodes = (SIDLE_FORCE | SIDLE_NO),
2009 .sysc_fields = &omap_hwmod_sysc_type1,
2010};
2011
2012static struct omap_hwmod_class omap3xxx_counter_hwmod_class = {
2013 .name = "counter",
2014 .sysc = &omap3xxx_counter_sysc,
2015};
2016
2017static struct omap_hwmod omap3xxx_counter_32k_hwmod = {
2018 .name = "counter_32k",
2019 .class = &omap3xxx_counter_hwmod_class,
2020 .clkdm_name = "wkup_clkdm",
2021 .flags = HWMOD_SWSUP_SIDLE,
2022 .main_clk = "wkup_32k_fck",
2023 .prcm = {
2024 .omap2 = {
2025 .module_offs = WKUP_MOD,
2026 .prcm_reg_id = 1,
2027 .module_bit = OMAP3430_ST_32KSYNC_SHIFT,
2028 .idlest_reg_id = 1,
2029 .idlest_idle_bit = OMAP3430_ST_32KSYNC_SHIFT,
2030 },
2031 },
2032};
2033
1983/* 2034/*
1984 * interfaces 2035 * interfaces
1985 */ 2036 */
@@ -3059,6 +3110,34 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__usb_tll_hs = {
3059 .user = OCP_USER_MPU | OCP_USER_SDMA, 3110 .user = OCP_USER_MPU | OCP_USER_SDMA,
3060}; 3111};
3061 3112
3113/* l4_core -> hdq1w interface */
3114static struct omap_hwmod_ocp_if omap3xxx_l4_core__hdq1w = {
3115 .master = &omap3xxx_l4_core_hwmod,
3116 .slave = &omap3xxx_hdq1w_hwmod,
3117 .clk = "hdq_ick",
3118 .addr = omap2_hdq1w_addr_space,
3119 .user = OCP_USER_MPU | OCP_USER_SDMA,
3120 .flags = OMAP_FIREWALL_L4 | OCPIF_SWSUP_IDLE,
3121};
3122
3123/* l4_wkup -> 32ksync_counter */
3124static struct omap_hwmod_addr_space omap3xxx_counter_32k_addrs[] = {
3125 {
3126 .pa_start = 0x48320000,
3127 .pa_end = 0x4832001f,
3128 .flags = ADDR_TYPE_RT
3129 },
3130 { }
3131};
3132
3133static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__counter_32k = {
3134 .master = &omap3xxx_l4_wkup_hwmod,
3135 .slave = &omap3xxx_counter_32k_hwmod,
3136 .clk = "omap_32ksync_ick",
3137 .addr = omap3xxx_counter_32k_addrs,
3138 .user = OCP_USER_MPU | OCP_USER_SDMA,
3139};
3140
3062static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = { 3141static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = {
3063 &omap3xxx_l3_main__l4_core, 3142 &omap3xxx_l3_main__l4_core,
3064 &omap3xxx_l3_main__l4_per, 3143 &omap3xxx_l3_main__l4_per,
@@ -3103,6 +3182,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = {
3103 &omap34xx_l4_core__mcspi2, 3182 &omap34xx_l4_core__mcspi2,
3104 &omap34xx_l4_core__mcspi3, 3183 &omap34xx_l4_core__mcspi3,
3105 &omap34xx_l4_core__mcspi4, 3184 &omap34xx_l4_core__mcspi4,
3185 &omap3xxx_l4_wkup__counter_32k,
3106 NULL, 3186 NULL,
3107}; 3187};
3108 3188
@@ -3151,6 +3231,7 @@ static struct omap_hwmod_ocp_if *omap34xx_hwmod_ocp_ifs[] __initdata = {
3151 &omap34xx_l4_core__sr1, 3231 &omap34xx_l4_core__sr1,
3152 &omap34xx_l4_core__sr2, 3232 &omap34xx_l4_core__sr2,
3153 &omap3xxx_l4_core__mailbox, 3233 &omap3xxx_l4_core__mailbox,
3234 &omap3xxx_l4_core__hdq1w,
3154 NULL 3235 NULL
3155}; 3236};
3156 3237
@@ -3170,6 +3251,7 @@ static struct omap_hwmod_ocp_if *omap36xx_hwmod_ocp_ifs[] __initdata = {
3170 &omap3xxx_l4_core__usb_tll_hs, 3251 &omap3xxx_l4_core__usb_tll_hs,
3171 &omap3xxx_l4_core__es3plus_mmc1, 3252 &omap3xxx_l4_core__es3plus_mmc1,
3172 &omap3xxx_l4_core__es3plus_mmc2, 3253 &omap3xxx_l4_core__es3plus_mmc2,
3254 &omap3xxx_l4_core__hdq1w,
3173 NULL 3255 NULL
3174}; 3256};
3175 3257
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 49061295475c..950454a3fa31 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -1487,7 +1487,8 @@ static struct omap_hwmod_class omap44xx_i2c_hwmod_class = {
1487}; 1487};
1488 1488
1489static struct omap_i2c_dev_attr i2c_dev_attr = { 1489static struct omap_i2c_dev_attr i2c_dev_attr = {
1490 .flags = OMAP_I2C_FLAG_BUS_SHIFT_NONE, 1490 .flags = OMAP_I2C_FLAG_BUS_SHIFT_NONE |
1491 OMAP_I2C_FLAG_RESET_REGS_POSTIDLE,
1491}; 1492};
1492 1493
1493/* i2c1 */ 1494/* i2c1 */
@@ -1911,7 +1912,7 @@ static struct omap_hwmod_class omap44xx_mcbsp_hwmod_class = {
1911 1912
1912/* mcbsp1 */ 1913/* mcbsp1 */
1913static struct omap_hwmod_irq_info omap44xx_mcbsp1_irqs[] = { 1914static struct omap_hwmod_irq_info omap44xx_mcbsp1_irqs[] = {
1914 { .irq = 17 + OMAP44XX_IRQ_GIC_START }, 1915 { .name = "common", .irq = 17 + OMAP44XX_IRQ_GIC_START },
1915 { .irq = -1 } 1916 { .irq = -1 }
1916}; 1917};
1917 1918
@@ -1946,7 +1947,7 @@ static struct omap_hwmod omap44xx_mcbsp1_hwmod = {
1946 1947
1947/* mcbsp2 */ 1948/* mcbsp2 */
1948static struct omap_hwmod_irq_info omap44xx_mcbsp2_irqs[] = { 1949static struct omap_hwmod_irq_info omap44xx_mcbsp2_irqs[] = {
1949 { .irq = 22 + OMAP44XX_IRQ_GIC_START }, 1950 { .name = "common", .irq = 22 + OMAP44XX_IRQ_GIC_START },
1950 { .irq = -1 } 1951 { .irq = -1 }
1951}; 1952};
1952 1953
@@ -1981,7 +1982,7 @@ static struct omap_hwmod omap44xx_mcbsp2_hwmod = {
1981 1982
1982/* mcbsp3 */ 1983/* mcbsp3 */
1983static struct omap_hwmod_irq_info omap44xx_mcbsp3_irqs[] = { 1984static struct omap_hwmod_irq_info omap44xx_mcbsp3_irqs[] = {
1984 { .irq = 23 + OMAP44XX_IRQ_GIC_START }, 1985 { .name = "common", .irq = 23 + OMAP44XX_IRQ_GIC_START },
1985 { .irq = -1 } 1986 { .irq = -1 }
1986}; 1987};
1987 1988
@@ -2016,7 +2017,7 @@ static struct omap_hwmod omap44xx_mcbsp3_hwmod = {
2016 2017
2017/* mcbsp4 */ 2018/* mcbsp4 */
2018static struct omap_hwmod_irq_info omap44xx_mcbsp4_irqs[] = { 2019static struct omap_hwmod_irq_info omap44xx_mcbsp4_irqs[] = {
2019 { .irq = 16 + OMAP44XX_IRQ_GIC_START }, 2020 { .name = "common", .irq = 16 + OMAP44XX_IRQ_GIC_START },
2020 { .irq = -1 } 2021 { .irq = -1 }
2021}; 2022};
2022 2023
@@ -3534,6 +3535,7 @@ static struct omap_hwmod_class omap44xx_wd_timer_hwmod_class = {
3534 .name = "wd_timer", 3535 .name = "wd_timer",
3535 .sysc = &omap44xx_wd_timer_sysc, 3536 .sysc = &omap44xx_wd_timer_sysc,
3536 .pre_shutdown = &omap2_wd_timer_disable, 3537 .pre_shutdown = &omap2_wd_timer_disable,
3538 .reset = &omap2_wd_timer_reset,
3537}; 3539};
3538 3540
3539/* wd_timer2 */ 3541/* wd_timer2 */
diff --git a/arch/arm/mach-omap2/omap_hwmod_common_data.h b/arch/arm/mach-omap2/omap_hwmod_common_data.h
index 7aa9156d50ab..e7e8eeae95e5 100644
--- a/arch/arm/mach-omap2/omap_hwmod_common_data.h
+++ b/arch/arm/mach-omap2/omap_hwmod_common_data.h
@@ -38,6 +38,7 @@ extern struct omap_hwmod_addr_space omap2430_mcspi3_addr_space[];
38extern struct omap_hwmod_addr_space omap2_dma_system_addrs[]; 38extern struct omap_hwmod_addr_space omap2_dma_system_addrs[];
39extern struct omap_hwmod_addr_space omap2_mailbox_addrs[]; 39extern struct omap_hwmod_addr_space omap2_mailbox_addrs[];
40extern struct omap_hwmod_addr_space omap2_mcbsp1_addrs[]; 40extern struct omap_hwmod_addr_space omap2_mcbsp1_addrs[];
41extern struct omap_hwmod_addr_space omap2_hdq1w_addr_space[];
41 42
42/* Common IP block data across OMAP2xxx */ 43/* Common IP block data across OMAP2xxx */
43extern struct omap_hwmod_irq_info omap2xxx_timer12_mpu_irqs[]; 44extern struct omap_hwmod_irq_info omap2xxx_timer12_mpu_irqs[];
@@ -74,6 +75,7 @@ extern struct omap_hwmod omap2xxx_gpio3_hwmod;
74extern struct omap_hwmod omap2xxx_gpio4_hwmod; 75extern struct omap_hwmod omap2xxx_gpio4_hwmod;
75extern struct omap_hwmod omap2xxx_mcspi1_hwmod; 76extern struct omap_hwmod omap2xxx_mcspi1_hwmod;
76extern struct omap_hwmod omap2xxx_mcspi2_hwmod; 77extern struct omap_hwmod omap2xxx_mcspi2_hwmod;
78extern struct omap_hwmod omap2xxx_counter_32k_hwmod;
77 79
78/* Common interface data across OMAP2xxx */ 80/* Common interface data across OMAP2xxx */
79extern struct omap_hwmod_ocp_if omap2xxx_l3_main__l4_core; 81extern struct omap_hwmod_ocp_if omap2xxx_l3_main__l4_core;
@@ -141,6 +143,7 @@ extern struct omap_hwmod_irq_info omap2_dma_system_irqs[];
141extern struct omap_hwmod_irq_info omap2_mcspi1_mpu_irqs[]; 143extern struct omap_hwmod_irq_info omap2_mcspi1_mpu_irqs[];
142extern struct omap_hwmod_irq_info omap2_mcspi2_mpu_irqs[]; 144extern struct omap_hwmod_irq_info omap2_mcspi2_mpu_irqs[];
143extern struct omap_hwmod_addr_space omap2xxx_timer12_addrs[]; 145extern struct omap_hwmod_addr_space omap2xxx_timer12_addrs[];
146extern struct omap_hwmod_irq_info omap2_hdq1w_mpu_irqs[];
144 147
145/* OMAP hwmod classes - forward declarations */ 148/* OMAP hwmod classes - forward declarations */
146extern struct omap_hwmod_class l3_hwmod_class; 149extern struct omap_hwmod_class l3_hwmod_class;
@@ -152,6 +155,8 @@ extern struct omap_hwmod_class omap2_dss_hwmod_class;
152extern struct omap_hwmod_class omap2_dispc_hwmod_class; 155extern struct omap_hwmod_class omap2_dispc_hwmod_class;
153extern struct omap_hwmod_class omap2_rfbi_hwmod_class; 156extern struct omap_hwmod_class omap2_rfbi_hwmod_class;
154extern struct omap_hwmod_class omap2_venc_hwmod_class; 157extern struct omap_hwmod_class omap2_venc_hwmod_class;
158extern struct omap_hwmod_class_sysconfig omap2_hdq1w_sysc;
159extern struct omap_hwmod_class omap2_hdq1w_class;
155 160
156extern struct omap_hwmod_class omap2xxx_timer_hwmod_class; 161extern struct omap_hwmod_class omap2xxx_timer_hwmod_class;
157extern struct omap_hwmod_class omap2xxx_wd_timer_hwmod_class; 162extern struct omap_hwmod_class omap2xxx_wd_timer_hwmod_class;
diff --git a/arch/arm/mach-omap2/wd_timer.c b/arch/arm/mach-omap2/wd_timer.c
index 4067669d96c4..b2f1c67043a2 100644
--- a/arch/arm/mach-omap2/wd_timer.c
+++ b/arch/arm/mach-omap2/wd_timer.c
@@ -14,6 +14,7 @@
14#include <plat/omap_hwmod.h> 14#include <plat/omap_hwmod.h>
15 15
16#include "wd_timer.h" 16#include "wd_timer.h"
17#include "common.h"
17 18
18/* 19/*
19 * In order to avoid any assumptions from bootloader regarding WDT 20 * In order to avoid any assumptions from bootloader regarding WDT
@@ -25,6 +26,8 @@
25#define OMAP_WDT_WPS 0x34 26#define OMAP_WDT_WPS 0x34
26#define OMAP_WDT_SPR 0x48 27#define OMAP_WDT_SPR 0x48
27 28
29/* Maximum microseconds to wait for OMAP module to softreset */
30#define MAX_MODULE_SOFTRESET_WAIT 10000
28 31
29int omap2_wd_timer_disable(struct omap_hwmod *oh) 32int omap2_wd_timer_disable(struct omap_hwmod *oh)
30{ 33{
@@ -54,3 +57,45 @@ int omap2_wd_timer_disable(struct omap_hwmod *oh)
54 return 0; 57 return 0;
55} 58}
56 59
60/**
61 * omap2_wdtimer_reset - reset and disable the WDTIMER IP block
62 * @oh: struct omap_hwmod *
63 *
64 * After the WDTIMER IP blocks are reset on OMAP2/3, we must also take
65 * care to execute the special watchdog disable sequence. This is
66 * because the watchdog is re-armed upon OCP softreset. (On OMAP4,
67 * this behavior was apparently changed and the watchdog is no longer
68 * re-armed after an OCP soft-reset.) Returns -ETIMEDOUT if the reset
69 * did not complete, or 0 upon success.
70 *
71 * XXX Most of this code should be moved to the omap_hwmod.c layer
72 * during a normal merge window. omap_hwmod_softreset() should be
73 * renamed to omap_hwmod_set_ocp_softreset(), and omap_hwmod_softreset()
74 * should call the hwmod _ocp_softreset() code.
75 */
76int omap2_wd_timer_reset(struct omap_hwmod *oh)
77{
78 int c = 0;
79
80 /* Write to the SOFTRESET bit */
81 omap_hwmod_softreset(oh);
82
83 /* Poll on RESETDONE bit */
84 omap_test_timeout((omap_hwmod_read(oh,
85 oh->class->sysc->syss_offs)
86 & SYSS_RESETDONE_MASK),
87 MAX_MODULE_SOFTRESET_WAIT, c);
88
89 if (oh->class->sysc->srst_udelay)
90 udelay(oh->class->sysc->srst_udelay);
91
92 if (c == MAX_MODULE_SOFTRESET_WAIT)
93 pr_warning("%s: %s: softreset failed (waited %d usec)\n",
94 __func__, oh->name, MAX_MODULE_SOFTRESET_WAIT);
95 else
96 pr_debug("%s: %s: softreset in %d usec\n", __func__,
97 oh->name, c);
98
99 return (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT :
100 omap2_wd_timer_disable(oh);
101}
diff --git a/arch/arm/mach-omap2/wd_timer.h b/arch/arm/mach-omap2/wd_timer.h
index e0054a2d5505..f6bbba73b535 100644
--- a/arch/arm/mach-omap2/wd_timer.h
+++ b/arch/arm/mach-omap2/wd_timer.h
@@ -13,5 +13,6 @@
13#include <plat/omap_hwmod.h> 13#include <plat/omap_hwmod.h>
14 14
15extern int omap2_wd_timer_disable(struct omap_hwmod *oh); 15extern int omap2_wd_timer_disable(struct omap_hwmod *oh);
16extern int omap2_wd_timer_reset(struct omap_hwmod *oh);
16 17
17#endif 18#endif