[PATCH 1/2] watchdog:OMAP3:Register IVA and SECURE WDT, make clks ac

2009-07-09 Thread Ulrik Bech Hald
Enabling registration of IVA and SECURE WDT devices. Making
ick and fck for IVA and SECURE WDTs accessible.

Tested on Zoom1 OMAP3 platform

Signed-off-by: Ulrik Bech Hald 
Reviewed-by: Kevin Hilman 
---
 arch/arm/mach-omap1/clock.c |6 +-
 arch/arm/mach-omap2/clock24xx.c |4 +-
 arch/arm/mach-omap2/clock34xx.c |   12 +++---
 arch/arm/plat-omap/devices.c|   91 ---
 4 files changed, 86 insertions(+), 27 deletions(-)

diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index 436eed2..c0b5849 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -85,9 +85,9 @@ static struct omap_clk omap_clks[] = {
CLK(NULL,   "arm_gpio_ck",  &arm_gpio_ck,   CK_1510 | CK_310),
CLK(NULL,   "armxor_ck",&armxor_ck.clk, CK_16XX | CK_1510 | 
CK_310),
CLK(NULL,   "armtim_ck",&armtim_ck.clk, CK_16XX | CK_1510 | 
CK_310),
-   CLK("omap_wdt", "fck",  &armwdt_ck.clk, CK_16XX | CK_1510 | 
CK_310),
-   CLK("omap_wdt", "ick",  &armper_ck.clk, CK_16XX),
-   CLK("omap_wdt", "ick",  &dummy_ck,  CK_1510 | CK_310),
+   CLK("omap_wdt.2", "fck",&armwdt_ck.clk, CK_16XX | CK_1510 | 
CK_310),
+   CLK("omap_wdt.2", "ick",&armper_ck.clk, CK_16XX),
+   CLK("omap_wdt.2", "ick",&dummy_ck,  CK_1510 | CK_310),
CLK(NULL,   "arminth_ck",   &arminth_ck1510, CK_1510 | CK_310),
CLK(NULL,   "arminth_ck",   &arminth_ck16xx, CK_16XX),
/* CK_GEN2 clocks */
diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c
index 44de027..4fe3def 100644
--- a/arch/arm/mach-omap2/clock24xx.c
+++ b/arch/arm/mach-omap2/clock24xx.c
@@ -165,8 +165,8 @@ static struct omap_clk omap24xx_clks[] = {
CLK(NULL,   "uart3_fck",&uart3_fck, CK_243X | CK_242X),
CLK(NULL,   "gpios_ick",&gpios_ick, CK_243X | CK_242X),
CLK(NULL,   "gpios_fck",&gpios_fck, CK_243X | CK_242X),
-   CLK("omap_wdt", "ick",  &mpu_wdt_ick,   CK_243X | CK_242X),
-   CLK("omap_wdt", "fck",  &mpu_wdt_fck,   CK_243X | CK_242X),
+   CLK("omap_wdt.2", "ick",&mpu_wdt_ick,   CK_243X | CK_242X),
+   CLK("omap_wdt.2", "fck",&mpu_wdt_fck,   CK_243X | CK_242X),
CLK(NULL,   "sync_32k_ick", &sync_32k_ick,  CK_243X | CK_242X),
CLK(NULL,   "wdt1_ick", &wdt1_ick,  CK_243X | CK_242X),
CLK(NULL,   "omapctrl_ick", &omapctrl_ick,  CK_243X | CK_242X),
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index 045da92..aaea62c 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -215,11 +215,11 @@ static struct omap_clk omap34xx_clks[] = {
CLK(NULL,   "gpt1_fck", &gpt1_fck,  CK_343X),
CLK(NULL,   "wkup_32k_fck", &wkup_32k_fck,  CK_343X),
CLK(NULL,   "gpio1_dbck",   &gpio1_dbck,CK_343X),
-   CLK("omap_wdt", "fck",  &wdt2_fck,  CK_343X),
+   CLK("omap_wdt.1", "fck",&wdt2_fck,  CK_343X),
CLK(NULL,   "wkup_l4_ick",  &wkup_l4_ick,   CK_343X),
CLK(NULL,   "usim_ick", &usim_ick,  CK_3430ES2),
-   CLK("omap_wdt", "ick",  &wdt2_ick,  CK_343X),
-   CLK(NULL,   "wdt1_ick", &wdt1_ick,  CK_343X),
+   CLK("omap_wdt.1", "ick",&wdt2_ick,  CK_343X),
+   CLK("omap_wdt.0", "ick",&wdt1_ick,  CK_343X),
CLK(NULL,   "gpio1_ick",&gpio1_ick, CK_343X),
CLK(NULL,   "omap_32ksync_ick", &omap_32ksync_ick, CK_343X),
CLK(NULL,   "gpt12_ick",&gpt12_ick, CK_343X),
@@ -241,14 +241,14 @@ static struct omap_clk omap34xx_clks[] = {
CLK(NULL,   "gpio4_dbck",   &gpio4_dbck,CK_343X),
CLK(NULL,   "gpio3_dbck",   &gpio3_dbck,CK_343X),
CLK(NULL,   "gpio2_dbck",   &gpio2_dbck,CK_343X),
-   CLK(NULL,   "wdt3_fck", &wdt3_fck,  CK_343X),
+   CLK("omap_wdt.2", "fck",&wdt3_fck,  CK_343X),
CLK(NULL,   "per_l4_ick",   &per_l4_ick,CK_343X),
CLK(NULL,   "gpio6_ick

[PATCH 0/2] watchdog:OMAP3:Add support for IVA2, SECURE WDTs

2009-07-09 Thread Ulrik Bech Hald
This patch series enables support for IVA2 and SECURE
WDTs, available on omap34xx.
The WDTs will be accessible (when present on device) through:
MPU:/dev/watchdog
SECURE: /dev/watchdog_secure
IVA2:   /dev/watchdog_iva2

Tested on Zoom1 OMAP3 platform, compile-tested for OMAP2
Signed-off-by: Ulrik Bech Hald 
Reviewed-by: Kevin Hilman 
--- 
 arch/arm/mach-omap1/clock.c |6 +-
 arch/arm/mach-omap2/clock24xx.c |4 -
 arch/arm/mach-omap2/clock34xx.c |   12 ++---
 arch/arm/plat-omap/devices.c|   91 
 drivers/watchdog/omap_wdt.c |   34 +++---
 5 files changed, 112 insertions(+), 35 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] watchdog:OMAP3:Enable support for IVA2 and SECURE

2009-07-09 Thread Ulrik Bech Hald
This patch adds support for IVA2 and SECURE WDTs in the omap_wdt
driver for omap34xx family. SECURE will be available as
/dev/watchdog_secure on HS/EMU devices and IVA2 will be available
as /dev/watchdog_iva2. MPU will still be available as /dev/watchdog

Tested on Zoom1 OMAP3 platform

Signed-off-by: Ulrik Bech Hald 
Reviewed-by: Kevin Hilman 
---
 drivers/watchdog/omap_wdt.c |   34 ++
 1 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 3ed571a..12409fe 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -47,7 +47,9 @@
 
 #include "omap_wdt.h"
 
-static struct platform_device *omap_wdt_dev;
+#define NUM_WDTS   3
+
+static struct platform_device *omap_wdt_dev[NUM_WDTS];
 
 static unsigned timer_margin;
 module_param(timer_margin, uint, 0);
@@ -139,8 +141,23 @@ static void omap_wdt_set_timeout(struct omap_wdt_dev *wdev)
  */
 static int omap_wdt_open(struct inode *inode, struct file *file)
 {
-   struct omap_wdt_dev *wdev = platform_get_drvdata(omap_wdt_dev);
-   void __iomem *base = wdev->base;
+   struct omap_wdt_dev *wdev = NULL;
+   void __iomem *base;
+
+   /* Find match between device node and wdt device */
+   int i;
+   for (i = 0; i < NUM_WDTS; i++) {
+   if (omap_wdt_dev[i]) {
+   wdev = platform_get_drvdata(omap_wdt_dev[i]);
+   if (iminor(inode) == wdev->omap_wdt_miscdev.minor)
+   break;
+   }
+   }
+
+   if (!wdev)
+   return -ENODEV;
+
+   base = wdev->base;
 
if (test_and_set_bit(1, (unsigned long *)&(wdev->omap_wdt_users)))
return -EBUSY;
@@ -272,7 +289,7 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
goto err_get_resource;
}
 
-   if (omap_wdt_dev) {
+   if (omap_wdt_dev[pdev->id]) {
ret = -EBUSY;
goto err_busy;
}
@@ -321,9 +338,9 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
omap_wdt_adjust_timeout(timer_margin);
 
wdev->omap_wdt_miscdev.parent = &pdev->dev;
-   wdev->omap_wdt_miscdev.minor = WATCHDOG_MINOR;
-   wdev->omap_wdt_miscdev.name = "watchdog";
+   wdev->omap_wdt_miscdev.minor = MISC_DYNAMIC_MINOR;
wdev->omap_wdt_miscdev.fops = &omap_wdt_fops;
+   wdev->omap_wdt_miscdev.name = (char *) pdev->dev.platform_data;
 
ret = misc_register(&(wdev->omap_wdt_miscdev));
if (ret)
@@ -339,7 +356,8 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
clk_disable(wdev->ick);
clk_disable(wdev->fck);
 
-   omap_wdt_dev = pdev;
+   /* keep track of the wdt platform devices in local device array */
+   omap_wdt_dev[pdev->id] = pdev;
 
return 0;
 
@@ -391,7 +409,7 @@ static int __devexit omap_wdt_remove(struct platform_device 
*pdev)
iounmap(wdev->base);
 
kfree(wdev);
-   omap_wdt_dev = NULL;
+   omap_wdt_dev[pdev->id] = NULL;
 
return 0;
 }
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 1/2] watchdog:OMAP3:Register IVA and SECURE WDT, make clks ac

2009-06-26 Thread Ulrik Bech Hald
Enabling registration of IVA and SECURE WDT devices. Making
ick and fck for IVA and SECURE WDTs accessible.

Tested on Zoom1 OMAP3 platform

Signed-off-by: Ulrik Bech Hald 
---
 arch/arm/mach-omap1/clock.c |6 +-
 arch/arm/mach-omap2/clock24xx.c |4 +-
 arch/arm/mach-omap2/clock34xx.c |   12 +++---
 arch/arm/plat-omap/devices.c|   91 ---
 4 files changed, 86 insertions(+), 27 deletions(-)

diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index 436eed2..c0b5849 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -85,9 +85,9 @@ static struct omap_clk omap_clks[] = {
CLK(NULL,   "arm_gpio_ck",  &arm_gpio_ck,   CK_1510 | CK_310),
CLK(NULL,   "armxor_ck",&armxor_ck.clk, CK_16XX | CK_1510 | 
CK_310),
CLK(NULL,   "armtim_ck",&armtim_ck.clk, CK_16XX | CK_1510 | 
CK_310),
-   CLK("omap_wdt", "fck",  &armwdt_ck.clk, CK_16XX | CK_1510 | 
CK_310),
-   CLK("omap_wdt", "ick",  &armper_ck.clk, CK_16XX),
-   CLK("omap_wdt", "ick",  &dummy_ck,  CK_1510 | CK_310),
+   CLK("omap_wdt.2", "fck",&armwdt_ck.clk, CK_16XX | CK_1510 | 
CK_310),
+   CLK("omap_wdt.2", "ick",&armper_ck.clk, CK_16XX),
+   CLK("omap_wdt.2", "ick",&dummy_ck,  CK_1510 | CK_310),
CLK(NULL,   "arminth_ck",   &arminth_ck1510, CK_1510 | CK_310),
CLK(NULL,   "arminth_ck",   &arminth_ck16xx, CK_16XX),
/* CK_GEN2 clocks */
diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c
index 44de027..4fe3def 100644
--- a/arch/arm/mach-omap2/clock24xx.c
+++ b/arch/arm/mach-omap2/clock24xx.c
@@ -165,8 +165,8 @@ static struct omap_clk omap24xx_clks[] = {
CLK(NULL,   "uart3_fck",&uart3_fck, CK_243X | CK_242X),
CLK(NULL,   "gpios_ick",&gpios_ick, CK_243X | CK_242X),
CLK(NULL,   "gpios_fck",&gpios_fck, CK_243X | CK_242X),
-   CLK("omap_wdt", "ick",  &mpu_wdt_ick,   CK_243X | CK_242X),
-   CLK("omap_wdt", "fck",  &mpu_wdt_fck,   CK_243X | CK_242X),
+   CLK("omap_wdt.2", "ick",&mpu_wdt_ick,   CK_243X | CK_242X),
+   CLK("omap_wdt.2", "fck",&mpu_wdt_fck,   CK_243X | CK_242X),
CLK(NULL,   "sync_32k_ick", &sync_32k_ick,  CK_243X | CK_242X),
CLK(NULL,   "wdt1_ick", &wdt1_ick,  CK_243X | CK_242X),
CLK(NULL,   "omapctrl_ick", &omapctrl_ick,  CK_243X | CK_242X),
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index 045da92..aaea62c 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -215,11 +215,11 @@ static struct omap_clk omap34xx_clks[] = {
CLK(NULL,   "gpt1_fck", &gpt1_fck,  CK_343X),
CLK(NULL,   "wkup_32k_fck", &wkup_32k_fck,  CK_343X),
CLK(NULL,   "gpio1_dbck",   &gpio1_dbck,CK_343X),
-   CLK("omap_wdt", "fck",  &wdt2_fck,  CK_343X),
+   CLK("omap_wdt.1", "fck",&wdt2_fck,  CK_343X),
CLK(NULL,   "wkup_l4_ick",  &wkup_l4_ick,   CK_343X),
CLK(NULL,   "usim_ick", &usim_ick,  CK_3430ES2),
-   CLK("omap_wdt", "ick",  &wdt2_ick,  CK_343X),
-   CLK(NULL,   "wdt1_ick", &wdt1_ick,  CK_343X),
+   CLK("omap_wdt.1", "ick",&wdt2_ick,  CK_343X),
+   CLK("omap_wdt.0", "ick",&wdt1_ick,  CK_343X),
CLK(NULL,   "gpio1_ick",&gpio1_ick, CK_343X),
CLK(NULL,   "omap_32ksync_ick", &omap_32ksync_ick, CK_343X),
CLK(NULL,   "gpt12_ick",&gpt12_ick, CK_343X),
@@ -241,14 +241,14 @@ static struct omap_clk omap34xx_clks[] = {
CLK(NULL,   "gpio4_dbck",   &gpio4_dbck,CK_343X),
CLK(NULL,   "gpio3_dbck",   &gpio3_dbck,CK_343X),
CLK(NULL,   "gpio2_dbck",   &gpio2_dbck,CK_343X),
-   CLK(NULL,   "wdt3_fck", &wdt3_fck,  CK_343X),
+   CLK("omap_wdt.2", "fck",&wdt3_fck,  CK_343X),
CLK(NULL,   "per_l4_ick",   &per_l4_ick,CK_343X),
CLK(NULL,   "gpio6_ick",&gpio6_ick, 

[PATCH v5 2/2] watchdog:OMAP3:Enable support for IVA2 and SECURE

2009-06-26 Thread Ulrik Bech Hald
This patch adds support for IVA2 and SECURE WDTs in the omap_wdt
driver for omap34xx family. SECURE will be available as
/dev/watchdog_secure on HS/EMU devices and IVA2 will be available
as /dev/watchdog_iva2. MPU will still be available as /dev/watchdog

Tested on Zoom1 OMAP3 platform

Signed-off-by: Ulrik Bech Hald 
---
runtime dependency: [PATCH 1/1] watchdog: OMAP fixes: enable clock in probe, 
trigger timer reload 

 drivers/watchdog/omap_wdt.c |   34 ++
 1 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index f271385..9965f64 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -47,7 +47,9 @@
 
 #include "omap_wdt.h"
 
-static struct platform_device *omap_wdt_dev;
+#define NUM_WDTS   3
+
+static struct platform_device *omap_wdt_dev[NUM_WDTS];
 
 static unsigned timer_margin;
 module_param(timer_margin, uint, 0);
@@ -139,8 +141,23 @@ static void omap_wdt_set_timeout(struct omap_wdt_dev *wdev)
  */
 static int omap_wdt_open(struct inode *inode, struct file *file)
 {
-   struct omap_wdt_dev *wdev = platform_get_drvdata(omap_wdt_dev);
-   void __iomem *base = wdev->base;
+   struct omap_wdt_dev *wdev = NULL;
+   void __iomem *base;
+
+   /* Find match between device node and wdt device */
+   int i;
+   for (i = 0; i < NUM_WDTS; i++) {
+   if (omap_wdt_dev[i]) {
+   wdev = platform_get_drvdata(omap_wdt_dev[i]);
+   if (iminor(inode) == wdev->omap_wdt_miscdev.minor)
+   break;
+   }
+   }
+
+   if (!wdev)
+   return -ENODEV;
+
+   base = wdev->base;
 
if (test_and_set_bit(1, (unsigned long *)&(wdev->omap_wdt_users)))
return -EBUSY;
@@ -271,7 +288,7 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
goto err_get_resource;
}
 
-   if (omap_wdt_dev) {
+   if (omap_wdt_dev[pdev->id]) {
ret = -EBUSY;
goto err_busy;
}
@@ -317,9 +334,9 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
omap_wdt_adjust_timeout(timer_margin);
 
wdev->omap_wdt_miscdev.parent = &pdev->dev;
-   wdev->omap_wdt_miscdev.minor = WATCHDOG_MINOR;
-   wdev->omap_wdt_miscdev.name = "watchdog";
+   wdev->omap_wdt_miscdev.minor = MISC_DYNAMIC_MINOR;
wdev->omap_wdt_miscdev.fops = &omap_wdt_fops;
+   wdev->omap_wdt_miscdev.name = (char *) pdev->dev.platform_data;
 
ret = misc_register(&(wdev->omap_wdt_miscdev));
if (ret)
@@ -332,7 +349,8 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
/* autogate OCP interface clock */
__raw_writel(0x01, wdev->base + OMAP_WATCHDOG_SYS_CONFIG);
 
-   omap_wdt_dev = pdev;
+   /* keep track of the wdt platform devices in local device array */
+   omap_wdt_dev[pdev->id] = pdev;
 
return 0;
 
@@ -384,7 +402,7 @@ static int __devexit omap_wdt_remove(struct platform_device 
*pdev)
iounmap(wdev->base);
 
kfree(wdev);
-   omap_wdt_dev = NULL;
+   omap_wdt_dev[pdev->id] = NULL;
 
return 0;
 }
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 0/2] watchdog:OMAP3:Add support for IVA2, SECURE WDTs

2009-06-26 Thread Ulrik Bech Hald
This patch series enables support for IVA2 and SECURE
WDTs, available on omap34xx.
The WDTs will be accessible (when present on device) through:
MPU:/dev/watchdog
SECURE: /dev/watchdog_secure
IVA2:   /dev/watchdog_iva2

Tested on Zoom1 OMAP3 platform, compile-tested for OMAP2
Signed-off-by: Ulrik Bech Hald 
--- 
This patch set has a dependency on:
runtime: [PATCH 1/1] watchdog: OMAP fixes: enable clock in probe, trigger timer 
reload

 arch/arm/mach-omap1/clock.c |6 +-
 arch/arm/mach-omap2/clock24xx.c |4 -
 arch/arm/mach-omap2/clock34xx.c |   12 ++---
 arch/arm/plat-omap/devices.c|   91 
 drivers/watchdog/omap_wdt.c |   34 +++---
 5 files changed, 112 insertions(+), 35 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/1] i2c:OMAP3:Errata workaround for spurious RDR event

2009-06-22 Thread Ulrik Bech Hald
Under certain rare conditions, I2C_STAT[13].RDR bit may be set,
and the corresponding interrupt fire, even when there is no
data in the receive FIFO, or the I2C data transfer is still
ongoing. These spurious RDR events must be ignored by the
software.

A check for OMAP_I2C_STAT_BB is introduced in the ISR to
prevent further processing of RDR interrupt, if the bus is busy.

Signed-off-by: Ulrik Bech Hald 
Signed-off-by: Jagadeesh Bhaskar Pakaravoor 
---
 drivers/i2c/busses/i2c-omap.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index ece0125..88feea1 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -668,6 +668,15 @@ omap_i2c_isr(int this_irq, void *dev_id)
omap_i2c_complete_cmd(dev, err);
if (stat & (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR)) {
u8 num_bytes = 1;
+   /* 3430 I2C Errata 1.15
+* RDR could be set when the bus is busy, then
+* ignore the interrupt, and clear the bit.
+*/
+   u8 stat2 = 0;
+   stat2 = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
+   if (stat2 & OMAP_I2C_STAT_BB)
+   return IRQ_HANDLED;
+
if (dev->fifo_size) {
if (stat & OMAP_I2C_STAT_RRDY)
num_bytes = dev->fifo_size;
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] i2c:OMAP3:Errata workaround for spurious RDR event

2009-06-22 Thread Ulrik Bech Hald
Under certain rare conditions, I2C_STAT[13].RDR bit may be set,
and the corresponding interrupt fire, even when there is no
data in the receive FIFO, or the I2C data transfer is still
ongoing. These spurious RDR events must be ignored by the
software.

A check for OMAP_I2C_STAT_BB is introduced in the ISR to
prevent further processing of RDR interrupt, if the bus is busy.

Signed-off-by: Ulrik Bech Hald 
---
 drivers/i2c/busses/i2c-omap.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index ece0125..88feea1 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -668,6 +668,15 @@ omap_i2c_isr(int this_irq, void *dev_id)
omap_i2c_complete_cmd(dev, err);
if (stat & (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR)) {
u8 num_bytes = 1;
+   /* 3430 I2C Errata 1.15
+* RDR could be set when the bus is busy, then
+* ignore the interrupt, and clear the bit.
+*/
+   u8 stat2 = 0;
+   stat2 = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
+   if (stat2 & OMAP_I2C_STAT_BB)
+   return IRQ_HANDLED;
+
if (dev->fifo_size) {
if (stat & OMAP_I2C_STAT_RRDY)
num_bytes = dev->fifo_size;
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 0/2] watchdog:OMAP3:Add support for IVA2, SECURE WDTs

2009-06-17 Thread Ulrik Bech Hald
This patch series enables support for IVA2 and SECURE
WDTs, available on omap34xx.
The WDTs will be accessible (when present on device) through:
MPU:/dev/watchdog
SECURE: /dev/watchdog_secure
IVA2:   /dev/watchdog_iva2

Tested on Zoom1 OMAP3 platform
Signed-off-by: Ulrik Bech Hald 
--- 
This patch set has a dependency on:
runtime: [PATCH 1/1] watchdog: OMAP fixes: enable clock in probe, trigger timer 
reload

 arch/arm/mach-omap1/clock.c |6 +-
 arch/arm/mach-omap2/clock24xx.c |4 -
 arch/arm/mach-omap2/clock34xx.c |   12 ++---
 arch/arm/plat-omap/devices.c|   91 
 drivers/watchdog/omap_wdt.c |   34 +++---
 5 files changed, 112 insertions(+), 35 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 1/2] watchdog:OMAP3:Register IVA and SECURE WDT, make clks accessible

2009-06-17 Thread Ulrik Bech Hald
Enabling registration of IVA and SECURE WDT devices. Making
ick and fck for IVA and SECURE WDTs accessible.

Tested on Zoom1 OMAP3 platform

Signed-off-by: Ulrik Bech Hald 
---
 arch/arm/mach-omap1/clock.c |6 +-
 arch/arm/mach-omap2/clock24xx.c |4 +-
 arch/arm/mach-omap2/clock34xx.c |   12 +++---
 arch/arm/plat-omap/devices.c|   91 ---
 4 files changed, 86 insertions(+), 27 deletions(-)

diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index 436eed2..c0b5849 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -85,9 +85,9 @@ static struct omap_clk omap_clks[] = {
CLK(NULL,   "arm_gpio_ck",  &arm_gpio_ck,   CK_1510 | CK_310),
CLK(NULL,   "armxor_ck",&armxor_ck.clk, CK_16XX | CK_1510 | 
CK_310),
CLK(NULL,   "armtim_ck",&armtim_ck.clk, CK_16XX | CK_1510 | 
CK_310),
-   CLK("omap_wdt", "fck",  &armwdt_ck.clk, CK_16XX | CK_1510 | 
CK_310),
-   CLK("omap_wdt", "ick",  &armper_ck.clk, CK_16XX),
-   CLK("omap_wdt", "ick",  &dummy_ck,  CK_1510 | CK_310),
+   CLK("omap_wdt.2", "fck",&armwdt_ck.clk, CK_16XX | CK_1510 | 
CK_310),
+   CLK("omap_wdt.2", "ick",&armper_ck.clk, CK_16XX),
+   CLK("omap_wdt.2", "ick",&dummy_ck,  CK_1510 | CK_310),
CLK(NULL,   "arminth_ck",   &arminth_ck1510, CK_1510 | CK_310),
CLK(NULL,   "arminth_ck",   &arminth_ck16xx, CK_16XX),
/* CK_GEN2 clocks */
diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c
index 44de027..4fe3def
--- a/arch/arm/mach-omap2/clock24xx.c
+++ b/arch/arm/mach-omap2/clock24xx.c
@@ -165,8 +165,8 @@ static struct omap_clk omap24xx_clks[] = {
CLK(NULL,   "uart3_fck",&uart3_fck, CK_243X | CK_242X),
CLK(NULL,   "gpios_ick",&gpios_ick, CK_243X | CK_242X),
CLK(NULL,   "gpios_fck",&gpios_fck, CK_243X | CK_242X),
-   CLK("omap_wdt", "ick",  &mpu_wdt_ick,   CK_243X | CK_242X),
-   CLK("omap_wdt", "fck",  &mpu_wdt_fck,   CK_243X | CK_242X),
+   CLK("omap_wdt.2", "ick",&mpu_wdt_ick,   CK_243X | CK_242X),
+   CLK("omap_wdt.2", "fck",&mpu_wdt_fck,   CK_243X | CK_242X),
CLK(NULL,   "sync_32k_ick", &sync_32k_ick,  CK_243X | CK_242X),
CLK(NULL,   "wdt1_ick", &wdt1_ick,  CK_243X | CK_242X),
CLK(NULL,   "omapctrl_ick", &omapctrl_ick,  CK_243X | CK_242X),
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index 045da92..a4613e5 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -215,11 +215,11 @@ static struct omap_clk omap34xx_clks[] = {
CLK(NULL,   "gpt1_fck", &gpt1_fck,  CK_343X),
CLK(NULL,   "wkup_32k_fck", &wkup_32k_fck,  CK_343X),
CLK(NULL,   "gpio1_dbck",   &gpio1_dbck,CK_343X),
-   CLK("omap_wdt", "fck",  &wdt2_fck,  CK_343X),
+   CLK("omap_wdt.2", "fck",&wdt2_fck,  CK_343X),
CLK(NULL,   "wkup_l4_ick",  &wkup_l4_ick,   CK_343X),
CLK(NULL,   "usim_ick", &usim_ick,  CK_3430ES2),
-   CLK("omap_wdt", "ick",  &wdt2_ick,  CK_343X),
-   CLK(NULL,   "wdt1_ick", &wdt1_ick,  CK_343X),
+   CLK("omap_wdt.2", "ick",&wdt2_ick,  CK_343X),
+   CLK("omap_wdt.1", "ick",&wdt1_ick,  CK_343X),
CLK(NULL,   "gpio1_ick",&gpio1_ick, CK_343X),
CLK(NULL,   "omap_32ksync_ick", &omap_32ksync_ick, CK_343X),
CLK(NULL,   "gpt12_ick",&gpt12_ick, CK_343X),
@@ -241,14 +241,14 @@ static struct omap_clk omap34xx_clks[] = {
CLK(NULL,   "gpio4_dbck",   &gpio4_dbck,CK_343X),
CLK(NULL,   "gpio3_dbck",   &gpio3_dbck,CK_343X),
CLK(NULL,   "gpio2_dbck",   &gpio2_dbck,CK_343X),
-   CLK(NULL,   "wdt3_fck", &wdt3_fck,  CK_343X),
+   CLK("omap_wdt.3", "fck",&wdt3_fck,  CK_343X),
CLK(NULL,   "per_l4_ick",   &per_l4_ick,CK_343X),
CLK(NULL,   "gpio6_ick",&gpio6_ick, C

[PATCH v4 2/2] watchdog:OMAP3:Enable support for IVA2 and SECURE

2009-06-17 Thread Ulrik Bech Hald
This patch adds support for IVA2 and SECURE WDTs in the omap_wdt
driver for omap34xx family. SECURE will be available as
/dev/watchdog_secure on HS/EMU devices and IVA2 will be available
as /dev/watchdog_iva2. MPU will still be available as /dev/watchdog

Tested on Zoom1 OMAP3 platform

Signed-off-by: Ulrik Bech Hald 
---
runtime: [PATCH 1/1] watchdog: OMAP fixes: enable clock in probe, trigger timer 
reload 

 drivers/watchdog/omap_wdt.c |   34 ++
 1 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index f271385..ab9bd88
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -47,7 +47,9 @@
 
 #include "omap_wdt.h"
 
-static struct platform_device *omap_wdt_dev;
+#define NUM_WDTS   3
+
+static struct platform_device *omap_wdt_dev[NUM_WDTS];
 
 static unsigned timer_margin;
 module_param(timer_margin, uint, 0);
@@ -139,8 +141,23 @@ static void omap_wdt_set_timeout(struct omap_wdt_dev *wdev)
  */
 static int omap_wdt_open(struct inode *inode, struct file *file)
 {
-   struct omap_wdt_dev *wdev = platform_get_drvdata(omap_wdt_dev);
-   void __iomem *base = wdev->base;
+   struct omap_wdt_dev *wdev = NULL;
+   void __iomem *base;
+
+   /* Find match between device node and wdt device */
+   int i;
+   for (i = 0; i < NUM_WDTS; i++) {
+   if (omap_wdt_dev[i]) {
+   wdev = platform_get_drvdata(omap_wdt_dev[i]);
+   if (iminor(inode) == wdev->omap_wdt_miscdev.minor)
+   break;
+   }
+   }
+
+   if (!wdev)
+   return -ENODEV;
+
+   base = wdev->base;
 
if (test_and_set_bit(1, (unsigned long *)&(wdev->omap_wdt_users)))
return -EBUSY;
@@ -271,7 +288,7 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
goto err_get_resource;
}
 
-   if (omap_wdt_dev) {
+   if (omap_wdt_dev[pdev->id-1]) {
ret = -EBUSY;
goto err_busy;
}
@@ -317,9 +334,9 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
omap_wdt_adjust_timeout(timer_margin);
 
wdev->omap_wdt_miscdev.parent = &pdev->dev;
-   wdev->omap_wdt_miscdev.minor = WATCHDOG_MINOR;
-   wdev->omap_wdt_miscdev.name = "watchdog";
+   wdev->omap_wdt_miscdev.minor = MISC_DYNAMIC_MINOR;
wdev->omap_wdt_miscdev.fops = &omap_wdt_fops;
+   wdev->omap_wdt_miscdev.name = (char *) pdev->dev.platform_data;
 
ret = misc_register(&(wdev->omap_wdt_miscdev));
if (ret)
@@ -332,7 +349,8 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
/* autogate OCP interface clock */
__raw_writel(0x01, wdev->base + OMAP_WATCHDOG_SYS_CONFIG);
 
-   omap_wdt_dev = pdev;
+   /* keep track of the wdt platform devices in local device array */
+   omap_wdt_dev[pdev->id - 1] = pdev;
 
return 0;
 
@@ -384,7 +402,7 @@ static int __devexit omap_wdt_remove(struct platform_device 
*pdev)
iounmap(wdev->base);
 
kfree(wdev);
-   omap_wdt_dev = NULL;
+   omap_wdt_dev[pdev->id-1] = NULL;
 
return 0;
 }
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 1/2] watchdog:OMAP3:Register IVA and SECURE WDT, make clks accessible

2009-06-16 Thread Ulrik Bech Hald
Enabling registration of IVA and SECURE WDT devices. Making
ick and fck for IVA and SECURE WDTs accessible.

Tested on Zoom1 OMAP3 platform
Signed-off-by: Ulrik Bech Hald 
---
This patch has a dependency on:
compilation: PATCH 1/2] OMAP2/3: SoC IDs: add omap_type() for determining 
GP/EMU/HS

 arch/arm/mach-omap2/clock34xx.c |   12 +++---
 arch/arm/plat-omap/devices.c|   81 +++
 2 files changed, 71 insertions(+), 22 deletions(-)

diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index 9e43fe5..933ae9e 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -215,11 +215,11 @@ static struct omap_clk omap34xx_clks[] = {
CLK(NULL,   "gpt1_fck", &gpt1_fck,  CK_343X),
CLK(NULL,   "wkup_32k_fck", &wkup_32k_fck,  CK_343X),
CLK(NULL,   "gpio1_dbck",   &gpio1_dbck,CK_343X),
-   CLK("omap_wdt", "fck",  &wdt2_fck,  CK_343X),
+   CLK("omap_wdt.2", "fck",&wdt2_fck,  CK_343X),
CLK(NULL,   "wkup_l4_ick",  &wkup_l4_ick,   CK_343X),
CLK(NULL,   "usim_ick", &usim_ick,  CK_3430ES2),
-   CLK("omap_wdt", "ick",  &wdt2_ick,  CK_343X),
-   CLK(NULL,   "wdt1_ick", &wdt1_ick,  CK_343X),
+   CLK("omap_wdt.2", "ick",&wdt2_ick,  CK_343X),
+   CLK("omap_wdt.1", "ick",&wdt1_ick,  CK_343X),
CLK(NULL,   "gpio1_ick",&gpio1_ick, CK_343X),
CLK(NULL,   "omap_32ksync_ick", &omap_32ksync_ick, CK_343X),
CLK(NULL,   "gpt12_ick",&gpt12_ick, CK_343X),
@@ -241,14 +241,14 @@ static struct omap_clk omap34xx_clks[] = {
CLK(NULL,   "gpio4_dbck",   &gpio4_dbck,CK_343X),
CLK(NULL,   "gpio3_dbck",   &gpio3_dbck,CK_343X),
CLK(NULL,   "gpio2_dbck",   &gpio2_dbck,CK_343X),
-   CLK(NULL,   "wdt3_fck", &wdt3_fck,  CK_343X),
+   CLK("omap_wdt.3", "fck",&wdt3_fck,  CK_343X),
CLK(NULL,   "per_l4_ick",   &per_l4_ick,CK_343X),
CLK(NULL,   "gpio6_ick",&gpio6_ick, CK_343X),
CLK(NULL,   "gpio5_ick",&gpio5_ick, CK_343X),
CLK(NULL,   "gpio4_ick",&gpio4_ick, CK_343X),
CLK(NULL,   "gpio3_ick",&gpio3_ick, CK_343X),
CLK(NULL,   "gpio2_ick",&gpio2_ick, CK_343X),
-   CLK(NULL,   "wdt3_ick", &wdt3_ick,  CK_343X),
+   CLK("omap_wdt.3", "ick",&wdt3_ick,  CK_343X),
CLK(NULL,   "uart3_ick",&uart3_ick, CK_343X),
CLK(NULL,   "gpt9_ick", &gpt9_ick,  CK_343X),
CLK(NULL,   "gpt8_ick", &gpt8_ick,  CK_343X),
@@ -275,7 +275,7 @@ static struct omap_clk omap34xx_clks[] = {
CLK(NULL,   "sr_l4_ick",&sr_l4_ick, CK_343X),
CLK(NULL,   "secure_32k_fck", &secure_32k_fck, CK_343X),
CLK(NULL,   "gpt12_fck",&gpt12_fck, CK_343X),
-   CLK(NULL,   "wdt1_fck", &wdt1_fck,  CK_343X),
+   CLK("omap_wdt.1", "fck",&wdt1_fck,  CK_343X),
 };
 
 /* CM_AUTOIDLE_PLL*.AUTO_* bit values */
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
old mode 100644
new mode 100755
index a64b692..de5182c
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -288,42 +288,91 @@ static inline void omap_init_uwire(void) {}
 
 #ifdefined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
 
-static struct resource wdt_resources[] = {
+#defineOMAP34XX_WDT1_BASE  0x4830c000
+#defineOMAP34XX_WDT2_BASE  0x48314000
+#defineOMAP34XX_WDT3_BASE  0x4903
+#defineOMAP2430_WDT_BASE   0x49016000
+#defineOMAP2420_WDT_BASE   0x48022000
+#defineOMAP16XX_WDT_BASE   0xfffeb000
+
+static struct resource wdt1_resources[] = {
{
-   .flags  = IORESOURCE_MEM,
+   .flags = IORESOURCE_MEM,
},
 };
 
-static struct platform_device omap_wdt_device = {
-   .name  = "omap_wdt",
-   .id  = -1,
-   .num_resources  = ARRAY_SIZE(wdt_resources),
-   .resource   = wdt_resources,
+static struct resource wdt2_resources[] = {
+   {
+   .flags = IORESOURCE_MEM,
+   },
+};
+
+static stru

[PATCH v3 2/2] watchdog:OMAP3:Enable support for IVA2 and SECURE

2009-06-16 Thread Ulrik Bech Hald
This patch enables the IVA2 and SECURE WDTs in the omap_wdt
driver for omap34xx family. SECURE will be available as
/dev/watchdog_secure on HS/EMU devices and IVA2 will be available
as /dev/watchdog_iva2. MPU will still be available as /dev/watchdog

Tested on Zoom1 OMAP3 platform
Signed-off-by: Ulrik Bech Hald 
---
This patch has a dependency on:
runtime: [PATCH 1/1] watchdog: OMAP fixes: enable clock in probe, trigger timer 
reload

 drivers/watchdog/omap_wdt.c |   51 --
 1 files changed, 43 insertions(+), 8 deletions(-)

diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index f271385..85a92de 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -47,7 +47,15 @@
 
 #include "omap_wdt.h"
 
-static struct platform_device *omap_wdt_dev;
+#define NUM_WDTS   3
+
+enum {
+   SECURE_WDT = 1,
+   MPU_WDT,
+   IVA2_WDT,
+};
+
+static struct platform_device *omap_wdt_dev[NUM_WDTS];
 
 static unsigned timer_margin;
 module_param(timer_margin, uint, 0);
@@ -139,8 +147,23 @@ static void omap_wdt_set_timeout(struct omap_wdt_dev *wdev)
  */
 static int omap_wdt_open(struct inode *inode, struct file *file)
 {
-   struct omap_wdt_dev *wdev = platform_get_drvdata(omap_wdt_dev);
-   void __iomem *base = wdev->base;
+   struct omap_wdt_dev *wdev;
+   void __iomem *base;
+
+   /* by default MPU wdt is present across omap family */
+   wdev = platform_get_drvdata(omap_wdt_dev[1]);
+
+   /* Find match between device node and wdt device */
+   int i;
+   for (i = 0; i < NUM_WDTS; i++) {
+   if (omap_wdt_dev[i]) {
+   wdev = platform_get_drvdata(omap_wdt_dev[i]);
+   if (iminor(inode) == wdev->omap_wdt_miscdev.minor)
+   break;
+   }
+   }
+
+   base = wdev->base;
 
if (test_and_set_bit(1, (unsigned long *)&(wdev->omap_wdt_users)))
return -EBUSY;
@@ -271,7 +294,7 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
goto err_get_resource;
}
 
-   if (omap_wdt_dev) {
+   if (omap_wdt_dev[pdev->id-1]) {
ret = -EBUSY;
goto err_busy;
}
@@ -317,10 +340,21 @@ static int __devinit omap_wdt_probe(struct 
platform_device *pdev)
omap_wdt_adjust_timeout(timer_margin);
 
wdev->omap_wdt_miscdev.parent = &pdev->dev;
-   wdev->omap_wdt_miscdev.minor = WATCHDOG_MINOR;
-   wdev->omap_wdt_miscdev.name = "watchdog";
+   wdev->omap_wdt_miscdev.minor = MISC_DYNAMIC_MINOR;
wdev->omap_wdt_miscdev.fops = &omap_wdt_fops;
 
+   switch (pdev->id) {
+   case SECURE_WDT:
+   wdev->omap_wdt_miscdev.name = "watchdog_secure";
+   break;
+   case IVA2_WDT:
+   wdev->omap_wdt_miscdev.name = "watchdog_iva2";
+   break;
+   case MPU_WDT:
+   default:
+   wdev->omap_wdt_miscdev.name = "watchdog";
+   }
+
ret = misc_register(&(wdev->omap_wdt_miscdev));
if (ret)
goto err_misc;
@@ -332,7 +366,8 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
/* autogate OCP interface clock */
__raw_writel(0x01, wdev->base + OMAP_WATCHDOG_SYS_CONFIG);
 
-   omap_wdt_dev = pdev;
+   /* keep track of the wdt platform devices in local device array */
+   omap_wdt_dev[pdev->id - 1] = pdev;
 
return 0;
 
@@ -384,7 +419,7 @@ static int __devexit omap_wdt_remove(struct platform_device 
*pdev)
iounmap(wdev->base);
 
kfree(wdev);
-   omap_wdt_dev = NULL;
+   omap_wdt_dev[pdev->id-1] = NULL;
 
return 0;
 }
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 0/2] watchdog:OMAP3:Add support for IVA2, SECURE WDTs

2009-06-16 Thread Ulrik Bech Hald
This patch series enables support for IVA2 and SECURE
WDTs, available on omap34xx.
The WDTs will be accessible (when present on device) through:
MPU:/dev/watchdog
SECURE: /dev/watchdog_secure
IVA:/dev/watchdog_iva2

Tested on Zoom1 OMAP3 platform
Signed-off-by: Ulrik Bech Hald 
--- 
This patch set has a dependency on:
compilation: [PATCH 1/2] OMAP2/3: SoC IDs: add omap_type() for determining 
GP/EMU/HS
runtime: [PATCH 1/1] watchdog: OMAP fixes: enable clock in probe, trigger timer 
reload

 arch/arm/mach-omap2/clock34xx.c |   12 ++---
 arch/arm/plat-omap/devices.c|   81 
 drivers/watchdog/omap_wdt.c |   51 +
 3 files changed, 114 insertions(+), 30 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] watchdog:OMAP3:Enable support for IVA2 and SECURE

2009-06-15 Thread Ulrik Bech Hald
This patch enables the IVA2 and SECURE WDTs in the omap_wdt
driver for omap34xx family. SECURE will be available as
/dev/watchdog_secure on HS/EMU devices and IVA2 will be available
as /dev/watchdog_iva2. MPU will still be available as /dev/watchdog

Signed-off-by: Ulrik Bech Hald 
---
This patch has a dependency on:
[PATCH 1/1] watchdog: OMAP fixes: enable clock in probe, trigger timer reload

 drivers/watchdog/omap_wdt.c |   51 --
 1 files changed, 43 insertions(+), 8 deletions(-)

diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index f271385..85a92de 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -47,7 +47,15 @@
 
 #include "omap_wdt.h"
 
-static struct platform_device *omap_wdt_dev;
+#define NUM_WDTS   3
+
+enum {
+   SECURE_WDT = 1,
+   MPU_WDT,
+   IVA2_WDT,
+};
+
+static struct platform_device *omap_wdt_dev[NUM_WDTS];
 
 static unsigned timer_margin;
 module_param(timer_margin, uint, 0);
@@ -139,8 +147,23 @@ static void omap_wdt_set_timeout(struct omap_wdt_dev *wdev)
  */
 static int omap_wdt_open(struct inode *inode, struct file *file)
 {
-   struct omap_wdt_dev *wdev = platform_get_drvdata(omap_wdt_dev);
-   void __iomem *base = wdev->base;
+   struct omap_wdt_dev *wdev;
+   void __iomem *base;
+
+   /* by default MPU wdt is present across omap family */
+   wdev = platform_get_drvdata(omap_wdt_dev[1]);
+
+   /* Find match between device node and wdt device */
+   int i;
+   for (i = 0; i < NUM_WDTS; i++) {
+   if (omap_wdt_dev[i]) {
+   wdev = platform_get_drvdata(omap_wdt_dev[i]);
+   if (iminor(inode) == wdev->omap_wdt_miscdev.minor)
+   break;
+   }
+   }
+
+   base = wdev->base;
 
if (test_and_set_bit(1, (unsigned long *)&(wdev->omap_wdt_users)))
return -EBUSY;
@@ -271,7 +294,7 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
goto err_get_resource;
}
 
-   if (omap_wdt_dev) {
+   if (omap_wdt_dev[pdev->id-1]) {
ret = -EBUSY;
goto err_busy;
}
@@ -317,10 +340,21 @@ static int __devinit omap_wdt_probe(struct 
platform_device *pdev)
omap_wdt_adjust_timeout(timer_margin);
 
wdev->omap_wdt_miscdev.parent = &pdev->dev;
-   wdev->omap_wdt_miscdev.minor = WATCHDOG_MINOR;
-   wdev->omap_wdt_miscdev.name = "watchdog";
+   wdev->omap_wdt_miscdev.minor = MISC_DYNAMIC_MINOR;
wdev->omap_wdt_miscdev.fops = &omap_wdt_fops;
 
+   switch (pdev->id) {
+   case SECURE_WDT:
+   wdev->omap_wdt_miscdev.name = "watchdog_secure";
+   break;
+   case IVA2_WDT:
+   wdev->omap_wdt_miscdev.name = "watchdog_iva2";
+   break;
+   case MPU_WDT:
+   default:
+   wdev->omap_wdt_miscdev.name = "watchdog";
+   }
+
ret = misc_register(&(wdev->omap_wdt_miscdev));
if (ret)
goto err_misc;
@@ -332,7 +366,8 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
/* autogate OCP interface clock */
__raw_writel(0x01, wdev->base + OMAP_WATCHDOG_SYS_CONFIG);
 
-   omap_wdt_dev = pdev;
+   /* keep track of the wdt platform devices in local device array */
+   omap_wdt_dev[pdev->id - 1] = pdev;
 
return 0;
 
@@ -384,7 +419,7 @@ static int __devexit omap_wdt_remove(struct platform_device 
*pdev)
iounmap(wdev->base);
 
kfree(wdev);
-   omap_wdt_dev = NULL;
+   omap_wdt_dev[pdev->id-1] = NULL;
 
return 0;
 }
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/2] watchdog:OMAP3:Add support for IVA2, SECURE WDTs

2009-06-15 Thread Ulrik Bech Hald
This patch series enables support for IVA2 and SECURE
WDTs, available on omap34xx.
The WDTs will be accessible (when present on device) through:
MPU:/dev/watchdog
SECURE: /dev/watchdog_secure
IVA:/dev/watchdog_iva2

Signed-off-by: Ulrik Bech Hald 
--- 
This patch set has a dependency on:
[PATCH 1/2] OMAP2/3: SoC IDs: add omap_type() for determining GP/EMU/HS
[PATCH 1/1] watchdog: OMAP fixes: enable clock in probe, trigger timer reload

 arch/arm/mach-omap2/clock34xx.c |   12 ++---
 arch/arm/plat-omap/devices.c|   81 
 drivers/watchdog/omap_wdt.c |   51 +
 3 files changed, 114 insertions(+), 30 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] watchdog:OMAP3:Register IVA and SECURE WDT, make clks accessible

2009-06-15 Thread Ulrik Bech Hald
Enabling registration of IVA and SECURE WDT devices. Making
ick and fck for IVA and SECURE WDTs accessible.

Signed-off-by: Ulrik Bech Hald 
---
This patch has a dependency on:
PATCH 1/2] OMAP2/3: SoC IDs: add omap_type() for determining GP/EMU/HS

 arch/arm/mach-omap2/clock34xx.c |   12 +++---
 arch/arm/plat-omap/devices.c|   81 +++
 2 files changed, 71 insertions(+), 22 deletions(-)
 mode change 100644 => 100755 arch/arm/plat-omap/devices.c

diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index 9e43fe5..933ae9e 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -215,11 +215,11 @@ static struct omap_clk omap34xx_clks[] = {
CLK(NULL,   "gpt1_fck", &gpt1_fck,  CK_343X),
CLK(NULL,   "wkup_32k_fck", &wkup_32k_fck,  CK_343X),
CLK(NULL,   "gpio1_dbck",   &gpio1_dbck,CK_343X),
-   CLK("omap_wdt", "fck",  &wdt2_fck,  CK_343X),
+   CLK("omap_wdt.2", "fck",&wdt2_fck,  CK_343X),
CLK(NULL,   "wkup_l4_ick",  &wkup_l4_ick,   CK_343X),
CLK(NULL,   "usim_ick", &usim_ick,  CK_3430ES2),
-   CLK("omap_wdt", "ick",  &wdt2_ick,  CK_343X),
-   CLK(NULL,   "wdt1_ick", &wdt1_ick,  CK_343X),
+   CLK("omap_wdt.2", "ick",&wdt2_ick,  CK_343X),
+   CLK("omap_wdt.1", "ick",&wdt1_ick,  CK_343X),
CLK(NULL,   "gpio1_ick",&gpio1_ick, CK_343X),
CLK(NULL,   "omap_32ksync_ick", &omap_32ksync_ick, CK_343X),
CLK(NULL,   "gpt12_ick",&gpt12_ick, CK_343X),
@@ -241,14 +241,14 @@ static struct omap_clk omap34xx_clks[] = {
CLK(NULL,   "gpio4_dbck",   &gpio4_dbck,CK_343X),
CLK(NULL,   "gpio3_dbck",   &gpio3_dbck,CK_343X),
CLK(NULL,   "gpio2_dbck",   &gpio2_dbck,CK_343X),
-   CLK(NULL,   "wdt3_fck", &wdt3_fck,  CK_343X),
+   CLK("omap_wdt.3", "fck",&wdt3_fck,  CK_343X),
CLK(NULL,   "per_l4_ick",   &per_l4_ick,CK_343X),
CLK(NULL,   "gpio6_ick",&gpio6_ick, CK_343X),
CLK(NULL,   "gpio5_ick",&gpio5_ick, CK_343X),
CLK(NULL,   "gpio4_ick",&gpio4_ick, CK_343X),
CLK(NULL,   "gpio3_ick",&gpio3_ick, CK_343X),
CLK(NULL,   "gpio2_ick",&gpio2_ick, CK_343X),
-   CLK(NULL,   "wdt3_ick", &wdt3_ick,  CK_343X),
+   CLK("omap_wdt.3", "ick",&wdt3_ick,  CK_343X),
CLK(NULL,   "uart3_ick",&uart3_ick, CK_343X),
CLK(NULL,   "gpt9_ick", &gpt9_ick,  CK_343X),
CLK(NULL,   "gpt8_ick", &gpt8_ick,  CK_343X),
@@ -275,7 +275,7 @@ static struct omap_clk omap34xx_clks[] = {
CLK(NULL,   "sr_l4_ick",&sr_l4_ick, CK_343X),
CLK(NULL,   "secure_32k_fck", &secure_32k_fck, CK_343X),
CLK(NULL,   "gpt12_fck",&gpt12_fck, CK_343X),
-   CLK(NULL,   "wdt1_fck", &wdt1_fck,  CK_343X),
+   CLK("omap_wdt.1", "fck",&wdt1_fck,  CK_343X),
 };
 
 /* CM_AUTOIDLE_PLL*.AUTO_* bit values */
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
old mode 100644
new mode 100755
index a64b692..de5182c
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -288,42 +288,91 @@ static inline void omap_init_uwire(void) {}
 
 #ifdefined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
 
-static struct resource wdt_resources[] = {
+#defineOMAP34XX_WDT1_BASE  0x4830c000
+#defineOMAP34XX_WDT2_BASE  0x48314000
+#defineOMAP34XX_WDT3_BASE  0x4903
+#defineOMAP2430_WDT_BASE   0x49016000
+#defineOMAP2420_WDT_BASE   0x48022000
+#defineOMAP16XX_WDT_BASE   0xfffeb000
+
+static struct resource wdt1_resources[] = {
{
-   .flags  = IORESOURCE_MEM,
+   .flags = IORESOURCE_MEM,
},
 };
 
-static struct platform_device omap_wdt_device = {
-   .name  = "omap_wdt",
-   .id  = -1,
-   .num_resources  = ARRAY_SIZE(wdt_resources),
-   .resource   = wdt_resources,
+static struct resource wdt2_resources[] = {
+   {
+   .flags = IORESOURCE_MEM,
+   }

[PATCH 1/1] watchdog: OMAP fixes: enable clock in probe, trigger timer reload

2009-06-12 Thread Ulrik Bech Hald
This patch contains two bugfixes:

1)In omap_wdt_probe() the watchdog is reset and disabled. This
requires register access and the clks needs to be enabled temporarily

2)In omap_wdt_open() the timer register needs to be reloaded
to trigger a new timer value (the default of 60s)

Tested on OMAP34xx platform (Zoom1)

Reviewed-by: Kevin Hilman 
Signed-off-by: Ulrik Bech Hald 
---
 drivers/watchdog/omap_wdt.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 drivers/watchdog/omap_wdt.c

diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
old mode 100644
new mode 100755
index f271385..3ed571a
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -159,6 +159,7 @@ static int omap_wdt_open(struct inode *inode, struct file 
*file)
file->private_data = (void *) wdev;
 
omap_wdt_set_timeout(wdev);
+   omap_wdt_ping(wdev); /* trigger loading of new timeout value */
omap_wdt_enable(wdev);
 
return nonseekable_open(inode, file);
@@ -313,6 +314,9 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
 
platform_set_drvdata(pdev, wdev);
 
+   clk_enable(wdev->ick);
+   clk_enable(wdev->fck);
+
omap_wdt_disable(wdev);
omap_wdt_adjust_timeout(timer_margin);
 
@@ -332,6 +336,9 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
/* autogate OCP interface clock */
__raw_writel(0x01, wdev->base + OMAP_WATCHDOG_SYS_CONFIG);
 
+   clk_disable(wdev->ick);
+   clk_disable(wdev->fck);
+
omap_wdt_dev = pdev;
 
return 0;
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] OMAP3:Re-introduce omap_type()

2009-06-12 Thread Ulrik Bech Hald
The functionality of omap_type() is needed for eg. watchdog
device registration to distinguish different device types.

Signed-off-by: Ulrik Bech Hald 
---
 arch/arm/mach-omap2/id.c |   21 +
 1 files changed, 21 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 arch/arm/mach-omap2/id.c

diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
old mode 100644
new mode 100755
index 458990e..9fa61b4
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -48,6 +48,27 @@ int omap_chip_is(struct omap_chip_id oci)
 }
 EXPORT_SYMBOL(omap_chip_is);
 
+int omap_type(void)
+{
+   u32 val = 0;
+
+   if (cpu_is_omap24xx()) {
+   val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS);
+   } else if (cpu_is_omap34xx()) {
+   val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS);
+   } else {
+   pr_err("Cannot detect omap type!\n");
+   goto out;
+   }
+
+   val &= OMAP2_DEVICETYPE_MASK;
+   val >>= 8;
+
+out:
+   return val;
+}
+EXPORT_SYMBOL(omap_type);
+
 
/**/
 
 #define OMAP_TAP_IDCODE0x0204
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] OMAP3:WDT:Enable clk in probe, trigger timer reload

2009-06-12 Thread Ulrik Bech Hald
This patch contains two bugfixes:

1)In omap_wdt_probe() the watchdog is reset and disabled. This
requires register access and the clks needs to be enabled temporarily

2)In omap_wdt_open() the timer register needs to be reloaded
to trigger a new timer value (the default of 60s)

Signed-off-by: Ulrik Bech Hald 
---
 drivers/watchdog/omap_wdt.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 drivers/watchdog/omap_wdt.c

diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
old mode 100644
new mode 100755
index f271385..3ed571a
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -159,6 +159,7 @@ static int omap_wdt_open(struct inode *inode, struct file 
*file)
file->private_data = (void *) wdev;
 
omap_wdt_set_timeout(wdev);
+   omap_wdt_ping(wdev); /* trigger loading of new timeout value */
omap_wdt_enable(wdev);
 
return nonseekable_open(inode, file);
@@ -313,6 +314,9 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
 
platform_set_drvdata(pdev, wdev);
 
+   clk_enable(wdev->ick);
+   clk_enable(wdev->fck);
+
omap_wdt_disable(wdev);
omap_wdt_adjust_timeout(timer_margin);
 
@@ -332,6 +336,9 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
/* autogate OCP interface clock */
__raw_writel(0x01, wdev->base + OMAP_WATCHDOG_SYS_CONFIG);
 
+   clk_disable(wdev->ick);
+   clk_disable(wdev->fck);
+
omap_wdt_dev = pdev;
 
return 0;
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/3] OMAP3:WDT:Enable IVA, SECURE and minor bugfixes

2009-06-08 Thread Ulrik Bech Hald
This patch series enables support for IVA and SECURE
WDTs, available on omap34xx.
For omap34xx devices the WDT will be accessible 
(when present) through:
SECURE:/dev/watchdog1
MPU:   /dev/watchdog2
IVA:   /dev/watchdog3

For devices older than omap34xx only MPU WDT is present
and will be accessible through /dev/watchdog

The series also fixes two bugs:

1) Correct timeout value is not loaded upon opening the
   watchdog device.

2) clks are not enabled when accessing registers in probe 

 b/arch/arm/mach-omap2/clock34xx.c |   12 ++---
 b/arch/arm/plat-omap/devices.c|   79 ++
 b/drivers/watchdog/omap_wdt.c |   42 ++
 3 files changed, 112 insertions(+), 28 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] OMAP3:WDT:Enable support for IVA and SECURE

2009-06-08 Thread Ulrik Bech Hald
This patch enables the IVA and SECURE WDTs in the omap_wdt
driver for omap34xx family. SECURE will be available as /dev/watchdog1
HS/EMU devices and IVA will be available as /dev/watchdog3.
MPU will be available as /dev/watchdog2
For omap versions earlier than 34xx only MPU watchdog is present and
will be available as /dev/watchdog for backwards compatibility.

Signed-off-by: Ulrik Bech Hald 
---
 drivers/watchdog/omap_wdt.c |   42 +++---
 1 files changed, 35 insertions(+), 7 deletions(-)
 mode change 100644 => 100755 drivers/watchdog/omap_wdt.c

diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
old mode 100644
new mode 100755
index f271385..26935c7
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -47,7 +47,9 @@
 
 #include "omap_wdt.h"
 
-static struct platform_device *omap_wdt_dev;
+#define NUM_WDTS   3
+
+static struct platform_device *omap_wdt_dev[NUM_WDTS];
 
 static unsigned timer_margin;
 module_param(timer_margin, uint, 0);
@@ -139,8 +141,26 @@ static void omap_wdt_set_timeout(struct omap_wdt_dev *wdev)
  */
 static int omap_wdt_open(struct inode *inode, struct file *file)
 {
-   struct omap_wdt_dev *wdev = platform_get_drvdata(omap_wdt_dev);
-   void __iomem *base = wdev->base;
+   struct omap_wdt_dev *wdev;
+   void __iomem *base;
+
+   /* by default MPU wdt is present across omap family */
+   wdev = platform_get_drvdata(omap_wdt_dev[1]);
+
+   /* if multiple wdts, find match between device node and wdt device */
+   if (cpu_is_omap34xx()) {
+   int i;
+   for (i = 0; i < NUM_WDTS; i++) {
+   if (omap_wdt_dev[i]) {
+   wdev = platform_get_drvdata(omap_wdt_dev[i]);
+   if (iminor(inode)
+   == wdev->omap_wdt_miscdev.minor)
+   break;
+   }
+   }
+   }
+
+   base = wdev->base;
 
if (test_and_set_bit(1, (unsigned long *)&(wdev->omap_wdt_users)))
return -EBUSY;
@@ -263,6 +283,7 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
struct resource *res, *mem;
struct omap_wdt_dev *wdev;
int ret;
+   static char wdt_name[32];
 
/* reserve static register mappings */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -271,7 +292,7 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
goto err_get_resource;
}
 
-   if (omap_wdt_dev) {
+   if (omap_wdt_dev[pdev->id-1]) {
ret = -EBUSY;
goto err_busy;
}
@@ -318,8 +339,14 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
 
wdev->omap_wdt_miscdev.parent = &pdev->dev;
wdev->omap_wdt_miscdev.minor = WATCHDOG_MINOR;
-   wdev->omap_wdt_miscdev.name = "watchdog";
wdev->omap_wdt_miscdev.fops = &omap_wdt_fops;
+   wdev->omap_wdt_miscdev.name = "watchdog";
+   if (cpu_is_omap34xx()) {
+   snprintf(wdt_name, sizeof(wdt_name), "watchdog%d", pdev->id);
+   wdev->omap_wdt_miscdev.name = wdt_name;
+   if (pdev->id != 2)
+   wdev->omap_wdt_miscdev.minor = MISC_DYNAMIC_MINOR;
+   }
 
ret = misc_register(&(wdev->omap_wdt_miscdev));
if (ret)
@@ -332,7 +359,8 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
/* autogate OCP interface clock */
__raw_writel(0x01, wdev->base + OMAP_WATCHDOG_SYS_CONFIG);
 
-   omap_wdt_dev = pdev;
+   /* keep track of the wdt platform devices in local device array */
+   omap_wdt_dev[pdev->id - 1] = pdev;
 
return 0;
 
@@ -384,7 +412,7 @@ static int __devexit omap_wdt_remove(struct platform_device 
*pdev)
iounmap(wdev->base);
 
kfree(wdev);
-   omap_wdt_dev = NULL;
+   omap_wdt_dev[pdev->id-1] = NULL;
 
return 0;
 }
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] OMAP3:WDT:Enable clk in probe, trigger timer reload

2009-06-08 Thread Ulrik Bech Hald
This patch contains two bugfixes:

1)In omap_wdt_probe() the watchdog is reset and disabled. This
requires register access and the clks needs to be enabled temporarily

2)In omap_wdt_open() the timer register needs to be reloaded
to trigger a new timer value (the default of 60s)

Signed-off-by: Ulrik Bech Hald 
---
 drivers/watchdog/omap_wdt.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 26935c7..cb580a8 100755
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -179,6 +179,7 @@ static int omap_wdt_open(struct inode *inode, struct file 
*file)
file->private_data = (void *) wdev;
 
omap_wdt_set_timeout(wdev);
+   omap_wdt_ping(wdev); /* trigger loading of new timeout value */
omap_wdt_enable(wdev);
 
return nonseekable_open(inode, file);
@@ -334,6 +335,9 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
 
platform_set_drvdata(pdev, wdev);
 
+   clk_enable(wdev->ick);
+   clk_enable(wdev->fck);
+
omap_wdt_disable(wdev);
omap_wdt_adjust_timeout(timer_margin);
 
@@ -359,6 +363,9 @@ static int __devinit omap_wdt_probe(struct platform_device 
*pdev)
/* autogate OCP interface clock */
__raw_writel(0x01, wdev->base + OMAP_WATCHDOG_SYS_CONFIG);
 
+   clk_disable(wdev->ick);
+   clk_disable(wdev->fck);
+
/* keep track of the wdt platform devices in local device array */
omap_wdt_dev[pdev->id - 1] = pdev;
 
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] OMAP3:WDT:Register IVA,SECURE, make clks accessible

2009-06-08 Thread Ulrik Bech Hald
Enabling registration of IVA and SECURE WDT devices. Making
ick and fck for IVA and SECURE WDTs accessible.

Signed-off-by: Ulrik Bech Hald 
---
 arch/arm/mach-omap2/clock34xx.c |   12 +++---
 arch/arm/plat-omap/devices.c|   79 +++---
 2 files changed, 70 insertions(+), 21 deletions(-)

diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index ba05aa4..fe43d73 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -212,11 +212,11 @@ static struct omap_clk omap34xx_clks[] = {
CLK(NULL,   "gpt1_fck", &gpt1_fck,  CK_343X),
CLK(NULL,   "wkup_32k_fck", &wkup_32k_fck,  CK_343X),
CLK(NULL,   "gpio1_dbck",   &gpio1_dbck,CK_343X),
-   CLK("omap_wdt", "fck",  &wdt2_fck,  CK_343X),
+   CLK("omap_wdt.2", "fck",&wdt2_fck,  CK_343X),
CLK(NULL,   "wkup_l4_ick",  &wkup_l4_ick,   CK_343X),
CLK(NULL,   "usim_ick", &usim_ick,  CK_3430ES2),
-   CLK("omap_wdt", "ick",  &wdt2_ick,  CK_343X),
-   CLK(NULL,   "wdt1_ick", &wdt1_ick,  CK_343X),
+   CLK("omap_wdt.2", "ick",&wdt2_ick,  CK_343X),
+   CLK("omap_wdt.1", "ick",&wdt1_ick,  CK_343X),
CLK(NULL,   "gpio1_ick",&gpio1_ick, CK_343X),
CLK(NULL,   "omap_32ksync_ick", &omap_32ksync_ick, CK_343X),
CLK(NULL,   "gpt12_ick",&gpt12_ick, CK_343X),
@@ -238,14 +238,14 @@ static struct omap_clk omap34xx_clks[] = {
CLK(NULL,   "gpio4_dbck",   &gpio4_dbck,CK_343X),
CLK(NULL,   "gpio3_dbck",   &gpio3_dbck,CK_343X),
CLK(NULL,   "gpio2_dbck",   &gpio2_dbck,CK_343X),
-   CLK(NULL,   "wdt3_fck", &wdt3_fck,  CK_343X),
+   CLK("omap_wdt.3", "fck",&wdt3_fck,  CK_343X),
CLK(NULL,   "per_l4_ick",   &per_l4_ick,CK_343X),
CLK(NULL,   "gpio6_ick",&gpio6_ick, CK_343X),
CLK(NULL,   "gpio5_ick",&gpio5_ick, CK_343X),
CLK(NULL,   "gpio4_ick",&gpio4_ick, CK_343X),
CLK(NULL,   "gpio3_ick",&gpio3_ick, CK_343X),
CLK(NULL,   "gpio2_ick",&gpio2_ick, CK_343X),
-   CLK(NULL,   "wdt3_ick", &wdt3_ick,  CK_343X),
+   CLK("omap_wdt.3", "ick",&wdt3_ick,  CK_343X),
CLK(NULL,   "uart3_ick",&uart3_ick, CK_343X),
CLK(NULL,   "gpt9_ick", &gpt9_ick,  CK_343X),
CLK(NULL,   "gpt8_ick", &gpt8_ick,  CK_343X),
@@ -272,7 +272,7 @@ static struct omap_clk omap34xx_clks[] = {
CLK(NULL,   "sr_l4_ick",&sr_l4_ick, CK_343X),
CLK(NULL,   "secure_32k_fck", &secure_32k_fck, CK_343X),
CLK(NULL,   "gpt12_fck",&gpt12_fck, CK_343X),
-   CLK(NULL,   "wdt1_fck", &wdt1_fck,  CK_343X),
+   CLK("omap_wdt.1", "fck",&wdt1_fck,  CK_343X),
 };
 
 /* CM_AUTOIDLE_PLL*.AUTO_* bit values */
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index 87fb7ff..2a1b806 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -288,36 +288,85 @@ static inline void omap_init_uwire(void) {}
 
 #ifdefined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
 
-static struct resource wdt_resources[] = {
+#defineOMAP34XX_WDT1_BASE  0x4830c000
+#defineOMAP34XX_WDT2_BASE  0x48314000
+#defineOMAP34XX_WDT3_BASE  0x4903
+#defineOMAP2430_WDT_BASE   0x49016000
+#defineOMAP2420_WDT_BASE   0x48022000
+#defineOMAP16XX_WDT_BASE   0xfffeb000
+
+static struct resource wdt1_resources[] = {
{
-   .flags  = IORESOURCE_MEM,
+   .flags = IORESOURCE_MEM,
},
 };
 
-static struct platform_device omap_wdt_device = {
-   .name  = "omap_wdt",
-   .id  = -1,
-   .num_resources  = ARRAY_SIZE(wdt_resources),
-   .resource   = wdt_resources,
+static struct resource wdt2_resources[] = {
+   {
+   .flags = IORESOURCE_MEM,
+   },
+};
+
+static struct resource wdt3_resources[] = {
+   {
+   .flags = IORESOURCE_MEM,
+   },
+};
+
+/* SECURE WDT */
+static struct platform_device omap_wdt1_device = {
+