Re: [PATCH v3 4/4] omap: mailbox: convert block api to kfifo

2010-06-15 Thread Hiroshi DOYU
From: ext C.A, Subramaniam subramaniam...@ti.com
Subject: RE: [PATCH v3 4/4] omap: mailbox: convert block api to kfifo
Date: Mon, 14 Jun 2010 17:56:35 +0200

 Hi Ohad/Hiroshi,
 
 Good to see the new mailbox requirements. While we are at it can we add some 
 more :)?
 
 * Make the mailbox as a generic driver. 
   Meaning, users can request for a pair of mailbox rather than
 using a set of pre-defined ones. For eg: Instead of doing an
 omap_mbox_get(mailbox-1) we can have the user specify the mailbox
 pair that he needs ( omap_mbox_get(int tx_mbox, int rx_mbox) or
 similar API ). This also means that we remove the bulk of the data
 structures like omap2_mbox_1_priv and mbox_1_info and so
 on. Additional checks needs to be done so that consequtive requests
 to the driver does not re-configure the rx-tx pairs.
 
 Rationale: 
 The pre-configured structures does make sense in case of DSP Bridge,
 since it is the only user of mailbox. However, for Syslink for
 example, (or for any other IPC or user of mailbox) it would be good
 for the user of the mailbox to request the pair (or just tx/rx) from
 user/kernel side.

Fair enough.

 * Provide debug support for the mailboxes (relevant for OMAP4)
   Since OMAP4 has support to read the RAW registers we might as
 well add an API for the user to read the status from RAW registers.

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


Re: [PATCH v5] OMAP: Fix for bus width which improves SD card's peformance.

2010-06-15 Thread kishore kadiyala
Sorry its Line wrapped and please drop this, Will be reposting the same.

Regards,
Kishore

On Mon, Jun 14, 2010 at 9:40 PM, kishore kadiyala
kishorek.kadiy...@gmail.com wrote:
 This patch improves low speeds for SD cards.
 OMAP-MMC controller's can support maximum bus width of '8'.
 when bus width is mentioned as 8 in controller data,the SD
 stack will check whether bus width is 4 and if not it will
 set bus width to 1 and there by degrading performance.
 This patch fixes the issue and improves the performance of
 SD cards.

 Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
 Signed-off-by: Venkatraman S svenk...@ti.com
 Signed-off-by: Nishanth Menon n...@ti.com
 Acked-by: Madhusudhan Chikkature madhu...@ti.com
 Tested-by: Jarkko Nikula jhnik...@gmail.com
 ---
 In V5 : Rebasing on 2.6.35-rc3
 In V4 : Updated with Nishanth's comments and appened his Signed-off
        http://marc.info/?t=12716914936r=1w=2
 In V3 : Updated  with Madhu's comments  and appended Tested by Nikula
 In V2 : Appended Signed-off by Venkat and Ack by Madhu

 Here are my experiment numbers, on a Class 6 SDHC card:
 Read peformance is increased by 220%
 Write Performance is increased by 52%

  drivers/mmc/host/omap_hsmmc.c |   17 +++--
  1 files changed, 15 insertions(+), 2 deletions(-)

 diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
 index b032828..a0c8515 100644
 --- a/drivers/mmc/host/omap_hsmmc.c
 +++ b/drivers/mmc/host/omap_hsmmc.c
 @@ -2096,10 +2096,23 @@ static int __init omap_hsmmc_probe(struct
 platform_device *pdev)
        mmc-caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
                     MMC_CAP_WAIT_WHILE_BUSY;

 -       if (mmc_slot(host).wires = 8)
 +       switch (mmc_slot(host).wires) {
 +       case 8:
                mmc-caps |= MMC_CAP_8_BIT_DATA;
 -       else if (mmc_slot(host).wires = 4)
 +               /* Fall through */
 +       case 4:
                mmc-caps |= MMC_CAP_4_BIT_DATA;
 +               break;
 +       case 1:
 +               /* Nothing to crib here */
 +       case 0:
 +               /* Assuming nothing was given by board, Core use's 1-Bit */
 +               break;
 +       default:
 +               /* Completely unexpected.. Core goes with 1-Bit Width */
 +               dev_crit(mmc_dev(host-mmc), Invalid width %d\n used!
 +                       using 1 instead\n, mmc_slot(host).wires);
 +       }

        if (mmc_slot(host).nonremovable)
                mmc-caps |= MMC_CAP_NONREMOVABLE;
 --
 1.6.3.3

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


Re: [PATCH v3 4/4] omap: mailbox: convert block api to kfifo

2010-06-15 Thread Hiroshi DOYU
Hi Ohad,

From: ext Ohad Ben-Cohen o...@wizery.com
Subject: Re: [PATCH v3 4/4] omap: mailbox: convert block api to kfifo
Date: Tue, 15 Jun 2010 06:43:21 +0200

 Hi Hiroshi,
 
 On Mon, Jun 14, 2010 at 3:58 AM, Hiroshi DOYU hiroshi.d...@nokia.com wrote:
 Does dspbridge really need its own defered work for sending mailbox
 messages?
 
 We do, according to
 
 http://permalink.gmane.org/gmane.linux.ports.arm.omap/38240

I am wondering that this defered work may not be necessary just for
the serialization.

 (thanks Rene for the explanation).
 
 For recieving, its defered work(tasklet) can be trigered directly in
 the above proposed callback, that callback can triger its own
 workqueue if necessary, then.
 
 Agree
 
 I think that, for recieving, some PM
 command may has to be sent back immedieately inside of
 tasklet. omap_mbox_msg_send_sync() may handle this case.
 
 Not sure how much QoS is an issue with mailbox (do we really have
 latency issues ?), but I guess adding such interface can't hurt.

This solves the one case of lockdep issue.

 I think that workqueue is only necessary when it has to sleep,
 otherwise tasklet is prefered.
 
 I must say I disagree; tasklets are really not friendly to the whole
 system's responsiveness and should be used only if really needed
 (there was even an attempt to remove them entirely in the past:
 http://lwn.net/Articles/239633/).

Evoking a workqueue may be overkilling just for putting several bytes
into registers since large part of contents is usually passed through
shared memory.

 I'd like to allow mutiple listners in some way, as the flexibility of
 mailbox functionalty.
 
 This can be achieved using notifier chains of multiple listeners
 callback, but I agree with Felipe: do we really want this
 functionality ? I just rather not add code that no one is going to
 use.
 
 What do you say we start with enforcing only 1 listener and later, if
 the use case of several listeners shows up, we'd add that support
 (promise! :) ?

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


[PATCH v5] OMAP: Fix for bus width which improves SD card's peformance.

2010-06-15 Thread kishore kadiyala
From: Kishore Kadiyala kishore.kadiy...@ti.com

This patch improves low speeds for SD cards.
OMAP-MMC controller's can support maximum bus width of '8'.
when bus width is mentioned as 8 in controller data,the SD
stack will check whether bus width is 4 and if not it will
set bus width to 1 and there by degrading performance.
This patch fixes the issue and improves the performance of
SD cards.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
Signed-off-by: Nishanth Menon n...@ti.com
Acked-by: Madhusudhan Chikkature madhu...@ti.com
Tested-by: Jarkko Nikula jhnik...@gmail.com
---
In V5 : Rebasing on 2.6.35-rc3
In V4 : Updated with Nishanth's comments and appened his Signed-off
http://marc.info/?t=12716914936r=1w=2
In V3 : Updated  with Madhu's comments  and appended Tested by Nikula
In V2 : Appended Signed-off by Venkat and Ack by Madhu

Here are my experiment numbers, on a Class 6 SDHC card:
Read peformance is increased by 220%
Write Performance is increased by 52%

 drivers/mmc/host/omap_hsmmc.c |   17 +++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index b032828..a0c8515 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2096,10 +2096,23 @@ static int __init omap_hsmmc_probe(struct
mmc-caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
 MMC_CAP_WAIT_WHILE_BUSY;

-   if (mmc_slot(host).wires = 8)
+   switch (mmc_slot(host).wires) {
+   case 8:
mmc-caps |= MMC_CAP_8_BIT_DATA;
-   else if (mmc_slot(host).wires = 4)
+   /* Fall through */
+   case 4:
mmc-caps |= MMC_CAP_4_BIT_DATA;
+   break;
+   case 1:
+   /* Nothing to crib here */
+   case 0:
+   /* Assuming nothing was given by board, Core use's 1-Bit */
+   break;
+   default:
+   /* Completely unexpected.. Core goes with 1-Bit Width */
+   dev_crit(mmc_dev(host-mmc), Invalid width %d\n used!
+   using 1 instead\n, mmc_slot(host).wires);
+   }

if (mmc_slot(host).nonremovable)
mmc-caps |= MMC_CAP_NONREMOVABLE;
-- 
1.6.3.3
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v3 3/3] DSS2 FB Allow usage of def_vrfb only for omap2,3

2010-06-15 Thread Guruswamy, Senthilvadivu
Tomi, 

 -Original Message-
 From: Guruswamy, Senthilvadivu 
 Sent: Thursday, June 10, 2010 4:54 PM
 To: linux-omap@vger.kernel.org; linux-fb...@vger.kernel.org; 
 t...@atomide.com; tomi.valkei...@nokia.com; Hiremath, Vaibhav
 Cc: Guruswamy, Senthilvadivu
 Subject: [PATCH v3 3/3] DSS2 FB Allow usage of def_vrfb only 
 for omap2,3
 
 From: Senthilvadivu Guruswamy svad...@ti.com
 
 Changes since v2:
   Added a check to warn the wrong usage of vrfb in 
 non-vrfb omap devices.
 
 Force def_vrfb to 0 for non omap2, omap3 devices
 
 Signed-off-by: Senthilvadivu Guruswamy svad...@ti.com
 ---
  drivers/video/omap2/omapfb/omapfb-main.c |   10 ++
  1 files changed, 10 insertions(+), 0 deletions(-)
 
 diff --git a/drivers/video/omap2/omapfb/omapfb-main.c 
 b/drivers/video/omap2/omapfb/omapfb-main.c
 index 4b4506d..0f79db8 100644
 --- a/drivers/video/omap2/omapfb/omapfb-main.c
 +++ b/drivers/video/omap2/omapfb/omapfb-main.c
 @@ -2128,6 +2128,16 @@ static int omapfb_probe(struct 
 platform_device *pdev)
   goto err0;
   }
  
 + /* TODO : Replace cpu check with omap_has_vrfb once HAS_FEATURE
 + *available for OMAP2 and OMAP3
 + */
 + if (def_vrfb  (!cpu_is_omap24xx())  (!cpu_is_omap34xx())) {
 + def_vrfb = 0;
 + dev_warn(pdev-dev, VRFB is not in this device,
 + using DMA for rotation\n);
 + }
 +
 +
   mutex_init(fbdev-mtx);

[Senthil]  All the comments received are incorporated in this v3.
I don't see any more comments on this patch series.  Is it
fine for you to take up this series of patches?
   fbdev-dev = pdev-dev;
 -- 
 1.6.3.3
 
 --
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[no subject]

2010-06-15 Thread omar hasan
I have a urgent message to share with you get back to me for details...
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v5 0/3] omap3 nand: cleanup exiting platform related code

2010-06-15 Thread Ghorai, Sukumar
Tony,

 -Original Message-
 From: Vimal Singh [mailto:vimal.neww...@gmail.com]
 Sent: Tuesday, June 08, 2010 10:43 PM
 To: Ghorai, Sukumar
 Cc: linux-omap@vger.kernel.org; linux-...@lists.infradead.org;
 t...@atomide.com; m...@compulab.co.il
 Subject: Re: [PATCH v5 0/3] omap3 nand: cleanup exiting platform related
 code
 
 Reviewed-by: Vimal Singh vimal.neww...@gmail.com
 
 On Fri, Jun 4, 2010 at 1:10 PM, Sukumar Ghorai s-gho...@ti.com wrote:
    The following set of patches applies on top of for-next branch.
         http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-
 2.6.git
    Patches verified on: omap3430-SDP, omap3630-sdp, zoom3 and beagle
 board
 
    And these are the patches required to address the following input -
      1. The NAND driver needs to stop tinkering with the GPMC registers
         The omap General Purpose Memory Controller (GPMC) registers are
 omap
         specific, and not driver specific. Tinkering with these registers
 can
         cause issues with the other devices on the GPMC.
 
      2. Passing hardcoded GPMC_CS0_BASE needs to go from the board files
         Passing hardcoded GPMC virtual addressess is sure way to mess up
 things.
         This should all become unnecessary once the NAND drivers stops
 messing
         with the GPMC registers directly.
      Discussion: http://www.mail-archive.com/linux-
 o...@vger.kernel.org/msg27630.html
 
    Changes in this series -
                 Unused function removed.
 
   Functions related to ecc and prefetch engine are optimized.
   v4: http://www.mail-archive.com/linux-
 o...@vger.kernel.org/msg29458.html
 
   Few functionality was missing  like - There should be some locking as
 only
    one chipselect can use the ECC or prefetch engine at a time. If you
 have
    NAND in two chipselects, bad things would happen.
   v3: http://www.mail-archive.com/linux-
 o...@vger.kernel.org/msg28715.html
 
   Additionally, it was needed to implement more functions for the
 platform
   init code to use.
   v2: http://www.mail-archive.com/linux-
 o...@vger.kernel.org/msg28467.html
 
   v1: http://www.mail-archive.com/linux-
 o...@vger.kernel.org/msg28164.html
 
 
  Sukumar Ghorai (3):
         omap3 gpmc: functionality enhancement
         omap3 nand: cleanup virtual address usages
         omap3 nand: fix issue in board file to detect nand
   arch/arm/mach-omap2/board-cm-t35.c         |   20 +---
   arch/arm/mach-omap2/board-devkit8000.c     |   25 +---
   arch/arm/mach-omap2/board-omap3beagle.c    |   24 +---
   arch/arm/mach-omap2/board-omap3touchbook.c |   25 +---
   arch/arm/mach-omap2/board-overo.c          |   24 +---
   arch/arm/mach-omap2/board-sdp-flash.c      |    5 -
   arch/arm/mach-omap2/gpmc-nand.c            |   39 ++
   arch/arm/mach-omap2/gpmc.c                 |  228
 +---
   arch/arm/plat-omap/include/plat/gpmc.h     |   36 -
   arch/arm/plat-omap/include/plat/nand.h     |    6 +-
   drivers/mtd/nand/omap2.c                   |  229 -
 ---
   11 files changed, 320 insertions(+), 341 deletions(-)

[Ghorai] Any comments or input on these patch?

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


[RFC] [PATCH] Board changes for tmp105 temperature sensor

2010-06-15 Thread Datta, Shubhrajyoti
Adding board configuration for the tmp105
temperature sensor. The interface to the sensor
is I2C.

Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)
 mode change 100644 = 100755 arch/arm/mach-omap2/board-4430sdp.c

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
old mode 100644
new mode 100755
index 4bb2c5d..3e3b222
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -353,6 +353,11 @@ static struct i2c_board_info __initdata 
sdp4430_i2c_boardinfo[] = {
.platform_data = sdp4430_twldata,
},
 };
+static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
+   {
+   I2C_BOARD_INFO(tmp105, 0x48),
+   },
+};
 static int __init omap4_i2c_init(void)
 {
/*
@@ -362,7 +367,8 @@ static int __init omap4_i2c_init(void)
omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo,
ARRAY_SIZE(sdp4430_i2c_boardinfo));
omap_register_i2c_bus(2, 400, NULL, 0);
-   omap_register_i2c_bus(3, 400, NULL, 0);
+   omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
+   ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
omap_register_i2c_bus(4, 400, NULL, 0);
return 0;
 }
-- 
1.5.4.7

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


SDHC card affected by preemption model in 2.6.35

2010-06-15 Thread Mathieu Poirier
HW: Beagleboard rev. C2 and C4
Processor: OMAP3
Kernel: 2.6.35-rc2
Driver: mmci-omap-hs

I am faced with an SDHC card problem on a beagleboard.  Some cards
cannot be initialized on startup while others work perfectly.  I tracked
the issue down to one single kernel config: PREEMPT_VOLUNTARY.  

When going from PREEMPT_VOLUNTARY to PREEMPT_NONE the problem goes away.

When booting, a failing card (PREEMPT_VOLUNTARY) will output the
following: 
[ 2.283355] mmc0: error -110 whilst initialising SD card

I have also seen transfer errors such as this one: 
[ 105.343780] mmcblk0: error -110 transferring data, sector 798431, nr
26, card status 0xc00 

When working properly (PREEMPT_NONE), you get: 
[   27.026519] mmc0: new high speed SDHC card at address 0007
[   27.075775] mmcblk0: mmc0:0007 SD08G 7.49 GiB 

We seem to have a little timing problem - has anyone seen the same
issue ?  Can driver mmci-omap-hs actually work under
PREEMPT_VOLUNTARY ? 

Thanks, Mathieu.




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


[PATCH 07/13 v3] OMAP: GPIO: add GPIO hwmods structures for OMAP3

2010-06-15 Thread Varadarajan, Charulatha
From: Charulatha V ch...@ti.com

Add hwmod structures for GPIO module on OMAP3

Signed-off-by: Charulatha V ch...@ti.com
Signed-off-by: Rajendra Nayak rna...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  366 
 1 files changed, 366 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index e288b20..91ef205 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -17,6 +17,7 @@
 #include mach/irqs.h
 #include plat/cpu.h
 #include plat/dma.h
+#include plat/gpio.h
 
 #include omap_hwmod_common_data.h
 
@@ -81,6 +82,12 @@ static struct omap_hwmod omap3xxx_l3_hwmod = {
 };
 
 static struct omap_hwmod omap3xxx_l4_wkup_hwmod;
+static struct omap_hwmod omap3xxx_gpio1_hwmod;
+static struct omap_hwmod omap3xxx_gpio2_hwmod;
+static struct omap_hwmod omap3xxx_gpio3_hwmod;
+static struct omap_hwmod omap3xxx_gpio4_hwmod;
+static struct omap_hwmod omap3xxx_gpio5_hwmod;
+static struct omap_hwmod omap3xxx_gpio6_hwmod;
 
 /* L4_CORE - L4_WKUP interface */
 static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = {
@@ -89,6 +96,114 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = 
{
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* L4 WKUP - GPIO1 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio1_addrs[] = {
+   {
+   .pa_start   = OMAP34XX_GPIO1_BASE,
+   .pa_end = OMAP34XX_GPIO1_BASE + SZ_4K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__gpio1 = {
+   .master = omap3xxx_l4_wkup_hwmod,
+   .slave  = omap3xxx_gpio1_hwmod,
+   .clk= gpio1_ick,
+   .addr   = omap3xxx_gpio1_addrs,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_gpio1_addrs),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 PER - GPIO2 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio2_addrs[] = {
+   {
+   .pa_start   = OMAP34XX_GPIO2_BASE,
+   .pa_end = OMAP34XX_GPIO2_BASE + SZ_4K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio2 = {
+   .master = omap3xxx_l4_per_hwmod,
+   .slave  = omap3xxx_gpio2_hwmod,
+   .clk= gpio2_ick,
+   .addr   = omap3xxx_gpio2_addrs,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_gpio2_addrs),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 PER - GPIO3 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio3_addrs[] = {
+   {
+   .pa_start   = OMAP34XX_GPIO3_BASE,
+   .pa_end = OMAP34XX_GPIO3_BASE + SZ_4K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio3 = {
+   .master = omap3xxx_l4_per_hwmod,
+   .slave  = omap3xxx_gpio3_hwmod,
+   .clk= gpio3_ick,
+   .addr   = omap3xxx_gpio3_addrs,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_gpio3_addrs),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 PER - GPIO4 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio4_addrs[] = {
+   {
+   .pa_start   = OMAP34XX_GPIO4_BASE,
+   .pa_end = OMAP34XX_GPIO4_BASE + SZ_4K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio4 = {
+   .master = omap3xxx_l4_per_hwmod,
+   .slave  = omap3xxx_gpio4_hwmod,
+   .clk= gpio4_ick,
+   .addr   = omap3xxx_gpio4_addrs,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_gpio4_addrs),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 PER - GPIO5 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio5_addrs[] = {
+   {
+   .pa_start   = OMAP34XX_GPIO5_BASE,
+   .pa_end = OMAP34XX_GPIO5_BASE + SZ_4K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio5 = {
+   .master = omap3xxx_l4_per_hwmod,
+   .slave  = omap3xxx_gpio5_hwmod,
+   .clk= gpio5_ick,
+   .addr   = omap3xxx_gpio5_addrs,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_gpio5_addrs),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 PER - GPIO6 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio6_addrs[] = {
+   {
+   .pa_start   = OMAP34XX_GPIO6_BASE,
+   .pa_end = OMAP34XX_GPIO6_BASE + SZ_4K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio6 = {
+   .master = 

[PATCH 12/13 v3] OMAP: GPIO: Implement GPIO as a platform device

2010-06-15 Thread Varadarajan, Charulatha
From: Charulatha V ch...@ti.com

This patch implements GPIO as a platform device. Also it
implements OMAP2PLUS specific GPIO as HWMOD FW adapted device.
OMAP2PLUS GPIO uses runtime APIs.

GPIO APIs are used in machine_init functions. Hence it is
required to complete GPIO probe before machine_init. Therefore
GPIO device register and driver register are implemented as
postcore_initcalls.

Inorder to convert GPIO as platform device, modifications are
required in clock_data.c file for OMAP1 so that device names
can be used to obtain clock instead of getting clocks by
name/NULL ptr.

omap_gpio_init() does nothing now and this function would be
removed in the next patch as it's usage is spread across most of
the board files.

Signed-off-by: Charulatha V ch...@ti.com
Signed-off-by: Rajendra Nayak rna...@ti.com
---
 arch/arm/mach-omap1/Makefile |6 +
 arch/arm/mach-omap1/clock_data.c |4 +-
 arch/arm/mach-omap2/Makefile |2 +-
 arch/arm/plat-omap/gpio.c|  425 ++
 4 files changed, 120 insertions(+), 317 deletions(-)

diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index ea231c7..88f0905 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -46,6 +46,12 @@ ifeq ($(CONFIG_ARCH_OMAP15XX),y)
 obj-$(CONFIG_MACH_OMAP_INNOVATOR)  += fpga.o
 endif
 
+# GPIO
+obj-$(CONFIG_ARCH_OMAP730) += gpio7xx.o
+obj-$(CONFIG_ARCH_OMAP850) += gpio7xx.o
+obj-$(CONFIG_ARCH_OMAP15XX)+= gpio15xx.o
+obj-$(CONFIG_ARCH_OMAP16XX)+= gpio16xx.o
+
 # LEDs support
 led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o
 led-$(CONFIG_MACH_OMAP_H3) += leds-h2p2-debug.o
diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c
index aa8558a..5c2a0a1 100644
--- a/arch/arm/mach-omap1/clock_data.c
+++ b/arch/arm/mach-omap1/clock_data.c
@@ -99,7 +99,7 @@ static struct arm_idlect1_clk armper_ck = {
  * activation.  [ GPIO code for 1510 ]
  */
 static struct clk arm_gpio_ck = {
-   .name   = arm_gpio_ck,
+   .name   = ick,
.ops= clkops_generic,
.parent = ck_dpll1,
.flags  = ENABLE_ON_INIT,
@@ -589,7 +589,7 @@ static struct omap_clk omap_clks[] = {
CLK(NULL,   ck_sossi, sossi_ck,  CK_16XX),
CLK(NULL,   arm_ck,   arm_ck,CK_16XX | CK_1510 | 
CK_310),
CLK(NULL,   armper_ck,armper_ck.clk, CK_16XX | CK_1510 | 
CK_310),
-   CLK(NULL,   arm_gpio_ck,  arm_gpio_ck,   CK_1510 | CK_310),
+   CLK(omap-gpio.0, ick, arm_gpio_ck, CK_1510 | CK_310),
CLK(NULL,   armxor_ck,armxor_ck.clk, CK_16XX | CK_1510 | 
CK_310 | CK_7XX),
CLK(NULL,   armtim_ck,armtim_ck.clk, CK_16XX | CK_1510 | 
CK_310),
CLK(omap_wdt, fck,  armwdt_ck.clk, CK_16XX | CK_1510 | 
CK_310),
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index ae5f36f..0756b84 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -3,7 +3,7 @@
 #
 
 # Common support
-obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o
+obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o gpio.o
 
 omap-2-3-common= irq.o sdrc.o
 hwmod-common   = omap_hwmod.o \
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 3ea616a..81d8e2d 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -21,7 +21,10 @@
 #include linux/err.h
 #include linux/clk.h
 #include linux/io.h
+#include linux/slab.h
+#include linux/pm_runtime.h
 
+#include plat/omap_device.h
 #include mach/hardware.h
 #include asm/irq.h
 #include mach/irqs.h
@@ -32,7 +35,6 @@
 /*
  * OMAP1510 GPIO registers
  */
-#define OMAP1510_GPIO_BASE 0xfffce000
 #define OMAP1510_GPIO_DATA_INPUT   0x00
 #define OMAP1510_GPIO_DATA_OUTPUT  0x04
 #define OMAP1510_GPIO_DIR_CONTROL  0x08
@@ -46,10 +48,6 @@
 /*
  * OMAP1610 specific GPIO registers
  */
-#define OMAP1610_GPIO1_BASE0xfffbe400
-#define OMAP1610_GPIO2_BASE0xfffbec00
-#define OMAP1610_GPIO3_BASE0xfffbb400
-#define OMAP1610_GPIO4_BASE0xfffbbc00
 #define OMAP1610_GPIO_REVISION 0x
 #define OMAP1610_GPIO_SYSCONFIG0x0010
 #define OMAP1610_GPIO_SYSSTATUS0x0014
@@ -71,12 +69,6 @@
 /*
  * OMAP7XX specific GPIO registers
  */
-#define OMAP7XX_GPIO1_BASE 0xfffbc000
-#define OMAP7XX_GPIO2_BASE 0xfffbc800
-#define OMAP7XX_GPIO3_BASE 0xfffbd000
-#define OMAP7XX_GPIO4_BASE 0xfffbd800
-#define OMAP7XX_GPIO5_BASE 0xfffbe000
-#define OMAP7XX_GPIO6_BASE 0xfffbe800
 #define OMAP7XX_GPIO_DATA_INPUT0x00
 #define OMAP7XX_GPIO_DATA_OUTPUT   0x04
 #define OMAP7XX_GPIO_DIR_CONTROL   0x08

[PATCH 13/13 v3] OMAP: GPIO: Remove omap_gpio_init()

2010-06-15 Thread Varadarajan, Charulatha
From: Charulatha V ch...@ti.com

This patch removes the usage of omap_gpio_init() from all
omap board files since omap_gpio_init() does nothing, after gpio
is implemented as a platform device.

Signed-off-by: Charulatha V ch...@ti.com
---
 arch/arm/mach-omap1/board-ams-delta.c  |1 -
 arch/arm/mach-omap1/board-fsample.c|1 -
 arch/arm/mach-omap1/board-h2.c |1 -
 arch/arm/mach-omap1/board-h3.c |1 -
 arch/arm/mach-omap1/board-htcherald.c  |1 -
 arch/arm/mach-omap1/board-innovator.c  |1 -
 arch/arm/mach-omap1/board-nokia770.c   |1 -
 arch/arm/mach-omap1/board-osk.c|1 -
 arch/arm/mach-omap1/board-palmte.c |1 -
 arch/arm/mach-omap1/board-palmz71.c|1 -
 arch/arm/mach-omap1/board-perseus2.c   |1 -
 arch/arm/mach-omap1/board-sx1.c|1 -
 arch/arm/mach-omap1/board-voiceblue.c  |1 -
 arch/arm/mach-omap2/board-2430sdp.c|1 -
 arch/arm/mach-omap2/board-3430sdp.c|1 -
 arch/arm/mach-omap2/board-3630sdp.c|1 -
 arch/arm/mach-omap2/board-4430sdp.c|1 -
 arch/arm/mach-omap2/board-am3517evm.c  |1 -
 arch/arm/mach-omap2/board-apollon.c|1 -
 arch/arm/mach-omap2/board-cm-t35.c |1 -
 arch/arm/mach-omap2/board-devkit8000.c |1 -
 arch/arm/mach-omap2/board-h4.c |1 -
 arch/arm/mach-omap2/board-igep0020.c   |1 -
 arch/arm/mach-omap2/board-ldp.c|1 -
 arch/arm/mach-omap2/board-n8x0.c   |1 -
 arch/arm/mach-omap2/board-omap3beagle.c|1 -
 arch/arm/mach-omap2/board-omap3evm.c   |1 -
 arch/arm/mach-omap2/board-omap3pandora.c   |1 -
 arch/arm/mach-omap2/board-omap3stalker.c   |1 -
 arch/arm/mach-omap2/board-omap3touchbook.c |1 -
 arch/arm/mach-omap2/board-overo.c  |1 -
 arch/arm/mach-omap2/board-rx51.c   |1 -
 arch/arm/mach-omap2/board-zoom2.c  |1 -
 arch/arm/mach-omap2/board-zoom3.c  |1 -
 arch/arm/plat-omap/gpio.c  |6 --
 arch/arm/plat-omap/include/plat/gpio.h |1 -
 36 files changed, 0 insertions(+), 41 deletions(-)

diff --git a/arch/arm/mach-omap1/board-ams-delta.c 
b/arch/arm/mach-omap1/board-ams-delta.c
index fdd1dd5..75d1bd0 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -136,7 +136,6 @@ static void __init ams_delta_init_irq(void)
 {
omap1_init_common_hw();
omap_init_irq();
-   omap_gpio_init();
 }
 
 static struct map_desc ams_delta_io_desc[] __initdata = {
diff --git a/arch/arm/mach-omap1/board-fsample.c 
b/arch/arm/mach-omap1/board-fsample.c
index 096f2ed..8d9d6e8 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -313,7 +313,6 @@ static void __init omap_fsample_init_irq(void)
 {
omap1_init_common_hw();
omap_init_irq();
-   omap_gpio_init();
fsample_init_smc91x();
 }
 
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index d1100e4..dd04ef5 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -383,7 +383,6 @@ static void __init h2_init_irq(void)
 {
omap1_init_common_hw();
omap_init_irq();
-   omap_gpio_init();
h2_init_smc91x();
 }
 
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index a53ab82..ac8af4b 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -422,7 +422,6 @@ static void __init h3_init_irq(void)
 {
omap1_init_common_hw();
omap_init_irq();
-   omap_gpio_init();
h3_init_smc91x();
 }
 
diff --git a/arch/arm/mach-omap1/board-htcherald.c 
b/arch/arm/mach-omap1/board-htcherald.c
index 8e313b4..6ff6f30 100644
--- a/arch/arm/mach-omap1/board-htcherald.c
+++ b/arch/arm/mach-omap1/board-htcherald.c
@@ -278,7 +278,6 @@ static void __init htcherald_init(void)
 {
printk(KERN_INFO HTC Herald init.\n);
 
-   omap_gpio_init();
 
omap_board_config = htcherald_config;
omap_board_config_size = ARRAY_SIZE(htcherald_config);
diff --git a/arch/arm/mach-omap1/board-innovator.c 
b/arch/arm/mach-omap1/board-innovator.c
index 5d12fd3..28bb2cd 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -290,7 +290,6 @@ static void __init innovator_init_irq(void)
 {
omap1_init_common_hw();
omap_init_irq();
-   omap_gpio_init();
 #ifdef CONFIG_ARCH_OMAP15XX
if (cpu_is_omap1510()) {
omap1510_fpga_init_irq();
diff --git a/arch/arm/mach-omap1/board-nokia770.c 
b/arch/arm/mach-omap1/board-nokia770.c
index 71e1a3f..6ea838c 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -379,7 +379,6 @@ static void __init omap_nokia770_init(void)
platform_add_devices(nokia770_devices, 

[PATCH 05/13 v3] OMAP: GPIO: Introduce support for OMAP16xx chip GPIO init

2010-06-15 Thread Varadarajan, Charulatha
From: Charulatha V ch...@ti.com

This patch adds support for handling OMAP16xx specific gpio_init
by providing platform device data and doing device registration.

Signed-off-by: Charulatha V ch...@ti.com
---
 arch/arm/mach-omap1/gpio16xx.c |  208 
 1 files changed, 208 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap1/gpio16xx.c

diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c
new file mode 100644
index 000..6651d15
--- /dev/null
+++ b/arch/arm/mach-omap1/gpio16xx.c
@@ -0,0 +1,208 @@
+/*
+ * gpio16xx.c - OMAP16XX-specific gpio code
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ *
+ * Author:
+ * Charulatha V ch...@ti.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/gpio.h
+
+#define OMAP1610_GPIO1_BASE0xfffbe400
+#define OMAP1610_GPIO2_BASE0xfffbec00
+#define OMAP1610_GPIO3_BASE0xfffbb400
+#define OMAP1610_GPIO4_BASE0xfffbbc00
+#define OMAP1_MPUIO_VBASE  OMAP1_MPUIO_BASE
+
+static struct omap_gpio_dev_attr omap16xx_gpio_attr = {
+   .gpio_bank_count = 5,
+   .gpio_bank_bits = 16,
+   .omap1_ick_flag = false,
+};
+
+/*
+ * OMAP16XX MPU GPIO interface data
+ */
+static struct __initdata resource omap16xx_mpu_gpio_resources[] = {
+   {
+   .start  = OMAP1_MPUIO_VBASE,
+   .end= OMAP1_MPUIO_VBASE + SZ_2K - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .start  = INT_MPUIO,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = {
+   .virtual_irq_start  = IH_MPUIO_BASE,
+   .method = METHOD_MPUIO,
+   .gpio_attr  = omap16xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap16xx_mpu_gpio = {
+   .name   = omap-gpio,
+   .id = 0,
+   .dev= {
+   .platform_data = omap16xx_mpu_gpio_config,
+   },
+   .num_resources = ARRAY_SIZE(omap16xx_mpu_gpio_resources),
+   .resource = omap16xx_mpu_gpio_resources,
+};
+
+/*
+ * OMAP16XX GPIO1 interface data
+ */
+static struct __initdata resource omap16xx_gpio1_resources[] = {
+   {
+   .start  = OMAP1610_GPIO1_BASE,
+   .end= OMAP1610_GPIO1_BASE + SZ_2K - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .start  = INT_GPIO_BANK1,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = {
+   .virtual_irq_start  = IH_GPIO_BASE,
+   .method = METHOD_GPIO_1610,
+   .gpio_attr  = omap16xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap16xx_gpio1 = {
+   .name   = omap-gpio,
+   .id = 1,
+   .dev= {
+   .platform_data = omap16xx_gpio1_config,
+   },
+   .num_resources = ARRAY_SIZE(omap16xx_gpio1_resources),
+   .resource = omap16xx_gpio1_resources,
+};
+
+/*
+ * OMAP16XX GPIO2 interface data
+ */
+static struct __initdata resource omap16xx_gpio2_resources[] = {
+   {
+   .start  = OMAP1610_GPIO2_BASE,
+   .end= OMAP1610_GPIO2_BASE + SZ_2K - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .start  = INT_1610_GPIO_BANK2,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+static struct __initdata omap_gpio_platform_data omap16xx_gpio2_config = {
+   .virtual_irq_start  = IH_GPIO_BASE + 16,
+   .method = METHOD_GPIO_1610,
+   .gpio_attr  = omap16xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap16xx_gpio2 = {
+   .name   = omap-gpio,
+   .id = 2,
+   .dev= {
+   .platform_data = omap16xx_gpio2_config,
+   },
+   .num_resources = ARRAY_SIZE(omap16xx_gpio2_resources),
+   .resource = omap16xx_gpio2_resources,
+};
+
+/*
+ * OMAP16XX GPIO3 interface data
+ */
+static struct __initdata resource omap16xx_gpio3_resources[] = {
+   {
+   .start  = OMAP1610_GPIO3_BASE,
+   .end= OMAP1610_GPIO3_BASE + SZ_2K - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .start  = INT_1610_GPIO_BANK3,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+static struct __initdata omap_gpio_platform_data omap16xx_gpio3_config = {
+   .virtual_irq_start  = IH_GPIO_BASE + 32,
+   .method = METHOD_GPIO_1610,
+   .gpio_attr  = omap16xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap16xx_gpio3 = {
+   .name   

[PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

2010-06-15 Thread Varadarajan, Charulatha
From: Charulatha V ch...@ti.com

This patch adds support for handling GPIO as a HWMOD FW adapted
platform device for OMAP2PLUS chips.

gpio_init needs to be done before machine_init functions access gpio APIs.
Hence gpio_init is made as a postcore_initcall.

Signed-off-by: Charulatha V ch...@ti.com
---
 arch/arm/mach-omap2/gpio.c |  104 
 1 files changed, 104 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/gpio.c

diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
new file mode 100644
index 000..993995a
--- /dev/null
+++ b/arch/arm/mach-omap2/gpio.c
@@ -0,0 +1,104 @@
+/*
+ * gpio.c - OMAP2PLUS-specific gpio code
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ *
+ * Author:
+ * Charulatha V ch...@ti.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/gpio.h
+#include linux/err.h
+#include linux/slab.h
+
+#include plat/omap_hwmod.h
+#include plat/omap_device.h
+
+static struct omap_device_pm_latency omap_gpio_latency[] = {
+   [0] = {
+   .deactivate_func = omap_device_idle_hwmods,
+   .activate_func   = omap_device_enable_hwmods,
+   .flags   = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+   },
+};
+
+static int omap2_init_gpio(struct omap_hwmod *oh, void *user)
+{
+   struct omap_device *od;
+   struct omap_gpio_platform_data *pdata;
+   char *name = omap-gpio;
+   static int id;
+   struct omap_gpio_dev_attr *gpio_dev_data;
+
+   if (!oh)
+   pr_err(Could not look up omap gpio %d\n, id + 1);
+
+   pdata = kzalloc(sizeof(struct omap_gpio_platform_data),
+   GFP_KERNEL);
+   if (!pdata) {
+   pr_err(Memory allocation failed gpio%d\n, id + 1);
+   return -ENOMEM;
+   }
+
+   gpio_dev_data = (struct omap_gpio_dev_attr *)oh-dev_attr;
+   pdata-gpio_attr = gpio_dev_data;
+   pdata-method = (int)user;
+   pdata-virtual_irq_start = IH_GPIO_BASE + 32 * id;
+
+   od = omap_device_build(name, id, oh, pdata,
+   sizeof(*pdata), omap_gpio_latency,
+   ARRAY_SIZE(omap_gpio_latency),
+   false);
+   WARN(IS_ERR(od), Cant build omap_device for %s:%s.\n,
+   name, oh-name);
+
+   id++;
+   return 0;
+}
+
+static int __init gpio_init(int method)
+{
+   return omap_hwmod_for_each_by_class(gpio, omap2_init_gpio,
+   (void *)method);
+}
+
+/*
+ * gpio_init needs to be done before
+ * machine_init functions access gpio APIs.
+ * Hence gpio_init is a postcore_initcall.
+ */
+#ifdef CONFIG_ARCH_OMAP2
+static int __init omap24xx_gpio_init(void)
+{  if (!cpu_is_omap24xx())
+   return -EINVAL;
+
+   return gpio_init(METHOD_GPIO_24XX);
+}
+postcore_initcall(omap24xx_gpio_init);
+#endif
+
+#ifdef CONFIG_ARCH_OMAP3
+static int __init omap3xxx_gpio_init(void)
+{
+   if (!cpu_is_omap34xx())
+   return -EINVAL;
+
+   return gpio_init(METHOD_GPIO_24XX);
+}
+postcore_initcall(omap3xxx_gpio_init);
+#endif
+
+#ifdef CONFIG_ARCH_OMAP4
+static int __init omap44xx_gpio_init(void)
+{
+   if (!cpu_is_omap44xx())
+   return -EINVAL;
+
+   return gpio_init(METHOD_GPIO_44XX);
+}
+postcore_initcall(omap44xx_gpio_init);
+#endif
-- 
1.6.3.3

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


[PATCH 10/13 v3] OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct

2010-06-15 Thread Varadarajan, Charulatha
From: Charulatha V ch...@ti.com

This patch adds gpio_dev_attr to OMAP4 gpio hwmod structure. This patch
also corrects the gpio .main_clk and .clk fields in gpio hwmod structures.

Signed-off-by: Charulatha V ch...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   37 +++-
 1 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 20f5f8c..b4c0878 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -22,6 +22,7 @@
 
 #include plat/omap_hwmod.h
 #include plat/cpu.h
+#include plat/gpio.h
 
 #include omap_hwmod_common_data.h
 
@@ -1272,6 +1273,12 @@ static struct omap_hwmod omap44xx_fdif_hwmod = {
  * general purpose io module
  */
 
+static struct omap_gpio_dev_attr gpio_dev_attr = {
+   .gpio_bank_count = 6,
+   .gpio_bank_bits = 32,
+   .dbck_flag = true,
+};
+
 static struct omap_hwmod_class_sysconfig omap44xx_gpio_sysc = {
.rev_offs   = 0x,
.sysc_offs  = 0x0010,
@@ -1305,7 +1312,7 @@ static struct omap_hwmod_addr_space 
omap44xx_gpio1_addrs[] = {
 static struct omap_hwmod_ocp_if omap44xx_l4_wkup__gpio1 = {
.master = omap44xx_l4_wkup_hwmod,
.slave  = omap44xx_gpio1_hwmod,
-   .clk= l4_wkup_clk_mux_ck,
+   .clk= gpio1_ick,
.addr   = omap44xx_gpio1_addrs,
.addr_cnt   = ARRAY_SIZE(omap44xx_gpio1_addrs),
.user   = OCP_USER_MPU | OCP_USER_SDMA,
@@ -1325,7 +1332,7 @@ static struct omap_hwmod omap44xx_gpio1_hwmod = {
.class  = omap44xx_gpio_hwmod_class,
.mpu_irqs   = omap44xx_gpio1_irqs,
.mpu_irqs_cnt   = ARRAY_SIZE(omap44xx_gpio1_irqs),
-   .main_clk   = gpio1_ick,
+   .main_clk   = NULL,
.prcm = {
.omap4 = {
.clkctrl_reg = OMAP4430_CM_WKUP_GPIO1_CLKCTRL,
@@ -1333,6 +1340,7 @@ static struct omap_hwmod omap44xx_gpio1_hwmod = {
},
.opt_clks   = gpio1_opt_clks,
.opt_clks_cnt = ARRAY_SIZE(gpio1_opt_clks),
+   .dev_attr   = gpio_dev_attr,
.slaves = omap44xx_gpio1_slaves,
.slaves_cnt = ARRAY_SIZE(omap44xx_gpio1_slaves),
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -1356,7 +1364,7 @@ static struct omap_hwmod_addr_space 
omap44xx_gpio2_addrs[] = {
 static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio2 = {
.master = omap44xx_l4_per_hwmod,
.slave  = omap44xx_gpio2_hwmod,
-   .clk= l4_div_ck,
+   .clk= gpio2_ick,
.addr   = omap44xx_gpio2_addrs,
.addr_cnt   = ARRAY_SIZE(omap44xx_gpio2_addrs),
.user   = OCP_USER_MPU | OCP_USER_SDMA,
@@ -1376,7 +1384,7 @@ static struct omap_hwmod omap44xx_gpio2_hwmod = {
.class  = omap44xx_gpio_hwmod_class,
.mpu_irqs   = omap44xx_gpio2_irqs,
.mpu_irqs_cnt   = ARRAY_SIZE(omap44xx_gpio2_irqs),
-   .main_clk   = gpio2_ick,
+   .main_clk   = NULL,
.prcm = {
.omap4 = {
.clkctrl_reg = OMAP4430_CM_L4PER_GPIO2_CLKCTRL,
@@ -1384,6 +1392,7 @@ static struct omap_hwmod omap44xx_gpio2_hwmod = {
},
.opt_clks   = gpio2_opt_clks,
.opt_clks_cnt = ARRAY_SIZE(gpio2_opt_clks),
+   .dev_attr   = gpio_dev_attr,
.slaves = omap44xx_gpio2_slaves,
.slaves_cnt = ARRAY_SIZE(omap44xx_gpio2_slaves),
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -1407,7 +1416,7 @@ static struct omap_hwmod_addr_space 
omap44xx_gpio3_addrs[] = {
 static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio3 = {
.master = omap44xx_l4_per_hwmod,
.slave  = omap44xx_gpio3_hwmod,
-   .clk= l4_div_ck,
+   .clk= gpio3_ick,
.addr   = omap44xx_gpio3_addrs,
.addr_cnt   = ARRAY_SIZE(omap44xx_gpio3_addrs),
.user   = OCP_USER_MPU | OCP_USER_SDMA,
@@ -1427,7 +1436,7 @@ static struct omap_hwmod omap44xx_gpio3_hwmod = {
.class  = omap44xx_gpio_hwmod_class,
.mpu_irqs   = omap44xx_gpio3_irqs,
.mpu_irqs_cnt   = ARRAY_SIZE(omap44xx_gpio3_irqs),
-   .main_clk   = gpio3_ick,
+   .main_clk   = NULL,
.prcm = {
.omap4 = {
.clkctrl_reg = OMAP4430_CM_L4PER_GPIO3_CLKCTRL,
@@ -1435,6 +1444,7 @@ static struct omap_hwmod omap44xx_gpio3_hwmod = {
},
.opt_clks   = gpio3_opt_clks,
.opt_clks_cnt = ARRAY_SIZE(gpio3_opt_clks),
+   .dev_attr   = gpio_dev_attr,
.slaves = omap44xx_gpio3_slaves,
.slaves_cnt = ARRAY_SIZE(omap44xx_gpio3_slaves),
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -1458,7 +1468,7 @@ 

[PATCH 06/13 v3] OMAP: GPIO: Introduce support for OMAP7xx chip GPIO init

2010-06-15 Thread Varadarajan, Charulatha
From: Charulatha V ch...@ti.com

This patch adds support for handling OMAP7xx specific gpio_init
by providing platform device data and doing device registration.

Signed-off-by: Charulatha V ch...@ti.com
---
 arch/arm/mach-omap1/gpio7xx.c |  274 +
 1 files changed, 274 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap1/gpio7xx.c

diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c
new file mode 100644
index 000..6db124f
--- /dev/null
+++ b/arch/arm/mach-omap1/gpio7xx.c
@@ -0,0 +1,274 @@
+/*
+ * gpio7xx.c - OMAP7XX-specific gpio code
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ *
+ * Author:
+ * Charulatha V ch...@ti.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/gpio.h
+
+#define OMAP7XX_GPIO1_BASE 0xfffbc000
+#define OMAP7XX_GPIO2_BASE 0xfffbc800
+#define OMAP7XX_GPIO3_BASE 0xfffbd000
+#define OMAP7XX_GPIO4_BASE 0xfffbd800
+#define OMAP7XX_GPIO5_BASE 0xfffbe000
+#define OMAP7XX_GPIO6_BASE 0xfffbe800
+#define OMAP1_MPUIO_VBASE  OMAP1_MPUIO_BASE
+
+static struct omap_gpio_dev_attr omap7xx_gpio_attr = {
+   .gpio_bank_count = 7,
+   .gpio_bank_bits = 32,
+   .omap1_ick_flag = false,
+};
+
+/*
+ * OMAP7XX MPU GPIO interface data
+ */
+static struct __initdata resource omap7xx_mpu_gpio_resources[] = {
+   {
+   .start  = OMAP1_MPUIO_VBASE,
+   .end= OMAP1_MPUIO_VBASE + SZ_2K - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .start  = INT_7XX_MPUIO,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = {
+   .virtual_irq_start  = IH_MPUIO_BASE,
+   .method = METHOD_MPUIO,
+   .gpio_attr  = omap7xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap7xx_mpu_gpio = {
+   .name   = omap-gpio,
+   .id = 0,
+   .dev= {
+   .platform_data = omap7xx_mpu_gpio_config,
+   },
+   .num_resources = ARRAY_SIZE(omap7xx_mpu_gpio_resources),
+   .resource = omap7xx_mpu_gpio_resources,
+};
+
+/*
+ * OMAP7XX GPIO1 interface data
+ */
+static struct __initdata resource omap7xx_gpio1_resources[] = {
+   {
+   .start  = OMAP7XX_GPIO1_BASE,
+   .end= OMAP7XX_GPIO1_BASE + SZ_2K - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .start  = INT_7XX_GPIO_BANK1,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = {
+   .virtual_irq_start  = IH_GPIO_BASE,
+   .method = METHOD_GPIO_7XX,
+   .gpio_attr  = omap7xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap7xx_gpio1 = {
+   .name   = omap-gpio,
+   .id = 1,
+   .dev= {
+   .platform_data = omap7xx_gpio1_config,
+   },
+   .num_resources = ARRAY_SIZE(omap7xx_gpio1_resources),
+   .resource = omap7xx_gpio1_resources,
+};
+
+/*
+ * OMAP7XX GPIO2 interface data
+ */
+static struct __initdata resource omap7xx_gpio2_resources[] = {
+   {
+   .start  = OMAP7XX_GPIO2_BASE,
+   .end= OMAP7XX_GPIO2_BASE + SZ_2K - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .start  = INT_7XX_GPIO_BANK2,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+static struct __initdata omap_gpio_platform_data omap7xx_gpio2_config = {
+   .virtual_irq_start  = IH_GPIO_BASE + 32,
+   .method = METHOD_GPIO_7XX,
+   .gpio_attr  = omap7xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap7xx_gpio2 = {
+   .name   = omap-gpio,
+   .id = 2,
+   .dev= {
+   .platform_data = omap7xx_gpio2_config,
+   },
+   .num_resources = ARRAY_SIZE(omap7xx_gpio2_resources),
+   .resource = omap7xx_gpio2_resources,
+};
+
+/*
+ * OMAP7XX GPIO3 interface data
+ */
+static struct __initdata resource omap7xx_gpio3_resources[] = {
+   {
+   .start  = OMAP7XX_GPIO3_BASE,
+   .end= OMAP7XX_GPIO3_BASE + SZ_2K - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .start  = INT_7XX_GPIO_BANK3,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+static struct __initdata omap_gpio_platform_data omap7xx_gpio3_config = {
+   .virtual_irq_start  = IH_GPIO_BASE + 64,
+   .method = METHOD_GPIO_7XX,
+   .gpio_attr  = omap7xx_gpio_attr,
+};
+
+static struct 

[PATCH 08/13 v3] OMAP: GPIO: add GPIO hwmods structures for OMAP242X

2010-06-15 Thread Varadarajan, Charulatha
From: Charulatha V ch...@ti.com

Add hwmod structures for GPIO module on OMAP242X

Signed-off-by: Charulatha V ch...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_2420_data.c |  228 
 1 files changed, 228 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c 
b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index a8b57a6..8742707 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -15,6 +15,7 @@
 #include mach/irqs.h
 #include plat/cpu.h
 #include plat/dma.h
+#include plat/gpio.h
 
 #include omap_hwmod_common_data.h
 
@@ -32,6 +33,10 @@
 static struct omap_hwmod omap2420_mpu_hwmod;
 static struct omap_hwmod omap2420_l3_hwmod;
 static struct omap_hwmod omap2420_l4_core_hwmod;
+static struct omap_hwmod omap2420_gpio1_hwmod;
+static struct omap_hwmod omap2420_gpio2_hwmod;
+static struct omap_hwmod omap2420_gpio3_hwmod;
+static struct omap_hwmod omap2420_gpio4_hwmod;
 
 /* L3 - L4_CORE interface */
 static struct omap_hwmod_ocp_if omap2420_l3__l4_core = {
@@ -88,6 +93,78 @@ static struct omap_hwmod_ocp_if *omap2420_l4_core_masters[] 
= {
omap2420_l4_core__l4_wkup,
 };
 
+/* L4 WKUP - GPIO1 interface */
+static struct omap_hwmod_addr_space omap2420_gpio1_addr_space[] = {
+   {
+   .pa_start   = OMAP242X_GPIO1_BASE,
+   .pa_end = OMAP242X_GPIO1_BASE + SZ_4K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio1 = {
+   .master = omap2420_l4_wkup_hwmod,
+   .slave  = omap2420_gpio1_hwmod,
+   .clk= gpios_ick,
+   .addr   = omap2420_gpio1_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap2420_gpio1_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 WKUP - GPIO2 interface */
+static struct omap_hwmod_addr_space omap2420_gpio2_addr_space[] = {
+   {
+   .pa_start   = OMAP242X_GPIO2_BASE,
+   .pa_end = OMAP242X_GPIO2_BASE + SZ_4K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio2 = {
+   .master = omap2420_l4_wkup_hwmod,
+   .slave  = omap2420_gpio2_hwmod,
+   .clk= gpios_ick,
+   .addr   = omap2420_gpio2_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap2420_gpio2_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 WKUP - GPIO3 interface */
+static struct omap_hwmod_addr_space omap2420_gpio3_addr_space[] = {
+   {
+   .pa_start   = OMAP242X_GPIO3_BASE,
+   .pa_end = OMAP242X_GPIO3_BASE + SZ_4K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio3 = {
+   .master = omap2420_l4_wkup_hwmod,
+   .slave  = omap2420_gpio3_hwmod,
+   .clk= gpios_ick,
+   .addr   = omap2420_gpio3_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap2420_gpio3_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 WKUP - GPIO4 interface */
+static struct omap_hwmod_addr_space omap2420_gpio4_addr_space[] = {
+   {
+   .pa_start   = OMAP242X_GPIO4_BASE,
+   .pa_end = OMAP242X_GPIO4_BASE + SZ_4K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio4 = {
+   .master = omap2420_l4_wkup_hwmod,
+   .slave  = omap2420_gpio4_hwmod,
+   .clk= gpios_ick,
+   .addr   = omap2420_gpio4_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap2420_gpio4_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 /* L4 CORE */
 static struct omap_hwmod omap2420_l4_core_hwmod = {
.name   = l4_core_hwmod,
@@ -136,11 +213,162 @@ static struct omap_hwmod omap2420_mpu_hwmod = {
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
 };
 
+/* GPIO common */
+
+static struct omap_gpio_dev_attr gpio_dev_attr = {
+   .gpio_bank_count = 4,
+   .gpio_bank_bits = 32,
+   .dbck_flag = false,
+};
+
+static struct omap_hwmod_class_sysconfig omap242x_gpio_sysc = {
+   .rev_offs   = 0x,
+   .sysc_offs  = 0x0010,
+   .syss_offs  = 0x0014,
+   .sysc_flags = (SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap242x_gpio_hwmod_class = {
+   .name = gpio,
+   .sysc = omap242x_gpio_sysc,
+};
+
+/* GPIO1 */
+
+static struct omap_hwmod_irq_info omap242x_gpio1_irqs[] = {
+   { .name = gpio_mpu_irq, .irq = INT_24XX_GPIO_BANK1 },

[PATCH 01/13 v3] OMAP: GPIO: Modify init() in preparation for platform device implementation

2010-06-15 Thread Varadarajan, Charulatha
From: Charulatha V ch...@ti.com

This is in prepartion for implementing GPIO as a platform device.
gpio bank's base addresses are moved from gpio.c to plat/gpio.h.

This patch also modifies omap_gpio_init() to make use of
omap_gpio_chip_init() and omap_gpio_mod_init(). omap_gpio_mod_init() does
the module init by clearing the status register and initializing the
GPIO control register. omap_gpio_chip_init() initializes the chip request,
free, get, set and other function pointers and sets the gpio irq handler.

Signed-off-by: Charulatha V ch...@ti.com
---
 arch/arm/plat-omap/gpio.c |  235 +++--
 1 files changed, 120 insertions(+), 115 deletions(-)

diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 9b7e354..3ea616a 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -190,14 +190,12 @@ struct gpio_bank {
u32 suspend_wakeup;
u32 saved_wakeup;
 #endif
-#ifdef CONFIG_ARCH_OMAP2PLUS
u32 non_wakeup_gpios;
u32 enabled_non_wakeup_gpios;
 
u32 saved_datain;
u32 saved_fallingdetect;
u32 saved_risingdetect;
-#endif
u32 level_mask;
u32 toggle_mask;
spinlock_t lock;
@@ -1711,6 +1709,124 @@ static void __init omap_gpio_show_rev(void)
  */
 static struct lock_class_key gpio_lock_class;
 
+static void omap_gpio_mod_init(struct gpio_bank *bank, int id)
+{
+   if (cpu_class_is_omap2()) {
+   if (cpu_is_omap44xx()) {
+   __raw_writel(0x, bank-base +
+   OMAP4_GPIO_IRQSTATUSCLR0);
+   __raw_writel(0x, bank-base +
+OMAP4_GPIO_DEBOUNCENABLE);
+   /* Initialize interface clk ungated, module enabled */
+   __raw_writel(0, bank-base + OMAP4_GPIO_CTRL);
+   } else if (cpu_is_omap34xx()) {
+   __raw_writel(0x, bank-base +
+   OMAP24XX_GPIO_IRQENABLE1);
+   __raw_writel(0x, bank-base +
+   OMAP24XX_GPIO_IRQSTATUS1);
+   __raw_writel(0x, bank-base +
+   OMAP24XX_GPIO_DEBOUNCE_EN);
+
+   /* Initialize interface clk ungated, module enabled */
+   __raw_writel(0, bank-base + OMAP24XX_GPIO_CTRL);
+   /* Enable autoidle for the OCP interface */
+   omap_writel(1  0, 0x48306814);
+   } else if (cpu_is_omap24xx()) {
+   static const u32 non_wakeup_gpios[] = {
+   0xe203ffc0, 0x08700040
+   };
+   if (id  ARRAY_SIZE(non_wakeup_gpios))
+   bank-non_wakeup_gpios = non_wakeup_gpios[id];
+
+   /* Enable autoidle for the OCP interface */
+   omap_writel(1  0, 0x48019010);
+   }
+   } else if (cpu_class_is_omap1()) {
+   if (bank_is_mpuio(bank))
+   __raw_writew(0x, bank-base
+   + OMAP_MPUIO_GPIO_MASKIT);
+   if (cpu_is_omap15xx()  bank-method == METHOD_GPIO_1510) {
+   __raw_writew(0x, bank-base
+   + OMAP1510_GPIO_INT_MASK);
+   __raw_writew(0x, bank-base
+   + OMAP1510_GPIO_INT_STATUS);
+   }
+   if (cpu_is_omap16xx()  bank-method == METHOD_GPIO_1610) {
+   __raw_writew(0x, bank-base
+   + OMAP1610_GPIO_IRQENABLE1);
+   __raw_writew(0x, bank-base
+   + OMAP1610_GPIO_IRQSTATUS1);
+   __raw_writew(0x0014, bank-base
+   + OMAP1610_GPIO_SYSCONFIG);
+
+   /* Enable system clock for GPIO module.
+* The CAM_CLK_CTRL *is* really the right place. */
+   omap_writel(omap_readl(ULPD_CAM_CLK_CTRL) | 0x04,
+   ULPD_CAM_CLK_CTRL);
+   }
+   if (cpu_is_omap7xx()  bank-method == METHOD_GPIO_7XX) {
+   __raw_writel(0x, bank-base
+   + OMAP7XX_GPIO_INT_MASK);
+   __raw_writel(0x, bank-base
+   + OMAP7XX_GPIO_INT_STATUS);
+   }
+   }
+}
+
+static void __init omap_gpio_chip_init(struct gpio_bank *bank)
+{
+   int j, gpio_bank_bits = 16;
+   static int gpio;
+
+   if (cpu_is_omap7xx()  bank-method == METHOD_GPIO_7XX)
+   

[PATCH 03/13 v3] OMAP: GPIO: Include platform_data structure for GPIO

2010-06-15 Thread Varadarajan, Charulatha
From: Charulatha V ch...@ti.com

This patch introduces platform_data structure for GPIO
so that GPIO module can be implemented in platform device model.

Signed-off-by: Charulatha V ch...@ti.com
---
 arch/arm/plat-omap/include/plat/gpio.h |   21 +
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/gpio.h 
b/arch/arm/plat-omap/include/plat/gpio.h
index de1c604..fa5c05f 100644
--- a/arch/arm/plat-omap/include/plat/gpio.h
+++ b/arch/arm/plat-omap/include/plat/gpio.h
@@ -28,6 +28,7 @@
 
 #include linux/io.h
 #include mach/irqs.h
+#include linux/platform_device.h
 
 #define OMAP1_MPUIO_BASE   0xfffb5000
 
@@ -71,6 +72,26 @@
 IH_MPUIO_BASE + ((nr)  0x0f) : \
 IH_GPIO_BASE + (nr))
 
+#define METHOD_MPUIO   0
+#define METHOD_GPIO_1510   1
+#define METHOD_GPIO_1610   2
+#define METHOD_GPIO_7XX3
+#define METHOD_GPIO_24XX   5
+#define METHOD_GPIO_44XX   6
+
+struct omap_gpio_dev_attr {
+   int gpio_bank_count;/* No of GPIO banks - SoC specific */
+   int gpio_bank_bits; /* GPIO bank width */
+   bool dbck_flag; /* dbck validity - True only for OMAP34 */
+   bool omap1_ick_flag;/* OMAP1 ick - True only for OMAP15xx */
+};
+
+struct omap_gpio_platform_data {
+   u16 virtual_irq_start;
+   int method;
+   struct omap_gpio_dev_attr *gpio_attr;
+};
+
 extern int omap_gpio_init(void);   /* Call from board init only */
 extern void omap2_gpio_prepare_for_idle(int power_state);
 extern void omap2_gpio_resume_after_idle(void);
-- 
1.6.3.3

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


[PATCH 02/13 v3] OMAP: GPIO: Populate GPIO base address in omapxxxx.h

2010-06-15 Thread Varadarajan, Charulatha
From: Charulatha V ch...@ti.com

This patch populates omap24xx.h, omap34xx.h and omap44xx.h files
with SoC specific GPIO base addresses. This would be later used
while creating GPIO hwmod structures.
---
 arch/arm/plat-omap/include/plat/omap24xx.h |   12 
 arch/arm/plat-omap/include/plat/omap34xx.h |8 
 arch/arm/plat-omap/include/plat/omap44xx.h |8 
 3 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/omap24xx.h 
b/arch/arm/plat-omap/include/plat/omap24xx.h
index 7055672..4406bbe 100644
--- a/arch/arm/plat-omap/include/plat/omap24xx.h
+++ b/arch/arm/plat-omap/include/plat/omap24xx.h
@@ -85,5 +85,17 @@
 #define OMAP24XX_SEC_AES_BASE  (OMAP24XX_SEC_BASE + 0x6000)
 #define OMAP24XX_SEC_PKA_BASE  (OMAP24XX_SEC_BASE + 0x8000)
 
+/* GPIO controller*/
+#define OMAP242X_GPIO1_BASE(L4_24XX_BASE + 0x18000)
+#define OMAP242X_GPIO2_BASE(L4_24XX_BASE + 0x1a000)
+#define OMAP242X_GPIO3_BASE(L4_24XX_BASE + 0x1c000)
+#define OMAP242X_GPIO4_BASE(L4_24XX_BASE + 0x1e000)
+
+#define OMAP243X_GPIO1_BASE(L4_WK_243X_BASE + 0xC000)
+#define OMAP243X_GPIO2_BASE(L4_WK_243X_BASE + 0xE000)
+#define OMAP243X_GPIO3_BASE(L4_WK_243X_BASE + 0x1)
+#define OMAP243X_GPIO4_BASE(L4_WK_243X_BASE + 0x12000)
+#define OMAP243X_GPIO5_BASE(L4_24XX_BASE+ 0xB6000)
+
 #endif /* __ASM_ARCH_OMAP2_H */
 
diff --git a/arch/arm/plat-omap/include/plat/omap34xx.h 
b/arch/arm/plat-omap/include/plat/omap34xx.h
index 98fc8b4..53279b8 100644
--- a/arch/arm/plat-omap/include/plat/omap34xx.h
+++ b/arch/arm/plat-omap/include/plat/omap34xx.h
@@ -87,5 +87,13 @@
 #define OMAP34XX_SEC_SHA1MD5_BASE  (OMAP34XX_SEC_BASE + 0x23000)
 #define OMAP34XX_SEC_AES_BASE  (OMAP34XX_SEC_BASE + 0x25000)
 
+/* GPIO controller*/
+#define OMAP34XX_GPIO1_BASE(L4_WK_34XX_BASE  + 0x1)
+#define OMAP34XX_GPIO2_BASE(L4_PER_34XX_BASE + 0x5)
+#define OMAP34XX_GPIO3_BASE(L4_PER_34XX_BASE + 0x52000)
+#define OMAP34XX_GPIO4_BASE(L4_PER_34XX_BASE + 0x54000)
+#define OMAP34XX_GPIO5_BASE(L4_PER_34XX_BASE + 0x56000)
+#define OMAP34XX_GPIO6_BASE(L4_PER_34XX_BASE + 0x58000)
+
 #endif /* __ASM_ARCH_OMAP3_H */
 
diff --git a/arch/arm/plat-omap/include/plat/omap44xx.h 
b/arch/arm/plat-omap/include/plat/omap44xx.h
index 8b3f12f..bec7d69 100644
--- a/arch/arm/plat-omap/include/plat/omap44xx.h
+++ b/arch/arm/plat-omap/include/plat/omap44xx.h
@@ -52,5 +52,13 @@
 #define OMAP4_MMU1_BASE0x55082000
 #define OMAP4_MMU2_BASE0x4A066000
 
+/* GPIO controller*/
+#define OMAP44XX_GPIO1_BASE (L4_WK_44XX_BASE  + 0x1)
+#define OMAP44XX_GPIO2_BASE (L4_PER_44XX_BASE + 0x55000)
+#define OMAP44XX_GPIO3_BASE (L4_PER_44XX_BASE + 0x57000)
+#define OMAP44XX_GPIO4_BASE (L4_PER_44XX_BASE + 0x59000)
+#define OMAP44XX_GPIO5_BASE (L4_PER_44XX_BASE + 0x5B000)
+#define OMAP44XX_GPIO6_BASE (L4_PER_44XX_BASE + 0x5D000)
+
 #endif /* __ASM_ARCH_OMAP44XX_H */
 
-- 
1.6.3.3

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


[PATCH 09/13 v3] OMAP: GPIO: add GPIO hwmods structures for OMAP243X

2010-06-15 Thread Varadarajan, Charulatha
From: Charulatha V ch...@ti.com

Add hwmod structures for GPIO module on OMAP243X

Signed-off-by: Charulatha V ch...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |  279 
 1 files changed, 279 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c 
b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index 8b1f74b..ac0e191 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -15,6 +15,7 @@
 #include mach/irqs.h
 #include plat/cpu.h
 #include plat/dma.h
+#include plat/gpio.h
 
 #include omap_hwmod_common_data.h
 
@@ -72,6 +73,11 @@ static struct omap_hwmod omap2430_l3_hwmod = {
 static struct omap_hwmod omap2430_l4_wkup_hwmod;
 static struct omap_hwmod omap2430_mmc1_hwmod;
 static struct omap_hwmod omap2430_mmc2_hwmod;
+static struct omap_hwmod omap2430_gpio1_hwmod;
+static struct omap_hwmod omap2430_gpio2_hwmod;
+static struct omap_hwmod omap2430_gpio3_hwmod;
+static struct omap_hwmod omap2430_gpio4_hwmod;
+static struct omap_hwmod omap2430_gpio5_hwmod;
 
 /* L4_CORE - L4_WKUP interface */
 static struct omap_hwmod_ocp_if omap2430_l4_core__l4_wkup = {
@@ -80,6 +86,96 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__l4_wkup = {
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* L4 WKUP - GPIO1 interface */
+static struct omap_hwmod_addr_space omap2430_gpio1_addr_space[] = {
+   {
+   .pa_start   = OMAP243X_GPIO1_BASE,
+   .pa_end = OMAP243X_GPIO1_BASE + SZ_4K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio1 = {
+   .master = omap2430_l4_wkup_hwmod,
+   .slave  = omap2430_gpio1_hwmod,
+   .clk= gpios_ick,
+   .addr   = omap2430_gpio1_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap2430_gpio1_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 WKUP - GPIO2 interface */
+static struct omap_hwmod_addr_space omap2430_gpio2_addr_space[] = {
+   {
+   .pa_start   = OMAP243X_GPIO2_BASE,
+   .pa_end = OMAP243X_GPIO2_BASE + SZ_4K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio2 = {
+   .master = omap2430_l4_wkup_hwmod,
+   .slave  = omap2430_gpio2_hwmod,
+   .clk= gpios_ick,
+   .addr   = omap2430_gpio2_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap2430_gpio2_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 WKUP - GPIO3 interface */
+static struct omap_hwmod_addr_space omap2430_gpio3_addr_space[] = {
+   {
+   .pa_start   = OMAP243X_GPIO3_BASE,
+   .pa_end = OMAP243X_GPIO3_BASE + SZ_4K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio3 = {
+   .master = omap2430_l4_wkup_hwmod,
+   .slave  = omap2430_gpio3_hwmod,
+   .clk= gpios_ick,
+   .addr   = omap2430_gpio3_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap2430_gpio3_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 WKUP - GPIO4 interface */
+static struct omap_hwmod_addr_space omap2430_gpio4_addr_space[] = {
+   {
+   .pa_start   = OMAP243X_GPIO4_BASE,
+   .pa_end = OMAP243X_GPIO4_BASE + SZ_4K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio4 = {
+   .master = omap2430_l4_wkup_hwmod,
+   .slave  = omap2430_gpio4_hwmod,
+   .clk= gpios_ick,
+   .addr   = omap2430_gpio4_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap2430_gpio4_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 CORE - GPIO5 interface */
+static struct omap_hwmod_addr_space omap2430_gpio5_addr_space[] = {
+   {
+   .pa_start   = OMAP243X_GPIO5_BASE,
+   .pa_end = OMAP243X_GPIO5_BASE + SZ_4K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__gpio5 = {
+   .master = omap2430_l4_core_hwmod,
+   .slave  = omap2430_gpio5_hwmod,
+   .clk= gpio5_ick,
+   .addr   = omap2430_gpio5_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap2430_gpio5_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 /* Slave interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = {
omap2430_l3__l4_core,
@@ -138,11 +234,194 @@ static struct omap_hwmod omap2430_mpu_hwmod = {
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
+/* GPIO common */
+

[PATCH 04/13 v3] OMAP: GPIO: Introduce support for OMAP15xx chip GPIO init

2010-06-15 Thread Varadarajan, Charulatha
From: Charulatha V ch...@ti.com

This patch adds support for handling OMAP15xx specific gpio_init
by providing platform device data and doing device registration.

Signed-off-by: Charulatha V ch...@ti.com
---
 arch/arm/mach-omap1/gpio15xx.c |  102 
 1 files changed, 102 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap1/gpio15xx.c

diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c
new file mode 100644
index 000..e4f1738
--- /dev/null
+++ b/arch/arm/mach-omap1/gpio15xx.c
@@ -0,0 +1,102 @@
+/*
+ * gpio15xx.c - OMAP15XX-specific gpio code
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ *
+ * Author:
+ * Charulatha V ch...@ti.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/gpio.h
+
+#define OMAP1_MPUIO_VBASE  OMAP1_MPUIO_BASE
+#define OMAP1510_GPIO_BASE 0xfffce000
+
+static struct omap_gpio_dev_attr omap15xx_gpio_attr = {
+   .gpio_bank_count = 2,
+   .gpio_bank_bits = 16,
+   .omap1_ick_flag = true,
+};
+
+/*
+ * OMAP15XX GPIO1 interface data
+ */
+static struct __initdata resource omap15xx_mpu_gpio_resources[] = {
+   {
+   .start  = OMAP1_MPUIO_VBASE,
+   .end= OMAP1_MPUIO_VBASE + SZ_2K - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .start  = INT_MPUIO,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = {
+   .virtual_irq_start  = IH_MPUIO_BASE,
+   .method = METHOD_MPUIO,
+   .gpio_attr  = omap15xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap15xx_mpu_gpio = {
+   .name   = omap-gpio,
+   .id = 0,
+   .dev= {
+   .platform_data = omap15xx_mpu_gpio_config,
+   },
+   .num_resources = ARRAY_SIZE(omap15xx_mpu_gpio_resources),
+   .resource = omap15xx_mpu_gpio_resources,
+};
+
+/*
+ * OMAP15XX GPIO2 interface data
+ */
+static struct __initdata resource omap15xx_gpio_resources[] = {
+   {
+   .start  = OMAP1510_GPIO_BASE,
+   .end= OMAP1510_GPIO_BASE + SZ_2K - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .start  = INT_GPIO_BANK1,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = {
+   .virtual_irq_start  = IH_GPIO_BASE,
+   .method = METHOD_GPIO_1510,
+   .gpio_attr  = omap15xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap15xx_gpio = {
+   .name   = omap-gpio,
+   .id = 1,
+   .dev= {
+   .platform_data = omap15xx_gpio_config,
+   },
+   .num_resources = ARRAY_SIZE(omap15xx_gpio_resources),
+   .resource = omap15xx_gpio_resources,
+};
+
+/*
+ * omap15xx_gpio_init needs to be done before
+ * machine_init functions access gpio APIs.
+ * Hence omap15xx_gpio_init is a postcore_initcall.
+ */
+static int __init omap15xx_gpio_init(void)
+{
+   if (!cpu_is_omap15xx())
+   return -EINVAL;
+
+   platform_device_register(omap15xx_mpu_gpio);
+   platform_device_register(omap15xx_gpio);
+
+   return 0;
+}
+postcore_initcall(omap15xx_gpio_init);
-- 
1.6.3.3

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


[PATCH 00/13 v3] OMAP: GPIO: Implement GPIO in HWMOD way

2010-06-15 Thread Varadarajan, Charulatha
From: Charulatha V ch...@ti.com

This patch series makes OMAP2PLUS specific GPIO implemented in HWMOD
FW way. This is done by implementing GPIO module in platform device model.

This patch series is generated on origin/pm-wip/hwmods-omap4.

This patch series is created on top of the following two patches:
- OMAP: GPIO: fix auto-disable of debounce clock
https://patchwork.kernel.org/patch/103831/
- omap: Stalker board: switch over to gpio_set_debounce
https://patchwork.kernel.org/patch/103017/

This patch series is tested on OMAP4430 SDP board and OMAP3430 SDP board.
It would be of great help if someone could test the same on OMAP1
and OMAP2 boards.

Version History:
---

Comments Fixed in v3:
- .module_offs populated in hwmod structures
- If not defined CONFIG_PM_RUNTIME is not handled in GPIO driver
- No changes to mach-omap2/clock-data.c to handle clocks by dev ptr
as it is taken care using clock get by name in hwmod  omap_device layer
- Using ick instead of arm_gpio_ck for OMAP15xx clock
- SoC base addresses moved to plat-omap/omap.h that should be
used only by the omap_hwmod__data.c file
- OMAP2/3 hwmod structures naming convention changed as it is
followed in OMAP4
- omap24xx_gpio_init() uses cpu_is_omap24xx() instead of separate
checks for 2420  2430 in OMAP2 specific init call (mach-omap layer)
- Reason for using postcore_initcall is added to patch description for
the patch OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init
- Comments added for usage of dbck_flag and other elements
in dev_attr structure
- Uses dev_dbg() and dev_err() instead of pr_dbg() and pr_err()
- Corrects the gpio clock details in OMAP4 hwmod database


v2 series:
Some important links to patch v2 series and comments:
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg30262.html
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg28787.html
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg30263.html
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg30295.html
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg30259.html
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg28933.html
Comments Fixed in V2:
- GPIO dev attr was added for SoC specific chip info (eg., gpio bank count)
- Removed omap_gpio_init() usage from board files 
- platform_get_resource() used instead of pdata-base for
OMAP2+ base addresses
- postcore_initcall used for gpio init instead of making
GPIO as an early platform device. SoC specific gpio_init
needs to be done before machine_init functions access gpio
APIs. Hence making SoC specific gpio_init as postcore_initcall.
- getting gpio dbck is moved to omap_set_gpio_debounce()
instead of doing it in probe


v1 series:
Some important links to patch v1 series and comments:
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg26934.html
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg27860.html
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg28183.html
Highlights in v1:
- Introduces SoC specific functions at mach-omap layer
- Implements GPIO as a platform device
- Make gpio an early device and make it implemented in
HWMOD FW adapted way for OMAP2PLUS


Charulatha V (13):
  OMAP: GPIO: Modify init() in preparation for platform device
implementation
  OMAP: GPIO: Populate GPIO base address in omap.h
  OMAP: GPIO: Include platform_data structure for GPIO
  OMAP: GPIO: Introduce support for OMAP15xx chip GPIO init
  OMAP: GPIO: Introduce support for OMAP16xx chip GPIO init
  OMAP: GPIO: Introduce support for OMAP7xx chip GPIO init
  OMAP: GPIO: add GPIO hwmods structures for OMAP3
  OMAP: GPIO: add GPIO hwmods structures for OMAP242X
  OMAP: GPIO: add GPIO hwmods structures for OMAP243X
  OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct
  OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init
  OMAP: GPIO: Implement GPIO as a platform device
  OMAP: GPIO: Remove omap_gpio_init()

 arch/arm/mach-omap1/Makefile   |6 +
 arch/arm/mach-omap1/board-ams-delta.c  |1 -
 arch/arm/mach-omap1/board-fsample.c|1 -
 arch/arm/mach-omap1/board-h2.c |1 -
 arch/arm/mach-omap1/board-h3.c |1 -
 arch/arm/mach-omap1/board-htcherald.c  |1 -
 arch/arm/mach-omap1/board-innovator.c  |1 -
 arch/arm/mach-omap1/board-nokia770.c   |1 -
 arch/arm/mach-omap1/board-osk.c|1 -
 arch/arm/mach-omap1/board-palmte.c |1 -
 arch/arm/mach-omap1/board-palmz71.c|1 -
 arch/arm/mach-omap1/board-perseus2.c   |1 -
 arch/arm/mach-omap1/board-sx1.c|1 -
 arch/arm/mach-omap1/board-voiceblue.c  |1 -
 arch/arm/mach-omap1/clock_data.c   |4 +-
 arch/arm/mach-omap1/gpio15xx.c |  102 +
 arch/arm/mach-omap1/gpio16xx.c |  208 ++
 arch/arm/mach-omap1/gpio7xx.c  |  274 

Re: SDHC card affected by preemption model in 2.6.35

2010-06-15 Thread Venkatraman S
 Mathieu Poirier mathieu.poir...@canonical.com wrote:
 HW: Beagleboard rev. C2 and C4
 Processor: OMAP3
 Kernel: 2.6.35-rc2
 Driver: mmci-omap-hs

 I am faced with an SDHC card problem on a beagleboard.  Some cards
 cannot be initialized on startup while others work perfectly.  I tracked
 the issue down to one single kernel config: PREEMPT_VOLUNTARY.

 When going from PREEMPT_VOLUNTARY to PREEMPT_NONE the problem goes away.

 When booting, a failing card (PREEMPT_VOLUNTARY) will output the
 following:
 [ 2.283355] mmc0: error -110 whilst initialising SD card

 I have also seen transfer errors such as this one:
 [ 105.343780] mmcblk0: error -110 transferring data, sector 798431, nr
 26, card status 0xc00

 When working properly (PREEMPT_NONE), you get:
 [   27.026519] mmc0: new high speed SDHC card at address 0007
 [   27.075775] mmcblk0: mmc0:0007 SD08G 7.49 GiB

 We seem to have a little timing problem - has anyone seen the same
 issue ?  Can driver mmci-omap-hs actually work under
 PREEMPT_VOLUNTARY ?

 Thanks, Mathieu.


I will check this out - not tested with PREEMPT_VOLUNTARY so far.
If it's not too much trouble, can you provide a log with CONFIG_MMC_DEBUG ?
Also, some details about the failing card would be helpful.

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


Re: [PATCH 10/13 v3] OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct

2010-06-15 Thread Benoit Cousson

Hi Charu,

On 6/15/2010 5:05 PM, Varadarajan, Charulatha wrote:

From: Charulatha Vch...@ti.com

This patch adds gpio_dev_attr to OMAP4 gpio hwmod structure. This patch
also corrects the gpio .main_clk and .clk fields in gpio hwmod structures.

Signed-off-by: Charulatha Vch...@ti.com
---
  arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   37 +++-
  1 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 20f5f8c..b4c0878 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -22,6 +22,7 @@

  #includeplat/omap_hwmod.h
  #includeplat/cpu.h
+#includeplat/gpio.h

  #include omap_hwmod_common_data.h

@@ -1272,6 +1273,12 @@ static struct omap_hwmod omap44xx_fdif_hwmod = {
   * general purpose io module
   */

+static struct omap_gpio_dev_attr gpio_dev_attr = {
+   .gpio_bank_count = 6,


Why do you need that information?
The point is that this struct is in theory a per instance data not a 
global one. If needed, you should be able to get that from the number of 
iteration done during the init of hwmods.



+   .gpio_bank_bits = 32,
+   .dbck_flag = true,
+};


Since this structure is the same than OMAP3, you should maybe consider 
sharing it.



+
  static struct omap_hwmod_class_sysconfig omap44xx_gpio_sysc = {
.rev_offs   = 0x,
.sysc_offs  = 0x0010,
@@ -1305,7 +1312,7 @@ static struct omap_hwmod_addr_space 
omap44xx_gpio1_addrs[] = {
  static struct omap_hwmod_ocp_if omap44xx_l4_wkup__gpio1 = {
.master =omap44xx_l4_wkup_hwmod,
.slave  =omap44xx_gpio1_hwmod,
-   .clk= l4_wkup_clk_mux_ck,
+   .clk= gpio1_ick,
.addr   = omap44xx_gpio1_addrs,
.addr_cnt   = ARRAY_SIZE(omap44xx_gpio1_addrs),
.user   = OCP_USER_MPU | OCP_USER_SDMA,
@@ -1325,7 +1332,7 @@ static struct omap_hwmod omap44xx_gpio1_hwmod = {
.class  =omap44xx_gpio_hwmod_class,
.mpu_irqs   = omap44xx_gpio1_irqs,
.mpu_irqs_cnt   = ARRAY_SIZE(omap44xx_gpio1_irqs),
-   .main_clk   = gpio1_ick,
+   .main_clk   = NULL,


Removing the line is enough. It will be null by default.
I'm still not 100% sure that this is the good way to control the GPIO 
module mode, but at least this is cleaner than the previous clock mapping.


Benoit

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


Re: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

2010-06-15 Thread Benoit Cousson

On 6/15/2010 5:05 PM, Varadarajan, Charulatha wrote:

From: Charulatha Vch...@ti.com

This patch adds support for handling GPIO as a HWMOD FW adapted
platform device for OMAP2PLUS chips.

gpio_init needs to be done before machine_init functions access gpio APIs.
Hence gpio_init is made as a postcore_initcall.

Signed-off-by: Charulatha Vch...@ti.com
---
  arch/arm/mach-omap2/gpio.c |  104 
  1 files changed, 104 insertions(+), 0 deletions(-)
  create mode 100644 arch/arm/mach-omap2/gpio.c

diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
new file mode 100644
index 000..993995a
--- /dev/null
+++ b/arch/arm/mach-omap2/gpio.c
@@ -0,0 +1,104 @@
+/*
+ * gpio.c - OMAP2PLUS-specific gpio code
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ *
+ * Author:
+ * Charulatha Vch...@ti.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#includelinux/gpio.h
+#includelinux/err.h
+#includelinux/slab.h
+
+#includeplat/omap_hwmod.h
+#includeplat/omap_device.h
+
+static struct omap_device_pm_latency omap_gpio_latency[] = {
+   [0] = {
+   .deactivate_func = omap_device_idle_hwmods,
+   .activate_func   = omap_device_enable_hwmods,
+   .flags   = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+   },
+};
+
+static int omap2_init_gpio(struct omap_hwmod *oh, void *user)
+{
+   struct omap_device *od;
+   struct omap_gpio_platform_data *pdata;
+   char *name = omap-gpio;
+   static int id;
+   struct omap_gpio_dev_attr *gpio_dev_data;
+
+   if (!oh)
+   pr_err(Could not look up omap gpio %d\n, id + 1);
+
+   pdata = kzalloc(sizeof(struct omap_gpio_platform_data),
+   GFP_KERNEL);
+   if (!pdata) {
+   pr_err(Memory allocation failed gpio%d\n, id + 1);
+   return -ENOMEM;
+   }
+
+   gpio_dev_data = (struct omap_gpio_dev_attr *)oh-dev_attr;
+   pdata-gpio_attr = gpio_dev_data;
+   pdata-method = (int)user;


That method seems to be an IP version specific information and not a Soc 
specific one. You should store that in the hwmod dev_attr.


What does 'method' mean in that context? Maybe the name should be revisited?



+   pdata-virtual_irq_start = IH_GPIO_BASE + 32 * id;
+
+   od = omap_device_build(name, id, oh, pdata,
+   sizeof(*pdata), omap_gpio_latency,
+   ARRAY_SIZE(omap_gpio_latency),
+   false);
+   WARN(IS_ERR(od), Cant build omap_device for %s:%s.\n,
+   name, oh-name);
+
+   id++;
+   return 0;
+}
+
+static int __init gpio_init(int method)
+{
+   return omap_hwmod_for_each_by_class(gpio, omap2_init_gpio,
+   (void *)method);
+}
+
+/*
+ * gpio_init needs to be done before
+ * machine_init functions access gpio APIs.
+ * Hence gpio_init is a postcore_initcall.
+ */
+#ifdef CONFIG_ARCH_OMAP2
+static int __init omap24xx_gpio_init(void)
+{  if (!cpu_is_omap24xx())
+   return -EINVAL;
+
+   return gpio_init(METHOD_GPIO_24XX);
+}
+postcore_initcall(omap24xx_gpio_init);
+#endif
+
+#ifdef CONFIG_ARCH_OMAP3
+static int __init omap3xxx_gpio_init(void)
+{
+   if (!cpu_is_omap34xx())
+   return -EINVAL;
+
+   return gpio_init(METHOD_GPIO_24XX);
+}
+postcore_initcall(omap3xxx_gpio_init);
+#endif
+
+#ifdef CONFIG_ARCH_OMAP4
+static int __init omap44xx_gpio_init(void)
+{
+   if (!cpu_is_omap44xx())
+   return -EINVAL;
+
+   return gpio_init(METHOD_GPIO_44XX);
+}


You can avoid all this duplication of code by using the dev_attr instead 
of using a parameter.


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


Re: SDHC card affected by preemption model in 2.6.35

2010-06-15 Thread Mathieu Poirier
On Tue, 2010-06-15 at 20:58 +0530, Venkatraman S wrote:
 Mathieu Poirier mathieu.poir...@canonical.com wrote:
  HW: Beagleboard rev. C2 and C4
  Processor: OMAP3
  Kernel: 2.6.35-rc2
  Driver: mmci-omap-hs
 
  I am faced with an SDHC card problem on a beagleboard.  Some cards
  cannot be initialized on startup while others work perfectly.  I tracked
  the issue down to one single kernel config: PREEMPT_VOLUNTARY.
 
  When going from PREEMPT_VOLUNTARY to PREEMPT_NONE the problem goes away.
 
  When booting, a failing card (PREEMPT_VOLUNTARY) will output the
  following:
  [ 2.283355] mmc0: error -110 whilst initialising SD card
 
  I have also seen transfer errors such as this one:
  [ 105.343780] mmcblk0: error -110 transferring data, sector 798431, nr
  26, card status 0xc00
 
  When working properly (PREEMPT_NONE), you get:
  [   27.026519] mmc0: new high speed SDHC card at address 0007
  [   27.075775] mmcblk0: mmc0:0007 SD08G 7.49 GiB
 
  We seem to have a little timing problem - has anyone seen the same
  issue ?  Can driver mmci-omap-hs actually work under
  PREEMPT_VOLUNTARY ?
 
  Thanks, Mathieu.
 
 
 I will check this out - not tested with PREEMPT_VOLUNTARY so far.
 If it's not too much trouble, can you provide a log with CONFIG_MMC_DEBUG ?
 Also, some details about the failing card would be helpful.
 
 Thanks,
 Venkat.

Venkat,

Unfortunately enabling CONFIG_MMC_DEBUG doesn't yield more information -
the error message is the same and no additional output shows on the
console.

As for the cards, had failures with 3 different manufacturer:
- Patriot Memory, MicroSD card, 8GB, class 4, SDHC.  
- Kinston, 4GB, class 6, SDHC.
- Sandisk, 4GB, Class 2, SDHC.

I am more than willing to test kernels for you if need be.

Thanks, Mathieu.

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


Re: SDHC card affected by preemption model in 2.6.35

2010-06-15 Thread David Brownell

   When going from PREEMPT_VOLUNTARY to PREEMPT_NONE
 the problem goes away.

Have you found whether this is a problem
with the OMAP HSMMC driver
versus the MMC/SD framework code

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


Re: SDHC card affected by preemption model in 2.6.35

2010-06-15 Thread Mathieu Poirier
On Tue, 2010-06-15 at 14:55 -0700, David Brownell wrote:
When going from PREEMPT_VOLUNTARY to PREEMPT_NONE
  the problem goes away.
 
 Have you found whether this is a problem
 with the OMAP HSMMC driver
 versus the MMC/SD framework code
 
Not yet - I'm in the code, investigating.


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


Serial console not working after waking up from sleep

2010-06-15 Thread Han Wang
Hi,

  I am testing the 2.6.35-rc1 pm branch code on Overo. The system
boots ok. (I can provide booting log if that is necessary) However,
when I use echo mem  /sys/power/state to send overo to sleep and
wake it up by enter a key into serial console. I got garbage
characters in the serial console, and I can not enter anything into
the console anymore. I wonder if anyone has encountered a similar
problem, and please give me some suggestion.

I have appended command log below.

r...@overo:~# echo mem  /sys/power/state
PM: Syncing filesystems ... done.
PM: Preparing system for mem sleep
PM: Adding info for No Bus:vcs63
PM: Adding info for No Bus:vcsa63
Freezing user space processes ... (elapsed 0.02 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.01 seconds) done.
PM: Entering mem sleep
i2c_omap i2c_omap.1: preparing suspend
i2c_omap i2c_omap.3: preparing suspend
platform overo_lcd: preparing suspend
serial8250 serial8250.0: preparing suspend, may wakeup
serial8250 serial8250.1: preparing suspend, may wakeup
serial8250 serial8250.2: preparing suspend, may wakeup
platform omap2-nand: preparing suspend
platform musb_hdrc: preparing suspend
platform smsc911x.0: preparing suspend
platform smsc911x.1: preparing suspend
platform omap2_mcspi.1: preparing suspend
platform omap2_mcspi.2: preparing suspend
platform omap2_mcspi.3: preparing suspend
platform omap2_mcspi.4: preparing suspend
arm-pmu arm-pmu.0: preparing suspend
platform omap_rng: preparing suspend
platform omapfb: preparing suspend
twl4030_gpio twl4030_gpio: preparing suspend
mmci-omap-hs mmci-omap-hs.0: preparing suspend
mmci-omap-hs mmci-omap-hs.1: preparing suspend
twl_reg twl_reg.17: preparing suspend
twl_reg twl_reg.18: preparing suspend
twl_reg twl_reg.19: preparing suspend
twl4030_usb twl4030_usb: preparing suspend, may wakeup
twl_reg twl_reg.6: preparing suspend
serial8250 serial8250: preparing suspend
mmcblk mmc0:fb2a: legacy suspend
serial8250 serial8250: suspend
i2c i2c-3: suspend
twl_reg twl_reg.6: suspend
twl4030_usb twl4030_usb: suspend, may wakeup
twl_reg twl_reg.19: suspend
twl_reg twl_reg.18: suspend
twl_reg twl_reg.17: suspend
mmci-omap-hs mmci-omap-hs.1: suspend
mmci-omap-hs mmci-omap-hs.0: suspend
twl4030_gpio twl4030_gpio: suspend
dummy 1-004b: suspend
dummy 1-004a: suspend
dummy 1-0049: suspend
twl 1-0048: suspend, may wakeup
i2c i2c-1: suspend
platform omapfb: suspend
platform omap_rng: suspend
arm-pmu arm-pmu.0: suspend
platform omap2_mcspi.4: suspend
platform omap2_mcspi.3: suspend
platform omap2_mcspi.2: suspend
platform omap2_mcspi.1: suspend
platform smsc911x.1: suspend
platform smsc911x.0: suspend
platform musb_hdrc: suspend
platform omap2-nand: suspend
serial8250 serial8250.2: suspend, may wakeup
serial8250 serial8250.1: suspend, may wakeup
serial8250 serial8250.0: suspend, may wakeup
platform overo_lcd: suspend
i2c_omap i2c_omap.3: suspend
i2c_omap i2c_omap.1: suspend
PM: suspend of devices complete after 201.965 msecs
serial8250 serial8250: LATE suspend
i2c i2c-3: LATE suspend
twl_reg twl_reg.6: LATE suspend
twl4030_usb twl4030_usb: LATE suspend, may wakeup
twl_reg twl_reg.19: LATE suspend
twl_reg twl_reg.18: LATE suspend
twl_reg twl_reg.17: LATE suspend
mmci-omap-hs mmci-omap-hs.1: LATE suspend
mmci-omap-hs mmci-omap-hs.0: LATE suspend
twl4030_gpio twl4030_gpio: LATE suspend
dummy 1-004b: LATE suspend
dummy 1-004a: LATE suspend
dummy 1-0049: LATE suspend
twl 1-0048: LATE suspend, may wakeup
i2c i2c-1: LATE suspend
platform omapfb: LATE suspend
platform omap_rng: LATE suspend
arm-pmu arm-pmu.0: LATE suspend
platform omap2_mcspi.4: LATE suspend
platform omap2_mcspi.3: LATE suspend
platform omap2_mcspi.2: LATE suspend
platform omap2_mcspi.1: LATE suspend
platform smsc911x.1: LATE suspend
platform smsc911x.0: LATE suspend
platform musb_hdrc: LATE suspend
platform omap2-nand: LATE suspend
serial8250 serial8250.2: LATE suspend, may wakeup
serial8250 serial8250.1: LATE suspend, may wakeup
serial8250 serial8250.0: LATE suspend, may wakeup
platform overo_lcd: LATE suspend
i2c_omap i2c_omap.3: LATE suspend
i2c_omap i2c_omap.1: LATE suspend
PM: late suspend of devices complete after 103.088 msecs
Successfully put all powerdomains to target state
i2c_omap i2c_omap.1: EARLY resume
i2c_omap i2c_omap.3: EARLY resume
platform overo_lcd: EARLY resume
serial8250 serial8250.0: EARLY resume
serial8250 serial8250.1: EARLY resume
serial8250 serial8250.2: EARLY resume
platform omap2-nand: EARLY resume
platform musb_hdrc: EARLY resume
platform smsc911x.0: EARLY resume
platform smsc911x.1: EARLY resume
platform omap2_mcspi.1: EARLY resume
platform omap2_mcspi.2: EARLY resume
platform omap2_mcspi.3: EARLY resume
platform omap2_mcspi.4: EARLY resume
arm-pmu arm-pmu.0: EARLY resume
platform omap_rng: EARLY resume
platform omapfb: EARLY resume
i2c i2c-1: EARLY resume
twl 1-0048: EARLY resume
dummy 1-0049: EARLY resume
dummy 1-004a: EARLY resume
dummy 1-004b: EARLY resume
twl4030_gpio twl4030_gpio: EARLY resume
mmci-omap-hs 

Re: [PATCH v3 4/4] omap: mailbox: convert block api to kfifo

2010-06-15 Thread Ohad Ben-Cohen
On Tue, Jun 15, 2010 at 3:04 AM, Hiroshi DOYU hiroshi.d...@nokia.com wrote:
 Fair enough.

Thanks, I'll prepare them and resubmit
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 4/4] omap: mailbox: convert block api to kfifo

2010-06-15 Thread Hiroshi DOYU
Hi Ohad,

From: ext Ohad Ben-Cohen o...@wizery.com
Subject: Re: [PATCH v3 4/4] omap: mailbox: convert block api to kfifo
Date: Wed, 16 Jun 2010 07:09:13 +0200

 On Tue, Jun 15, 2010 at 3:04 AM, Hiroshi DOYU hiroshi.d...@nokia.com wrote:
 Fair enough.
 
 Thanks, I'll prepare them and resubmit

You can use the following branch which has accumulateed unmerged
mailbox patches.

git://gitorious.org/~doyu/lk/mainline.git v2.6.35-rc3-mailbox



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