Re: [PATCH] omap_hsmmc - use threaded irq handler for card-detect.

2011-12-29 Thread Kishore Kadiyala
On Thu, Dec 29, 2011 at 8:35 PM, NeilBrown ne...@suse.de wrote:


 As the card-detect irq handler just schedules work to be done by
 a thread, we can use request_threaded_irq to do much of the work for
 us.  This means that interrupts which arrive by handle_nested_irq
 actually work.

 Reviewed-by: Felipe Balbi ba...@ti.com
 Tested-by: Grazvydas Ignotas nota...@gmail.com
 Signed-off-by: NeilBrown ne...@suse.de

I have done some thing similar but didn't pushed it  :-(
Anyways
Acked-by:  Kishore Kadiyala kishorek.kadiy...@gmail.com


 diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
 index d5fe43d..56f6cfc 100644
 --- a/drivers/mmc/host/omap_hsmmc.c
 +++ b/drivers/mmc/host/omap_hsmmc.c
 @@ -24,7 +24,6 @@
  #include linux/delay.h
  #include linux/dma-mapping.h
  #include linux/platform_device.h
 -#include linux/workqueue.h
  #include linux/timer.h
  #include linux/clk.h
  #include linux/mmc/host.h
 @@ -163,7 +162,6 @@ struct omap_hsmmc_host {
         */
        struct  regulator       *vcc;
        struct  regulator       *vcc_aux;
 -       struct  work_struct     mmc_carddetect_work;
        void    __iomem         *base;
        resource_size_t         mapbase;
        spinlock_t              irq_lock; /* Prevent races with irq handler */
 @@ -1280,17 +1278,16 @@ static void omap_hsmmc_protect_card(struct 
 omap_hsmmc_host *host)
  }

  /*
 - * Work Item to notify the core about card insertion/removal
 + * irq handler to notify the core about card insertion/removal
  */
 -static void omap_hsmmc_detect(struct work_struct *work)
 +static irqreturn_t omap_hsmmc_detect(int irq, void *dev_id)
  {
 -       struct omap_hsmmc_host *host =
 -               container_of(work, struct omap_hsmmc_host, 
 mmc_carddetect_work);
 +       struct omap_hsmmc_host *host = dev_id;
        struct omap_mmc_slot_data *slot = mmc_slot(host);
        int carddetect;

        if (host-suspended)
 -               return;
 +               return IRQ_HANDLED;

        sysfs_notify(host-mmc-class_dev.kobj, NULL, cover_switch);

 @@ -1305,19 +1302,6 @@ static void omap_hsmmc_detect(struct work_struct *work)
                mmc_detect_change(host-mmc, (HZ * 200) / 1000);
        else
                mmc_detect_change(host-mmc, (HZ * 50) / 1000);
 -}
 -
 -/*
 - * ISR for handling card insertion and removal
 - */
 -static irqreturn_t omap_hsmmc_cd_handler(int irq, void *dev_id)
 -{
 -       struct omap_hsmmc_host *host = (struct omap_hsmmc_host *)dev_id;
 -
 -       if (host-suspended)
 -               return IRQ_HANDLED;
 -       schedule_work(host-mmc_carddetect_work);
 -
        return IRQ_HANDLED;
  }

 @@ -1919,7 +1903,6 @@ static int __init omap_hsmmc_probe(struct 
 platform_device *pdev)
        host-next_data.cookie = 1;

        platform_set_drvdata(pdev, host);
 -       INIT_WORK(host-mmc_carddetect_work, omap_hsmmc_detect);

        mmc-ops        = omap_hsmmc_ops;

 @@ -2047,10 +2030,11 @@ static int __init omap_hsmmc_probe(struct 
 platform_device *pdev)

        /* Request IRQ for card detect */
        if ((mmc_slot(host).card_detect_irq)) {
 -               ret = request_irq(mmc_slot(host).card_detect_irq,
 -                                 omap_hsmmc_cd_handler,
 -                                 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
 -                                 mmc_hostname(mmc), host);
 +               ret = request_threaded_irq(mmc_slot(host).card_detect_irq,
 +                                          NULL,
 +                                          omap_hsmmc_detect,
 +                                          IRQF_TRIGGER_RISING | 
 IRQF_TRIGGER_FALLING,
 +                                          mmc_hostname(mmc), host);
                if (ret) {
                        dev_dbg(mmc_dev(host-mmc),
                                Unable to grab MMC CD IRQ\n);
 @@ -2129,7 +2113,6 @@ static int omap_hsmmc_remove(struct platform_device 
 *pdev)
                free_irq(host-irq, host);
                if (mmc_slot(host).card_detect_irq)
                        free_irq(mmc_slot(host).card_detect_irq, host);
 -               flush_work_sync(host-mmc_carddetect_work);

                pm_runtime_put_sync(host-dev);
                pm_runtime_disable(host-dev);
 @@ -2176,7 +2159,6 @@ static int omap_hsmmc_suspend(struct device *dev)
                                return ret;
                        }
                }
 -               cancel_work_sync(host-mmc_carddetect_work);
                ret = mmc_suspend_host(host-mmc);

                if (ret == 0) {
--
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] ARM: OMAP: hsmmc: add max_freq field

2011-12-22 Thread Kishore Kadiyala
On Wed, Dec 14, 2011 at 6:52 PM, Daniel Mack zon...@gmail.com wrote:
 External circuitry like level shifters may limit the maximum operation
 speed of the hsmmc controller. Add a field to struct omap2_hsmmc_info
 so boards can adjust the setting on demand.

 Signed-off-by: Daniel Mack zon...@gmail.com
 Cc: Tony Lindgren t...@atomide.com
 ---
  arch/arm/mach-omap2/hsmmc.c   |    1 +
  arch/arm/mach-omap2/hsmmc.h   |    2 ++
  drivers/mmc/host/omap_hsmmc.c |    8 ++--
  3 files changed, 9 insertions(+), 2 deletions(-)

 diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
 index f4a1020..4c7bc36 100644
 --- a/arch/arm/mach-omap2/hsmmc.c
 +++ b/arch/arm/mach-omap2/hsmmc.c
 @@ -298,6 +298,7 @@ static int __init omap_hsmmc_pdata_init(struct 
 omap2_hsmmc_info *c,
        mmc-slots[0].caps = c-caps;
        mmc-slots[0].internal_clock = !c-ext_clock;
        mmc-dma_mask = 0x;
 +       mmc-max_freq = c-max_freq;
        if (cpu_is_omap44xx())
                mmc-reg_offset = OMAP4_MMC_REG_OFFSET;
        else
 diff --git a/arch/arm/mach-omap2/hsmmc.h b/arch/arm/mach-omap2/hsmmc.h
 index f757e78..65a8c12 100644
 --- a/arch/arm/mach-omap2/hsmmc.h
 +++ b/arch/arm/mach-omap2/hsmmc.h
 @@ -25,6 +25,8 @@ struct omap2_hsmmc_info {
        char    *name;          /* or NULL for default */
        struct device *dev;     /* returned: pointer to mmc adapter */
        int     ocr_mask;       /* temporary HACK */
 +       int     max_freq;       /* maximum clock, if constrained by external
 +                                * circuitry, or 0 for default */
        /* Remux (pad configuration) when powering on/off */
        void (*remux)(struct device *dev, int slot, int power_on);
        /* init some special card */
 diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
 index 101cd31..8215ef9 100644
 --- a/drivers/mmc/host/omap_hsmmc.c
 +++ b/drivers/mmc/host/omap_hsmmc.c
 @@ -1927,8 +1927,12 @@ static int __init omap_hsmmc_probe(struct 
 platform_device *pdev)
        if (mmc_slot(host).vcc_aux_disable_is_sleep)
                mmc_slot(host).no_off = 1;

 -       mmc-f_min      = OMAP_MMC_MIN_CLOCK;
 -       mmc-f_max      = OMAP_MMC_MAX_CLOCK;
 +       mmc-f_min = OMAP_MMC_MIN_CLOCK;
 +
 +       if (pdata-max_freq  0)

What about having check as below:
if (pdata-max_freq  0  pdata-max_freq  OMAP_MMC_MAX_CLOCK)

 +               mmc-f_max = pdata-max_freq;
 +       else
 +               mmc-f_max = OMAP_MMC_MAX_CLOCK;

        spin_lock_init(host-irq_lock);

 --
 1.7.7.4

 --
 To unsubscribe from this list: send the line unsubscribe linux-mmc in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
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 1/2] omap: hsmmc: Normalize dma cleanup operations

2011-09-06 Thread Kishore Kadiyala
On Fri, Sep 2, 2011 at 12:35 AM, Venkatraman S svenk...@ti.com wrote:
 Reuse omap_hsmmc_dma_cleanup even for normal dma teardown in
 omap_hsmmc_dma_cb. Consolidate multiple points of dma unmap into a
 single location in post_req function, to prevent double unmapping.

 Signed-off-by: Venkatraman S svenk...@ti.com
 ---
  drivers/mmc/host/omap_hsmmc.c |   20 +---
  1 files changed, 5 insertions(+), 15 deletions(-)

 diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
 index 21e4a79..5b7776c 100644
 --- a/drivers/mmc/host/omap_hsmmc.c
 +++ b/drivers/mmc/host/omap_hsmmc.c
 @@ -999,7 +999,8 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host 
 *host, int errno)
  {
        int dma_ch;

 -       host-data-error = errno;
 +       if (host-data)

The condition check above becomes redundant since dma_cleanup is
called during errors in omap_hsmmc_do_irq. Better have this check in
the dma_cb where dma_cleanup is newly added.

 +               host-data-error = errno;

        spin_lock(host-irq_lock);
        dma_ch = host-dma_ch;
 @@ -1007,12 +1008,8 @@ static void omap_hsmmc_dma_cleanup(struct 
 omap_hsmmc_host *host, int errno)
        spin_unlock(host-irq_lock);

        if (host-use_dma  dma_ch != -1) {
 -               dma_unmap_sg(mmc_dev(host-mmc), host-data-sg,
 -                       host-data-sg_len,
 -                       omap_hsmmc_get_dma_dir(host, host-data));
                omap_free_dma(dma_ch);
        }
 -       host-data = NULL;

No need to remove the above one.

  }

  /*
 @@ -1370,7 +1367,7 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, 
 void *cb_data)
  {
        struct omap_hsmmc_host *host = cb_data;
        struct mmc_data *data;
 -       int dma_ch, req_in_progress;
 +       int req_in_progress;

        if (!(ch_status  OMAP_DMA_BLOCK_IRQ)) {
                dev_warn(mmc_dev(host-mmc), unexpected dma status %x\n,
 @@ -1394,16 +1391,9 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, 
 void *cb_data)
                return;
        }

 -       if (!data-host_cookie)
 -               dma_unmap_sg(mmc_dev(host-mmc), data-sg, data-sg_len,
 -                            omap_hsmmc_get_dma_dir(host, data));
 -
        req_in_progress = host-req_in_progress;
 -       dma_ch = host-dma_ch;
 -       host-dma_ch = -1;
        spin_unlock(host-irq_lock);
 -
 -       omap_free_dma(dma_ch);
 +       omap_hsmmc_dma_cleanup(host, 0);

        /* If DMA has finished after TC, complete the request */
        if (!req_in_progress) {
 @@ -1575,7 +1565,7 @@ static void omap_hsmmc_post_req(struct mmc_host *mmc, 
 struct mmc_request *mrq,
        struct omap_hsmmc_host *host = mmc_priv(mmc);
        struct mmc_data *data = mrq-data;

 -       if (host-use_dma) {

Here also , the above conditional check is required.

 +       if (data-host_cookie) {
                dma_unmap_sg(mmc_dev(host-mmc), data-sg, data-sg_len,
                             omap_hsmmc_get_dma_dir(host, data));
                data-host_cookie = 0;
 --
 1.7.1

 --
 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

--
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: Booting hangs with updated linux-omap kernel on OMAP3EVM

2011-08-29 Thread Kishore Kadiyala
On Mon, Aug 29, 2011 at 4:18 PM, Ravi, Deepthy deepthy.r...@ti.com wrote:
 Hi,
 I tried booting OMAP3EVM with the updated linux-omap kernel .
 The last commit details on the kernel are :
 Author: Tony Lindgren t...@atomide.com
 commit b148d763841161894ed6629794064065a834aa2b
 Linux-omap rebuilt: Updated to use omap_sdrc_init

 It hangs at one point.

 Following is the boot log,

 Texas Instruments X-Loader 1.51 (May  3 2011 - 19:22:23)
 Starting X-loader on MMC
 Reading boot sector

 220008 Bytes Read from MMC
 Starting OS Bootloader from MMC...
 Starting OS Bootloader...


 U-Boot 2010.06 (May 03 2011 - 19:23:34)

 OMAP3430/3530-GP ES3.1, CPU-OPP2 L3-165MHz
 OMAP3 EVM board + LPDDR/NAND
 I2C:   ready
 DRAM:  128 MiB
 NAND:  HW ECC [Kernel/FS layout] selected
 256 MiB
 In:    serial
 Out:   serial
 Err:   serial
 Read back SMSC id 0x9220
 Die ID #46a4000404032d460d01d014
 Net:   smc911x-0
 Hit any key to stop autoboot:  0
 OMAP3_EVM #
 OMAP3_EVM #
 OMAP3_EVM # run myboot
 smc911x: detected LAN9220 controller
 smc911x: phy initialized
 smc911x: MAC 00:50:c2:7e:93:73
 Using smc911x-0 device
 TFTP from server 192.168.1.79; our IP address is 192.168.1.123
 Filename 'uImage'.
 Load address: 0x8000
 Loading: #
         #
         #
         #
         #
         #
         #
         #
         #
         ##
 done
 Bytes transferred = 3287400 (322968 hex)
 mmc1 is available
 reading ramdisk.gz

 2013059 bytes read
 ## Booting kernel from Legacy Image at 8000 ...
   Image Name:   Linux-3.1.0-rc3-11176-g2e5a5f9-d
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3287336 Bytes = 3.1 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
 OK

 Starting kernel ...

 Uncompressing Linux... done, booting the kernel.
 [    0.00] Linux version 3.1.0-rc3-11176-g2e5a5f9-dirty 
 (x0157478@psplinux060) (gcc version 4.3.3 (GCC) ) #4 SMP Mon Aug 29 15:37:16 
 IST 2011
 [    0.00] CPU: ARMv7 Processor [411fc083] revision 3 (ARMv7), cr=10c53c7f
 [    0.00] CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction 
 cache
 [    0.00] Machine: OMAP3 EVM
 [    0.00] Memory policy: ECC disabled, Data cache writeback
 [    0.00] OMAP3430/3530 ES3.1 (l2cache iva sgx neon isp )
 [    0.00] SRAM: Mapped pa 0x4020 to va 0xfe40 size: 0x1
 [    0.00] Clocking rate (Crystal/Core/MPU): 26.0/332/500 MHz
 [    0.00] PERCPU: Embedded 8 pages/cpu @c0cef000 s10112 r8192 d14464 
 u32768
 [    0.00] Built 1 zonelists in Zone order, mobility grouping on.  Total 
 pages: 32512
 [    0.00] Kernel command line: mem=128M console=ttyO0,115200n8 
 root=/dev/ram0 initrd=0x8200,40M ramdisk_size=32768 ip=dhcp
 [    0.00] PID hash table entries: 512 (order: -1, 2048 bytes)
 [    0.00] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
 [    0.00] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
 [    0.00] Memory: 128MB = 128MB total
 [    0.00] Memory: 76736k/76736k available, 54336k reserved, 0K highmem
 [    0.00] Virtual kernel memory layout:
 [    0.00]     vector  : 0x - 0x1000   (   4 kB)
 [    0.00]     fixmap  : 0xfff0 - 0xfffe   ( 896 kB)
 [    0.00]     DMA     : 0xffc0 - 0xffe0   (   2 MB)
 [    0.00]     vmalloc : 0xc880 - 0xf800   ( 760 MB)
 [    0.00]     lowmem  : 0xc000 - 0xc800   ( 128 MB)
 [    0.00]     modules : 0xbf00 - 0xc000   (  16 MB)
 [    0.00]       .text : 0xc0008000 - 0xc05c0d30   (5860 kB)
 [    0.00]       .init : 0xc05c1000 - 0xc060e780   ( 310 kB)
 [    0.00]       .data : 0xc061 - 0xc0695490   ( 534 kB)
 [    0.00]        .bss : 0xc06954b4 - 0xc0bea4f4   (5461 kB)
 [    0.00] Hierarchical RCU implementation.
 [    0.00] NR_IRQS:410
 [    0.00] IRQ: Found an INTC at 0xfa20 (revision 4.0) with 96 
 interrupts
 [    0.00] Total of 96 interrupts on 1 active controller
 [    0.00] OMAP clockevent source: GPTIMER1 at 32768 Hz
 [    0.00] sched_clock: 32 bits at 32kHz, resolution 30517ns, wraps every 
 131071999ms
 [    0.00] Console: colour dummy device 80x30
 [    0.00] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., 
 Ingo Molnar
 [    0.00] ... 

Re: [PATCH] OMAP4: MMC: fix power and audio issue, decouple USBC1 from MMC1

2011-07-22 Thread Kishore Kadiyala
On Fri, Jul 22, 2011 at 12:59 AM, Bryan Buckley bryan.buck...@ti.com wrote:
 Remove OMAP4_USBC1_ICUSB_PWRDNZ_MASK during enable/disable PWRDNZ mode for
 MMC1_PBIAS and associated extended-drain MMC1 I/O cell. This is in accordance
 with the control module programming guide. This fixes a bug where if trying to
 use gpio_98 or gpio_99 and MMC1 at the same time the GPIO signal will be
 affected by a changing SDMMC1_VDDS.

 Software must keep MMC1_PBIAS cell and MMC1_IO cell PWRDNZ signals low 
 whenever
 SDMMC1_VDDS ramps up/down or changes for cell protection purposes.

 MMC1 is based on SDMMC1_VDDS whereas USBC1 is based on SIM_VDDS therefore
 they can operate independently.

 Signed-off-by: Bryan Buckley bryan.buck...@ti.com

Good catch,

Acked-by:  Kishore Kadiyala kishore.kadiy...@ti.com

 ---
  arch/arm/mach-omap2/hsmmc.c |   12 
  1 files changed, 4 insertions(+), 8 deletions(-)

 diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
 index 3842405..a6135df 100644
 --- a/arch/arm/mach-omap2/hsmmc.c
 +++ b/arch/arm/mach-omap2/hsmmc.c
 @@ -144,8 +144,7 @@ static void omap4_hsmmc1_before_set_reg(struct device 
 *dev, int slot,
         */
        reg = omap4_ctrl_pad_readl(control_pbias_offset);
        reg = ~(OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK |
 -               OMAP4_MMC1_PWRDNZ_MASK |
 -               OMAP4_USBC1_ICUSB_PWRDNZ_MASK);
 +               OMAP4_MMC1_PWRDNZ_MASK);
        omap4_ctrl_pad_writel(reg, control_pbias_offset);
  }

 @@ -165,8 +164,7 @@ static void omap4_hsmmc1_after_set_reg(struct device 
 *dev, int slot,
                else
                        reg |= OMAP4_MMC1_PBIASLITE_VMODE_MASK;
                reg |= (OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK |
 -                       OMAP4_MMC1_PWRDNZ_MASK |
 -                       OMAP4_USBC1_ICUSB_PWRDNZ_MASK);
 +                       OMAP4_MMC1_PWRDNZ_MASK);
                omap4_ctrl_pad_writel(reg, control_pbias_offset);
                /* 4 microsec delay for comparator to generate an error*/
                udelay(4);
 @@ -174,16 +172,14 @@ static void omap4_hsmmc1_after_set_reg(struct device 
 *dev, int slot,
                if (reg  OMAP4_MMC1_PBIASLITE_VMODE_ERROR_MASK) {
                        pr_err(Pbias Voltage is not same as LDO\n);
                        /* Caution : On VMODE_ERROR Power Down MMC IO */
 -                       reg = ~(OMAP4_MMC1_PWRDNZ_MASK |
 -                               OMAP4_USBC1_ICUSB_PWRDNZ_MASK);
 +                       reg = ~(OMAP4_MMC1_PWRDNZ_MASK);
                        omap4_ctrl_pad_writel(reg, control_pbias_offset);
                }
        } else {
                reg = omap4_ctrl_pad_readl(control_pbias_offset);
                reg |= (OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK |
                        OMAP4_MMC1_PWRDNZ_MASK |
 -                       OMAP4_MMC1_PBIASLITE_VMODE_MASK |
 -                       OMAP4_USBC1_ICUSB_PWRDNZ_MASK);
 +                       OMAP4_MMC1_PBIASLITE_VMODE_MASK);
                omap4_ctrl_pad_writel(reg, control_pbias_offset);
        }
  }
 --
 1.7.0.4

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

--
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 1/2] ARM: OMAP4: MMC: increase delay for pbias

2011-05-31 Thread Kishore Kadiyala
On Mon, May 30, 2011 at 7:55 PM, Balaji T K balaj...@ti.com wrote:
 4 micro seconds is not enough for PBIAS if MMC regulator is
 enabled from MMC regulator OFF.
 Increase the delay for PBIAS to stabilize.
 Wait for PBIAS and timeout if not.

 Resolves MMC/SD failure on OMAP4
 Pbias Voltage is not same as LDO

 Signed-off-by: Balaji T K balaj...@ti.com

Acked-by:  Kishore Kadiyala kishore.kadiy...@ti.com

snip
--
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 2/2] ARM: OMAP4: MMC: no regulator off during probe for eMMC

2011-05-31 Thread Kishore Kadiyala
On Mon, May 30, 2011 at 7:55 PM, Balaji T K balaj...@ti.com wrote:
 eMMC does not handle power off when not in sleep state,
 Skip regulator disable during probe when eMMC is
 not in known state - state left by bootloader.

 Resolves eMMC failure on OMAP4
 mmc0: error -110 whilst initialising MMC card

 Signed-off-by: Balaji T K balaj...@ti.com

Tested-by:  Kishore Kadiyala kishore.kadiy...@ti.com
Acked-by:  Kishore Kadiyala kishore.kadiy...@ti.com

 ---
  arch/arm/mach-omap2/board-4430sdp.c   |    1 +
  arch/arm/mach-omap2/hsmmc.c           |    3 +++
  arch/arm/mach-omap2/hsmmc.h           |    1 +
  arch/arm/plat-omap/include/plat/mmc.h |    3 +++
  drivers/mmc/host/omap_hsmmc.c         |    3 +++
  5 files changed, 11 insertions(+), 0 deletions(-)

 diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
 b/arch/arm/mach-omap2/board-4430sdp.c
 index 73fa90b..b324605 100644
 --- a/arch/arm/mach-omap2/board-4430sdp.c
 +++ b/arch/arm/mach-omap2/board-4430sdp.c
 @@ -322,6 +322,7 @@ static struct omap2_hsmmc_info mmc[] = {
                .gpio_wp        = -EINVAL,
                .nonremovable   = true,
                .ocr_mask       = MMC_VDD_29_30,
 +               .no_off_init    = true,
        },
        {
                .mmc            = 1,
 diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
 index 3f8dc16..28ca144 100644
 --- a/arch/arm/mach-omap2/hsmmc.c
 +++ b/arch/arm/mach-omap2/hsmmc.c
 @@ -338,6 +338,9 @@ static int __init omap_hsmmc_pdata_init(struct 
 omap2_hsmmc_info *c,
        if (c-no_off)
                mmc-slots[0].no_off = 1;

 +       if (c-no_off_init)
 +               mmc-slots[0].no_regulator_off_init = c-no_off_init;
 +
        if (c-vcc_aux_disable_is_sleep)
                mmc-slots[0].vcc_aux_disable_is_sleep = 1;

 diff --git a/arch/arm/mach-omap2/hsmmc.h b/arch/arm/mach-omap2/hsmmc.h
 index f119348..f757e78 100644
 --- a/arch/arm/mach-omap2/hsmmc.h
 +++ b/arch/arm/mach-omap2/hsmmc.h
 @@ -18,6 +18,7 @@ struct omap2_hsmmc_info {
        bool    nonremovable;   /* Nonremovable e.g. eMMC */
        bool    power_saving;   /* Try to sleep or power off when possible */
        bool    no_off;         /* power_saving and power is not to go off */
 +       bool    no_off_init;    /* no power off when not in MMC sleep state */
        bool    vcc_aux_disable_is_sleep; /* Regulator off remapped to sleep */
        int     gpio_cd;        /* or -EINVAL */
        int     gpio_wp;        /* or -EINVAL */
 diff --git a/arch/arm/plat-omap/include/plat/mmc.h 
 b/arch/arm/plat-omap/include/plat/mmc.h
 index f38fef9..c7b8741 100644
 --- a/arch/arm/plat-omap/include/plat/mmc.h
 +++ b/arch/arm/plat-omap/include/plat/mmc.h
 @@ -101,6 +101,9 @@ struct omap_mmc_platform_data {
                /* If using power_saving and the MMC power is not to go off */
                unsigned no_off:1;

 +               /* eMMC does not handle power off when not in sleep state */
 +               unsigned no_regulator_off_init:1;
 +
                /* Regulator off remapped to sleep */
                unsigned vcc_aux_disable_is_sleep:1;

 diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
 index 259ece0..5b2e215 100644
 --- a/drivers/mmc/host/omap_hsmmc.c
 +++ b/drivers/mmc/host/omap_hsmmc.c
 @@ -435,6 +435,9 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host 
 *host)
                reg = regulator_get(host-dev, vmmc_aux);
                host-vcc_aux = IS_ERR(reg) ? NULL : reg;

 +               /* For eMMC do not power off when not in sleep state */
 +               if (mmc_slot(host).no_regulator_off_init)
 +                       return 0;
                /*
                * UGLY HACK:  workaround regulator framework bugs.
                * When the bootloader leaves a supply active, it's
 --
 1.7.0.4

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

--
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 RESEND] omap : nand : fix subpage ecc issue with prefetch

2011-05-11 Thread Kishore Kadiyala
When reading/writing a subpage (When HW ECC is not available/enabled)
for number of bytes not aligned to 4, the mis-aligned bytes are handled
first (by cpu copy method) before enabling the Prefetch engine to/from
'p'(start of buffer 'buf'). Then it reads/writes rest of the bytes with
the help of Prefetch engine, if available, or again using cpu copy method.
Currently, reading/writing of rest of bytes, is not done correctly since
its trying to read/write again to/from begining of buffer 'buf',
overwriting the mis-aligned bytes.

Read  write using prefetch engine got broken in commit '2c01946c'.
We never hit a scenario of not getting 'gpmc_prefetch_enable' call
success. So, problem did not get caught up.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Signed-off-by: Vimal Singh vimal.neww...@gmail.com
Reported-by: Bryan DE FARIA bdefa...@adeneo-embedded.com
Cc: sta...@kernel.org [2.6.35+]
---
 drivers/mtd/nand/omap2.c |   12 +---
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index da9a351..2c8040f 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -263,11 +263,10 @@ static void omap_read_buf_pref(struct mtd_info *mtd, 
u_char *buf, int len)
if (ret) {
/* PFPW engine is busy, use cpu copy method */
if (info-nand.options  NAND_BUSWIDTH_16)
-   omap_read_buf16(mtd, buf, len);
+   omap_read_buf16(mtd, (u_char *)p, len);
else
-   omap_read_buf8(mtd, buf, len);
+   omap_read_buf8(mtd, (u_char *)p, len);
} else {
-   p = (u32 *) buf;
do {
r_count = gpmc_read_status(GPMC_PREFETCH_FIFO_CNT);
r_count = r_count  2;
@@ -293,7 +292,7 @@ static void omap_write_buf_pref(struct mtd_info *mtd,
struct omap_nand_info, mtd);
uint32_t w_count = 0;
int i = 0, ret = 0;
-   u16 *p;
+   u16 *p = (u16 *)buf;
unsigned long tim, limit;
 
/* take care of subpage writes */
@@ -309,11 +308,10 @@ static void omap_write_buf_pref(struct mtd_info *mtd,
if (ret) {
/* PFPW engine is busy, use cpu copy method */
if (info-nand.options  NAND_BUSWIDTH_16)
-   omap_write_buf16(mtd, buf, len);
+   omap_write_buf16(mtd, (u_char *)p, len);
else
-   omap_write_buf8(mtd, buf, len);
+   omap_write_buf8(mtd, (u_char *)p, len);
} else {
-   p = (u16 *) buf;
while (len) {
w_count = gpmc_read_status(GPMC_PREFETCH_FIFO_CNT);
w_count = w_count  1;
-- 
1.7.4.1

--
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 RESEND] omap : nand : fix subpage ecc issue with prefetch

2011-05-11 Thread Kishore Kadiyala
When reading/writing a subpage (When HW ECC is not available/enabled)
for number of bytes not aligned to 4, the mis-aligned bytes are handled
first (by cpu copy method) before enabling the Prefetch engine to/from
'p'(start of buffer 'buf'). Then it reads/writes rest of the bytes with
the help of Prefetch engine, if available, or again using cpu copy method.
Currently, reading/writing of rest of bytes, is not done correctly since
its trying to read/write again to/from begining of buffer 'buf',
overwriting the mis-aligned bytes.

Read  write using prefetch engine got broken in commit '2c01946c'.
We never hit a scenario of not getting 'gpmc_prefetch_enable' call
success. So, problem did not get caught up.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Signed-off-by: Vimal Singh vimal.neww...@gmail.com
Reported-by: Bryan DE FARIA bdefa...@adeneo-embedded.com
---
 drivers/mtd/nand/omap2.c |   12 +---
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index da9a351..2c8040f 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -263,11 +263,10 @@ static void omap_read_buf_pref(struct mtd_info *mtd, 
u_char *buf, int len)
if (ret) {
/* PFPW engine is busy, use cpu copy method */
if (info-nand.options  NAND_BUSWIDTH_16)
-   omap_read_buf16(mtd, buf, len);
+   omap_read_buf16(mtd, (u_char *)p, len);
else
-   omap_read_buf8(mtd, buf, len);
+   omap_read_buf8(mtd, (u_char *)p, len);
} else {
-   p = (u32 *) buf;
do {
r_count = gpmc_read_status(GPMC_PREFETCH_FIFO_CNT);
r_count = r_count  2;
@@ -293,7 +292,7 @@ static void omap_write_buf_pref(struct mtd_info *mtd,
struct omap_nand_info, mtd);
uint32_t w_count = 0;
int i = 0, ret = 0;
-   u16 *p;
+   u16 *p = (u16 *)buf;
unsigned long tim, limit;
 
/* take care of subpage writes */
@@ -309,11 +308,10 @@ static void omap_write_buf_pref(struct mtd_info *mtd,
if (ret) {
/* PFPW engine is busy, use cpu copy method */
if (info-nand.options  NAND_BUSWIDTH_16)
-   omap_write_buf16(mtd, buf, len);
+   omap_write_buf16(mtd, (u_char *)p, len);
else
-   omap_write_buf8(mtd, buf, len);
+   omap_write_buf8(mtd, (u_char *)p, len);
} else {
-   p = (u16 *) buf;
while (len) {
w_count = gpmc_read_status(GPMC_PREFETCH_FIFO_CNT);
w_count = w_count  1;
-- 
1.7.4.1

--
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: [stable] [PATCH RESEND] omap : nand : fix subpage ecc issue with prefetch

2011-05-11 Thread Kishore Kadiyala
On Wed, May 11, 2011 at 8:24 PM, Greg KH g...@kroah.com wrote:
 On Wed, May 11, 2011 at 07:54:57PM +0530, Kishore Kadiyala wrote:
 When reading/writing a subpage (When HW ECC is not available/enabled)
 for number of bytes not aligned to 4, the mis-aligned bytes are handled
 first (by cpu copy method) before enabling the Prefetch engine to/from
 'p'(start of buffer 'buf'). Then it reads/writes rest of the bytes with
 the help of Prefetch engine, if available, or again using cpu copy method.
 Currently, reading/writing of rest of bytes, is not done correctly since
 its trying to read/write again to/from begining of buffer 'buf',
 overwriting the mis-aligned bytes.

 Read  write using prefetch engine got broken in commit '2c01946c'.
 We never hit a scenario of not getting 'gpmc_prefetch_enable' call
 success. So, problem did not get caught up.

 Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
 Signed-off-by: Vimal Singh vimal.neww...@gmail.com
 Reported-by: Bryan DE FARIA bdefa...@adeneo-embedded.com
 ---
  drivers/mtd/nand/omap2.c |   12 +---
  1 files changed, 5 insertions(+), 7 deletions(-)


 formletter

 This is not the correct way to submit patches for inclusion in the
 stable kernel tree.  Please read Documentation/stable_kernel_rules.txt
 for how to do this properly.

Ok, will post it properly.

Regards,
Kishore

 /formletter

 __
 Linux MTD discussion mailing list
 http://lists.infradead.org/mailman/listinfo/linux-mtd/

--
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 RESEND] omap : nand : fix subpage ecc issue with prefetch

2011-05-11 Thread Kishore Kadiyala
Oops forgot to CC sta...@kernel.org, posting again without any changes.

Regards,
Kishore

On Mon, May 9, 2011 at 7:51 PM, Kishore Kadiyala
kishore.kadiy...@ti.com wrote:
 When reading/writing a subpage (When HW ECC is not available/enabled)
 for number of bytes not aligned to 4, the mis-aligned bytes are handled
 first (by cpu copy method) before enabling the Prefetch engine to/from
 'p'(start of buffer 'buf'). Then it reads/writes rest of the bytes with
 the help of Prefetch engine, if available, or again using cpu copy method.
 Currently, reading/writing of rest of bytes, is not done correctly since
 its trying to read/write again to/from begining of buffer 'buf',
 overwriting the mis-aligned bytes.

 Read  write using prefetch engine got broken in commit '2c01946c'.
 We never hit a scenario of not getting 'gpmc_prefetch_enable' call
 success. So, problem did not get caught up.

 Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
 Signed-off-by: Vimal Singh vimal.neww...@gmail.com
 Reported-by: Bryan DE FARIA bdefa...@adeneo-embedded.com
 ---
  drivers/mtd/nand/omap2.c |   12 +---
  1 files changed, 5 insertions(+), 7 deletions(-)

 diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
 index da9a351..2c8040f 100644
 --- a/drivers/mtd/nand/omap2.c
 +++ b/drivers/mtd/nand/omap2.c
 @@ -263,11 +263,10 @@ static void omap_read_buf_pref(struct mtd_info *mtd, 
 u_char *buf, int len)
        if (ret) {
                /* PFPW engine is busy, use cpu copy method */
                if (info-nand.options  NAND_BUSWIDTH_16)
 -                       omap_read_buf16(mtd, buf, len);
 +                       omap_read_buf16(mtd, (u_char *)p, len);
                else
 -                       omap_read_buf8(mtd, buf, len);
 +                       omap_read_buf8(mtd, (u_char *)p, len);
        } else {
 -               p = (u32 *) buf;
                do {
                        r_count = gpmc_read_status(GPMC_PREFETCH_FIFO_CNT);
                        r_count = r_count  2;
 @@ -293,7 +292,7 @@ static void omap_write_buf_pref(struct mtd_info *mtd,
                                                struct omap_nand_info, mtd);
        uint32_t w_count = 0;
        int i = 0, ret = 0;
 -       u16 *p;
 +       u16 *p = (u16 *)buf;
        unsigned long tim, limit;

        /* take care of subpage writes */
 @@ -309,11 +308,10 @@ static void omap_write_buf_pref(struct mtd_info *mtd,
        if (ret) {
                /* PFPW engine is busy, use cpu copy method */
                if (info-nand.options  NAND_BUSWIDTH_16)
 -                       omap_write_buf16(mtd, buf, len);
 +                       omap_write_buf16(mtd, (u_char *)p, len);
                else
 -                       omap_write_buf8(mtd, buf, len);
 +                       omap_write_buf8(mtd, (u_char *)p, len);
        } else {
 -               p = (u16 *) buf;
                while (len) {
                        w_count = gpmc_read_status(GPMC_PREFETCH_FIFO_CNT);
                        w_count = w_count  1;
 --
 1.7.4.1


 __
 Linux MTD discussion mailing list
 http://lists.infradead.org/mailman/listinfo/linux-mtd/

--
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 RESEND] omap : nand : fix subpage ecc issue with prefetch

2011-05-09 Thread Kishore Kadiyala
When reading/writing a subpage (When HW ECC is not available/enabled)
for number of bytes not aligned to 4, the mis-aligned bytes are handled
first (by cpu copy method) before enabling the Prefetch engine to/from
'p'(start of buffer 'buf'). Then it reads/writes rest of the bytes with
the help of Prefetch engine, if available, or again using cpu copy method.
Currently, reading/writing of rest of bytes, is not done correctly since
its trying to read/write again to/from begining of buffer 'buf',
overwriting the mis-aligned bytes.

Read  write using prefetch engine got broken in commit '2c01946c'.
We never hit a scenario of not getting 'gpmc_prefetch_enable' call
success. So, problem did not get caught up.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Signed-off-by: Vimal Singh vimal.neww...@gmail.com
Reported-by: Bryan DE FARIA bdefa...@adeneo-embedded.com
---
 drivers/mtd/nand/omap2.c |   12 +---
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index da9a351..2c8040f 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -263,11 +263,10 @@ static void omap_read_buf_pref(struct mtd_info *mtd, 
u_char *buf, int len)
if (ret) {
/* PFPW engine is busy, use cpu copy method */
if (info-nand.options  NAND_BUSWIDTH_16)
-   omap_read_buf16(mtd, buf, len);
+   omap_read_buf16(mtd, (u_char *)p, len);
else
-   omap_read_buf8(mtd, buf, len);
+   omap_read_buf8(mtd, (u_char *)p, len);
} else {
-   p = (u32 *) buf;
do {
r_count = gpmc_read_status(GPMC_PREFETCH_FIFO_CNT);
r_count = r_count  2;
@@ -293,7 +292,7 @@ static void omap_write_buf_pref(struct mtd_info *mtd,
struct omap_nand_info, mtd);
uint32_t w_count = 0;
int i = 0, ret = 0;
-   u16 *p;
+   u16 *p = (u16 *)buf;
unsigned long tim, limit;
 
/* take care of subpage writes */
@@ -309,11 +308,10 @@ static void omap_write_buf_pref(struct mtd_info *mtd,
if (ret) {
/* PFPW engine is busy, use cpu copy method */
if (info-nand.options  NAND_BUSWIDTH_16)
-   omap_write_buf16(mtd, buf, len);
+   omap_write_buf16(mtd, (u_char *)p, len);
else
-   omap_write_buf8(mtd, buf, len);
+   omap_write_buf8(mtd, (u_char *)p, len);
} else {
-   p = (u16 *) buf;
while (len) {
w_count = gpmc_read_status(GPMC_PREFETCH_FIFO_CNT);
w_count = w_count  1;
-- 
1.7.4.1

--
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] omap : nand : fix subpage ecc issue with prefetch

2011-05-03 Thread Kishore Kadiyala
For prefetch engine, read and write  got broken in commit '2c01946c'.
We never hit a scenario of not getting 'gpmc_prefetch_enable'
call success.
When reading/writing a subpage with a non divisible by 4 ecc number
of bytes, the mis-aligned bytes gets handled first before enabling
the Prefetch engine, then it reads/writes rest of the bytes.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Signed-off-by: Vimal Singh vimal.neww...@gmail.com
Reported-by: Bryan DE FARIA bdefa...@adeneo-embedded.com
---
 drivers/mtd/nand/omap2.c |   12 +---
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index da9a351..2c8040f 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -263,11 +263,10 @@ static void omap_read_buf_pref(struct mtd_info *mtd, 
u_char *buf, int len)
if (ret) {
/* PFPW engine is busy, use cpu copy method */
if (info-nand.options  NAND_BUSWIDTH_16)
-   omap_read_buf16(mtd, buf, len);
+   omap_read_buf16(mtd, (u_char *)p, len);
else
-   omap_read_buf8(mtd, buf, len);
+   omap_read_buf8(mtd, (u_char *)p, len);
} else {
-   p = (u32 *) buf;
do {
r_count = gpmc_read_status(GPMC_PREFETCH_FIFO_CNT);
r_count = r_count  2;
@@ -293,7 +292,7 @@ static void omap_write_buf_pref(struct mtd_info *mtd,
struct omap_nand_info, mtd);
uint32_t w_count = 0;
int i = 0, ret = 0;
-   u16 *p;
+   u16 *p = (u16 *)buf;
unsigned long tim, limit;
 
/* take care of subpage writes */
@@ -309,11 +308,10 @@ static void omap_write_buf_pref(struct mtd_info *mtd,
if (ret) {
/* PFPW engine is busy, use cpu copy method */
if (info-nand.options  NAND_BUSWIDTH_16)
-   omap_write_buf16(mtd, buf, len);
+   omap_write_buf16(mtd, (u_char *)p, len);
else
-   omap_write_buf8(mtd, buf, len);
+   omap_write_buf8(mtd, (u_char *)p, len);
} else {
-   p = (u16 *) buf;
while (len) {
w_count = gpmc_read_status(GPMC_PREFETCH_FIFO_CNT);
w_count = w_count  1;
-- 
1.7.4.1

--
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 2.6.39] omap: board-4430sdp: revert hsmmc_info reordering

2011-04-01 Thread Kishore Kadiyala
On Fri, Apr 1, 2011 at 12:22 PM, Luciano Coelho coe...@ti.com wrote:
 The order in which the MMC cards are defined in the the 4430sdp board
 file seems to have been mistakenly reorderded as part of an unrelated
 patch.  In commit 0005ae73cfe44ee42d0be12a12cc82bf982f518e, where only
 the dev_name was supposed to be changed, the mmc order was changed as
 well.  This caused the external SD card reader not to be recognized,
 at least on Blaze.

Both OMAP4 SDP  Blaze boards have internal eMMC as storage.

Just think of some scenario as below with FS in  eMMC
[with external card recognized as mmcblk0 and eMMC as mmcblk1]:
Booting with both external card on MMC1 and eMMC on MMC2 and having
bootargs set to root=/dev/mmcblk1px [x= parition number].
Removing the external card from slot makes eMMC recognized as mmcblk0 and
in this case kernel can't pick the file system as passed above in the bootargs.

So, making the permanent storage on the boards registered as first
block device gets
rid of the problem.

Regards,
Kishore

 This patch reverts this change so that the external SD card is
 recognized again.

 Cc: Kishore Kadiyala kishore.kadiy...@ti.com
 Cc: Benoit Cousson b-cous...@ti.com
 Signed-off-by: Luciano Coelho coe...@ti.com
 ---

 I have started investigating the cause for this problem, because it
 seems to me that the value in the mmc element is what should matter,
 but it doesn't seem to be the case.  I believe there is a bug
 elsewhere, that causes the order of the array to matter, but I'm not
 very familiar with hsmmc and I don't have much time right now to delve
 into the problem, so I leave this to the omap people. ;) I can always
 help testing if necessary.

 The change indeed seems to have been a mistake, because it was
 introduced silently in v6:
 https://patchwork.kernel.org/patch/595861/

 In v5, the change was not there:
 https://patchwork.kernel.org/patch/590441/

  arch/arm/mach-omap2/board-4430sdp.c |   10 +-
  1 files changed, 5 insertions(+), 5 deletions(-)

 diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
 b/arch/arm/mach-omap2/board-4430sdp.c
 index 56702c5..8991d56 100644
 --- a/arch/arm/mach-omap2/board-4430sdp.c
 +++ b/arch/arm/mach-omap2/board-4430sdp.c
 @@ -351,6 +351,11 @@ static struct twl4030_usb_data omap4_usbphy_data = {

  static struct omap2_hsmmc_info mmc[] = {
        {
 +               .mmc            = 1,
 +               .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
 +               .gpio_wp        = -EINVAL,
 +       },
 +       {
                .mmc            = 2,
                .caps           =  MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
                .gpio_cd        = -EINVAL,
 @@ -358,11 +363,6 @@ static struct omap2_hsmmc_info mmc[] = {
                .nonremovable   = true,
                .ocr_mask       = MMC_VDD_29_30,
        },
 -       {
 -               .mmc            = 1,
 -               .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
 -               .gpio_wp        = -EINVAL,
 -       },
        {}      /* Terminator */
  };

 --
 1.7.1

 --
 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

--
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 2.6.39] omap: board-4430sdp: revert hsmmc_info reordering

2011-04-01 Thread Kishore Kadiyala
On Fri, Apr 1, 2011 at 1:50 PM, Luciano Coelho coe...@ti.com wrote:
 On Fri, 2011-04-01 at 12:46 +0530, Kishore Kadiyala wrote:
 On Fri, Apr 1, 2011 at 12:22 PM, Luciano Coelho coe...@ti.com wrote:
  The order in which the MMC cards are defined in the the 4430sdp board
  file seems to have been mistakenly reorderded as part of an unrelated
  patch.  In commit 0005ae73cfe44ee42d0be12a12cc82bf982f518e, where only
  the dev_name was supposed to be changed, the mmc order was changed as
  well.  This caused the external SD card reader not to be recognized,
  at least on Blaze.

 Both OMAP4 SDP  Blaze boards have internal eMMC as storage.

 Just think of some scenario as below with FS in  eMMC
 [with external card recognized as mmcblk0 and eMMC as mmcblk1]:
 Booting with both external card on MMC1 and eMMC on MMC2 and having
 bootargs set to root=/dev/mmcblk1px [x= parition number].
 Removing the external card from slot makes eMMC recognized as mmcblk0 and
 in this case kernel can't pick the file system as passed above in the 
 bootargs.

 Yes, this makes sense.  The internal eMMC should be mapped first, I
 agree.


 So, making the permanent storage on the boards registered as first
 block device gets
 rid of the problem.

 Yes, but there is something wrong that causes the external MMC not to be
 recognized at all if you map the internal MMC first.  There is a bug
 elsewhere that needs to be fixed before this change can be made.

 As I said, I don't know much about the OMAP MMC subsystem and I don't
 have the time right now to investigate what really is wrong.  That's why
 I sent this patch, as quick fix (or rather getting rid of a regression).

I don't see any regression with 2.6.39-rc1 on either OMAP4430SDP or Blaze,
logs below:

Blaze log : http://pastebin.com/mGB5uD7P
SDP log : http://pastebin.com/A5uAFfsr


 Another thing is that this is a crosspatch change.  It shouldn't be part
 of the same patch that changes the name of the driver, since this is
 totally unrelated.  If you really think this needs to be done, it should
 have been done in a separate patch.

Agree , it went accidentally in V6.


 --
 Cheers,
 Luca.


--
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: Code for v2.6.39 merge window frozen, patches archived

2011-03-16 Thread Kishore Kadiyala
On Wed, Mar 16, 2011 at 7:50 PM, G, Manjunath Kondaiah manj...@ti.com wrote:
 On Wed, Mar 16, 2011 at 07:37:10PM +0530, G, Manjunath Kondaiah wrote:
 On Mon, Mar 14, 2011 at 12:25:38PM -0700, Tony Lindgren wrote:
  Hi all,
 
  I've applied few random fix like patches today into omap-for-linus
  but that's it for this merge window.
 
  So let's do some testing with with Stephen's for-next and
  omap-for-linus and start queueing up fixes for the -rc cycle.
 omap-for-linus boots on:
 OMAP3430-Zoom2
 OMAP3630-Zoom3
 OMAP4430-Blaze

 With OMAP3 and OMAP4 disabled, it boots successfully on:
 OMAP2420-H4
 OMAP2430-SDP

 Also boots on OMAP1710-H3

boots fine on OMAP4430SDP as well

Regards,
Kishore


 -Manjunath


 -Manjunath

 
  I've also moved all the patchwork.kernel.org patches into
  archived-v2.6.39 bundle and marked them as archived:
 
  https://patchwork.kernel.org/user/bundle/1381/
 
  You can still find the patches there if you click on Filters
  and changed Archived from No to Both.
 
  Looks like there's one smartreflex patch that does not seem
  to exist in patchwork though.. So that one is still lurking
  around on the patchwork list of patches until the issue has
  been fixed in patchwork.kernel.org.
 
  Cheers,
 
  Tony
  --
  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
 --
 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

--
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 v6 8/8] OMAP: hsmmc: Rename the device and driver

2011-02-28 Thread Kishore Kadiyala
Modifying the device  driver name from mmci-omap-hs to
omap_hsmmc.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Acked-by: Benoit Coussonb-cous...@ti.com
---
 arch/arm/mach-omap2/board-2430sdp.c  |2 +-
 arch/arm/mach-omap2/board-3430sdp.c  |6 +++---
 arch/arm/mach-omap2/board-4430sdp.c  |   14 +++---
 arch/arm/mach-omap2/board-devkit8000.c   |2 +-
 arch/arm/mach-omap2/board-igep0020.c |6 +++---
 arch/arm/mach-omap2/board-igep0030.c |6 +++---
 arch/arm/mach-omap2/board-omap3evm.c |2 +-
 arch/arm/mach-omap2/board-omap3pandora.c |6 +++---
 arch/arm/mach-omap2/board-omap4panda.c   |4 ++--
 arch/arm/mach-omap2/board-rm680.c|2 +-
 arch/arm/mach-omap2/board-rx51-peripherals.c |8 
 arch/arm/mach-omap2/board-zoom-peripherals.c |2 +-
 arch/arm/mach-omap2/clock2430_data.c |   12 ++--
 arch/arm/mach-omap2/clock3xxx_data.c |   12 ++--
 arch/arm/mach-omap2/clock44xx_data.c |   20 ++--
 arch/arm/mach-omap2/hsmmc.c  |2 +-
 drivers/mmc/host/omap_hsmmc.c|2 +-
 17 files changed, 54 insertions(+), 54 deletions(-)

diff --git a/arch/arm/mach-omap2/board-2430sdp.c 
b/arch/arm/mach-omap2/board-2430sdp.c
index cc42d47..ab0880b 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -149,7 +149,7 @@ static void __init omap_2430sdp_init_early(void)
 }
 
 static struct regulator_consumer_supply sdp2430_vmmc1_supplies[] = {
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0),
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.0),
 };
 
 /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index 8950ecc..40b0174 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -410,15 +410,15 @@ static struct regulator_consumer_supply 
sdp3430_vpll2_supplies[] = {
 };
 
 static struct regulator_consumer_supply sdp3430_vmmc1_supplies[] = {
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0),
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.0),
 };
 
 static struct regulator_consumer_supply sdp3430_vsim_supplies[] = {
-   REGULATOR_SUPPLY(vmmc_aux, mmci-omap-hs.0),
+   REGULATOR_SUPPLY(vmmc_aux, omap_hsmmc.0),
 };
 
 static struct regulator_consumer_supply sdp3430_vmmc2_supplies[] = {
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.1),
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.1),
 };
 
 /*
diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 1a943be..f914099 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -349,11 +349,6 @@ static struct twl4030_usb_data omap4_usbphy_data = {
 
 static struct omap2_hsmmc_info mmc[] = {
{
-   .mmc= 1,
-   .caps   = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
-   .gpio_wp= -EINVAL,
-   },
-   {
.mmc= 2,
.caps   =  MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
.gpio_cd= -EINVAL,
@@ -361,19 +356,24 @@ static struct omap2_hsmmc_info mmc[] = {
.nonremovable   = true,
.ocr_mask   = MMC_VDD_29_30,
},
+   {
+   .mmc= 1,
+   .caps   = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
+   .gpio_wp= -EINVAL,
+   },
{}  /* Terminator */
 };
 
 static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
{
.supply = vmmc,
-   .dev_name = mmci-omap-hs.1,
+   .dev_name = omap_hsmmc.1,
},
 };
 static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
{
.supply = vmmc,
-   .dev_name = mmci-omap-hs.0,
+   .dev_name = omap_hsmmc.0,
},
 };
 
diff --git a/arch/arm/mach-omap2/board-devkit8000.c 
b/arch/arm/mach-omap2/board-devkit8000.c
index 54abdd0..c9170f4 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -140,7 +140,7 @@ static void devkit8000_panel_disable_dvi(struct 
omap_dss_device *dssdev)
 }
 
 static struct regulator_consumer_supply devkit8000_vmmc1_supply =
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0);
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.0);
 
 
 /* ads7846 on SPI */
diff --git a/arch/arm/mach-omap2/board-igep0020.c 
b/arch/arm/mach-omap2/board-igep0020.c
index 54e6318..1877c28 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -250,7 +250,7 @@ static inline void __init igep2_init_smsc911x(void) { }
 #endif
 
 static struct regulator_consumer_supply igep2_vmmc1_supply =
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0);
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.0);
 
 /* VMMC1 for OMAP

[PATCH v6 5/8] OMAP: hwmod data: Add dev_attr and use in the host driver

2011-02-28 Thread Kishore Kadiyala
Add a device attribute to hwmod data of omap2430, omap3, omap4.
Currently the device attribute holds information regarding dual volt MMC card
support by the controller which will be later passed to the host driver via
platform data.

Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Acked-by: Benoit Coussonb-cous...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |6 ++
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |6 ++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |8 
 arch/arm/plat-omap/include/plat/mmc.h  |9 +
 4 files changed, 29 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 cba1800..d144540 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -19,6 +19,7 @@
 #include plat/i2c.h
 #include plat/gpio.h
 #include plat/mcspi.h
+#include plat/mmc.h
 #include plat/l3_2xxx.h
 
 #include omap_hwmod_common_data.h
@@ -1585,6 +1586,10 @@ static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] 
= {
omap2430_l4_core__mmc1,
 };
 
+static struct omap_mmc_dev_attr mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
 static struct omap_hwmod omap2430_mmc1_hwmod = {
.name   = mmc1,
.flags  = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
@@ -1604,6 +1609,7 @@ static struct omap_hwmod omap2430_mmc1_hwmod = {
.idlest_idle_bit = OMAP2430_ST_MMCHS1_SHIFT,
},
},
+   .dev_attr   = mmc1_dev_attr,
.slaves = omap2430_mmc1_slaves,
.slaves_cnt = ARRAY_SIZE(omap2430_mmc1_slaves),
.class  = omap2430_mmc_class,
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 7726932..07065c3 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -22,6 +22,7 @@
 #include plat/l4_3xxx.h
 #include plat/i2c.h
 #include plat/gpio.h
+#include plat/mmc.h
 #include plat/smartreflex.h
 #include plat/mcspi.h
 
@@ -2309,6 +2310,10 @@ static struct omap_hwmod_ocp_if *omap3xxx_mmc1_slaves[] 
= {
omap3xxx_l4_core__mmc1,
 };
 
+static struct omap_mmc_dev_attr mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
 static struct omap_hwmod omap3xxx_mmc1_hwmod = {
.name   = mmc1,
.mpu_irqs   = omap34xx_mmc1_mpu_irqs,
@@ -2327,6 +2332,7 @@ static struct omap_hwmod omap3xxx_mmc1_hwmod = {
.idlest_idle_bit = OMAP3430_ST_MMC1_SHIFT,
},
},
+   .dev_attr   = mmc1_dev_attr,
.slaves = omap3xxx_mmc1_slaves,
.slaves_cnt = ARRAY_SIZE(omap3xxx_mmc1_slaves),
.class  = omap34xx_mmc_class,
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index dd39e75..0f7d02b 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -25,6 +25,7 @@
 #include plat/gpio.h
 #include plat/dma.h
 #include plat/mcspi.h
+#include plat/mmc.h
 
 #include omap_hwmod_common_data.h
 
@@ -3383,6 +3384,7 @@ static struct omap_hwmod_class omap44xx_mmc_hwmod_class = 
{
 };
 
 /* mmc1 */
+
 static struct omap_hwmod_irq_info omap44xx_mmc1_irqs[] = {
{ .irq = 83 + OMAP44XX_IRQ_GIC_START },
 };
@@ -3420,6 +3422,11 @@ static struct omap_hwmod_ocp_if *omap44xx_mmc1_slaves[] 
= {
omap44xx_l4_per__mmc1,
 };
 
+/* mmc1 dev_attr */
+static struct omap_mmc_dev_attr mmc1_dev_attr = {
+   .flags  = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
 static struct omap_hwmod omap44xx_mmc1_hwmod = {
.name   = mmc1,
.class  = omap44xx_mmc_hwmod_class,
@@ -3433,6 +3440,7 @@ static struct omap_hwmod omap44xx_mmc1_hwmod = {
.clkctrl_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL,
},
},
+   .dev_attr   = mmc1_dev_attr,
.slaves = omap44xx_mmc1_slaves,
.slaves_cnt = ARRAY_SIZE(omap44xx_mmc1_slaves),
.masters= omap44xx_mmc1_masters,
diff --git a/arch/arm/plat-omap/include/plat/mmc.h 
b/arch/arm/plat-omap/include/plat/mmc.h
index e5de5d4..a7afab0 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -43,6 +43,12 @@
 
 #define OMAP_MMC_MAX_SLOTS 2
 
+#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT  BIT(1)
+
+struct omap_mmc_dev_attr {
+   u8 flags;
+};
+
 struct omap_mmc_platform_data {
/* back-link to device */
struct device *dev;
@@ -71,6 +77,9 @@ struct omap_mmc_platform_data {
 
u64 dma_mask;
 
+   /* Integrating attributes from the omap_hwmod layer */
+   u8 controller_flags;
+
/* Register offset deviation */
u16 reg_offset;
 
-- 
1.7.1

--
To unsubscribe from

[PATCH v6 0/8] OMAP: HSMMC: hwmod adaptation

2011-02-28 Thread Kishore Kadiyala
Adding hwmod data for hsmmc device on OMAP2430/OMAP3/OMAP4.
Adapting the omap_hsmmc driver to hwmod framework.

Omap2420 platform consists of mmc block as in omap1 and not the hsmmc block
as present in omap2430, omap3, omap4 platforms. The series takes care of
spliting out the mmc device init for omap2420 and thus doing hwmod adaptation
for hsmmc drivers. 

Also includes moving of mux setting API for hsmmc devices from devices.c to 
hsmmc.c and renaming of device  driver name.

The patch series is based on omap-for-linus and tested on OMAP2430, OMAP3430SDP,
OMAP4430SDP  OMAP4Panda.Also boot tested on OMAP2420SDP.

For testing hsmmc with hwmod adaptaion on OMAP2430SDP,has dependency on:
http://www.spinics.net/lists/linux-omap/msg47088.html

V6:
---
In the previous versions, implementation for adaptation of hsmmc to 
hwmod framework was based on omap_hwmod_for_each_by_class and using
this will not support flexible resgistration of hsmmc devices.
The current implemetation uses omap_hwmod_lookup and supports flexible
registration of hsmmc devices based on the entry in board file.

V5:
---
http://www.spinics.net/lists/linux-omap/msg47046.html

V4:
---
http://www.spinics.net/lists/linux-mmc/msg06237.html

V3:
--
http://www.spinics.net/lists/linux-omap/msg46783.html

V2:
---
http://www.spinics.net/lists/linux-omap/msg45443.html

V1:
---
http://www.spinics.net/lists/linux-mmc/msg05689.html


Anand Gadiyar (2):
  omap: mmc: split out init for 2420
  OMAP4: hwmod data: enable HSMMC

Kishore Kadiyala (4):
  OMAP: hwmod data: Add dev_attr and use in the host driver
  OMAP: hsmmc: Move mux configuration to hsmmc.c
  OMAP: adapt hsmmc to hwmod framework
  OMAP: hsmmc: Rename the device and driver

Paul Walmsley (2):
  OMAP2430: hwmod data: Add HSMMC
  OMAP3: hwmod data: Add HSMMC

 arch/arm/mach-omap2/board-2430sdp.c  |2 +-
 arch/arm/mach-omap2/board-3430sdp.c  |6 +-
 arch/arm/mach-omap2/board-4430sdp.c  |   14 +-
 arch/arm/mach-omap2/board-devkit8000.c   |2 +-
 arch/arm/mach-omap2/board-igep0020.c |6 +-
 arch/arm/mach-omap2/board-igep0030.c |6 +-
 arch/arm/mach-omap2/board-n8x0.c |2 +-
 arch/arm/mach-omap2/board-omap3evm.c |2 +-
 arch/arm/mach-omap2/board-omap3pandora.c |6 +-
 arch/arm/mach-omap2/board-omap4panda.c   |4 +-
 arch/arm/mach-omap2/board-rm680.c|2 +-
 arch/arm/mach-omap2/board-rx51-peripherals.c |8 +-
 arch/arm/mach-omap2/board-zoom-peripherals.c |2 +-
 arch/arm/mach-omap2/clock2430_data.c |   12 +-
 arch/arm/mach-omap2/clock3xxx_data.c |   12 +-
 arch/arm/mach-omap2/clock44xx_data.c |   20 +-
 arch/arm/mach-omap2/devices.c|  293 ++
 arch/arm/mach-omap2/hsmmc.c  |  424 +-
 arch/arm/mach-omap2/omap_hwmod_2430_data.c   |  154 ++
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c   |  215 +
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c   |   18 +-
 arch/arm/mach-omap2/prcm-common.h|4 +
 arch/arm/plat-omap/include/plat/mmc.h|   29 +-
 drivers/mmc/host/omap_hsmmc.c|6 +-
 24 files changed, 765 insertions(+), 484 deletions(-)

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


[PATCH v6 7/8] OMAP: adapt hsmmc to hwmod framework

2011-02-28 Thread Kishore Kadiyala
OMAP2420 platform consists of mmc block as in omap1 and not the
hsmmc block as present in omap2430, omap3, omap4 platforms.
Removing all base address macro defines except keeping one for OMAP2420 and
adapting only hsmmc device registration and driver to hwmod framework.

Changes involves:
1) Remove controller reset in devices.c which is taken care of
   by hwmod framework.
2) Using omap-device layer to register device and utilizing data from
   hwmod data file for base address, dma channel number, Irq_number,
   device attribute.
3) Update the driver to use dev_attr to find whether controller
   supports dual volt cards

Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Reviewed-by: Balaji T K balaj...@ti.com
Cc: Benoit Cousson b-cous...@ti.com
CC: Kevin Hilman khil...@deeprootsystems.com
Cc: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/devices.c |  168 
 arch/arm/mach-omap2/hsmmc.c   |  346 +++--
 arch/arm/plat-omap/include/plat/mmc.h |   20 +--
 drivers/mmc/host/omap_hsmmc.c |4 +-
 4 files changed, 200 insertions(+), 338 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 2f4a598..31632ac 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -544,112 +544,6 @@ static inline void omap_init_aes(void) { }
 
 /*-*/
 
-#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
-
-#define MMCHS_SYSCONFIG0x0010
-#define MMCHS_SYSCONFIG_SWRESET(1  1)
-#define MMCHS_SYSSTATUS0x0014
-#define MMCHS_SYSSTATUS_RESETDONE  (1  0)
-
-static struct platform_device dummy_pdev = {
-   .dev = {
-   .bus = platform_bus_type,
-   },
-};
-
-/**
- * omap_hsmmc_reset() - Full reset of each HS-MMC controller
- *
- * Ensure that each MMC controller is fully reset.  Controllers
- * left in an unknown state (by bootloader) may prevent retention
- * or OFF-mode.  This is especially important in cases where the
- * MMC driver is not enabled, _or_ built as a module.
- *
- * In order for reset to work, interface, functional and debounce
- * clocks must be enabled.  The debounce clock comes from func_32k_clk
- * and is not under SW control, so we only enable i- and f-clocks.
- **/
-static void __init omap_hsmmc_reset(void)
-{
-   u32 i, nr_controllers;
-   struct clk *iclk, *fclk;
-
-   if (cpu_is_omap242x())
-   return;
-
-   nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC :
-   (cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC);
-
-   for (i = 0; i  nr_controllers; i++) {
-   u32 v, base = 0;
-   struct device *dev = dummy_pdev.dev;
-
-   switch (i) {
-   case 0:
-   base = OMAP2_MMC1_BASE;
-   break;
-   case 1:
-   base = OMAP2_MMC2_BASE;
-   break;
-   case 2:
-   base = OMAP3_MMC3_BASE;
-   break;
-   case 3:
-   if (!cpu_is_omap44xx())
-   return;
-   base = OMAP4_MMC4_BASE;
-   break;
-   case 4:
-   if (!cpu_is_omap44xx())
-   return;
-   base = OMAP4_MMC5_BASE;
-   break;
-   }
-
-   if (cpu_is_omap44xx())
-   base += OMAP4_MMC_REG_OFFSET;
-
-   dummy_pdev.id = i;
-   dev_set_name(dummy_pdev.dev, mmci-omap-hs.%d, i);
-   iclk = clk_get(dev, ick);
-   if (IS_ERR(iclk))
-   goto err1;
-   if (clk_enable(iclk))
-   goto err2;
-
-   fclk = clk_get(dev, fck);
-   if (IS_ERR(fclk))
-   goto err3;
-   if (clk_enable(fclk))
-   goto err4;
-
-   omap_writel(MMCHS_SYSCONFIG_SWRESET, base + MMCHS_SYSCONFIG);
-   v = omap_readl(base + MMCHS_SYSSTATUS);
-   while (!(omap_readl(base + MMCHS_SYSSTATUS) 
-MMCHS_SYSSTATUS_RESETDONE))
-   cpu_relax();
-
-   clk_disable(fclk);
-   clk_put(fclk);
-   clk_disable(iclk);
-   clk_put(iclk);
-   }
-   return;
-
-err4:
-   clk_put(fclk);
-err3:
-   clk_disable(iclk);
-err2:
-   clk_put(iclk);
-err1:
-   printk(KERN_WARNING %s: Unable to enable clocks for MMC%d, 
-   cannot reset.\n,  __func__, i);
-}
-#else
-static inline void omap_hsmmc_reset(void) {}
-#endif
-
 #if defined(CONFIG_MMC_OMAP) || defined

[PATCH v6 3/8] OMAP3: hwmod data: Add HSMMC

2011-02-28 Thread Kishore Kadiyala
From: Paul Walmsley p...@pwsan.com

Update the omap3 hwmod data with the HSMMC info.

Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Rajendra Nayak rna...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Benoit Cousson b-cous...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  209 
 arch/arm/mach-omap2/prcm-common.h  |4 +
 2 files changed, 213 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 e9d0012..7726932 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -68,6 +68,9 @@ static struct omap_hwmod omap34xx_mcspi1;
 static struct omap_hwmod omap34xx_mcspi2;
 static struct omap_hwmod omap34xx_mcspi3;
 static struct omap_hwmod omap34xx_mcspi4;
+static struct omap_hwmod omap3xxx_mmc1_hwmod;
+static struct omap_hwmod omap3xxx_mmc2_hwmod;
+static struct omap_hwmod omap3xxx_mmc3_hwmod;
 static struct omap_hwmod am35xx_usbhsotg_hwmod;
 
 static struct omap_hwmod omap3xxx_dma_system_hwmod;
@@ -158,6 +161,63 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup 
= {
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* L4 CORE - MMC1 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc1_addr_space[] = {
+   {
+   .pa_start   = 0x4809c000,
+   .pa_end = 0x4809c1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc1 = {
+   .master = omap3xxx_l4_core_hwmod,
+   .slave  = omap3xxx_mmc1_hwmod,
+   .clk= mmchs1_ick,
+   .addr   = omap3xxx_mmc1_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mmc1_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+   .flags  = OMAP_FIREWALL_L4
+};
+
+/* L4 CORE - MMC2 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc2_addr_space[] = {
+   {
+   .pa_start   = 0x480b4000,
+   .pa_end = 0x480b41ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc2 = {
+   .master = omap3xxx_l4_core_hwmod,
+   .slave  = omap3xxx_mmc2_hwmod,
+   .clk= mmchs2_ick,
+   .addr   = omap3xxx_mmc2_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mmc2_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+   .flags  = OMAP_FIREWALL_L4
+};
+
+/* L4 CORE - MMC3 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc3_addr_space[] = {
+   {
+   .pa_start   = 0x480ad000,
+   .pa_end = 0x480ad1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc3 = {
+   .master = omap3xxx_l4_core_hwmod,
+   .slave  = omap3xxx_mmc3_hwmod,
+   .clk= mmchs3_ick,
+   .addr   = omap3xxx_mmc3_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mmc3_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+   .flags  = OMAP_FIREWALL_L4
+};
+
 /* L4 CORE - UART1 interface */
 static struct omap_hwmod_addr_space omap3xxx_uart1_addr_space[] = {
{
@@ -2212,11 +2272,160 @@ static struct omap_hwmod am35xx_usbhsotg_hwmod = {
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES3_1)
 };
 
+/* MMC/SD/SDIO common */
+
+static struct omap_hwmod_class_sysconfig omap34xx_mmc_sysc = {
+   .rev_offs   = 0x1fc,
+   .sysc_offs  = 0x10,
+   .syss_offs  = 0x14,
+   .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+  SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap34xx_mmc_class = {
+   .name = mmc,
+   .sysc = omap34xx_mmc_sysc,
+};
+
+/* MMC/SD/SDIO1 */
+
+static struct omap_hwmod_irq_info omap34xx_mmc1_mpu_irqs[] = {
+   { .irq = 83, },
+};
+
+static struct omap_hwmod_dma_info omap34xx_mmc1_sdma_reqs[] = {
+   { .name = tx, .dma_req = 61, },
+   { .name = rx, .dma_req = 62, },
+};
+
+static struct omap_hwmod_opt_clk omap34xx_mmc1_opt_clks[] = {
+   { .role = dbck, .clk = omap_32k_fck, },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_mmc1_slaves[] = {
+   omap3xxx_l4_core__mmc1,
+};
+
+static struct omap_hwmod omap3xxx_mmc1_hwmod = {
+   .name   = mmc1,
+   .mpu_irqs   = omap34xx_mmc1_mpu_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(omap34xx_mmc1_mpu_irqs),
+   .sdma_reqs  = omap34xx_mmc1_sdma_reqs

[PATCH v6 6/8] OMAP: hsmmc: Move mux configuration to hsmmc.c

2011-02-28 Thread Kishore Kadiyala
Moving the definition of mux setting API from devices.c to hsmmc.c
and renaming it from omap2_mmc_mux to omap_hsmmc_mux.
Also calling omap_hsmmc_mux from omap2_hsmmc_init.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Chris Ball c...@laptop.org
Cc: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/devices.c |   83 
 arch/arm/mach-omap2/hsmmc.c   |   84 +
 2 files changed, 84 insertions(+), 83 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 100bb42..2f4a598 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -708,87 +708,6 @@ void __init omap242x_init_mmc(struct 
omap_mmc_platform_data **mmc_data)
 
 #if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
 
-static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
-   int controller_nr)
-{
-   if ((mmc_controller-slots[0].switch_pin  0)  \
-   (mmc_controller-slots[0].switch_pin  OMAP_MAX_GPIO_LINES))
-   omap_mux_init_gpio(mmc_controller-slots[0].switch_pin,
-   OMAP_PIN_INPUT_PULLUP);
-   if ((mmc_controller-slots[0].gpio_wp  0)  \
-   (mmc_controller-slots[0].gpio_wp  OMAP_MAX_GPIO_LINES))
-   omap_mux_init_gpio(mmc_controller-slots[0].gpio_wp,
-   OMAP_PIN_INPUT_PULLUP);
-   if (cpu_is_omap34xx()) {
-   if (controller_nr == 0) {
-   omap_mux_init_signal(sdmmc1_clk,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc1_cmd,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc1_dat0,
-   OMAP_PIN_INPUT_PULLUP);
-   if (mmc_controller-slots[0].caps 
-   (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
-   omap_mux_init_signal(sdmmc1_dat1,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc1_dat2,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc1_dat3,
-   OMAP_PIN_INPUT_PULLUP);
-   }
-   if (mmc_controller-slots[0].caps 
-   MMC_CAP_8_BIT_DATA) {
-   omap_mux_init_signal(sdmmc1_dat4,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc1_dat5,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc1_dat6,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc1_dat7,
-   OMAP_PIN_INPUT_PULLUP);
-   }
-   }
-   if (controller_nr == 1) {
-   /* MMC2 */
-   omap_mux_init_signal(sdmmc2_clk,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc2_cmd,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc2_dat0,
-   OMAP_PIN_INPUT_PULLUP);
-
-   /*
-* For 8 wire configurations, Lines DAT4, 5, 6 and 7 
need to be muxed
-* in the board-*.c files
-*/
-   if (mmc_controller-slots[0].caps 
-   (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
-   omap_mux_init_signal(sdmmc2_dat1,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc2_dat2,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc2_dat3,
-   OMAP_PIN_INPUT_PULLUP);
-   }
-   if (mmc_controller-slots[0].caps 
-   MMC_CAP_8_BIT_DATA) {
-   omap_mux_init_signal(sdmmc2_dat4.sdmmc2_dat4,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc2_dat5.sdmmc2_dat5,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc2_dat6.sdmmc2_dat6,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc2_dat7.sdmmc2_dat7

[PATCH v6 2/8] OMAP2430: hwmod data: Add HSMMC

2011-02-28 Thread Kishore Kadiyala
From: Paul Walmsley p...@pwsan.com

Update the omap2430 hwmod data with the HSMMC info.

Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Rajendra Nayak rna...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Benoit Cousson b-cous...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |  148 
 1 files changed, 148 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 de0015d..cba1800 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -54,6 +54,8 @@ static struct omap_hwmod omap2430_dma_system_hwmod;
 static struct omap_hwmod omap2430_mcspi1_hwmod;
 static struct omap_hwmod omap2430_mcspi2_hwmod;
 static struct omap_hwmod omap2430_mcspi3_hwmod;
+static struct omap_hwmod omap2430_mmc1_hwmod;
+static struct omap_hwmod omap2430_mmc2_hwmod;
 
 /* L3 - L4_CORE interface */
 static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = {
@@ -250,6 +252,42 @@ static struct omap_hwmod_ocp_if 
*omap2430_usbhsotg_slaves[] = {
omap2430_l4_core__usbhsotg,
 };
 
+/* L4 CORE - MMC1 interface */
+static struct omap_hwmod_addr_space omap2430_mmc1_addr_space[] = {
+   {
+   .pa_start   = 0x4809c000,
+   .pa_end = 0x4809c1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__mmc1 = {
+   .master = omap2430_l4_core_hwmod,
+   .slave  = omap2430_mmc1_hwmod,
+   .clk= mmchs1_ick,
+   .addr   = omap2430_mmc1_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap2430_mmc1_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 CORE - MMC2 interface */
+static struct omap_hwmod_addr_space omap2430_mmc2_addr_space[] = {
+   {
+   .pa_start   = 0x480b4000,
+   .pa_end = 0x480b41ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = {
+   .master = omap2430_l4_core_hwmod,
+   .slave  = omap2430_mmc2_hwmod,
+   .addr   = omap2430_mmc2_addr_space,
+   .clk= mmchs2_ick,
+   .addr_cnt   = ARRAY_SIZE(omap2430_mmc2_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_main__l4_core,
@@ -258,6 +296,8 @@ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] 
= {
 /* Master interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap2430_l4_core_masters[] = {
omap2430_l4_core__l4_wkup,
+   omap2430_l4_core__mmc1,
+   omap2430_l4_core__mmc2,
 };
 
 /* L4 CORE */
@@ -1508,6 +1548,112 @@ static struct omap_hwmod omap2430_usbhsotg_hwmod = {
 
 
 
+/* MMC/SD/SDIO common */
+
+static struct omap_hwmod_class_sysconfig omap2430_mmc_sysc = {
+   .rev_offs   = 0x1fc,
+   .sysc_offs  = 0x10,
+   .syss_offs  = 0x14,
+   .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+  SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap2430_mmc_class = {
+   .name = mmc,
+   .sysc = omap2430_mmc_sysc,
+};
+
+/* MMC/SD/SDIO1 */
+
+static struct omap_hwmod_irq_info omap2430_mmc1_mpu_irqs[] = {
+   { .irq = 83 },
+};
+
+static struct omap_hwmod_dma_info omap2430_mmc1_sdma_reqs[] = {
+   { .name = tx, .dma_req = 61 }, /* DMA_MMC1_TX */
+   { .name = rx, .dma_req = 62 }, /* DMA_MMC1_RX */
+};
+
+static struct omap_hwmod_opt_clk omap2430_mmc1_opt_clks[] = {
+   { .role = dbck, .clk = mmchsdb1_fck },
+};
+
+static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] = {
+   omap2430_l4_core__mmc1,
+};
+
+static struct omap_hwmod omap2430_mmc1_hwmod = {
+   .name   = mmc1,
+   .flags  = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
+   .mpu_irqs   = omap2430_mmc1_mpu_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(omap2430_mmc1_mpu_irqs),
+   .sdma_reqs  = omap2430_mmc1_sdma_reqs,
+   .sdma_reqs_cnt  = ARRAY_SIZE(omap2430_mmc1_sdma_reqs),
+   .opt_clks   = omap2430_mmc1_opt_clks,
+   .opt_clks_cnt   = ARRAY_SIZE(omap2430_mmc1_opt_clks),
+   .main_clk   = mmchs1_fck,
+   .prcm   = {
+   .omap2 = {
+   .module_offs = CORE_MOD,
+   .prcm_reg_id = 2,
+   .module_bit  = OMAP2430_EN_MMCHS1_SHIFT,
+   .idlest_reg_id = 2

[PATCH v6 4/8] OMAP4: hwmod data: enable HSMMC

2011-02-28 Thread Kishore Kadiyala
From: Anand Gadiyar gadi...@ti.com

Enabling hsmmc hwmod for OMAP4

Signed-off-by: Anand Gadiyar gadi...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Acked-by: Benoit Coussonb-cous...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 79a8601..dd39e75 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -5077,11 +5077,11 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] 
= {
omap44xx_mcspi4_hwmod,
 
/* mmc class */
-/* omap44xx_mmc1_hwmod, */
-/* omap44xx_mmc2_hwmod, */
-/* omap44xx_mmc3_hwmod, */
-/* omap44xx_mmc4_hwmod, */
-/* omap44xx_mmc5_hwmod, */
+   omap44xx_mmc1_hwmod,
+   omap44xx_mmc2_hwmod,
+   omap44xx_mmc3_hwmod,
+   omap44xx_mmc4_hwmod,
+   omap44xx_mmc5_hwmod,
 
/* mpu class */
omap44xx_mpu_hwmod,
-- 
1.7.1

--
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


[RESEND v5 PATCH 5/8] OMAP: hwmod data: Add dev_attr and use in the host driver

2011-02-26 Thread Kishore Kadiyala
Add a device attribute to hwmod data of omap2430, omap3, omap4.
Currently the device attribute holds information regarding dual volt MMC card
support by the controller which will be later passed to the host driver via
platform data.

Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Acked-by: Benoit Coussonb-cous...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |6 ++
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |6 ++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |8 
 arch/arm/plat-omap/include/plat/mmc.h  |9 +
 4 files changed, 29 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 cba1800..d144540 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -19,6 +19,7 @@
 #include plat/i2c.h
 #include plat/gpio.h
 #include plat/mcspi.h
+#include plat/mmc.h
 #include plat/l3_2xxx.h
 
 #include omap_hwmod_common_data.h
@@ -1585,6 +1586,10 @@ static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] 
= {
omap2430_l4_core__mmc1,
 };
 
+static struct omap_mmc_dev_attr mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
 static struct omap_hwmod omap2430_mmc1_hwmod = {
.name   = mmc1,
.flags  = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
@@ -1604,6 +1609,7 @@ static struct omap_hwmod omap2430_mmc1_hwmod = {
.idlest_idle_bit = OMAP2430_ST_MMCHS1_SHIFT,
},
},
+   .dev_attr   = mmc1_dev_attr,
.slaves = omap2430_mmc1_slaves,
.slaves_cnt = ARRAY_SIZE(omap2430_mmc1_slaves),
.class  = omap2430_mmc_class,
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 7726932..07065c3 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -22,6 +22,7 @@
 #include plat/l4_3xxx.h
 #include plat/i2c.h
 #include plat/gpio.h
+#include plat/mmc.h
 #include plat/smartreflex.h
 #include plat/mcspi.h
 
@@ -2309,6 +2310,10 @@ static struct omap_hwmod_ocp_if *omap3xxx_mmc1_slaves[] 
= {
omap3xxx_l4_core__mmc1,
 };
 
+static struct omap_mmc_dev_attr mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
 static struct omap_hwmod omap3xxx_mmc1_hwmod = {
.name   = mmc1,
.mpu_irqs   = omap34xx_mmc1_mpu_irqs,
@@ -2327,6 +2332,7 @@ static struct omap_hwmod omap3xxx_mmc1_hwmod = {
.idlest_idle_bit = OMAP3430_ST_MMC1_SHIFT,
},
},
+   .dev_attr   = mmc1_dev_attr,
.slaves = omap3xxx_mmc1_slaves,
.slaves_cnt = ARRAY_SIZE(omap3xxx_mmc1_slaves),
.class  = omap34xx_mmc_class,
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index dd39e75..0f7d02b 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -25,6 +25,7 @@
 #include plat/gpio.h
 #include plat/dma.h
 #include plat/mcspi.h
+#include plat/mmc.h
 
 #include omap_hwmod_common_data.h
 
@@ -3383,6 +3384,7 @@ static struct omap_hwmod_class omap44xx_mmc_hwmod_class = 
{
 };
 
 /* mmc1 */
+
 static struct omap_hwmod_irq_info omap44xx_mmc1_irqs[] = {
{ .irq = 83 + OMAP44XX_IRQ_GIC_START },
 };
@@ -3420,6 +3422,11 @@ static struct omap_hwmod_ocp_if *omap44xx_mmc1_slaves[] 
= {
omap44xx_l4_per__mmc1,
 };
 
+/* mmc1 dev_attr */
+static struct omap_mmc_dev_attr mmc1_dev_attr = {
+   .flags  = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
 static struct omap_hwmod omap44xx_mmc1_hwmod = {
.name   = mmc1,
.class  = omap44xx_mmc_hwmod_class,
@@ -3433,6 +3440,7 @@ static struct omap_hwmod omap44xx_mmc1_hwmod = {
.clkctrl_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL,
},
},
+   .dev_attr   = mmc1_dev_attr,
.slaves = omap44xx_mmc1_slaves,
.slaves_cnt = ARRAY_SIZE(omap44xx_mmc1_slaves),
.masters= omap44xx_mmc1_masters,
diff --git a/arch/arm/plat-omap/include/plat/mmc.h 
b/arch/arm/plat-omap/include/plat/mmc.h
index e5de5d4..a7afab0 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -43,6 +43,12 @@
 
 #define OMAP_MMC_MAX_SLOTS 2
 
+#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT  BIT(1)
+
+struct omap_mmc_dev_attr {
+   u8 flags;
+};
+
 struct omap_mmc_platform_data {
/* back-link to device */
struct device *dev;
@@ -71,6 +77,9 @@ struct omap_mmc_platform_data {
 
u64 dma_mask;
 
+   /* Integrating attributes from the omap_hwmod layer */
+   u8 controller_flags;
+
/* Register offset deviation */
u16 reg_offset;
 
-- 
1.7.1

--
To unsubscribe from

[RESEND v5 PATCH 2/8] OMAP2430: hwmod data: Add HSMMC

2011-02-26 Thread Kishore Kadiyala
From: Paul Walmsley p...@pwsan.com

Update the omap2430 hwmod data with the HSMMC info.

For testing OMAP2430SDP with hsmmc hwmod adaptation
has dependency on
 1) Pauls clock domain fix patch for hsmmc2
http://www.spinics.net/lists/linux-omap/msg47088.html
 2) Balaji's regulator patch
https://patchwork.kernel.org/patch/538301/   

Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Rajendra Nayak rna...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Benoit Cousson b-cous...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |  148 
 1 files changed, 148 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 de0015d..cba1800 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -54,6 +54,8 @@ static struct omap_hwmod omap2430_dma_system_hwmod;
 static struct omap_hwmod omap2430_mcspi1_hwmod;
 static struct omap_hwmod omap2430_mcspi2_hwmod;
 static struct omap_hwmod omap2430_mcspi3_hwmod;
+static struct omap_hwmod omap2430_mmc1_hwmod;
+static struct omap_hwmod omap2430_mmc2_hwmod;
 
 /* L3 - L4_CORE interface */
 static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = {
@@ -250,6 +252,42 @@ static struct omap_hwmod_ocp_if 
*omap2430_usbhsotg_slaves[] = {
omap2430_l4_core__usbhsotg,
 };
 
+/* L4 CORE - MMC1 interface */
+static struct omap_hwmod_addr_space omap2430_mmc1_addr_space[] = {
+   {
+   .pa_start   = 0x4809c000,
+   .pa_end = 0x4809c1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__mmc1 = {
+   .master = omap2430_l4_core_hwmod,
+   .slave  = omap2430_mmc1_hwmod,
+   .clk= mmchs1_ick,
+   .addr   = omap2430_mmc1_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap2430_mmc1_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 CORE - MMC2 interface */
+static struct omap_hwmod_addr_space omap2430_mmc2_addr_space[] = {
+   {
+   .pa_start   = 0x480b4000,
+   .pa_end = 0x480b41ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = {
+   .master = omap2430_l4_core_hwmod,
+   .slave  = omap2430_mmc2_hwmod,
+   .addr   = omap2430_mmc2_addr_space,
+   .clk= mmchs2_ick,
+   .addr_cnt   = ARRAY_SIZE(omap2430_mmc2_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_main__l4_core,
@@ -258,6 +296,8 @@ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] 
= {
 /* Master interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap2430_l4_core_masters[] = {
omap2430_l4_core__l4_wkup,
+   omap2430_l4_core__mmc1,
+   omap2430_l4_core__mmc2,
 };
 
 /* L4 CORE */
@@ -1508,6 +1548,112 @@ static struct omap_hwmod omap2430_usbhsotg_hwmod = {
 
 
 
+/* MMC/SD/SDIO common */
+
+static struct omap_hwmod_class_sysconfig omap2430_mmc_sysc = {
+   .rev_offs   = 0x1fc,
+   .sysc_offs  = 0x10,
+   .syss_offs  = 0x14,
+   .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+  SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap2430_mmc_class = {
+   .name = mmc,
+   .sysc = omap2430_mmc_sysc,
+};
+
+/* MMC/SD/SDIO1 */
+
+static struct omap_hwmod_irq_info omap2430_mmc1_mpu_irqs[] = {
+   { .irq = 83 },
+};
+
+static struct omap_hwmod_dma_info omap2430_mmc1_sdma_reqs[] = {
+   { .name = tx, .dma_req = 61 }, /* DMA_MMC1_TX */
+   { .name = rx, .dma_req = 62 }, /* DMA_MMC1_RX */
+};
+
+static struct omap_hwmod_opt_clk omap2430_mmc1_opt_clks[] = {
+   { .role = dbck, .clk = mmchsdb1_fck },
+};
+
+static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] = {
+   omap2430_l4_core__mmc1,
+};
+
+static struct omap_hwmod omap2430_mmc1_hwmod = {
+   .name   = mmc1,
+   .flags  = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
+   .mpu_irqs   = omap2430_mmc1_mpu_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(omap2430_mmc1_mpu_irqs),
+   .sdma_reqs  = omap2430_mmc1_sdma_reqs,
+   .sdma_reqs_cnt  = ARRAY_SIZE(omap2430_mmc1_sdma_reqs),
+   .opt_clks   = omap2430_mmc1_opt_clks,
+   .opt_clks_cnt   = ARRAY_SIZE(omap2430_mmc1_opt_clks),
+   .main_clk   = mmchs1_fck

[PATCH v5 0/8] OMAP: HSMMC: hwmod adaptation

2011-02-25 Thread Kishore Kadiyala
Adding hwmod data for hsmmc device on OMAP2430/OMAP3/OMAP4.
Adapting the omap_hsmmc driver to hwmod framework.

Omap2420 platform consists of mmc block as in omap1 and not the
hsmmc block as present in omap2430, omap3, omap4 platforms. 
The series takes care spliting out the mmc device init for omap2420
and takes care of hwmod adaptation for hsmmc drivers. 
This was already posted at :
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg45190.html

Also includes renaming of device  driver name.

The patch series is based on omap-for-linus and tested on 
OMAP2430, OMAP3430SDP  OMAP4430SDP.
Also boot tested on OMAP2420SDP.

V4:
---
http://www.spinics.net/lists/linux-mmc/msg06237.html

V3:
--
http://www.spinics.net/lists/linux-omap/msg46783.html

V2:
---
http://www.spinics.net/lists/linux-omap/msg45443.html

V1:
---
http://www.spinics.net/lists/linux-mmc/msg05689.html

Anand Gadiyar (2):
  omap: mmc: split out init for 2420
  OMAP4: hwmod data: enable HSMMC

Kishore Kadiyala (4):
  OMAP: hwmod data: Add dev_attr and use in the host driver
  OMAP: hsmmc: Move mux configuration to hsmmc.c
  OMAP: adapt hsmmc to hwmod framework
  OMAP: hsmmc: Rename the device and driver

Paul Walmsley (2):
  OMAP2430: hwmod data: Add HSMMC
  OMAP3: hwmod data: Add HSMMC

 arch/arm/mach-omap2/board-2430sdp.c  |2 +-
 arch/arm/mach-omap2/board-3430sdp.c  |6 +-
 arch/arm/mach-omap2/board-4430sdp.c  |4 +-
 arch/arm/mach-omap2/board-devkit8000.c   |2 +-
 arch/arm/mach-omap2/board-igep0020.c |6 +-
 arch/arm/mach-omap2/board-igep0030.c |6 +-
 arch/arm/mach-omap2/board-n8x0.c |2 +-
 arch/arm/mach-omap2/board-omap3evm.c |2 +-
 arch/arm/mach-omap2/board-omap3pandora.c |6 +-
 arch/arm/mach-omap2/board-omap4panda.c   |4 +-
 arch/arm/mach-omap2/board-rm680.c|2 +-
 arch/arm/mach-omap2/board-rx51-peripherals.c |8 +-
 arch/arm/mach-omap2/board-zoom-peripherals.c |2 +-
 arch/arm/mach-omap2/clock2430_data.c |   12 +-
 arch/arm/mach-omap2/clock3xxx_data.c |   12 +-
 arch/arm/mach-omap2/clock44xx_data.c |   20 +-
 arch/arm/mach-omap2/devices.c|  293 ++
 arch/arm/mach-omap2/hsmmc.c  |  419 +-
 arch/arm/mach-omap2/omap_hwmod_2430_data.c   |  152 ++
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c   |  215 +
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c   |   18 +-
 arch/arm/mach-omap2/prcm-common.h|4 +
 arch/arm/plat-omap/include/plat/mmc.h|   29 +-
 drivers/mmc/host/omap_hsmmc.c|6 +-
 24 files changed, 753 insertions(+), 479 deletions(-)

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


[PATCH v5 6/8] OMAP: hsmmc: Move mux configuration to hsmmc.c

2011-02-25 Thread Kishore Kadiyala
Moving the definition of mux setting API from devices.c to hsmmc.c
and renaming it from omap2_mmc_mux to omap_hsmmc_mux.
Also calling omap_hsmmc_mux from omap2_hsmmc_init.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Chris Ball c...@laptop.org
Cc: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/devices.c |   83 
 arch/arm/mach-omap2/hsmmc.c   |   84 +
 2 files changed, 84 insertions(+), 83 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 100bb42..2f4a598 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -708,87 +708,6 @@ void __init omap242x_init_mmc(struct 
omap_mmc_platform_data **mmc_data)
 
 #if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
 
-static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
-   int controller_nr)
-{
-   if ((mmc_controller-slots[0].switch_pin  0)  \
-   (mmc_controller-slots[0].switch_pin  OMAP_MAX_GPIO_LINES))
-   omap_mux_init_gpio(mmc_controller-slots[0].switch_pin,
-   OMAP_PIN_INPUT_PULLUP);
-   if ((mmc_controller-slots[0].gpio_wp  0)  \
-   (mmc_controller-slots[0].gpio_wp  OMAP_MAX_GPIO_LINES))
-   omap_mux_init_gpio(mmc_controller-slots[0].gpio_wp,
-   OMAP_PIN_INPUT_PULLUP);
-   if (cpu_is_omap34xx()) {
-   if (controller_nr == 0) {
-   omap_mux_init_signal(sdmmc1_clk,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc1_cmd,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc1_dat0,
-   OMAP_PIN_INPUT_PULLUP);
-   if (mmc_controller-slots[0].caps 
-   (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
-   omap_mux_init_signal(sdmmc1_dat1,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc1_dat2,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc1_dat3,
-   OMAP_PIN_INPUT_PULLUP);
-   }
-   if (mmc_controller-slots[0].caps 
-   MMC_CAP_8_BIT_DATA) {
-   omap_mux_init_signal(sdmmc1_dat4,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc1_dat5,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc1_dat6,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc1_dat7,
-   OMAP_PIN_INPUT_PULLUP);
-   }
-   }
-   if (controller_nr == 1) {
-   /* MMC2 */
-   omap_mux_init_signal(sdmmc2_clk,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc2_cmd,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc2_dat0,
-   OMAP_PIN_INPUT_PULLUP);
-
-   /*
-* For 8 wire configurations, Lines DAT4, 5, 6 and 7 
need to be muxed
-* in the board-*.c files
-*/
-   if (mmc_controller-slots[0].caps 
-   (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
-   omap_mux_init_signal(sdmmc2_dat1,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc2_dat2,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc2_dat3,
-   OMAP_PIN_INPUT_PULLUP);
-   }
-   if (mmc_controller-slots[0].caps 
-   MMC_CAP_8_BIT_DATA) {
-   omap_mux_init_signal(sdmmc2_dat4.sdmmc2_dat4,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc2_dat5.sdmmc2_dat5,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc2_dat6.sdmmc2_dat6,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc2_dat7.sdmmc2_dat7

[PATCH v5 4/8] OMAP4: hwmod data: enable HSMMC

2011-02-25 Thread Kishore Kadiyala
From: Anand Gadiyar gadi...@ti.com

Enabling hsmmc hwmod for OMAP4

Signed-off-by: Anand Gadiyar gadi...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Acked-by: Benoit Coussonb-cous...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 79a8601..dd39e75 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -5077,11 +5077,11 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] 
= {
omap44xx_mcspi4_hwmod,
 
/* mmc class */
-/* omap44xx_mmc1_hwmod, */
-/* omap44xx_mmc2_hwmod, */
-/* omap44xx_mmc3_hwmod, */
-/* omap44xx_mmc4_hwmod, */
-/* omap44xx_mmc5_hwmod, */
+   omap44xx_mmc1_hwmod,
+   omap44xx_mmc2_hwmod,
+   omap44xx_mmc3_hwmod,
+   omap44xx_mmc4_hwmod,
+   omap44xx_mmc5_hwmod,
 
/* mpu class */
omap44xx_mpu_hwmod,
-- 
1.7.1

--
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 5/8] OMAP: hwmod data: Add dev_attr and use in the host driver

2011-02-25 Thread Kishore Kadiyala
Add a device attribute to hwmod data of omap2430, omap3, omap4.
Currently the device attribute holds information regarding dual volt MMC card
support by the controller which will be later passed to the host driver via
platform data.

Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Acked-by: Benoit Coussonb-cous...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |6 ++
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |6 ++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |8 
 arch/arm/plat-omap/include/plat/mmc.h  |9 +
 4 files changed, 29 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 a1c3c5e..37610a2 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -19,6 +19,7 @@
 #include plat/i2c.h
 #include plat/gpio.h
 #include plat/mcspi.h
+#include plat/mmc.h
 #include plat/l3_2xxx.h
 
 #include omap_hwmod_common_data.h
@@ -1585,6 +1586,10 @@ static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] 
= {
omap2430_l4_core__mmc1,
 };
 
+static struct omap_mmc_dev_attr mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
 static struct omap_hwmod omap2430_mmc1_hwmod = {
.name   = mmc1,
.mpu_irqs   = omap2430_mmc1_mpu_irqs,
@@ -1603,6 +1608,7 @@ static struct omap_hwmod omap2430_mmc1_hwmod = {
.idlest_idle_bit = OMAP2430_ST_MMCHS1_SHIFT,
},
},
+   .dev_attr   = mmc1_dev_attr,
.slaves = omap2430_mmc1_slaves,
.slaves_cnt = ARRAY_SIZE(omap2430_mmc1_slaves),
.class  = omap2430_mmc_class,
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 7726932..07065c3 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -22,6 +22,7 @@
 #include plat/l4_3xxx.h
 #include plat/i2c.h
 #include plat/gpio.h
+#include plat/mmc.h
 #include plat/smartreflex.h
 #include plat/mcspi.h
 
@@ -2309,6 +2310,10 @@ static struct omap_hwmod_ocp_if *omap3xxx_mmc1_slaves[] 
= {
omap3xxx_l4_core__mmc1,
 };
 
+static struct omap_mmc_dev_attr mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
 static struct omap_hwmod omap3xxx_mmc1_hwmod = {
.name   = mmc1,
.mpu_irqs   = omap34xx_mmc1_mpu_irqs,
@@ -2327,6 +2332,7 @@ static struct omap_hwmod omap3xxx_mmc1_hwmod = {
.idlest_idle_bit = OMAP3430_ST_MMC1_SHIFT,
},
},
+   .dev_attr   = mmc1_dev_attr,
.slaves = omap3xxx_mmc1_slaves,
.slaves_cnt = ARRAY_SIZE(omap3xxx_mmc1_slaves),
.class  = omap34xx_mmc_class,
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index dd39e75..f799a97 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -25,6 +25,7 @@
 #include plat/gpio.h
 #include plat/dma.h
 #include plat/mcspi.h
+#include plat/mmc.h
 
 #include omap_hwmod_common_data.h
 
@@ -3383,6 +3384,7 @@ static struct omap_hwmod_class omap44xx_mmc_hwmod_class = 
{
 };
 
 /* mmc1 */
+
 static struct omap_hwmod_irq_info omap44xx_mmc1_irqs[] = {
{ .irq = 83 + OMAP44XX_IRQ_GIC_START },
 };
@@ -3420,6 +3422,11 @@ static struct omap_hwmod_ocp_if *omap44xx_mmc1_slaves[] 
= {
omap44xx_l4_per__mmc1,
 };
 
+/* mmc1 dev_attr */
+static struct omap_mmc_dev_attr mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
 static struct omap_hwmod omap44xx_mmc1_hwmod = {
.name   = mmc1,
.class  = omap44xx_mmc_hwmod_class,
@@ -3433,6 +3440,7 @@ static struct omap_hwmod omap44xx_mmc1_hwmod = {
.clkctrl_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL,
},
},
+   .dev_attr   = mmc1_dev_attr,
.slaves = omap44xx_mmc1_slaves,
.slaves_cnt = ARRAY_SIZE(omap44xx_mmc1_slaves),
.masters= omap44xx_mmc1_masters,
diff --git a/arch/arm/plat-omap/include/plat/mmc.h 
b/arch/arm/plat-omap/include/plat/mmc.h
index e5de5d4..a7afab0 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -43,6 +43,12 @@
 
 #define OMAP_MMC_MAX_SLOTS 2
 
+#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT  BIT(1)
+
+struct omap_mmc_dev_attr {
+   u8 flags;
+};
+
 struct omap_mmc_platform_data {
/* back-link to device */
struct device *dev;
@@ -71,6 +77,9 @@ struct omap_mmc_platform_data {
 
u64 dma_mask;
 
+   /* Integrating attributes from the omap_hwmod layer */
+   u8 controller_flags;
+
/* Register offset deviation */
u16 reg_offset;
 
-- 
1.7.1

--
To unsubscribe from this list

[PATCH v5 8/8] OMAP: hsmmc: Rename the device and driver

2011-02-25 Thread Kishore Kadiyala
Modifying the device  driver name from mmci-omap-hs to
omap_hsmmc.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Acked-by: Benoit Coussonb-cous...@ti.com
---
 arch/arm/mach-omap2/board-2430sdp.c  |2 +-
 arch/arm/mach-omap2/board-3430sdp.c  |6 +++---
 arch/arm/mach-omap2/board-4430sdp.c  |4 ++--
 arch/arm/mach-omap2/board-devkit8000.c   |2 +-
 arch/arm/mach-omap2/board-igep0020.c |6 +++---
 arch/arm/mach-omap2/board-igep0030.c |6 +++---
 arch/arm/mach-omap2/board-omap3evm.c |2 +-
 arch/arm/mach-omap2/board-omap3pandora.c |6 +++---
 arch/arm/mach-omap2/board-omap4panda.c   |4 ++--
 arch/arm/mach-omap2/board-rm680.c|2 +-
 arch/arm/mach-omap2/board-rx51-peripherals.c |8 
 arch/arm/mach-omap2/board-zoom-peripherals.c |2 +-
 arch/arm/mach-omap2/clock2430_data.c |   12 ++--
 arch/arm/mach-omap2/clock3xxx_data.c |   12 ++--
 arch/arm/mach-omap2/clock44xx_data.c |   20 ++--
 arch/arm/mach-omap2/hsmmc.c  |2 +-
 drivers/mmc/host/omap_hsmmc.c|2 +-
 17 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/arch/arm/mach-omap2/board-2430sdp.c 
b/arch/arm/mach-omap2/board-2430sdp.c
index cc42d47..ab0880b 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -149,7 +149,7 @@ static void __init omap_2430sdp_init_early(void)
 }
 
 static struct regulator_consumer_supply sdp2430_vmmc1_supplies[] = {
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0),
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.0),
 };
 
 /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index 8950ecc..40b0174 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -410,15 +410,15 @@ static struct regulator_consumer_supply 
sdp3430_vpll2_supplies[] = {
 };
 
 static struct regulator_consumer_supply sdp3430_vmmc1_supplies[] = {
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0),
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.0),
 };
 
 static struct regulator_consumer_supply sdp3430_vsim_supplies[] = {
-   REGULATOR_SUPPLY(vmmc_aux, mmci-omap-hs.0),
+   REGULATOR_SUPPLY(vmmc_aux, omap_hsmmc.0),
 };
 
 static struct regulator_consumer_supply sdp3430_vmmc2_supplies[] = {
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.1),
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.1),
 };
 
 /*
diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 1a943be..cca2fbc 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -367,13 +367,13 @@ static struct omap2_hsmmc_info mmc[] = {
 static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
{
.supply = vmmc,
-   .dev_name = mmci-omap-hs.1,
+   .dev_name = omap_hsmmc.1,
},
 };
 static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
{
.supply = vmmc,
-   .dev_name = mmci-omap-hs.0,
+   .dev_name = omap_hsmmc.0,
},
 };
 
diff --git a/arch/arm/mach-omap2/board-devkit8000.c 
b/arch/arm/mach-omap2/board-devkit8000.c
index 54abdd0..c9170f4 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -140,7 +140,7 @@ static void devkit8000_panel_disable_dvi(struct 
omap_dss_device *dssdev)
 }
 
 static struct regulator_consumer_supply devkit8000_vmmc1_supply =
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0);
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.0);
 
 
 /* ads7846 on SPI */
diff --git a/arch/arm/mach-omap2/board-igep0020.c 
b/arch/arm/mach-omap2/board-igep0020.c
index 54e6318..1877c28 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -250,7 +250,7 @@ static inline void __init igep2_init_smsc911x(void) { }
 #endif
 
 static struct regulator_consumer_supply igep2_vmmc1_supply =
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0);
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.0);
 
 /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
 static struct regulator_init_data igep2_vmmc1 = {
@@ -268,7 +268,7 @@ static struct regulator_init_data igep2_vmmc1 = {
 };
 
 static struct regulator_consumer_supply igep2_vio_supply =
-   REGULATOR_SUPPLY(vmmc_aux, mmci-omap-hs.1);
+   REGULATOR_SUPPLY(vmmc_aux, omap_hsmmc.1);
 
 static struct regulator_init_data igep2_vio = {
.constraints = {
@@ -286,7 +286,7 @@ static struct regulator_init_data igep2_vio = {
 };
 
 static struct regulator_consumer_supply igep2_vmmc2_supply =
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.1);
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.1);
 
 static struct regulator_init_data igep2_vmmc2 = {
.constraints= {
diff --git a/arch/arm/mach-omap2/board-igep0030.c 
b/arch/arm/mach

[PATCH v5 1/8] omap: mmc: split out init for 2420

2011-02-25 Thread Kishore Kadiyala
From: Anand Gadiyar gadi...@ti.com

The MMC controller on the OMAP2420 is different from those
on the OMAP2430, OMAP3 and OMAP4 families - all of the latter
are identical. The one on the OMAP2420 is closer to that
on OMAP1 chips.

Currently, the n8x0 is the only OMAP2420 platform supported
in mainline which registers the MMC controller. Upcoming
changes to register the controllers using hwmod data are
potentially invasive. To reduce the risk, separate out the
2420 controller registration from the common init function
and update its only user. Also seperating out mux settings
for OMAP2420.

Signed-off-by: Anand Gadiyar gadi...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Tony Lindgren t...@atomide.com
Cc: Madhusudhan Chikkature madhu...@ti.com
Cc: Chris Ball c...@laptop.org
---
 arch/arm/mach-omap2/board-n8x0.c  |2 +-
 arch/arm/mach-omap2/devices.c |   88 +
 arch/arm/plat-omap/include/plat/mmc.h |4 ++
 3 files changed, 61 insertions(+), 33 deletions(-)

diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index b36cbd2..e710cd9 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -536,7 +536,7 @@ static void __init n8x0_mmc_init(void)
}
 
mmc_data[0] = mmc1_data;
-   omap2_init_mmc(mmc_data, OMAP24XX_NR_MMC);
+   omap242x_init_mmc(mmc_data);
 }
 #else
 
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 9ee876f..100bb42 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -650,11 +650,10 @@ err1:
 static inline void omap_hsmmc_reset(void) {}
 #endif
 
-#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
-   defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
 
-static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
-   int controller_nr)
+static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
+   *mmc_controller)
 {
if ((mmc_controller-slots[0].switch_pin  0)  \
(mmc_controller-slots[0].switch_pin  OMAP_MAX_GPIO_LINES))
@@ -665,33 +664,61 @@ static inline void omap2_mmc_mux(struct 
omap_mmc_platform_data *mmc_controller,
omap_mux_init_gpio(mmc_controller-slots[0].gpio_wp,
OMAP_PIN_INPUT_PULLUP);
 
-   if (cpu_is_omap2420()  controller_nr == 0) {
-   omap_mux_init_signal(sdmmc_cmd, 0);
-   omap_mux_init_signal(sdmmc_clki, 0);
-   omap_mux_init_signal(sdmmc_clko, 0);
-   omap_mux_init_signal(sdmmc_dat0, 0);
-   omap_mux_init_signal(sdmmc_dat_dir0, 0);
-   omap_mux_init_signal(sdmmc_cmd_dir, 0);
-   if (mmc_controller-slots[0].caps  MMC_CAP_4_BIT_DATA) {
-   omap_mux_init_signal(sdmmc_dat1, 0);
-   omap_mux_init_signal(sdmmc_dat2, 0);
-   omap_mux_init_signal(sdmmc_dat3, 0);
-   omap_mux_init_signal(sdmmc_dat_dir1, 0);
-   omap_mux_init_signal(sdmmc_dat_dir2, 0);
-   omap_mux_init_signal(sdmmc_dat_dir3, 0);
-   }
+   omap_mux_init_signal(sdmmc_cmd, 0);
+   omap_mux_init_signal(sdmmc_clki, 0);
+   omap_mux_init_signal(sdmmc_clko, 0);
+   omap_mux_init_signal(sdmmc_dat0, 0);
+   omap_mux_init_signal(sdmmc_dat_dir0, 0);
+   omap_mux_init_signal(sdmmc_cmd_dir, 0);
+   if (mmc_controller-slots[0].caps  MMC_CAP_4_BIT_DATA) {
+   omap_mux_init_signal(sdmmc_dat1, 0);
+   omap_mux_init_signal(sdmmc_dat2, 0);
+   omap_mux_init_signal(sdmmc_dat3, 0);
+   omap_mux_init_signal(sdmmc_dat_dir1, 0);
+   omap_mux_init_signal(sdmmc_dat_dir2, 0);
+   omap_mux_init_signal(sdmmc_dat_dir3, 0);
+   }
 
-   /*
-* Use internal loop-back in MMC/SDIO Module Input Clock
-* selection
-*/
-   if (mmc_controller-slots[0].internal_clock) {
-   u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
-   v |= (1  24);
-   omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
-   }
+   /*
+* Use internal loop-back in MMC/SDIO Module Input Clock
+* selection
+*/
+   if (mmc_controller-slots[0].internal_clock) {
+   u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
+   v |= (1  24);
+   omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
+   }
+}
+
+void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
+{
+   char *name = mmci-omap;
+
+   if (!mmc_data[0]) {
+   pr_err(%s fails: Incomplete platform data

[PATCH v5 7/8] OMAP: adapt hsmmc to hwmod framework

2011-02-25 Thread Kishore Kadiyala
Changes involves:
1) Remove controller reset in devices.c which is taken care of
   by hwmod framework.
2) Omap2420 platform consists of mmc block as in omap1 and not the
   hsmmc block as present in omap2430, omap3, omap4 platforms.
   Removing all base address macro defines except keeping one for OMAP2420.
3) Using omap-device layer to register device and utilizing data from
   hwmod data file for base address, dma channel number, Irq_number,
   device attribute.
4) Update the driver to use dev_attr to find whether controller
   supports dual volt cards

Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Benoit Cousson b-cous...@ti.com
CC: Kevin Hilman khil...@deeprootsystems.com
---
 arch/arm/mach-omap2/devices.c |  168 
 arch/arm/mach-omap2/hsmmc.c   |  343 ++--
 arch/arm/plat-omap/include/plat/mmc.h |   20 +--
 drivers/mmc/host/omap_hsmmc.c |4 +-
 4 files changed, 196 insertions(+), 339 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 2f4a598..31632ac 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -544,112 +544,6 @@ static inline void omap_init_aes(void) { }
 
 /*-*/
 
-#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
-
-#define MMCHS_SYSCONFIG0x0010
-#define MMCHS_SYSCONFIG_SWRESET(1  1)
-#define MMCHS_SYSSTATUS0x0014
-#define MMCHS_SYSSTATUS_RESETDONE  (1  0)
-
-static struct platform_device dummy_pdev = {
-   .dev = {
-   .bus = platform_bus_type,
-   },
-};
-
-/**
- * omap_hsmmc_reset() - Full reset of each HS-MMC controller
- *
- * Ensure that each MMC controller is fully reset.  Controllers
- * left in an unknown state (by bootloader) may prevent retention
- * or OFF-mode.  This is especially important in cases where the
- * MMC driver is not enabled, _or_ built as a module.
- *
- * In order for reset to work, interface, functional and debounce
- * clocks must be enabled.  The debounce clock comes from func_32k_clk
- * and is not under SW control, so we only enable i- and f-clocks.
- **/
-static void __init omap_hsmmc_reset(void)
-{
-   u32 i, nr_controllers;
-   struct clk *iclk, *fclk;
-
-   if (cpu_is_omap242x())
-   return;
-
-   nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC :
-   (cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC);
-
-   for (i = 0; i  nr_controllers; i++) {
-   u32 v, base = 0;
-   struct device *dev = dummy_pdev.dev;
-
-   switch (i) {
-   case 0:
-   base = OMAP2_MMC1_BASE;
-   break;
-   case 1:
-   base = OMAP2_MMC2_BASE;
-   break;
-   case 2:
-   base = OMAP3_MMC3_BASE;
-   break;
-   case 3:
-   if (!cpu_is_omap44xx())
-   return;
-   base = OMAP4_MMC4_BASE;
-   break;
-   case 4:
-   if (!cpu_is_omap44xx())
-   return;
-   base = OMAP4_MMC5_BASE;
-   break;
-   }
-
-   if (cpu_is_omap44xx())
-   base += OMAP4_MMC_REG_OFFSET;
-
-   dummy_pdev.id = i;
-   dev_set_name(dummy_pdev.dev, mmci-omap-hs.%d, i);
-   iclk = clk_get(dev, ick);
-   if (IS_ERR(iclk))
-   goto err1;
-   if (clk_enable(iclk))
-   goto err2;
-
-   fclk = clk_get(dev, fck);
-   if (IS_ERR(fclk))
-   goto err3;
-   if (clk_enable(fclk))
-   goto err4;
-
-   omap_writel(MMCHS_SYSCONFIG_SWRESET, base + MMCHS_SYSCONFIG);
-   v = omap_readl(base + MMCHS_SYSSTATUS);
-   while (!(omap_readl(base + MMCHS_SYSSTATUS) 
-MMCHS_SYSSTATUS_RESETDONE))
-   cpu_relax();
-
-   clk_disable(fclk);
-   clk_put(fclk);
-   clk_disable(iclk);
-   clk_put(iclk);
-   }
-   return;
-
-err4:
-   clk_put(fclk);
-err3:
-   clk_disable(iclk);
-err2:
-   clk_put(iclk);
-err1:
-   printk(KERN_WARNING %s: Unable to enable clocks for MMC%d, 
-   cannot reset.\n,  __func__, i);
-}
-#else
-static inline void omap_hsmmc_reset(void) {}
-#endif
-
 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
 
 static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
@@ -706,67 +600,6 @@ void __init omap242x_init_mmc(struct

[PATCH v5 2/8] OMAP2430: hwmod data: Add HSMMC

2011-02-25 Thread Kishore Kadiyala
From: Paul Walmsley p...@pwsan.com

Update the omap2430 hwmod data with the HSMMC info.

Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Rajendra Nayak rna...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Benoit Cousson b-cous...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |  146 
 1 files changed, 146 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 de0015d..a1c3c5e 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -54,6 +54,8 @@ static struct omap_hwmod omap2430_dma_system_hwmod;
 static struct omap_hwmod omap2430_mcspi1_hwmod;
 static struct omap_hwmod omap2430_mcspi2_hwmod;
 static struct omap_hwmod omap2430_mcspi3_hwmod;
+static struct omap_hwmod omap2430_mmc1_hwmod;
+static struct omap_hwmod omap2430_mmc2_hwmod;
 
 /* L3 - L4_CORE interface */
 static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = {
@@ -250,6 +252,42 @@ static struct omap_hwmod_ocp_if 
*omap2430_usbhsotg_slaves[] = {
omap2430_l4_core__usbhsotg,
 };
 
+/* L4 CORE - MMC1 interface */
+static struct omap_hwmod_addr_space omap2430_mmc1_addr_space[] = {
+   {
+   .pa_start   = 0x4809c000,
+   .pa_end = 0x4809c1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__mmc1 = {
+   .master = omap2430_l4_core_hwmod,
+   .slave  = omap2430_mmc1_hwmod,
+   .clk= mmchs1_ick,
+   .addr   = omap2430_mmc1_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap2430_mmc1_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 CORE - MMC2 interface */
+static struct omap_hwmod_addr_space omap2430_mmc2_addr_space[] = {
+   {
+   .pa_start   = 0x480b4000,
+   .pa_end = 0x480b41ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = {
+   .master = omap2430_l4_core_hwmod,
+   .slave  = omap2430_mmc2_hwmod,
+   .addr   = omap2430_mmc2_addr_space,
+   .clk= mmchs2_ick,
+   .addr_cnt   = ARRAY_SIZE(omap2430_mmc2_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_main__l4_core,
@@ -258,6 +296,8 @@ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] 
= {
 /* Master interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap2430_l4_core_masters[] = {
omap2430_l4_core__l4_wkup,
+   omap2430_l4_core__mmc1,
+   omap2430_l4_core__mmc2,
 };
 
 /* L4 CORE */
@@ -1508,6 +1548,110 @@ static struct omap_hwmod omap2430_usbhsotg_hwmod = {
 
 
 
+/* MMC/SD/SDIO common */
+
+static struct omap_hwmod_class_sysconfig omap2430_mmc_sysc = {
+   .rev_offs   = 0x1fc,
+   .sysc_offs  = 0x10,
+   .syss_offs  = 0x14,
+   .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+  SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap2430_mmc_class = {
+   .name = mmc,
+   .sysc = omap2430_mmc_sysc,
+};
+
+/* MMC/SD/SDIO1 */
+
+static struct omap_hwmod_irq_info omap2430_mmc1_mpu_irqs[] = {
+   { .irq = 83 },
+};
+
+static struct omap_hwmod_dma_info omap2430_mmc1_sdma_reqs[] = {
+   { .name = tx, .dma_req = 61 }, /* DMA_MMC1_TX */
+   { .name = rx, .dma_req = 62 }, /* DMA_MMC1_RX */
+};
+
+static struct omap_hwmod_opt_clk omap2430_mmc1_opt_clks[] = {
+   { .role = dbck, .clk = mmchsdb_fck },
+};
+
+static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] = {
+   omap2430_l4_core__mmc1,
+};
+
+static struct omap_hwmod omap2430_mmc1_hwmod = {
+   .name   = mmc1,
+   .mpu_irqs   = omap2430_mmc1_mpu_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(omap2430_mmc1_mpu_irqs),
+   .sdma_reqs  = omap2430_mmc1_sdma_reqs,
+   .sdma_reqs_cnt  = ARRAY_SIZE(omap2430_mmc1_sdma_reqs),
+   .opt_clks   = omap2430_mmc1_opt_clks,
+   .opt_clks_cnt   = ARRAY_SIZE(omap2430_mmc1_opt_clks),
+   .main_clk   = mmchs1_fck,
+   .prcm   = {
+   .omap2 = {
+   .module_offs = CORE_MOD,
+   .prcm_reg_id = 2,
+   .module_bit  = OMAP2430_EN_MMCHS1_SHIFT,
+   .idlest_reg_id = 2,
+   .idlest_idle_bit = OMAP2430_ST_MMCHS1_SHIFT

[PATCH v5 3/8] OMAP3: hwmod data: Add HSMMC

2011-02-25 Thread Kishore Kadiyala
From: Paul Walmsley p...@pwsan.com

Update the omap3 hwmod data with the HSMMC info.

Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Rajendra Nayak rna...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Benoit Cousson b-cous...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  209 
 arch/arm/mach-omap2/prcm-common.h  |4 +
 2 files changed, 213 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 e9d0012..7726932 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -68,6 +68,9 @@ static struct omap_hwmod omap34xx_mcspi1;
 static struct omap_hwmod omap34xx_mcspi2;
 static struct omap_hwmod omap34xx_mcspi3;
 static struct omap_hwmod omap34xx_mcspi4;
+static struct omap_hwmod omap3xxx_mmc1_hwmod;
+static struct omap_hwmod omap3xxx_mmc2_hwmod;
+static struct omap_hwmod omap3xxx_mmc3_hwmod;
 static struct omap_hwmod am35xx_usbhsotg_hwmod;
 
 static struct omap_hwmod omap3xxx_dma_system_hwmod;
@@ -158,6 +161,63 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup 
= {
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* L4 CORE - MMC1 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc1_addr_space[] = {
+   {
+   .pa_start   = 0x4809c000,
+   .pa_end = 0x4809c1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc1 = {
+   .master = omap3xxx_l4_core_hwmod,
+   .slave  = omap3xxx_mmc1_hwmod,
+   .clk= mmchs1_ick,
+   .addr   = omap3xxx_mmc1_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mmc1_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+   .flags  = OMAP_FIREWALL_L4
+};
+
+/* L4 CORE - MMC2 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc2_addr_space[] = {
+   {
+   .pa_start   = 0x480b4000,
+   .pa_end = 0x480b41ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc2 = {
+   .master = omap3xxx_l4_core_hwmod,
+   .slave  = omap3xxx_mmc2_hwmod,
+   .clk= mmchs2_ick,
+   .addr   = omap3xxx_mmc2_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mmc2_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+   .flags  = OMAP_FIREWALL_L4
+};
+
+/* L4 CORE - MMC3 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc3_addr_space[] = {
+   {
+   .pa_start   = 0x480ad000,
+   .pa_end = 0x480ad1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc3 = {
+   .master = omap3xxx_l4_core_hwmod,
+   .slave  = omap3xxx_mmc3_hwmod,
+   .clk= mmchs3_ick,
+   .addr   = omap3xxx_mmc3_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mmc3_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+   .flags  = OMAP_FIREWALL_L4
+};
+
 /* L4 CORE - UART1 interface */
 static struct omap_hwmod_addr_space omap3xxx_uart1_addr_space[] = {
{
@@ -2212,11 +2272,160 @@ static struct omap_hwmod am35xx_usbhsotg_hwmod = {
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES3_1)
 };
 
+/* MMC/SD/SDIO common */
+
+static struct omap_hwmod_class_sysconfig omap34xx_mmc_sysc = {
+   .rev_offs   = 0x1fc,
+   .sysc_offs  = 0x10,
+   .syss_offs  = 0x14,
+   .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+  SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap34xx_mmc_class = {
+   .name = mmc,
+   .sysc = omap34xx_mmc_sysc,
+};
+
+/* MMC/SD/SDIO1 */
+
+static struct omap_hwmod_irq_info omap34xx_mmc1_mpu_irqs[] = {
+   { .irq = 83, },
+};
+
+static struct omap_hwmod_dma_info omap34xx_mmc1_sdma_reqs[] = {
+   { .name = tx, .dma_req = 61, },
+   { .name = rx, .dma_req = 62, },
+};
+
+static struct omap_hwmod_opt_clk omap34xx_mmc1_opt_clks[] = {
+   { .role = dbck, .clk = omap_32k_fck, },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_mmc1_slaves[] = {
+   omap3xxx_l4_core__mmc1,
+};
+
+static struct omap_hwmod omap3xxx_mmc1_hwmod = {
+   .name   = mmc1,
+   .mpu_irqs   = omap34xx_mmc1_mpu_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(omap34xx_mmc1_mpu_irqs),
+   .sdma_reqs  = omap34xx_mmc1_sdma_reqs

[PATCH v4 3/6] OMAP4: hwmod data: enable HSMMC

2011-02-24 Thread Kishore Kadiyala
From: Anand Gadiyar gadi...@ti.com

Enabling hsmmc hwmod for OMAP4

Signed-off-by: Anand Gadiyar gadi...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Acked-by: Benoit Coussonb-cous...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 79a8601..dd39e75 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -5077,11 +5077,11 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] 
= {
omap44xx_mcspi4_hwmod,
 
/* mmc class */
-/* omap44xx_mmc1_hwmod, */
-/* omap44xx_mmc2_hwmod, */
-/* omap44xx_mmc3_hwmod, */
-/* omap44xx_mmc4_hwmod, */
-/* omap44xx_mmc5_hwmod, */
+   omap44xx_mmc1_hwmod,
+   omap44xx_mmc2_hwmod,
+   omap44xx_mmc3_hwmod,
+   omap44xx_mmc4_hwmod,
+   omap44xx_mmc5_hwmod,
 
/* mpu class */
omap44xx_mpu_hwmod,
-- 
1.7.1

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


[PATCH v4 0/6] OMAP: HSMMC: hwmod adaptation

2011-02-24 Thread Kishore Kadiyala
Adding hwmod data for hsmmc device on OMAP2430/OMAP3/OMAP4.
Adapting the omap_hsmmc driver to hwmod framework.

The patch series is based on omap-for-linus and tested on 
OMAP2430, OMAP3430SDP  OMAP4430SDP.
Also boot tested on OMAP2420SDP.

V4:
---
Omap2420 platform consists of mmc block as in omap1 and not the
hsmmc block as present in omap2430, omap3, omap4 platforms. 
The series takes care of hwmod adaptation of hsmmc drivers and 
thus excluding the omap2420 platforms.

Also includes renaming of device  driver name.

The patch series has dependency on :
 1)https://patchwork.kernel.org/patch/585281/ 
 2)https://patchwork.kernel.org/patch/538301/

V3:
--
http://www.spinics.net/lists/linux-omap/msg46783.html

V2:
---
http://www.spinics.net/lists/linux-omap/msg45443.html

V1:
---
http://www.spinics.net/lists/linux-mmc/msg05689.html


Anand Gadiyar (1):
  OMAP4: hwmod data: enable HSMMC

Kishore Kadiyala (2):
  OMAP: hwmod data: Add dev_attr and use in the host driver
  OMAP: adapt hsmmc to hwmod framework
  OMAP: hsmmc: Rename the device and driver

Paul Walmsley (2):
  OMAP2430: hwmod data: Add HSMMC
  OMAP3: hwmod data: Add HSMMC

 arch/arm/mach-omap2/board-2430sdp.c  |2 +-
 arch/arm/mach-omap2/board-3430sdp.c  |6 +-
 arch/arm/mach-omap2/board-4430sdp.c  |4 +-
 arch/arm/mach-omap2/board-devkit8000.c   |2 +-
 arch/arm/mach-omap2/board-igep0020.c |6 +-
 arch/arm/mach-omap2/board-igep0030.c |6 +-
 arch/arm/mach-omap2/board-omap3evm.c |2 +-
 arch/arm/mach-omap2/board-omap3pandora.c |6 +-
 arch/arm/mach-omap2/board-omap4panda.c   |4 +-
 arch/arm/mach-omap2/board-rm680.c|2 +-
 arch/arm/mach-omap2/board-rx51-peripherals.c |8 +-
 arch/arm/mach-omap2/board-zoom-peripherals.c |2 +-
 arch/arm/mach-omap2/clock2430_data.c |   12 +-
 arch/arm/mach-omap2/clock3xxx_data.c |   12 +-
 arch/arm/mach-omap2/clock44xx_data.c |   20 +-
 arch/arm/mach-omap2/devices.c|  251 
 arch/arm/mach-omap2/hsmmc.c  |  417 +-
 arch/arm/mach-omap2/omap_hwmod_2430_data.c   |  152 ++
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c   |  215 +
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c   |   16 +-
 arch/arm/mach-omap2/prcm-common.h|4 +
 arch/arm/plat-omap/include/plat/mmc.h|   29 +--
 drivers/mmc/host/omap_hsmmc.c|6 +-
 23 files changed, 713 insertions(+), 471 deletions(-)

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


[PATCH v4 4/6] OMAP: hwmod data: Add dev_attr and use in the host driver

2011-02-24 Thread Kishore Kadiyala
Add a device attribute to hwmod data of omap2430, omap3, omap4.
Currently the device attribute holds information regarding dual volt MMC card
support by the controller which will be later passed to the host driver via
platform data.

Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Benoit Cousson b-cous...@ti.com
Cc: Paul Walmsley p...@pwsan.com
---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |6 ++
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |6 ++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |6 ++
 arch/arm/plat-omap/include/plat/mmc.h  |9 +
 4 files changed, 27 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 9c99083..cbb7c9d 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -19,6 +19,7 @@
 #include plat/i2c.h
 #include plat/gpio.h
 #include plat/mcspi.h
+#include plat/mmc.h
 #include plat/l3_2xxx.h
 
 #include omap_hwmod_common_data.h
@@ -1568,6 +1569,10 @@ static struct omap_hwmod_class mmc_class = {
 
 /* MMC/SD/SDIO1 */
 
+static struct omap_mmc_dev_attr mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
 static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = {
{ .irq = 83 },
 };
@@ -1603,6 +1608,7 @@ static struct omap_hwmod omap2430_mmc1_hwmod = {
.idlest_idle_bit = OMAP2430_ST_MMCHS1_SHIFT,
},
},
+   .dev_attr   = mmc1_dev_attr,
.slaves = omap2430_mmc1_slaves,
.slaves_cnt = ARRAY_SIZE(omap2430_mmc1_slaves),
.class  = mmc_class,
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index d4e734e..7fa2dfb 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -22,6 +22,7 @@
 #include plat/l4_3xxx.h
 #include plat/i2c.h
 #include plat/gpio.h
+#include plat/mmc.h
 #include plat/smartreflex.h
 #include plat/mcspi.h
 
@@ -2292,6 +2293,10 @@ static struct omap_hwmod_class mmc_class = {
 
 /* MMC/SD/SDIO1 */
 
+static struct omap_mmc_dev_attr mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
 static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = {
{ .irq = 83, },
 };
@@ -2327,6 +2332,7 @@ static struct omap_hwmod omap3xxx_mmc1_hwmod = {
.idlest_idle_bit = OMAP3430_ST_MMC1_SHIFT,
},
},
+   .dev_attr   = mmc1_dev_attr,
.slaves = omap3xxx_mmc1_slaves,
.slaves_cnt = ARRAY_SIZE(omap3xxx_mmc1_slaves),
.class  = mmc_class,
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index dd39e75..28031e3 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -25,6 +25,7 @@
 #include plat/gpio.h
 #include plat/dma.h
 #include plat/mcspi.h
+#include plat/mmc.h
 
 #include omap_hwmod_common_data.h
 
@@ -3383,6 +3384,10 @@ static struct omap_hwmod_class omap44xx_mmc_hwmod_class 
= {
 };
 
 /* mmc1 */
+static struct omap_mmc_dev_attr mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
 static struct omap_hwmod_irq_info omap44xx_mmc1_irqs[] = {
{ .irq = 83 + OMAP44XX_IRQ_GIC_START },
 };
@@ -3433,6 +3438,7 @@ static struct omap_hwmod omap44xx_mmc1_hwmod = {
.clkctrl_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL,
},
},
+   .dev_attr   = mmc1_dev_attr,
.slaves = omap44xx_mmc1_slaves,
.slaves_cnt = ARRAY_SIZE(omap44xx_mmc1_slaves),
.masters= omap44xx_mmc1_masters,
diff --git a/arch/arm/plat-omap/include/plat/mmc.h 
b/arch/arm/plat-omap/include/plat/mmc.h
index e5de5d4..a7afab0 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -43,6 +43,12 @@
 
 #define OMAP_MMC_MAX_SLOTS 2
 
+#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT  BIT(1)
+
+struct omap_mmc_dev_attr {
+   u8 flags;
+};
+
 struct omap_mmc_platform_data {
/* back-link to device */
struct device *dev;
@@ -71,6 +77,9 @@ struct omap_mmc_platform_data {
 
u64 dma_mask;
 
+   /* Integrating attributes from the omap_hwmod layer */
+   u8 controller_flags;
+
/* Register offset deviation */
u16 reg_offset;
 
-- 
1.7.1

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


[PATCH v4 5/6] OMAP: adapt hsmmc to hwmod framework

2011-02-24 Thread Kishore Kadiyala
Changes involves:
1) Remove controller reset in devices.c which is taken care of
   by hwmod framework.
2) Omap2420 platform consists of mmc block as in omap1 and not the
   hsmmc block as present in omap2430, omap3, omap4 platforms.
   Removing all base address macro defines except keeping one for OMAP2420.
3) Using omap-device layer to register device and utilizing data from
   hwmod data file for base address, dma channel number, Irq_number,
   device attribute.
4) Update the driver to use dev_attr to find whether controller
   supports dual volt cards

Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Benoit Cousson b-cous...@ti.com
CC: Kevin Hilman khil...@deeprootsystems.com
---
 arch/arm/mach-omap2/devices.c |  251 
 arch/arm/mach-omap2/hsmmc.c   |  417 +
 arch/arm/plat-omap/include/plat/mmc.h |   20 +--
 drivers/mmc/host/omap_hsmmc.c |4 +-
 4 files changed, 274 insertions(+), 418 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 100bb42..31632ac 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -544,112 +544,6 @@ static inline void omap_init_aes(void) { }
 
 /*-*/
 
-#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
-
-#define MMCHS_SYSCONFIG0x0010
-#define MMCHS_SYSCONFIG_SWRESET(1  1)
-#define MMCHS_SYSSTATUS0x0014
-#define MMCHS_SYSSTATUS_RESETDONE  (1  0)
-
-static struct platform_device dummy_pdev = {
-   .dev = {
-   .bus = platform_bus_type,
-   },
-};
-
-/**
- * omap_hsmmc_reset() - Full reset of each HS-MMC controller
- *
- * Ensure that each MMC controller is fully reset.  Controllers
- * left in an unknown state (by bootloader) may prevent retention
- * or OFF-mode.  This is especially important in cases where the
- * MMC driver is not enabled, _or_ built as a module.
- *
- * In order for reset to work, interface, functional and debounce
- * clocks must be enabled.  The debounce clock comes from func_32k_clk
- * and is not under SW control, so we only enable i- and f-clocks.
- **/
-static void __init omap_hsmmc_reset(void)
-{
-   u32 i, nr_controllers;
-   struct clk *iclk, *fclk;
-
-   if (cpu_is_omap242x())
-   return;
-
-   nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC :
-   (cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC);
-
-   for (i = 0; i  nr_controllers; i++) {
-   u32 v, base = 0;
-   struct device *dev = dummy_pdev.dev;
-
-   switch (i) {
-   case 0:
-   base = OMAP2_MMC1_BASE;
-   break;
-   case 1:
-   base = OMAP2_MMC2_BASE;
-   break;
-   case 2:
-   base = OMAP3_MMC3_BASE;
-   break;
-   case 3:
-   if (!cpu_is_omap44xx())
-   return;
-   base = OMAP4_MMC4_BASE;
-   break;
-   case 4:
-   if (!cpu_is_omap44xx())
-   return;
-   base = OMAP4_MMC5_BASE;
-   break;
-   }
-
-   if (cpu_is_omap44xx())
-   base += OMAP4_MMC_REG_OFFSET;
-
-   dummy_pdev.id = i;
-   dev_set_name(dummy_pdev.dev, mmci-omap-hs.%d, i);
-   iclk = clk_get(dev, ick);
-   if (IS_ERR(iclk))
-   goto err1;
-   if (clk_enable(iclk))
-   goto err2;
-
-   fclk = clk_get(dev, fck);
-   if (IS_ERR(fclk))
-   goto err3;
-   if (clk_enable(fclk))
-   goto err4;
-
-   omap_writel(MMCHS_SYSCONFIG_SWRESET, base + MMCHS_SYSCONFIG);
-   v = omap_readl(base + MMCHS_SYSSTATUS);
-   while (!(omap_readl(base + MMCHS_SYSSTATUS) 
-MMCHS_SYSSTATUS_RESETDONE))
-   cpu_relax();
-
-   clk_disable(fclk);
-   clk_put(fclk);
-   clk_disable(iclk);
-   clk_put(iclk);
-   }
-   return;
-
-err4:
-   clk_put(fclk);
-err3:
-   clk_disable(iclk);
-err2:
-   clk_put(iclk);
-err1:
-   printk(KERN_WARNING %s: Unable to enable clocks for MMC%d, 
-   cannot reset.\n,  __func__, i);
-}
-#else
-static inline void omap_hsmmc_reset(void) {}
-#endif
-
 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
 
 static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
@@ -706,150 +600,6 @@ void __init omap242x_init_mmc(struct

[PATCH v4 1/6] OMAP2430: hwmod data: Add HSMMC

2011-02-24 Thread Kishore Kadiyala
From: Paul Walmsley p...@pwsan.com

Update the omap2430 hwmod data with the HSMMC info.

Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Rajendra Nayak rna...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Benoit Cousson b-cous...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |  146 
 1 files changed, 146 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 de0015d..9c99083 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -54,6 +54,8 @@ static struct omap_hwmod omap2430_dma_system_hwmod;
 static struct omap_hwmod omap2430_mcspi1_hwmod;
 static struct omap_hwmod omap2430_mcspi2_hwmod;
 static struct omap_hwmod omap2430_mcspi3_hwmod;
+static struct omap_hwmod omap2430_mmc1_hwmod;
+static struct omap_hwmod omap2430_mmc2_hwmod;
 
 /* L3 - L4_CORE interface */
 static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = {
@@ -250,6 +252,42 @@ static struct omap_hwmod_ocp_if 
*omap2430_usbhsotg_slaves[] = {
omap2430_l4_core__usbhsotg,
 };
 
+/* L4 CORE - MMC1 interface */
+static struct omap_hwmod_addr_space omap2430_mmc1_addr_space[] = {
+   {
+   .pa_start   = 0x4809c000,
+   .pa_end = 0x4809c1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__mmc1 = {
+   .master = omap2430_l4_core_hwmod,
+   .slave  = omap2430_mmc1_hwmod,
+   .clk= mmchs1_ick,
+   .addr   = omap2430_mmc1_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap2430_mmc1_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 CORE - MMC2 interface */
+static struct omap_hwmod_addr_space omap2430_mmc2_addr_space[] = {
+   {
+   .pa_start   = 0x480b4000,
+   .pa_end = 0x480b41ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = {
+   .master = omap2430_l4_core_hwmod,
+   .slave  = omap2430_mmc2_hwmod,
+   .addr   = omap2430_mmc2_addr_space,
+   .clk= mmchs2_ick,
+   .addr_cnt   = ARRAY_SIZE(omap2430_mmc2_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_main__l4_core,
@@ -258,6 +296,8 @@ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] 
= {
 /* Master interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap2430_l4_core_masters[] = {
omap2430_l4_core__l4_wkup,
+   omap2430_l4_core__mmc1,
+   omap2430_l4_core__mmc2,
 };
 
 /* L4 CORE */
@@ -1508,6 +1548,110 @@ static struct omap_hwmod omap2430_usbhsotg_hwmod = {
 
 
 
+/* MMC/SD/SDIO common */
+
+static struct omap_hwmod_class_sysconfig mmc_sysc = {
+   .rev_offs   = 0x1fc,
+   .sysc_offs  = 0x10,
+   .syss_offs  = 0x14,
+   .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+  SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class mmc_class = {
+   .name = mmc,
+   .sysc = mmc_sysc,
+};
+
+/* MMC/SD/SDIO1 */
+
+static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = {
+   { .irq = 83 },
+};
+
+static struct omap_hwmod_dma_info mmc1_sdma_reqs[] = {
+   { .name = tx, .dma_req = 61 }, /* DMA_MMC1_TX */
+   { .name = rx, .dma_req = 62 }, /* DMA_MMC1_RX */
+};
+
+static struct omap_hwmod_opt_clk mmc1_opt_clks[] = {
+   { .role = dbck, .clk = mmchsdb_fck },
+};
+
+static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] = {
+   omap2430_l4_core__mmc1,
+};
+
+static struct omap_hwmod omap2430_mmc1_hwmod = {
+   .name   = mmc1,
+   .mpu_irqs   = mmc1_mpu_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(mmc1_mpu_irqs),
+   .sdma_reqs  = mmc1_sdma_reqs,
+   .sdma_reqs_cnt  = ARRAY_SIZE(mmc1_sdma_reqs),
+   .opt_clks   = mmc1_opt_clks,
+   .opt_clks_cnt   = ARRAY_SIZE(mmc1_opt_clks),
+   .main_clk   = mmchs1_fck,
+   .prcm   = {
+   .omap2 = {
+   .module_offs = CORE_MOD,
+   .prcm_reg_id = 2,
+   .module_bit  = OMAP2430_EN_MMCHS1_SHIFT,
+   .idlest_reg_id = 2,
+   .idlest_idle_bit = OMAP2430_ST_MMCHS1_SHIFT,
+   },
+   },
+   .slaves = omap2430_mmc1_slaves,
+   .slaves_cnt

[PATCH v4 2/6] OMAP3: hwmod data: Add HSMMC

2011-02-24 Thread Kishore Kadiyala
From: Paul Walmsley p...@pwsan.com

Update the omap3 hwmod data with the HSMMC info.

Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Rajendra Nayak rna...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Benoit Cousson b-cous...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  209 
 arch/arm/mach-omap2/prcm-common.h  |4 +
 2 files changed, 213 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 e9d0012..d4e734e 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -68,6 +68,9 @@ static struct omap_hwmod omap34xx_mcspi1;
 static struct omap_hwmod omap34xx_mcspi2;
 static struct omap_hwmod omap34xx_mcspi3;
 static struct omap_hwmod omap34xx_mcspi4;
+static struct omap_hwmod omap3xxx_mmc1_hwmod;
+static struct omap_hwmod omap3xxx_mmc2_hwmod;
+static struct omap_hwmod omap3xxx_mmc3_hwmod;
 static struct omap_hwmod am35xx_usbhsotg_hwmod;
 
 static struct omap_hwmod omap3xxx_dma_system_hwmod;
@@ -158,6 +161,63 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup 
= {
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* L4 CORE - MMC1 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc1_addr_space[] = {
+   {
+   .pa_start   = 0x4809c000,
+   .pa_end = 0x4809c1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc1 = {
+   .master = omap3xxx_l4_core_hwmod,
+   .slave  = omap3xxx_mmc1_hwmod,
+   .clk= mmchs1_ick,
+   .addr   = omap3xxx_mmc1_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mmc1_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+   .flags  = OMAP_FIREWALL_L4
+};
+
+/* L4 CORE - MMC2 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc2_addr_space[] = {
+   {
+   .pa_start   = 0x480b4000,
+   .pa_end = 0x480b41ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc2 = {
+   .master = omap3xxx_l4_core_hwmod,
+   .slave  = omap3xxx_mmc2_hwmod,
+   .clk= mmchs2_ick,
+   .addr   = omap3xxx_mmc2_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mmc2_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+   .flags  = OMAP_FIREWALL_L4
+};
+
+/* L4 CORE - MMC3 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc3_addr_space[] = {
+   {
+   .pa_start   = 0x480ad000,
+   .pa_end = 0x480ad1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc3 = {
+   .master = omap3xxx_l4_core_hwmod,
+   .slave  = omap3xxx_mmc3_hwmod,
+   .clk= mmchs3_ick,
+   .addr   = omap3xxx_mmc3_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mmc3_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+   .flags  = OMAP_FIREWALL_L4
+};
+
 /* L4 CORE - UART1 interface */
 static struct omap_hwmod_addr_space omap3xxx_uart1_addr_space[] = {
{
@@ -2212,11 +2272,160 @@ static struct omap_hwmod am35xx_usbhsotg_hwmod = {
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES3_1)
 };
 
+/* MMC/SD/SDIO common */
+
+static struct omap_hwmod_class_sysconfig mmc_sysc = {
+   .rev_offs   = 0x1fc,
+   .sysc_offs  = 0x10,
+   .syss_offs  = 0x14,
+   .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+  SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class mmc_class = {
+   .name = mmc,
+   .sysc = mmc_sysc,
+};
+
+/* MMC/SD/SDIO1 */
+
+static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = {
+   { .irq = 83, },
+};
+
+static struct omap_hwmod_dma_info mmc1_sdma_reqs[] = {
+   { .name = tx, .dma_req = 61, },
+   { .name = rx, .dma_req = 62, },
+};
+
+static struct omap_hwmod_opt_clk mmc1_opt_clks[] = {
+   { .role = dbck, .clk = omap_32k_fck, },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_mmc1_slaves[] = {
+   omap3xxx_l4_core__mmc1,
+};
+
+static struct omap_hwmod omap3xxx_mmc1_hwmod = {
+   .name   = mmc1,
+   .mpu_irqs   = mmc1_mpu_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(mmc1_mpu_irqs),
+   .sdma_reqs  = mmc1_sdma_reqs,
+   .sdma_reqs_cnt  = ARRAY_SIZE(mmc1_sdma_reqs),
+   .opt_clks

[PATCH v4 6/6] OMAP: hsmmc: Rename the device and driver

2011-02-24 Thread Kishore Kadiyala
Modifying the device  driver name from mmci-omap-hs to
omap_hsmmc.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Kevin Hilman khil...@deeprootsystems.com
Cc: Benoit Cousson b-cous...@ti.com
Cc: Paul Walmsley p...@pwsan.com
Cc: Chris Ball c...@laptop.org
Cc: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/board-2430sdp.c  |2 +-
 arch/arm/mach-omap2/board-3430sdp.c  |6 +++---
 arch/arm/mach-omap2/board-4430sdp.c  |4 ++--
 arch/arm/mach-omap2/board-devkit8000.c   |2 +-
 arch/arm/mach-omap2/board-igep0020.c |6 +++---
 arch/arm/mach-omap2/board-igep0030.c |6 +++---
 arch/arm/mach-omap2/board-omap3evm.c |2 +-
 arch/arm/mach-omap2/board-omap3pandora.c |6 +++---
 arch/arm/mach-omap2/board-omap4panda.c   |4 ++--
 arch/arm/mach-omap2/board-rm680.c|2 +-
 arch/arm/mach-omap2/board-rx51-peripherals.c |8 
 arch/arm/mach-omap2/board-zoom-peripherals.c |2 +-
 arch/arm/mach-omap2/clock2430_data.c |   12 ++--
 arch/arm/mach-omap2/clock3xxx_data.c |   12 ++--
 arch/arm/mach-omap2/clock44xx_data.c |   20 ++--
 arch/arm/mach-omap2/hsmmc.c  |2 +-
 drivers/mmc/host/omap_hsmmc.c|2 +-
 17 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/arch/arm/mach-omap2/board-2430sdp.c 
b/arch/arm/mach-omap2/board-2430sdp.c
index cc42d47..ab0880b 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -149,7 +149,7 @@ static void __init omap_2430sdp_init_early(void)
 }
 
 static struct regulator_consumer_supply sdp2430_vmmc1_supplies[] = {
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0),
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.0),
 };
 
 /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index 8950ecc..40b0174 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -410,15 +410,15 @@ static struct regulator_consumer_supply 
sdp3430_vpll2_supplies[] = {
 };
 
 static struct regulator_consumer_supply sdp3430_vmmc1_supplies[] = {
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0),
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.0),
 };
 
 static struct regulator_consumer_supply sdp3430_vsim_supplies[] = {
-   REGULATOR_SUPPLY(vmmc_aux, mmci-omap-hs.0),
+   REGULATOR_SUPPLY(vmmc_aux, omap_hsmmc.0),
 };
 
 static struct regulator_consumer_supply sdp3430_vmmc2_supplies[] = {
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.1),
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.1),
 };
 
 /*
diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 1a943be..cca2fbc 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -367,13 +367,13 @@ static struct omap2_hsmmc_info mmc[] = {
 static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
{
.supply = vmmc,
-   .dev_name = mmci-omap-hs.1,
+   .dev_name = omap_hsmmc.1,
},
 };
 static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
{
.supply = vmmc,
-   .dev_name = mmci-omap-hs.0,
+   .dev_name = omap_hsmmc.0,
},
 };
 
diff --git a/arch/arm/mach-omap2/board-devkit8000.c 
b/arch/arm/mach-omap2/board-devkit8000.c
index 54abdd0..c9170f4 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -140,7 +140,7 @@ static void devkit8000_panel_disable_dvi(struct 
omap_dss_device *dssdev)
 }
 
 static struct regulator_consumer_supply devkit8000_vmmc1_supply =
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0);
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.0);
 
 
 /* ads7846 on SPI */
diff --git a/arch/arm/mach-omap2/board-igep0020.c 
b/arch/arm/mach-omap2/board-igep0020.c
index 54e6318..1877c28 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -250,7 +250,7 @@ static inline void __init igep2_init_smsc911x(void) { }
 #endif
 
 static struct regulator_consumer_supply igep2_vmmc1_supply =
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0);
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.0);
 
 /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
 static struct regulator_init_data igep2_vmmc1 = {
@@ -268,7 +268,7 @@ static struct regulator_init_data igep2_vmmc1 = {
 };
 
 static struct regulator_consumer_supply igep2_vio_supply =
-   REGULATOR_SUPPLY(vmmc_aux, mmci-omap-hs.1);
+   REGULATOR_SUPPLY(vmmc_aux, omap_hsmmc.1);
 
 static struct regulator_init_data igep2_vio = {
.constraints = {
@@ -286,7 +286,7 @@ static struct regulator_init_data igep2_vio = {
 };
 
 static struct regulator_consumer_supply igep2_vmmc2_supply =
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.1);
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.1);
 
 static struct

Re: Linux-next as of 20110222 broken on OMAP4

2011-02-23 Thread Kishore Kadiyala
On Wed, Feb 23, 2011 at 10:20 AM, DebBarma, Tarun Kanti
tarun.ka...@ti.com wrote:
 -Original Message-
 From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap-
 ow...@vger.kernel.org] On Behalf Of Tony Lindgren
 Sent: Wednesday, February 23, 2011 12:44 AM
 To: Cousson, Benoit
 Cc: Gadiyar, Anand; linux-omap
 Subject: Re: Linux-next as of 20110222 broken on OMAP4

 * Cousson, Benoit b-cous...@ti.com [110222 04:50]:
  Hi Anand,
 
  On 2/22/2011 10:49 AM, Gadiyar, Anand wrote:
   Looks like linux-next as of today is broken on at least OMAP4.
  
   Turning on earlyprintk, I get a crash in omap_init_mcspi. Disabling
   CONFIG_SPI_OMAP24XX gets me as far as the following lines from my
   bootup log, but I haven't attempted to debug further.
  
   If there are any patches out there to fix this, let me know.
   Else I will debug this sometime tomorrow.
 
  Yes, it was discussed with Tony and temporarily fixed yesterday.
 
  The SPI fix is is already in omap-for-linus, and the timer1 temp fix is
 below.
  We need to find a better way to handle timer now that they are
 initialized pretty soon.

 I applied the fix below with Paul's ack from the other thread.
 So linux-next should be working again on omap4 when it gets rebuilt.
 I have tested on OMAP4 and OMAP3. BTW, it doesn't work on OMAP24xx.
snip


The following commit breaks OMAP2420 booting

git bisect bad
15490ef8ff8fd22d677cb5d4f6a98e5a79118dba is the first bad commit
commit 15490ef8ff8fd22d677cb5d4f6a98e5a79118dba
Author: Russell King rmk+ker...@arm.linux.org.uk
Date:   Wed Feb 9 16:33:46 2011 +

   ARM: Avoid building unsafe kernels on OMAP2 and MX3

   OMAP2 (armv6) and MX3 turn off support for the V6K instructions, which
   when they include support for SMP kernels means that the resulting
   kernel is unsafe on SMP and can result in corrupted filesystems as we
   end up using unsafe bitops.

   Re-enable the use of V6K instructions on such kernels, and let such
   kernels running on V6 CPUs eat undefined instruction faults which will
   be much safer than filesystem corruption.  Next merge window we can fix
   this properly (as it requires a much bigger set of changes.)

   Acked-by: Tony Lindgren t...@atomide.com
   Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk

:04 04 48e40d2ece61dfc65cb701841efd31e3f7b2c0ff
df6ed06ca039457b7929bdd2fe5ca9ea6a331844 M  arch

Regards,
Kishore
--
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: Linux-next as of 20110222 broken on OMAP4

2011-02-23 Thread Kishore Kadiyala
On Wed, Feb 23, 2011 at 5:50 PM, DebBarma, Tarun Kanti
tarun.ka...@ti.com wrote:
 -Original Message-
 From: Kishore Kadiyala [mailto:kishorek.kadiy...@gmail.com]
 Sent: Wednesday, February 23, 2011 5:37 PM
 To: DebBarma, Tarun Kanti
 Cc: Tony Lindgren; Cousson, Benoit; Gadiyar, Anand; linux-omap
 Subject: Re: Linux-next as of 20110222 broken on OMAP4

 On Wed, Feb 23, 2011 at 10:20 AM, DebBarma, Tarun Kanti
 tarun.ka...@ti.com wrote:
  -Original Message-
  From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap-
  ow...@vger.kernel.org] On Behalf Of Tony Lindgren
  Sent: Wednesday, February 23, 2011 12:44 AM
  To: Cousson, Benoit
  Cc: Gadiyar, Anand; linux-omap
  Subject: Re: Linux-next as of 20110222 broken on OMAP4
 
  * Cousson, Benoit b-cous...@ti.com [110222 04:50]:
   Hi Anand,
  
   On 2/22/2011 10:49 AM, Gadiyar, Anand wrote:
Looks like linux-next as of today is broken on at least OMAP4.
   
Turning on earlyprintk, I get a crash in omap_init_mcspi. Disabling
CONFIG_SPI_OMAP24XX gets me as far as the following lines from my
bootup log, but I haven't attempted to debug further.
   
If there are any patches out there to fix this, let me know.
Else I will debug this sometime tomorrow.
  
   Yes, it was discussed with Tony and temporarily fixed yesterday.
  
   The SPI fix is is already in omap-for-linus, and the timer1 temp fix
 is
  below.
   We need to find a better way to handle timer now that they are
  initialized pretty soon.
 
  I applied the fix below with Paul's ack from the other thread.
  So linux-next should be working again on omap4 when it gets rebuilt.
  I have tested on OMAP4 and OMAP3. BTW, it doesn't work on OMAP24xx.
 snip


 The following commit breaks OMAP2420 booting

 git bisect bad
 15490ef8ff8fd22d677cb5d4f6a98e5a79118dba is the first bad commit
 commit 15490ef8ff8fd22d677cb5d4f6a98e5a79118dba
 Author: Russell King rmk+ker...@arm.linux.org.uk
 Date:   Wed Feb 9 16:33:46 2011 +

    ARM: Avoid building unsafe kernels on OMAP2 and MX3

    OMAP2 (armv6) and MX3 turn off support for the V6K instructions, which
    when they include support for SMP kernels means that the resulting
    kernel is unsafe on SMP and can result in corrupted filesystems as we
    end up using unsafe bitops.

    Re-enable the use of V6K instructions on such kernels, and let such
    kernels running on V6 CPUs eat undefined instruction faults which will
    be much safer than filesystem corruption.  Next merge window we can fix
    this properly (as it requires a much bigger set of changes.)

    Acked-by: Tony Lindgren t...@atomide.com
    Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk

 :04 04 48e40d2ece61dfc65cb701841efd31e3f7b2c0ff
 df6ed06ca039457b7929bdd2fe5ca9ea6a331844 M      arch
 I was thinking Paul's patch already tested on N800, OMAP2420!
 [PATCH 0/8] OMAP2+: hwmod/clockevent: allow late-init of individual     hwmods
 In other words, Paul's patch fixed the breakage on OMAP24xx.
 --
 Tarun


Sorry it was on lkml and not on linux-next

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


[PATCH 1/6] omap: mmc: split out init for 2420

2011-02-23 Thread Kishore Kadiyala
From: Anand Gadiyar gadi...@ti.com

The MMC controller on the OMAP2420 is different from those
on the OMAP2430, OMAP3 and OMAP4 families - all of the latter
are identical. The one on the OMAP2420 is closer to that
on OMAP1 chips.

Currently, the n8x0 is the only OMAP2420 platform supported
in mainline which registers the MMC controller. Upcoming
changes to register the controllers using hwmod data are
potentially invasive. To reduce the risk, separate out the
2420 controller registration from the common init function
and update its only user. Also seperating out mux settings
for OMAP2420.

Signed-off-by: Anand Gadiyar gadi...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Tony Lindgren t...@atomide.com
Cc: Madhusudhan Chikkature madhu...@ti.com
Cc: Chris Ball c...@laptop.org
---
 arch/arm/mach-omap2/board-n8x0.c  |2 +-
 arch/arm/mach-omap2/devices.c |   88 +
 arch/arm/plat-omap/include/plat/mmc.h |4 ++
 3 files changed, 61 insertions(+), 33 deletions(-)

diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index b36cbd2..e710cd9 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -536,7 +536,7 @@ static void __init n8x0_mmc_init(void)
}
 
mmc_data[0] = mmc1_data;
-   omap2_init_mmc(mmc_data, OMAP24XX_NR_MMC);
+   omap242x_init_mmc(mmc_data);
 }
 #else
 
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 71f099b..7b35c87 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -609,11 +609,10 @@ err1:
 static inline void omap_hsmmc_reset(void) {}
 #endif
 
-#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
-   defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
 
-static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
-   int controller_nr)
+static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
+   *mmc_controller)
 {
if ((mmc_controller-slots[0].switch_pin  0)  \
(mmc_controller-slots[0].switch_pin  OMAP_MAX_GPIO_LINES))
@@ -624,33 +623,61 @@ static inline void omap2_mmc_mux(struct 
omap_mmc_platform_data *mmc_controller,
omap_mux_init_gpio(mmc_controller-slots[0].gpio_wp,
OMAP_PIN_INPUT_PULLUP);
 
-   if (cpu_is_omap2420()  controller_nr == 0) {
-   omap_mux_init_signal(sdmmc_cmd, 0);
-   omap_mux_init_signal(sdmmc_clki, 0);
-   omap_mux_init_signal(sdmmc_clko, 0);
-   omap_mux_init_signal(sdmmc_dat0, 0);
-   omap_mux_init_signal(sdmmc_dat_dir0, 0);
-   omap_mux_init_signal(sdmmc_cmd_dir, 0);
-   if (mmc_controller-slots[0].caps  MMC_CAP_4_BIT_DATA) {
-   omap_mux_init_signal(sdmmc_dat1, 0);
-   omap_mux_init_signal(sdmmc_dat2, 0);
-   omap_mux_init_signal(sdmmc_dat3, 0);
-   omap_mux_init_signal(sdmmc_dat_dir1, 0);
-   omap_mux_init_signal(sdmmc_dat_dir2, 0);
-   omap_mux_init_signal(sdmmc_dat_dir3, 0);
-   }
+   omap_mux_init_signal(sdmmc_cmd, 0);
+   omap_mux_init_signal(sdmmc_clki, 0);
+   omap_mux_init_signal(sdmmc_clko, 0);
+   omap_mux_init_signal(sdmmc_dat0, 0);
+   omap_mux_init_signal(sdmmc_dat_dir0, 0);
+   omap_mux_init_signal(sdmmc_cmd_dir, 0);
+   if (mmc_controller-slots[0].caps  MMC_CAP_4_BIT_DATA) {
+   omap_mux_init_signal(sdmmc_dat1, 0);
+   omap_mux_init_signal(sdmmc_dat2, 0);
+   omap_mux_init_signal(sdmmc_dat3, 0);
+   omap_mux_init_signal(sdmmc_dat_dir1, 0);
+   omap_mux_init_signal(sdmmc_dat_dir2, 0);
+   omap_mux_init_signal(sdmmc_dat_dir3, 0);
+   }
 
-   /*
-* Use internal loop-back in MMC/SDIO Module Input Clock
-* selection
-*/
-   if (mmc_controller-slots[0].internal_clock) {
-   u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
-   v |= (1  24);
-   omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
-   }
+   /*
+* Use internal loop-back in MMC/SDIO Module Input Clock
+* selection
+*/
+   if (mmc_controller-slots[0].internal_clock) {
+   u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
+   v |= (1  24);
+   omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
+   }
+}
+
+void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
+{
+   char *name = mmci-omap;
+
+   if (!mmc_data[0]) {
+   pr_err(%s fails: Incomplete platform data

[PATCH] omap: mmc: split out init for 2420

2011-02-23 Thread Kishore Kadiyala
From: Anand Gadiyar gadi...@ti.com

The MMC controller on the OMAP2420 is different from those
on the OMAP2430, OMAP3 and OMAP4 families - all of the latter
are identical. The one on the OMAP2420 is closer to that
on OMAP1 chips.

Currently, the n8x0 is the only OMAP2420 platform supported
in mainline which registers the MMC controller. Upcoming
changes to register the controllers using hwmod data are
potentially invasive. To reduce the risk, separate out the
2420 controller registration from the common init function
and update its only user. Also seperating out mux settings
for OMAP2420.

Signed-off-by: Anand Gadiyar gadi...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Tony Lindgren t...@atomide.com
Cc: Madhusudhan Chikkature madhu...@ti.com
Cc: Chris Ball c...@laptop.org
---
 arch/arm/mach-omap2/board-n8x0.c  |2 +-
 arch/arm/mach-omap2/devices.c |   88 +
 arch/arm/plat-omap/include/plat/mmc.h |4 ++
 3 files changed, 61 insertions(+), 33 deletions(-)

diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index b36cbd2..e710cd9 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -536,7 +536,7 @@ static void __init n8x0_mmc_init(void)
}
 
mmc_data[0] = mmc1_data;
-   omap2_init_mmc(mmc_data, OMAP24XX_NR_MMC);
+   omap242x_init_mmc(mmc_data);
 }
 #else
 
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 71f099b..7b35c87 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -609,11 +609,10 @@ err1:
 static inline void omap_hsmmc_reset(void) {}
 #endif
 
-#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
-   defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
 
-static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
-   int controller_nr)
+static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
+   *mmc_controller)
 {
if ((mmc_controller-slots[0].switch_pin  0)  \
(mmc_controller-slots[0].switch_pin  OMAP_MAX_GPIO_LINES))
@@ -624,33 +623,61 @@ static inline void omap2_mmc_mux(struct 
omap_mmc_platform_data *mmc_controller,
omap_mux_init_gpio(mmc_controller-slots[0].gpio_wp,
OMAP_PIN_INPUT_PULLUP);
 
-   if (cpu_is_omap2420()  controller_nr == 0) {
-   omap_mux_init_signal(sdmmc_cmd, 0);
-   omap_mux_init_signal(sdmmc_clki, 0);
-   omap_mux_init_signal(sdmmc_clko, 0);
-   omap_mux_init_signal(sdmmc_dat0, 0);
-   omap_mux_init_signal(sdmmc_dat_dir0, 0);
-   omap_mux_init_signal(sdmmc_cmd_dir, 0);
-   if (mmc_controller-slots[0].caps  MMC_CAP_4_BIT_DATA) {
-   omap_mux_init_signal(sdmmc_dat1, 0);
-   omap_mux_init_signal(sdmmc_dat2, 0);
-   omap_mux_init_signal(sdmmc_dat3, 0);
-   omap_mux_init_signal(sdmmc_dat_dir1, 0);
-   omap_mux_init_signal(sdmmc_dat_dir2, 0);
-   omap_mux_init_signal(sdmmc_dat_dir3, 0);
-   }
+   omap_mux_init_signal(sdmmc_cmd, 0);
+   omap_mux_init_signal(sdmmc_clki, 0);
+   omap_mux_init_signal(sdmmc_clko, 0);
+   omap_mux_init_signal(sdmmc_dat0, 0);
+   omap_mux_init_signal(sdmmc_dat_dir0, 0);
+   omap_mux_init_signal(sdmmc_cmd_dir, 0);
+   if (mmc_controller-slots[0].caps  MMC_CAP_4_BIT_DATA) {
+   omap_mux_init_signal(sdmmc_dat1, 0);
+   omap_mux_init_signal(sdmmc_dat2, 0);
+   omap_mux_init_signal(sdmmc_dat3, 0);
+   omap_mux_init_signal(sdmmc_dat_dir1, 0);
+   omap_mux_init_signal(sdmmc_dat_dir2, 0);
+   omap_mux_init_signal(sdmmc_dat_dir3, 0);
+   }
 
-   /*
-* Use internal loop-back in MMC/SDIO Module Input Clock
-* selection
-*/
-   if (mmc_controller-slots[0].internal_clock) {
-   u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
-   v |= (1  24);
-   omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
-   }
+   /*
+* Use internal loop-back in MMC/SDIO Module Input Clock
+* selection
+*/
+   if (mmc_controller-slots[0].internal_clock) {
+   u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
+   v |= (1  24);
+   omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
+   }
+}
+
+void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
+{
+   char *name = mmci-omap;
+
+   if (!mmc_data[0]) {
+   pr_err(%s fails: Incomplete platform data

[PATCH v3 0/5] OMAP: HSMMC: hwmod adaptation

2011-02-23 Thread Kishore Kadiyala
Adding hwmod data for hsmmc device on OMAP2430/OMAP3/OMAP4.
Adapting the omap_hsmmc driver to hwmod framework.

The patch series is based on -rc6 and tested on OMAP2430, OMAP3430SDP
 OMAP4430SDP.

V3:
---
Omap2420 platform consists of mmc block as in omap1 and not the
hsmmc block as present in omap2430, omap3, omap4 platforms. 
The series takes care of hwmod adaptation of hsmmc drivers and 
thus excluding the omap2420 platforms.

The patch series has dependency on :
 1)https://patchwork.kernel.org/patch/585281/ 
 2)https://patchwork.kernel.org/patch/538301/

V2:
---
http://www.spinics.net/lists/linux-omap/msg45443.html

V1:
---
http://www.spinics.net/lists/linux-mmc/msg05689.html


Anand Gadiyar (1):
  OMAP4: hwmod data: enable HSMMC

Kishore Kadiyala (2):
  OMAP: hwmod data: Add dev_attr and use in the host driver
  OMAP: adapt hsmmc to hwmod framework

Paul Walmsley (2):
  OMAP2430: hwmod data: Add HSMMC
  OMAP3: hwmod data: Add HSMMC

 arch/arm/mach-omap2/devices.c  |  251 
 arch/arm/mach-omap2/hsmmc.c|  153 --
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |  155 +
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  221 
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   26 +++-
 arch/arm/mach-omap2/prcm-common.h  |4 +
 arch/arm/plat-omap/include/plat/mmc.h  |   24 +--
 drivers/mmc/host/omap_hsmmc.c  |4 +-
 8 files changed, 554 insertions(+), 284 deletions(-)

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


[PATCH v3 4/5] OMAP: hwmod data: Add dev_attr and use in the host driver

2011-02-23 Thread Kishore Kadiyala
Add a device attribute to hwmod data of omap2430, omap3, omap4.
Currently the device attribute holds information regarding dual volt MMC card
support by the controller which will be later passed to the host driver via
platform data.

Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Benoit Cousson b-cous...@ti.com
Cc: Paul Walmsley p...@pwsan.com
---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |9 +
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   12 
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   16 
 arch/arm/plat-omap/include/plat/mmc.h  |   10 ++
 drivers/mmc/host/omap_hsmmc.c  |4 ++--
 5 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c 
b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index 4d45b7d..e050355 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -19,6 +19,7 @@
 #include plat/i2c.h
 #include plat/gpio.h
 #include plat/mcspi.h
+#include plat/mmc.h
 
 #include omap_hwmod_common_data.h
 
@@ -1290,6 +1291,10 @@ static struct omap_hwmod_class mmc_class = {
 
 /* MMC/SD/SDIO1 */
 
+static struct mmc_dev_attr mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
 static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = {
{ .irq = 83 },
 };
@@ -1328,11 +1333,14 @@ static struct omap_hwmod omap2430_mmc1_hwmod = {
.slaves = omap2430_mmc1_slaves,
.slaves_cnt = ARRAY_SIZE(omap2430_mmc1_slaves),
.class  = mmc_class,
+   .dev_attr   = mmc1_dev_attr,
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* MMC/SD/SDIO2 */
 
+static struct mmc_dev_attr mmc2_dev_attr;
+
 static struct omap_hwmod_irq_info mmc2_mpu_irqs[] = {
{ .irq = 86 },
 };
@@ -1371,6 +1379,7 @@ static struct omap_hwmod omap2430_mmc2_hwmod = {
.slaves = omap2430_mmc2_slaves,
.slaves_cnt = ARRAY_SIZE(omap2430_mmc2_slaves),
.class  = mmc_class,
+   .dev_attr   = mmc2_dev_attr,
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index c8f2725..6afdf7f 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -21,6 +21,7 @@
 #include plat/l4_3xxx.h
 #include plat/i2c.h
 #include plat/gpio.h
+#include plat/mmc.h
 #include plat/smartreflex.h
 #include plat/mcspi.h
 
@@ -1868,6 +1869,10 @@ static struct omap_hwmod_class mmc_class = {
 
 /* MMC/SD/SDIO1 */
 
+static struct mmc_dev_attr omap_mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
 static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = {
{ .irq = 83, },
 };
@@ -1906,11 +1911,14 @@ static struct omap_hwmod omap3xxx_mmc1_hwmod = {
.slaves = omap3xxx_mmc1_slaves,
.slaves_cnt = ARRAY_SIZE(omap3xxx_mmc1_slaves),
.class  = mmc_class,
+   .dev_attr   = omap_mmc1_dev_attr,
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* MMC/SD/SDIO2 */
 
+static struct mmc_dev_attr omap_mmc2_dev_attr;
+
 static struct omap_hwmod_irq_info mmc2_mpu_irqs[] = {
{ .irq = INT_24XX_MMC2_IRQ, },
 };
@@ -1949,11 +1957,14 @@ static struct omap_hwmod omap3xxx_mmc2_hwmod = {
.slaves = omap3xxx_mmc2_slaves,
.slaves_cnt = ARRAY_SIZE(omap3xxx_mmc2_slaves),
.class  = mmc_class,
+   .dev_attr   = omap_mmc2_dev_attr,
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* MMC/SD/SDIO3 */
 
+static struct mmc_dev_attr omap_mmc3_dev_attr;
+
 static struct omap_hwmod_irq_info mmc3_mpu_irqs[] = {
{ .irq = 94, },
 };
@@ -1991,6 +2002,7 @@ static struct omap_hwmod omap3xxx_mmc3_hwmod = {
.slaves = omap3xxx_mmc3_slaves,
.slaves_cnt = ARRAY_SIZE(omap3xxx_mmc3_slaves),
.class  = mmc_class,
+   .dev_attr   = omap_mmc3_dev_attr,
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index dd39e75..6c4ccfd 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -25,6 +25,7 @@
 #include plat/gpio.h
 #include plat/dma.h
 #include plat/mcspi.h
+#include plat/mmc.h
 
 #include omap_hwmod_common_data.h
 
@@ -3383,6 +3384,10 @@ static struct omap_hwmod_class omap44xx_mmc_hwmod_class 
= {
 };
 
 /* mmc1 */
+static struct mmc_dev_attr omap_mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
 static struct omap_hwmod_irq_info omap44xx_mmc1_irqs[] = {
{ .irq = 83 + OMAP44XX_IRQ_GIC_START },
 };
@@ -3437,10 +3442,14 @@ static struct omap_hwmod omap44xx_mmc1_hwmod = {
.slaves_cnt

[PATCH v3 5/5] OMAP: adapt hsmmc to hwmod framework

2011-02-23 Thread Kishore Kadiyala
Changes involves:
1) Remove controller reset in devices.c which is taken care of
   by hwmod framework.
2) Removing all base address macro defines except keeping one for OMAP2420.
3) Using omap-device layer to register device and utilizing data from
   hwmod data file for base address, dma channel number, Irq_number,
   device attribute.

Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Benoit Cousson b-cous...@ti.com
CC: Kevin Hilman khil...@deeprootsystems.com
---
 arch/arm/mach-omap2/devices.c |  251 -
 arch/arm/mach-omap2/hsmmc.c   |  153 ++--
 arch/arm/plat-omap/include/plat/mmc.h |   14 --
 3 files changed, 141 insertions(+), 277 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 7b35c87..2d2deb6 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -503,112 +503,6 @@ static inline void omap_init_aes(void) { }
 
 /*-*/
 
-#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
-
-#define MMCHS_SYSCONFIG0x0010
-#define MMCHS_SYSCONFIG_SWRESET(1  1)
-#define MMCHS_SYSSTATUS0x0014
-#define MMCHS_SYSSTATUS_RESETDONE  (1  0)
-
-static struct platform_device dummy_pdev = {
-   .dev = {
-   .bus = platform_bus_type,
-   },
-};
-
-/**
- * omap_hsmmc_reset() - Full reset of each HS-MMC controller
- *
- * Ensure that each MMC controller is fully reset.  Controllers
- * left in an unknown state (by bootloader) may prevent retention
- * or OFF-mode.  This is especially important in cases where the
- * MMC driver is not enabled, _or_ built as a module.
- *
- * In order for reset to work, interface, functional and debounce
- * clocks must be enabled.  The debounce clock comes from func_32k_clk
- * and is not under SW control, so we only enable i- and f-clocks.
- **/
-static void __init omap_hsmmc_reset(void)
-{
-   u32 i, nr_controllers;
-   struct clk *iclk, *fclk;
-
-   if (cpu_is_omap242x())
-   return;
-
-   nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC :
-   (cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC);
-
-   for (i = 0; i  nr_controllers; i++) {
-   u32 v, base = 0;
-   struct device *dev = dummy_pdev.dev;
-
-   switch (i) {
-   case 0:
-   base = OMAP2_MMC1_BASE;
-   break;
-   case 1:
-   base = OMAP2_MMC2_BASE;
-   break;
-   case 2:
-   base = OMAP3_MMC3_BASE;
-   break;
-   case 3:
-   if (!cpu_is_omap44xx())
-   return;
-   base = OMAP4_MMC4_BASE;
-   break;
-   case 4:
-   if (!cpu_is_omap44xx())
-   return;
-   base = OMAP4_MMC5_BASE;
-   break;
-   }
-
-   if (cpu_is_omap44xx())
-   base += OMAP4_MMC_REG_OFFSET;
-
-   dummy_pdev.id = i;
-   dev_set_name(dummy_pdev.dev, mmci-omap-hs.%d, i);
-   iclk = clk_get(dev, ick);
-   if (IS_ERR(iclk))
-   goto err1;
-   if (clk_enable(iclk))
-   goto err2;
-
-   fclk = clk_get(dev, fck);
-   if (IS_ERR(fclk))
-   goto err3;
-   if (clk_enable(fclk))
-   goto err4;
-
-   omap_writel(MMCHS_SYSCONFIG_SWRESET, base + MMCHS_SYSCONFIG);
-   v = omap_readl(base + MMCHS_SYSSTATUS);
-   while (!(omap_readl(base + MMCHS_SYSSTATUS) 
-MMCHS_SYSSTATUS_RESETDONE))
-   cpu_relax();
-
-   clk_disable(fclk);
-   clk_put(fclk);
-   clk_disable(iclk);
-   clk_put(iclk);
-   }
-   return;
-
-err4:
-   clk_put(fclk);
-err3:
-   clk_disable(iclk);
-err2:
-   clk_put(iclk);
-err1:
-   printk(KERN_WARNING %s: Unable to enable clocks for MMC%d, 
-   cannot reset.\n,  __func__, i);
-}
-#else
-static inline void omap_hsmmc_reset(void) {}
-#endif
-
 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
 
 static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
@@ -665,150 +559,6 @@ void __init omap242x_init_mmc(struct 
omap_mmc_platform_data **mmc_data)
 
 #endif
 
-#if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
-
-static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
-   int controller_nr

[PATCH v3 3/5] OMAP4: hwmod data: enable HSMMC

2011-02-23 Thread Kishore Kadiyala
From: Anand Gadiyar gadi...@ti.com

Enabling hsmmc hwmod for OMAP4

Signed-off-by: Anand Gadiyar gadi...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Benoit Cousson b-cous...@ti.com
Cc: Paul Walmsley p...@pwsan.com
CC: Kevin Hilman khil...@deeprootsystems.com
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 79a8601..dd39e75 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -5077,11 +5077,11 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] 
= {
omap44xx_mcspi4_hwmod,
 
/* mmc class */
-/* omap44xx_mmc1_hwmod, */
-/* omap44xx_mmc2_hwmod, */
-/* omap44xx_mmc3_hwmod, */
-/* omap44xx_mmc4_hwmod, */
-/* omap44xx_mmc5_hwmod, */
+   omap44xx_mmc1_hwmod,
+   omap44xx_mmc2_hwmod,
+   omap44xx_mmc3_hwmod,
+   omap44xx_mmc4_hwmod,
+   omap44xx_mmc5_hwmod,
 
/* mpu class */
omap44xx_mpu_hwmod,
-- 
1.7.1

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


[PATCH v3 2/5] OMAP3: hwmod data: Add HSMMC

2011-02-23 Thread Kishore Kadiyala
From: Paul Walmsley p...@pwsan.com

Update the omap3 hwmod data with the HSMMC info.

Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Rajendra Nayak rna...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Benoit Cousson b-cous...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  209 
 arch/arm/mach-omap2/prcm-common.h  |4 +
 2 files changed, 213 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 879f55f..c8f2725 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -61,6 +61,9 @@ static struct omap_hwmod omap34xx_mcspi1;
 static struct omap_hwmod omap34xx_mcspi2;
 static struct omap_hwmod omap34xx_mcspi3;
 static struct omap_hwmod omap34xx_mcspi4;
+static struct omap_hwmod omap3xxx_mmc1_hwmod;
+static struct omap_hwmod omap3xxx_mmc2_hwmod;
+static struct omap_hwmod omap3xxx_mmc3_hwmod;
 static struct omap_hwmod am35xx_usbhsotg_hwmod;
 
 static struct omap_hwmod omap3xxx_dma_system_hwmod;
@@ -138,6 +141,63 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup 
= {
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* L4 CORE - MMC1 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc1_addr_space[] = {
+   {
+   .pa_start   = 0x4809c000,
+   .pa_end = 0x4809c1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc1 = {
+   .master = omap3xxx_l4_core_hwmod,
+   .slave  = omap3xxx_mmc1_hwmod,
+   .clk= mmchs1_ick,
+   .addr   = omap3xxx_mmc1_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mmc1_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+   .flags  = OMAP_FIREWALL_L4
+};
+
+/* L4 CORE - MMC2 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc2_addr_space[] = {
+   {
+   .pa_start   = 0x480b4000,
+   .pa_end = 0x480b41ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc2 = {
+   .master = omap3xxx_l4_core_hwmod,
+   .slave  = omap3xxx_mmc2_hwmod,
+   .clk= mmchs2_ick,
+   .addr   = omap3xxx_mmc2_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mmc2_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+   .flags  = OMAP_FIREWALL_L4
+};
+
+/* L4 CORE - MMC3 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc3_addr_space[] = {
+   {
+   .pa_start   = 0x480ad000,
+   .pa_end = 0x480ad1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc3 = {
+   .master = omap3xxx_l4_core_hwmod,
+   .slave  = omap3xxx_mmc3_hwmod,
+   .clk= mmchs3_ick,
+   .addr   = omap3xxx_mmc3_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mmc3_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+   .flags  = OMAP_FIREWALL_L4
+};
+
 /* L4 CORE - UART1 interface */
 static struct omap_hwmod_addr_space omap3xxx_uart1_addr_space[] = {
{
@@ -1788,11 +1848,160 @@ static struct omap_hwmod am35xx_usbhsotg_hwmod = {
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES3_1)
 };
 
+/* MMC/SD/SDIO common */
+
+static struct omap_hwmod_class_sysconfig mmc_sysc = {
+   .rev_offs   = 0x1fc,
+   .sysc_offs  = 0x10,
+   .syss_offs  = 0x14,
+   .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+  SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class mmc_class = {
+   .name = mmc,
+   .sysc = mmc_sysc,
+};
+
+/* MMC/SD/SDIO1 */
+
+static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = {
+   { .irq = 83, },
+};
+
+static struct omap_hwmod_dma_info mmc1_sdma_reqs[] = {
+   { .name = tx, .dma_req = 61, },
+   { .name = rx, .dma_req = 62, },
+};
+
+static struct omap_hwmod_opt_clk mmc1_opt_clks[] = {
+   { .role = dbck, .clk = omap_32k_fck, },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_mmc1_slaves[] = {
+   omap3xxx_l4_core__mmc1,
+};
+
+static struct omap_hwmod omap3xxx_mmc1_hwmod = {
+   .name   = mmc1,
+   .mpu_irqs   = mmc1_mpu_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(mmc1_mpu_irqs),
+   .sdma_reqs  = mmc1_sdma_reqs,
+   .sdma_reqs_cnt  = ARRAY_SIZE(mmc1_sdma_reqs),
+   .opt_clks

[PATCH v3 1/5] OMAP2430: hwmod data: Add HSMMC

2011-02-23 Thread Kishore Kadiyala
From: Paul Walmsley p...@pwsan.com

Update the omap2430 hwmod data with the HSMMC info.

Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Rajendra Nayak rna...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Benoit Cousson b-cous...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |  146 
 1 files changed, 146 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 7ba688a..4d45b7d 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -49,6 +49,8 @@ static struct omap_hwmod omap2430_dma_system_hwmod;
 static struct omap_hwmod omap2430_mcspi1_hwmod;
 static struct omap_hwmod omap2430_mcspi2_hwmod;
 static struct omap_hwmod omap2430_mcspi3_hwmod;
+static struct omap_hwmod omap2430_mmc1_hwmod;
+static struct omap_hwmod omap2430_mmc2_hwmod;
 
 /* L3 - L4_CORE interface */
 static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = {
@@ -232,6 +234,42 @@ static struct omap_hwmod_ocp_if 
*omap2430_usbhsotg_slaves[] = {
omap2430_l4_core__usbhsotg,
 };
 
+/* L4 CORE - MMC1 interface */
+static struct omap_hwmod_addr_space omap2430_mmc1_addr_space[] = {
+   {
+   .pa_start   = 0x4809c000,
+   .pa_end = 0x4809c1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__mmc1 = {
+   .master = omap2430_l4_core_hwmod,
+   .slave  = omap2430_mmc1_hwmod,
+   .clk= mmchs1_ick,
+   .addr   = omap2430_mmc1_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap2430_mmc1_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 CORE - MMC2 interface */
+static struct omap_hwmod_addr_space omap2430_mmc2_addr_space[] = {
+   {
+   .pa_start   = 0x480b4000,
+   .pa_end = 0x480b41ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = {
+   .master = omap2430_l4_core_hwmod,
+   .slave  = omap2430_mmc2_hwmod,
+   .addr   = omap2430_mmc2_addr_space,
+   .clk= mmchs2_ick,
+   .addr_cnt   = ARRAY_SIZE(omap2430_mmc2_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_main__l4_core,
@@ -240,6 +278,8 @@ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] 
= {
 /* Master interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap2430_l4_core_masters[] = {
omap2430_l4_core__l4_wkup,
+   omap2430_l4_core__mmc1,
+   omap2430_l4_core__mmc2,
 };
 
 /* L4 CORE */
@@ -1230,6 +1270,110 @@ static struct omap_hwmod omap2430_usbhsotg_hwmod = {
 
 
 
+/* MMC/SD/SDIO common */
+
+static struct omap_hwmod_class_sysconfig mmc_sysc = {
+   .rev_offs   = 0x1fc,
+   .sysc_offs  = 0x10,
+   .syss_offs  = 0x14,
+   .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+  SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class mmc_class = {
+   .name = mmc,
+   .sysc = mmc_sysc,
+};
+
+/* MMC/SD/SDIO1 */
+
+static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = {
+   { .irq = 83 },
+};
+
+static struct omap_hwmod_dma_info mmc1_sdma_reqs[] = {
+   { .name = tx, .dma_req = 61 }, /* DMA_MMC1_TX */
+   { .name = rx, .dma_req = 62 }, /* DMA_MMC1_RX */
+};
+
+static struct omap_hwmod_opt_clk mmc1_opt_clks[] = {
+   { .role = dbck, .clk = mmchsdb_fck },
+};
+
+static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] = {
+   omap2430_l4_core__mmc1,
+};
+
+static struct omap_hwmod omap2430_mmc1_hwmod = {
+   .name   = mmc1,
+   .mpu_irqs   = mmc1_mpu_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(mmc1_mpu_irqs),
+   .sdma_reqs  = mmc1_sdma_reqs,
+   .sdma_reqs_cnt  = ARRAY_SIZE(mmc1_sdma_reqs),
+   .opt_clks   = mmc1_opt_clks,
+   .opt_clks_cnt   = ARRAY_SIZE(mmc1_opt_clks),
+   .main_clk   = mmchs1_fck,
+   .prcm   = {
+   .omap2 = {
+   .module_offs = CORE_MOD,
+   .prcm_reg_id = 2,
+   .module_bit  = OMAP2430_EN_MMCHS1_SHIFT,
+   .idlest_reg_id = 2,
+   .idlest_idle_bit = OMAP2430_ST_MMCHS1_SHIFT,
+   },
+   },
+   .slaves = omap2430_mmc1_slaves,
+   .slaves_cnt

[PATCH v2 2/5] OMAP2430: hwmod data: Add HSMMC

2011-02-08 Thread Kishore Kadiyala
From: Paul Walmsley p...@pwsan.com

Update the omap2430 hwmod data with the HSMMC info.
Also update the device attribute structure.

Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Rajendra Nayak rna...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |  155 
 1 files changed, 155 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 8ecfbcd..166391d 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -18,6 +18,7 @@
 #include plat/serial.h
 #include plat/i2c.h
 #include plat/gpio.h
+#include plat/mmc.h
 
 #include omap_hwmod_common_data.h
 
@@ -45,6 +46,8 @@ static struct omap_hwmod omap2430_gpio3_hwmod;
 static struct omap_hwmod omap2430_gpio4_hwmod;
 static struct omap_hwmod omap2430_gpio5_hwmod;
 static struct omap_hwmod omap2430_dma_system_hwmod;
+static struct omap_hwmod omap2430_mmc1_hwmod;
+static struct omap_hwmod omap2430_mmc2_hwmod;
 
 /* L3 - L4_CORE interface */
 static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = {
@@ -189,6 +192,42 @@ static struct omap_hwmod_ocp_if omap2_l4_core__uart3 = {
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* L4 CORE - MMC1 interface */
+static struct omap_hwmod_addr_space omap2430_mmc1_addr_space[] = {
+   {
+   .pa_start   = 0x4809c000,
+   .pa_end = 0x4809c1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__mmc1 = {
+   .master = omap2430_l4_core_hwmod,
+   .slave  = omap2430_mmc1_hwmod,
+   .clk= mmchs1_ick,
+   .addr   = omap2430_mmc1_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap2430_mmc1_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 CORE - MMC2 interface */
+static struct omap_hwmod_addr_space omap2430_mmc2_addr_space[] = {
+   {
+   .pa_start   = 0x480b4000,
+   .pa_end = 0x480b41ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = {
+   .master = omap2430_l4_core_hwmod,
+   .slave  = omap2430_mmc2_hwmod,
+   .addr   = omap2430_mmc2_addr_space,
+   .clk= mmchs2_ick,
+   .addr_cnt   = ARRAY_SIZE(omap2430_mmc2_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_main__l4_core,
@@ -197,6 +236,8 @@ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] 
= {
 /* Master interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap2430_l4_core_masters[] = {
omap2430_l4_core__l4_wkup,
+   omap2430_l4_core__mmc1,
+   omap2430_l4_core__mmc2,
 };
 
 /* L4 CORE */
@@ -919,6 +960,118 @@ static struct omap_hwmod omap2430_dma_system_hwmod = {
.flags  = HWMOD_NO_IDLEST,
 };
 
+/* MMC/SD/SDIO common */
+
+static struct omap_hwmod_class_sysconfig mmc_sysc = {
+   .rev_offs   = 0x1fc,
+   .sysc_offs  = 0x10,
+   .syss_offs  = 0x14,
+   .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+  SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class mmc_class = {
+   .name = mmc,
+   .sysc = mmc_sysc,
+};
+
+/* MMC/SD/SDIO1 */
+
+static struct mmc_dev_attr mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
+static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = {
+   { .irq = 83 },
+};
+
+static struct omap_hwmod_dma_info mmc1_sdma_reqs[] = {
+   { .name = tx, .dma_req = 61 }, /* DMA_MMC1_TX */
+   { .name = rx, .dma_req = 62 }, /* DMA_MMC1_RX */
+};
+
+static struct omap_hwmod_opt_clk mmc1_opt_clks[] = {
+   { .role = dbck, .clk = mmchsdb_fck },
+};
+
+static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] = {
+   omap2430_l4_core__mmc1,
+};
+
+static struct omap_hwmod omap2430_mmc1_hwmod = {
+   .name   = mmc1_hwmod,
+   .mpu_irqs   = mmc1_mpu_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(mmc1_mpu_irqs),
+   .sdma_reqs  = mmc1_sdma_reqs,
+   .sdma_reqs_cnt  = ARRAY_SIZE(mmc1_sdma_reqs),
+   .opt_clks   = mmc1_opt_clks,
+   .opt_clks_cnt   = ARRAY_SIZE(mmc1_opt_clks),
+   .main_clk   = mmchs1_fck,
+   .prcm   = {
+   .omap2 = {
+   .module_offs = CORE_MOD

[PATCH v2 5/5] OMAP: devices: Modify HSMMC device to adapt to hwmod framework

2011-02-08 Thread Kishore Kadiyala
Changes involves:
1) Remove controller reset in devices.c which is taken care
   by hwmod framework.
2) Removing all base address macro defines.
3) Using omap-device layer to register device and utilizing data from
   hwmod data file for base address, dma channel number, Irq_number,
   device attribute.
4) Update the driver to use dev_attr to find whether controller
   supports dual volt cards.
5) Moving omap_mmc_add api from plat-omap/devices.c to mach-omap1/devices.c

Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
---
 arch/arm/mach-omap1/devices.c |   41 +++
 arch/arm/mach-omap2/board-n8x0.c  |6 +-
 arch/arm/mach-omap2/devices.c |  207 +++--
 arch/arm/mach-omap2/hsmmc.c   |6 +-
 arch/arm/plat-omap/devices.c  |   50 
 arch/arm/plat-omap/include/plat/mmc.h |   36 ++-
 drivers/mmc/host/omap_hsmmc.c |4 +-
 7 files changed, 100 insertions(+), 250 deletions(-)

diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index b0f4c23..eae41b6 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -72,6 +72,47 @@ static inline void omap_init_mbox(void) { }
 
 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
 
+#define OMAP_MMC_NR_RES2
+
+int __init omap_mmc_add(const char *name, int id, unsigned long base,
+   unsigned long size, unsigned int irq,
+   struct omap_mmc_platform_data *data)
+{
+   struct platform_device *pdev;
+   struct resource res[OMAP_MMC_NR_RES];
+   int ret;
+
+   pdev = platform_device_alloc(name, id);
+   if (!pdev)
+   return -ENOMEM;
+
+   memset(res, 0, OMAP_MMC_NR_RES * sizeof(struct resource));
+   res[0].start = base;
+   res[0].end = base + size - 1;
+   res[0].flags = IORESOURCE_MEM;
+   res[1].start = irq;
+   res[1].end = irq;
+   res[1].flags = IORESOURCE_IRQ;
+
+   ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
+   if (ret == 0)
+   ret = platform_device_add_data(pdev, data, sizeof(*data));
+   if (ret)
+   goto fail;
+
+   ret = platform_device_add(pdev);
+   if (ret)
+   goto fail;
+
+   /* return device handle to board setup code */
+   data-dev = pdev-dev;
+   return 0;
+
+fail:
+   platform_device_put(pdev);
+   return ret;
+}
+
 static inline void omap1_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
int controller_nr)
 {
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index 1cb53bc..5c9cd31 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -594,8 +594,6 @@ static struct omap_mmc_platform_data mmc1_data = {
},
 };
 
-static struct omap_mmc_platform_data *mmc_data[OMAP24XX_NR_MMC];
-
 static void __init n8x0_mmc_init(void)
 
 {
@@ -637,8 +635,8 @@ static void __init n8x0_mmc_init(void)
gpio_direction_output(N810_EMMC_VIO_GPIO, 0);
}
 
-   mmc_data[0] = mmc1_data;
-   omap2_init_mmc(mmc_data, OMAP24XX_NR_MMC);
+   hsmmc_data[0] = mmc1_data;
+   omap_hwmod_for_each_by_class(mmc, omap2_init_mmc, NULL);
 }
 #else
 
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index e0f0ef9..80e46b3 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -610,112 +610,6 @@ static inline void omap_init_aes(void) { }
 
 /*-*/
 
-#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
-
-#define MMCHS_SYSCONFIG0x0010
-#define MMCHS_SYSCONFIG_SWRESET(1  1)
-#define MMCHS_SYSSTATUS0x0014
-#define MMCHS_SYSSTATUS_RESETDONE  (1  0)
-
-static struct platform_device dummy_pdev = {
-   .dev = {
-   .bus = platform_bus_type,
-   },
-};
-
-/**
- * omap_hsmmc_reset() - Full reset of each HS-MMC controller
- *
- * Ensure that each MMC controller is fully reset.  Controllers
- * left in an unknown state (by bootloader) may prevent retention
- * or OFF-mode.  This is especially important in cases where the
- * MMC driver is not enabled, _or_ built as a module.
- *
- * In order for reset to work, interface, functional and debounce
- * clocks must be enabled.  The debounce clock comes from func_32k_clk
- * and is not under SW control, so we only enable i- and f-clocks.
- **/
-static void __init omap_hsmmc_reset(void)
-{
-   u32 i, nr_controllers;
-   struct clk *iclk, *fclk;
-
-   if (cpu_is_omap242x())
-   return;
-
-   nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC :
-   (cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC);
-
-   for (i = 0; i

[PATCH v2 1/5] OMAP2420: hwmod data: Add HSMMC

2011-02-08 Thread Kishore Kadiyala
Update the omap2420 hwmod data with the HSMMC info.
Add a device attribute structure which will be used
by the host driver to find whether the HSMMC controller
supports DUAL VOLT cards.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_2420_data.c |   80 
 arch/arm/plat-omap/include/plat/mmc.h  |7 +++
 2 files changed, 87 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 b85c630..19fec6a 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -18,6 +18,7 @@
 #include plat/serial.h
 #include plat/i2c.h
 #include plat/gpio.h
+#include plat/mmc.h
 
 #include omap_hwmod_common_data.h
 
@@ -44,6 +45,7 @@ static struct omap_hwmod omap2420_gpio2_hwmod;
 static struct omap_hwmod omap2420_gpio3_hwmod;
 static struct omap_hwmod omap2420_gpio4_hwmod;
 static struct omap_hwmod omap2420_dma_system_hwmod;
+static struct omap_hwmod omap2420_mmc_hwmod;
 
 /* L3 - L4_CORE interface */
 static struct omap_hwmod_ocp_if omap2420_l3_main__l4_core = {
@@ -95,6 +97,24 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__l4_wkup = {
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* L4 CORE - MMC interface */
+static struct omap_hwmod_addr_space omap2420_mmc_addr_space[] = {
+   {
+   .pa_start   = 0x4809c000,
+   .pa_end = 0x4809c07f,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2420_l4_core__mmc = {
+   .master = omap2420_l4_core_hwmod,
+   .slave  = omap2420_mmc_hwmod,
+   .clk= mmc_ick,
+   .addr   = omap2420_mmc_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap2420_mmc_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 /* L4 CORE - UART1 interface */
 static struct omap_hwmod_addr_space omap2420_uart1_addr_space[] = {
{
@@ -196,6 +216,7 @@ static struct omap_hwmod_ocp_if *omap2420_l4_core_slaves[] 
= {
 /* Master interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap2420_l4_core_masters[] = {
omap2420_l4_core__l4_wkup,
+   omap2420_l4_core__mmc,
omap2_l4_core__uart1,
omap2_l4_core__uart2,
omap2_l4_core__uart3,
@@ -864,6 +885,64 @@ static struct omap_hwmod omap2420_dma_system_hwmod = {
.flags  = HWMOD_NO_IDLEST,
 };
 
+/* MMC/SD/SDIO common */
+
+static struct omap_hwmod_class_sysconfig mmc_sysc = {
+   .rev_offs   = 0x3c,
+   .sysc_offs  = 0x64,
+   .syss_offs  = 0x68,
+   .sysc_flags = (SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class mmc_class = {
+   .name = mmc,
+   .sysc = mmc_sysc,
+};
+
+/* MMC/SD/SDIO1 */
+
+static struct mmc_dev_attr mmc_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
+static struct omap_hwmod_irq_info mmc_mpu_irqs[] = {
+   { .irq = 83 },
+};
+
+static struct omap_hwmod_dma_info mmc_sdma_reqs[] = {
+   { .name = tx, .dma_req = 61 }, /* DMA_MMC_TX */
+   { .name = rx, .dma_req = 62 }, /* DMA_MMC_RX */
+};
+
+static struct omap_hwmod_ocp_if *omap2420_mmc_slaves[] = {
+   omap2420_l4_core__mmc,
+};
+
+static struct omap_hwmod omap2420_mmc_hwmod = {
+   .name   = mmc_hwmod,
+   .mpu_irqs   = mmc_mpu_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(mmc_mpu_irqs),
+   .sdma_reqs  = mmc_sdma_reqs,
+   .sdma_reqs_cnt  = ARRAY_SIZE(mmc_sdma_reqs),
+   .main_clk   = mmc_fck,
+   .prcm   = {
+   .omap2 = {
+   .module_offs = CORE_MOD,
+   .prcm_reg_id = 1,
+   .module_bit  = OMAP2420_EN_MMC_SHIFT,
+   .idlest_reg_id = 1,
+   .idlest_idle_bit = OMAP2420_ST_MMC_SHIFT,
+   },
+   },
+   .slaves = omap2420_mmc_slaves,
+   .slaves_cnt = ARRAY_SIZE(omap2420_mmc_slaves),
+   .class  = mmc_class,
+   .dev_attr   = mmc_dev_attr,
+   .omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
+};
+
 static __initdata struct omap_hwmod *omap2420_hwmods[] = {
omap2420_l3_main_hwmod,
omap2420_l4_core_hwmod,
@@ -871,6 +950,7 @@ static __initdata struct omap_hwmod *omap2420_hwmods[] = {
omap2420_mpu_hwmod,
omap2420_iva_hwmod,
omap2420_wd_timer2_hwmod,
+   omap2420_mmc_hwmod,
omap2420_uart1_hwmod,
omap2420_uart2_hwmod,
omap2420_uart3_hwmod,
diff --git a/arch/arm/plat-omap/include/plat/mmc.h 
b/arch/arm/plat-omap/include/plat/mmc.h
index f57f36a..7821344 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -43,6

[PATCH v2 3/5] OMAP3: hwmod data: Add HSMMC

2011-02-08 Thread Kishore Kadiyala
From: Paul Walmsley p...@pwsan.com

Update the omap3 hwmod data with the HSMMC info.

Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Rajendra Nayak rna...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  221 
 arch/arm/mach-omap2/prcm-common.h  |2 +
 arch/arm/mach-omap2/prm-regbits-34xx.h |4 +
 3 files changed, 227 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 8d81813..47ca2ee 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -21,6 +21,7 @@
 #include plat/l4_3xxx.h
 #include plat/i2c.h
 #include plat/gpio.h
+#include plat/mmc.h
 #include plat/smartreflex.h
 
 #include omap_hwmod_common_data.h
@@ -107,6 +108,9 @@ static struct omap_hwmod omap3xxx_uart1_hwmod;
 static struct omap_hwmod omap3xxx_uart2_hwmod;
 static struct omap_hwmod omap3xxx_uart3_hwmod;
 static struct omap_hwmod omap3xxx_uart4_hwmod;
+static struct omap_hwmod omap3xxx_mmc1_hwmod;
+static struct omap_hwmod omap3xxx_mmc2_hwmod;
+static struct omap_hwmod omap3xxx_mmc3_hwmod;
 
 /* L4_CORE - L4_WKUP interface */
 static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = {
@@ -301,6 +305,63 @@ static struct omap_hwmod_ocp_if omap3_l4_core__sr2 = {
.user   = OCP_USER_MPU,
 };
 
+/* L4 CORE - MMC1 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc1_addr_space[] = {
+   {
+   .pa_start   = 0x4809c000,
+   .pa_end = 0x4809c1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc1 = {
+   .master = omap3xxx_l4_core_hwmod,
+   .slave  = omap3xxx_mmc1_hwmod,
+   .clk= mmchs1_ick,
+   .addr   = omap3xxx_mmc1_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mmc1_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+   .flags  = OMAP_FIREWALL_L4
+};
+
+/* L4 CORE - MMC2 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc2_addr_space[] = {
+   {
+   .pa_start   = 0x480b4000,
+   .pa_end = 0x480b41ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc2 = {
+   .master = omap3xxx_l4_core_hwmod,
+   .slave  = omap3xxx_mmc2_hwmod,
+   .clk= mmchs2_ick,
+   .addr   = omap3xxx_mmc2_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mmc2_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+   .flags  = OMAP_FIREWALL_L4
+};
+
+/* L4 CORE - MMC3 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc3_addr_space[] = {
+   {
+   .pa_start   = 0x480ad000,
+   .pa_end = 0x480ad1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc3 = {
+   .master = omap3xxx_l4_core_hwmod,
+   .slave  = omap3xxx_mmc3_hwmod,
+   .clk= mmchs3_ick,
+   .addr   = omap3xxx_mmc3_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mmc3_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+   .flags  = OMAP_FIREWALL_L4
+};
+
 /* Slave interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap3xxx_l4_core_slaves[] = {
omap3xxx_l3_main__l4_core,
@@ -1356,11 +1417,171 @@ static struct omap_hwmod omap36xx_sr2_hwmod = {
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3630ES1),
 };
 
+/* MMC/SD/SDIO common */
+
+static struct omap_hwmod_class_sysconfig mmc_sysc = {
+   .rev_offs   = 0x1fc,
+   .sysc_offs  = 0x10,
+   .syss_offs  = 0x14,
+   .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+  SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class mmc_class = {
+   .name = mmc,
+   .sysc = mmc_sysc,
+};
+
+/* MMC/SD/SDIO1 */
+
+static struct mmc_dev_attr omap_mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
+static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = {
+   { .irq = 83, },
+};
+
+static struct omap_hwmod_dma_info mmc1_sdma_reqs[] = {
+   { .name = tx, .dma_req = 61, },
+   { .name = rx, .dma_req = 62, },
+};
+
+static struct omap_hwmod_opt_clk mmc1_opt_clks[] = {
+   { .role = dbck, .clk = omap_32k_fck, },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_mmc1_slaves

[PATCH v2 4/5] OMAP4: hwmod data: Add HSMMC

2011-02-08 Thread Kishore Kadiyala
From: Benoit Cousson b-cous...@ti.com

Update the omap4 hwmod data with the HSMMC info.

Signed-off-by: Benoit Cousson b-cous...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |  339 
 1 files changed, 339 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index c2806bd..ec46835 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -24,6 +24,7 @@
 #include plat/cpu.h
 #include plat/gpio.h
 #include plat/dma.h
+#include plat/mmc.h
 
 #include omap_hwmod_common_data.h
 
@@ -53,6 +54,8 @@ static struct omap_hwmod omap44xx_l4_abe_hwmod;
 static struct omap_hwmod omap44xx_l4_cfg_hwmod;
 static struct omap_hwmod omap44xx_l4_per_hwmod;
 static struct omap_hwmod omap44xx_l4_wkup_hwmod;
+static struct omap_hwmod omap44xx_mmc1_hwmod;
+static struct omap_hwmod omap44xx_mmc2_hwmod;
 static struct omap_hwmod omap44xx_mpu_hwmod;
 static struct omap_hwmod omap44xx_mpu_private_hwmod;
 
@@ -229,6 +232,22 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l3_main_1 
= {
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* mmc1 - l3_main_1 */
+static struct omap_hwmod_ocp_if omap44xx_mmc1__l3_main_1 = {
+   .master = omap44xx_mmc1_hwmod,
+   .slave  = omap44xx_l3_main_1_hwmod,
+   .clk= l3_div_ck,
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* mmc2 - l3_main_1 */
+static struct omap_hwmod_ocp_if omap44xx_mmc2__l3_main_1 = {
+   .master = omap44xx_mmc2_hwmod,
+   .slave  = omap44xx_l3_main_1_hwmod,
+   .clk= l3_div_ck,
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 /* mpu - l3_main_1 */
 static struct omap_hwmod_ocp_if omap44xx_mpu__l3_main_1 = {
.master = omap44xx_mpu_hwmod,
@@ -242,6 +261,8 @@ static struct omap_hwmod_ocp_if 
*omap44xx_l3_main_1_slaves[] = {
omap44xx_dsp__l3_main_1,
omap44xx_l3_main_2__l3_main_1,
omap44xx_l4_cfg__l3_main_1,
+   omap44xx_mmc1__l3_main_1,
+   omap44xx_mmc2__l3_main_1,
omap44xx_mpu__l3_main_1,
 };
 
@@ -1435,6 +1456,317 @@ static struct omap_hwmod omap44xx_iva_hwmod = {
 };
 
 /*
+ * 'mmc' class
+ * multimedia card high-speed/sd/sdio (mmc/sd/sdio) host controller
+ */
+
+static struct omap_hwmod_class_sysconfig omap44xx_mmc_sysc = {
+   .rev_offs   = 0x,
+   .sysc_offs  = 0x0010,
+   .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_MIDLEMODE |
+  SYSC_HAS_RESET_STATUS | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_SOFTRESET),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
+  SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
+  MSTANDBY_SMART),
+   .sysc_fields= omap_hwmod_sysc_type2,
+};
+
+static struct omap_hwmod_class omap44xx_mmc_hwmod_class = {
+   .name   = mmc,
+   .sysc   = omap44xx_mmc_sysc,
+};
+
+/* mmc1 */
+static struct omap_hwmod_irq_info omap44xx_mmc1_irqs[] = {
+   { .irq = 83 + OMAP44XX_IRQ_GIC_START },
+};
+
+static struct omap_hwmod_dma_info omap44xx_mmc1_sdma_reqs[] = {
+   { .name = tx, .dma_req = 60 + OMAP44XX_DMA_REQ_START },
+   { .name = rx, .dma_req = 61 + OMAP44XX_DMA_REQ_START },
+};
+
+/* mmc1 master ports */
+static struct omap_hwmod_ocp_if *omap44xx_mmc1_masters[] = {
+   omap44xx_mmc1__l3_main_1,
+};
+
+static struct omap_hwmod_addr_space omap44xx_mmc1_addrs[] = {
+   {
+   .pa_start   = 0x4809c000,
+   .pa_end = 0x4809c3ff,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+/* l4_per - mmc1 */
+static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc1 = {
+   .master = omap44xx_l4_per_hwmod,
+   .slave  = omap44xx_mmc1_hwmod,
+   .clk= l4_div_ck,
+   .addr   = omap44xx_mmc1_addrs,
+   .addr_cnt   = ARRAY_SIZE(omap44xx_mmc1_addrs),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* mmc1 slave ports */
+static struct omap_hwmod_ocp_if *omap44xx_mmc1_slaves[] = {
+   omap44xx_l4_per__mmc1,
+};
+
+static struct mmc_dev_attr omap_mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
+static struct omap_hwmod omap44xx_mmc1_hwmod = {
+   .name   = mmc1,
+   .class  = omap44xx_mmc_hwmod_class,
+   .mpu_irqs   = omap44xx_mmc1_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(omap44xx_mmc1_irqs),
+   .sdma_reqs  = omap44xx_mmc1_sdma_reqs,
+   .sdma_reqs_cnt  = ARRAY_SIZE(omap44xx_mmc1_sdma_reqs),
+   .main_clk   = mmc1_fck,
+   .prcm = {
+   .omap4 = {
+   .clkctrl_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL,
+   },
+   },
+   .slaves = omap44xx_mmc1_slaves

[PATCH v2 0/5] OMAP: HSMMC: hwmod adaptation

2011-02-08 Thread Kishore Kadiyala
Adding hwmod data for hsmmc device on OMAP2420/OMAP2430/OMAP3/OMAP4.
Adapting the omap_hsmmc driver to hwmod framework

V2:
---
Updated hwmod data for OMAP2420  OMAP2430. 

The patch series is rebased on v2.6.38-rc4 and tested on OMAP4430SDP, 
OMAP3430SDP  OMAP2430SDP.

For OMAP2430SDP validation, the patch series has dependency on
https://patchwork.kernel.org/patch/538301/

Testing on N8x0 is pending due to unavailability of working ones.
Will be thankful if some body test this series on N8x0.

V1:
---
http://www.spinics.net/lists/linux-mmc/msg05689.html


Kishore Kadiyala (2):
  OMAP2420: hwmod data: Add HSMMC
  OMAP: devices: Modify HSMMC device to adapt to hwmod framework

Paul Walmsley (2):
  OMAP2430: hwmod data: Add HSMMC
  OMAP3: hwmod data: Add HSMMC
  
Benoit Cousson (1):  
  OMAP4: hwmod data: Add HSMMC

 arch/arm/mach-omap1/devices.c  |   41 
 arch/arm/mach-omap2/board-n8x0.c   |6 +-
 arch/arm/mach-omap2/devices.c  |  207 -
 arch/arm/mach-omap2/hsmmc.c|6 +-
 arch/arm/mach-omap2/omap_hwmod_2420_data.c |   80 +++
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |  155 +
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  221 ++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |  339 
 arch/arm/mach-omap2/prcm-common.h  |2 +
 arch/arm/mach-omap2/prm-regbits-34xx.h |4 +
 arch/arm/plat-omap/devices.c   |   50 
 arch/arm/plat-omap/include/plat/mmc.h  |   43 ++---
 drivers/mmc/host/omap_hsmmc.c  |4 +-
 13 files changed, 908 insertions(+), 250 deletions(-)

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


Re: [PATCH] OMAP2: add regulator for MMC1

2011-02-08 Thread Kishore Kadiyala
On Mon, Feb 7, 2011 at 9:38 PM, Balaji T K balaj...@ti.com wrote:
 Add regulator VMMC1 used by SD/MMC card slot1 in 2430sdp.

 Signed-off-by: Balaji T K balaj...@ti.com

Tested-by: Kishore Kadiyala kishore.kadiy...@ti.com

Regards,
Kishore

 ---
 Tested on OMAP2430 SDP with busybox filesystem mounted on MMC1

  arch/arm/mach-omap2/board-2430sdp.c |   21 +
  1 files changed, 21 insertions(+), 0 deletions(-)

 diff --git a/arch/arm/mach-omap2/board-2430sdp.c 
 b/arch/arm/mach-omap2/board-2430sdp.c
 index e066177..361f6cb 100644
 --- a/arch/arm/mach-omap2/board-2430sdp.c
 +++ b/arch/arm/mach-omap2/board-2430sdp.c
 @@ -22,6 +22,7 @@
  #include linux/mmc/host.h
  #include linux/delay.h
  #include linux/i2c/twl.h
 +#include linux/regulator/machine.h
  #include linux/err.h
  #include linux/clk.h
  #include linux/io.h
 @@ -148,6 +149,25 @@ static void __init omap_2430sdp_init_irq(void)
        omap_init_irq();
  }

 +static struct regulator_consumer_supply sdp2430_vmmc1_supplies[] = {
 +       REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0),
 +};
 +
 +/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
 +static struct regulator_init_data sdp2430_vmmc1 = {
 +       .constraints = {
 +               .min_uV                 = 185,
 +               .max_uV                 = 315,
 +               .valid_modes_mask       = REGULATOR_MODE_NORMAL
 +                                       | REGULATOR_MODE_STANDBY,
 +               .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
 +                                       | REGULATOR_CHANGE_MODE
 +                                       | REGULATOR_CHANGE_STATUS,
 +       },
 +       .num_consumer_supplies  = ARRAY_SIZE(sdp2430_vmmc1_supplies),
 +       .consumer_supplies      = sdp2430_vmmc1_supplies[0],
 +};
 +
  static struct twl4030_gpio_platform_data sdp2430_gpio_data = {
        .gpio_base      = OMAP_MAX_GPIO_LINES,
        .irq_base       = TWL4030_GPIO_IRQ_BASE,
 @@ -160,6 +180,7 @@ static struct twl4030_platform_data sdp2430_twldata = {

        /* platform_data for children goes here */
        .gpio           = sdp2430_gpio_data,
 +       .vmmc1          = sdp2430_vmmc1,
  };

  static struct i2c_board_info __initdata sdp2430_i2c_boardinfo[] = {
 --
 1.7.0.4

 --
 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

--
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 2/2] Input: ads7846: use gpio_request_one to configure pendown_gpio

2011-02-04 Thread Kishore Kadiyala
Manju,

Line wrapped, looks like your .muttrc needs to be configured for 80
characters limit.

Regards,
Kishore

On Fri, Feb 4, 2011 at 7:02 PM, G, Manjunath Kondaiah manj...@ti.com wrote:
 On Thu, Feb 03, 2011 at 09:19:53AM -0800, Dmitry Torokhov wrote:
 On Thu, Feb 03, 2011 at 08:54:05AM -0800, Dmitry Torokhov wrote:
  On Thu, Feb 03, 2011 at 08:51:46PM +0530, Sourav Poddar wrote:
   The ads7846 driver requests a gpio but does not currently
   configure it explicitly as an input. Use gpio_request_one
   to request and configure it at one shot.
  
   Signed-off-by: Sourav Poddar sourav.pod...@ti.com
   Cc: Dmitry Torokhov d...@mail.ru
 
  Will apply this one, the other one is a bit messy IMO, will have to
  think about it.
 

 Something like below should do I think.
 Patch looks good but it applies only on top of previous patch:
 https://patchwork.kernel.org/patch/529941/

 Why to have two patches for this fix?

 Both the patches can be merged as:

 diff --git a/drivers/input/touchscreen/ads7846.c
 b/drivers/input/touchscreen/ads7846.c
 index 14ea54b..940967b 100644
 --- a/drivers/input/touchscreen/ads7846.c
 +++ b/drivers/input/touchscreen/ads7846.c
 @@ -941,29 +941,30 @@ static int __devinit ads7846_setup_pendown(struct
 spi_device *spi, struct ads784
        struct ads7846_platform_data *pdata = spi-dev.platform_data;
        int err;

 -       /* REVISIT when the irq can be triggered active-low, or if for
        some
 +       /*
 +        * REVISIT when the irq can be triggered active-low, or if for
 some
         * reason the touchscreen isn't hooked up, we don't need to
         * access
         * the pendown state.
         */
 -       if (!pdata-get_pendown_state 
        !gpio_is_valid(pdata-gpio_pendown)) {
 -               dev_err(spi-dev, no get_pendown_state nor
                gpio_pendown?\n);
 -               return -EINVAL;
 -       }

        if (pdata-get_pendown_state) {
                ts-get_pendown_state = pdata-get_pendown_state;
 -               return 0;
 -       }
 +       } else if (gpio_is_valid(pdata-gpio_pendown)) {
 +
 +               err = gpio_request_one(pdata-gpio_pendown,
 GPIOF_DIR_IN,
 +
 ads7846_pendown);
 +               if (err) {
 +                       dev_err(spi-dev, failed to request pendown
 GPIO%d\n,
 +                               pdata-gpio_pendown);
 +                       return err;
 +               }

 -       err = gpio_request(pdata-gpio_pendown, ads7846_pendown);
 -       if (err) {
 -               dev_err(spi-dev, failed to request pendown GPIO%d\n,
 -                       pdata-gpio_pendown);
 -               return err;
 +               ts-gpio_pendown = pdata-gpio_pendown;
 +       } else {
 +               dev_err(spi-dev, no get_pendown_state nor
 gpio_pendown?\n);
 +               return -EINVAL;
        }

 -       ts-gpio_pendown = pdata-gpio_pendown;
 -
        return 0;
  }

 @@ -1353,7 +1354,7 @@ static int __devinit ads7846_probe(struct
 spi_device *spi)
  err_put_regulator:
        regulator_put(ts-reg);
  err_free_gpio:
 -       if (ts-gpio_pendown != -1)
 +       if (!ts-get_pendown_state)
                gpio_free(ts-gpio_pendown);
  err_cleanup_filter:
        if (ts-filter_cleanup)
 @@ -1383,8 +1384,13 @@ static int __devexit ads7846_remove(struct
 spi_device *spi)
        regulator_disable(ts-reg);
        regulator_put(ts-reg);

 -       if (ts-gpio_pendown != -1)
 +       if (!ts-get_pendown_state) {
 +               /*
 +                * If we are not using specialized pendown method we
 must
 +                * have been relying on gpio we set up ourselves.
 +                */
                gpio_free(ts-gpio_pendown);
 +       }

        if (ts-filter_cleanup)
                ts-filter_cleanup(ts-filter_data);



 --
 Dmitry


 Input: ads7846 - check proper condition when freeing gpio

 From: Dmitry Torokhov dmitry.torok...@gmail.com

 When driver uses custom pendown detection method gpio_pendown is not
 set up and so we should not try to free it, otherwise we are presented
 with:

 [ cut here ]
 WARNING: at drivers/gpio/gpiolib.c:1258 gpio_free+0x100/0x12c()
 Modules linked in:
 [c0061208] (unwind_backtrace+0x0/0xe4) from 
 [c0091f58](warn_slowpath_common+0x4c/0x64)
 [c0091f58] (warn_slowpath_common+0x4c/0x64) from 
 [c0091f88](warn_slowpath_null+0x18/0x1c)
 [c0091f88] (warn_slowpath_null+0x18/0x1c) from 
 [c024e610](gpio_free+0x100/0x12c)
 [c024e610] (gpio_free+0x100/0x12c) from 
 [c03e9fbc](ads7846_probe+0xa38/0xc5c)
 [c03e9fbc] (ads7846_probe+0xa38/0xc5c) from 
 [c02cff14](spi_drv_probe+0x18/0x1c)
 [c02cff14] (spi_drv_probe+0x18/0x1c) from 
 [c028bca4](driver_probe_device+0xc8/0x184)
 [c028bca4] (driver_probe_device+0xc8/0x184) from 
 [c028bdc8](__driver_attach+0x68/0x8c)
 [c028bdc8] (__driver_attach+0x68/0x8c) from 
 [c028b4c8](bus_for_each_dev+0x48/0x74)
 [c028b4c8] (bus_for_each_dev+0x48/0x74) from 
 [c028ae08](bus_add_driver+0xa0/0x220)
 [c028ae08] (bus_add_driver+0xa0/0x220) from 

[PATCH 0/5] OMAP: HSMMC: hwmod adaptation

2011-02-02 Thread Kishore Kadiyala
Adding hwmod data for hsmmc device on OMAP2420/OMAP2430/OMAP3/OMAP4.
Adapting the omap_hsmmc driver to hwmod framework.

The patch series is based on v2.6.38-rc3 and tested on OMAP4430SDP  
OMAP3430SDP.

Testing pending on OMAP2420SDP  OMAP2430SDP since mmc/sd cards are not getting
detected. Currently omap2_hsmmc_init call is missing in the board files, but 
updating it is not helping though.
Investigation is under progress and any pointers on working version of MMC/SD on
OMAP2420/2430 SDP would be helpful.


Kishore Kadiyala (2):
  OMAP2420: hwmod data: Add HSMMC
  OMAP: devices: Modify HSMMC device to adapt to hwmod framework

Paul Walmsley (2):
  OMAP2430: hwmod data: Add HSMMC
  OMAP3: hwmod data: Add HSMMC
  
Benoit Cousson (1):  
  OMAP4: hwmod data: Add HSMMC

 arch/arm/mach-omap1/devices.c  |   41 
 arch/arm/mach-omap2/board-n8x0.c   |6 +-
 arch/arm/mach-omap2/devices.c  |  207 -
 arch/arm/mach-omap2/hsmmc.c|6 +-
 arch/arm/mach-omap2/omap_hwmod_2420_data.c |   88 +++
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |  155 +
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  221 ++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |  339 
 arch/arm/mach-omap2/prcm-common.h  |2 +
 arch/arm/mach-omap2/prm-regbits-34xx.h |4 +
 arch/arm/plat-omap/devices.c   |   50 
 arch/arm/plat-omap/include/plat/mmc.h  |   43 ++---
 drivers/mmc/host/omap_hsmmc.c  |4 +-
 13 files changed, 916 insertions(+), 250 deletions(-)

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


[PATCH 1/5] OMAP2420: hwmod data: Add HSMMC

2011-02-02 Thread Kishore Kadiyala
Update the omap2420 hwmod data with the HSMMC info.
Add a device attribute structure which will be used
by the host driver to find whether the HSMMC controller
supports DUAL VOLT cards.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_2420_data.c |   88 
 arch/arm/plat-omap/include/plat/mmc.h  |7 ++
 2 files changed, 95 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 b85c630..1fbb618 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -18,6 +18,7 @@
 #include plat/serial.h
 #include plat/i2c.h
 #include plat/gpio.h
+#include plat/mmc.h
 
 #include omap_hwmod_common_data.h
 
@@ -44,6 +45,7 @@ static struct omap_hwmod omap2420_gpio2_hwmod;
 static struct omap_hwmod omap2420_gpio3_hwmod;
 static struct omap_hwmod omap2420_gpio4_hwmod;
 static struct omap_hwmod omap2420_dma_system_hwmod;
+static struct omap_hwmod omap2420_mmc1_hwmod;
 
 /* L3 - L4_CORE interface */
 static struct omap_hwmod_ocp_if omap2420_l3_main__l4_core = {
@@ -95,6 +97,24 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__l4_wkup = {
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* L4 CORE - MMC1 interface */
+static struct omap_hwmod_addr_space omap2420_mmc1_addr_space[] = {
+   {
+   .pa_start   = 0x4809c000,
+   .pa_end = 0x4809c07f,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2420_l4_core__mmc1 = {
+   .master = omap2420_l4_core_hwmod,
+   .slave  = omap2420_mmc1_hwmod,
+   .clk= mmchs1_ick,
+   .addr   = omap2420_mmc1_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap2420_mmc1_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 /* L4 CORE - UART1 interface */
 static struct omap_hwmod_addr_space omap2420_uart1_addr_space[] = {
{
@@ -196,6 +216,7 @@ static struct omap_hwmod_ocp_if *omap2420_l4_core_slaves[] 
= {
 /* Master interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap2420_l4_core_masters[] = {
omap2420_l4_core__l4_wkup,
+   omap2420_l4_core__mmc1,
omap2_l4_core__uart1,
omap2_l4_core__uart2,
omap2_l4_core__uart3,
@@ -864,6 +885,72 @@ static struct omap_hwmod omap2420_dma_system_hwmod = {
.flags  = HWMOD_NO_IDLEST,
 };
 
+/* MMC/SD/SDIO common */
+
+static struct omap_hwmod_class_sysconfig mmc_sysc = {
+   .rev_offs   = 0x3c,
+   .sysc_offs  = 0x64,
+   .syss_offs  = 0x68,
+   .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+  SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class mmc_class = {
+   .name = mmc,
+   .sysc = mmc_sysc,
+};
+
+/* MMC/SD/SDIO1 */
+
+static struct mmc_dev_attr mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
+static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = {
+   { .irq = 83 },
+};
+
+static struct omap_hwmod_dma_info mmc1_sdma_reqs[] = {
+   { .name = tx, .dma_req = 61 }, /* DMA_MMC1_TX */
+   { .name = rx, .dma_req = 62 }, /* DMA_MMC1_RX */
+};
+
+static struct omap_hwmod_opt_clk mmc1_opt_clks[] = {
+   { .role = dbck, .clk = mmchsdb_fck },
+};
+
+static struct omap_hwmod_ocp_if *omap2420_mmc1_slaves[] = {
+   omap2420_l4_core__mmc1,
+};
+
+static struct omap_hwmod omap2420_mmc1_hwmod = {
+   .name   = mmc1_hwmod,
+   .mpu_irqs   = mmc1_mpu_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(mmc1_mpu_irqs),
+   .sdma_reqs  = mmc1_sdma_reqs,
+   .sdma_reqs_cnt  = ARRAY_SIZE(mmc1_sdma_reqs),
+   .opt_clks   = mmc1_opt_clks,
+   .opt_clks_cnt   = ARRAY_SIZE(mmc1_opt_clks),
+   .main_clk   = mmchs1_fck,
+   .prcm   = {
+   .omap2 = {
+   .module_offs = CORE_MOD,
+   .prcm_reg_id = 1,
+   .module_bit  = OMAP2420_EN_MMC_SHIFT,
+   .idlest_reg_id = 1,
+   .idlest_idle_bit = OMAP2420_ST_MMC_SHIFT,
+   },
+   },
+   .slaves = omap2420_mmc1_slaves,
+   .slaves_cnt = ARRAY_SIZE(omap2420_mmc1_slaves),
+   .class  = mmc_class,
+   .dev_attr   = mmc1_dev_attr,
+   .omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
+};
+
 static __initdata struct omap_hwmod *omap2420_hwmods[] = {
omap2420_l3_main_hwmod,
omap2420_l4_core_hwmod,
@@ -871,6 +958,7 @@ static __initdata struct omap_hwmod *omap2420_hwmods[] = {
omap2420_mpu_hwmod,
omap2420_iva_hwmod

[PATCH 5/5] OMAP: devices: Modify HSMMC device to adapt to hwmod framework

2011-02-02 Thread Kishore Kadiyala
Changes involves:
1) Remove controller reset in devices.c which is taken care
   by hwmod framework.
2) Removing all base address macro defines.
3) Using omap-device layer to register device and utilizing data from
   hwmod data file for base address, dma channel number, Irq_number,
   device attribute.
4) Update the driver to use dev_attr to find whether controller
   supports dual volt cards.
5) Moving omap_mmc_add api from plat-omap/devices.c to mach-omap1/devices.c

Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
---
 arch/arm/mach-omap1/devices.c |   41 +++
 arch/arm/mach-omap2/board-n8x0.c  |6 +-
 arch/arm/mach-omap2/devices.c |  207 +++--
 arch/arm/mach-omap2/hsmmc.c   |6 +-
 arch/arm/plat-omap/devices.c  |   50 
 arch/arm/plat-omap/include/plat/mmc.h |   36 ++-
 drivers/mmc/host/omap_hsmmc.c |4 +-
 7 files changed, 100 insertions(+), 250 deletions(-)

diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index b0f4c23..eae41b6 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -72,6 +72,47 @@ static inline void omap_init_mbox(void) { }
 
 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
 
+#define OMAP_MMC_NR_RES2
+
+int __init omap_mmc_add(const char *name, int id, unsigned long base,
+   unsigned long size, unsigned int irq,
+   struct omap_mmc_platform_data *data)
+{
+   struct platform_device *pdev;
+   struct resource res[OMAP_MMC_NR_RES];
+   int ret;
+
+   pdev = platform_device_alloc(name, id);
+   if (!pdev)
+   return -ENOMEM;
+
+   memset(res, 0, OMAP_MMC_NR_RES * sizeof(struct resource));
+   res[0].start = base;
+   res[0].end = base + size - 1;
+   res[0].flags = IORESOURCE_MEM;
+   res[1].start = irq;
+   res[1].end = irq;
+   res[1].flags = IORESOURCE_IRQ;
+
+   ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
+   if (ret == 0)
+   ret = platform_device_add_data(pdev, data, sizeof(*data));
+   if (ret)
+   goto fail;
+
+   ret = platform_device_add(pdev);
+   if (ret)
+   goto fail;
+
+   /* return device handle to board setup code */
+   data-dev = pdev-dev;
+   return 0;
+
+fail:
+   platform_device_put(pdev);
+   return ret;
+}
+
 static inline void omap1_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
int controller_nr)
 {
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index 1cb53bc..5c9cd31 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -594,8 +594,6 @@ static struct omap_mmc_platform_data mmc1_data = {
},
 };
 
-static struct omap_mmc_platform_data *mmc_data[OMAP24XX_NR_MMC];
-
 static void __init n8x0_mmc_init(void)
 
 {
@@ -637,8 +635,8 @@ static void __init n8x0_mmc_init(void)
gpio_direction_output(N810_EMMC_VIO_GPIO, 0);
}
 
-   mmc_data[0] = mmc1_data;
-   omap2_init_mmc(mmc_data, OMAP24XX_NR_MMC);
+   hsmmc_data[0] = mmc1_data;
+   omap_hwmod_for_each_by_class(mmc, omap2_init_mmc, NULL);
 }
 #else
 
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 2c9c912..aa07264 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -610,112 +610,6 @@ static inline void omap_init_aes(void) { }
 
 /*-*/
 
-#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
-
-#define MMCHS_SYSCONFIG0x0010
-#define MMCHS_SYSCONFIG_SWRESET(1  1)
-#define MMCHS_SYSSTATUS0x0014
-#define MMCHS_SYSSTATUS_RESETDONE  (1  0)
-
-static struct platform_device dummy_pdev = {
-   .dev = {
-   .bus = platform_bus_type,
-   },
-};
-
-/**
- * omap_hsmmc_reset() - Full reset of each HS-MMC controller
- *
- * Ensure that each MMC controller is fully reset.  Controllers
- * left in an unknown state (by bootloader) may prevent retention
- * or OFF-mode.  This is especially important in cases where the
- * MMC driver is not enabled, _or_ built as a module.
- *
- * In order for reset to work, interface, functional and debounce
- * clocks must be enabled.  The debounce clock comes from func_32k_clk
- * and is not under SW control, so we only enable i- and f-clocks.
- **/
-static void __init omap_hsmmc_reset(void)
-{
-   u32 i, nr_controllers;
-   struct clk *iclk, *fclk;
-
-   if (cpu_is_omap242x())
-   return;
-
-   nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC :
-   (cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC);
-
-   for (i = 0; i

[PATCH 3/5] OMAP3: hwmod data: Add HSMMC

2011-02-02 Thread Kishore Kadiyala
From: Paul Walmsley p...@pwsan.com

Update the omap3 hwmod data with the HSMMC info.

Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Rajendra Nayak rna...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  221 
 arch/arm/mach-omap2/prcm-common.h  |2 +
 arch/arm/mach-omap2/prm-regbits-34xx.h |4 +
 3 files changed, 227 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 8d81813..47ca2ee 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -21,6 +21,7 @@
 #include plat/l4_3xxx.h
 #include plat/i2c.h
 #include plat/gpio.h
+#include plat/mmc.h
 #include plat/smartreflex.h
 
 #include omap_hwmod_common_data.h
@@ -107,6 +108,9 @@ static struct omap_hwmod omap3xxx_uart1_hwmod;
 static struct omap_hwmod omap3xxx_uart2_hwmod;
 static struct omap_hwmod omap3xxx_uart3_hwmod;
 static struct omap_hwmod omap3xxx_uart4_hwmod;
+static struct omap_hwmod omap3xxx_mmc1_hwmod;
+static struct omap_hwmod omap3xxx_mmc2_hwmod;
+static struct omap_hwmod omap3xxx_mmc3_hwmod;
 
 /* L4_CORE - L4_WKUP interface */
 static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = {
@@ -301,6 +305,63 @@ static struct omap_hwmod_ocp_if omap3_l4_core__sr2 = {
.user   = OCP_USER_MPU,
 };
 
+/* L4 CORE - MMC1 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc1_addr_space[] = {
+   {
+   .pa_start   = 0x4809c000,
+   .pa_end = 0x4809c1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc1 = {
+   .master = omap3xxx_l4_core_hwmod,
+   .slave  = omap3xxx_mmc1_hwmod,
+   .clk= mmchs1_ick,
+   .addr   = omap3xxx_mmc1_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mmc1_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+   .flags  = OMAP_FIREWALL_L4
+};
+
+/* L4 CORE - MMC2 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc2_addr_space[] = {
+   {
+   .pa_start   = 0x480b4000,
+   .pa_end = 0x480b41ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc2 = {
+   .master = omap3xxx_l4_core_hwmod,
+   .slave  = omap3xxx_mmc2_hwmod,
+   .clk= mmchs2_ick,
+   .addr   = omap3xxx_mmc2_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mmc2_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+   .flags  = OMAP_FIREWALL_L4
+};
+
+/* L4 CORE - MMC3 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc3_addr_space[] = {
+   {
+   .pa_start   = 0x480ad000,
+   .pa_end = 0x480ad1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc3 = {
+   .master = omap3xxx_l4_core_hwmod,
+   .slave  = omap3xxx_mmc3_hwmod,
+   .clk= mmchs3_ick,
+   .addr   = omap3xxx_mmc3_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mmc3_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+   .flags  = OMAP_FIREWALL_L4
+};
+
 /* Slave interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap3xxx_l4_core_slaves[] = {
omap3xxx_l3_main__l4_core,
@@ -1356,11 +1417,171 @@ static struct omap_hwmod omap36xx_sr2_hwmod = {
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3630ES1),
 };
 
+/* MMC/SD/SDIO common */
+
+static struct omap_hwmod_class_sysconfig mmc_sysc = {
+   .rev_offs   = 0x1fc,
+   .sysc_offs  = 0x10,
+   .syss_offs  = 0x14,
+   .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+  SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class mmc_class = {
+   .name = mmc,
+   .sysc = mmc_sysc,
+};
+
+/* MMC/SD/SDIO1 */
+
+static struct mmc_dev_attr omap_mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
+static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = {
+   { .irq = 83, },
+};
+
+static struct omap_hwmod_dma_info mmc1_sdma_reqs[] = {
+   { .name = tx, .dma_req = 61, },
+   { .name = rx, .dma_req = 62, },
+};
+
+static struct omap_hwmod_opt_clk mmc1_opt_clks[] = {
+   { .role = dbck, .clk = omap_32k_fck, },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_mmc1_slaves

[PATCH 4/5] OMAP4: hwmod data: Add HSMMC

2011-02-02 Thread Kishore Kadiyala
From: Benoit Cousson b-cous...@ti.com

Update the omap4 hwmod data with the HSMMC info.

Signed-off-by: Benoit Cousson b-cous...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |  339 
 1 files changed, 339 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index c2806bd..ec46835 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -24,6 +24,7 @@
 #include plat/cpu.h
 #include plat/gpio.h
 #include plat/dma.h
+#include plat/mmc.h
 
 #include omap_hwmod_common_data.h
 
@@ -53,6 +54,8 @@ static struct omap_hwmod omap44xx_l4_abe_hwmod;
 static struct omap_hwmod omap44xx_l4_cfg_hwmod;
 static struct omap_hwmod omap44xx_l4_per_hwmod;
 static struct omap_hwmod omap44xx_l4_wkup_hwmod;
+static struct omap_hwmod omap44xx_mmc1_hwmod;
+static struct omap_hwmod omap44xx_mmc2_hwmod;
 static struct omap_hwmod omap44xx_mpu_hwmod;
 static struct omap_hwmod omap44xx_mpu_private_hwmod;
 
@@ -229,6 +232,22 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l3_main_1 
= {
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* mmc1 - l3_main_1 */
+static struct omap_hwmod_ocp_if omap44xx_mmc1__l3_main_1 = {
+   .master = omap44xx_mmc1_hwmod,
+   .slave  = omap44xx_l3_main_1_hwmod,
+   .clk= l3_div_ck,
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* mmc2 - l3_main_1 */
+static struct omap_hwmod_ocp_if omap44xx_mmc2__l3_main_1 = {
+   .master = omap44xx_mmc2_hwmod,
+   .slave  = omap44xx_l3_main_1_hwmod,
+   .clk= l3_div_ck,
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 /* mpu - l3_main_1 */
 static struct omap_hwmod_ocp_if omap44xx_mpu__l3_main_1 = {
.master = omap44xx_mpu_hwmod,
@@ -242,6 +261,8 @@ static struct omap_hwmod_ocp_if 
*omap44xx_l3_main_1_slaves[] = {
omap44xx_dsp__l3_main_1,
omap44xx_l3_main_2__l3_main_1,
omap44xx_l4_cfg__l3_main_1,
+   omap44xx_mmc1__l3_main_1,
+   omap44xx_mmc2__l3_main_1,
omap44xx_mpu__l3_main_1,
 };
 
@@ -1435,6 +1456,317 @@ static struct omap_hwmod omap44xx_iva_hwmod = {
 };
 
 /*
+ * 'mmc' class
+ * multimedia card high-speed/sd/sdio (mmc/sd/sdio) host controller
+ */
+
+static struct omap_hwmod_class_sysconfig omap44xx_mmc_sysc = {
+   .rev_offs   = 0x,
+   .sysc_offs  = 0x0010,
+   .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_MIDLEMODE |
+  SYSC_HAS_RESET_STATUS | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_SOFTRESET),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
+  SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
+  MSTANDBY_SMART),
+   .sysc_fields= omap_hwmod_sysc_type2,
+};
+
+static struct omap_hwmod_class omap44xx_mmc_hwmod_class = {
+   .name   = mmc,
+   .sysc   = omap44xx_mmc_sysc,
+};
+
+/* mmc1 */
+static struct omap_hwmod_irq_info omap44xx_mmc1_irqs[] = {
+   { .irq = 83 + OMAP44XX_IRQ_GIC_START },
+};
+
+static struct omap_hwmod_dma_info omap44xx_mmc1_sdma_reqs[] = {
+   { .name = tx, .dma_req = 60 + OMAP44XX_DMA_REQ_START },
+   { .name = rx, .dma_req = 61 + OMAP44XX_DMA_REQ_START },
+};
+
+/* mmc1 master ports */
+static struct omap_hwmod_ocp_if *omap44xx_mmc1_masters[] = {
+   omap44xx_mmc1__l3_main_1,
+};
+
+static struct omap_hwmod_addr_space omap44xx_mmc1_addrs[] = {
+   {
+   .pa_start   = 0x4809c000,
+   .pa_end = 0x4809c3ff,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+/* l4_per - mmc1 */
+static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc1 = {
+   .master = omap44xx_l4_per_hwmod,
+   .slave  = omap44xx_mmc1_hwmod,
+   .clk= l4_div_ck,
+   .addr   = omap44xx_mmc1_addrs,
+   .addr_cnt   = ARRAY_SIZE(omap44xx_mmc1_addrs),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* mmc1 slave ports */
+static struct omap_hwmod_ocp_if *omap44xx_mmc1_slaves[] = {
+   omap44xx_l4_per__mmc1,
+};
+
+static struct mmc_dev_attr omap_mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
+static struct omap_hwmod omap44xx_mmc1_hwmod = {
+   .name   = mmc1,
+   .class  = omap44xx_mmc_hwmod_class,
+   .mpu_irqs   = omap44xx_mmc1_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(omap44xx_mmc1_irqs),
+   .sdma_reqs  = omap44xx_mmc1_sdma_reqs,
+   .sdma_reqs_cnt  = ARRAY_SIZE(omap44xx_mmc1_sdma_reqs),
+   .main_clk   = mmc1_fck,
+   .prcm = {
+   .omap4 = {
+   .clkctrl_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL,
+   },
+   },
+   .slaves = omap44xx_mmc1_slaves

[PATCH 2/5] OMAP2430: hwmod data: Add HSMMC

2011-02-02 Thread Kishore Kadiyala
From: Paul Walmsley p...@pwsan.com

Update the omap2430 hwmod data with the HSMMC info.
Also update the device attribute structure.

Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Rajendra Nayak rna...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |  155 
 1 files changed, 155 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 8ecfbcd..1fbc5c4 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -18,6 +18,7 @@
 #include plat/serial.h
 #include plat/i2c.h
 #include plat/gpio.h
+#include plat/mmc.h
 
 #include omap_hwmod_common_data.h
 
@@ -45,6 +46,8 @@ static struct omap_hwmod omap2430_gpio3_hwmod;
 static struct omap_hwmod omap2430_gpio4_hwmod;
 static struct omap_hwmod omap2430_gpio5_hwmod;
 static struct omap_hwmod omap2430_dma_system_hwmod;
+static struct omap_hwmod omap2430_mmc1_hwmod;
+static struct omap_hwmod omap2430_mmc2_hwmod;
 
 /* L3 - L4_CORE interface */
 static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = {
@@ -189,6 +192,42 @@ static struct omap_hwmod_ocp_if omap2_l4_core__uart3 = {
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* L4 CORE - MMC1 interface */
+static struct omap_hwmod_addr_space omap2430_mmc1_addr_space[] = {
+   {
+   .pa_start   = 0x4809c000,
+   .pa_end = 0x4809c1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__mmc1 = {
+   .master = omap2430_l4_core_hwmod,
+   .slave  = omap2430_mmc1_hwmod,
+   .clk= mmchs1_ick,
+   .addr   = omap2430_mmc1_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap2430_mmc1_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 CORE - MMC2 interface */
+static struct omap_hwmod_addr_space omap2430_mmc2_addr_space[] = {
+   {
+   .pa_start   = 0x480b4000,
+   .pa_end = 0x480b41ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = {
+   .master = omap2430_l4_core_hwmod,
+   .slave  = omap2430_mmc2_hwmod,
+   .addr   = omap2430_mmc2_addr_space,
+   .clk= mmchs1_ick,
+   .addr_cnt   = ARRAY_SIZE(omap2430_mmc2_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_main__l4_core,
@@ -197,6 +236,8 @@ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] 
= {
 /* Master interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap2430_l4_core_masters[] = {
omap2430_l4_core__l4_wkup,
+   omap2430_l4_core__mmc1,
+   omap2430_l4_core__mmc2,
 };
 
 /* L4 CORE */
@@ -919,6 +960,118 @@ static struct omap_hwmod omap2430_dma_system_hwmod = {
.flags  = HWMOD_NO_IDLEST,
 };
 
+/* MMC/SD/SDIO common */
+
+static struct omap_hwmod_class_sysconfig mmc_sysc = {
+   .rev_offs   = 0x1fc,
+   .sysc_offs  = 0x10,
+   .syss_offs  = 0x14,
+   .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+  SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class mmc_class = {
+   .name = mmc,
+   .sysc = mmc_sysc,
+};
+
+/* MMC/SD/SDIO1 */
+
+static struct mmc_dev_attr mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
+static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = {
+   { .irq = 83 },
+};
+
+static struct omap_hwmod_dma_info mmc1_sdma_reqs[] = {
+   { .name = tx, .dma_req = 61 }, /* DMA_MMC1_TX */
+   { .name = rx, .dma_req = 62 }, /* DMA_MMC1_RX */
+};
+
+static struct omap_hwmod_opt_clk mmc1_opt_clks[] = {
+   { .role = dbck, .clk = mmchsdb_fck },
+};
+
+static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] = {
+   omap2430_l4_core__mmc1,
+};
+
+static struct omap_hwmod omap2430_mmc1_hwmod = {
+   .name   = mmc1_hwmod,
+   .mpu_irqs   = mmc1_mpu_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(mmc1_mpu_irqs),
+   .sdma_reqs  = mmc1_sdma_reqs,
+   .sdma_reqs_cnt  = ARRAY_SIZE(mmc1_sdma_reqs),
+   .opt_clks   = mmc1_opt_clks,
+   .opt_clks_cnt   = ARRAY_SIZE(mmc1_opt_clks),
+   .main_clk   = mmchs1_fck,
+   .prcm   = {
+   .omap2 = {
+   .module_offs = CORE_MOD

Re: [PATCH] omap3: nand: bch ecc support added

2011-01-21 Thread Kishore Kadiyala
Ghorai,

snip

  #ifdef CONFIG_MTD_PARTITIONS
 diff --git a/drivers/mtd/nand/omap_bch_decoder.c 
 b/drivers/mtd/nand/omap_bch_decoder.c
 new file mode 100644
 index 000..da42bda
 --- /dev/null
 +++ b/drivers/mtd/nand/omap_bch_decoder.c
 @@ -0,0 +1,393 @@
 +/*
 + * drivers/mtd/nand/omap_omap_bch_decoder.c
 + *
 + * Whole BCH ECC Decoder (Post hardware generated syndrome decoding)
 + *
 + * Copyright (c) 2007 Texas Instruments
 + *
 + * Author: Sukumar Ghorai s-gho...@ti.com
 + *                Michael Fillinger m-fillin...@ti.com

Vimal was the original author who has created this file
[No change in file name/directory hierarchy].
It's not fair to remove Vimal's author and add your's.

Instead you should have kept his name and added your's.

snip

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


[PATCH 0/4] omap4: hsmmc: Adding ADMA support

2011-01-18 Thread Kishore Kadiyala
This patch series adds support for ADMA on MMC1  MMC2 controllers on OMAP4.
There is no performance improvement observed using ADMA over SDMA.
Advantage using ADMA could be reducing contention over SDMA.
Also the series includes some cleanup.

The series is based on 2.6.37-rc8 and tested on OMAP4430SDP  OMAP3430SDP.


Kishore Kadiyala (4):
  omap: hsmmc: Rename use_dma to xfer_type and define possible
transfers
  omap: hsmmc: Rename and cleanup omap_hsmmc_dma_cleanup
  omap4: hsmmc: Adding ADMA support for MMC1  MMC2 controllers
  omap4: hsmmc: enable ADMA for MMC1  MMC2

 arch/arm/mach-omap2/hsmmc.c   |   13 ++-
 arch/arm/plat-omap/include/plat/mmc.h |1 +
 drivers/mmc/host/omap_hsmmc.c |  241 +++--
 3 files changed, 210 insertions(+), 45 deletions(-)

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


[PATCH 1/4] omap: hsmmc: Rename use_dma to xfer_type and define possible transfers

2011-01-18 Thread Kishore Kadiyala
OMAP4 introduces dedicated internal DMA which is ADMA for its MMC
controllers HSMMC1  HSMMC2.
Renaming use_dma member of the struct omap_hsmmc_host to xfer_type
and defining the transfer modes PIO/SDMA/ADMA that can be used by the
MMC controller.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Reviewed-by: Sukumar Ghorai s-gho...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   20 +---
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 5d46021..8fb8586 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -125,6 +125,11 @@
 #define OMAP_MMC_SLEEP_TIMEOUT 1000
 #define OMAP_MMC_OFF_TIMEOUT   8000
 
+/* Transfer Modes used by MMC controller */
+#defineOMAP_HSMMC_USE_PIO_XFER 0
+#defineOMAP_HSMMC_USE_SDMA_XFER1
+#defineOMAP_HSMMC_USE_ADMA_XFER2
+
 /*
  * One controller can have multiple slots, like on some omap boards using
  * omap.c controller driver. Luckily this is not currently done on any known
@@ -172,7 +177,8 @@ struct omap_hsmmc_host {
u32 bytesleft;
int suspended;
int irq;
-   int use_dma, dma_ch;
+   int dma_ch;
+   int xfer_type; /* Transfer can be PIO/SDMA/ADMA */
int dma_line_tx, dma_line_rx;
int slot_id;
int got_dbclk;
@@ -545,7 +551,7 @@ static void omap_hsmmc_enable_irq(struct omap_hsmmc_host 
*host,
 {
unsigned int irq_mask;
 
-   if (host-use_dma)
+   if (host-xfer_type != OMAP_HSMMC_USE_PIO_XFER)
irq_mask = INT_EN_MASK  ~(BRR_ENABLE | BWR_ENABLE);
else
irq_mask = INT_EN_MASK;
@@ -835,7 +841,7 @@ omap_hsmmc_start_command(struct omap_hsmmc_host *host, 
struct mmc_command *cmd,
cmdreg = ~(DDIR);
}
 
-   if (host-use_dma)
+   if (host-xfer_type != OMAP_HSMMC_USE_PIO_XFER)
cmdreg |= DMA_EN;
 
host-req_in_progress = 1;
@@ -864,7 +870,7 @@ static void omap_hsmmc_request_done(struct omap_hsmmc_host 
*host, struct mmc_req
 
omap_hsmmc_disable_irq(host);
/* Do not complete the request if DMA is still in progress */
-   if (mrq-data  host-use_dma  dma_ch != -1)
+   if (mrq-data  host-xfer_type  dma_ch != -1)
return;
host-mrq = NULL;
mmc_request_done(host-mmc, mrq);
@@ -942,7 +948,7 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host 
*host, int errno)
host-dma_ch = -1;
spin_unlock(host-irq_lock);
 
-   if (host-use_dma  dma_ch != -1) {
+   if (host-xfer_type  dma_ch != -1) {
dma_unmap_sg(mmc_dev(host-mmc), host-data-sg, host-dma_len,
omap_hsmmc_get_dma_dir(host, host-data));
omap_free_dma(dma_ch);
@@ -1451,7 +1457,7 @@ omap_hsmmc_prepare_data(struct omap_hsmmc_host *host, 
struct mmc_request *req)
| (req-data-blocks  16));
set_data_timeout(host, req-data-timeout_ns, req-data-timeout_clks);
 
-   if (host-use_dma) {
+   if (host-xfer_type) {
ret = omap_hsmmc_start_dma_transfer(host, req);
if (ret != 0) {
dev_dbg(mmc_dev(host-mmc), MMC start dma failure\n);
@@ -2050,7 +2056,7 @@ static int __init omap_hsmmc_probe(struct platform_device 
*pdev)
host-mmc   = mmc;
host-pdata = pdata;
host-dev   = pdev-dev;
-   host-use_dma   = 1;
+   host-xfer_type = OMAP_HSMMC_USE_SDMA_XFER;
host-dev-dma_mask = pdata-dma_mask;
host-dma_ch= -1;
host-irq   = irq;
-- 
1.7.1

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


[PATCH 2/4] omap: hsmmc: Rename and cleanup omap_hsmmc_dma_cleanup

2011-01-18 Thread Kishore Kadiyala
Renaming omap_hsmmc_dma_cleanup as omap_hsmmc_xfer_cleanup and doing some
cleanup by handling the error  success scenarios during a transfer for
different xfer_type.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Reviewed-by: Sukumar Ghorai s-gho...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   52 ++--
 1 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 8fb8586..7cf0383 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -935,25 +935,37 @@ omap_hsmmc_cmd_done(struct omap_hsmmc_host *host, struct 
mmc_command *cmd)
 }
 
 /*
- * DMA clean up for command errors
+ * SDMA clean up during SDMA transfers.
+ * Also unmapping of sg list in case of error/transfer done during
+ * SDMA/ADMA transfers.
  */
-static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno)
+static void omap_hsmmc_xfer_cleanup(struct omap_hsmmc_host *host, int errno)
 {
int dma_ch;
+   struct mmc_data *data = errno ? host-data : host-mrq-data;
 
-   host-data-error = errno;
-
-   spin_lock(host-irq_lock);
-   dma_ch = host-dma_ch;
-   host-dma_ch = -1;
-   spin_unlock(host-irq_lock);
-
-   if (host-xfer_type  dma_ch != -1) {
-   dma_unmap_sg(mmc_dev(host-mmc), host-data-sg, host-dma_len,
-   omap_hsmmc_get_dma_dir(host, host-data));
+   switch (host-xfer_type) {
+   case OMAP_HSMMC_USE_SDMA_XFER:
+   spin_lock(host-irq_lock);
+   dma_ch = host-dma_ch;
+   host-dma_ch = -1;
+   spin_unlock(host-irq_lock);
+   if (dma_ch != -1)
+   dma_unmap_sg(mmc_dev(host-mmc), data-sg,
+   host-dma_len,
+   omap_hsmmc_get_dma_dir(host, data));
omap_free_dma(dma_ch);
+   break;
+   case OMAP_HSMMC_USE_PIO_XFER:
+   /* TODO */
+   break;
+   default:
+   dev_dbg(mmc_dev(host-mmc), Unknown xfer_type\n);
+   }
+   if (errno) {
+   host-data-error = errno;
+   host-data = NULL;
}
-   host-data = NULL;
 }
 
 /*
@@ -1059,7 +1071,7 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host 
*host, int status)
}
if (host-data || host-response_busy) {
if (host-data)
-   omap_hsmmc_dma_cleanup(host,
+   omap_hsmmc_xfer_cleanup(host,
-ETIMEDOUT);
host-response_busy = 0;
omap_hsmmc_reset_controller_fsm(host, SRD);
@@ -1072,7 +1084,7 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host 
*host, int status)
-ETIMEDOUT : -EILSEQ;
 
if (host-data)
-   omap_hsmmc_dma_cleanup(host, err);
+   omap_hsmmc_xfer_cleanup(host, err);
else
host-mrq-cmd-error = err;
host-response_busy = 0;
@@ -1310,7 +1322,7 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, 
void *cb_data)
 {
struct omap_hsmmc_host *host = cb_data;
struct mmc_data *data = host-mrq-data;
-   int dma_ch, req_in_progress;
+   int req_in_progress;
 
if (!(ch_status  OMAP_DMA_BLOCK_IRQ)) {
dev_warn(mmc_dev(host-mmc), unexpected dma status %x\n,
@@ -1332,16 +1344,10 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, 
void *cb_data)
spin_unlock(host-irq_lock);
return;
}
-
-   dma_unmap_sg(mmc_dev(host-mmc), data-sg, host-dma_len,
-   omap_hsmmc_get_dma_dir(host, data));
-
req_in_progress = host-req_in_progress;
-   dma_ch = host-dma_ch;
-   host-dma_ch = -1;
spin_unlock(host-irq_lock);
 
-   omap_free_dma(dma_ch);
+   omap_hsmmc_xfer_cleanup(host, 0);
 
/* If DMA has finished after TC, complete the request */
if (!req_in_progress) {
-- 
1.7.1

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


[PATCH 3/4] omap4: hsmmc: Adding ADMA support for MMC1 MMC2 controllers

2011-01-18 Thread Kishore Kadiyala
On OMAP4, MMC1  MMC2 controllers support ADMA feature which will
provide direct access to internal data.
Basically ADMA is a DMA controller embedded in the MMC controller.
It fetches each descriptor line [address+length+attributes] from a
descriptor table and executes the corresponding action [based on attributes].
Base address of Descriptor table in stored in MMCHS_ADMASAL register.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
Signed-off-by: Santosh Shilimkar santosh.shilim...@ti.com
Reviewed-by: Sukumar Ghorai s-gho...@ti.com
---
 arch/arm/plat-omap/include/plat/mmc.h |1 +
 drivers/mmc/host/omap_hsmmc.c |  223 +++--
 2 files changed, 184 insertions(+), 40 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/mmc.h 
b/arch/arm/plat-omap/include/plat/mmc.h
index f57f36a..b13e927 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -110,6 +110,7 @@ struct omap_mmc_platform_data {
/* we can put the features above into this variable */
 #define HSMMC_HAS_PBIAS(1  0)
 #define HSMMC_HAS_UPDATED_RESET(1  1)
+#define HSMMC_HAS_ADMA_SUPPORT (1  2)
unsigned features;
 
int switch_pin; /* gpio (card detect) */
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 7cf0383..aaa113b 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -51,12 +51,15 @@
 #define OMAP_HSMMC_RSP54   0x0118
 #define OMAP_HSMMC_RSP76   0x011C
 #define OMAP_HSMMC_DATA0x0120
+#define OMAP_HSMMC_PSTATE  0x0124
 #define OMAP_HSMMC_HCTL0x0128
 #define OMAP_HSMMC_SYSCTL  0x012C
 #define OMAP_HSMMC_STAT0x0130
 #define OMAP_HSMMC_IE  0x0134
 #define OMAP_HSMMC_ISE 0x0138
 #define OMAP_HSMMC_CAPA0x0140
+#define OMAP_HSMMC_ADMA_ES 0x0154
+#define OMAP_HSMMC_ADMA_SAL0x0158
 
 #define VS18   (1  26)
 #define VS30   (1  25)
@@ -104,6 +107,25 @@
 #define SRD(1  26)
 #define SOFTRESET  (1  1)
 #define RESETDONE  (1  0)
+#define DMAS   (0x2  3)
+#define CAPA_ADMA_SUPPORT  (1  19)
+#define ADMA_XFER_VALID(1  0)
+#define ADMA_XFER_END  (1  1)
+#define ADMA_XFER_LINK (1  4)
+#define ADMA_XFER_DESC (1  5)
+#define DMA_MNS_ADMA_MODE  (1  20)
+#define ADMA_ERR   (1  25)
+#define ADMA_XFER_INT  (1  3)
+
+#define ADMA_TABLE_SZ  (PAGE_SIZE)
+#define ADMA_TABLE_NUM_ENTRIES (ADMA_TABLE_SZ / sizeof(struct adma_desc_table))
+
+/*
+ * According to TRM, it is possible to transfer upto 64kB per ADMA table entry.
+ * But 64kB = 0x1 cannot be represented using a 16bit integer
+ * in 1 ADMA table row. Hence rounding it to a lesser value.
+ */
+#define ADMA_MAX_XFER_PER_ROW (63 * 1024)
 
 /*
  * FIXME: Most likely all the data using these _DEVID defines should come
@@ -146,6 +168,13 @@
 #define OMAP_HSMMC_WRITE(base, reg, val) \
__raw_writel((val), (base) + OMAP_HSMMC_##reg)
 
+/* ADMA descriptor table entry */
+struct adma_desc_table {
+   u16 attr;
+   u16 length;
+   dma_addr_t addr;
+};
+
 struct omap_hsmmc_host {
struct  device  *dev;
struct  mmc_host*mmc;
@@ -179,6 +208,8 @@ struct omap_hsmmc_host {
int irq;
int dma_ch;
int xfer_type; /* Transfer can be PIO/SDMA/ADMA */
+   struct adma_desc_table  *adma_table;
+   dma_addr_t  phy_adma_table;
int dma_line_tx, dma_line_rx;
int slot_id;
int got_dbclk;
@@ -877,6 +908,44 @@ static void omap_hsmmc_request_done(struct omap_hsmmc_host 
*host, struct mmc_req
 }
 
 /*
+ * SDMA clean up during SDMA transfers.
+ * Also unmapping of sg list in case of error/transfer done during
+ * SDMA/ADMA transfers.
+ */
+static void omap_hsmmc_xfer_cleanup(struct omap_hsmmc_host *host, int errno)
+{
+   int dma_ch;
+   struct mmc_data *data = errno ? host-data : host-mrq-data;
+
+   switch (host-xfer_type) {
+   case OMAP_HSMMC_USE_SDMA_XFER:
+   spin_lock(host-irq_lock);
+   dma_ch = host-dma_ch;
+   host-dma_ch = -1;
+   spin_unlock(host-irq_lock);
+   if (dma_ch != -1)
+   dma_unmap_sg(mmc_dev(host-mmc), data-sg,
+   host-dma_len,
+   omap_hsmmc_get_dma_dir(host, data));
+   omap_free_dma(dma_ch);
+   break;
+   case OMAP_HSMMC_USE_ADMA_XFER:
+   dma_unmap_sg(mmc_dev(host-mmc), data-sg,
+   host-dma_len, omap_hsmmc_get_dma_dir(host, data

[PATCH 4/4] omap4: hsmmc: enable ADMA for MMC1 MMC2

2011-01-18 Thread Kishore Kadiyala
Enable ADMA support for MMC1  MMC2 controller on omap4 by updating
features of struct omap_mmc_platform_data.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
Reviewed-by: Sukumar Ghorai s-gho...@ti.com
---
 arch/arm/mach-omap2/hsmmc.c |   13 +++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index 34272e4..2ac7271 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -307,8 +307,17 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info 
*controllers)
else
mmc-slots[0].features |= HSMMC_HAS_PBIAS;
 
-   if (cpu_is_omap44xx()  (omap_rev()  OMAP4430_REV_ES1_0))
-   mmc-slots[0].features |= HSMMC_HAS_UPDATED_RESET;
+   /*
+* OMAP4: MMC1  MMC2 controllers support ADMA.
+* Default works with SDMA.
+* For ADMA support, update respective BIT in features.
+*/
+   if (cpu_is_omap44xx()) {
+   mmc-slots[0].features |= HSMMC_HAS_ADMA_SUPPORT;
+   if (omap_rev()  OMAP4430_REV_ES1_0)
+   mmc-slots[0].features |=
+   HSMMC_HAS_UPDATED_RESET;
+   }
 
switch (c-mmc) {
case 1:
-- 
1.7.1

--
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


omap4: hsmmc: Fix improper card detection while booting

2010-11-15 Thread kishore kadiyala
While booting OMAP4 ES2.0 boards, cards on MMC1 and MMC2 controllers
are not getting detected some times.

During reset of command/data line, wrong pointer to base address
was passed while read operation to SYSCTL register, thus impacting
the updated reset logic.
Passing correct base address fixes the issue.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Acked-by: Felipie Balbi ba...@ti.com
Cc: Tony Lindgren t...@atomide.com
Cc: Chris Ball   c...@laptop.org
Cc: Madhusudhan Chikkature madhu...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 82a1079..5d46021 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1002,7 +1002,7 @@ static inline void omap_hsmmc_reset_controller_fsm(struct 
omap_hsmmc_host
*host,
 * Monitor a 0-1 transition first
 */
if (mmc_slot(host).features  HSMMC_HAS_UPDATED_RESET) {
-   while ((!(OMAP_HSMMC_READ(host, SYSCTL)  bit))
+   while ((!(OMAP_HSMMC_READ(host-base, SYSCTL)  bit))
 (i++  limit))
cpu_relax();
}
-- 
1.7.1


--
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 v4 1/4] omap4 hsmmc: Adding card detect support for MMC1

2010-10-01 Thread kishore kadiyala
Ping !!

On Wed, Sep 29, 2010 at 4:11 PM, kishore kadiyala
kishorek.kadiy...@gmail.com wrote:
 Gentle Reminder !

 Regards,
 Kishore

 On Tue, Sep 28, 2010 at 12:22 PM, kishore kadiyala
 kishorek.kadiy...@gmail.com wrote:
 Hi Samuel,

 Could you please review this patch which touches mfd/twl6030-irq.c for
 card detect support
 of MMC1 controller on OMAP4.

 Regards,
 Kishore

 On Mon, Sep 27, 2010 at 1:25 PM, kishore kadiyala
 kishorek.kadiy...@gmail.com wrote:
 Cc: Samuel Ortiz sa...@linux.intel.com

 On Fri, Sep 24, 2010 at 10:43 PM, kishore kadiyala
 kishore.kadiy...@ti.com wrote:
 Adding card detect callback function and card detect configuration
 function for MMC1 Controller on OMAP4.

 Card detect configuration function does initial configuration of the
 MMC Control  PullUp-PullDown registers of Phoenix.

 For MMC1 Controller, card detect interrupt source is
 twl6030 which is non-gpio. The card detect call back function provides
 card present/absent status by reading MMC Control register present
 on twl6030.

 Since OMAP4 doesn't use any GPIO line as used in OMAP3 for card detect,
 the suspend/resume initialization which was done in omap_hsmmc_gpio_init
 previously is moved to the probe thus making it generic for both OMAP3  
 OMAP4.

 Cc: Tony Lindgren t...@atomide.com
 Cc: Andrew Morton a...@linux-foundation.org
 Cc: Madhusudhan Chikkature madhu...@ti.com
 Cc: Adrian Hunter adrian.hun...@nokia.com
 Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
 ---
  arch/arm/mach-omap2/board-4430sdp.c |    7 +++-
  drivers/mfd/twl6030-irq.c           |   73 
 +++
  drivers/mmc/host/omap_hsmmc.c       |    4 +-
  include/linux/i2c/twl.h             |   31 +++
  4 files changed, 112 insertions(+), 3 deletions(-)

 diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
 b/arch/arm/mach-omap2/board-4430sdp.c
 index 9447644..a49f285 100644
 --- a/arch/arm/mach-omap2/board-4430sdp.c
 +++ b/arch/arm/mach-omap2/board-4430sdp.c
 @@ -227,9 +227,14 @@ static int omap4_twl6030_hsmmc_late_init(struct 
 device *dev)
        struct omap_mmc_platform_data *pdata = dev-platform_data;

        /* Setting MMC1 Card detect Irq */
 -       if (pdev-id == 0)
 +       if (pdev-id == 0) {
 +               ret = twl6030_mmc_card_detect_config();
 +               if (ret)
 +                       pr_err(Failed configuring MMC1 card detect\n);
                pdata-slots[0].card_detect_irq = TWL6030_IRQ_BASE +
                                                MMCDETECT_INTR_OFFSET;
 +               pdata-slots[0].card_detect = twl6030_mmc_card_detect;
 +       }
        return ret;
  }

 diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c
 index 10bf228..2d3bb82 100644
 --- a/drivers/mfd/twl6030-irq.c
 +++ b/drivers/mfd/twl6030-irq.c
 @@ -36,6 +36,7 @@
  #include linux/irq.h
  #include linux/kthread.h
  #include linux/i2c/twl.h
 +#include linux/platform_device.h

  /*
  * TWL6030 (unlike its predecessors, which had two level interrupt 
 handling)
 @@ -223,6 +224,78 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset)
  }
  EXPORT_SYMBOL(twl6030_interrupt_mask);

 +int twl6030_mmc_card_detect_config(void)
 +{
 +       int ret;
 +       u8 reg_val = 0;
 +
 +       /* Unmasking the Card detect Interrupt line for MMC1 from Phoenix 
 */
 +       twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK,
 +                                               REG_INT_MSK_LINE_B);
 +       twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK,
 +                                               REG_INT_MSK_STS_B);
 +       /*
 +        * Intially Configuring MMC_CTRL for receving interrupts 
 +        * Card status on TWL6030 for MMC1
 +        */
 +       ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, 
 TWL6030_MMCCTRL);
 +       if (ret  0) {
 +               pr_err(twl6030: Failed to read MMCCTRL, error %d\n, ret);
 +               return ret;
 +       }
 +       reg_val = ~VMMC_AUTO_OFF;
 +       reg_val |= SW_FC;
 +       ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, 
 TWL6030_MMCCTRL);
 +       if (ret  0) {
 +               pr_err(twl6030: Failed to write MMCCTRL, error %d\n, 
 ret);
 +               return ret;
 +       }
 +
 +       /* Configuring PullUp-PullDown register */
 +       ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val,
 +                                               TWL6030_CFG_INPUT_PUPD3);
 +       if (ret  0) {
 +               pr_err(twl6030: Failed to read CFG_INPUT_PUPD3, error 
 %d\n,
 +                                                                       
 ret);
 +               return ret;
 +       }
 +       reg_val = ~(MMC_PU | MMC_PD);
 +       ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val,
 +                                               TWL6030_CFG_INPUT_PUPD3);
 +       if (ret  0) {
 +               pr_err(twl6030: Failed to write CFG_INPUT_PUPD3, error 
 %d\n,
 +                                                                       
 ret

Re: [PATCH v4 1/4] omap4 hsmmc: Adding card detect support for MMC1

2010-10-01 Thread kishore kadiyala
Samuel,

Sorry , I will ensure to CC you for MFD related changes in future.

Regards,
Kishore

On Fri, Oct 1, 2010 at 4:59 PM, Samuel Ortiz sa...@linux.intel.com wrote:
 On Fri, Oct 01, 2010 at 12:29:48PM +0530, kishore kadiyala wrote:
 Ping !!
 Applied !!

 BTW, please add the full patch when you cc me, so that I don't have to dig
 through patchwork to grab something I can git-am.

 Cheers,
 Samuel.


 On Wed, Sep 29, 2010 at 4:11 PM, kishore kadiyala
 kishorek.kadiy...@gmail.com wrote:
  Gentle Reminder !
 
  Regards,
  Kishore
 
  On Tue, Sep 28, 2010 at 12:22 PM, kishore kadiyala
  kishorek.kadiy...@gmail.com wrote:
  Hi Samuel,
 
  Could you please review this patch which touches mfd/twl6030-irq.c for
  card detect support
  of MMC1 controller on OMAP4.
 
  Regards,
  Kishore
 
  On Mon, Sep 27, 2010 at 1:25 PM, kishore kadiyala
  kishorek.kadiy...@gmail.com wrote:
  Cc: Samuel Ortiz sa...@linux.intel.com
 
  On Fri, Sep 24, 2010 at 10:43 PM, kishore kadiyala
  kishore.kadiy...@ti.com wrote:
  Adding card detect callback function and card detect configuration
  function for MMC1 Controller on OMAP4.
 
  Card detect configuration function does initial configuration of the
  MMC Control  PullUp-PullDown registers of Phoenix.
 
  For MMC1 Controller, card detect interrupt source is
  twl6030 which is non-gpio. The card detect call back function provides
  card present/absent status by reading MMC Control register present
  on twl6030.
 
  Since OMAP4 doesn't use any GPIO line as used in OMAP3 for card detect,
  the suspend/resume initialization which was done in omap_hsmmc_gpio_init
  previously is moved to the probe thus making it generic for both OMAP3 
   OMAP4.
 
  Cc: Tony Lindgren t...@atomide.com
  Cc: Andrew Morton a...@linux-foundation.org
  Cc: Madhusudhan Chikkature madhu...@ti.com
  Cc: Adrian Hunter adrian.hun...@nokia.com
  Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
  ---
   arch/arm/mach-omap2/board-4430sdp.c |    7 +++-
   drivers/mfd/twl6030-irq.c           |   73 
  +++
   drivers/mmc/host/omap_hsmmc.c       |    4 +-
   include/linux/i2c/twl.h             |   31 +++
   4 files changed, 112 insertions(+), 3 deletions(-)
 
  diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
  b/arch/arm/mach-omap2/board-4430sdp.c
  index 9447644..a49f285 100644
  --- a/arch/arm/mach-omap2/board-4430sdp.c
  +++ b/arch/arm/mach-omap2/board-4430sdp.c
  @@ -227,9 +227,14 @@ static int omap4_twl6030_hsmmc_late_init(struct 
  device *dev)
         struct omap_mmc_platform_data *pdata = dev-platform_data;
 
         /* Setting MMC1 Card detect Irq */
  -       if (pdev-id == 0)
  +       if (pdev-id == 0) {
  +               ret = twl6030_mmc_card_detect_config();
  +               if (ret)
  +                       pr_err(Failed configuring MMC1 card detect\n);
                 pdata-slots[0].card_detect_irq = TWL6030_IRQ_BASE +
                                                 MMCDETECT_INTR_OFFSET;
  +               pdata-slots[0].card_detect = twl6030_mmc_card_detect;
  +       }
         return ret;
   }
 
  diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c
  index 10bf228..2d3bb82 100644
  --- a/drivers/mfd/twl6030-irq.c
  +++ b/drivers/mfd/twl6030-irq.c
  @@ -36,6 +36,7 @@
   #include linux/irq.h
   #include linux/kthread.h
   #include linux/i2c/twl.h
  +#include linux/platform_device.h
 
   /*
   * TWL6030 (unlike its predecessors, which had two level interrupt 
  handling)
  @@ -223,6 +224,78 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset)
   }
   EXPORT_SYMBOL(twl6030_interrupt_mask);
 
  +int twl6030_mmc_card_detect_config(void)
  +{
  +       int ret;
  +       u8 reg_val = 0;
  +
  +       /* Unmasking the Card detect Interrupt line for MMC1 from 
  Phoenix */
  +       twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK,
  +                                               REG_INT_MSK_LINE_B);
  +       twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK,
  +                                               REG_INT_MSK_STS_B);
  +       /*
  +        * Intially Configuring MMC_CTRL for receving interrupts 
  +        * Card status on TWL6030 for MMC1
  +        */
  +       ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, 
  TWL6030_MMCCTRL);
  +       if (ret  0) {
  +               pr_err(twl6030: Failed to read MMCCTRL, error %d\n, 
  ret);
  +               return ret;
  +       }
  +       reg_val = ~VMMC_AUTO_OFF;
  +       reg_val |= SW_FC;
  +       ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, 
  TWL6030_MMCCTRL);
  +       if (ret  0) {
  +               pr_err(twl6030: Failed to write MMCCTRL, error %d\n, 
  ret);
  +               return ret;
  +       }
  +
  +       /* Configuring PullUp-PullDown register */
  +       ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val,
  +                                               
  TWL6030_CFG_INPUT_PUPD3);
  +       if (ret  0) {
  +               pr_err(twl6030

Re: [PATCH v4 1/4] omap4 hsmmc: Adding card detect support for MMC1

2010-10-01 Thread kishore kadiyala
On Fri, Oct 1, 2010 at 8:11 PM, Varadarajan, Charulatha ch...@ti.com wrote:

 snip

   diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
   index 6de90bf..e64894c 100644
   --- a/include/linux/i2c/twl.h
   +++ b/include/linux/i2c/twl.h
   @@ -141,6 +141,16 @@
    #define TWL6030_CHARGER_CTRL_INT_MASK  0x10
    #define TWL6030_CHARGER_FAULT_INT_MASK         0x60
  
   +#define TWL6030_MMCCTRL                0xEE
   +#define VMMC_AUTO_OFF                  (0x1  3)
   +#define SW_FC                          (0x1  2)
   +#define STS_MMC                        0x1
   +
   +#define TWL6030_CFG_INPUT_PUPD3        0xF2
   +#define MMC_PU                         (0x1  3)
   +#define MMC_PD                         (0x1  2)
   +
   +
  
    #define TWL4030_CLASS_ID               0x4030
    #define TWL6030_CLASS_ID               0x6030
   @@ -173,6 +183,27 @@ int twl_i2c_read(u8 mod_no, u8
 *value, u8 reg, unsigned num_bytes);
    int twl6030_interrupt_unmask(u8 bit_mask, u8 offset);
    int twl6030_interrupt_mask(u8 bit_mask, u8 offset);
  
   +/* Card detect Configuration for MMC1 Controller on OMAP4 */
   +#ifdef CONFIG_TWL4030_CORE
   +int twl6030_mmc_card_detect_config(void);
   +#else
   +static inline int twl6030_mmc_card_detect_config(void)
   +{
   +       pr_debug(twl6030_mmc_card_detect_config not
 supported\n);
   +       return 0;
   +}
   +#endif
   +
   +/* MMC1 Controller on OMAP4 uses Phoenix irq for
 Card detect */
   +#ifdef CONFIG_TWL4030_CORE
   +int twl6030_mmc_card_detect(struct device *dev, int slot);
   +#else
   +static inline int twl6030_mmc_card_detect(struct
 device *dev, int slot)
   +{
   +       pr_debug(Call back twl6030_mmc_card_detect
 not supported\n);

 Use dev_dbg() instead of pr_debug...
 Same comment applies across this patch series whereever pr_err/pr_debug
 APIs are used.

Couldn't get it  how it makes a difference ? could you explain

Regards,
Kishore

   +       return -EIO;
   +}
   +#endif

 snip
--
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 v2 3/4] omap4 hsmmc: Register offset handling

2010-10-01 Thread kishore kadiyala
Manju,

On Fri, Oct 1, 2010 at 8:32 PM, G, Manjunath Kondaiah manj...@ti.com wrote:



 -Original Message-
 From: linux-omap-ow...@vger.kernel.org
 [mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of
 Kadiyala, Kishore
 Sent: Saturday, September 18, 2010 10:04 PM
 To: linux-...@vger.kernel.org; linux-omap@vger.kernel.org;
 linux-arm-ker...@lists.infradead.org
 Cc: khil...@deeprootsystems.com; Cousson, Benoit
 Subject: [PATCH v2 3/4] omap4 hsmmc: Register offset handling

 The offset handling implementation of omap4 mmc registers
 which was already present can't be reused once hwmod
 modifications are done for mmc driver.
 Since hwmod data file for OMAP4 is an auto generated the base
 address for MMC will remain same as OMAP3 and thus the offset
 deviation of registers should be updated in the hsmmc driver.
 The omap-mmc platform data is updated with a register offset
 which will be updated and used in the driver accordingly.

 Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
 ---
  arch/arm/mach-omap2/devices.c         |    8 +++-
  arch/arm/mach-omap2/hsmmc.c           |    4 
  arch/arm/plat-omap/include/plat/mmc.h |    3 +++
  drivers/mmc/host/omap_hsmmc.c         |    2 +-
  4 files changed, 11 insertions(+), 6 deletions(-)

 diff --git a/arch/arm/mach-omap2/devices.c
 b/arch/arm/mach-omap2/devices.c index 2dbb265..bb7ec13 100644
 --- a/arch/arm/mach-omap2/devices.c
 +++ b/arch/arm/mach-omap2/devices.c
 @@ -745,13 +745,13 @@ void __init omap2_init_mmc(struct
 omap_mmc_platform_data **mmc_data,
               case 3:
                       if (!cpu_is_omap44xx())
                               return;
 -                     base = OMAP4_MMC4_BASE + OMAP4_MMC_REG_OFFSET;
 +                     base = OMAP4_MMC4_BASE;
                       irq = OMAP44XX_IRQ_MMC4;
                       break;
               case 4:
                       if (!cpu_is_omap44xx())
                               return;
 -                     base = OMAP4_MMC5_BASE + OMAP4_MMC_REG_OFFSET;
 +                     base = OMAP4_MMC5_BASE;
                       irq = OMAP44XX_IRQ_MMC5;
                       break;
               default:
 @@ -762,10 +762,8 @@ void __init omap2_init_mmc(struct
 omap_mmc_platform_data **mmc_data,
                       size = OMAP2420_MMC_SIZE;
                       name = mmci-omap;
               } else if (cpu_is_omap44xx()) {
 -                     if (i  3) {
 -                             base += OMAP4_MMC_REG_OFFSET;
 +                     if (i  3)
                               irq += OMAP44XX_IRQ_GIC_START;
 -                     }
                       size = OMAP4_HSMMC_SIZE;
                       name = mmci-omap-hs;
               } else {
 diff --git a/arch/arm/mach-omap2/hsmmc.c
 b/arch/arm/mach-omap2/hsmmc.c index c8f647b..49d76a7 100644
 --- a/arch/arm/mach-omap2/hsmmc.c
 +++ b/arch/arm/mach-omap2/hsmmc.c
 @@ -261,6 +261,10 @@ void __init omap2_hsmmc_init(struct
 omap2_hsmmc_info *controllers)
               mmc-slots[0].wires = c-wires;
               mmc-slots[0].internal_clock = !c-ext_clock;
               mmc-dma_mask = 0x;
 +             if (cpu_is_omap44xx())
 +                     mmc-reg_offset = OMAP4_MMC_REG_OFFSET;
 +             else
 +                     mmc-reg_offset = 0;

 1. Since you mentioned that, this is useful for hwmod, the
 register offsets should use enum and static tables. You can
 refer to i2c-omap.c for more details and dma hwmod review
 comments for more details.
 https://patchwork.kernel.org/patch/126251/

I've avoided using static tables for register offset handling as suggested
by Benoit for HSMMC driver.Instead had the offset updated in hsmmc.c
and used in driver.

Could you check the latest version V4
http://www.spinics.net/lists/linux-omap/msg37226.html



 2. Replace macros with inline functions for low level read/write
 functions.

Didn't touch this in the latest V4

Regards,
Kishore

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

--
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 v4 1/4] omap4 hsmmc: Adding card detect support for MMC1

2010-09-29 Thread kishore kadiyala
Gentle Reminder !

Regards,
Kishore

On Tue, Sep 28, 2010 at 12:22 PM, kishore kadiyala
kishorek.kadiy...@gmail.com wrote:
 Hi Samuel,

 Could you please review this patch which touches mfd/twl6030-irq.c for
 card detect support
 of MMC1 controller on OMAP4.

 Regards,
 Kishore

 On Mon, Sep 27, 2010 at 1:25 PM, kishore kadiyala
 kishorek.kadiy...@gmail.com wrote:
 Cc: Samuel Ortiz sa...@linux.intel.com

 On Fri, Sep 24, 2010 at 10:43 PM, kishore kadiyala
 kishore.kadiy...@ti.com wrote:
 Adding card detect callback function and card detect configuration
 function for MMC1 Controller on OMAP4.

 Card detect configuration function does initial configuration of the
 MMC Control  PullUp-PullDown registers of Phoenix.

 For MMC1 Controller, card detect interrupt source is
 twl6030 which is non-gpio. The card detect call back function provides
 card present/absent status by reading MMC Control register present
 on twl6030.

 Since OMAP4 doesn't use any GPIO line as used in OMAP3 for card detect,
 the suspend/resume initialization which was done in omap_hsmmc_gpio_init
 previously is moved to the probe thus making it generic for both OMAP3  
 OMAP4.

 Cc: Tony Lindgren t...@atomide.com
 Cc: Andrew Morton a...@linux-foundation.org
 Cc: Madhusudhan Chikkature madhu...@ti.com
 Cc: Adrian Hunter adrian.hun...@nokia.com
 Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
 ---
  arch/arm/mach-omap2/board-4430sdp.c |    7 +++-
  drivers/mfd/twl6030-irq.c           |   73 
 +++
  drivers/mmc/host/omap_hsmmc.c       |    4 +-
  include/linux/i2c/twl.h             |   31 +++
  4 files changed, 112 insertions(+), 3 deletions(-)

 diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
 b/arch/arm/mach-omap2/board-4430sdp.c
 index 9447644..a49f285 100644
 --- a/arch/arm/mach-omap2/board-4430sdp.c
 +++ b/arch/arm/mach-omap2/board-4430sdp.c
 @@ -227,9 +227,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device 
 *dev)
        struct omap_mmc_platform_data *pdata = dev-platform_data;

        /* Setting MMC1 Card detect Irq */
 -       if (pdev-id == 0)
 +       if (pdev-id == 0) {
 +               ret = twl6030_mmc_card_detect_config();
 +               if (ret)
 +                       pr_err(Failed configuring MMC1 card detect\n);
                pdata-slots[0].card_detect_irq = TWL6030_IRQ_BASE +
                                                MMCDETECT_INTR_OFFSET;
 +               pdata-slots[0].card_detect = twl6030_mmc_card_detect;
 +       }
        return ret;
  }

 diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c
 index 10bf228..2d3bb82 100644
 --- a/drivers/mfd/twl6030-irq.c
 +++ b/drivers/mfd/twl6030-irq.c
 @@ -36,6 +36,7 @@
  #include linux/irq.h
  #include linux/kthread.h
  #include linux/i2c/twl.h
 +#include linux/platform_device.h

  /*
  * TWL6030 (unlike its predecessors, which had two level interrupt handling)
 @@ -223,6 +224,78 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset)
  }
  EXPORT_SYMBOL(twl6030_interrupt_mask);

 +int twl6030_mmc_card_detect_config(void)
 +{
 +       int ret;
 +       u8 reg_val = 0;
 +
 +       /* Unmasking the Card detect Interrupt line for MMC1 from Phoenix */
 +       twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK,
 +                                               REG_INT_MSK_LINE_B);
 +       twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK,
 +                                               REG_INT_MSK_STS_B);
 +       /*
 +        * Intially Configuring MMC_CTRL for receving interrupts 
 +        * Card status on TWL6030 for MMC1
 +        */
 +       ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, 
 TWL6030_MMCCTRL);
 +       if (ret  0) {
 +               pr_err(twl6030: Failed to read MMCCTRL, error %d\n, ret);
 +               return ret;
 +       }
 +       reg_val = ~VMMC_AUTO_OFF;
 +       reg_val |= SW_FC;
 +       ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, 
 TWL6030_MMCCTRL);
 +       if (ret  0) {
 +               pr_err(twl6030: Failed to write MMCCTRL, error %d\n, ret);
 +               return ret;
 +       }
 +
 +       /* Configuring PullUp-PullDown register */
 +       ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val,
 +                                               TWL6030_CFG_INPUT_PUPD3);
 +       if (ret  0) {
 +               pr_err(twl6030: Failed to read CFG_INPUT_PUPD3, error 
 %d\n,
 +                                                                       
 ret);
 +               return ret;
 +       }
 +       reg_val = ~(MMC_PU | MMC_PD);
 +       ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val,
 +                                               TWL6030_CFG_INPUT_PUPD3);
 +       if (ret  0) {
 +               pr_err(twl6030: Failed to write CFG_INPUT_PUPD3, error 
 %d\n,
 +                                                                       
 ret);
 +               return ret;
 +       }
 +       return 0;
 +}
 +EXPORT_SYMBOL(twl6030_mmc_card_detect_config

Re: [PATCH v4 1/4] omap4 hsmmc: Adding card detect support for MMC1

2010-09-28 Thread kishore kadiyala
Hi Samuel,

Could you please review this patch which touches mfd/twl6030-irq.c for
card detect support
of MMC1 controller on OMAP4.

Regards,
Kishore

On Mon, Sep 27, 2010 at 1:25 PM, kishore kadiyala
kishorek.kadiy...@gmail.com wrote:
 Cc: Samuel Ortiz sa...@linux.intel.com

 On Fri, Sep 24, 2010 at 10:43 PM, kishore kadiyala
 kishore.kadiy...@ti.com wrote:
 Adding card detect callback function and card detect configuration
 function for MMC1 Controller on OMAP4.

 Card detect configuration function does initial configuration of the
 MMC Control  PullUp-PullDown registers of Phoenix.

 For MMC1 Controller, card detect interrupt source is
 twl6030 which is non-gpio. The card detect call back function provides
 card present/absent status by reading MMC Control register present
 on twl6030.

 Since OMAP4 doesn't use any GPIO line as used in OMAP3 for card detect,
 the suspend/resume initialization which was done in omap_hsmmc_gpio_init
 previously is moved to the probe thus making it generic for both OMAP3  
 OMAP4.

 Cc: Tony Lindgren t...@atomide.com
 Cc: Andrew Morton a...@linux-foundation.org
 Cc: Madhusudhan Chikkature madhu...@ti.com
 Cc: Adrian Hunter adrian.hun...@nokia.com
 Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
 ---
  arch/arm/mach-omap2/board-4430sdp.c |    7 +++-
  drivers/mfd/twl6030-irq.c           |   73 
 +++
  drivers/mmc/host/omap_hsmmc.c       |    4 +-
  include/linux/i2c/twl.h             |   31 +++
  4 files changed, 112 insertions(+), 3 deletions(-)

 diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
 b/arch/arm/mach-omap2/board-4430sdp.c
 index 9447644..a49f285 100644
 --- a/arch/arm/mach-omap2/board-4430sdp.c
 +++ b/arch/arm/mach-omap2/board-4430sdp.c
 @@ -227,9 +227,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device 
 *dev)
        struct omap_mmc_platform_data *pdata = dev-platform_data;

        /* Setting MMC1 Card detect Irq */
 -       if (pdev-id == 0)
 +       if (pdev-id == 0) {
 +               ret = twl6030_mmc_card_detect_config();
 +               if (ret)
 +                       pr_err(Failed configuring MMC1 card detect\n);
                pdata-slots[0].card_detect_irq = TWL6030_IRQ_BASE +
                                                MMCDETECT_INTR_OFFSET;
 +               pdata-slots[0].card_detect = twl6030_mmc_card_detect;
 +       }
        return ret;
  }

 diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c
 index 10bf228..2d3bb82 100644
 --- a/drivers/mfd/twl6030-irq.c
 +++ b/drivers/mfd/twl6030-irq.c
 @@ -36,6 +36,7 @@
  #include linux/irq.h
  #include linux/kthread.h
  #include linux/i2c/twl.h
 +#include linux/platform_device.h

  /*
  * TWL6030 (unlike its predecessors, which had two level interrupt handling)
 @@ -223,6 +224,78 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset)
  }
  EXPORT_SYMBOL(twl6030_interrupt_mask);

 +int twl6030_mmc_card_detect_config(void)
 +{
 +       int ret;
 +       u8 reg_val = 0;
 +
 +       /* Unmasking the Card detect Interrupt line for MMC1 from Phoenix */
 +       twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK,
 +                                               REG_INT_MSK_LINE_B);
 +       twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK,
 +                                               REG_INT_MSK_STS_B);
 +       /*
 +        * Intially Configuring MMC_CTRL for receving interrupts 
 +        * Card status on TWL6030 for MMC1
 +        */
 +       ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL);
 +       if (ret  0) {
 +               pr_err(twl6030: Failed to read MMCCTRL, error %d\n, ret);
 +               return ret;
 +       }
 +       reg_val = ~VMMC_AUTO_OFF;
 +       reg_val |= SW_FC;
 +       ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL);
 +       if (ret  0) {
 +               pr_err(twl6030: Failed to write MMCCTRL, error %d\n, ret);
 +               return ret;
 +       }
 +
 +       /* Configuring PullUp-PullDown register */
 +       ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val,
 +                                               TWL6030_CFG_INPUT_PUPD3);
 +       if (ret  0) {
 +               pr_err(twl6030: Failed to read CFG_INPUT_PUPD3, error %d\n,
 +                                                                       ret);
 +               return ret;
 +       }
 +       reg_val = ~(MMC_PU | MMC_PD);
 +       ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val,
 +                                               TWL6030_CFG_INPUT_PUPD3);
 +       if (ret  0) {
 +               pr_err(twl6030: Failed to write CFG_INPUT_PUPD3, error 
 %d\n,
 +                                                                       ret);
 +               return ret;
 +       }
 +       return 0;
 +}
 +EXPORT_SYMBOL(twl6030_mmc_card_detect_config);
 +
 +int twl6030_mmc_card_detect(struct device *dev, int slot)
 +{
 +       int ret = -EIO;
 +       u8 read_reg = 0;
 +       struct

Re: [PATCH v4 1/4] omap4 hsmmc: Adding card detect support for MMC1

2010-09-27 Thread kishore kadiyala
Hi Tony,

On Sat, Sep 25, 2010 at 6:08 AM, Tony Lindgren t...@atomide.com wrote:
 * kishore kadiyala kishore.kadiy...@ti.com [100924 10:05]:
 Adding card detect callback function and card detect configuration
 function for MMC1 Controller on OMAP4.

 Card detect configuration function does initial configuration of the
 MMC Control  PullUp-PullDown registers of Phoenix.

 For MMC1 Controller, card detect interrupt source is
 twl6030 which is non-gpio. The card detect call back function provides
 card present/absent status by reading MMC Control register present
 on twl6030.

 Since OMAP4 doesn't use any GPIO line as used in OMAP3 for card detect,
 the suspend/resume initialization which was done in omap_hsmmc_gpio_init
 previously is moved to the probe thus making it generic for both OMAP3  
 OMAP4.

 --- a/drivers/mfd/twl6030-irq.c
 +++ b/drivers/mfd/twl6030-irq.c

 Looks like this patch should be sent to Samuel Ortiz as it's mostly
 mfd related.

Thanks , I will send this patch to Samuel.

snip

Regards,
Kishore
--
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 v4 1/4] omap4 hsmmc: Adding card detect support for MMC1

2010-09-27 Thread kishore kadiyala
Cc: Samuel Ortiz sa...@linux.intel.com

On Fri, Sep 24, 2010 at 10:43 PM, kishore kadiyala
kishore.kadiy...@ti.com wrote:
 Adding card detect callback function and card detect configuration
 function for MMC1 Controller on OMAP4.

 Card detect configuration function does initial configuration of the
 MMC Control  PullUp-PullDown registers of Phoenix.

 For MMC1 Controller, card detect interrupt source is
 twl6030 which is non-gpio. The card detect call back function provides
 card present/absent status by reading MMC Control register present
 on twl6030.

 Since OMAP4 doesn't use any GPIO line as used in OMAP3 for card detect,
 the suspend/resume initialization which was done in omap_hsmmc_gpio_init
 previously is moved to the probe thus making it generic for both OMAP3  
 OMAP4.

 Cc: Tony Lindgren t...@atomide.com
 Cc: Andrew Morton a...@linux-foundation.org
 Cc: Madhusudhan Chikkature madhu...@ti.com
 Cc: Adrian Hunter adrian.hun...@nokia.com
 Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
 ---
  arch/arm/mach-omap2/board-4430sdp.c |    7 +++-
  drivers/mfd/twl6030-irq.c           |   73 
 +++
  drivers/mmc/host/omap_hsmmc.c       |    4 +-
  include/linux/i2c/twl.h             |   31 +++
  4 files changed, 112 insertions(+), 3 deletions(-)

 diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
 b/arch/arm/mach-omap2/board-4430sdp.c
 index 9447644..a49f285 100644
 --- a/arch/arm/mach-omap2/board-4430sdp.c
 +++ b/arch/arm/mach-omap2/board-4430sdp.c
 @@ -227,9 +227,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device 
 *dev)
        struct omap_mmc_platform_data *pdata = dev-platform_data;

        /* Setting MMC1 Card detect Irq */
 -       if (pdev-id == 0)
 +       if (pdev-id == 0) {
 +               ret = twl6030_mmc_card_detect_config();
 +               if (ret)
 +                       pr_err(Failed configuring MMC1 card detect\n);
                pdata-slots[0].card_detect_irq = TWL6030_IRQ_BASE +
                                                MMCDETECT_INTR_OFFSET;
 +               pdata-slots[0].card_detect = twl6030_mmc_card_detect;
 +       }
        return ret;
  }

 diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c
 index 10bf228..2d3bb82 100644
 --- a/drivers/mfd/twl6030-irq.c
 +++ b/drivers/mfd/twl6030-irq.c
 @@ -36,6 +36,7 @@
  #include linux/irq.h
  #include linux/kthread.h
  #include linux/i2c/twl.h
 +#include linux/platform_device.h

  /*
  * TWL6030 (unlike its predecessors, which had two level interrupt handling)
 @@ -223,6 +224,78 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset)
  }
  EXPORT_SYMBOL(twl6030_interrupt_mask);

 +int twl6030_mmc_card_detect_config(void)
 +{
 +       int ret;
 +       u8 reg_val = 0;
 +
 +       /* Unmasking the Card detect Interrupt line for MMC1 from Phoenix */
 +       twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK,
 +                                               REG_INT_MSK_LINE_B);
 +       twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK,
 +                                               REG_INT_MSK_STS_B);
 +       /*
 +        * Intially Configuring MMC_CTRL for receving interrupts 
 +        * Card status on TWL6030 for MMC1
 +        */
 +       ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL);
 +       if (ret  0) {
 +               pr_err(twl6030: Failed to read MMCCTRL, error %d\n, ret);
 +               return ret;
 +       }
 +       reg_val = ~VMMC_AUTO_OFF;
 +       reg_val |= SW_FC;
 +       ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL);
 +       if (ret  0) {
 +               pr_err(twl6030: Failed to write MMCCTRL, error %d\n, ret);
 +               return ret;
 +       }
 +
 +       /* Configuring PullUp-PullDown register */
 +       ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val,
 +                                               TWL6030_CFG_INPUT_PUPD3);
 +       if (ret  0) {
 +               pr_err(twl6030: Failed to read CFG_INPUT_PUPD3, error %d\n,
 +                                                                       ret);
 +               return ret;
 +       }
 +       reg_val = ~(MMC_PU | MMC_PD);
 +       ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val,
 +                                               TWL6030_CFG_INPUT_PUPD3);
 +       if (ret  0) {
 +               pr_err(twl6030: Failed to write CFG_INPUT_PUPD3, error %d\n,
 +                                                                       ret);
 +               return ret;
 +       }
 +       return 0;
 +}
 +EXPORT_SYMBOL(twl6030_mmc_card_detect_config);
 +
 +int twl6030_mmc_card_detect(struct device *dev, int slot)
 +{
 +       int ret = -EIO;
 +       u8 read_reg = 0;
 +       struct platform_device *pdev = to_platform_device(dev);
 +
 +       if (pdev-id) {
 +               /* TWL6030 provide's Card detect support for
 +                * only MMC1 controller.
 +                */
 +               pr_err(Unkown MMC controller

Re: [PATCH v3 2/4] omap4 hsmmc: Fix the init if CONFIG_MMC_OMAP_HS is not set

2010-09-24 Thread kishore kadiyala
On Wed, Sep 22, 2010 at 11:35 PM, Sergei Shtylyov sshtyl...@mvista.com wrote:
 Hello.

 kishore kadiyala wrote:

 From: Benoit Cousson b-cous...@ti.com

 Avoid possible crash if CONFIG_MMC_OMAP_HS is not set

 Signed-off-by: Benoit Cousson b-cous...@ti.com
 Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
 ---
  arch/arm/mach-omap2/board-4430sdp.c |    8 +++-
  1 files changed, 7 insertions(+), 1 deletions(-)

 diff --git a/arch/arm/mach-omap2/board-4430sdp.c
 b/arch/arm/mach-omap2/board-4430sdp.c
 index a49f285..ac8541c 100644
 --- a/arch/arm/mach-omap2/board-4430sdp.c
 +++ b/arch/arm/mach-omap2/board-4430sdp.c
 @@ -240,8 +240,14 @@ static int omap4_twl6030_hsmmc_late_init(struct
 device *dev)

  static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
  {
 -       struct omap_mmc_platform_data *pdata = dev-platform_data;
 +       struct omap_mmc_platform_data *pdata;

 +       /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
 +       if (!dev) {
 +               pr_err(Failed omap4_twl6030_hsmmc_set_late_init\n);

   pr_err(Failed %s\n, __func__);

OK , will have as mentioned

 WBR, Sergei

Regards,
Kishore
--
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 1/4] omap4 hsmmc: Adding card detect support for MMC1

2010-09-24 Thread kishore kadiyala
Hi Hari,


On Thu, Sep 23, 2010 at 11:22 AM, kishore kadiyala
kishorek.kadiy...@gmail.com wrote:
 Hi Hari,

 On Thu, Sep 23, 2010 at 1:19 AM, Kanigeri, Hari h-kanige...@ti.com wrote:
 Kishore,

 +int twl6030_mmc_card_detect(struct device *dev, int slot)
 +{
 +     int ret = -EIO;
 +     u8 read_reg = 0;
 +     struct platform_device *pdev = to_platform_device(dev);
 +
 +     switch (pdev-id) {
 +     case 0:
 +             /*
 +              * BIT0 of REG_MMC_CTRL
 +              * 0 - Card not present ,1 - Card present
 +              */
 +             ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, read_reg,
 +                                                     TWL6030_MMCCTRL);
 +             if (ret = 0)
 +                     ret = read_reg  STS_MMC;
 +             break;

 nitpick: may be you don't need a switch statement for only one case.

 From future perspective,since there are 5 MMC controllers on OMAP4
 and current patch supports card detect feature only for one controller i.e 
 MMC1
 as of now. Once the interfaces connected on the remaining 4 MMC controllers
 are defined further additions will be required for respective cases.


Correcting my previous comment, I've just verified twl6030 current
version spec on OMAP4
which can provide card detect interrupt only for one MMC controller i.e MMC1.
I will replace switch with if.

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


[PATCH v4 0/4] omap4 hsmmc: Card detect and Register offset handling

2010-09-24 Thread kishore kadiyala
The patch series is based on mainline 2.6.36-rc5.
The series is tested on OMAP3430SDP and OMAP4430SDP and has dependency on
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg34718.html

V3:
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg35423.html

V2:
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg35135.html

V1:
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg34040.html

Kishore Kadiyala (3):
  omap4 hsmmc : Adding card detect support for MMC1
  omap4 hsmmc: Register offset handling
  omap4 hsmmc: Update ocr mask for MMC2 for regulator to use

Benoit Cousson (1);
  omap4 hsmmc: Fix the init if CONFIG_MMC_OMAP_HS is not set

 arch/arm/mach-omap2/board-4430sdp.c   |   16 ++-
 arch/arm/mach-omap2/devices.c |8 +--
 arch/arm/mach-omap2/hsmmc.c   |4 ++
 arch/arm/plat-omap/include/plat/mmc.h |3 +
 drivers/mfd/twl6030-irq.c |   73 +
 drivers/mmc/host/omap_hsmmc.c |   18 +++-
 include/linux/i2c/twl.h   |   31 ++
 7 files changed, 144 insertions(+), 9 deletions(-)


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


[PATCH v4 1/4] omap4 hsmmc: Adding card detect support for MMC1

2010-09-24 Thread kishore kadiyala
Adding card detect callback function and card detect configuration
function for MMC1 Controller on OMAP4.

Card detect configuration function does initial configuration of the
MMC Control  PullUp-PullDown registers of Phoenix.

For MMC1 Controller, card detect interrupt source is
twl6030 which is non-gpio. The card detect call back function provides
card present/absent status by reading MMC Control register present
on twl6030.

Since OMAP4 doesn't use any GPIO line as used in OMAP3 for card detect,
the suspend/resume initialization which was done in omap_hsmmc_gpio_init
previously is moved to the probe thus making it generic for both OMAP3  OMAP4.

Cc: Tony Lindgren t...@atomide.com
Cc: Andrew Morton a...@linux-foundation.org
Cc: Madhusudhan Chikkature madhu...@ti.com
Cc: Adrian Hunter adrian.hun...@nokia.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c |7 +++-
 drivers/mfd/twl6030-irq.c   |   73 +++
 drivers/mmc/host/omap_hsmmc.c   |4 +-
 include/linux/i2c/twl.h |   31 +++
 4 files changed, 112 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 9447644..a49f285 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -227,9 +227,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device 
*dev)
struct omap_mmc_platform_data *pdata = dev-platform_data;

/* Setting MMC1 Card detect Irq */
-   if (pdev-id == 0)
+   if (pdev-id == 0) {
+   ret = twl6030_mmc_card_detect_config();
+   if (ret)
+   pr_err(Failed configuring MMC1 card detect\n);
pdata-slots[0].card_detect_irq = TWL6030_IRQ_BASE +
MMCDETECT_INTR_OFFSET;
+   pdata-slots[0].card_detect = twl6030_mmc_card_detect;
+   }
return ret;
 }

diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c
index 10bf228..2d3bb82 100644
--- a/drivers/mfd/twl6030-irq.c
+++ b/drivers/mfd/twl6030-irq.c
@@ -36,6 +36,7 @@
 #include linux/irq.h
 #include linux/kthread.h
 #include linux/i2c/twl.h
+#include linux/platform_device.h

 /*
  * TWL6030 (unlike its predecessors, which had two level interrupt handling)
@@ -223,6 +224,78 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset)
 }
 EXPORT_SYMBOL(twl6030_interrupt_mask);

+int twl6030_mmc_card_detect_config(void)
+{
+   int ret;
+   u8 reg_val = 0;
+
+   /* Unmasking the Card detect Interrupt line for MMC1 from Phoenix */
+   twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK,
+   REG_INT_MSK_LINE_B);
+   twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK,
+   REG_INT_MSK_STS_B);
+   /*
+* Intially Configuring MMC_CTRL for receving interrupts 
+* Card status on TWL6030 for MMC1
+*/
+   ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL);
+   if (ret  0) {
+   pr_err(twl6030: Failed to read MMCCTRL, error %d\n, ret);
+   return ret;
+   }
+   reg_val = ~VMMC_AUTO_OFF;
+   reg_val |= SW_FC;
+   ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL);
+   if (ret  0) {
+   pr_err(twl6030: Failed to write MMCCTRL, error %d\n, ret);
+   return ret;
+   }
+
+   /* Configuring PullUp-PullDown register */
+   ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val,
+   TWL6030_CFG_INPUT_PUPD3);
+   if (ret  0) {
+   pr_err(twl6030: Failed to read CFG_INPUT_PUPD3, error %d\n,
+   ret);
+   return ret;
+   }
+   reg_val = ~(MMC_PU | MMC_PD);
+   ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val,
+   TWL6030_CFG_INPUT_PUPD3);
+   if (ret  0) {
+   pr_err(twl6030: Failed to write CFG_INPUT_PUPD3, error %d\n,
+   ret);
+   return ret;
+   }
+   return 0;
+}
+EXPORT_SYMBOL(twl6030_mmc_card_detect_config);
+
+int twl6030_mmc_card_detect(struct device *dev, int slot)
+{
+   int ret = -EIO;
+   u8 read_reg = 0;
+   struct platform_device *pdev = to_platform_device(dev);
+
+   if (pdev-id) {
+   /* TWL6030 provide's Card detect support for
+* only MMC1 controller.
+*/
+   pr_err(Unkown MMC controller %d in %s\n, pdev-id, __func__);
+   return ret;
+   }
+   /*
+* BIT0 of MMC_CTRL on TWL6030 provides card status for MMC1
+* 0 - Card not present ,1 - Card present
+*/
+   ret

[PATCH v4 2/4] omap4 hsmmc: Fix the init if CONFIG_MMC_OMAP_HS is not set

2010-09-24 Thread kishore kadiyala
From: Benoit Cousson b-cous...@ti.com

Avoid possible crash if CONFIG_MMC_OMAP_HS is not set

Cc: Tony Lindgren t...@atomide.com
Cc: Andrew Morton a...@linux-foundation.org
Cc: Madhusudhan Chikkature madhu...@ti.com
Cc: Adrian Hunter adrian.hun...@nokia.com
Signed-off-by: Benoit Cousson b-cous...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index a49f285..7978a79 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -240,8 +240,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device 
*dev)

 static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
 {
-   struct omap_mmc_platform_data *pdata = dev-platform_data;
+   struct omap_mmc_platform_data *pdata;

+   /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
+   if (!dev) {
+   pr_err(Failed %s\n, __func__);
+   return;
+   }
+   pdata = dev-platform_data;
pdata-init =   omap4_twl6030_hsmmc_late_init;
 }

-- 
1.7.0.4

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


[PATCH v4 4/4] omap4 hsmmc: Update ocr mask for MMC2 for regulator to use

2010-09-24 Thread kishore kadiyala
On OMAP4, MMC2 controller has eMMC which draws power from VAUX regulator
on TWL. Though the eMMC supports dual voltage[1.8v/3v] as per ocr register,
its VCC is fixed at 3V for operation. With this once the mmc core selects
the minimum voltage[1.8] supported based on the ocr value read from OCR 
register,
eMMC will not get detected. Thus the platform data for MMC2 is updated with ocr
mask and same will be communicated to core which will set the regulator to
always operate at 3V when ever turned ON.

Cc: Tony Lindgren t...@atomide.com
Cc: Andrew Morton a...@linux-foundation.org
Cc: Madhusudhan Chikkature madhu...@ti.com
Cc: Adrian Hunter adrian.hun...@nokia.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c |1 +
 drivers/mmc/host/omap_hsmmc.c   |   12 
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 7978a79..8b0e71a 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -202,6 +202,7 @@ static struct omap2_hsmmc_info mmc[] = {
.gpio_cd= -EINVAL,
.gpio_wp= -EINVAL,
.nonremovable   = true,
+   .ocr_mask   = MMC_VDD_29_30,
},
{}  /* Terminator */
 };
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 8cb007c..f629acf 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -364,6 +364,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 {
struct regulator *reg;
int ret = 0;
+   int ocr_value = 0;

switch (host-id) {
case OMAP_MMC1_DEVID:
@@ -396,6 +397,17 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
}
} else {
host-vcc = reg;
+   ocr_value = mmc_regulator_get_ocrmask(reg);
+   if (!mmc_slot(host).ocr_mask) {
+   mmc_slot(host).ocr_mask = ocr_value;
+   } else {
+   if (!(mmc_slot(host).ocr_mask  ocr_value)) {
+   pr_err(MMC%d ocrmask %x is not supported\n,
+   host-id, mmc_slot(host).ocr_mask);
+   mmc_slot(host).ocr_mask = 0;
+   return -EINVAL;
+   }
+   }
mmc_slot(host).ocr_mask = mmc_regulator_get_ocrmask(reg);

/* Allow an aux regulator */
-- 
1.7.0.4

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


[PATCH v4 3/4] omap4 hsmmc: Register offset handling

2010-09-24 Thread kishore kadiyala

In OMAP4, as per new PM programming model, the legacy registers
which were there in OMAP3 are all shifted by 0x100 while new one's
are added from offset 0 to 0x10.
For OMAP4, the register offset appending of 0x100 done in devices.c
currently, is moved to driver file.This change fits in for current
implementation as well as once the driver undergoes hwmod adaptation.

Cc: Tony Lindgren t...@atomide.com
Cc: Andrew Morton a...@linux-foundation.org
Cc: Madhusudhan Chikkature madhu...@ti.com
Cc: Adrian Hunter adrian.hun...@nokia.com
Cc: Benoit Cousson b-cous...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
---
 arch/arm/mach-omap2/devices.c |8 +++-
 arch/arm/mach-omap2/hsmmc.c   |4 
 arch/arm/plat-omap/include/plat/mmc.h |3 +++
 drivers/mmc/host/omap_hsmmc.c |2 ++
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 2dbb265..bb7ec13 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -745,13 +745,13 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data 
**mmc_data,
case 3:
if (!cpu_is_omap44xx())
return;
-   base = OMAP4_MMC4_BASE + OMAP4_MMC_REG_OFFSET;
+   base = OMAP4_MMC4_BASE;
irq = OMAP44XX_IRQ_MMC4;
break;
case 4:
if (!cpu_is_omap44xx())
return;
-   base = OMAP4_MMC5_BASE + OMAP4_MMC_REG_OFFSET;
+   base = OMAP4_MMC5_BASE;
irq = OMAP44XX_IRQ_MMC5;
break;
default:
@@ -762,10 +762,8 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data 
**mmc_data,
size = OMAP2420_MMC_SIZE;
name = mmci-omap;
} else if (cpu_is_omap44xx()) {
-   if (i  3) {
-   base += OMAP4_MMC_REG_OFFSET;
+   if (i  3)
irq += OMAP44XX_IRQ_GIC_START;
-   }
size = OMAP4_HSMMC_SIZE;
name = mmci-omap-hs;
} else {
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index c8f647b..49d76a7 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -261,6 +261,10 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info 
*controllers)
mmc-slots[0].wires = c-wires;
mmc-slots[0].internal_clock = !c-ext_clock;
mmc-dma_mask = 0x;
+   if (cpu_is_omap44xx())
+   mmc-reg_offset = OMAP4_MMC_REG_OFFSET;
+   else
+   mmc-reg_offset = 0;

mmc-get_context_loss_count = hsmmc_get_context_loss;

diff --git a/arch/arm/plat-omap/include/plat/mmc.h 
b/arch/arm/plat-omap/include/plat/mmc.h
index 9b89ec6..4e6ef07 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -71,6 +71,9 @@ struct omap_mmc_platform_data {

u64 dma_mask;

+   /* Register offset deviation */
+   u16 reg_offset;
+
struct omap_mmc_slot_data {

/* 4 wire signaling is optional, and is used for SD/SDIO/HSMMC;
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index a51894d..8cb007c 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2009,6 +2009,8 @@ static int __init omap_hsmmc_probe(struct platform_device 
*pdev)
if (res == NULL || irq  0)
return -ENXIO;

+   res-start += pdata-reg_offset;
+   res-end += pdata-reg_offset;
res = request_mem_region(res-start, res-end - res-start + 1,
pdev-name);
if (res == NULL)
-- 
1.7.0.4


--
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 v2 1/4] omap4 hsmmc: Adding card detect support for MMC1

2010-09-22 Thread kishore kadiyala
Hi balbi,

On Wed, Sep 22, 2010 at 2:21 PM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Sat, Sep 18, 2010 at 11:33:56AM -0500, kishore kadiyala wrote:

 @@ -223,6 +224,81 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset)
 }
 EXPORT_SYMBOL(twl6030_interrupt_mask);

 +int twl6030_mmc_card_detect_config(void)
 +{
 +       int ret;
 +       u8 reg_val = 0;
 +
 +       /* Unmasking the Card detect Interrupt line for MMC1 from Phoenix
 */
 +       if (twl_class_is_6030()) {

 which other class can this be ?

It can only be a 6030 class.
as twl6030_mmc_card_detect_config is called only in board file I can
remove the check.


 +       /*
 +        * Intially Configuring MMC_CTRL for receving interrupts 
 +        * Card status on TWL6030 for MMC1
 +        */
 +       ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val,
 TWL6030_MMCCTRL);
 +       if (ret  0) {
 +               pr_err(twl6030: Failed to read MMCCTRL, error %d\n,
 ret);
 +               return ret;
 +       }
 +       reg_val = ~VMMC_AUTO_OFF;
 +       reg_val |= SW_FC;
 +       ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val,
 TWL6030_MMCCTRL);
 +       if (ret  0) {
 +               pr_err(twl6030: Failed to write MMCCTRL, error %d\n,
 ret);
 +               return ret;
 +       }
 +
 +       /* Configuring PullUp-PullDown register */
 +       ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val,
 +                                               TWL6030_CFG_INPUT_PUPD3);

 is this a gpio ? Could gpiolib take care of this ?

This is not a gpio but an interrupt line from twl6030 to MMC controller


 +       if (ret  0) {
 +               pr_err(twl6030: Failed to read CFG_INPUT_PUPD3, error
 %d\n,
 +
 ret);
 +               return ret;
 +       }
 +       reg_val = ~(MMC_PU | MMC_PD);
 +       ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val,
 +                                               TWL6030_CFG_INPUT_PUPD3);

 ditto.
This is not a gpio

 +int twl6030_mmc_card_detect(struct device *dev, int slot)
 +{
 +       int ret = -EIO;
 +       u8 read_reg = 0;
 +       struct platform_device *pdev = container_of(dev,
 +                                       struct platform_device, dev);

 how about:

        struct platform_device *pdev = to_platform_device(dev);

ok will use this .


 diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
 index 562dbbb..a51894d 100644
 --- a/drivers/mmc/host/omap_hsmmc.c
 +++ b/drivers/mmc/host/omap_hsmmc.c
 @@ -466,8 +466,6 @@ static int omap_hsmmc_gpio_init(struct
 omap_mmc_platform_data *pdata)
        int ret;

        if (gpio_is_valid(pdata-slots[0].switch_pin)) {
 -               pdata-suspend = omap_hsmmc_suspend_cdirq;
 -               pdata-resume = omap_hsmmc_resume_cdirq;
                if (pdata-slots[0].cover)
                        pdata-slots[0].get_cover_state =
                                        omap_hsmmc_get_cover_state;
 @@ -2211,6 +2209,8 @@ static int __init omap_hsmmc_probe(struct
 platform_device *pdev)
                                Unable to grab MMC CD IRQ\n);
                        goto err_irq_cd;
                }
 +               pdata-suspend = omap_hsmmc_suspend_cdirq;
 +               pdata-resume = omap_hsmmc_resume_cdirq;

 this doesn't look to be part of $SUBJECT, care to explain ?

I've just moved the initialization of suspend  resume which was
previously done in omap_hsmmc_gpio_init.
Ok will update in the log


 @@ -173,6 +183,27 @@ int twl_i2c_read(u8 mod_no, u8 *value, u8 reg,
 unsigned num_bytes);
 int twl6030_interrupt_unmask(u8 bit_mask, u8 offset);
 int twl6030_interrupt_mask(u8 bit_mask, u8 offset);

 +/* Card detect Configuration for MMC1 Controller on OMAP4 */
 +#ifdef CONFIG_TWL4030_CORE
 +int twl6030_mmc_card_detect_config(void);
 +#else
 +static inline int twl6030_mmc_card_detect_config(void)
 +{
 +       pr_err(twl6030_mmc_card_detect_config not supported\n);

 pr_debug() would be better ??

ok will update with pr_debug


 +/* MMC1 Controller on OMAP4 uses Phoenix irq for Card detect */
 +#ifdef CONFIG_TWL4030_CORE
 +int twl6030_mmc_card_detect(struct device *dev, int slot);
 +#else
 +static inline int twl6030_mmc_card_detect(struct device *dev, int slot)
 +{
 +       pr_err(Call back twl6030_mmc_card_detect not supported\n);

 ditto.

ok will update with pr_debug


 --
 balbi

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


[PATCH v3 0/4] omap4 hsmmc: Card detect and Register offset handling

2010-09-22 Thread kishore kadiyala
The patch series is based on mainline 2.6.36-rc5.
The series is tested on OMAP3430SDP and OMAP4430SDP and has dependency on
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg34718.html

V2:
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg35135.html

V1:
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg34040.html

Kishore Kadiyala (3):
  omap4 hsmmc : Adding card detect support for MMC1
  omap4 hsmmc: Register offset handling
  omap4 hsmmc: Update ocr mask for MMC2 for regulator to use

Benoit Cousson (1);
  omap4 hsmmc: Fix the init if CONFIG_MMC_OMAP_HS is not set

 arch/arm/mach-omap2/board-4430sdp.c   |   16 ++-
 arch/arm/mach-omap2/devices.c |8 +--
 arch/arm/mach-omap2/hsmmc.c   |4 ++
 arch/arm/plat-omap/include/plat/mmc.h |3 +
 drivers/mfd/twl6030-irq.c |   72 +
 drivers/mmc/host/omap_hsmmc.c |   18 +++-
 include/linux/i2c/twl.h   |   31 ++
 7 files changed, 143 insertions(+), 9 deletions(-)


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


[PATCH v3 1/4] omap4 hsmmc: Adding card detect support for MMC1

2010-09-22 Thread kishore kadiyala
Adding card detect callback function and card detect configuration
function for MMC1 Controller on OMAP4.

Card detect configuration function does initial configuration of the
MMC Control  PullUp-PullDown registers of Phoenix.

For MMC1 Controller, card detect interrupt source is
twl6030 which is non-gpio. The card detect call back function provides
card present/absent status by reading MMC Control register present
on twl6030.

Since OMAP4 doesn't use any GPIO line as used in OMAP3 for card detect,
the suspend/resume initialization which was done in omap_hsmmc_gpio_init
previously is moved to the probe thus making it generic for both OMAP3  OMAP4.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c |7 +++-
 drivers/mfd/twl6030-irq.c   |   72 +++
 drivers/mmc/host/omap_hsmmc.c   |4 +-
 include/linux/i2c/twl.h |   31 +++
 4 files changed, 111 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 9447644..a49f285 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -227,9 +227,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device 
*dev)
struct omap_mmc_platform_data *pdata = dev-platform_data;

/* Setting MMC1 Card detect Irq */
-   if (pdev-id == 0)
+   if (pdev-id == 0) {
+   ret = twl6030_mmc_card_detect_config();
+   if (ret)
+   pr_err(Failed configuring MMC1 card detect\n);
pdata-slots[0].card_detect_irq = TWL6030_IRQ_BASE +
MMCDETECT_INTR_OFFSET;
+   pdata-slots[0].card_detect = twl6030_mmc_card_detect;
+   }
return ret;
 }

diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c
index 10bf228..d065899 100644
--- a/drivers/mfd/twl6030-irq.c
+++ b/drivers/mfd/twl6030-irq.c
@@ -36,6 +36,7 @@
 #include linux/irq.h
 #include linux/kthread.h
 #include linux/i2c/twl.h
+#include linux/platform_device.h

 /*
  * TWL6030 (unlike its predecessors, which had two level interrupt handling)
@@ -223,6 +224,77 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset)
 }
 EXPORT_SYMBOL(twl6030_interrupt_mask);

+int twl6030_mmc_card_detect_config(void)
+{
+   int ret;
+   u8 reg_val = 0;
+
+   /* Unmasking the Card detect Interrupt line for MMC1 from Phoenix */
+   twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK,
+   REG_INT_MSK_LINE_B);
+   twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK,
+   REG_INT_MSK_STS_B);
+   /*
+* Intially Configuring MMC_CTRL for receving interrupts 
+* Card status on TWL6030 for MMC1
+*/
+   ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL);
+   if (ret  0) {
+   pr_err(twl6030: Failed to read MMCCTRL, error %d\n, ret);
+   return ret;
+   }
+   reg_val = ~VMMC_AUTO_OFF;
+   reg_val |= SW_FC;
+   ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL);
+   if (ret  0) {
+   pr_err(twl6030: Failed to write MMCCTRL, error %d\n, ret);
+   return ret;
+   }
+
+   /* Configuring PullUp-PullDown register */
+   ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val,
+   TWL6030_CFG_INPUT_PUPD3);
+   if (ret  0) {
+   pr_err(twl6030: Failed to read CFG_INPUT_PUPD3, error %d\n,
+   ret);
+   return ret;
+   }
+   reg_val = ~(MMC_PU | MMC_PD);
+   ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val,
+   TWL6030_CFG_INPUT_PUPD3);
+   if (ret  0) {
+   pr_err(twl6030: Failed to write CFG_INPUT_PUPD3, error %d\n,
+   ret);
+   return ret;
+   }
+   return 0;
+}
+EXPORT_SYMBOL(twl6030_mmc_card_detect_config);
+
+int twl6030_mmc_card_detect(struct device *dev, int slot)
+{
+   int ret = -EIO;
+   u8 read_reg = 0;
+   struct platform_device *pdev = to_platform_device(dev);
+
+   switch (pdev-id) {
+   case 0:
+   /*
+* BIT0 of REG_MMC_CTRL
+* 0 - Card not present ,1 - Card present
+*/
+   ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, read_reg,
+   TWL6030_MMCCTRL);
+   if (ret = 0)
+   ret = read_reg  STS_MMC;
+   break;
+   default:
+   pr_err(Unkown MMC controller %d in %s\n, pdev-id, __func__);
+   }
+   return ret;
+}
+EXPORT_SYMBOL

[PATCH v3 2/4] omap4 hsmmc: Fix the init if CONFIG_MMC_OMAP_HS is not set

2010-09-22 Thread kishore kadiyala
From: Benoit Cousson b-cous...@ti.com

Avoid possible crash if CONFIG_MMC_OMAP_HS is not set

Signed-off-by: Benoit Cousson b-cous...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index a49f285..ac8541c 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -240,8 +240,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device 
*dev)

 static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
 {
-   struct omap_mmc_platform_data *pdata = dev-platform_data;
+   struct omap_mmc_platform_data *pdata;

+   /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
+   if (!dev) {
+   pr_err(Failed omap4_twl6030_hsmmc_set_late_init\n);
+   return;
+   }
+   pdata = dev-platform_data;
pdata-init =   omap4_twl6030_hsmmc_late_init;
 }

-- 
1.7.0.4


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


[PATCH v3 3/4] omap4 hsmmc: Register offset handling

2010-09-22 Thread kishore kadiyala
In OMAP4, as per new PM programming model, the legacy registers
which were there in OMAP3 are all shifted by 0x100 while new one's
are added from offset 0 to 0x10.
For OMAP4, the register offset appending of 0x100 done in devices.c
currently, is moved to driver file.This change fits in for current
implementation as well as once the driver undergoes hwmod adaptation.

Cc: Kevin Hilman khil...@deeprootsystems.com
Cc: Benoit Cousson b-cous...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
---
 arch/arm/mach-omap2/devices.c |8 +++-
 arch/arm/mach-omap2/hsmmc.c   |4 
 arch/arm/plat-omap/include/plat/mmc.h |3 +++
 drivers/mmc/host/omap_hsmmc.c |2 ++
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 2dbb265..bb7ec13 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -745,13 +745,13 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data 
**mmc_data,
case 3:
if (!cpu_is_omap44xx())
return;
-   base = OMAP4_MMC4_BASE + OMAP4_MMC_REG_OFFSET;
+   base = OMAP4_MMC4_BASE;
irq = OMAP44XX_IRQ_MMC4;
break;
case 4:
if (!cpu_is_omap44xx())
return;
-   base = OMAP4_MMC5_BASE + OMAP4_MMC_REG_OFFSET;
+   base = OMAP4_MMC5_BASE;
irq = OMAP44XX_IRQ_MMC5;
break;
default:
@@ -762,10 +762,8 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data 
**mmc_data,
size = OMAP2420_MMC_SIZE;
name = mmci-omap;
} else if (cpu_is_omap44xx()) {
-   if (i  3) {
-   base += OMAP4_MMC_REG_OFFSET;
+   if (i  3)
irq += OMAP44XX_IRQ_GIC_START;
-   }
size = OMAP4_HSMMC_SIZE;
name = mmci-omap-hs;
} else {
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index c8f647b..49d76a7 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -261,6 +261,10 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info 
*controllers)
mmc-slots[0].wires = c-wires;
mmc-slots[0].internal_clock = !c-ext_clock;
mmc-dma_mask = 0x;
+   if (cpu_is_omap44xx())
+   mmc-reg_offset = OMAP4_MMC_REG_OFFSET;
+   else
+   mmc-reg_offset = 0;

mmc-get_context_loss_count = hsmmc_get_context_loss;

diff --git a/arch/arm/plat-omap/include/plat/mmc.h 
b/arch/arm/plat-omap/include/plat/mmc.h
index 9b89ec6..4e6ef07 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -71,6 +71,9 @@ struct omap_mmc_platform_data {

u64 dma_mask;

+   /* Register offset deviation */
+   u16 reg_offset;
+
struct omap_mmc_slot_data {

/* 4 wire signaling is optional, and is used for SD/SDIO/HSMMC;
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index a51894d..8cb007c 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2009,6 +2009,8 @@ static int __init omap_hsmmc_probe(struct platform_device 
*pdev)
if (res == NULL || irq  0)
return -ENXIO;

+   res-start += pdata-reg_offset;
+   res-end += pdata-reg_offset;
res = request_mem_region(res-start, res-end - res-start + 1,
pdev-name);
if (res == NULL)
-- 
1.7.0.4


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


[PATCH v3 4/4] omap4 hsmmc: Update ocr mask for MMC2 for regulator to use

2010-09-22 Thread kishore kadiyala
On OMAP4, MMC2 controller has eMMC which draws power from VAUX regulator
on TWL. Though the eMMC supports dual voltage[1.8v/3v] as per ocr register,
its VCC is fixed at 3V for operation. With this once the mmc core selects
the minimum voltage[1.8] supported based on the ocr value read from OCR 
register,
eMMC will not get detected. Thus the platform data for MMC2 is updated with ocr
mask and same will be communicated to core which will set the regulator to
always operate at 3V when ever turned ON.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c |1 +
 drivers/mmc/host/omap_hsmmc.c   |   12 
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index ac8541c..9fd1044 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -202,6 +202,7 @@ static struct omap2_hsmmc_info mmc[] = {
.gpio_cd= -EINVAL,
.gpio_wp= -EINVAL,
.nonremovable   = true,
+   .ocr_mask   = MMC_VDD_29_30,
},
{}  /* Terminator */
 };
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 8cb007c..f629acf 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -364,6 +364,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 {
struct regulator *reg;
int ret = 0;
+   int ocr_value = 0;

switch (host-id) {
case OMAP_MMC1_DEVID:
@@ -396,6 +397,17 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
}
} else {
host-vcc = reg;
+   ocr_value = mmc_regulator_get_ocrmask(reg);
+   if (!mmc_slot(host).ocr_mask) {
+   mmc_slot(host).ocr_mask = ocr_value;
+   } else {
+   if (!(mmc_slot(host).ocr_mask  ocr_value)) {
+   pr_err(MMC%d ocrmask %x is not supported\n,
+   host-id, mmc_slot(host).ocr_mask);
+   mmc_slot(host).ocr_mask = 0;
+   return -EINVAL;
+   }
+   }
mmc_slot(host).ocr_mask = mmc_regulator_get_ocrmask(reg);

/* Allow an aux regulator */
-- 
1.7.0.4


--
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 1/4] omap4 hsmmc: Adding card detect support for MMC1

2010-09-22 Thread kishore kadiyala
Hi Hari,

On Thu, Sep 23, 2010 at 1:19 AM, Kanigeri, Hari h-kanige...@ti.com wrote:
 Kishore,

 +int twl6030_mmc_card_detect(struct device *dev, int slot)
 +{
 +     int ret = -EIO;
 +     u8 read_reg = 0;
 +     struct platform_device *pdev = to_platform_device(dev);
 +
 +     switch (pdev-id) {
 +     case 0:
 +             /*
 +              * BIT0 of REG_MMC_CTRL
 +              * 0 - Card not present ,1 - Card present
 +              */
 +             ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, read_reg,
 +                                                     TWL6030_MMCCTRL);
 +             if (ret = 0)
 +                     ret = read_reg  STS_MMC;
 +             break;

 nitpick: may be you don't need a switch statement for only one case.

From future perspective,since there are 5 MMC controllers on OMAP4
and current patch supports card detect feature only for one controller i.e MMC1
as of now. Once the interfaces connected on the remaining 4 MMC controllers
are defined further additions will be required for respective cases.

snip

Regards,
Kishore
--
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 v2 3/4] omap4 hsmmc: Register offset handling

2010-09-21 Thread kishore kadiyala
Hi Benoit,

On Tue, Sep 21, 2010 at 2:26 AM, Cousson, Benoit b-cous...@ti.com wrote:
 Hi Kishore

 On 9/18/2010 6:34 PM, Kadiyala, Kishore wrote:

 The offset handling implementation of omap4 mmc registers which
 was already present can't be reused once hwmod modifications are done
 for mmc driver.
 Since hwmod data file for OMAP4 is an auto generated the base
 address for MMC will remain same as OMAP3 and thus the offset deviation
 of registers should be updated in the hsmmc driver.

 That explanation does not sound very accurate to me.
 The fact that the hwmods are auto-generated has nothing to do with your
 offset problem.

Agree the change log needs to be updated  as said  but when
coming to implementation this how it is:

With current mainline kernel, offset appending is already implemented in
mach-omap2/devices.c and works fine [here bases are updated with 0x100
and then passed to driver which has same register offset's as OMAP3].

When hwmod modifications are done to the MMC driver, the base address are
picked from omap_hwmod_44xx_data.c and omap_device is build.
Coming to the driver it still has the same old register offset's as OMAP3 and
there should be a way to add 0x100 some where.

The current patch moves the offset appending to the driver file which is updated
in mach-omap2/hsmmc.c which will fit for current implementation and even
hwmod adaptation.

The real cause is due to the update of the IP to support the
 new PM programming model.
 Because of that, and to keep a certain level of compatibility, the legacy
 registers were all shifted by 0x100 and the new one were added from offset 0
 to 0x10.

 Regards,
 Benoit


snip

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


[PATCH v2 0/4] OMAP4 hsmmc :card detect and Register offset handling

2010-09-18 Thread kishore kadiyala
The patch series is basically for OMAP4 and is based on mainline 2.6.36-rc4.
The series is tested on OMAP3430SDP and OMAP4430SDP and has dependency on
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg34718.html

V1:
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg34040.html

Kishore Kadiyala (3):
  omap4 hsmmc : Adding card detect support for MMC1
  omap4 hsmmc: Register offset handling
  omap4 hsmmc: Update ocr mask for MMC2 for regulator to use

Benoit Cousson (1);
  omap4 hsmmc: Fix the init if CONFIG_MMC_OMAP_HS is not set


 arch/arm/mach-omap2/board-4430sdp.c   |   16 ++-
 arch/arm/mach-omap2/devices.c |8 +--
 arch/arm/mach-omap2/hsmmc.c   |4 ++
 arch/arm/plat-omap/include/plat/mmc.h |3 +
 drivers/mfd/twl6030-irq.c |   76 +
 drivers/mmc/host/omap_hsmmc.c |   18 ++-
 include/linux/i2c/twl.h   |   31 +
 7 files changed, 146 insertions(+), 10 deletions(-)

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


[PATCH v2 1/4] omap4 hsmmc: Adding card detect support for MMC1

2010-09-18 Thread kishore kadiyala
Adding card detect callback function and card detect configuration
function for MMC1 Controller.

Card detect configuration function does initial configuration of the
MMC Control  PullUp-PullDown registers of Phoenix.

For MMC1 Controller, Card detect interrupt source is
twl6030 and the card detect call back function provides card present/absent
status by reading MMC Control register.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c |7 +++-
 drivers/mfd/twl6030-irq.c   |   76 +++
 drivers/mmc/host/omap_hsmmc.c   |4 +-
 include/linux/i2c/twl.h |   31 ++
 4 files changed, 115 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 9447644..a49f285 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -227,9 +227,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device 
*dev)
struct omap_mmc_platform_data *pdata = dev-platform_data;

/* Setting MMC1 Card detect Irq */
-   if (pdev-id == 0)
+   if (pdev-id == 0) {
+   ret = twl6030_mmc_card_detect_config();
+   if (ret)
+   pr_err(Failed configuring MMC1 card detect\n);
pdata-slots[0].card_detect_irq = TWL6030_IRQ_BASE +
MMCDETECT_INTR_OFFSET;
+   pdata-slots[0].card_detect = twl6030_mmc_card_detect;
+   }
return ret;
 }

diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c
index 10bf228..de232b1 100644
--- a/drivers/mfd/twl6030-irq.c
+++ b/drivers/mfd/twl6030-irq.c
@@ -36,6 +36,7 @@
 #include linux/irq.h
 #include linux/kthread.h
 #include linux/i2c/twl.h
+#include linux/platform_device.h

 /*
  * TWL6030 (unlike its predecessors, which had two level interrupt handling)
@@ -223,6 +224,81 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset)
 }
 EXPORT_SYMBOL(twl6030_interrupt_mask);

+int twl6030_mmc_card_detect_config(void)
+{
+   int ret;
+   u8 reg_val = 0;
+
+   /* Unmasking the Card detect Interrupt line for MMC1 from Phoenix */
+   if (twl_class_is_6030()) {
+   twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK,
+   REG_INT_MSK_LINE_B);
+   twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK,
+   REG_INT_MSK_STS_B);
+   }
+
+   /*
+* Intially Configuring MMC_CTRL for receving interrupts 
+* Card status on TWL6030 for MMC1
+*/
+   ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL);
+   if (ret  0) {
+   pr_err(twl6030: Failed to read MMCCTRL, error %d\n, ret);
+   return ret;
+   }
+   reg_val = ~VMMC_AUTO_OFF;
+   reg_val |= SW_FC;
+   ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL);
+   if (ret  0) {
+   pr_err(twl6030: Failed to write MMCCTRL, error %d\n, ret);
+   return ret;
+   }
+
+   /* Configuring PullUp-PullDown register */
+   ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val,
+   TWL6030_CFG_INPUT_PUPD3);
+   if (ret  0) {
+   pr_err(twl6030: Failed to read CFG_INPUT_PUPD3, error %d\n,
+   ret);
+   return ret;
+   }
+   reg_val = ~(MMC_PU | MMC_PD);
+   ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val,
+   TWL6030_CFG_INPUT_PUPD3);
+   if (ret  0) {
+   pr_err(twl6030: Failed to write CFG_INPUT_PUPD3, error %d\n,
+   ret);
+   return ret;
+   }
+   return 0;
+}
+EXPORT_SYMBOL(twl6030_mmc_card_detect_config);
+
+int twl6030_mmc_card_detect(struct device *dev, int slot)
+{
+   int ret = -EIO;
+   u8 read_reg = 0;
+   struct platform_device *pdev = container_of(dev,
+   struct platform_device, dev);
+
+   switch (pdev-id) {
+   case 0:
+   /*
+* BIT0 of REG_MMC_CTRL
+* 0 - Card not present ,1 - Card present
+*/
+   ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, read_reg,
+   TWL6030_MMCCTRL);
+   if (ret = 0)
+   ret = read_reg  STS_MMC;
+   break;
+   default:
+   pr_err(Unkown MMC controller %d in %s\n, pdev-id, __func__);
+   }
+   return ret;
+}
+EXPORT_SYMBOL(twl6030_mmc_card_detect);
+
 int twl6030_init_irq(int irq_num, unsigned irq_base, unsigned irq_end)
 {

diff --git a/drivers/mmc/host/omap_hsmmc.c b

[PATCH v2 2/4] omap4 hsmmc: Fix the init if CONFIG_MMC_OMAP_HS is not set

2010-09-18 Thread kishore kadiyala
From: Benoit Cousson b-cous...@ti.com

Avoid possible crash if CONFIG_MMC_OMAP_HS is not set

Signed-off-by: Benoit Cousson b-cous...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index a49f285..ac8541c 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -240,8 +240,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device 
*dev)

 static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
 {
-   struct omap_mmc_platform_data *pdata = dev-platform_data;
+   struct omap_mmc_platform_data *pdata;

+   /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
+   if (!dev) {
+   pr_err(Failed omap4_twl6030_hsmmc_set_late_init\n);
+   return;
+   }
+   pdata = dev-platform_data;
pdata-init =   omap4_twl6030_hsmmc_late_init;
 }

-- 
1.7.0.4

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


[PATCH v2 3/4] omap4 hsmmc: Register offset handling

2010-09-18 Thread kishore kadiyala
The offset handling implementation of omap4 mmc registers which
was already present can't be reused once hwmod modifications are done
for mmc driver.
Since hwmod data file for OMAP4 is an auto generated the base
address for MMC will remain same as OMAP3 and thus the offset deviation
of registers should be updated in the hsmmc driver.
The omap-mmc platform data is updated with a register offset which
will be updated and used in the driver accordingly.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
---
 arch/arm/mach-omap2/devices.c |8 +++-
 arch/arm/mach-omap2/hsmmc.c   |4 
 arch/arm/plat-omap/include/plat/mmc.h |3 +++
 drivers/mmc/host/omap_hsmmc.c |2 +-
 4 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 2dbb265..bb7ec13 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -745,13 +745,13 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data 
**mmc_data,
case 3:
if (!cpu_is_omap44xx())
return;
-   base = OMAP4_MMC4_BASE + OMAP4_MMC_REG_OFFSET;
+   base = OMAP4_MMC4_BASE;
irq = OMAP44XX_IRQ_MMC4;
break;
case 4:
if (!cpu_is_omap44xx())
return;
-   base = OMAP4_MMC5_BASE + OMAP4_MMC_REG_OFFSET;
+   base = OMAP4_MMC5_BASE;
irq = OMAP44XX_IRQ_MMC5;
break;
default:
@@ -762,10 +762,8 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data 
**mmc_data,
size = OMAP2420_MMC_SIZE;
name = mmci-omap;
} else if (cpu_is_omap44xx()) {
-   if (i  3) {
-   base += OMAP4_MMC_REG_OFFSET;
+   if (i  3)
irq += OMAP44XX_IRQ_GIC_START;
-   }
size = OMAP4_HSMMC_SIZE;
name = mmci-omap-hs;
} else {
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index c8f647b..49d76a7 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -261,6 +261,10 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info 
*controllers)
mmc-slots[0].wires = c-wires;
mmc-slots[0].internal_clock = !c-ext_clock;
mmc-dma_mask = 0x;
+   if (cpu_is_omap44xx())
+   mmc-reg_offset = OMAP4_MMC_REG_OFFSET;
+   else
+   mmc-reg_offset = 0;

mmc-get_context_loss_count = hsmmc_get_context_loss;

diff --git a/arch/arm/plat-omap/include/plat/mmc.h 
b/arch/arm/plat-omap/include/plat/mmc.h
index 9b89ec6..4e6ef07 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -71,6 +71,9 @@ struct omap_mmc_platform_data {

u64 dma_mask;

+   /* Register offset deviation */
+   u16 reg_offset;
+
struct omap_mmc_slot_data {

/* 4 wire signaling is optional, and is used for SD/SDIO/HSMMC;
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index a51894d..bfca9ca 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2034,7 +2034,7 @@ static int __init omap_hsmmc_probe(struct platform_device 
*pdev)
host-irq   = irq;
host-id= pdev-id;
host-slot_id   = 0;
-   host-mapbase   = res-start;
+   host-mapbase   = res-start + pdata-reg_offset;
host-base  = ioremap(host-mapbase, SZ_4K);
host-power_mode = MMC_POWER_OFF;

-- 
1.7.0.4


--
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


  1   2   >