From 7ee11a3df703bae7db9e85796aa266f82f2e5c51 Mon Sep 17 00:00:00 2001 From: Girish S Ghongdemath Date: Sat, 3 Dec 2011 22:30:26 -0600 Subject: OMAP4: PM: omap4_trigger_ioctrl: use proper mask for proper delay PRM_IO_PMCTRL register has more fields beyond WUCLK_STATUS. Shifting the bits does not guarantee that the resultant value represents the WUCLK_STATUS (a single bit). Instead, mask the same to be sure about picking up just the register field we need. Without this, we may not manage to get the test to pass and it times out after 1+ms in every attempt. This wrongly forces the prcm_interrupt_handler to be delayed by 1ms when IOPAD wakeup is triggered. This causes the IO daisy chain blind window to be abnormally long, instead of a few us. Measurements show that time between rising and falling edge of WUCLIN is: * without fix: 1600us * with fix: 1.2us Also the latch is really complete when the WUCLKIN pulse goes low, so we need to wait until WUCLK_STATUS goes low. Change-Id: Ib0a052968796181b4b252afc13bca8f12cdd940b [d-elaidi@ti.com: parallel fix] Signed-off-by: Djamil Elaidi Signed-off-by: Girish S Ghongdemath --- arch/arm/mach-omap2/pm44xx.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c index 75b6223ad9e..1ddc41e1b15 100644 --- a/arch/arm/mach-omap2/pm44xx.c +++ b/arch/arm/mach-omap2/pm44xx.c @@ -115,13 +115,30 @@ void omap4_trigger_ioctrl(void) /* Trigger WUCLKIN enable */ omap4_prminst_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, OMAP4430_WUCLK_CTRL_MASK, OMAP4430_PRM_PARTITION, OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET); - omap_test_timeout( - ((omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET) - >> OMAP4430_WUCLK_STATUS_SHIFT) == 1), - MAX_IOPAD_LATCH_TIME, i); + omap_test_timeout((((omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, + OMAP4430_PRM_DEVICE_INST, + OMAP4_PRM_IO_PMCTRL_OFFSET) & + OMAP4430_WUCLK_STATUS_MASK) >> + OMAP4430_WUCLK_STATUS_SHIFT) == 1), + MAX_IOPAD_LATCH_TIME, i); + if (i == MAX_IOPAD_LATCH_TIME) + pr_err("%s: Max IO latch time reached for WUCLKIN enable\n", + __func__); + /* Trigger WUCLKIN disable */ omap4_prminst_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, 0x0, OMAP4430_PRM_PARTITION, OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET); + + /* Ensure this is cleared */ + omap_test_timeout((((omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, + OMAP4430_PRM_DEVICE_INST, + OMAP4_PRM_IO_PMCTRL_OFFSET) & + OMAP4430_WUCLK_STATUS_MASK) >> + OMAP4430_WUCLK_STATUS_SHIFT) == 0), + MAX_IOPAD_LATCH_TIME, i); + if (i == MAX_IOPAD_LATCH_TIME) + pr_err("%s: Max IO latch time reached for WUCLKIN disable\n", + __func__); return; } -- cgit v1.2.3