Skip to contentSkip to conversation

omap4 hsmmc: Adding card detect support for MMC1

PATCH New kishore kadiyala 6 participants 14 messages Sep 24, 2010 – Oct 20, 2010

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

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

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 <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Madhusudhan Chikkature <[email protected]>
Cc Adrian Hunter <[email protected]>
---
 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(-)
arch/arm/mach-omap2/board-4430sdp.c +6 -1
index 9447644..a49f285 100644
@@ -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;
 }
 
drivers/mfd/twl6030-irq.c +73 -0

85 lines not on this page · raw message

drivers/mmc/host/omap_hsmmc.c +2 -2
index 562dbbb..a51894d 100644
@@ -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;
 	}
 
 	omap_hsmmc_disable_irq(host);
include/linux/i2c/twl.h +31 -0
index 6de90bf..e64894c 100644
@@ -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");
+	return -EIO;
+}
+#endif
 /*----------------------------------------------------------------------*/
 
 /*
Signature · 1 line
1.7.0.4
maintainer
#1 lore raw

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

drivers/mfd/twl6030-irq.c

Quoted 17 lines · 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.

drivers/mfd/twl6030-irq.c +0 -0

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

Tony

#2 lore raw

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

Hi Tony,

Quoted 16 lines · Tony Lindgren
Quoted 14 lines · 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.

Quoted 5 lines

drivers/mfd/twl6030-irq.c

Quoted 2 lines
drivers/mfd/twl6030-irq.c +0 -0

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

#3 lore raw

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

In reply to kishore kadiyala
Cc Samuel Ortiz <[email protected]>
Quoted 218 lines · 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 <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Madhusudhan Chikkature <[email protected]>
Cc Adrian Hunter <[email protected]>

---

?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(-)

arch/arm/mach-omap2/board-4430sdp.c +0 -0
index 9447644..a49f285 100644
@@ -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;
?}

drivers/mfd/twl6030-irq.c +0 -0
index 10bf228..2d3bb82 100644
@@ -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)

drivers/mfd/twl6030-irq.c +72 -0
@@ -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 = 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);
+
 ?int twl6030_init_irq(int irq_num, unsigned irq_base, unsigned irq_end)
 ?{
 
drivers/mmc/host/omap_hsmmc.c +0 -2
index 562dbbb..a51894d 100644
@@ -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;

drivers/mmc/host/omap_hsmmc.c +2 -0
@@ -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;
 ? ? ? ?}
 
 ? ? ? ?omap_hsmmc_disable_irq(host);
include/linux/i2c/twl.h +0 -0
index 6de90bf..e64894c 100644
@@ -141,6 +141,16 @@

?#define TWL6030_CHARGER_CTRL_INT_MASK ?0x10 ?#define TWL6030_CHARGER_FAULT_INT_MASK ? ? ? ? 0x60

include/linux/i2c/twl.h +10 -0
+#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

include/linux/i2c/twl.h +21 -0
@@ -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");
+ ? ? ? return -EIO;
+}
+#endif

?/*----------------------------------------------------------------------*/

?/*
--
1.7.0.4

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

#4 lore raw

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

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

Quoted 223 lines · kishore kadiyala
Cc Samuel Ortiz <[email protected]>
Quoted 218 lines · 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 <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Madhusudhan Chikkature <[email protected]>
Cc Adrian Hunter <[email protected]>

---

?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(-)

arch/arm/mach-omap2/board-4430sdp.c +0 -0
index 9447644..a49f285 100644
@@ -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;
?}

drivers/mfd/twl6030-irq.c +0 -0
index 10bf228..2d3bb82 100644
@@ -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)

drivers/mfd/twl6030-irq.c +72 -0
@@ -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 = 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);
+
 ?int twl6030_init_irq(int irq_num, unsigned irq_base, unsigned irq_end)
 ?{
 
drivers/mmc/host/omap_hsmmc.c +0 -2
index 562dbbb..a51894d 100644
@@ -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;

drivers/mmc/host/omap_hsmmc.c +2 -0
@@ -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;
 ? ? ? ?}
 
 ? ? ? ?omap_hsmmc_disable_irq(host);
include/linux/i2c/twl.h +0 -0
index 6de90bf..e64894c 100644
@@ -141,6 +141,16 @@

?#define TWL6030_CHARGER_CTRL_INT_MASK ?0x10 ?#define TWL6030_CHARGER_FAULT_INT_MASK ? ? ? ? 0x60

include/linux/i2c/twl.h +10 -0
+#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

include/linux/i2c/twl.h +21 -0
@@ -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");
+ ? ? ? return -EIO;
+}
+#endif

?/*----------------------------------------------------------------------*/

?/*
--
1.7.0.4

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

#5 lore raw

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

Gentle Reminder !

Regards,
Kishore

Quoted 235 lines · 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

Quoted 223 lines · kishore kadiyala
Cc Samuel Ortiz <[email protected]>
Quoted 218 lines · 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 <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Madhusudhan Chikkature <[email protected]>
Cc Adrian Hunter <[email protected]>

---

?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(-)

arch/arm/mach-omap2/board-4430sdp.c +0 -0
index 9447644..a49f285 100644
@@ -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;
?}

drivers/mfd/twl6030-irq.c +0 -0
index 10bf228..2d3bb82 100644
@@ -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)

drivers/mfd/twl6030-irq.c +72 -0
@@ -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 = 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);
+
 ?int twl6030_init_irq(int irq_num, unsigned irq_base, unsigned irq_end)
 ?{
 
drivers/mmc/host/omap_hsmmc.c +0 -2
index 562dbbb..a51894d 100644
@@ -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;

drivers/mmc/host/omap_hsmmc.c +2 -0
@@ -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;
 ? ? ? ?}
 
 ? ? ? ?omap_hsmmc_disable_irq(host);
include/linux/i2c/twl.h +0 -0
index 6de90bf..e64894c 100644
@@ -141,6 +141,16 @@

?#define TWL6030_CHARGER_CTRL_INT_MASK ?0x10 ?#define TWL6030_CHARGER_FAULT_INT_MASK ? ? ? ? 0x60

include/linux/i2c/twl.h +10 -0
+#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

include/linux/i2c/twl.h +21 -0
@@ -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");
+ ? ? ? return -EIO;
+}
+#endif

?/*----------------------------------------------------------------------*/

?/*
--
1.7.0.4

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

#6 lore raw

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

Ping !!

Quoted 243 lines · kishore kadiyala

Gentle Reminder !

Regards,
Kishore

Quoted 235 lines · 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

Quoted 223 lines · kishore kadiyala
Cc Samuel Ortiz <[email protected]>
Quoted 218 lines · 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 <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Madhusudhan Chikkature <[email protected]>
Cc Adrian Hunter <[email protected]>

---

?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(-)

arch/arm/mach-omap2/board-4430sdp.c +0 -0
index 9447644..a49f285 100644
@@ -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;
?}

drivers/mfd/twl6030-irq.c +0 -0
index 10bf228..2d3bb82 100644
@@ -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)

drivers/mfd/twl6030-irq.c +72 -0
@@ -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 = 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);
+
 ?int twl6030_init_irq(int irq_num, unsigned irq_base, unsigned irq_end)
 ?{
 
drivers/mmc/host/omap_hsmmc.c +0 -2
index 562dbbb..a51894d 100644
@@ -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;

drivers/mmc/host/omap_hsmmc.c +2 -0
@@ -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;
 ? ? ? ?}
 
 ? ? ? ?omap_hsmmc_disable_irq(host);
include/linux/i2c/twl.h +0 -0
index 6de90bf..e64894c 100644
@@ -141,6 +141,16 @@

?#define TWL6030_CHARGER_CTRL_INT_MASK ?0x10 ?#define TWL6030_CHARGER_FAULT_INT_MASK ? ? ? ? 0x60

include/linux/i2c/twl.h +10 -0
+#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

include/linux/i2c/twl.h +21 -0
@@ -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");
+ ? ? ? return -EIO;
+}
+#endif

?/*----------------------------------------------------------------------*/

?/*
--
1.7.0.4

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

#7 lore raw

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

Quoted 1 line · kishore kadiyala

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.

Quoted 245 lines
Quoted 243 lines · kishore kadiyala

Gentle Reminder !

Regards,
Kishore

Quoted 235 lines · 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

Quoted 223 lines · kishore kadiyala
Cc Samuel Ortiz <[email protected]>
Quoted 218 lines · 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 <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Madhusudhan Chikkature <[email protected]>
Cc Adrian Hunter <[email protected]>

---
 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(-)
arch/arm/mach-omap2/board-4430sdp.c +4 -1
index 9447644..a49f285 100644
@@ -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;
 }

drivers/mfd/twl6030-irq.c +73 -0
index 10bf228..2d3bb82 100644
@@ -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 = 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);
+
  int twl6030_init_irq(int irq_num, unsigned irq_base, unsigned irq_end)
  {
 
drivers/mmc/host/omap_hsmmc.c +0 -2
index 562dbbb..a51894d 100644
@@ -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;

drivers/mmc/host/omap_hsmmc.c +2 -0
@@ -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;
        }
 
        omap_hsmmc_disable_irq(host);
include/linux/i2c/twl.h +31 -1
index 6de90bf..e64894c 100644
@@ -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");
+       return -EIO;
+}
+#endif
  /*----------------------------------------------------------------------*/
 
  /*
--

1.7.0.4

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

Signature · 6 lines
Intel Open Source Technology Centre
http://oss.intel.com/
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#8 lore raw

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

Samuel,

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

Regards,
Kishore

Quoted 261 lines · Samuel Ortiz
Quoted 1 line · kishore kadiyala

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.

Quoted 237 lines
Quoted 235 lines · kishore kadiyala

Gentle Reminder !

Regards,
Kishore

Quoted 228 lines · 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

Quoted 217 lines · kishore kadiyala
Cc Samuel Ortiz <[email protected]>
Quoted 213 lines · 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 <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Madhusudhan Chikkature <[email protected]>
Cc Adrian Hunter <[email protected]>

---

?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(-)

arch/arm/mach-omap2/board-4430sdp.c +0 -0
index 9447644..a49f285 100644
@@ -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;
?}

drivers/mfd/twl6030-irq.c +0 -0
index 10bf228..2d3bb82 100644
@@ -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)

drivers/mfd/twl6030-irq.c +72 -0
@@ -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 = 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);
+
 ?int twl6030_init_irq(int irq_num, unsigned irq_base, unsigned irq_end)
 ?{
 
drivers/mmc/host/omap_hsmmc.c +0 -2
index 562dbbb..a51894d 100644
@@ -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;

drivers/mmc/host/omap_hsmmc.c +2 -0
@@ -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;
 ? ? ? ?}
 
 ? ? ? ?omap_hsmmc_disable_irq(host);
include/linux/i2c/twl.h +0 -0
index 6de90bf..e64894c 100644
@@ -141,6 +141,16 @@

?#define TWL6030_CHARGER_CTRL_INT_MASK ?0x10 ?#define TWL6030_CHARGER_FAULT_INT_MASK ? ? ? ? 0x60

include/linux/i2c/twl.h +10 -0
+#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

include/linux/i2c/twl.h +21 -0
@@ -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");
+ ? ? ? return -EIO;
+}
+#endif

?/*----------------------------------------------------------------------*/

?/*
--
1.7.0.4

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines

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

--
Intel Open Source Technology Centre
http://oss.intel.com/

#9 lore raw

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

<<snip>>

Quoted 40 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
include/linux/i2c/twl.h +0 -0
index 6de90bf..e64894c 100644
@@ -141,6 +141,16 @@

?#define TWL6030_CHARGER_CTRL_INT_MASK ?0x10 ?#define TWL6030_CHARGER_FAULT_INT_MASK ? ? ? ? 0x60

include/linux/i2c/twl.h +10 -0
+#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)
+
+
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8

Quoted 3 lines

?#define TWL4030_CLASS_ID ? ? ? ? ? ? ? 0x4030
?#define TWL6030_CLASS_ID ? ? ? ? ? ? ? 0x6030

include/linux/i2c/twl.h +0 -0
@@ -173,6 +183,27 @@ int twl_i2c_read(u8 mod_no, u8 

*value, u8 reg, unsigned num_bytes);

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8 · line 192

Quoted 10 lines
include/linux/i2c/twl.h +7 -0
 ?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");

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8 · line 197

Quoted 5 lines
include/linux/i2c/twl.h +5 -0
+ ? ? ? return 0;
+}
+#endif
+
+/* MMC1 Controller on OMAP4 uses Phoenix irq for 

Card detect */

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8 · line 201

Quoted 4 lines
include/linux/i2c/twl.h +4 -0
+#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)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8 · line 203

Quoted 2 lines
include/linux/i2c/twl.h +2 -0
+{
+ ? ? ? 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.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8 · line 206

Quoted 3 lines
include/linux/i2c/twl.h +3 -0
+ ? ? ? return -EIO;
+}
+#endif

<<snip>>

#10 lore raw

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

Quoted 48 lines · Charulatha

<<snip>>

Quoted 45 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
include/linux/i2c/twl.h +0 -0
index 6de90bf..e64894c 100644
@@ -141,6 +141,16 @@

?#define TWL6030_CHARGER_CTRL_INT_MASK ?0x10 ?#define TWL6030_CHARGER_FAULT_INT_MASK ? ? ? ? 0x60

include/linux/i2c/twl.h +10 -0
+#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)
+
+
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8

Quoted 3 lines

?#define TWL4030_CLASS_ID ? ? ? ? ? ? ? 0x4030
?#define TWL6030_CLASS_ID ? ? ? ? ? ? ? 0x6030

include/linux/i2c/twl.h +0 -0
@@ -173,6 +183,27 @@ int twl_i2c_read(u8 mod_no, u8

*value, u8 reg, unsigned num_bytes);

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8 · line 192

Quoted 10 lines
include/linux/i2c/twl.h +7 -0
 ?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");

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8 · line 197

Quoted 5 lines
include/linux/i2c/twl.h +5 -0
+ ? ? ? return 0;
+}
+#endif
+
+/* MMC1 Controller on OMAP4 uses Phoenix irq for

Card detect */

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8 · line 201

Quoted 4 lines
include/linux/i2c/twl.h +4 -0
+#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)

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8 · line 203

Quoted 2 lines
include/linux/i2c/twl.h +2 -0
+{
+ ? ? ? 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

Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8 · line 206

Quoted 4 lines
include/linux/i2c/twl.h +3 -0
+ ? ? ? return -EIO;
+}
+#endif

<<snip>>

#11 lore raw

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

Quoted 65 lines

-----Original Message-----
From: kishore kadiyala [mailto:kishorek.kadiyala at gmail.com]
Sent: Friday, October 01, 2010 8:15 PM
To: Varadarajan, Charulatha
Cc: Samuel Ortiz; linux-mmc at vger.kernel.org; linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org; tony at atomide.com; akpm at linux- foundation.org; Chikkature Rajashekar, Madhusudhan;
adrian.hunter at nokia.com
Subject: Re: [PATCH v4 1/4] omap4 hsmmc: Adding card detect support for MMC1

Quoted 50 lines · Charulatha

<<snip>>

Quoted 47 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
include/linux/i2c/twl.h +0 -0
index 6de90bf..e64894c 100644
@@ -141,6 +141,16 @@

?#define TWL6030_CHARGER_CTRL_INT_MASK ?0x10 ?#define TWL6030_CHARGER_FAULT_INT_MASK ? ? ? ? 0x60

include/linux/i2c/twl.h +10 -0
+#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)
+
+
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8

Quoted 3 lines

?#define TWL4030_CLASS_ID ? ? ? ? ? ? ? 0x4030
?#define TWL6030_CLASS_ID ? ? ? ? ? ? ? 0x6030

include/linux/i2c/twl.h +0 -0
@@ -173,6 +183,27 @@ int twl_i2c_read(u8 mod_no, u8

*value, u8 reg, unsigned num_bytes);

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8 · line 192

Quoted 10 lines
include/linux/i2c/twl.h +7 -0
 ?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");

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8 · line 197

Quoted 5 lines
include/linux/i2c/twl.h +5 -0
+ ? ? ? return 0;
+}
+#endif
+
+/* MMC1 Controller on OMAP4 uses Phoenix irq for

Card detect */

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8 · line 201

Quoted 4 lines
include/linux/i2c/twl.h +4 -0
+#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)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
include/linux/i2c/twl.h +2 -0
+{
+ ? ? ? pr_debug("Call back twl6030_mmc_card_detect
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

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

Quoted 8 lines

Regards,
Kishore

Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8 · line 206

Quoted 4 lines
include/linux/i2c/twl.h +3 -0
+ ? ? ? return -EIO;
+}
+#endif

<<snip>>

#12 lore raw

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

In reply to kishore kadiyala
Quoted 65 lines

-----Original Message-----
From: linux-omap-owner at vger.kernel.org [mailto:linux-omap- owner at vger.kernel.org] On Behalf Of kishore kadiyala
Sent: Friday, October 01, 2010 8:15 PM
To: Varadarajan, Charulatha
Cc: Samuel Ortiz; linux-mmc at vger.kernel.org; linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org; tony at atomide.com; akpm at linux- foundation.org; Chikkature Rajashekar, Madhusudhan;
adrian.hunter at nokia.com
Subject: Re: [PATCH v4 1/4] omap4 hsmmc: Adding card detect support for MMC1

Quoted 50 lines · Charulatha

<<snip>>

Quoted 47 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
include/linux/i2c/twl.h +0 -0
index 6de90bf..e64894c 100644
@@ -141,6 +141,16 @@

?#define TWL6030_CHARGER_CTRL_INT_MASK ?0x10 ?#define TWL6030_CHARGER_FAULT_INT_MASK ? ? ? ? 0x60

include/linux/i2c/twl.h +10 -0
+#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)
+
+
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8

Quoted 3 lines

?#define TWL4030_CLASS_ID ? ? ? ? ? ? ? 0x4030
?#define TWL6030_CLASS_ID ? ? ? ? ? ? ? 0x6030

include/linux/i2c/twl.h +0 -0
@@ -173,6 +183,27 @@ int twl_i2c_read(u8 mod_no, u8

*value, u8 reg, unsigned num_bytes);

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8 · line 192

Quoted 10 lines
include/linux/i2c/twl.h +7 -0
 ?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");

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8 · line 197

Quoted 5 lines
include/linux/i2c/twl.h +5 -0
+ ? ? ? return 0;
+}
+#endif
+
+/* MMC1 Controller on OMAP4 uses Phoenix irq for

Card detect */

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8 · line 201

Quoted 4 lines
include/linux/i2c/twl.h +4 -0
+#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)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
include/linux/i2c/twl.h +2 -0
+{
+ ? ? ? pr_debug("Call back twl6030_mmc_card_detect
Quoted 7 lines
Quoted 5 lines
Quoted 1 line

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

One things which I can think of is dev_dbg() would contain the device name so that you know which device the error is associated with. -tarun

Quoted 11 lines
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

include/linux/i2c/twl.h int twl_i2c_read(u8 mod_no, u8 · line 206

Quoted 5 lines
include/linux/i2c/twl.h +3 -0
+ ? ? ? return -EIO;
+}
+#endif

<<snip>>

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

#13 lore raw

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

In reply to kishore kadiyala

Kishore,

<<snip>>

A minor comment

drivers/mfd/twl6030-irq.c int twl6030_interrupt_mask(u8 bit_mask, u8 offset) · line 283

Quoted 10 lines
drivers/mfd/twl6030-irq.c +10 -0
+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

Quoted 6 lines
(quoted diff) +1 -0
+		pr_err("Unkown MMC controller %d in %s\n", 

pdev->id, __func__);

drivers/mfd/twl6030-irq.c +4 -0
+		return ret;
+	}
+	/*
+	 * BIT0 of MMC_CTRL on TWL6030 provides card status for MMC1

drivers/mfd/twl6030-irq.c int twl6030_interrupt_mask(u8 bit_mask, u8 offset) · line 298

Quoted 10 lines
drivers/mfd/twl6030-irq.c +10 -0
+	 * 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>>