Re: NULL pointer dereference when using ALSA SOC

2008-09-26 Thread Tony Lindgren
* Siarhei Siamashka [EMAIL PROTECTED] [080925 22:20]:
 On Tuesday 23 September 2008, Arun KS wrote:
  Hi all,
 
  I am writing an ASOC driver for tlvaic23 on osk5912 platform.
 [...]
 
 Hi. Coincidentally I have been hacking the old aic23 driver in the last few
 days to make it work on Nokia 770. Don't know if these fixes have any value
 for linux-omap tree, but I would be glad if anybody finds some of them useful.
 Patch against old 2.6.16 kernel can be found here:
 http://lists.maemo.org/pipermail/maemo-developers/2008-September/035053.html

Of course we want all the patches integrated! Please start posting
your patches to alsa-devel and cc linux-omap.

 A bug with current position detection in 'audio_get_dma_pos' is especially bad
 as it causes sound stuttering on video playback.

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch 2.6.27-rc6-omap] ASOC: quieter boot for non-Overo boards

2008-09-26 Thread Jarkko Nikula
On Thu, 25 Sep 2008 10:41:48 -0700
ext David Brownell [EMAIL PROTECTED] wrote:

  Putting the board specific bits in the
  arch/arm/mach-omap2/board-XYZ.c file has been discussed a number of
  times on alsa-devel and the folks there insist that for now (i.e.
  ASoC V1) this is the proper way to do things.
 
 Hmm, I'm not sure I follow.  They want the SOC devices
 in the wrong place in the driver model tree, potentially
 impacting power management?
 
 I don't want to fight that fight, but ... that seems unwise.
 
Yep. Now in ASoC v1, the machine, platform/CPU and codec are tied
together during compile time and I think it has been easier to
review/manage by keeping them under one sound/soc directory.

I suppose that when ASoC v2 is in place and devices can be individually
probed, we might see that machine drivers will start moving out from
there.


Jarkko
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch] some drivers switch away from OMAP-specific GPIO calls

2008-09-26 Thread Tony Lindgren
* David Brownell [EMAIL PROTECTED] [080925 19:52]:
 On Thursday 25 September 2008, Tony Lindgren wrote:
   
   This updates most of the OMAP drivers which are in mainline to
   switch to using the cross-platform GPIO calls instead of the
   older OMAP-specific ones.
   
   This is all fairly brainless/obvious stuff.  Probably the
   most interesting bit is to observe that the omap-keypad
   code seems to now have a portable core that could work with
   non-OMAP matrix keypads.  (That would improve with hardware
   IRQ debouncing enabled, of course...)
  
  Do you want push this to mainline as part of gpiolib patches?
 
 I'l send it now that I have your Signed-off-By.
 CC a few subsystem maintainers ... but I see no
 point in splitting this into mini-patchlets.

OK sounds good to me.

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: NULL pointer dereference when using ALSA SOC

2008-09-26 Thread Jarkko Nikula
On Thu, 25 Sep 2008 22:20:43 +0300
ext Siarhei Siamashka [EMAIL PROTECTED] wrote:

 On Tuesday 23 September 2008, Arun KS wrote:
  Hi all,
 
  I am writing an ASOC driver for tlvaic23 on osk5912 platform.
 [...]
 
 Hi. Coincidentally I have been hacking the old aic23 driver in the
 last few days to make it work on Nokia 770. Don't know if these fixes
 have any value for linux-omap tree, but I would be glad if anybody
 finds some of them useful. Patch against old 2.6.16 kernel can be
 found here:

Hi

sound/arm/omap is likely to disappear but with ASoC codec driver for
aic23 and machine driver for OSK, those would allow quite easily to add
support for 770 as well and to rotate support patch to 770 via
alsa-devel list.


Jarkko
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] OMAP3 clock: put DPLL into bypass if bypass rate = clk-rate, not hardware rate

2008-09-26 Thread Tero.Kristo
Hi,

The three patches you sent (fix CONFIG_OMAP_RESET_CLOCKS, fix
dss1_alwon_clk and this one) seem to fix problems I was seeing with
retention.

-Tero

-Original Message-
From: ext Paul Walmsley [mailto:[EMAIL PROTECTED] 
Sent: 25 September, 2008 17:39
To: linux-omap@vger.kernel.org
Cc: Kristo Tero (Nokia-D/Tampere); [EMAIL PROTECTED]
Subject: [PATCH] OMAP3 clock: put DPLL into bypass if bypass 
rate = clk-rate, not hardware rate


When a non-CORE DPLL is enabled via 
omap3_noncore_dpll_enable(), use the user's desired rate in 
clk-rate to determine whether to put the DPLL into bypass or 
lock mode, rather than reading the DPLL's current idle state 
from its hardware registers.

This fixes a bug observed when leaving retention. Non-CORE 
DPLLs were not being relocked when downstream clocks 
re-enabled; rather, the DPLL entered bypass mode.

Problem reported by Tero Kristo [EMAIL PROTECTED].

Signed-off-by: Paul Walmsley [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/clock34xx.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/clock34xx.c 
b/arch/arm/mach-omap2/clock34xx.c index c89d6bc..df258f7 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -281,9 +281,7 @@ static int 
omap3_noncore_dpll_enable(struct clk *clk)
   if (!dd)
   return -EINVAL;
 
-  rate = omap2_get_dpll_rate(clk);
-
-  if (dd-bypass_clk-rate == rate)
+  if (clk-rate == dd-bypass_clk-rate)
   r = _omap3_noncore_dpll_bypass(clk);
   else
   r = _omap3_noncore_dpll_lock(clk);

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


[PATCH 3/8] i2c: clean add_children a bit

2008-09-26 Thread Felipe Balbi
Clean up add_children a bit before adding more children
to twl4030-core.c

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
Acked-by: David Brownell [EMAIL PROTECTED]
---
 drivers/i2c/chips/twl4030-core.c |   63 +
 1 files changed, 36 insertions(+), 27 deletions(-)

diff --git a/drivers/i2c/chips/twl4030-core.c b/drivers/i2c/chips/twl4030-core.c
index 47f65f8..75356c3 100644
--- a/drivers/i2c/chips/twl4030-core.c
+++ b/drivers/i2c/chips/twl4030-core.c
@@ -45,6 +45,11 @@
 
 #define DRIVER_NAMEtwl4030
 
+#if defined(CONFIG_RTC_DRV_TWL4030) || defined(CONFIG_RTC_DRV_TWL4030_MODULE)
+#define twl_has_rtc()  (1)
+#else
+#define twl_has_rtc()  (0)
+#endif
 
 /* Primary Interrupt Handler on TWL4030 Registers */
 
@@ -639,34 +644,38 @@ static int add_children(struct twl4030_platform_data 
*pdata)
struct twl4030_client   *twl = NULL;
int status = 0;
 
-#ifdef CONFIG_RTC_DRV_TWL4030
-   pdev = platform_device_alloc(twl4030_rtc, -1);
-   if (pdev) {
-   twl = twl4030_modules[TWL4030_SLAVENUM_NUM3];
-   pdev-dev.parent = twl-client-dev;
-   device_init_wakeup(pdev-dev, 1);
-
-   /*
-* FIXME add the relevant IRQ resource, and make the
-* rtc driver use it instead of hard-wiring ...
-*
-* REVISIT platform_data here currently only supports
-* setting up the msecure line ... which actually
-* violates the princple of least privilege, since
-* it's effectively always in high trust mode.
-*
-* For now, expect equivalent treatment at board init:
-* setting msecure high.  Eventually, Linux might
-* become more aware of those HW security concerns.
-*/
-
-   status = platform_device_add(pdev);
-   if (status  0)
-   platform_device_put(pdev);
-   } else
-   status = -ENOMEM;
-#endif
+   if (twl_has_rtc()) {
+   pdev = platform_device_alloc(twl4030_rtc, -1);
+   if (pdev) {
+   twl = twl4030_modules[TWL4030_SLAVENUM_NUM3];
+   pdev-dev.parent = twl-client-dev;
+   device_init_wakeup(pdev-dev, 1);
+
+   /*
+* FIXME add the relevant IRQ resource, and make the
+* rtc driver use it instead of hard-wiring ...
+*
+* REVISIT platform_data here currently only supports
+* setting up the msecure line ... which actually
+* violates the princple of least privilege, since
+* it's effectively always in high trust mode.
+*
+* For now, expect equivalent treatment at board init:
+* setting msecure high.  Eventually, Linux might
+* become more aware of those HW security concerns.
+*/
+
+   status = platform_device_add(pdev);
+   if (status  0)
+   platform_device_put(pdev);
+   } else {
+   status = -ENOMEM;
+   goto err;
+   }
+   }
 
+err:
+   pr_err(failed to add twl4030's children\n);
return status;
 }
 
-- 
1.6.0.2.307.gc427

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


[PATCH 4/8] i2c: move twl4030_keypad to new style registration

2008-09-26 Thread Felipe Balbi
let twl4030-core.c take care of twl4030_keypad registration.

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/board-2430sdp.c |   14 ++
 arch/arm/mach-omap2/board-3430sdp.c |   14 ++
 arch/arm/mach-omap2/board-omap2evm.c|   16 ++
 arch/arm/mach-omap2/board-omap3evm.c|   69 --
 drivers/i2c/chips/twl4030-core.c|   27 ++
 drivers/input/keyboard/omap-twl4030keypad.c |6 +-
 include/linux/i2c/twl4030.h |   10 
 7 files changed, 85 insertions(+), 71 deletions(-)

diff --git a/arch/arm/mach-omap2/board-2430sdp.c 
b/arch/arm/mach-omap2/board-2430sdp.c
index 3649a94..8c4c9dd 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -173,7 +173,7 @@ static int sdp2430_keymap[] = {
0
 };
 
-static struct omap_kp_platform_data sdp2430_kp_data = {
+static struct twl4030_keypad_data sdp2430_kp_data = {
.rows   = 5,
.cols   = 6,
.keymap = sdp2430_keymap,
@@ -182,14 +182,6 @@ static struct omap_kp_platform_data sdp2430_kp_data = {
.irq= TWL4030_MODIRQ_KEYPAD,
 };
 
-static struct platform_device sdp2430_kp_device = {
-   .name   = omap_twl4030keypad,
-   .id = -1,
-   .dev= {
-   .platform_data  = sdp2430_kp_data,
-   },
-};
-
 static int __init msecure_init(void)
 {
int ret = 0;
@@ -216,7 +208,6 @@ out:
 static struct platform_device *sdp2430_devices[] __initdata = {
sdp2430_smc91x_device,
sdp2430_flash_device,
-   sdp2430_kp_device,
sdp2430_lcd_device,
 };
 
@@ -356,6 +347,9 @@ static struct omap_board_config_kernel sdp2430_config[] 
__initdata = {
 static struct twl4030_platform_data sdp2430_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
+
+   /* platform_data for children goes here */
+   .keypad = sdp2430_kp_data,
 };
 
 static struct i2c_board_info __initdata sdp2430_i2c_boardinfo[] = {
diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index 4c60d7b..fe1ba4e 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -110,7 +110,7 @@ static int sdp3430_keymap[] = {
0
 };
 
-static struct omap_kp_platform_data sdp3430_kp_data = {
+static struct twl4030_keypad_data sdp3430_kp_data = {
.rows   = 5,
.cols   = 6,
.keymap = sdp3430_keymap,
@@ -119,14 +119,6 @@ static struct omap_kp_platform_data sdp3430_kp_data = {
.irq= TWL4030_MODIRQ_KEYPAD,
 };
 
-static struct platform_device sdp3430_kp_device = {
-   .name   = omap_twl4030keypad,
-   .id = -1,
-   .dev= {
-   .platform_data  = sdp3430_kp_data,
-   },
-};
-
 static int ts_gpio;
 
 static int __init msecure_init(void)
@@ -252,7 +244,6 @@ static struct platform_device sdp3430_lcd_device = {
 
 static struct platform_device *sdp3430_devices[] __initdata = {
sdp3430_smc91x_device,
-   sdp3430_kp_device,
sdp3430_lcd_device,
 };
 
@@ -312,6 +303,9 @@ static struct omap_board_config_kernel sdp3430_config[] 
__initdata = {
 static struct twl4030_platform_data sdp3430_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
+
+   /* platform_data for children goes here */
+   .keypad = sdp3430_kp_data,
 };
 
 static struct i2c_board_info __initdata sdp3430_i2c_boardinfo[] = {
diff --git a/arch/arm/mach-omap2/board-omap2evm.c 
b/arch/arm/mach-omap2/board-omap2evm.c
index 6ce7740..d2a3743 100644
--- a/arch/arm/mach-omap2/board-omap2evm.c
+++ b/arch/arm/mach-omap2/board-omap2evm.c
@@ -200,23 +200,15 @@ static int omap2evm_keymap[] = {
KEY(3, 3, KEY_P)
 };
 
-static struct omap_kp_platform_data omap2evm_kp_data = {
+static struct twl4030_keypad_data omap2evm_kp_data = {
.rows   = 4,
.cols   = 4,
-   .keymap = omap2evm_keymap,
+   .keymap = omap2evm_keymap,
.keymapsize = ARRAY_SIZE(omap2evm_keymap),
.rep= 1,
.irq= TWL4030_MODIRQ_KEYPAD,
 };
 
-static struct platform_device omap2evm_kp_device = {
-   .name   = omap_twl4030keypad,
-   .id = -1,
-   .dev= {
-   .platform_data = omap2evm_kp_data,
-   },
-};
-
 static void __init omap2_evm_init_irq(void)
 {
omap2_init_common_hw(NULL);
@@ -237,6 +229,9 @@ static struct omap_board_config_kernel omap2_evm_config[] 
__initdata = {
 static struct twl4030_platform_data omap2evm_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
+
+   /* platform_data for children goes here */
+   .keypad  

[PATCH 7/8] twl4030 gpio platform data

2008-09-26 Thread Felipe Balbi
From: David Brownell [EMAIL PROTECTED]

Define platform data for configuring TWL4030 GPIOs,
and provide it for all boards using these chips.

For now all boards use the same fixed assignments for
GPIO and IRQ numbers.  Eventually we should be able
to shuffle them without changing platform headers.

Signed-off-by: David Brownell [EMAIL PROTECTED]
Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/board-2430sdp.c |7 +++
 arch/arm/mach-omap2/board-3430sdp.c |7 +++
 arch/arm/mach-omap2/board-ldp.c |7 +++
 arch/arm/mach-omap2/board-omap2evm.c|7 +++
 arch/arm/mach-omap2/board-omap3beagle.c |   12 
 arch/arm/mach-omap2/board-omap3evm.c|7 +++
 arch/arm/mach-omap2/board-overo.c   |7 +++
 include/linux/i2c/twl4030.h |   24 +---
 8 files changed, 75 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/board-2430sdp.c 
b/arch/arm/mach-omap2/board-2430sdp.c
index f35c252..0deaf09 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -345,6 +345,12 @@ static struct omap_board_config_kernel sdp2430_config[] 
__initdata = {
 };
 
 
+static struct twl4030_gpio_platform_data sdp2430_gpio_data = {
+   .gpio_base  = OMAP_MAX_GPIO_LINES,
+   .irq_base   = TWL4030_GPIO_IRQ_BASE,
+   .irq_end= TWL4030_GPIO_IRQ_END,
+};
+
 static struct twl4030_usb_data sdp2430_usb_data = {
.usb_mode   = T2_MODE_ULPI,
 };
@@ -354,6 +360,7 @@ static struct twl4030_platform_data sdp2430_twldata = {
.irq_end= TWL4030_IRQ_END,
 
/* platform_data for children goes here */
+   .gpio   = sdp2430_gpio_data,
.keypad = sdp2430_kp_data,
.usb= sdp2430_usb_data,
 };
diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index e0c39c2..66f0f98 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -300,6 +300,12 @@ static struct omap_board_config_kernel sdp3430_config[] 
__initdata = {
{ OMAP_TAG_LCD, sdp3430_lcd_config },
 };
 
+static struct twl4030_gpio_platform_data sdp3430_gpio_data = {
+   .gpio_base  = OMAP_MAX_GPIO_LINES,
+   .irq_base   = TWL4030_GPIO_IRQ_BASE,
+   .irq_end= TWL4030_GPIO_IRQ_END,
+};
+
 static struct twl4030_usb_data sdp3430_usb_data = {
.usb_mode   = T2_USB_MODE_ULPI,
 };
@@ -309,6 +315,7 @@ static struct twl4030_platform_data sdp3430_twldata = {
.irq_end= TWL4030_IRQ_END,
 
/* platform_data for children goes here */
+   .gpio   = sdp3430_gpio_data,
.keypad = sdp3430_kp_data,
.usb= sdp3430_usb_data,
 };
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index 219579b..48342f4 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -187,12 +187,19 @@ static struct twl4030_usb_data ldp_usb_data = {
.usb_mode   = T2_USB_MODE_ULPI,
 };
 
+static struct twl4030_gpio_platform_data ldp_gpio_data = {
+   .gpio_base  = OMAP_MAX_GPIO_LINES,
+   .irq_base   = TWL4030_GPIO_IRQ_BASE,
+   .irq_end= TWL4030_GPIO_IRQ_END,
+};
+
 static struct twl4030_platform_data ldp_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
 
/* platform_data for children goes here */
.usb= ldp_usb_data,
+   .gpio   = ldp_gpio_data,
 };
 
 static struct i2c_board_info __initdata ldp_i2c_boardinfo[] = {
diff --git a/arch/arm/mach-omap2/board-omap2evm.c 
b/arch/arm/mach-omap2/board-omap2evm.c
index be8348d..a921cf1 100644
--- a/arch/arm/mach-omap2/board-omap2evm.c
+++ b/arch/arm/mach-omap2/board-omap2evm.c
@@ -226,6 +226,12 @@ static struct omap_board_config_kernel omap2_evm_config[] 
__initdata = {
{ OMAP_TAG_LCD, omap2_evm_lcd_config },
 };
 
+static struct twl4030_gpio_platform_data omap2evm_gpio_data = {
+   .gpio_base  = OMAP_MAX_GPIO_LINES,
+   .irq_base   = TWL4030_GPIO_IRQ_BASE,
+   .irq_end= TWL4030_GPIO_IRQ_END,
+};
+
 static struct twl4030_usb_data omap2evm_usb_data = {
.usb_mode   = T2_USB_MODE_ULPI,
 };
@@ -237,6 +243,7 @@ static struct twl4030_platform_data omap2evm_twldata = {
/* platform_data for children goes here */
.keypad = omap2evm_kp_data,
.usb= omap2evm_usb_data,
+   .gpio   = omap2evm_gpio_data,
 };
 
 static struct i2c_board_info __initdata omap2evm_i2c_boardinfo[] = {
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c 
b/arch/arm/mach-omap2/board-omap3beagle.c
index ae677b9..aa5e9a6 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -114,12 +114,24 @@ static struct twl4030_usb_data beagle_usb_data = {

[PATCH 8/8] twl4030 uses gpiolib

2008-09-26 Thread Felipe Balbi
From: David Brownell [EMAIL PROTECTED]

Make the twl4030 core create a platform device to which its
GPIO code will bind, with platform_data used to configure
board-specific behaviors and configuration.

Update the twl4030 GPIO code:

  - Morph its gpio function code into a platform driver.

  - Move away from IRQ (and GPIO) numbers hard-wired in headers.

  - Hook up the twl4030 GPIO code to gpiolib.

  - Start phasing out the older TWL-specific calls ... currently
those are used only by arch/arm/mach-omap2/hsmmc.c setup code.

  - Use a mutex for locking, not a binary semaphore.

NOTE:  more patches pending:  (a) this doesn't use pdata-pullups
to initialize (currently hsmmc code always sets GPIO-0 pullup even
if the board has an external pullup);  (b) there's a new gpio
request/free hook forthcoming in 2.6.28, which this should use;
(c) likewise there's a new gpio_to_irq() hook; (d) the irq_chip
set_type() mechanism needs to be supported; (e) needs to move over
to drivers/gpio; (f) upcoming threaded IRQ infrastructure should
be used, when that merges.

NYET-Signed-off-by: David Brownell [EMAIL PROTECTED]
NYET-Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
---
 drivers/i2c/chips/Kconfig|2 +-
 drivers/i2c/chips/twl4030-core.c |   44 ++
 drivers/i2c/chips/twl4030-gpio.c |  273 +++---
 3 files changed, 238 insertions(+), 81 deletions(-)

diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
index 121aec9..1a21388 100644
--- a/drivers/i2c/chips/Kconfig
+++ b/drivers/i2c/chips/Kconfig
@@ -159,7 +159,7 @@ config TWL4030_CORE
 
 config TWL4030_GPIO
bool TWL4030 GPIO Driver
-   depends on TWL4030_CORE
+   depends on TWL4030_CORE  GPIOLIB
 
 config TWL4030_MADC
tristate TWL4030 MADC Driver
diff --git a/drivers/i2c/chips/twl4030-core.c b/drivers/i2c/chips/twl4030-core.c
index 36a6bb7..f8162de 100644
--- a/drivers/i2c/chips/twl4030-core.c
+++ b/drivers/i2c/chips/twl4030-core.c
@@ -63,6 +63,12 @@
 #define twl_has_usb()  (0)
 #endif
 
+#ifdef CONFIG_TWL4030_GPIO
+#define twl_has_gpio() true
+#else
+#define twl_has_gpio() false
+#endif
+
 /* Primary Interrupt Handler on TWL4030 Registers */
 
 /* Register Definitions */
@@ -656,6 +662,44 @@ static int add_children(struct twl4030_platform_data 
*pdata)
struct twl4030_client   *twl = NULL;
int status = 0;
 
+   if (twl_has_gpio()  pdata-gpio) {
+   twl = twl4030_modules[TWL4030_SLAVENUM_NUM1];
+
+   pdev = platform_device_alloc(twl4030_gpio, -1);
+   if (!pdev)
+   status = -ENOMEM;
+
+   /* more driver model init */
+   if (status == 0) {
+   pdev-dev.parent = twl-client-dev;
+   /* device_init_wakeup(pdev-dev, 1); */
+
+   status = platform_device_add_data(pdev, pdata-gpio,
+   sizeof(*pdata-gpio));
+   }
+
+   /* GPIO module IRQ */
+   if (status == 0) {
+   struct resource r = {
+   .start = pdata-irq_base + 0,
+   .flags = IORESOURCE_IRQ,
+   };
+
+   status = platform_device_add_resources(pdev, r, 1);
+   }
+
+   if (status == 0)
+   status = platform_device_add(pdev);
+
+   if (status  0) {
+   platform_device_put(pdev);
+   dev_dbg(twl-client-dev,
+   can't create gpio dev, %d\n,
+   status);
+   goto err;
+   }
+   }
+
if (twl_has_rtc()) {
pdev = platform_device_alloc(twl4030_rtc, -1);
if (pdev) {
diff --git a/drivers/i2c/chips/twl4030-gpio.c b/drivers/i2c/chips/twl4030-gpio.c
index b51bed0..0d4dd28 100644
--- a/drivers/i2c/chips/twl4030-gpio.c
+++ b/drivers/i2c/chips/twl4030-gpio.c
@@ -31,22 +31,31 @@
 #include linux/init.h
 #include linux/time.h
 #include linux/interrupt.h
-#include linux/random.h
-#include linux/syscalls.h
+#include linux/device.h
 #include linux/kthread.h
 #include linux/irq.h
+#include linux/gpio.h
+#include linux/platform_device.h
+#include linux/slab.h
 
-#include linux/i2c.h
 #include linux/i2c/twl4030.h
 #include linux/i2c/twl4030-gpio.h
-#include linux/slab.h
 
 #include mach/irqs.h
 #include asm/mach/irq.h
 #include mach/gpio.h
 #include mach/mux.h
 
-#include linux/device.h
+
+/* REVISIT when these symbols vanish elsewhere, remove them here too */
+#undef TWL4030_GPIO_IRQ_BASE
+#undef TWL4030_GPIO_IRQ_END
+#undef TWL4030_MODIRQ_GPIO
+
+static struct gpio_chip twl_gpiochip;
+static int twl4030_gpio_irq_base;
+static int twl4030_gpio_irq_end;
+
 
 /* BitField Definitions */
 
@@ -130,7 +139,7 @@
 #define GPIO_32_MASK   

[PATCH 5/8] i2c: move twl4030-usb to platform_device

2008-09-26 Thread Felipe Balbi
use new style twl4030-core to register a platform_device
for twl4030-usb.

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/board-2430sdp.c |6 +
 arch/arm/mach-omap2/board-3430sdp.c |5 +
 arch/arm/mach-omap2/board-ldp.c |7 +
 arch/arm/mach-omap2/board-omap2evm.c|5 +
 arch/arm/mach-omap2/board-omap3beagle.c |7 +
 arch/arm/mach-omap2/board-omap3evm.c|6 +-
 drivers/i2c/chips/Kconfig   |   16 --
 drivers/i2c/chips/twl4030-core.c|   27 +++
 drivers/i2c/chips/twl4030-usb.c |  328 ++-
 include/linux/i2c/twl4030.h |   10 +
 10 files changed, 217 insertions(+), 200 deletions(-)

diff --git a/arch/arm/mach-omap2/board-2430sdp.c 
b/arch/arm/mach-omap2/board-2430sdp.c
index 8c4c9dd..f35c252 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -344,12 +344,18 @@ static struct omap_board_config_kernel sdp2430_config[] 
__initdata = {
{OMAP_TAG_SERIAL_CONSOLE, sdp2430_serial_console_config},
 };
 
+
+static struct twl4030_usb_data sdp2430_usb_data = {
+   .usb_mode   = T2_MODE_ULPI,
+};
+
 static struct twl4030_platform_data sdp2430_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
 
/* platform_data for children goes here */
.keypad = sdp2430_kp_data,
+   .usb= sdp2430_usb_data,
 };
 
 static struct i2c_board_info __initdata sdp2430_i2c_boardinfo[] = {
diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index fe1ba4e..e0c39c2 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -300,12 +300,17 @@ static struct omap_board_config_kernel sdp3430_config[] 
__initdata = {
{ OMAP_TAG_LCD, sdp3430_lcd_config },
 };
 
+static struct twl4030_usb_data sdp3430_usb_data = {
+   .usb_mode   = T2_USB_MODE_ULPI,
+};
+
 static struct twl4030_platform_data sdp3430_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
 
/* platform_data for children goes here */
.keypad = sdp3430_kp_data,
+   .usb= sdp3430_usb_data,
 };
 
 static struct i2c_board_info __initdata sdp3430_i2c_boardinfo[] = {
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index c07c712..219579b 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -183,9 +183,16 @@ static struct omap_board_config_kernel ldp_config[] 
__initdata = {
{ OMAP_TAG_UART,ldp_uart_config },
 };
 
+static struct twl4030_usb_data ldp_usb_data = {
+   .usb_mode   = T2_USB_MODE_ULPI,
+};
+
 static struct twl4030_platform_data ldp_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
+
+   /* platform_data for children goes here */
+   .usb= ldp_usb_data,
 };
 
 static struct i2c_board_info __initdata ldp_i2c_boardinfo[] = {
diff --git a/arch/arm/mach-omap2/board-omap2evm.c 
b/arch/arm/mach-omap2/board-omap2evm.c
index d2a3743..be8348d 100644
--- a/arch/arm/mach-omap2/board-omap2evm.c
+++ b/arch/arm/mach-omap2/board-omap2evm.c
@@ -226,12 +226,17 @@ static struct omap_board_config_kernel omap2_evm_config[] 
__initdata = {
{ OMAP_TAG_LCD, omap2_evm_lcd_config },
 };
 
+static struct twl4030_usb_data omap2evm_usb_data = {
+   .usb_mode   = T2_USB_MODE_ULPI,
+};
+
 static struct twl4030_platform_data omap2evm_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
 
/* platform_data for children goes here */
.keypad = omap2evm_kp_data,
+   .usb= omap2evm_usb_data,
 };
 
 static struct i2c_board_info __initdata omap2evm_i2c_boardinfo[] = {
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c 
b/arch/arm/mach-omap2/board-omap3beagle.c
index fa8f5f6..ae677b9 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -110,9 +110,16 @@ static struct omap_uart_config omap3_beagle_uart_config 
__initdata = {
.enabled_uarts  = ((1  0) | (1  1) | (1  2)),
 };
 
+static struct twl4030_usb_data beagle_usb_data = {
+   .usb_mode   = T2_USB_MODE_ULPI,
+};
+
 static struct twl4030_platform_data beagle_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
+
+   /* platform_data for children goes here */
+   .usb= beagle_usb_data,
 };
 
 static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = {
diff --git a/arch/arm/mach-omap2/board-omap3evm.c 
b/arch/arm/mach-omap2/board-omap3evm.c
index c4a969d..158138c 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -90,6 +90,10 @@ static struct omap_uart_config omap3_evm_uart_config 

Re: [PATCH 5/8] i2c: move twl4030-usb to platform_device

2008-09-26 Thread Felipe Balbi
On Fri, Sep 26, 2008 at 12:40:58PM +0300, Felipe Balbi wrote:
 use new style twl4030-core to register a platform_device
 for twl4030-usb.
 
 Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
 ---
  arch/arm/mach-omap2/board-2430sdp.c |6 +
  arch/arm/mach-omap2/board-3430sdp.c |5 +
  arch/arm/mach-omap2/board-ldp.c |7 +
  arch/arm/mach-omap2/board-omap2evm.c|5 +
  arch/arm/mach-omap2/board-omap3beagle.c |7 +
  arch/arm/mach-omap2/board-omap3evm.c|6 +-
  drivers/i2c/chips/Kconfig   |   16 --
  drivers/i2c/chips/twl4030-core.c|   27 +++
  drivers/i2c/chips/twl4030-usb.c |  328 
 ++-
  include/linux/i2c/twl4030.h |   10 +
  10 files changed, 217 insertions(+), 200 deletions(-)
 
 diff --git a/arch/arm/mach-omap2/board-2430sdp.c 
 b/arch/arm/mach-omap2/board-2430sdp.c
 index 8c4c9dd..f35c252 100644
 --- a/arch/arm/mach-omap2/board-2430sdp.c
 +++ b/arch/arm/mach-omap2/board-2430sdp.c
 @@ -344,12 +344,18 @@ static struct omap_board_config_kernel sdp2430_config[] 
 __initdata = {
   {OMAP_TAG_SERIAL_CONSOLE, sdp2430_serial_console_config},
  };
  
 +
 +static struct twl4030_usb_data sdp2430_usb_data = {
 + .usb_mode   = T2_MODE_ULPI,
 +};
 +
  static struct twl4030_platform_data sdp2430_twldata = {
   .irq_base   = TWL4030_IRQ_BASE,
   .irq_end= TWL4030_IRQ_END,
  
   /* platform_data for children goes here */
   .keypad = sdp2430_kp_data,
 + .usb= sdp2430_usb_data,
  };
  
  static struct i2c_board_info __initdata sdp2430_i2c_boardinfo[] = {
 diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
 b/arch/arm/mach-omap2/board-3430sdp.c
 index fe1ba4e..e0c39c2 100644
 --- a/arch/arm/mach-omap2/board-3430sdp.c
 +++ b/arch/arm/mach-omap2/board-3430sdp.c
 @@ -300,12 +300,17 @@ static struct omap_board_config_kernel sdp3430_config[] 
 __initdata = {
   { OMAP_TAG_LCD, sdp3430_lcd_config },
  };
  
 +static struct twl4030_usb_data sdp3430_usb_data = {
 + .usb_mode   = T2_USB_MODE_ULPI,
 +};
 +
  static struct twl4030_platform_data sdp3430_twldata = {
   .irq_base   = TWL4030_IRQ_BASE,
   .irq_end= TWL4030_IRQ_END,
  
   /* platform_data for children goes here */
   .keypad = sdp3430_kp_data,
 + .usb= sdp3430_usb_data,
  };
  
  static struct i2c_board_info __initdata sdp3430_i2c_boardinfo[] = {
 diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
 index c07c712..219579b 100644
 --- a/arch/arm/mach-omap2/board-ldp.c
 +++ b/arch/arm/mach-omap2/board-ldp.c
 @@ -183,9 +183,16 @@ static struct omap_board_config_kernel ldp_config[] 
 __initdata = {
   { OMAP_TAG_UART,ldp_uart_config },
  };
  
 +static struct twl4030_usb_data ldp_usb_data = {
 + .usb_mode   = T2_USB_MODE_ULPI,
 +};
 +
  static struct twl4030_platform_data ldp_twldata = {
   .irq_base   = TWL4030_IRQ_BASE,
   .irq_end= TWL4030_IRQ_END,
 +
 + /* platform_data for children goes here */
 + .usb= ldp_usb_data,
  };
  
  static struct i2c_board_info __initdata ldp_i2c_boardinfo[] = {
 diff --git a/arch/arm/mach-omap2/board-omap2evm.c 
 b/arch/arm/mach-omap2/board-omap2evm.c
 index d2a3743..be8348d 100644
 --- a/arch/arm/mach-omap2/board-omap2evm.c
 +++ b/arch/arm/mach-omap2/board-omap2evm.c
 @@ -226,12 +226,17 @@ static struct omap_board_config_kernel 
 omap2_evm_config[] __initdata = {
   { OMAP_TAG_LCD, omap2_evm_lcd_config },
  };
  
 +static struct twl4030_usb_data omap2evm_usb_data = {
 + .usb_mode   = T2_USB_MODE_ULPI,
 +};
 +
  static struct twl4030_platform_data omap2evm_twldata = {
   .irq_base   = TWL4030_IRQ_BASE,
   .irq_end= TWL4030_IRQ_END,
  
   /* platform_data for children goes here */
   .keypad = omap2evm_kp_data,
 + .usb= omap2evm_usb_data,
  };
  
  static struct i2c_board_info __initdata omap2evm_i2c_boardinfo[] = {
 diff --git a/arch/arm/mach-omap2/board-omap3beagle.c 
 b/arch/arm/mach-omap2/board-omap3beagle.c
 index fa8f5f6..ae677b9 100644
 --- a/arch/arm/mach-omap2/board-omap3beagle.c
 +++ b/arch/arm/mach-omap2/board-omap3beagle.c
 @@ -110,9 +110,16 @@ static struct omap_uart_config omap3_beagle_uart_config 
 __initdata = {
   .enabled_uarts  = ((1  0) | (1  1) | (1  2)),
  };
  
 +static struct twl4030_usb_data beagle_usb_data = {
 + .usb_mode   = T2_USB_MODE_ULPI,
 +};
 +
  static struct twl4030_platform_data beagle_twldata = {
   .irq_base   = TWL4030_IRQ_BASE,
   .irq_end= TWL4030_IRQ_END,
 +
 + /* platform_data for children goes here */
 + .usb= beagle_usb_data,
  };
  
  static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = {
 diff --git a/arch/arm/mach-omap2/board-omap3evm.c 
 b/arch/arm/mach-omap2/board-omap3evm.c
 index c4a969d..158138c 100644
 --- 

Re: [PATCH 5/8] i2c: move twl4030-usb to platform_device

2008-09-26 Thread Felipe Balbi
On Fri, Sep 26, 2008 at 01:33:47PM +0300, Felipe Balbi wrote:
 -static void __exit twl4030_usb_exit(void)
 +static int __exit twl4030_usb_remove(struct platform_device *pdev)
  {
 - struct twl4030_usb *twl = the_transceiver;
 + struct twl4030_usb *twl = dev_get_drvdata(pdev-dev);

Damn, forgot this one. I'll resend the whole series soon. I'm converting
twl4030-madc to platform_device. Ignore this series.

-- 
balbi
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: MMC broken on beagleboard with current git

2008-09-26 Thread Tony Lindgren
* Tony Lindgren [EMAIL PROTECTED] [080926 10:40]:
 * Steve Sakoman [EMAIL PROTECTED] [080925 18:24]:
  On Thu, Sep 25, 2008 at 3:39 AM, Tony Lindgren [EMAIL PROTECTED] wrote:
  
   Hmm, I don't understand how it could work on 3430sdp...
  
   Looks like board-omap3beagle.c calls hsmmc_init() just like
   board-3430sdp.c. Maybe timings have changed and you need
   a longer delay somewhere during the init?
  
  I can confirm that mmc is also broken on Overo.  I'll spend some time
  today investigating.
 
 I'll double check on omap3430sdp.

Hmm, MMC does not seem to work any longer on 3430sdp either. I guess I
have broken it, sorry.

I've also confirmed that undoing c434c15d28c82d92e55897bd265c423e9ab69362
makes it work again.

I swear it was working when I last tested it.. I'll try to debug it
further, but I may not get to it for real until on Monday.

I still suspect some timing change caused by the init changes..

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/9] twl4030: fix potential null pointer dereference

2008-09-26 Thread Felipe Balbi
The following patch fix a potential null pointer
dereference in twl4030 keypad driver when parts
of keypad platform_data aren't passed down to the
driver. At that point kp-dbg_dev is not set yet.

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
---
 drivers/input/keyboard/omap-twl4030keypad.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/input/keyboard/omap-twl4030keypad.c 
b/drivers/input/keyboard/omap-twl4030keypad.c
index 3893d63..48f29d3 100644
--- a/drivers/input/keyboard/omap-twl4030keypad.c
+++ b/drivers/input/keyboard/omap-twl4030keypad.c
@@ -238,7 +238,7 @@ static int __init omap_kp_probe(struct platform_device 
*pdev)
return -ENOMEM;
 
if (!pdata-rows || !pdata-cols || !pdata-keymap) {
-   dev_err(kp-dbg_dev, No rows, cols or keymap from pdata\n);
+   dev_err(pdev-dev, No rows, cols or keymap from pdata\n);
kfree(kp);
return -EINVAL;
}
-- 
1.6.0.2.307.gc427

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


[PATCH 0/9] twl4030 updates

2008-09-26 Thread Felipe Balbi
Resending the series with madc conversion done and
another updates that I missed previously from Dave's
comments.

*** NOTE: I didn't test the madc changes (besides compile testing)
since I don't have code for testing that.

Maybe Mikko Ylinen could help us with that.

David Brownell (2):
  twl4030 gpio platform data
  twl4030 uses gpiolib

Felipe Balbi (6):
  twl4030: fix potential null pointer dereference
  i2c: clean add_children a bit
  i2c: move twl4030_keypad to new style registration
  i2c: move twl4030-usb to platform_device
  i2c: twl4030-usb: add 'vbus' sysfs file
  i2c: move twl4030-madc to new registration style

Jagadeesh Bhaskar Pakaravoor (1):
  twl4030-gpio: Remove default pullup enable/disable of GPIO

 arch/arm/mach-omap2/board-2430sdp.c |   33 ++-
 arch/arm/mach-omap2/board-3430sdp.c |   32 ++-
 arch/arm/mach-omap2/board-ldp.c |   20 ++
 arch/arm/mach-omap2/board-omap2evm.c|   34 ++-
 arch/arm/mach-omap2/board-omap3beagle.c |   25 ++
 arch/arm/mach-omap2/board-omap3evm.c|   86 ---
 arch/arm/mach-omap2/board-overo.c   |   13 +
 drivers/i2c/chips/Kconfig   |   18 +--
 drivers/i2c/chips/twl4030-core.c|  186 --
 drivers/i2c/chips/twl4030-gpio.c|  278 ++--
 drivers/i2c/chips/twl4030-madc.c|  243 +++---
 drivers/i2c/chips/twl4030-usb.c |  373 ++-
 drivers/input/keyboard/omap-twl4030keypad.c |8 +-
 include/linux/i2c/twl4030.h |   46 -
 14 files changed, 922 insertions(+), 473 deletions(-)

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


[PATCH 4/9] i2c: move twl4030_keypad to new style registration

2008-09-26 Thread Felipe Balbi
let twl4030-core.c take care of twl4030_keypad registration.

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/board-2430sdp.c |   14 ++
 arch/arm/mach-omap2/board-3430sdp.c |   14 ++
 arch/arm/mach-omap2/board-omap2evm.c|   16 ++
 arch/arm/mach-omap2/board-omap3evm.c|   69 --
 drivers/i2c/chips/twl4030-core.c|   27 ++
 drivers/input/keyboard/omap-twl4030keypad.c |6 +-
 include/linux/i2c/twl4030.h |   10 
 7 files changed, 85 insertions(+), 71 deletions(-)

diff --git a/arch/arm/mach-omap2/board-2430sdp.c 
b/arch/arm/mach-omap2/board-2430sdp.c
index 3649a94..8c4c9dd 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -173,7 +173,7 @@ static int sdp2430_keymap[] = {
0
 };
 
-static struct omap_kp_platform_data sdp2430_kp_data = {
+static struct twl4030_keypad_data sdp2430_kp_data = {
.rows   = 5,
.cols   = 6,
.keymap = sdp2430_keymap,
@@ -182,14 +182,6 @@ static struct omap_kp_platform_data sdp2430_kp_data = {
.irq= TWL4030_MODIRQ_KEYPAD,
 };
 
-static struct platform_device sdp2430_kp_device = {
-   .name   = omap_twl4030keypad,
-   .id = -1,
-   .dev= {
-   .platform_data  = sdp2430_kp_data,
-   },
-};
-
 static int __init msecure_init(void)
 {
int ret = 0;
@@ -216,7 +208,6 @@ out:
 static struct platform_device *sdp2430_devices[] __initdata = {
sdp2430_smc91x_device,
sdp2430_flash_device,
-   sdp2430_kp_device,
sdp2430_lcd_device,
 };
 
@@ -356,6 +347,9 @@ static struct omap_board_config_kernel sdp2430_config[] 
__initdata = {
 static struct twl4030_platform_data sdp2430_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
+
+   /* platform_data for children goes here */
+   .keypad = sdp2430_kp_data,
 };
 
 static struct i2c_board_info __initdata sdp2430_i2c_boardinfo[] = {
diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index 4c60d7b..fe1ba4e 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -110,7 +110,7 @@ static int sdp3430_keymap[] = {
0
 };
 
-static struct omap_kp_platform_data sdp3430_kp_data = {
+static struct twl4030_keypad_data sdp3430_kp_data = {
.rows   = 5,
.cols   = 6,
.keymap = sdp3430_keymap,
@@ -119,14 +119,6 @@ static struct omap_kp_platform_data sdp3430_kp_data = {
.irq= TWL4030_MODIRQ_KEYPAD,
 };
 
-static struct platform_device sdp3430_kp_device = {
-   .name   = omap_twl4030keypad,
-   .id = -1,
-   .dev= {
-   .platform_data  = sdp3430_kp_data,
-   },
-};
-
 static int ts_gpio;
 
 static int __init msecure_init(void)
@@ -252,7 +244,6 @@ static struct platform_device sdp3430_lcd_device = {
 
 static struct platform_device *sdp3430_devices[] __initdata = {
sdp3430_smc91x_device,
-   sdp3430_kp_device,
sdp3430_lcd_device,
 };
 
@@ -312,6 +303,9 @@ static struct omap_board_config_kernel sdp3430_config[] 
__initdata = {
 static struct twl4030_platform_data sdp3430_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
+
+   /* platform_data for children goes here */
+   .keypad = sdp3430_kp_data,
 };
 
 static struct i2c_board_info __initdata sdp3430_i2c_boardinfo[] = {
diff --git a/arch/arm/mach-omap2/board-omap2evm.c 
b/arch/arm/mach-omap2/board-omap2evm.c
index 6ce7740..d2a3743 100644
--- a/arch/arm/mach-omap2/board-omap2evm.c
+++ b/arch/arm/mach-omap2/board-omap2evm.c
@@ -200,23 +200,15 @@ static int omap2evm_keymap[] = {
KEY(3, 3, KEY_P)
 };
 
-static struct omap_kp_platform_data omap2evm_kp_data = {
+static struct twl4030_keypad_data omap2evm_kp_data = {
.rows   = 4,
.cols   = 4,
-   .keymap = omap2evm_keymap,
+   .keymap = omap2evm_keymap,
.keymapsize = ARRAY_SIZE(omap2evm_keymap),
.rep= 1,
.irq= TWL4030_MODIRQ_KEYPAD,
 };
 
-static struct platform_device omap2evm_kp_device = {
-   .name   = omap_twl4030keypad,
-   .id = -1,
-   .dev= {
-   .platform_data = omap2evm_kp_data,
-   },
-};
-
 static void __init omap2_evm_init_irq(void)
 {
omap2_init_common_hw(NULL);
@@ -237,6 +229,9 @@ static struct omap_board_config_kernel omap2_evm_config[] 
__initdata = {
 static struct twl4030_platform_data omap2evm_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
+
+   /* platform_data for children goes here */
+   .keypad  

[PATCH 6/9] i2c: twl4030-usb: add 'vbus' sysfs file

2008-09-26 Thread Felipe Balbi
vbus sysfs file will report the state of vbus irq coming from
twl4030-usb.

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
---
 drivers/i2c/chips/twl4030-usb.c |   51 ++-
 1 files changed, 50 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/chips/twl4030-usb.c b/drivers/i2c/chips/twl4030-usb.c
index d150805..3a5aa52 100644
--- a/drivers/i2c/chips/twl4030-usb.c
+++ b/drivers/i2c/chips/twl4030-usb.c
@@ -29,6 +29,8 @@
 #include linux/time.h
 #include linux/interrupt.h
 #include linux/platform_device.h
+#include linux/spinlock.h
+#include linux/workqueue.h
 #include linux/io.h
 #include linux/usb.h
 #include linux/usb/ch9.h
@@ -259,11 +261,17 @@
 
 
 struct twl4030_usb {
+   struct work_struct  irq_work;
struct otg_transceiver  otg;
struct device   *dev;
 
+   /* for vbus reporting with irqs disabled */
+   spinlock_t  lock;
+
/* pin configuration */
enum twl4030_usb_mode   usb_mode;
+
+   unsignedvbus:1;
int irq;
u8  asleep;
 };
@@ -529,6 +537,29 @@ static void twl4030_usb_ldo_init(struct twl4030_usb *twl)
twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, PROTECT_KEY);
 }
 
+static ssize_t twl4030_usb_vbus_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct twl4030_usb *twl = dev_get_drvdata(dev);
+   unsigned long flags;
+   int ret = -EINVAL;
+
+   spin_lock_irqsave(twl-lock, flags);
+   ret = sprintf(buf, %s\n, twl-vbus ? on : off);
+   spin_unlock_irqrestore(twl-lock, flags);
+
+   return ret;
+}
+static DEVICE_ATTR(vbus, 0444, twl4030_usb_vbus_show, NULL);
+
+static void twl4030_usb_irq_work(struct work_struct *work)
+{
+   struct twl4030_usb *twl = container_of(work,
+   struct twl4030_usb, irq_work);
+
+   sysfs_notify(twl-dev-kobj, NULL, vbus);
+}
+
 static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
 {
struct twl4030_usb *twl = _twl;
@@ -541,10 +572,13 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
if (val  USB_PRES_RISING) {
twl4030_phy_resume(twl);
twl4030charger_usb_en(1);
+   twl-vbus = 1;
} else {
twl4030charger_usb_en(0);
+   twl-vbus = 0;
twl4030_phy_suspend(twl, 0);
}
+   schedule_work(twl-irq_work);
 
return IRQ_HANDLED;
 }
@@ -634,16 +668,22 @@ static int __init twl4030_usb_probe(struct 
platform_device *pdev)
struct twl4030_usb_data *pdata = pdev-dev.platform_data;
struct twl4030_usb  *twl;
int status;
+   u8  vbus;
 
twl = kzalloc(sizeof *twl, GFP_KERNEL);
if (!twl)
return -ENOMEM;
 
+   WARN_ON(twl4030_i2c_read_u8(TWL4030_MODULE_INT,
+   vbus, REG_PWR_EDR1)  0);
+   vbus = USB_PRES_RISING;
+
twl-dev= pdev-dev;
twl-irq= TWL4030_PWRIRQ_USB_PRES;
twl-otg.set_host   = twl4030_set_host;
twl-otg.set_peripheral = twl4030_set_peripheral;
twl-otg.set_suspend= twl4030_set_suspend;
+   twl-vbus   = vbus ? 1 : 0;
 
if (!pdata) {
dev_info(pdev-dev, platform_data not available, defaulting
@@ -653,6 +693,12 @@ static int __init twl4030_usb_probe(struct platform_device 
*pdev)
twl-usb_mode   = pdata-usb_mode;
}
 
+   /* init spinlock for workqueue */
+   spin_lock_init(twl-lock);
+
+   /* init irq workqueue before request_irq */
+   INIT_WORK(twl-irq_work, twl4030_usb_irq_work);
+
usb_irq_disable(twl);
status = request_irq(twl-irq, twl4030_usb_irq, 0, twl4030_usb, twl);
if (status  0) {
@@ -662,7 +708,6 @@ static int __init twl4030_usb_probe(struct platform_device 
*pdev)
return status;
}
 
-
twl4030_usb_ldo_init(twl);
twl4030_phy_power(twl, 1);
twl4030_i2c_access(twl, 1);
@@ -679,6 +724,9 @@ static int __init twl4030_usb_probe(struct platform_device 
*pdev)
platform_set_drvdata(pdev, twl);
dev_info(pdev-dev, Initialized TWL4030 USB module\n);
 
+   if (device_create_file(pdev-dev, dev_attr_vbus))
+   dev_warn(pdev-dev, could not create sysfs file\n);
+
return 0;
 }
 
@@ -689,6 +737,7 @@ static int __exit twl4030_usb_remove(struct platform_device 
*pdev)
 
usb_irq_disable(twl);
free_irq(twl-irq, twl);
+   device_remove_file(twl-dev, dev_attr_vbus);
 
/* set transceiver mode to power on defaults */
twl4030_usb_set_mode(twl, -1);
-- 
1.6.0.2.307.gc427

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


[PATCH 2/9] twl4030-gpio: Remove default pullup enable/disable of GPIO

2008-09-26 Thread Felipe Balbi
From: Jagadeesh Bhaskar Pakaravoor [EMAIL PROTECTED]

One twl4030_request_gpio() should not tamper with the pullup
enabling/disabling of the rest of the GPIOs. So removing the default
pullup values written to REG_GPIOPUPDCTR1.

Signed-off-by: Girish S G [EMAIL PROTECTED]
Signed-off-by: Jagadeesh Bhaskar Pakaravoor [EMAIL PROTECTED]
---
 drivers/i2c/chips/twl4030-gpio.c |5 -
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/chips/twl4030-gpio.c b/drivers/i2c/chips/twl4030-gpio.c
index 4d89abc..b51bed0 100644
--- a/drivers/i2c/chips/twl4030-gpio.c
+++ b/drivers/i2c/chips/twl4030-gpio.c
@@ -301,7 +301,6 @@ int twl4030_request_gpio(int gpio)
if (gpio_usage_count  (0x1  gpio))
ret = -EBUSY;
else {
-   u8 clear_pull[6] = { 0, 0, 0, 0, 0, 0 };
/* First time usage? - switch on GPIO module */
if (!gpio_usage_count) {
ret =
@@ -311,10 +310,6 @@ int twl4030_request_gpio(int gpio)
}
if (!ret)
gpio_usage_count |= (0x1  gpio);
-
-   ret =
-   twl4030_i2c_write(TWL4030_MODULE_GPIO, clear_pull,
-   REG_GPIOPUPDCTR1, 5);
}
up(gpio_sem);
return ret;
-- 
1.6.0.2.307.gc427

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


[PATCH 5/9] i2c: move twl4030-usb to platform_device

2008-09-26 Thread Felipe Balbi
use new style twl4030-core to register a platform_device
for twl4030-usb.

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/board-2430sdp.c |6 +
 arch/arm/mach-omap2/board-3430sdp.c |5 +
 arch/arm/mach-omap2/board-ldp.c |7 +
 arch/arm/mach-omap2/board-omap2evm.c|5 +
 arch/arm/mach-omap2/board-omap3beagle.c |7 +
 arch/arm/mach-omap2/board-omap3evm.c|6 +-
 drivers/i2c/chips/Kconfig   |   16 --
 drivers/i2c/chips/twl4030-core.c|   27 +++
 drivers/i2c/chips/twl4030-usb.c |  328 ++-
 include/linux/i2c/twl4030.h |   10 +
 10 files changed, 217 insertions(+), 200 deletions(-)

diff --git a/arch/arm/mach-omap2/board-2430sdp.c 
b/arch/arm/mach-omap2/board-2430sdp.c
index 8c4c9dd..f35c252 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -344,12 +344,18 @@ static struct omap_board_config_kernel sdp2430_config[] 
__initdata = {
{OMAP_TAG_SERIAL_CONSOLE, sdp2430_serial_console_config},
 };
 
+
+static struct twl4030_usb_data sdp2430_usb_data = {
+   .usb_mode   = T2_MODE_ULPI,
+};
+
 static struct twl4030_platform_data sdp2430_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
 
/* platform_data for children goes here */
.keypad = sdp2430_kp_data,
+   .usb= sdp2430_usb_data,
 };
 
 static struct i2c_board_info __initdata sdp2430_i2c_boardinfo[] = {
diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index fe1ba4e..e0c39c2 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -300,12 +300,17 @@ static struct omap_board_config_kernel sdp3430_config[] 
__initdata = {
{ OMAP_TAG_LCD, sdp3430_lcd_config },
 };
 
+static struct twl4030_usb_data sdp3430_usb_data = {
+   .usb_mode   = T2_USB_MODE_ULPI,
+};
+
 static struct twl4030_platform_data sdp3430_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
 
/* platform_data for children goes here */
.keypad = sdp3430_kp_data,
+   .usb= sdp3430_usb_data,
 };
 
 static struct i2c_board_info __initdata sdp3430_i2c_boardinfo[] = {
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index c07c712..219579b 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -183,9 +183,16 @@ static struct omap_board_config_kernel ldp_config[] 
__initdata = {
{ OMAP_TAG_UART,ldp_uart_config },
 };
 
+static struct twl4030_usb_data ldp_usb_data = {
+   .usb_mode   = T2_USB_MODE_ULPI,
+};
+
 static struct twl4030_platform_data ldp_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
+
+   /* platform_data for children goes here */
+   .usb= ldp_usb_data,
 };
 
 static struct i2c_board_info __initdata ldp_i2c_boardinfo[] = {
diff --git a/arch/arm/mach-omap2/board-omap2evm.c 
b/arch/arm/mach-omap2/board-omap2evm.c
index d2a3743..be8348d 100644
--- a/arch/arm/mach-omap2/board-omap2evm.c
+++ b/arch/arm/mach-omap2/board-omap2evm.c
@@ -226,12 +226,17 @@ static struct omap_board_config_kernel omap2_evm_config[] 
__initdata = {
{ OMAP_TAG_LCD, omap2_evm_lcd_config },
 };
 
+static struct twl4030_usb_data omap2evm_usb_data = {
+   .usb_mode   = T2_USB_MODE_ULPI,
+};
+
 static struct twl4030_platform_data omap2evm_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
 
/* platform_data for children goes here */
.keypad = omap2evm_kp_data,
+   .usb= omap2evm_usb_data,
 };
 
 static struct i2c_board_info __initdata omap2evm_i2c_boardinfo[] = {
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c 
b/arch/arm/mach-omap2/board-omap3beagle.c
index fa8f5f6..ae677b9 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -110,9 +110,16 @@ static struct omap_uart_config omap3_beagle_uart_config 
__initdata = {
.enabled_uarts  = ((1  0) | (1  1) | (1  2)),
 };
 
+static struct twl4030_usb_data beagle_usb_data = {
+   .usb_mode   = T2_USB_MODE_ULPI,
+};
+
 static struct twl4030_platform_data beagle_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
+
+   /* platform_data for children goes here */
+   .usb= beagle_usb_data,
 };
 
 static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = {
diff --git a/arch/arm/mach-omap2/board-omap3evm.c 
b/arch/arm/mach-omap2/board-omap3evm.c
index c4a969d..158138c 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -90,6 +90,10 @@ static struct omap_uart_config omap3_evm_uart_config 

[PATCH 9/9] i2c: move twl4030-madc to new registration style

2008-09-26 Thread Felipe Balbi
Moving twl4030-madc to new style registration just like
the other twl4030 children.

Cc: Mikko Ylinen [EMAIL PROTECTED]
Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/board-2430sdp.c |6 +
 arch/arm/mach-omap2/board-3430sdp.c |6 +
 arch/arm/mach-omap2/board-ldp.c |6 +
 arch/arm/mach-omap2/board-omap2evm.c|6 +
 arch/arm/mach-omap2/board-omap3beagle.c |6 +
 arch/arm/mach-omap2/board-omap3evm.c|6 +
 arch/arm/mach-omap2/board-overo.c   |6 +
 drivers/i2c/chips/twl4030-core.c|   27 
 drivers/i2c/chips/twl4030-madc.c|  243 +++
 include/linux/i2c/twl4030.h |6 +
 10 files changed, 227 insertions(+), 91 deletions(-)

diff --git a/arch/arm/mach-omap2/board-2430sdp.c 
b/arch/arm/mach-omap2/board-2430sdp.c
index 0deaf09..d7f2bb9 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -355,12 +355,18 @@ static struct twl4030_usb_data sdp2430_usb_data = {
.usb_mode   = T2_MODE_ULPI,
 };
 
+static struct twl4030_madc_platform_data sdp2430_madc_data = {
+   .imr= TWL4030_MADC_IMR1,
+   .isr= TWL4030_MADC_ISR1,
+};
+
 static struct twl4030_platform_data sdp2430_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
 
/* platform_data for children goes here */
.gpio   = sdp2430_gpio_data,
+   .madc   = sdp2430_madc_data,
.keypad = sdp2430_kp_data,
.usb= sdp2430_usb_data,
 };
diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index 66f0f98..096550a 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -310,12 +310,18 @@ static struct twl4030_usb_data sdp3430_usb_data = {
.usb_mode   = T2_USB_MODE_ULPI,
 };
 
+static struct twl4030_madc_platform_data sdp3430_madc_data = {
+   .imr= TWL4030_MADC_IMR1,
+   .isr= TWL4030_MADC_ISR1,
+};
+
 static struct twl4030_platform_data sdp3430_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
 
/* platform_data for children goes here */
.gpio   = sdp3430_gpio_data,
+   .madc   = sdp3430_madc_data,
.keypad = sdp3430_kp_data,
.usb= sdp3430_usb_data,
 };
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index 48342f4..8b92f0d 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -193,11 +193,17 @@ static struct twl4030_gpio_platform_data ldp_gpio_data = {
.irq_end= TWL4030_GPIO_IRQ_END,
 };
 
+static struct twl4030_madc_platform_data ldp_madc_data = {
+   .imr= TWL4030_MADC_IMR1,
+   .isr= TWL4030_MADC_ISR1,
+};
+
 static struct twl4030_platform_data ldp_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
 
/* platform_data for children goes here */
+   .madc   = ldp_madc_data,
.usb= ldp_usb_data,
.gpio   = ldp_gpio_data,
 };
diff --git a/arch/arm/mach-omap2/board-omap2evm.c 
b/arch/arm/mach-omap2/board-omap2evm.c
index a921cf1..9f57fe0 100644
--- a/arch/arm/mach-omap2/board-omap2evm.c
+++ b/arch/arm/mach-omap2/board-omap2evm.c
@@ -236,12 +236,18 @@ static struct twl4030_usb_data omap2evm_usb_data = {
.usb_mode   = T2_USB_MODE_ULPI,
 };
 
+static struct twl4030_madc_platform_data omap2evm_madc_data = {
+   .imr= TWL4030_MADC_IMR1,
+   .isr= TWL4030_MADC_ISR1,
+};
+
 static struct twl4030_platform_data omap2evm_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
 
/* platform_data for children goes here */
.keypad = omap2evm_kp_data,
+   .madc   = omap2evm_madc_data,
.usb= omap2evm_usb_data,
.gpio   = omap2evm_gpio_data,
 };
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c 
b/arch/arm/mach-omap2/board-omap3beagle.c
index aa5e9a6..ba6e87a 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -114,6 +114,11 @@ static struct twl4030_usb_data beagle_usb_data = {
.usb_mode   = T2_USB_MODE_ULPI,
 };
 
+static struct twl4030_madc_platform_data beagle_madc_data = {
+   .imr= TWL4030_MADC_IMR1,
+   .isr= TWL4030_MADC_ISR1,
+};
+
 static struct twl4030_gpio_platform_data beagle_gpio_data = {
.gpio_base  = OMAP_MAX_GPIO_LINES,
.irq_base   = TWL4030_GPIO_IRQ_BASE,
@@ -130,6 +135,7 @@ static struct twl4030_platform_data beagle_twldata = {
.irq_end= TWL4030_IRQ_END,
 
/* platform_data for children goes here */
+   .madc 

[PATCH 02/16] OMAP3: GPMC context save/restore

2008-09-26 Thread Rajendra Nayak
This patch adds the context save restore functions for GPMC 

Signed-off-by: Rajendra Nayak [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/gpmc.c |   93 +
 arch/arm/plat-omap/include/mach/gpmc.h |3 +
 2 files changed, 96 insertions(+)

Index: linux-omap-2.6/arch/arm/mach-omap2/gpmc.c
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/gpmc.c  2008-09-25 
16:26:40.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/gpmc.c   2008-09-25 16:27:13.0 
+0530
@@ -54,10 +54,38 @@
 #define GPMC_CHUNK_SHIFT   24  /* 16 MB */
 #define GPMC_SECTION_SHIFT 28  /* 128 MB */
 
+/* Structure to save gpmc cs context */
+struct gpmc_cs_config {
+   u32 config1;
+   u32 config2;
+   u32 config3;
+   u32 config4;
+   u32 config5;
+   u32 config6;
+   u32 config7;
+   int is_valid;
+};
+
+/*
+ * Structure to save/restore gpmc context
+ * to support core off on OMAP3
+ */
+struct omap3_gpmc_regs {
+   u32 sysconfig;
+   u32 irqenable;
+   u32 timeout_ctrl;
+   u32 config;
+   u32 prefetch_config1;
+   u32 prefetch_config2;
+   u32 prefetch_control;
+   struct gpmc_cs_config cs_context[GPMC_CS_NUM];
+};
+
 static struct resource gpmc_mem_root;
 static struct resource gpmc_cs_mem[GPMC_CS_NUM];
 static DEFINE_SPINLOCK(gpmc_mem_lock);
 static unsignedgpmc_cs_map;
+static struct omap3_gpmc_regs gpmc_context;
 
 static void __iomem *gpmc_base;
 
@@ -451,3 +479,68 @@ void __init gpmc_init(void)
 
gpmc_mem_init();
 }
+
+#ifdef CONFIG_ARCH_OMAP3
+void omap3_gpmc_save_context()
+{
+   int i;
+   gpmc_context.sysconfig = gpmc_read_reg(GPMC_SYSCONFIG);
+   gpmc_context.irqenable = gpmc_read_reg(GPMC_IRQENABLE);
+   gpmc_context.timeout_ctrl = gpmc_read_reg(GPMC_TIMEOUT_CONTROL);
+   gpmc_context.config = gpmc_read_reg(GPMC_CONFIG);
+   gpmc_context.prefetch_config1 = gpmc_read_reg(GPMC_PREFETCH_CONFIG1);
+   gpmc_context.prefetch_config2 = gpmc_read_reg(GPMC_PREFETCH_CONFIG2);
+   gpmc_context.prefetch_control = gpmc_read_reg(GPMC_PREFETCH_CONTROL);
+   for (i = 0; i  GPMC_CS_NUM; i++) {
+   gpmc_context.cs_context[i].is_valid =
+   (gpmc_cs_read_reg(i, GPMC_CS_CONFIG7))
+GPMC_CONFIG7_CSVALID;
+   if (gpmc_context.cs_context[i].is_valid) {
+   gpmc_context.cs_context[i].config1 =
+   gpmc_cs_read_reg(i, GPMC_CS_CONFIG1);
+   gpmc_context.cs_context[i].config2 =
+   gpmc_cs_read_reg(i, GPMC_CS_CONFIG2);
+   gpmc_context.cs_context[i].config3 =
+   gpmc_cs_read_reg(i, GPMC_CS_CONFIG3);
+   gpmc_context.cs_context[i].config4 =
+   gpmc_cs_read_reg(i, GPMC_CS_CONFIG4);
+   gpmc_context.cs_context[i].config5 =
+   gpmc_cs_read_reg(i, GPMC_CS_CONFIG5);
+   gpmc_context.cs_context[i].config6 =
+   gpmc_cs_read_reg(i, GPMC_CS_CONFIG6);
+   gpmc_context.cs_context[i].config7 =
+   gpmc_cs_read_reg(i, GPMC_CS_CONFIG7);
+   }
+   }
+}
+
+void omap3_gpmc_restore_context()
+{
+   int i;
+   gpmc_write_reg(GPMC_SYSCONFIG, gpmc_context.sysconfig);
+   gpmc_write_reg(GPMC_IRQENABLE, gpmc_context.irqenable);
+   gpmc_write_reg(GPMC_TIMEOUT_CONTROL, gpmc_context.timeout_ctrl);
+   gpmc_write_reg(GPMC_CONFIG, gpmc_context.config);
+   gpmc_write_reg(GPMC_PREFETCH_CONFIG1, gpmc_context.prefetch_config1);
+   gpmc_write_reg(GPMC_PREFETCH_CONFIG2, gpmc_context.prefetch_config2);
+   gpmc_write_reg(GPMC_PREFETCH_CONTROL, gpmc_context.prefetch_control);
+   for (i = 0; i  GPMC_CS_NUM; i++) {
+   if (gpmc_context.cs_context[i].is_valid) {
+   gpmc_cs_write_reg(i, GPMC_CS_CONFIG1,
+   gpmc_context.cs_context[i].config1);
+   gpmc_cs_write_reg(i, GPMC_CS_CONFIG2,
+   gpmc_context.cs_context[i].config2);
+   gpmc_cs_write_reg(i, GPMC_CS_CONFIG3,
+   gpmc_context.cs_context[i].config3);
+   gpmc_cs_write_reg(i, GPMC_CS_CONFIG4,
+   gpmc_context.cs_context[i].config4);
+   gpmc_cs_write_reg(i, GPMC_CS_CONFIG5,
+   gpmc_context.cs_context[i].config5);
+   gpmc_cs_write_reg(i, GPMC_CS_CONFIG6,
+   gpmc_context.cs_context[i].config6);
+   gpmc_cs_write_reg(i, GPMC_CS_CONFIG7,
+   

[PATCH 03/16] OMAP3: Serial context save/restore

2008-09-26 Thread Rajendra Nayak
This patch adds the context save restore functions for UART

Signed-off-by: Rajendra Nayak [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/serial.c |   65 +++
 arch/arm/plat-omap/include/mach/serial.h |4 +
 include/linux/serial_reg.h   |1 
 3 files changed, 70 insertions(+)

Index: linux-omap-2.6/arch/arm/mach-omap2/serial.c
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/serial.c2008-09-25 
16:27:11.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/serial.c 2008-09-25 16:27:13.0 
+0530
@@ -68,6 +68,17 @@ static const u32 omap3_uart_wk_bit[OMAP_
OMAP3430_ST_UART2,
OMAP3430_ST_UART3,
 };
+
+struct omap3_uart_regs {
+   u16 dll;
+   u16 dlh;
+   u16 ier;
+   u16 sysc;
+   u16 scr;
+   u16 wer;
+};
+
+static struct omap3_uart_regs uart_context[OMAP_MAX_NR_PORTS];
 #endif
 
 static const u32 *omap_uart_wk_st;
@@ -315,6 +326,60 @@ static ssize_t awake_store(struct kobjec
return n;
 }
 
+#ifdef CONFIG_ARCH_OMAP3
+void omap3_uart_save_context(int unum)
+{
+   u16 lcr = 0;
+
+   struct plat_serial8250_port *p = serial_platform_data + unum;
+
+   if (uart_ick[unum] == NULL)
+   return;
+
+   lcr = serial_read_reg(p, UART_LCR);
+   serial_write_reg(p, UART_LCR, 0xBF);
+   uart_context[unum].dll = serial_read_reg(p, UART_DLL);
+   uart_context[unum].dlh = serial_read_reg(p, UART_DLM);
+   serial_write_reg(p, UART_LCR, lcr);
+   uart_context[unum].ier = serial_read_reg(p, UART_IER);
+   uart_context[unum].sysc = serial_read_reg(p, UART_OMAP_SYSC);
+   uart_context[unum].scr = serial_read_reg(p, UART_OMAP_SCR);
+   uart_context[unum].wer = serial_read_reg(p, UART_OMAP_WER);
+}
+EXPORT_SYMBOL(omap3_uart_save_context);
+
+void omap3_uart_restore_context(int unum)
+{
+   u16 efr = 0;
+
+   struct plat_serial8250_port *p = serial_platform_data + unum;
+
+   if (uart_ick[unum] == NULL)
+   return;
+
+   serial_write_reg(p, UART_OMAP_MDR1, 0x7);
+   serial_write_reg(p, UART_LCR, 0xBF); /* Config B mode */
+   efr = serial_read_reg(p, UART_EFR);
+   serial_write_reg(p, UART_EFR, UART_EFR_ECB);
+   serial_write_reg(p, UART_LCR, 0x0); /* Operational mode */
+   serial_write_reg(p, UART_IER, 0x0);
+   serial_write_reg(p, UART_LCR, 0xBF); /* Config B mode */
+   serial_write_reg(p, UART_DLL, uart_context[unum].dll);
+   serial_write_reg(p, UART_DLM, uart_context[unum].dlh);
+   serial_write_reg(p, UART_LCR, 0x0); /* Operational mode */
+   serial_write_reg(p, UART_IER, uart_context[unum].ier);
+   serial_write_reg(p, UART_FCR, 0xA1);
+   serial_write_reg(p, UART_LCR, 0xBF); /* Config B mode */
+   serial_write_reg(p, UART_EFR, efr);
+   serial_write_reg(p, UART_LCR, UART_LCR_WLEN8);
+   serial_write_reg(p, UART_OMAP_SCR, uart_context[unum].scr);
+   serial_write_reg(p, UART_OMAP_WER, uart_context[unum].wer);
+   serial_write_reg(p, UART_OMAP_SYSC, uart_context[unum].sysc);
+   serial_write_reg(p, UART_OMAP_MDR1, 0x00); /* UART 16x mode */
+}
+EXPORT_SYMBOL(omap3_uart_restore_context);
+#endif /* CONFIG_ARCH_OMAP3 */
+
 static struct platform_device serial_device = {
.name   = serial8250,
.id = PLAT8250_DEV_PLATFORM,
Index: linux-omap-2.6/include/linux/serial_reg.h
===
--- linux-omap-2.6.orig/include/linux/serial_reg.h  2008-09-25 
16:26:40.0 +0530
+++ linux-omap-2.6/include/linux/serial_reg.h   2008-09-25 16:27:13.0 
+0530
@@ -323,6 +323,7 @@
 #define UART_OMAP_MVER 0x14/* Module version register */
 #define UART_OMAP_SYSC 0x15/* System configuration register */
 #define UART_OMAP_SYSS 0x16/* System status register */
+#define UART_OMAP_WER  0x17/* Wake-up enable register */
 
 #endif /* _LINUX_SERIAL_REG_H */
 
Index: linux-omap-2.6/arch/arm/plat-omap/include/mach/serial.h
===
--- linux-omap-2.6.orig/arch/arm/plat-omap/include/mach/serial.h
2008-09-25 16:26:40.0 +0530
+++ linux-omap-2.6/arch/arm/plat-omap/include/mach/serial.h 2008-09-25 
16:27:13.0 +0530
@@ -40,4 +40,8 @@
__ret;  \
})
 
+#ifndef __ASSEMBLY__
+extern void omap3_uart_save_context(int unum);
+extern void omap3_uart_restore_context(int unum);
+#endif /* __ASSEMBLY__ */
 #endif

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


[PATCH 04/16] OMAP3: GPIO context save/restore

2008-09-26 Thread Rajendra Nayak
This patch adds the context save restore functions for GPIO

Signed-off-by: Rajendra Nayak [EMAIL PROTECTED]
---
 arch/arm/plat-omap/gpio.c  |   93 +
 arch/arm/plat-omap/include/mach/gpio.h |3 -
 2 files changed, 95 insertions(+), 1 deletion(-)

Index: linux-omap-2.6/arch/arm/plat-omap/gpio.c
===
--- linux-omap-2.6.orig/arch/arm/plat-omap/gpio.c   2008-09-25 
16:27:09.0 +0530
+++ linux-omap-2.6/arch/arm/plat-omap/gpio.c2008-09-25 16:27:14.0 
+0530
@@ -101,6 +101,7 @@
 #define OMAP24XX_GPIO_IRQSTATUS2   0x0028
 #define OMAP24XX_GPIO_IRQENABLE2   0x002c
 #define OMAP24XX_GPIO_IRQENABLE1   0x001c
+#define OMAP24XX_GPIO_WAKE_EN  0x0020
 #define OMAP24XX_GPIO_CTRL 0x0030
 #define OMAP24XX_GPIO_OE   0x0034
 #define OMAP24XX_GPIO_DATAIN   0x0038
@@ -218,6 +219,23 @@ static struct gpio_bank gpio_bank_34xx[6
{ OMAP34XX_GPIO6_BASE, INT_34XX_GPIO_BANK6, IH_GPIO_BASE + 160, 
METHOD_GPIO_24XX },
 };
 
+struct omap3_gpio_regs {
+   u32 sysconfig;
+   u32 irqenable1;
+   u32 irqenable2;
+   u32 wake_en;
+   u32 ctrl;
+   u32 oe;
+   u32 leveldetect0;
+   u32 leveldetect1;
+   u32 risingdetect;
+   u32 fallingdetect;
+   u32 dataout;
+   u32 setwkuena;
+   u32 setdataout;
+};
+
+static struct omap3_gpio_regs gpio_context[OMAP34XX_NR_GPIOS];
 #endif
 
 static struct gpio_bank *gpio_bank;
@@ -1711,6 +1729,81 @@ void omap2_gpio_resume_after_retention(v
 
 #endif
 
+#ifdef CONFIG_ARCH_OMAP34XX
+/* save the registers of bank 2-6 */
+void omap3_gpio_save_context(void)
+{
+   int i;
+   /* saving banks from 2-6 only */
+   for (i = 1; i  gpio_bank_count; i++) {
+   struct gpio_bank *bank = gpio_bank[i];
+   gpio_context[i].sysconfig =
+   __raw_readl(bank-base + OMAP24XX_GPIO_SYSCONFIG);
+   gpio_context[i].irqenable1 =
+   __raw_readl(bank-base + OMAP24XX_GPIO_IRQENABLE1);
+   gpio_context[i].irqenable2 =
+   __raw_readl(bank-base + OMAP24XX_GPIO_IRQENABLE2);
+   gpio_context[i].wake_en =
+   __raw_readl(bank-base + OMAP24XX_GPIO_WAKE_EN);
+   gpio_context[i].ctrl =
+   __raw_readl(bank-base + OMAP24XX_GPIO_CTRL);
+   gpio_context[i].oe =
+   __raw_readl(bank-base + OMAP24XX_GPIO_OE);
+   gpio_context[i].leveldetect0 =
+   __raw_readl(bank-base + OMAP24XX_GPIO_LEVELDETECT0);
+   gpio_context[i].leveldetect1 =
+   __raw_readl(bank-base + OMAP24XX_GPIO_LEVELDETECT1);
+   gpio_context[i].risingdetect =
+   __raw_readl(bank-base + OMAP24XX_GPIO_RISINGDETECT);
+   gpio_context[i].fallingdetect =
+   __raw_readl(bank-base + OMAP24XX_GPIO_FALLINGDETECT);
+   gpio_context[i].dataout =
+   __raw_readl(bank-base + OMAP24XX_GPIO_DATAOUT);
+   gpio_context[i].setwkuena =
+   __raw_readl(bank-base + OMAP24XX_GPIO_SETWKUENA);
+   gpio_context[i].setdataout =
+   __raw_readl(bank-base + OMAP24XX_GPIO_SETDATAOUT);
+   }
+}
+EXPORT_SYMBOL(omap3_gpio_save_context);
+
+/* restore the required registers of bank 2-6 */
+void omap3_gpio_restore_context(void)
+{
+   int i;
+   for (i = 1; i  gpio_bank_count; i++) {
+   struct gpio_bank *bank = gpio_bank[i];
+   __raw_writel(gpio_context[i].sysconfig,
+   bank-base + OMAP24XX_GPIO_SYSCONFIG);
+   __raw_writel(gpio_context[i].irqenable1,
+   bank-base + OMAP24XX_GPIO_IRQENABLE1);
+   __raw_writel(gpio_context[i].irqenable2,
+   bank-base + OMAP24XX_GPIO_IRQENABLE2);
+   __raw_writel(gpio_context[i].wake_en,
+   bank-base + OMAP24XX_GPIO_WAKE_EN);
+   __raw_writel(gpio_context[i].ctrl,
+   bank-base + OMAP24XX_GPIO_CTRL);
+   __raw_writel(gpio_context[i].oe,
+   bank-base + OMAP24XX_GPIO_OE);
+   __raw_writel(gpio_context[i].leveldetect0,
+   bank-base + OMAP24XX_GPIO_LEVELDETECT0);
+   __raw_writel(gpio_context[i].leveldetect1,
+   bank-base + OMAP24XX_GPIO_LEVELDETECT1);
+   __raw_writel(gpio_context[i].risingdetect,
+   bank-base + OMAP24XX_GPIO_RISINGDETECT);
+   __raw_writel(gpio_context[i].fallingdetect,
+   bank-base + OMAP24XX_GPIO_FALLINGDETECT);
+   __raw_writel(gpio_context[i].dataout,
+   

[PATCH 05/16] OMAP3: I2C context save/restore

2008-09-26 Thread Rajendra Nayak
This patch does i2c init/re-init for every transfer.
Avoids a i2c controller reset every time

Signed-off-by: Jouni Hogander [EMAIL PROTECTED]
Signed-off-by: Rajendra Nayak [EMAIL PROTECTED]
---
 drivers/i2c/busses/i2c-omap.c |   41 +++--
 1 files changed, 27 insertions(+), 14 deletions(-)

Index: linux-omap-2.6/drivers/i2c/busses/i2c-omap.c
===
--- linux-omap-2.6.orig/drivers/i2c/busses/i2c-omap.c   2008-09-25 
16:26:40.0 +0530
+++ linux-omap-2.6/drivers/i2c/busses/i2c-omap.c2008-09-25 
16:27:14.0 +0530
@@ -147,6 +147,10 @@ struct omap_i2c_dev {
unsignedb_hw:1; /* bad h/w fixes */
unsignedidle:1;
u16 iestate;/* Saved interrupt register */
+   u16 pscstate;
+   u16 scllstate;
+   u16 sclhstate;
+   u16 bufstate;
 };
 
 static inline void omap_i2c_write_reg(struct omap_i2c_dev *i2c_dev,
@@ -209,16 +213,20 @@ static void omap_i2c_unidle(struct omap_
if (dev-iclk != NULL)
clk_enable(dev-iclk);
clk_enable(dev-fclk);
+   if (cpu_is_omap34xx()) {
+   omap_i2c_write_reg(dev, OMAP_I2C_PSC_REG, dev-pscstate);
+   omap_i2c_write_reg(dev, OMAP_I2C_SCLL_REG, dev-scllstate);
+   omap_i2c_write_reg(dev, OMAP_I2C_SCLH_REG, dev-sclhstate);
+   omap_i2c_write_reg(dev, OMAP_I2C_BUF_REG, dev-bufstate);
+   }
dev-idle = 0;
-   if (dev-iestate)
-   omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev-iestate);
+   omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev-iestate);
 }
 
 static void omap_i2c_idle(struct omap_i2c_dev *dev)
 {
u16 iv;
 
-   dev-iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0);
if (dev-rev1)
iv = omap_i2c_read_reg(dev, OMAP_I2C_IV_REG);
@@ -238,7 +246,7 @@ static void omap_i2c_idle(struct omap_i2
 
 static int omap_i2c_init(struct omap_i2c_dev *dev)
 {
-   u16 psc = 0, scll = 0, sclh = 0;
+   u16 psc = 0, scll = 0, sclh = 0, buf = 0;
u16 fsscll = 0, fssclh = 0, hsscll = 0, hssclh = 0;
unsigned long fclk_rate = 1200;
unsigned long timeout;
@@ -327,23 +335,28 @@ static int omap_i2c_init(struct omap_i2c
omap_i2c_write_reg(dev, OMAP_I2C_SCLL_REG, scll);
omap_i2c_write_reg(dev, OMAP_I2C_SCLH_REG, sclh);
 
-   if (dev-fifo_size)
-   /* Note: setup required fifo size - 1 */
-   omap_i2c_write_reg(dev, OMAP_I2C_BUF_REG,
-   (dev-fifo_size - 1)  8 | /* RTRSH */
-   OMAP_I2C_BUF_RXFIF_CLR |
-   (dev-fifo_size - 1) | /* XTRSH */
-   OMAP_I2C_BUF_TXFIF_CLR);
+   if (dev-fifo_size) {
+   /* Note: setup required fifo size - 1. RTRSH and XTRSH */
+   buf = (dev-fifo_size - 1)  8 | OMAP_I2C_BUF_RXFIF_CLR |
+   (dev-fifo_size - 1) | OMAP_I2C_BUF_TXFIF_CLR;
+   omap_i2c_write_reg(dev, OMAP_I2C_BUF_REG, buf);
+   }
 
/* Take the I2C module out of reset: */
omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
 
/* Enable interrupts */
-   omap_i2c_write_reg(dev, OMAP_I2C_IE_REG,
-   (OMAP_I2C_IE_XRDY | OMAP_I2C_IE_RRDY |
+   dev-iestate = (OMAP_I2C_IE_XRDY | OMAP_I2C_IE_RRDY |
OMAP_I2C_IE_ARDY | OMAP_I2C_IE_NACK |
OMAP_I2C_IE_AL)  | ((dev-fifo_size) ?
-   (OMAP_I2C_IE_RDR | OMAP_I2C_IE_XDR) : 0));
+   (OMAP_I2C_IE_RDR | OMAP_I2C_IE_XDR) : 0);
+   omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev-iestate);
+   if (cpu_is_omap34xx()) {
+   dev-pscstate = psc;
+   dev-scllstate = scll;
+   dev-sclhstate = sclh;
+   dev-bufstate = buf;
+   }
return 0;
 }
 

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


[PATCH 06/16] OMAP3: INTC context save/restore

2008-09-26 Thread Rajendra Nayak
This patch adds the Interrupt controller context
save/restore routines

Signed-off-by: Rajendra Nayak [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/irq.c  |   67 +
 arch/arm/plat-omap/include/mach/irqs.h |5 ++
 2 files changed, 72 insertions(+)

Index: linux-omap-2.6/arch/arm/mach-omap2/irq.c
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/irq.c   2008-09-26 
14:07:07.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/irq.c2008-09-26 14:08:23.0 
+0530
@@ -24,6 +24,10 @@
 #define INTC_SYSCONFIG 0x0010
 #define INTC_SYSSTATUS 0x0014
 #define INTC_CONTROL   0x0048
+#define INTC_PROTECTION0x004C
+#define INTC_IDLE  0x0050
+#define INTC_THRESHOLD 0x0068
+#define INTC_MIR0  0x0084
 #define INTC_MIR_CLEAR00x0088
 #define INTC_MIR_SET0  0x008c
 #define INTC_PENDING_IRQ0  0x0098
@@ -48,6 +52,18 @@ static struct omap_irq_bank {
},
 };
 
+/* Structure to save interrupt controller context */
+struct omap3_intc_regs {
+   u32 sysconfig;
+   u32 protection;
+   u32 idle;
+   u32 threshold;
+   u32 ilr[INTCPS_NR_IRQS];
+   u32 mir[INTCPS_NR_MIR_REGS];
+};
+
+static struct omap3_intc_regs intc_context[ARRAY_SIZE(irq_banks)];
+
 /* INTC bank register get/set */
 
 static void intc_bank_write_reg(u32 val, struct omap_irq_bank *bank, u16 reg)
@@ -167,3 +183,54 @@ void __init omap_init_irq(void)
}
 }
 
+#ifdef CONFIG_ARCH_OMAP3
+void omap3_intc_save_context(void)
+{
+   int ind = 0, i = 0;
+   for (ind = 0; ind  ARRAY_SIZE(irq_banks); ind++) {
+   struct omap_irq_bank *bank = irq_banks + ind;
+   intc_context[ind].sysconfig =
+   intc_bank_read_reg(bank, INTC_SYSCONFIG);
+   intc_context[ind].protection =
+   intc_bank_read_reg(bank, INTC_PROTECTION);
+   intc_context[ind].idle =
+   intc_bank_read_reg(bank, INTC_IDLE);
+   intc_context[ind].threshold =
+   intc_bank_read_reg(bank, INTC_THRESHOLD);
+   for (i = 0; i  INTCPS_NR_IRQS; i++)
+   intc_context[ind].ilr[i] =
+   intc_bank_read_reg(bank, (0x100 + 0x4*ind));
+   for (i = 0; i  INTCPS_NR_MIR_REGS; i++)
+   intc_context[ind].mir[i] =
+   intc_bank_read_reg(irq_banks[0], INTC_MIR0 +
+   (0x20 * i));
+   }
+   /* MIRs are saved and restore with other PRCM registers */
+}
+
+void omap3_intc_restore_context(void)
+{
+   int ind = 0, i = 0;
+
+   for (ind = 0; ind  ARRAY_SIZE(irq_banks); ind++) {
+   struct omap_irq_bank *bank = irq_banks + ind;
+   intc_bank_write_reg(intc_context[ind].sysconfig,
+   bank, INTC_SYSCONFIG);
+   intc_bank_write_reg(intc_context[ind].sysconfig,
+   bank, INTC_SYSCONFIG);
+   intc_bank_write_reg(intc_context[ind].protection,
+   bank, INTC_PROTECTION);
+   intc_bank_write_reg(intc_context[ind].idle,
+   bank, INTC_IDLE);
+   intc_bank_write_reg(intc_context[ind].threshold,
+   bank, INTC_THRESHOLD);
+   for (i = 0; i  INTCPS_NR_IRQS; i++)
+   intc_bank_write_reg(intc_context[ind].ilr[i],
+   bank, (0x100 + 0x4*ind));
+   for (i = 0; i  INTCPS_NR_MIR_REGS; i++)
+   intc_bank_write_reg(intc_context[ind].mir[i],
+irq_banks[0], INTC_MIR0 + (0x20 * i));
+   }
+   /* MIRs are saved and restore with other PRCM registers */
+}
+#endif /* CONFIG_ARCH_OMAP3 */
Index: linux-omap-2.6/arch/arm/plat-omap/include/mach/irqs.h
===
--- linux-omap-2.6.orig/arch/arm/plat-omap/include/mach/irqs.h  2008-09-26 
14:07:07.0 +0530
+++ linux-omap-2.6/arch/arm/plat-omap/include/mach/irqs.h   2008-09-26 
14:07:34.0 +0530
@@ -367,9 +367,14 @@
 
 #define OMAP_IRQ_BIT(irq)  (1  ((irq) % 32))
 
+#define INTCPS_NR_MIR_REGS 3
+#define INTCPS_NR_IRQS 96
+
 #ifndef __ASSEMBLY__
 extern void omap_init_irq(void);
 extern int omap_irq_pending(void);
+void omap3_intc_save_context(void);
+void omap3_intc_restore_context(void);
 #endif
 
 #include mach/hardware.h

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


[PATCH 09/16] OMAP3: SCM context save/restore

2008-09-26 Thread Rajendra Nayak
This patch adds the System control module context save/restore

Signed-off-by: Rajendra Nayak [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/control.c |  151 ++
 arch/arm/plat-omap/include/mach/control.h |   23 
 2 files changed, 173 insertions(+), 1 deletion(-)

Index: linux-omap-2.6/arch/arm/mach-omap2/control.c
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/control.c   2008-09-26 
14:12:38.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/control.c2008-09-26 
14:16:00.0 +0530
@@ -93,6 +93,46 @@ struct omap3_scratchpad_sdrc_block {
  */
 u32 omap3_arm_context[128];
 
+struct omap3_control_regs {
+   u32 sysconfig;
+   u32 devconf0;
+   u32 mem_dftrw0;
+   u32 mem_dftrw1;
+   u32 msuspendmux_0;
+   u32 msuspendmux_1;
+   u32 msuspendmux_2;
+   u32 msuspendmux_3;
+   u32 msuspendmux_4;
+   u32 msuspendmux_5;
+   u32 sec_ctrl;
+   u32 devconf1;
+   u32 csirxfe;
+   u32 iva2_bootaddr;
+   u32 iva2_bootmod;
+   u32 debobs_0;
+   u32 debobs_1;
+   u32 debobs_2;
+   u32 debobs_3;
+   u32 debobs_4;
+   u32 debobs_5;
+   u32 debobs_6;
+   u32 debobs_7;
+   u32 debobs_8;
+   u32 prog_io0;
+   u32 prog_io1;
+   u32 dss_dpll_spreading;
+   u32 core_dpll_spreading;
+   u32 per_dpll_spreading;
+   u32 usbhost_dpll_spreading;
+   u32 pbias_lite;
+   u32 temp_sensor;
+   u32 sramldo4;
+   u32 sramldo5;
+   u32 csi;
+};
+
+static struct omap3_control_regs control_context;
+
 #define OMAP_CTRL_REGADDR(reg) (omap2_ctrl_base + (reg))
 
 void __init omap2_set_globals_control(struct omap_globals *omap2_globals)
@@ -265,4 +305,115 @@ void omap3_save_scratchpad_contents(void
sizeof(sdrc_block_contents), arm_context_addr, 4);
 }
 
+void omap3_control_save_context(void)
+{
+   control_context.sysconfig = omap_ctrl_readl(OMAP2_CONTROL_SYSCONFIG);
+   control_context.devconf0 = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
+   control_context.mem_dftrw0 =
+   omap_ctrl_readl(OMAP343X_CONTROL_MEM_DFTRW0);
+   control_context.mem_dftrw1 =
+   omap_ctrl_readl(OMAP343X_CONTROL_MEM_DFTRW1);
+   control_context.msuspendmux_0 =
+   omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_0);
+   control_context.msuspendmux_1 =
+   omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_1);
+   control_context.msuspendmux_2 =
+   omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_2);
+   control_context.msuspendmux_3 =
+   omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_3);
+   control_context.msuspendmux_4 =
+   omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_4);
+   control_context.msuspendmux_5 =
+   omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_5);
+   control_context.sec_ctrl = omap_ctrl_readl(OMAP2_CONTROL_SEC_CTRL);
+   control_context.devconf1 = omap_ctrl_readl(OMAP343X_CONTROL_DEVCONF1);
+   control_context.csirxfe = omap_ctrl_readl(OMAP343X_CONTROL_CSIRXFE);
+   control_context.iva2_bootaddr =
+   omap_ctrl_readl(OMAP343X_CONTROL_IVA2_BOOTADDR);
+   control_context.iva2_bootmod =
+   omap_ctrl_readl(OMAP343X_CONTROL_IVA2_BOOTMOD);
+   control_context.debobs_0 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_0);
+   control_context.debobs_1 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_1);
+   control_context.debobs_2 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_2);
+   control_context.debobs_3 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_3);
+   control_context.debobs_4 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_4);
+   control_context.debobs_5 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_5);
+   control_context.debobs_6 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_6);
+   control_context.debobs_7 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_7);
+   control_context.debobs_8 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_8);
+   control_context.prog_io0 = omap_ctrl_readl(OMAP343X_CONTROL_PROG_IO0);
+   control_context.prog_io1 = omap_ctrl_readl(OMAP343X_CONTROL_PROG_IO1);
+   control_context.dss_dpll_spreading =
+   omap_ctrl_readl(OMAP343X_CONTROL_DSS_DPLL_SPREADING);
+   control_context.core_dpll_spreading =
+   omap_ctrl_readl(OMAP343X_CONTROL_CORE_DPLL_SPREADING);
+   control_context.per_dpll_spreading =
+   omap_ctrl_readl(OMAP343X_CONTROL_PER_DPLL_SPREADING);
+   control_context.usbhost_dpll_spreading =
+   omap_ctrl_readl(OMAP343X_CONTROL_USBHOST_DPLL_SPREADING);
+   control_context.pbias_lite =
+   omap_ctrl_readl(OMAP343X_CONTROL_PBIAS_LITE);
+   control_context.temp_sensor =
+   

[PATCH 12/16] OMAP3: Restore MMU table entry

2008-09-26 Thread Rajendra Nayak
During the MMU restoration on the restore path from MPU OFF,
the page table entry for the page consisting of the code being
executed is modified to make MMU return VA=PA.
The MMU is then enabled and the original entry is being 
stored in scratchpad.
This patch reads the original values stored in scratchpad, and
restores them back.

Signed-off-by: Rajendra Nayak [EMAIL PROTECTED]

---
 arch/arm/mach-omap2/pm.h |4 
 arch/arm/mach-omap2/pm34xx.c |   33 +
 2 files changed, 37 insertions(+)

Index: linux-omap-2.6/arch/arm/mach-omap2/pm.h
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm.h2008-09-25 
16:27:12.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/pm.h 2008-09-25 16:27:18.0 
+0530
@@ -23,6 +23,10 @@ extern atomic_t sleep_block;
 extern void omap2_block_sleep(void);
 extern void omap2_allow_sleep(void);
 
+#define OMAP343X_TABLE_ADDRESS_OFFSET 0x31
+#define OMAP343X_TABLE_VALUE_OFFSET   0x30
+#define OMAP343X_CONTROL_REG_VALUE_OFFSET 0x32
+
 #ifdef CONFIG_PM_DEBUG
 extern void omap2_pm_dump(int mode, int resume, unsigned int us);
 extern int omap2_pm_debug;
Index: linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm34xx.c2008-09-25 
16:27:17.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c 2008-09-25 16:27:18.0 
+0530
@@ -30,6 +30,8 @@
 #include mach/clockdomain.h
 #include mach/powerdomain.h
 #include mach/common.h
+#include mach/control.h
+#include asm/tlbflush.h
 
 #include cm.h
 #include cm-regbits-34xx.h
@@ -149,6 +151,33 @@ static irqreturn_t prcm_interrupt_handle
return IRQ_HANDLED;
 }
 
+static void restore_control_register(u32 val)
+{
+   __asm__ __volatile__ (mcr p15, 0, %0, c1, c0, 0 : : r (val));
+}
+
+/* Function to restore the table entry that was modified for enabling MMU */
+static void restore_table_entry(void)
+{
+   u32 *scratchpad_address;
+   u32 previous_value, control_reg_value;
+   u32 *address;
+   scratchpad_address = OMAP2_IO_ADDRESS(OMAP343X_SCRATCHPAD);
+   /* Get address of entry that was modified */
+   address = (u32 *)__raw_readl(scratchpad_address
+   + OMAP343X_TABLE_ADDRESS_OFFSET);
+   /* Get the previous value which needs to be restored */
+   previous_value = __raw_readl(scratchpad_address
+   + OMAP343X_TABLE_VALUE_OFFSET);
+   address = __va(address);
+   *address = previous_value;
+   flush_tlb_all();
+   control_reg_value = __raw_readl(scratchpad_address
+   + OMAP343X_CONTROL_REG_VALUE_OFFSET);
+   /* This will enable caches and prediction */
+   restore_control_register(control_reg_value);
+}
+
 static void omap_sram_idle(void)
 {
/* Variable to tell what needs to be saved and restored
@@ -209,6 +238,10 @@ static void omap_sram_idle(void)
}
 
_omap_sram_idle(NULL, save_state);
+   /* Restore table entry modified during MMU restoration */
+   if (pwrdm_read_prev_pwrst(mpu_pwrdm) == PWRDM_POWER_OFF)
+   restore_table_entry();
+
 
if (core_next_state  PWRDM_POWER_ON) {
/* Disable IO-PAD wakeup */

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


[PATCH 14/16] OMAP3: CORE Off support

2008-09-26 Thread Rajendra Nayak
This patch updates omap_sram_idle with CORE OFF support

Signed-off-by: Rajendra Nayak [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/pm34xx.c |   79 +--
 1 files changed, 77 insertions(+), 2 deletions(-)

Index: linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm34xx.c2008-09-26 
16:38:37.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c 2008-09-26 16:39:18.0 
+0530
@@ -7,6 +7,9 @@
  * Tony Lindgren [EMAIL PROTECTED]
  * Jouni Hogander
  *
+ * Copyright (C) 2007 Texas Instruments, Inc.
+ * Rajendra Nayak [EMAIL PROTECTED]
+ *
  * Copyright (C) 2005 Texas Instruments, Inc.
  * Richard Woodruff [EMAIL PROTECTED]
  *
@@ -27,11 +30,15 @@
 #include mach/gpio.h
 #include mach/sram.h
 #include mach/pm.h
+#include mach/prcm.h
 #include mach/clockdomain.h
 #include mach/powerdomain.h
 #include mach/common.h
 #include mach/control.h
+#include mach/serial.h
+#include mach/gpio.h
 #include mach/sdrc.h
+#include mach/gpmc.h
 #include asm/tlbflush.h
 
 #include cm.h
@@ -59,6 +66,46 @@ static struct powerdomain *mpu_pwrdm, *n
 static struct powerdomain *core_pwrdm, *per_pwrdm;
 
 int set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
+void omap3_sram_restore_context(void);
+
+void omap3_per_save_context(void)
+{
+   omap3_gpio_save_context();
+}
+
+void omap3_per_restore_context(void)
+{
+   omap3_gpio_restore_context();
+}
+
+void omap3_core_save_context(void)
+{
+   u32 control_padconf_off;
+   /* Save the padconf registers */
+   control_padconf_off =
+   omap_ctrl_readl(OMAP343X_CONTROL_PADCONF_OFF);
+   control_padconf_off |= START_PADCONF_SAVE;
+   omap_ctrl_writel(control_padconf_off, OMAP343X_CONTROL_PADCONF_OFF);
+   /* wait for the save to complete */
+   while (!omap_ctrl_readl(OMAP343X_CONTROL_GENERAL_PURPOSE_STATUS)
+PADCONF_SAVE_DONE);
+   /* Save the Interrupt controller context */
+   omap3_intc_save_context();
+   /* Save the GPMC context */
+   omap3_gpmc_save_context();
+   /* Save the system control module context, padconf already save above*/
+   omap3_control_save_context();
+}
+
+void omap3_core_restore_context(void)
+{
+   /* Restore the control module context, padconf restored by h/w */
+   omap3_control_restore_context();
+   /* Restore the GPMC context */
+   omap3_gpmc_restore_context();
+   /* Restore the interrupt controller context */
+   omap3_intc_restore_context();
+}
 
 /* PRCM Interrupt Handler for wakeups */
 static irqreturn_t prcm_interrupt_handler (int irq, void *dev_id)
@@ -191,6 +238,7 @@ static void omap_sram_idle(void)
int mpu_next_state = PWRDM_POWER_ON;
int per_next_state = PWRDM_POWER_ON;
int core_next_state = PWRDM_POWER_ON;
+   int core_prev_state, per_prev_state;
 
if (!_omap_sram_idle)
return;
@@ -232,8 +280,19 @@ static void omap_sram_idle(void)
/* PER changes only with core */
per_next_state = pwrdm_read_next_pwrst(per_pwrdm);
if (clocks_off_while_idle) {
-   if (per_next_state  PWRDM_POWER_ON)
+   if (per_next_state  PWRDM_POWER_ON) {
+   if (per_next_state == PWRDM_POWER_OFF) {
+   omap3_per_save_context();
+   omap3_uart_save_context(2);
+   }
omap_serial_enable_clocks(0, 2);
+   }
+   if (core_next_state == PWRDM_POWER_OFF) {
+   omap3_core_save_context();
+   omap3_prcm_save_context();
+   omap3_uart_save_context(0);
+   omap3_uart_save_context(1);
+   }
omap_serial_enable_clocks(0, 0);
omap_serial_enable_clocks(0, 1);
}
@@ -258,8 +317,23 @@ static void omap_sram_idle(void)
if (clocks_off_while_idle) {
omap_serial_enable_clocks(1, 0);
omap_serial_enable_clocks(1, 1);
-   if (per_next_state  PWRDM_POWER_ON)
+   core_prev_state = pwrdm_read_prev_pwrst(core_pwrdm);
+   if (core_prev_state == PWRDM_POWER_OFF) {
+   omap3_core_restore_context();
+   omap3_prcm_restore_context();
+   omap3_sram_restore_context();
+   omap3_uart_restore_context(0);
+   omap3_uart_restore_context(1);
+   }
+   if (per_next_state  PWRDM_POWER_ON) {

[PATCH 10/16] OMAP3: SRAM restore function

2008-09-26 Thread Rajendra Nayak
This patch updates the context restore function for sram

Signed-off-by: Rajendra Nayak [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/pm34xx.c   |   10 +++---
 arch/arm/plat-omap/include/mach/sram.h |1 +
 arch/arm/plat-omap/sram.c  |6 +++---
 3 files changed, 11 insertions(+), 6 deletions(-)

Index: linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm34xx.c2008-09-25 
16:27:12.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c 2008-09-25 16:27:17.0 
+0530
@@ -558,6 +558,12 @@ static int __init clkdms_setup(struct cl
return 0;
 }
 
+void omap_push_sram_idle()
+{
+   _omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend,
+   omap34xx_cpu_suspend_sz);
+}
+
 int __init omap3_pm_init(void)
 {
struct power_state *pwrst;
@@ -592,9 +598,7 @@ int __init omap3_pm_init(void)
goto err2;
}
 
-   _omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend,
-   omap34xx_cpu_suspend_sz);
-
+   omap_push_sram_idle();
suspend_set_ops(omap_pm_ops);
 
pm_idle = omap3_pm_idle;
Index: linux-omap-2.6/arch/arm/plat-omap/sram.c
===
--- linux-omap-2.6.orig/arch/arm/plat-omap/sram.c   2008-09-25 
16:26:40.0 +0530
+++ linux-omap-2.6/arch/arm/plat-omap/sram.c2008-09-25 16:27:17.0 
+0530
@@ -367,14 +367,14 @@ u32 omap3_configure_core_dpll(u32 sdrc_r
   sdrc_actim_ctrlb, m2);
  }
 
-/* REVISIT: Should this be same as omap34xx_sram_init() after off-idle? */
-void restore_sram_functions(void)
+void omap3_sram_restore_context(void)
 {
omap_sram_ceil = omap_sram_base + omap_sram_size;
 
_omap3_sram_configure_core_dpll =
omap_sram_push(omap3_sram_configure_core_dpll,
   omap3_sram_configure_core_dpll_sz);
+   omap_push_sram_idle();
 }
 
 int __init omap3_sram_init(void)
@@ -382,7 +382,7 @@ int __init omap3_sram_init(void)
_omap3_sram_configure_core_dpll =
omap_sram_push(omap3_sram_configure_core_dpll,
   omap3_sram_configure_core_dpll_sz);
-
+   omap_push_sram_idle();
return 0;
 }
 #else
Index: linux-omap-2.6/arch/arm/plat-omap/include/mach/sram.h
===
--- linux-omap-2.6.orig/arch/arm/plat-omap/include/mach/sram.h  2008-09-25 
16:26:40.0 +0530
+++ linux-omap-2.6/arch/arm/plat-omap/include/mach/sram.h   2008-09-25 
16:27:17.0 +0530
@@ -62,5 +62,6 @@ extern u32 omap3_sram_configure_core_dpl
  u32 sdrc_actim_ctrla,
  u32 sdrc_actim_ctrlb, u32 m2);
 extern unsigned long omap3_sram_configure_core_dpll_sz;
+extern void omap_push_sram_idle();
 
 #endif

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


[PATCH 15/16] OMAP3: Dynamic enable/disable of OFF support

2008-09-26 Thread Rajendra Nayak
This patch adds a runtime sysfs knob (/sys/power/enable_off_mode)
to enable/disbale CORE OFF support for OMAP3. 

Signed-off-by: Rajendra Nayak [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/pm.c |   21 +
 arch/arm/mach-omap2/pm.h |2 ++
 arch/arm/mach-omap2/pm34xx.c |   26 ++
 3 files changed, 45 insertions(+), 4 deletions(-)

Index: linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm34xx.c2008-09-26 
16:39:30.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c 2008-09-26 16:39:34.0 
+0530
@@ -395,6 +395,32 @@ static int omap3_can_sleep(void)
return 1;
 }
 
+int set_next_pwrst(struct powerdomain *pwrdm)
+{
+   struct power_state *pwrst;
+   int ret = 0;
+   u32 state;
+
+   if (!pwrdm-pwrsts)
+   return 0;
+
+   if (enable_off_mode)
+   state = PWRDM_POWER_OFF;
+   else
+   state = PWRDM_POWER_RET;
+
+   ret = pwrdm_set_next_pwrst(pwrdm, state);
+   if (ret) {
+   printk(KERN_ERR Unable to set state of powerdomain: %s\n,
+  pwrdm-name);
+   goto err;
+   }
+   list_for_each_entry(pwrst, pwrst_list, node)
+   pwrst-next_state = state;
+err:
+   return ret;
+}
+
 /* This sets pwrdm state (other than mpu  core. Currently only ON 
  * RET are supported. Function is assuming that clkdm doesn't have
  * hw_sup mode enabled. */
Index: linux-omap-2.6/arch/arm/mach-omap2/pm.c
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm.c2008-09-26 
16:39:30.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/pm.c 2008-09-26 16:39:34.0 
+0530
@@ -35,6 +35,7 @@
 
 unsigned short enable_dyn_sleep;
 unsigned short clocks_off_while_idle;
+unsigned short enable_off_mode;
 atomic_t sleep_block = ATOMIC_INIT(0);
 
 static ssize_t idle_show(struct kobject *, struct kobj_attribute *, char *);
@@ -47,6 +48,9 @@ static struct kobj_attribute sleep_while
 static struct kobj_attribute clocks_off_while_idle_attr =
__ATTR(clocks_off_while_idle, 0644, idle_show, idle_store);
 
+static struct kobj_attribute enable_off_mode_attr =
+   __ATTR(enable_off_mode, 0644, idle_show, idle_store);
+
 static ssize_t idle_show(struct kobject *kobj, struct kobj_attribute *attr,
 char *buf)
 {
@@ -54,6 +58,8 @@ static ssize_t idle_show(struct kobject 
return sprintf(buf, %hu\n, enable_dyn_sleep);
else if (attr == clocks_off_while_idle_attr)
return sprintf(buf, %hu\n, clocks_off_while_idle);
+   else if (attr == enable_off_mode_attr)
+   return sprintf(buf, %hu\n, enable_off_mode);
else
return -EINVAL;
 }
@@ -69,13 +75,16 @@ static ssize_t idle_store(struct kobject
return -EINVAL;
}
 
-   if (attr == sleep_while_idle_attr)
+   if (attr == sleep_while_idle_attr) {
enable_dyn_sleep = value;
-   else if (attr == clocks_off_while_idle_attr)
+   } else if (attr == clocks_off_while_idle_attr) {
clocks_off_while_idle = value;
-   else
+   } else if (attr == enable_off_mode_attr) {
+   enable_off_mode = value;
+   pwrdm_for_each(set_next_pwrst);
+   } else {
return -EINVAL;
-
+   }
return n;
 }
 
@@ -114,6 +123,10 @@ static int __init omap_pm_init(void)
  clocks_off_while_idle_attr.attr);
if (error)
printk(KERN_ERR sysfs_create_file failed: %d\n, error);
+   error = sysfs_create_file(power_kobj,
+ enable_off_mode_attr.attr);
+   if (error)
+   printk(KERN_ERR sysfs_create_file failed: %d\n, error);
 
return error;
 }
Index: linux-omap-2.6/arch/arm/mach-omap2/pm.h
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm.h2008-09-26 
16:39:30.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/pm.h 2008-09-26 16:39:34.0 
+0530
@@ -18,10 +18,12 @@ extern int omap3_pm_init(void);
 
 extern unsigned short enable_dyn_sleep;
 extern unsigned short clocks_off_while_idle;
+extern unsigned short enable_off_mode;
 extern atomic_t sleep_block;
 
 extern void omap2_block_sleep(void);
 extern void omap2_allow_sleep(void);
+extern int set_next_pwrst(struct powerdomain *pwrdm);
 
 #define OMAP343X_TABLE_ADDRESS_OFFSET 0x31
 #define OMAP343X_TABLE_VALUE_OFFSET   0x30

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


[PATCH 11/16] OMAP3: PER/NEON/CORE control in idle

2008-09-26 Thread Rajendra Nayak
This patch adds handling of PER/NEON and CORE domain in idle.

Signed-off-by: Rajendra Nayak [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/pm34xx.c |   69 +--
 arch/arm/mach-omap2/serial.c |   19 +++-
 arch/arm/plat-omap/include/mach/common.h |2 
 3 files changed, 66 insertions(+), 24 deletions(-)

Index: linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm34xx.c2008-09-25 
16:27:17.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c 2008-09-25 16:27:17.0 
+0530
@@ -52,7 +52,10 @@ static void (*_omap_sram_idle)(u32 *addr
 
 static void (*saved_idle)(void);
 
-static struct powerdomain *mpu_pwrdm;
+static struct powerdomain *mpu_pwrdm, *neon_pwrdm;
+static struct powerdomain *core_pwrdm, *per_pwrdm;
+
+int set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
 
 /* PRCM Interrupt Handler for wakeups */
 static irqreturn_t prcm_interrupt_handler (int irq, void *dev_id)
@@ -154,13 +157,22 @@ static void omap_sram_idle(void)
/* save_state = 1 = Only L1 and logic lost */
/* save_state = 2 = Only L2 lost */
/* save_state = 3 = L1, L2 and logic lost */
-   int save_state = 0, mpu_next_state;
+   int save_state = 0;
+   int mpu_next_state = PWRDM_POWER_ON;
+   int per_next_state = PWRDM_POWER_ON;
+   int core_next_state = PWRDM_POWER_ON;
 
if (!_omap_sram_idle)
return;
 
+   pwrdm_clear_all_prev_pwrst(mpu_pwrdm);
+   pwrdm_clear_all_prev_pwrst(neon_pwrdm);
+   pwrdm_clear_all_prev_pwrst(core_pwrdm);
+   pwrdm_clear_all_prev_pwrst(per_pwrdm);
+
mpu_next_state = pwrdm_read_next_pwrst(mpu_pwrdm);
switch (mpu_next_state) {
+   case PWRDM_POWER_ON:
case PWRDM_POWER_RET:
/* No need to save context */
save_state = 0;
@@ -176,19 +188,39 @@ static void omap_sram_idle(void)
 
pm_dbg_pre_suspend();
 
-   omap2_gpio_prepare_for_retention();
-
-   /* Disable UART clocks */
-   if (clocks_off_while_idle)
-   omap_serial_enable_clocks(0);
+   /* NEON control */
+   if (pwrdm_read_pwrst(neon_pwrdm) == PWRDM_POWER_ON)
+   set_pwrdm_state(neon_pwrdm, mpu_next_state);
+
+   /* CORE  PER */
+   core_next_state = pwrdm_read_next_pwrst(core_pwrdm);
+   if (core_next_state  PWRDM_POWER_ON) {
+   omap2_gpio_prepare_for_retention();
+   /* PER changes only with core */
+   per_next_state = pwrdm_read_next_pwrst(per_pwrdm);
+   if (clocks_off_while_idle) {
+   if (per_next_state  PWRDM_POWER_ON)
+   omap_serial_enable_clocks(0, 2);
+   omap_serial_enable_clocks(0, 0);
+   omap_serial_enable_clocks(0, 1);
+   }
+   /* Enable IO-PAD wakeup */
+   prm_set_mod_reg_bits(OMAP3430_EN_IO, WKUP_MOD, PM_WKEN);
+   }
 
_omap_sram_idle(NULL, save_state);
 
-   /* Enable UART clocks */
-   if (clocks_off_while_idle)
-   omap_serial_enable_clocks(1);
-
-   omap2_gpio_resume_after_retention();
+   if (core_next_state  PWRDM_POWER_ON) {
+   /* Disable IO-PAD wakeup */
+   prm_clear_mod_reg_bits(OMAP3430_EN_IO, WKUP_MOD, PM_WKEN);
+   if (clocks_off_while_idle) {
+   omap_serial_enable_clocks(1, 0);
+   omap_serial_enable_clocks(1, 1);
+   if (per_next_state  PWRDM_POWER_ON)
+   omap_serial_enable_clocks(1, 2);
+   }
+   omap2_gpio_resume_after_retention();
+   }
 
pm_dbg_post_suspend();
 
@@ -598,11 +630,24 @@ int __init omap3_pm_init(void)
goto err2;
}
 
+   neon_pwrdm = pwrdm_lookup(neon_pwrdm);
+   per_pwrdm = pwrdm_lookup(per_pwrdm);
+   core_pwrdm = pwrdm_lookup(core_pwrdm);
+
omap_push_sram_idle();
suspend_set_ops(omap_pm_ops);
 
pm_idle = omap3_pm_idle;
 
+   pwrdm_add_wkdep(neon_pwrdm, mpu_pwrdm);
+   /*
+* REVISIT: This wkdep is only necessary when GPIO2-6 are enabled for
+* IO-pad wakeup.  Otherwise it will unnecessarily waste power
+* waking up PER with every CORE wakeup - see
+* http://marc.info/?l=linux-omapm=121852150710062w=2
+   */
+   pwrdm_add_wkdep(per_pwrdm, core_pwrdm);
+
 err1:
return ret;
 err2:
Index: linux-omap-2.6/arch/arm/mach-omap2/serial.c
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/serial.c2008-09-25 
16:27:13.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/serial.c 2008-09-25 16:27:17.0 
+0530
@@ -162,19 +162,16 @@ static void omap_serial_kick(void)

[PATCH 00/16] OMAP3: Context save/Restore + OFF mode support

2008-09-26 Thread Rajendra Nayak
Hi,

This patch set adds context save/restore routines for minimal kernel and OFF 
mode
support in idle and suspend. This patch set applies on top of pm-1 branch.

This has context save/restore support implemented for the following modules
GPMC, UART, GPIO, I2C, PRCM, INTC, SCM, SRAM. 

A sysfs knob to dynamically control OFF mode is provided at 
/sys/power/enable_off_mode. This is set to 0 (disabled) by default.

After bootup execute the following commands to be able to achieve OFF mode
in idle as well as in suspend.

# echo -n 1  /sys/power/enable_off_mode
# echo -n 1  /sys/power/clocks_off_while_idle
# echo -n 1  /sys/power/sleep_while_idle

regards,
Rajendra


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


[PATCH 13/16] OMAP3: MPU Off support

2008-09-26 Thread Rajendra Nayak
This enables support for MPU OFF in idle.

Signed-off-by: Rajendra Nayak [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/pm34xx.c|   11 ++-
 arch/arm/mach-omap2/sleep34xx.S |   13 -
 2 files changed, 18 insertions(+), 6 deletions(-)

Index: linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm34xx.c2008-09-26 
14:18:38.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c 2008-09-26 14:30:38.0 
+0530
@@ -31,6 +31,7 @@
 #include mach/powerdomain.h
 #include mach/common.h
 #include mach/control.h
+#include mach/sdrc.h
 #include asm/tlbflush.h
 
 #include cm.h
@@ -206,6 +207,9 @@ static void omap_sram_idle(void)
/* No need to save context */
save_state = 0;
break;
+   case PWRDM_POWER_OFF:
+   save_state = 3;
+   break;
default:
/* Invalid state */
printk(KERN_ERR Invalid mpu state in sram_idle\n);
@@ -237,7 +241,12 @@ static void omap_sram_idle(void)
prm_set_mod_reg_bits(OMAP3430_EN_IO, WKUP_MOD, PM_WKEN);
}
 
-   _omap_sram_idle(NULL, save_state);
+   /*
+* omap3_arm_context is the location where ARM registers
+* get saved. The restore path then reads from this
+* location and restores them back.
+*/
+   _omap_sram_idle(omap3_arm_context, save_state);
/* Restore table entry modified during MMU restoration */
if (pwrdm_read_prev_pwrst(mpu_pwrdm) == PWRDM_POWER_OFF)
restore_table_entry();
Index: linux-omap-2.6/arch/arm/mach-omap2/sleep34xx.S
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/sleep34xx.S 2008-09-26 
14:00:37.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/sleep34xx.S  2008-09-26 
14:28:09.0 +0530
@@ -37,12 +37,15 @@
OMAP3430_PM_PREPWSTST)
 #define PM_PREPWSTST_MPU_V OMAP34XX_PRM_REGADDR(MPU_MOD, \
OMAP3430_PM_PREPWSTST)
-#define PM_PWSTCTRL_MPU_P  OMAP34XX_PRM_REGADDR(MPU_MOD, PM_PWSTCTRL)
+/*
+ * This is the physical address of the register as specified
+ * by the _P. To be used while the MMU is still disabled.
+ */
+#define PM_PWSTCTRL_MPU_P  (OMAP3430_PRM_BASE + MPU_MOD + PM_PWSTCTRL)
 #define SCRATCHPAD_MEM_OFFS0x310 /* Move this as correct place is
   * available */
-#define SCRATCHPAD_BASE_P  OMAP343X_CTRL_REGADDR(\
-   OMAP343X_CONTROL_MEM_WKUP +\
-   SCRATCHPAD_MEM_OFFS)
+#define SCRATCHPAD_BASE_P  (OMAP343X_CTRL_BASE + OMAP343X_CONTROL_MEM_WKUP\
+   + SCRATCHPAD_MEM_OFFS)
 #define SDRC_POWER_V   OMAP34XX_SDRC_REGADDR(SDRC_POWER)
 
.text
@@ -97,7 +100,7 @@ loop:
 
ldmfd   sp!, {r0-r12, pc}   @ restore regs and return
 restore:
-   /* b restore*/  @ Enable to debug restore code
+   /* b restore*/  @ Enable to debug restore code
 /* Check what was the reason for mpu reset and store the reason in r9*/
 /* 1 - Only L1 and logic lost */
 /* 2 - Only L2 lost - In this case, we wont be here */

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


[PATCH 01/16] OMAP3: Adds missing CM offset defs

2008-09-26 Thread Rajendra Nayak
This is a *temp* patch needed only till the clock patches 
which add additional offset defs from Paul W are in pm-1

Signed-off-by: Rajendra Nayak [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/cm.h |2 ++
 1 files changed, 2 insertions(+)

Index: linux-omap-2.6/arch/arm/mach-omap2/cm.h
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/cm.h2008-09-25 
16:26:59.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/cm.h 2008-09-25 16:27:12.0 
+0530
@@ -36,6 +36,8 @@
 #define OMAP3430_CM_CLKOUT_CTRL
\
OMAP34XX_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
 
+#define OMAP3430_CM_CLKOUT_CTRL_OFFSET  0x0070
+
 /*
  * Module specific CM registers from CM_BASE + domain offset
  * Use cm_{read,write}_mod_reg() with these registers.

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


[PATCH 16/16] OMAP3: 3430SDP minimal kernel defconfig

2008-09-26 Thread Rajendra Nayak
Adds a minimal defconfig for OMAP3430 SDP. This can
be used to test OFF mode till all drivers are adapted.

Signed-off-by: Rajendra Nayak [EMAIL PROTECTED]
---
 arch/arm/configs/omap_3430sdp_min_defconfig | 1084 
 1 files changed, 1084 insertions(+)

Index: linux-omap-2.6/arch/arm/configs/omap_3430sdp_min_defconfig
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-omap-2.6/arch/arm/configs/omap_3430sdp_min_defconfig  2008-09-26 
16:35:19.0 +0530
@@ -0,0 +1,1084 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.27-rc7-omap1
+# Fri Sep 26 14:56:56 2008
+#
+CONFIG_ARM=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_GENERIC_GPIO=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_MMU=y
+# CONFIG_NO_IOPORT is not set
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+# CONFIG_ARCH_HAS_ILOG2_U32 is not set
+# CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_ARCH_SUPPORTS_AOUT=y
+CONFIG_ZONE_DMA=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+CONFIG_VECTORS_BASE=0x
+CONFIG_DEFCONFIG_LIST=/lib/modules/$UNAME_RELEASE/.config
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION=
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_POSIX_MQUEUE is not set
+CONFIG_BSD_PROCESS_ACCT=y
+# CONFIG_BSD_PROCESS_ACCT_V3 is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_AUDIT is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_CGROUPS is not set
+CONFIG_GROUP_SCHED=y
+CONFIG_FAIR_GROUP_SCHED=y
+# CONFIG_RT_GROUP_SCHED is not set
+CONFIG_USER_SCHED=y
+# CONFIG_CGROUP_SCHED is not set
+CONFIG_SYSFS_DEPRECATED=y
+CONFIG_SYSFS_DEPRECATED_V2=y
+# CONFIG_RELAY is not set
+# CONFIG_NAMESPACES is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SYSCTL=y
+CONFIG_EMBEDDED=y
+CONFIG_UID16=y
+# CONFIG_SYSCTL_SYSCALL is not set
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
+CONFIG_KALLSYMS_EXTRA_PASS=y
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_COMPAT_BRK=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_ANON_INODES=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+# CONFIG_MARKERS is not set
+CONFIG_HAVE_OPROFILE=y
+# CONFIG_KPROBES is not set
+# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
+# CONFIG_HAVE_IOREMAP_PROT is not set
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+# CONFIG_HAVE_ARCH_TRACEHOOK is not set
+# CONFIG_HAVE_DMA_ATTRS is not set
+# CONFIG_USE_GENERIC_SMP_HELPERS is not set
+CONFIG_HAVE_CLK=y
+CONFIG_PROC_PAGE_MONITOR=y
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+# CONFIG_TINY_SHMEM is not set
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+CONFIG_MODVERSIONS=y
+CONFIG_MODULE_SRCVERSION_ALL=y
+CONFIG_KMOD=y
+CONFIG_BLOCK=y
+# CONFIG_LBD is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+CONFIG_DEFAULT_AS=y
+# CONFIG_DEFAULT_DEADLINE is not set
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED=anticipatory
+CONFIG_CLASSIC_RCU=y
+
+#
+# System Type
+#
+# CONFIG_ARCH_AAEC2000 is not set
+# CONFIG_ARCH_INTEGRATOR is not set
+# CONFIG_ARCH_REALVIEW is not set
+# CONFIG_ARCH_VERSATILE is not set
+# CONFIG_ARCH_AT91 is not set
+# CONFIG_ARCH_CLPS7500 is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_EBSA110 is not set
+# CONFIG_ARCH_EP93XX is not set
+# CONFIG_ARCH_FOOTBRIDGE is not set
+# CONFIG_ARCH_NETX is not set
+# CONFIG_ARCH_H720X is not set
+# CONFIG_ARCH_IMX is not set
+# CONFIG_ARCH_IOP13XX is not set
+# CONFIG_ARCH_IOP32X is not set
+# CONFIG_ARCH_IOP33X is not set
+# CONFIG_ARCH_IXP23XX is not set
+# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_IXP4XX is not set
+# CONFIG_ARCH_L7200 is not set
+# CONFIG_ARCH_KIRKWOOD is not set
+# CONFIG_ARCH_KS8695 is not set
+# CONFIG_ARCH_NS9XXX is not set
+# CONFIG_ARCH_LOKI is not set
+# CONFIG_ARCH_MV78XX0 is not set
+# CONFIG_ARCH_MXC is not set
+# CONFIG_ARCH_ORION5X is not set
+# CONFIG_ARCH_PNX4008 is not set
+# CONFIG_ARCH_PXA is not set
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 

[PATCH 08/16] OMAP3: Populate scratchpad contents

2008-09-26 Thread Rajendra Nayak
This patch populates the scratchpad contents
as expected by the bootROM code.

Signed-off-by: Rajendra Nayak [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/control.c |  204 ++
 arch/arm/plat-omap/include/mach/control.h |   10 +
 2 files changed, 214 insertions(+)

Index: linux-omap-2.6/arch/arm/mach-omap2/control.c
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/control.c   2008-09-26 
10:03:38.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/control.c2008-09-26 
13:45:57.0 +0530
@@ -17,9 +17,82 @@
 
 #include mach/common.h
 #include mach/control.h
+#include mach/sdrc.h
+#include cm-regbits-34xx.h
+#include prm-regbits-34xx.h
+#include cm.h
+#include prm.h
+#include clock34xx.h
+#include sdrc.h
 
 static void __iomem *omap2_ctrl_base;
 
+struct omap3_scratchpad {
+   u32 boot_config_ptr;
+   u32 public_restore_ptr;
+   u32 secure_ram_restore_ptr;
+   u32 sdrc_module_semaphore;
+   u32 prcm_block_offset;
+   u32 sdrc_block_offset;
+};
+
+struct omap3_scratchpad_prcm_block {
+   u32 prm_clksrc_ctrl;
+   u32 prm_clksel;
+   u32 cm_clksel_core;
+   u32 cm_clksel_wkup;
+   u32 cm_clken_pll;
+   u32 cm_autoidle_pll;
+   u32 cm_clksel1_pll;
+   u32 cm_clksel2_pll;
+   u32 cm_clksel3_pll;
+   u32 cm_clken_pll_mpu;
+   u32 cm_autoidle_pll_mpu;
+   u32 cm_clksel1_pll_mpu;
+   u32 cm_clksel2_pll_mpu;
+   u32 prcm_block_size;
+};
+
+struct omap3_scratchpad_sdrc_block {
+   u16 sysconfig;
+   u16 cs_cfg;
+   u16 sharing;
+   u16 err_type;
+   u32 dll_a_ctrl;
+   u32 dll_b_ctrl;
+   u32 power;
+   u32 cs_0;
+   u32 mcfg_0;
+   u16 mr_0;
+   u16 emr_1_0;
+   u16 emr_2_0;
+   u16 emr_3_0;
+   u32 actim_ctrla_0;
+   u32 actim_ctrlb_0;
+   u32 rfr_ctrl_0;
+   u32 cs_1;
+   u32 mcfg_1;
+   u16 mr_1;
+   u16 emr_1_1;
+   u16 emr_2_1;
+   u16 emr_3_1;
+   u32 actim_ctrla_1;
+   u32 actim_ctrlb_1;
+   u32 rfr_ctrl_1;
+   u16 dcdl_1_ctrl;
+   u16 dcdl_2_ctrl;
+   u32 flags;
+   u32 block_size;
+};
+
+/*
+ * This is used to store ARM registers in SDRAM before attempting
+ * an MPU OFF. The save and restore happens from the SRAM sleep code.
+ * The address is stored in scratchpad, so that it can be used
+ * during the restore path.
+ */
+u32 omap3_arm_context[128];
+
 #define OMAP_CTRL_REGADDR(reg) (omap2_ctrl_base + (reg))
 
 void __init omap2_set_globals_control(struct omap_globals *omap2_globals)
@@ -62,3 +135,134 @@ void omap_ctrl_writel(u32 val, u16 offse
__raw_writel(val, OMAP_CTRL_REGADDR(offset));
 }
 
+#ifdef CONFIG_ARCH_OMAP3
+/*
+ * Clears the scratchpad contents in case of cold boot-
+ * called during bootup
+ */
+void omap3_clear_scratchpad_contents(void)
+{
+   u32 max_offset = OMAP343X_SCRATCHPAD_ROM_OFFSET;
+   u32 *v_addr;
+   u32 offset = 0;
+   v_addr = OMAP2_IO_ADDRESS(OMAP343X_SCRATCHPAD_ROM);
+   if (prm_read_mod_reg(OMAP3430_GR_MOD, OMAP3_PRM_RSTST_OFFSET) 
+   OMAP3430_GLOBAL_COLD_RST) {
+   for ( ; offset = max_offset; offset += 0x4)
+   __raw_writel(0x0, (v_addr + offset));
+   prm_set_mod_reg_bits(OMAP3430_GLOBAL_COLD_RST, OMAP3430_GR_MOD,
+   OMAP3_PRM_RSTST_OFFSET);
+   }
+}
+
+/* Populate the scratchpad structure with restore structure */
+void omap3_save_scratchpad_contents(void)
+{
+   void * __iomem scratchpad_address;
+   u32 arm_context_addr;
+   struct omap3_scratchpad scratchpad_contents;
+   struct omap3_scratchpad_prcm_block prcm_block_contents;
+   struct omap3_scratchpad_sdrc_block sdrc_block_contents;
+
+   /* Populate the Scratchpad contents */
+   scratchpad_contents.boot_config_ptr = 0x0;
+   scratchpad_contents.public_restore_ptr =
+virt_to_phys(get_restore_pointer());
+   scratchpad_contents.secure_ram_restore_ptr = 0x0;
+   scratchpad_contents.sdrc_module_semaphore = 0x0;
+   scratchpad_contents.prcm_block_offset = 0x2C;
+   scratchpad_contents.sdrc_block_offset = 0x64;
+
+   /* Populate the PRCM block contents */
+   prcm_block_contents.prm_clksrc_ctrl = prm_read_mod_reg(OMAP3430_GR_MOD,
+   OMAP3_PRM_CLKSRC_CTRL_OFFSET);
+   prcm_block_contents.prm_clksel = prm_read_mod_reg(OMAP3430_CCR_MOD,
+   OMAP3_PRM_CLKSEL_OFFSET);
+   prcm_block_contents.cm_clksel_core =
+   cm_read_mod_reg(CORE_MOD, CM_CLKSEL);
+   prcm_block_contents.cm_clksel_wkup =
+   cm_read_mod_reg(WKUP_MOD, CM_CLKSEL);
+   prcm_block_contents.cm_clken_pll =
+   cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKEN_PLL);
+   prcm_block_contents.cm_autoidle_pll =
+   

[PATCH 0/2] PM counters

2008-09-26 Thread Peter 'p2' De Schrijver
This patch introduces counters for the various PM states in OMAP3.

Peter 'p2' De Schrijver (2):
  PM counter infrastructure.
  Hook into PM counters

 arch/arm/mach-omap2/clock.c   |2 +
 arch/arm/mach-omap2/clockdomain.c |4 +
 arch/arm/mach-omap2/pm34xx.c  |6 ++
 arch/arm/mach-omap2/powerdomain.c |   94 +
 arch/arm/plat-omap/include/mach/powerdomain.h |7 ++
 5 files changed, 113 insertions(+), 0 deletions(-)

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


[PATCH 1/2] PM counter infrastructure.

2008-09-26 Thread Peter 'p2' De Schrijver

Signed-off-by: Peter 'p2' De Schrijver [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/powerdomain.c |   94 +
 arch/arm/plat-omap/include/mach/powerdomain.h |7 ++
 2 files changed, 101 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/powerdomain.c 
b/arch/arm/mach-omap2/powerdomain.c
index 73e2971..7107eb9 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -35,6 +35,11 @@
 #include mach/powerdomain.h
 #include mach/clockdomain.h
 
+enum {
+   PWRDM_STATE_NOW = 0,
+   PWRDM_STATE_PREV,
+};
+
 /* pwrdm_list contains all registered struct powerdomains */
 static LIST_HEAD(pwrdm_list);
 
@@ -102,6 +107,63 @@ static struct powerdomain *_pwrdm_deps_lookup(struct 
powerdomain *pwrdm,
return pd-pwrdm;
 }
 
+static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag)
+{
+
+   int prev;
+   int state;
+
+   if (pwrdm == NULL)
+   return -EINVAL;
+
+   state = pwrdm_read_pwrst(pwrdm);
+
+   switch (flag) {
+   case PWRDM_STATE_NOW:
+   prev = pwrdm-state;
+   break;
+   case PWRDM_STATE_PREV:
+   prev = pwrdm_read_prev_pwrst(pwrdm);
+   if (pwrdm-state != prev)
+   pwrdm-state_counter[prev]++;
+   break;
+   default:
+   return -EINVAL;
+   }
+
+   if (state != prev)
+   pwrdm-state_counter[state]++;
+
+   pwrdm-state = state;
+
+   return 0;
+}
+
+static int _pwrdm_pre_suspend_cb(struct powerdomain *pwrdm)
+{
+   pwrdm_clear_all_prev_pwrst(pwrdm);
+   _pwrdm_state_switch(pwrdm, PWRDM_STATE_NOW);
+   return 0;
+}
+
+static int _pwrdm_post_suspend_cb(struct powerdomain *pwrdm)
+{
+   _pwrdm_state_switch(pwrdm, PWRDM_STATE_PREV);
+   return 0;
+}
+
+static __init void _pwrdm_setup(struct powerdomain *pwrdm)
+{
+   int i;
+
+   for (i = 0; i  4; i++)
+   pwrdm-state_counter[i] = 0;
+
+   pwrdm_wait_transition(pwrdm);
+   pwrdm-state = pwrdm_read_pwrst(pwrdm);
+   pwrdm-state_counter[pwrdm-state] = 1;
+
+}
 
 /* Public functions */
 
@@ -1110,4 +1172,36 @@ int pwrdm_wait_transition(struct powerdomain *pwrdm)
return 0;
 }
 
+int pwrdm_state_switch(struct powerdomain *pwrdm)
+{
+   return _pwrdm_state_switch(pwrdm, PWRDM_STATE_NOW);
+}
+
+int pwrdm_clkdm_state_switch(struct clockdomain *clkdm)
+{
+   if (clkdm != NULL  clkdm-pwrdm.ptr != NULL) {
+   pwrdm_wait_transition(clkdm-pwrdm.ptr);
+   return pwrdm_state_switch(clkdm-pwrdm.ptr);
+   }
+
+   return -EINVAL;
+}
+int pwrdm_clk_state_switch(struct clk *clk)
+{
+   if (clk != NULL  clk-clkdm.ptr != NULL)
+   return pwrdm_clkdm_state_switch(clk-clkdm.ptr);
+   return -EINVAL;
+}
+
+int pwrdm_pre_suspend(void)
+{
+   pwrdm_for_each(_pwrdm_pre_suspend_cb);
+   return 0;
+}
+
+int pwrdm_post_suspend(void)
+{
+   pwrdm_for_each(_pwrdm_post_suspend_cb);
+   return 0;
+}
 
diff --git a/arch/arm/plat-omap/include/mach/powerdomain.h 
b/arch/arm/plat-omap/include/mach/powerdomain.h
index 69c9e67..d80ad4a 100644
--- a/arch/arm/plat-omap/include/mach/powerdomain.h
+++ b/arch/arm/plat-omap/include/mach/powerdomain.h
@@ -117,6 +117,8 @@ struct powerdomain {
 
struct list_head node;
 
+   int state;
+   unsigned state_counter[4];
 };
 
 
@@ -164,4 +166,9 @@ bool pwrdm_has_hdwr_sar(struct powerdomain *pwrdm);
 
 int pwrdm_wait_transition(struct powerdomain *pwrdm);
 
+int pwrdm_state_switch(struct powerdomain *pwrdm);
+int pwrdm_clkdm_state_switch(struct clockdomain *clkdm);
+int pwrdm_pre_suspend(void);
+int pwrdm_post_suspend(void);
+
 #endif
-- 
1.5.6.3

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


[PATCH 1/1] Hook into PM counters

2008-09-26 Thread Peter 'p2' De Schrijver

Signed-off-by: Peter 'p2' De Schrijver [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/clock.c   |2 ++
 arch/arm/mach-omap2/clockdomain.c |4 
 arch/arm/mach-omap2/pm34xx.c  |6 ++
 3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index c3af24e..dbbc7c8 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -1013,5 +1013,7 @@ void omap2_clk_disable_unused(struct clk *clk)
 
printk(KERN_INFO Disabling unused clock \%s\\n, clk-name);
_omap2_clk_disable(clk);
+   if (clk-clkdm.ptr != NULL)
+   pwrdm_clkdm_state_switch(clk-clkdm.ptr);
 }
 #endif
diff --git a/arch/arm/mach-omap2/clockdomain.c 
b/arch/arm/mach-omap2/clockdomain.c
index fa62f14..5249fe8 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -567,6 +567,8 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, 
struct clk *clk)
else
omap2_clkdm_wakeup(clkdm);
 
+   pwrdm_clkdm_state_switch(clkdm);
+
return 0;
 }
 
@@ -618,6 +620,8 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, 
struct clk *clk)
else
omap2_clkdm_sleep(clkdm);
 
+   pwrdm_clkdm_state_switch(clkdm);
+
return 0;
 }
 
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index a828db6..5913c4d 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -170,6 +170,8 @@ static void omap_sram_idle(void)
disable_smartreflex(SR1);
disable_smartreflex(SR2);
 
+   pwrdm_pre_suspend();
+
omap2_gpio_prepare_for_retention();
 
_omap_sram_idle(NULL, save_state);
@@ -179,6 +181,9 @@ static void omap_sram_idle(void)
/* Enable smartreflex after WFI */
enable_smartreflex(SR1);
enable_smartreflex(SR2);
+
+   pwrdm_post_suspend();
+
 }
 
 /*
@@ -260,6 +265,7 @@ static int set_pwrdm_state(struct powerdomain *pwrdm, u32 
state)
if (sleep_switch) {
omap2_clkdm_allow_idle(pwrdm-pwrdm_clkdms[0]);
pwrdm_wait_transition(pwrdm);
+   pwrdm_state_switch(pwrdm);
}
 
 err:
-- 
1.5.6.3

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


[PATCH 2/2] Hook into PM counters

2008-09-26 Thread Peter 'p2' De Schrijver

Signed-off-by: Peter 'p2' De Schrijver [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/clock.c   |2 ++
 arch/arm/mach-omap2/clockdomain.c |4 
 arch/arm/mach-omap2/pm34xx.c  |6 ++
 3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index c3af24e..dbbc7c8 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -1013,5 +1013,7 @@ void omap2_clk_disable_unused(struct clk *clk)
 
printk(KERN_INFO Disabling unused clock \%s\\n, clk-name);
_omap2_clk_disable(clk);
+   if (clk-clkdm.ptr != NULL)
+   pwrdm_clkdm_state_switch(clk-clkdm.ptr);
 }
 #endif
diff --git a/arch/arm/mach-omap2/clockdomain.c 
b/arch/arm/mach-omap2/clockdomain.c
index fa62f14..5249fe8 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -567,6 +567,8 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, 
struct clk *clk)
else
omap2_clkdm_wakeup(clkdm);
 
+   pwrdm_clkdm_state_switch(clkdm);
+
return 0;
 }
 
@@ -618,6 +620,8 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, 
struct clk *clk)
else
omap2_clkdm_sleep(clkdm);
 
+   pwrdm_clkdm_state_switch(clkdm);
+
return 0;
 }
 
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index a828db6..5913c4d 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -170,6 +170,8 @@ static void omap_sram_idle(void)
disable_smartreflex(SR1);
disable_smartreflex(SR2);
 
+   pwrdm_pre_suspend();
+
omap2_gpio_prepare_for_retention();
 
_omap_sram_idle(NULL, save_state);
@@ -179,6 +181,9 @@ static void omap_sram_idle(void)
/* Enable smartreflex after WFI */
enable_smartreflex(SR1);
enable_smartreflex(SR2);
+
+   pwrdm_post_suspend();
+
 }
 
 /*
@@ -260,6 +265,7 @@ static int set_pwrdm_state(struct powerdomain *pwrdm, u32 
state)
if (sleep_switch) {
omap2_clkdm_allow_idle(pwrdm-pwrdm_clkdms[0]);
pwrdm_wait_transition(pwrdm);
+   pwrdm_state_switch(pwrdm);
}
 
 err:
-- 
1.5.6.3

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


Re: [PATCH 1/1] Hook into PM counters

2008-09-26 Thread Peter 'p2' De Schrijver
This seems to be duplicate. You can ignore it.

Cheers,

Peter.

 
 Signed-off-by: Peter 'p2' De Schrijver [EMAIL PROTECTED]
 ---
  arch/arm/mach-omap2/clock.c   |2 ++
  arch/arm/mach-omap2/clockdomain.c |4 
  arch/arm/mach-omap2/pm34xx.c  |6 ++
  3 files changed, 12 insertions(+), 0 deletions(-)
 
 diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
 index c3af24e..dbbc7c8 100644
 --- a/arch/arm/mach-omap2/clock.c
 +++ b/arch/arm/mach-omap2/clock.c
 @@ -1013,5 +1013,7 @@ void omap2_clk_disable_unused(struct clk *clk)
  
   printk(KERN_INFO Disabling unused clock \%s\\n, clk-name);
   _omap2_clk_disable(clk);
 + if (clk-clkdm.ptr != NULL)
 + pwrdm_clkdm_state_switch(clk-clkdm.ptr);
  }
  #endif
 diff --git a/arch/arm/mach-omap2/clockdomain.c 
 b/arch/arm/mach-omap2/clockdomain.c
 index fa62f14..5249fe8 100644
 --- a/arch/arm/mach-omap2/clockdomain.c
 +++ b/arch/arm/mach-omap2/clockdomain.c
 @@ -567,6 +567,8 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, 
 struct clk *clk)
   else
   omap2_clkdm_wakeup(clkdm);
  
 + pwrdm_clkdm_state_switch(clkdm);
 +
   return 0;
  }
  
 @@ -618,6 +620,8 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, 
 struct clk *clk)
   else
   omap2_clkdm_sleep(clkdm);
  
 + pwrdm_clkdm_state_switch(clkdm);
 +
   return 0;
  }
  
 diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
 index a828db6..5913c4d 100644
 --- a/arch/arm/mach-omap2/pm34xx.c
 +++ b/arch/arm/mach-omap2/pm34xx.c
 @@ -170,6 +170,8 @@ static void omap_sram_idle(void)
   disable_smartreflex(SR1);
   disable_smartreflex(SR2);
  
 + pwrdm_pre_suspend();
 +
   omap2_gpio_prepare_for_retention();
  
   _omap_sram_idle(NULL, save_state);
 @@ -179,6 +181,9 @@ static void omap_sram_idle(void)
   /* Enable smartreflex after WFI */
   enable_smartreflex(SR1);
   enable_smartreflex(SR2);
 +
 + pwrdm_post_suspend();
 +
  }
  
  /*
 @@ -260,6 +265,7 @@ static int set_pwrdm_state(struct powerdomain *pwrdm, u32 
 state)
   if (sleep_switch) {
   omap2_clkdm_allow_idle(pwrdm-pwrdm_clkdms[0]);
   pwrdm_wait_transition(pwrdm);
 + pwrdm_state_switch(pwrdm);
   }
  
  err:
 -- 
 1.5.6.3
 

-- 
goa is a state of mind
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


OMAP34xx vs OMAP 35xx

2008-09-26 Thread twebb
I'm relatively new to the list and hoping someone can clarify a few
things.  Does OMAP3 imply support of both 34xx and 35xx?  When the
term OMAP3 EVM is used, does this mean OMAP3430 SDP only or does it
include OMAP35x EVM?

Thanks.
twebb
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] OMAP3: Update USBHOST pinmux settings

2008-09-26 Thread Ashwin Bihari
On Fri, Sep 26, 2008 at 11:34 AM, Gadiyar, Anand [EMAIL PROTECTED] wrote:
 From: Anand Gadiyar [EMAIL PROTECTED]

 Add pin-mux settings for OHCI in PHY mode.
 Also change settings for EHCI in TLL mode.

 Signed-off-by: Anand Gadiyar [EMAIL PROTECTED]
 ---
  arch/arm/mach-omap2/mux.c |   67 
 +++---
  arch/arm/plat-omap/include/mach/mux.h |   26 -
  2 files changed, 80 insertions(+), 13 deletions(-)

 Index: tony/arch/arm/mach-omap2/mux.c
 ===
 --- tony.orig/arch/arm/mach-omap2/mux.c 2008-09-04 12:57:33.0 +0530
 +++ tony/arch/arm/mach-omap2/mux.c  2008-09-26 20:49:24.963867406 +0530
 @@ -298,13 +298,13 @@ MUX_CFG_34XX(T2_3430_USB2HS_PHY_D7, 0x

  /* TLL - HSUSB: 12-pin TLL Port 1*/
  MUX_CFG_34XX(Y8_3430_USB1HS_TLL_CLK, 0x5da,
 -   OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_OUTPUT)
 -MUX_CFG_34XX(Y9_3430_USB1HS_TLL_STP, 0x5d8,
OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +MUX_CFG_34XX(Y9_3430_USB1HS_TLL_STP, 0x5d8,
 +   OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLUP)
  MUX_CFG_34XX(AA14_3430_USB1HS_TLL_DIR, 0x5ec,
 -   OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_OUTPUT)
 +   OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
  MUX_CFG_34XX(AA11_3430_USB1HS_TLL_NXT, 0x5ee,
 -   OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_OUTPUT)
 +   OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
  MUX_CFG_34XX(W13_3430_USB1HS_TLL_D0, 0x5dc,
OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
  MUX_CFG_34XX(W12_3430_USB1HS_TLL_D1, 0x5de,
 @@ -324,13 +324,13 @@ MUX_CFG_34XX(Y13_3430_USB1HS_TLL_D7, 0

  /* TLL - HSUSB: 12-pin TLL Port 2*/
  MUX_CFG_34XX(AA8_3430_USB2HS_TLL_CLK, 0x5f0,
 -   OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_OUTPUT)
 -MUX_CFG_34XX(AA10_3430_USB2HS_TLL_STP, 0x5f2,
OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +MUX_CFG_34XX(AA10_3430_USB2HS_TLL_STP, 0x5f2,
 +   OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLUP)
  MUX_CFG_34XX(AA9_3430_USB2HS_TLL_DIR, 0x5f4,
 -   OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_OUTPUT)
 +   OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
  MUX_CFG_34XX(AB11_3430_USB2HS_TLL_NXT, 0x5f6,
 -   OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_OUTPUT)
 +   OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
  MUX_CFG_34XX(AB10_3430_USB2HS_TLL_D0, 0x5f8,
OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
  MUX_CFG_34XX(AB9_3430_USB2HS_TLL_D1, 0x5fa,
 @@ -350,13 +350,13 @@ MUX_CFG_34XX(T2_3430_USB2HS_TLL_D7, 0x

  /* TLL - HSUSB: 12-pin TLL Port 3*/
  MUX_CFG_34XX(AA6_3430_USB3HS_TLL_CLK, 0x180,
 -   OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_OUTPUT)
 -MUX_CFG_34XX(AB3_3430_USB3HS_TLL_STP, 0x166,
OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +MUX_CFG_34XX(AB3_3430_USB3HS_TLL_STP, 0x166,
 +   OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLUP)
  MUX_CFG_34XX(AA3_3430_USB3HS_TLL_DIR, 0x168,
 -   OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_OUTPUT)
 +   OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
  MUX_CFG_34XX(Y3_3430_USB3HS_TLL_NXT, 0x16a,
 -   OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_OUTPUT)
 +   OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
  MUX_CFG_34XX(AA5_3430_USB3HS_TLL_D0, 0x186,
OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
  MUX_CFG_34XX(Y4_3430_USB3HS_TLL_D1, 0x184,
 @@ -373,6 +373,49 @@ MUX_CFG_34XX(AA13_3430_USB3HS_TLL_D6,
OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
  MUX_CFG_34XX(AA12_3430_USB3HS_TLL_D7, 0x172,
OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +
 +/* PHY FSUSB: FS Serial PHY 4-pin mode for Port 1*/
 +MUX_CFG_34XX(AF10_3430_USB1FS_PHY_MM1_RXDP, 0x5d8,
 +   OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +MUX_CFG_34XX(AG9_3430_USB1FS_PHY_MM1_RXDM, 0x5ee,
 +   OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +MUX_CFG_34XX(W13_3430_USB1FS_PHY_MM1_RXRCV, 0x5dc,
 +   OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +MUX_CFG_34XX(W12_3430_USB1FS_PHY_MM1_TXSE0, 0x5de,
 +   OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +MUX_CFG_34XX(W11_3430_USB1FS_PHY_MM1_TXDAT, 0x5e0,
 +   OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +MUX_CFG_34XX(Y11_3430_USB1FS_PHY_MM1_TXEN_N, 0x5ea,
 +   OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +
 +/* PHY FSUSB: FS Serial PHY 4-pin mode for Port 2*/
 +MUX_CFG_34XX(AF7_3430_USB2FS_PHY_MM2_RXDP, 0x5f2,
 +   OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +MUX_CFG_34XX(AH7_3430_USB2FS_PHY_MM2_RXDM, 0x5f6,
 +   OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +MUX_CFG_34XX(AB10_3430_USB2FS_PHY_MM2_RXRCV, 0x5f8,
 +   OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
 

RE: [PATCH] OMAP3: Update USBHOST pinmux settings

2008-09-26 Thread Gadiyar, Anand
 -Original Message-
 From: Ashwin Bihari [mailto:[EMAIL PROTECTED] 

snip
 
 Anand,
 
 Can you configure the USBHOST to just use the OHCI controller with a
 Phy and not use the EHCI controller at all?
 
 Regards
 ~ Ashwin

Hi Ashwin,

Yes, you can configure USBHOST to just use the OHCI controller
with a PHY and not use EHCI at all.

Patches coming up on this as soon as I can find the time. This
one was the first in the series - it'll take a little bit of
time to add all the pieces, so I'm sending out the patches as
I generate them.

Regards,
Anand--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] OMAP3: Update USBHOST pinmux settings

2008-09-26 Thread Ashwin Bihari
On Fri, Sep 26, 2008 at 11:44 AM, Gadiyar, Anand [EMAIL PROTECTED] wrote:
 -Original Message-
 From: Ashwin Bihari [mailto:[EMAIL PROTECTED]

 snip

 Anand,

 Can you configure the USBHOST to just use the OHCI controller with a
 Phy and not use the EHCI controller at all?

 Regards
 ~ Ashwin

 Hi Ashwin,

 Yes, you can configure USBHOST to just use the OHCI controller
 with a PHY and not use EHCI at all.

 Patches coming up on this as soon as I can find the time. This
 one was the first in the series - it'll take a little bit of
 time to add all the pieces, so I'm sending out the patches as
 I generate them.

 Regards,
 Anand

Anand,

That's great to hear..I look forward to see the patches..

Regards
~ Ashwin
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


MUSB OTG Interrupts

2008-09-26 Thread Ashwin Bihari
Greetings,

I've got a very curious problem with my OMAP3 based  board. I'm using
the OMAPZOOM kernel v2.6.27-rc3 and have enabled MUSB in OTG mode
(both host and perihperhal). I've got the file-backed-storage gadget.
If I plug the mini-B connector to the board, it gets the appropriate
interrupt and recognizes that it needs to be operate in peripheral
mode and goes about it's business. However, when I plug in the mini-A
connector to the board, there is no interrupt and no activity. I can
then unplug the mini-A connector, and plug in the mini-B connector to
get the interrupts and activity again.

If I boot the board up with the mini-A connector plugged in, it is
properly found/recognized during driver installation and any devices
attached are properly found and can be used. The IRQs at this time
fire properly. I have a thumb drive connected to a high speed hub
connected to the OMAP board, and the drive is found, I can mount it
and do everything. Now, in this particular case, if I unplug the
mini-A connector and plug either the mini-A or mini-B connector,
nothing happens at all.

Why am I only getting interrupts with the mini-B connector and not the
mini-A connector? Additionally, why does everything fail after my
second scenario above?

Regards
~ Ashwin
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Soft lockup when disconnecting musb isochronous device.

2008-09-26 Thread Nathan Monson
I've been trying to get the UVC camera driver working in linux-omap on
the Beagleboard, which uses musb.  With the latest linux-omap git,
capture doesn't work.  Applying Ajay Gupta's MUSB patches posted here
on 9/8 allows capture to work until the device is closed.

With or without Ajay's patches, when the device is closed, the
following lockup occurs.  Let me know if there is anything I can do to
help debug this.

BUG: soft lockup - CPU#0 stuck for 61s! [mjpg_streamer:1770]
Modules linked in: ipv6 pegasus uvcvideo compat_ioctl32 videodev v4l1_compat

Pid: 1770, comm:mjpg_streamer
CPU: 0Not tainted  (2.6.27-rc7-omap1 #4)
PC is at __mutex_lock_slowpath+0x1ec/0x204
LR is at __mutex_lock_slowpath+0x1c4/0x204
pc : [c0320fa0]lr : [c0320f78]psr: 6013
sp : c7265ca0  ip : c7265ca0  fp : c7265cd4
r10: c79eb400  r9 : c7128218  r8 : c78a6a08
r7 : c78df9c0  r6 : 6013  r5 : c0437690  r4 : c7265ca4
r3 :   r2 :   r1 : c7264000  r0 : c0437690
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 00c5387f  Table: 87348018  DAC: 0015
[c0034ca8] (show_regs+0x0/0x50) from [c007959c]
(softlockup_tick+0x100/0x140)
r5:00bc r4:007f
[c007949c] (softlockup_tick+0x0/0x140) from [c005c08c]
(run_local_timers+0x1c/0x20)
[c005c070] (run_local_timers+0x0/0x20) from [c005c4e8]
(update_process_times+0x30/0x5c)
[c005c4b8] (update_process_times+0x0/0x5c) from [c006f138]
(tick_sched_timer+0x8c/0xd8)
r5:c7265c58 r4:c044d630
[c006f0ac] (tick_sched_timer+0x0/0xd8) from [c0069090]
(__run_hrtimer+0x58/0x94)
r7:c0425e60 r6:c044d630 r5:c0425e60 r4:c044d630
[c0069038] (__run_hrtimer+0x0/0x94) from [c0069c64]
(hrtimer_interrupt+0x130/0x1a0)
r5:00b9 r4:183847b0
[c0069b34] (hrtimer_interrupt+0x0/0x1a0) from [c003d248]
(omap2_gp_timer_interrupt+0x28/0x34)
[c003d220] (omap2_gp_timer_interrupt+0x0/0x34) from [c0079a58]
(handle_IRQ_event+0x3c/0x74)
[c0079a1c] (handle_IRQ_event+0x0/0x74) from [c007b2a4]
(handle_level_irq+0xd4/0xf0)
r7:c78df9c0 r6: r5:005f r4:c04279a8
[c007b1d0] (handle_level_irq+0x0/0xf0) from [c0033048]
(__exception_text_start+0x48/0x64)
r5:c04279a8 r4:005f
[c0033000] (__exception_text_start+0x0/0x64) from [c0033830]
(__irq_svc+0x30/0x80)
Exception stack(0xc7265c58 to 0xc7265ca0)
5c40:   c0437690 c7264000
5c60:   c7265ca4 c0437690 6013 c78df9c0 c78a6a08 c7128218
5c80: c79eb400 c7265cd4 c7265ca0 c7265ca0 c0320f78 c0320fa0 6013 
r7:c78df9c0 r6:6013 r5:d820 r4:
[c0320db4] (__mutex_lock_slowpath+0x0/0x204) from [c0320fc8]
(mutex_lock+0x10/0x14)
r7:c7893000 r6:c7170c00 r5:c7170c00 r4:c791c738
[c0320fb8] (mutex_lock+0x0/0x14) from [c01ed760] (usb_kill_urb+0x38/0x104)
[c01ed728] (usb_kill_urb+0x0/0x104) from [c01ece30]
(usb_hcd_flush_endpoint+0xb0/0xcc)
r6:c791c740 r5:c7170c00 r4:c791c738
[c01ecd80] (usb_hcd_flush_endpoint+0x0/0xcc) from [c01ee044]
(usb_disable_endpoint+0x5c/0x6c)
r7:c7893000 r6:c78a6a40 r5:c7893000 r4:c791c740
[c01edfe8] (usb_disable_endpoint+0x0/0x6c) from [c01ee180]
(usb_disable_interface+0x34/0x4c)
r5:0028 r4:0001
[c01ee14c] (usb_disable_interface+0x0/0x4c) from [c01ef4e0]
(usb_set_interface+0xec/0x178)
r7:0001 r6: r5:c7893000 r4:c78a6e00
[c01ef3f4] (usb_set_interface+0x0/0x178) from [bf014c48]
(uvc_video_enable+0x3c/0x74 [uvcvideo])
r8:c721c050 r7:c7265e68 r6:c721c094 r5: r4:c721c050
[bf014c0c] (uvc_video_enable+0x0/0x74 [uvcvideo]) from [bf014308]
(uvc_v4l2_do_ioctl+0xce4/0xf50 [uvcvideo])
r7:c7265e68 r6:c79f9e00 r5:c78d4760 r4:40045613
[bf013624] (uvc_v4l2_do_ioctl+0x0/0xf50 [uvcvideo]) from
[bf008e20] (video_usercopy+0x1b8/0x2b8 [videodev])
[bf008c68] (video_usercopy+0x0/0x2b8 [videodev]) from [bf012fdc]
(uvc_v4l2_ioctl+0x54/0x68 [uvcvideo])
[bf012f88] (uvc_v4l2_ioctl+0x0/0x68 [uvcvideo]) from [c00ace28]
(vfs_ioctl+0x68/0x78)
r7:c79eb400 r6:0003 r5:40c78ccc r4:40045613
[c00acdc0] (vfs_ioctl+0x0/0x78) from [c00ad0a8] (do_vfs_ioctl+0x270/0x280)
r5:40c78ccc r4:c79eb400
[c00ace38] (do_vfs_ioctl+0x0/0x280) from [c00ad0f8] (sys_ioctl+0x40/0x64)
r7:c79eb400 r6:40045613 r5:40c78ccc r4:0003
[c00ad0b8] (sys_ioctl+0x0/0x64) from [c0033c80] (ret_fast_syscall+0x0/0x2c)

- Nathan
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] OMAP3: Update USBHOST pinmux settings

2008-09-26 Thread Gadiyar, Anand
Tony,

Hold off on this patch. Will send a better one on Monday.

David pointerd out that the comments mentiond 4-pin PHY 
mode, but six pins are described. Also, I just noticed that
TXENs are marked as inputs - I believe they should be
outputs. Will test the updated patch and resend.

Thanks Dave,

- Anand

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Gadiyar, Anand
 Sent: Friday, September 26, 2008 9:05 PM
 To: linux-omap@vger.kernel.org
 Subject: [PATCH] OMAP3: Update USBHOST pinmux settings
 
 From: Anand Gadiyar [EMAIL PROTECTED]
 
 Add pin-mux settings for OHCI in PHY mode.
 Also change settings for EHCI in TLL mode.
 
 Signed-off-by: Anand Gadiyar [EMAIL PROTECTED]
 ---
  arch/arm/mach-omap2/mux.c |   67 
 +++---
  arch/arm/plat-omap/include/mach/mux.h |   26 -
  2 files changed, 80 insertions(+), 13 deletions(-)
 
 Index: tony/arch/arm/mach-omap2/mux.c
 ===
 --- tony.orig/arch/arm/mach-omap2/mux.c   2008-09-04 
 12:57:33.0 +0530
 +++ tony/arch/arm/mach-omap2/mux.c2008-09-26 
 20:49:24.963867406 +0530
 @@ -298,13 +298,13 @@ MUX_CFG_34XX(T2_3430_USB2HS_PHY_D7, 0x
  
  /* TLL - HSUSB: 12-pin TLL Port 1*/
  MUX_CFG_34XX(Y8_3430_USB1HS_TLL_CLK, 0x5da,
 - OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_OUTPUT)
 -MUX_CFG_34XX(Y9_3430_USB1HS_TLL_STP, 0x5d8,
   OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +MUX_CFG_34XX(Y9_3430_USB1HS_TLL_STP, 0x5d8,
 + OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLUP)
  MUX_CFG_34XX(AA14_3430_USB1HS_TLL_DIR, 0x5ec,
 - OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_OUTPUT)
 + OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
  MUX_CFG_34XX(AA11_3430_USB1HS_TLL_NXT, 0x5ee,
 - OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_OUTPUT)
 + OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
  MUX_CFG_34XX(W13_3430_USB1HS_TLL_D0, 0x5dc,
   OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
  MUX_CFG_34XX(W12_3430_USB1HS_TLL_D1, 0x5de,
 @@ -324,13 +324,13 @@ MUX_CFG_34XX(Y13_3430_USB1HS_TLL_D7, 0
  
  /* TLL - HSUSB: 12-pin TLL Port 2*/
  MUX_CFG_34XX(AA8_3430_USB2HS_TLL_CLK, 0x5f0,
 - OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_OUTPUT)
 -MUX_CFG_34XX(AA10_3430_USB2HS_TLL_STP, 0x5f2,
   OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +MUX_CFG_34XX(AA10_3430_USB2HS_TLL_STP, 0x5f2,
 + OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLUP)
  MUX_CFG_34XX(AA9_3430_USB2HS_TLL_DIR, 0x5f4,
 - OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_OUTPUT)
 + OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
  MUX_CFG_34XX(AB11_3430_USB2HS_TLL_NXT, 0x5f6,
 - OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_OUTPUT)
 + OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
  MUX_CFG_34XX(AB10_3430_USB2HS_TLL_D0, 0x5f8,
   OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
  MUX_CFG_34XX(AB9_3430_USB2HS_TLL_D1, 0x5fa,
 @@ -350,13 +350,13 @@ MUX_CFG_34XX(T2_3430_USB2HS_TLL_D7, 0x
  
  /* TLL - HSUSB: 12-pin TLL Port 3*/
  MUX_CFG_34XX(AA6_3430_USB3HS_TLL_CLK, 0x180,
 - OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_OUTPUT)
 -MUX_CFG_34XX(AB3_3430_USB3HS_TLL_STP, 0x166,
   OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +MUX_CFG_34XX(AB3_3430_USB3HS_TLL_STP, 0x166,
 + OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLUP)
  MUX_CFG_34XX(AA3_3430_USB3HS_TLL_DIR, 0x168,
 - OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_OUTPUT)
 + OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
  MUX_CFG_34XX(Y3_3430_USB3HS_TLL_NXT, 0x16a,
 - OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_OUTPUT)
 + OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
  MUX_CFG_34XX(AA5_3430_USB3HS_TLL_D0, 0x186,
   OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
  MUX_CFG_34XX(Y4_3430_USB3HS_TLL_D1, 0x184,
 @@ -373,6 +373,49 @@ MUX_CFG_34XX(AA13_3430_USB3HS_TLL_D6, 
   OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
  MUX_CFG_34XX(AA12_3430_USB3HS_TLL_D7, 0x172,
   OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +
 +/* PHY FSUSB: FS Serial PHY 4-pin mode for Port 1*/
 +MUX_CFG_34XX(AF10_3430_USB1FS_PHY_MM1_RXDP, 0x5d8,
 + OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +MUX_CFG_34XX(AG9_3430_USB1FS_PHY_MM1_RXDM, 0x5ee,
 + OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +MUX_CFG_34XX(W13_3430_USB1FS_PHY_MM1_RXRCV, 0x5dc,
 + OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +MUX_CFG_34XX(W12_3430_USB1FS_PHY_MM1_TXSE0, 0x5de,
 + OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +MUX_CFG_34XX(W11_3430_USB1FS_PHY_MM1_TXDAT, 0x5e0,
 + OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +MUX_CFG_34XX(Y11_3430_USB1FS_PHY_MM1_TXEN_N, 0x5ea,
 + OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
 +
 +/* PHY 

Re: [PATCH 9/9] i2c: move twl4030-madc to new registration style

2008-09-26 Thread Felipe Balbi
On Fri, Sep 26, 2008 at 10:09:12AM -0700, David Brownell wrote:
 On Friday 26 September 2008, Felipe Balbi wrote:
   arch/arm/mach-omap2/board-2430sdp.c     |    6 +
   arch/arm/mach-omap2/board-3430sdp.c     |    6 +
   arch/arm/mach-omap2/board-ldp.c         |    6 +
   arch/arm/mach-omap2/board-omap2evm.c    |    6 +
   arch/arm/mach-omap2/board-omap3beagle.c |    6 +
   arch/arm/mach-omap2/board-omap3evm.c    |    6 +
   arch/arm/mach-omap2/board-overo.c       |    6 +
 
 The MADC stuff gave me:
 
 arch/arm/mach-omap2/board-omap3beagle.c:118: error: 'TWL4030_MADC_IMR1' 
 undeclared here (not in a function)
 arch/arm/mach-omap2/board-omap3beagle.c:119: error: 'TWL4030_MADC_ISR1' 
 undeclared here (not in a function)
 make[1]: *** [arch/arm/mach-omap2/board-omap3beagle.o] Error 1
 make[1]: *** Waiting for unfinished jobs
 make: *** [arch/arm/mach-omap2] Error 2
   CC  kernel/panic.o
 
 Ditto for Overo.
 
 
 Passing those registers in platform data seems bizarre.
 Doesn't the MADC code know its own register offsets??

there two of them. i[ms]r[12].

 The platform data should probably say which ADC channels
 are wired up...
 
 And no ADC lines are even hooked up on Beagle, so the right
 fix is just to not provide madc platform data on beagle.
 Probably the same is true on some other boards.

Yeah, i wasn't sure if beagle and overo were using them, so I put
anyways.

 Plus:  MADC is just a set of ADC channels, right?
 If so, the driver should have a comment saying that.

Mikko should comment on that as he wrote the driver.

-- 
balbi
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 8/9] twl4030 uses gpiolib

2008-09-26 Thread Felipe Balbi
On Fri, Sep 26, 2008 at 10:10:50AM -0700, David Brownell wrote:
 On Friday 26 September 2008, Felipe Balbi wrote:
  NYET-Signed-off-by: David Brownell [EMAIL PROTECTED]
  NYET-Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
 
 Err, strike the NYET- for me.  Editing mistake, that
 should have been removed before.  ;)

There were a few comments in the patch header that sugested me this
patch wasn't finished yet :-)

I'll stryke it out, np.

-- 
balbi
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: MUSB OTG Interrupts

2008-09-26 Thread Felipe Balbi
On Fri, Sep 26, 2008 at 12:00:17PM -0400, Ashwin Bihari wrote:
 Greetings,
 
 I've got a very curious problem with my OMAP3 based  board. I'm using
 the OMAPZOOM kernel v2.6.27-rc3 and have enabled MUSB in OTG mode
 (both host and perihperhal). I've got the file-backed-storage gadget.
 If I plug the mini-B connector to the board, it gets the appropriate
 interrupt and recognizes that it needs to be operate in peripheral
 mode and goes about it's business. However, when I plug in the mini-A
 connector to the board, there is no interrupt and no activity. I can
 then unplug the mini-A connector, and plug in the mini-B connector to
 get the interrupts and activity again.
 
 If I boot the board up with the mini-A connector plugged in, it is
 properly found/recognized during driver installation and any devices
 attached are properly found and can be used. The IRQs at this time
 fire properly. I have a thumb drive connected to a high speed hub
 connected to the OMAP board, and the drive is found, I can mount it
 and do everything. Now, in this particular case, if I unplug the
 mini-A connector and plug either the mini-A or mini-B connector,
 nothing happens at all.
 
 Why am I only getting interrupts with the mini-B connector and not the
 mini-A connector? Additionally, why does everything fail after my
 second scenario above?

Id pin interrupt handling is not done yet on twl4030-usb, I'm planning
to finish that part when we finish fixing twl children registration.

If you have to do that and send a patch, that's ok. Just be sure to make
it on top of latest twl4030-usb.c which I moved to platform_driver.

-- 
balbi
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] watchdog: fix typo in omap_wdt.c

2008-09-26 Thread Gadiyar, Anand
 -Original Message-
 From: Felipe Balbi [mailto:[EMAIL PROTECTED] 
 Sent: Friday, September 26, 2008 11:23 PM
 To: Gadiyar, Anand
 Cc: linux-omap@vger.kernel.org; [EMAIL PROTECTED]
 Subject: Re: [PATCH] watchdog: fix typo in omap_wdt.c
 
 On Fri, Sep 26, 2008 at 09:20:14PM +0530, Gadiyar, Anand wrote:
  From: Anand Gadiyar [EMAIL PROTECTED]
  
  Fix typo in omap_wdt.c introduced by a recent change
  
  Signed-off-by: Anand Gadiyar [EMAIL PROTECTED]
  ---
   drivers/watchdog/omap_wdt.c |2 +-
   1 files changed, 1 insertion(+), 1 deletion(-)
  
  Index: tony/drivers/watchdog/omap_wdt.c
  ===
  --- tony.orig/drivers/watchdog/omap_wdt.c   2008-09-25 
 16:45:08.0 +0530
  +++ tony/drivers/watchdog/omap_wdt.c2008-09-26 
 21:14:48.059042569 +0530
  @@ -283,7 +283,7 @@ static int __init omap_wdt_probe(struct 
  }
   
  if (omap_wdt_dev) {
  -   ret - EBUSY;
  +   ret = -EBUSY;
  goto err_busy;
  }
 
 Those patches weren't applied to linux-omap yet, so this change should
 be melded into the patch that introduced it. It's better to 
 resend that
 patch then to create a messed up bisect line.
 
 -- 
 balbi

Of course they were merged. I saw this warning when I compiled linux-omap,
when sending in that pin-muxing patch.

- Anand
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 8/9] twl4030 uses gpiolib

2008-09-26 Thread David Brownell
On Friday 26 September 2008, Felipe Balbi wrote:
 
  Err, strike the NYET- for me.  Editing mistake, that
  should have been removed before.  ;)
 
 There were a few comments in the patch header that sugested me this
 patch wasn't finished yet :-)

This patch is done.  The other work will be done later.

For example, all the existing users of these APIs are
in the hsmmc init logic.  That's kind of in flux now
(at least semi-broken).  When it works again, several
parts will change.

Likewise there are dependencies on some gpiolib features
that aren't yet merged.

- Dave

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


Re: [PATCH 0/9] twl4030 updates

2008-09-26 Thread David Brownell
On Friday 26 September 2008, David Brownell wrote:
 Let's apply the following patch 10/9 on top of this though.

And after applying this, and removing MADC config from
the Beagle and Overo board setup files, things worked!!

Moreover ... the USB host code worked, at least partially.
(Finally!  RC7.)  It enumerated the external hub, and the
Ethernet adapter hooked up to it.

But there were problems reading some chip registers via
control requests, and with MII read/write.  So it's not
all there yet.

- Dave

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


Re: [PATCH 0/9] twl4030 updates

2008-09-26 Thread Steve Sakoman
On Fri, Sep 26, 2008 at 12:00 PM, David Brownell [EMAIL PROTECTED] wrote:
 And after applying this, and removing MADC config from
 the Beagle and Overo board setup files, things worked!!

That's really great news!

 Moreover ... the USB host code worked, at least partially.
 (Finally!  RC7.)  It enumerated the external hub, and the
 Ethernet adapter hooked up to it.

Just to clarify -- you are referring to musb host code, correct?

Steve
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] watchdog: fix typo in omap_wdt.c

2008-09-26 Thread Felipe Balbi
On Fri, Sep 26, 2008 at 11:32:13PM +0530, Gadiyar, Anand wrote:
  -Original Message-
  From: Felipe Balbi [mailto:[EMAIL PROTECTED] 
  Sent: Friday, September 26, 2008 11:23 PM
  To: Gadiyar, Anand
  Cc: linux-omap@vger.kernel.org; [EMAIL PROTECTED]
  Subject: Re: [PATCH] watchdog: fix typo in omap_wdt.c
  
  On Fri, Sep 26, 2008 at 09:20:14PM +0530, Gadiyar, Anand wrote:
   From: Anand Gadiyar [EMAIL PROTECTED]
   
   Fix typo in omap_wdt.c introduced by a recent change
   
   Signed-off-by: Anand Gadiyar [EMAIL PROTECTED]
   ---
drivers/watchdog/omap_wdt.c |2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
   
   Index: tony/drivers/watchdog/omap_wdt.c
   ===
   --- tony.orig/drivers/watchdog/omap_wdt.c 2008-09-25 
  16:45:08.0 +0530
   +++ tony/drivers/watchdog/omap_wdt.c  2008-09-26 
  21:14:48.059042569 +0530
   @@ -283,7 +283,7 @@ static int __init omap_wdt_probe(struct 
 }

 if (omap_wdt_dev) {
   - ret - EBUSY;
   + ret = -EBUSY;
 goto err_busy;
 }
  
  Those patches weren't applied to linux-omap yet, so this change should
  be melded into the patch that introduced it. It's better to 
  resend that
  patch then to create a messed up bisect line.
  
  -- 
  balbi
 
 Of course they were merged. I saw this warning when I compiled linux-omap,
 when sending in that pin-muxing patch.

You're right, at first look I thought this was for omap_hdq.c :-p

Anyways, this patch should go also to Wim. Please send a copy of this
patch to him so he can apply to his tree as well, btw, here's his mail:

Wim Van Sebroeck [EMAIL PROTECTED]

-- 
balbi
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 9/9] i2c: move twl4030-madc to new registration style

2008-09-26 Thread Steve Sakoman
On Fri, Sep 26, 2008 at 12:50 PM, David Brownell [EMAIL PROTECTED] wrote:
 Steve, if Overo wires out any of the ADC channels on that
 one connector, you may want to come up with a better fox.

Overo does bring out the ADC channels to one of the 2 70 pin connectors.

Let's go ahead with your proposed patch for now.  I will revisit it
when I get an Overo buddy board that actually makes the ADC channels
accessible.  At that point I can prepare a patch that includes all
changes required to get the ADC stuff functioning.

Steve
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


OMAP3EVM LCD red tint

2008-09-26 Thread Daniel Schaeffer
Has anyone looked into why the LCD display on the OMAP3EVM is always 
tinted red? I created a couple of color test images that I cat'ed to 
/dev/fb and it looks like the blue color channel is completely ignored. 
 I was testing on v2.6.26-omap2 but is doesn't look like there have 
been any changes to the fb driver since then so I'm assuming the issue 
is also present in the head of the git tree.


Regards,

Daniel Schaeffer

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