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 Samuel Ortiz
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: Failed to read CFG_INPUT_PUPD3, error 
  %d\n,
  +                                                                       
  ret);
  +               return 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 Varadarajan, Charulatha
 
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.

   +       return -EIO;
   +}
   +#endif

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


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-mmc 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 Varadarajan, Charulatha
Kishore, 

snip

A minor comment

 +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.
 +  */

Check multiline comment style

 + 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 = twl_i2c_read_u8(TWL6030_MODULE_ID0, read_reg,
 + TWL6030_MMCCTRL);
 + if (ret = 0)
 + ret = read_reg  STS_MMC;
 + return ret;
 +}
 +EXPORT_SYMBOL(twl6030_mmc_card_detect);
 +

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


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

2010-10-01 Thread Varadarajan, Charulatha


 -Original Message-
 From: kishore kadiyala [mailto:kishorek.kadiy...@gmail.com]
 Sent: Friday, October 01, 2010 8:15 PM
 To: Varadarajan, Charulatha
 Cc: Samuel Ortiz; linux-mmc@vger.kernel.org; linux-o...@vger.kernel.org;
 linux-arm-ker...@lists.infradead.org; t...@atomide.com; a...@linux-
 foundation.org; Chikkature Rajashekar, Madhusudhan;
 adrian.hun...@nokia.com
 Subject: Re: [PATCH v4 1/4] omap4 hsmmc: Adding card detect support for
 MMC1
 
 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
 

device information gets added for debug prints which is very useful
while debugging

 Regards,
 Kishore
 
+       return -EIO;
+}
+#endif
 
  snip
--
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


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;
 +}
 

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

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

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

2010-09-24 Thread Tony Lindgren
* 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.

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