Re: [PATCH] mmc: omap_hsmmc: MAINTAINERS: update

2013-01-31 Thread Venkatraman S
On Thu, Jan 31, 2013 at 2:22 PM, Balaji T K balaj...@ti.com wrote:
 Update Maintainer email for omap_hsmmc,
 as Venkatraman will no longer be able to maintain omap_hsmmc driver.

 Signed-off-by: Venkatraman S svenk...@gmail.com
 Signed-off-by: Balaji T K balaj...@ti.com

Balaji,
  My sign-off is incorrect, as I did not write this patch.

Of course it would great to have a maintainer for this, hence you can add my
Acked-by: Venkatraman S svenk...@gmail.com

 ---
  MAINTAINERS |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

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


[PATCH] mmc: omap_hsmmc: MAINTAINERS: change omap_hsmmc maintenance to orphan

2013-01-16 Thread Venkatraman S
The specified email id is no longer in service.
Update the OMAP HSMMC entry from the MAINTAINERS file as I will
no longer be able to maintain this driver.

Signed-off-by: Venkatraman S svenk...@gmail.com
---
 MAINTAINERS |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index cd5b31f..95778e1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5499,10 +5499,8 @@ S:   Maintained
 F: drivers/mmc/host/omap.c
 
 OMAP HS MMC SUPPORT
-M: Venkatraman S svenk...@ti.com
-L: linux-...@vger.kernel.org
 L: linux-omap@vger.kernel.org
-S: Maintained
+S: Orphan
 F: drivers/mmc/host/omap_hsmmc.c
 
 OMAP RANDOM NUMBER GENERATOR SUPPORT
-- 
1.7.10.4

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


Re: [PATCH 1/7] mmc: omap_hsmmc: Fix Oops in case of data errors

2012-11-26 Thread Venkatraman S
On Mon, Nov 26, 2012 at 2:19 AM, Chris Ball c...@laptop.org wrote:
 Hi Venkat,

 On Mon, Nov 19 2012, Venkatraman S wrote:
 From: Balaji T K balaj...@ti.com

 commit ae4bf788ee9bf7c2d51b0309117d1fcccbdd50a2
 mmc: omap_hsmmc: consolidate error report handling of HSMMC IRQ
 sets both end_cmd and end_trans to 1.

 Setting end_cmd to 1 for Data Timeout/CRC leads to NULL pointer dereference 
 of
 host-cmd as the command complete has previously been handled.
 Set end_cmd only in case of command Timeout/CRC.

 Moreover host-cmd-error should not be updated on data error case, only
 host-data-error needs to be updated.

 Signed-off-by: Balaji T K balaj...@ti.com
 Reviewed-by: Felipe Balbi ba...@ti.com
 Signed-off-by: Venkatraman S svenk...@ti.com

 Thanks, pushed all 7 patches to mmc-next for 3.8.

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


Re: [PATCH 0/5] mmc: omap_hsmmc: Few patches for omap_hsmmc

2012-11-19 Thread Venkatraman S
On Sun, Nov 18, 2012 at 6:39 AM, Chris Ball c...@laptop.org wrote:
 Hi Venkat,

 On Tue, Nov 06 2012, Venkatraman S wrote:
 Hi Chris,
   Please review and merge the below patches.
 The first one is a bug fix that would be required to be sent
 for 3.7-rcX, others are intended for 3.8.

 There have been some changes requested to these -- could you resend your
 3.8 queue to me, please?


Yes - I am sending you now a series of 7 patches that has updated /
cleaned up revisions of
the previous patches. Also, it includes Balaji's mini bug fix series,
which is a better version of
my own fix.

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


[PATCH 1/7] mmc: omap_hsmmc: Fix Oops in case of data errors

2012-11-19 Thread Venkatraman S
From: Balaji T K balaj...@ti.com

commit ae4bf788ee9bf7c2d51b0309117d1fcccbdd50a2
mmc: omap_hsmmc: consolidate error report handling of HSMMC IRQ
sets both end_cmd and end_trans to 1.

Setting end_cmd to 1 for Data Timeout/CRC leads to NULL pointer dereference of
host-cmd as the command complete has previously been handled.
Set end_cmd only in case of command Timeout/CRC.

Moreover host-cmd-error should not be updated on data error case, only
host-data-error needs to be updated.

Signed-off-by: Balaji T K balaj...@ti.com
Reviewed-by: Felipe Balbi ba...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 5434fd8..0fcf792 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -969,10 +969,14 @@ static inline void omap_hsmmc_reset_controller_fsm(struct 
omap_hsmmc_host *host,
__func__);
 }
 
-static void hsmmc_command_incomplete(struct omap_hsmmc_host *host, int err)
+static void hsmmc_command_incomplete(struct omap_hsmmc_host *host,
+   int err, int end_cmd)
 {
omap_hsmmc_reset_controller_fsm(host, SRC);
-   host-cmd-error = err;
+   if (end_cmd) {
+   if (host-cmd)
+   host-cmd-error = err;
+   }
 
if (host-data) {
omap_hsmmc_reset_controller_fsm(host, SRD);
@@ -991,14 +995,16 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host 
*host, int status)
 
if (status  ERR) {
omap_hsmmc_dbg_report_irq(host, status);
+
+   if (status  (CMD_TIMEOUT | CMD_CRC))
+   end_cmd = 1;
if (status  (CMD_TIMEOUT | DATA_TIMEOUT))
-   hsmmc_command_incomplete(host, -ETIMEDOUT);
+   hsmmc_command_incomplete(host, -ETIMEDOUT, end_cmd);
else if (status  (CMD_CRC | DATA_CRC))
-   hsmmc_command_incomplete(host, -EILSEQ);
+   hsmmc_command_incomplete(host, -EILSEQ, end_cmd);
 
-   end_cmd = 1;
if (host-data || host-response_busy) {
-   end_trans = 1;
+   end_trans = !end_cmd;
host-response_busy = 0;
}
}
-- 
1.8.0

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


[PATCH 2/7] mmc: omap_hsmmc: no reset of cmd state machine for DCRC

2012-11-19 Thread Venkatraman S
From: Balaji T K balaj...@ti.com

Avoid soft reset of command internal state machine on data errors.

Signed-off-by: Balaji T K balaj...@ti.com
Reviewed-by: Felipe Balbi ba...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 0fcf792..2d90da8 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -972,8 +972,8 @@ static inline void omap_hsmmc_reset_controller_fsm(struct 
omap_hsmmc_host *host,
 static void hsmmc_command_incomplete(struct omap_hsmmc_host *host,
int err, int end_cmd)
 {
-   omap_hsmmc_reset_controller_fsm(host, SRC);
if (end_cmd) {
+   omap_hsmmc_reset_controller_fsm(host, SRC);
if (host-cmd)
host-cmd-error = err;
}
-- 
1.8.0

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


[PATCH 3/7] mmc: omap_hsmmc: update error code for response_busy cmd

2012-11-19 Thread Venkatraman S
From: Balaji T K balaj...@ti.com

update error code to cmd-error for commands with response_busy and no data

Signed-off-by: Balaji T K balaj...@ti.com
Reviewed-by: Felipe Balbi ba...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 2d90da8..571cd80 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -981,8 +981,8 @@ static void hsmmc_command_incomplete(struct omap_hsmmc_host 
*host,
if (host-data) {
omap_hsmmc_reset_controller_fsm(host, SRD);
omap_hsmmc_dma_cleanup(host, err);
-   }
-
+   } else if (host-mrq  host-mrq-cmd)
+   host-mrq-cmd-error = err;
 }
 
 static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, int status)
-- 
1.8.0

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


[PATCH 4/7] mmc: omap_hsmmc: Enable HSPE bit for high speed cards

2012-11-19 Thread Venkatraman S
From: Hebbar, Gururaja gururaja.heb...@ti.com

HSMMC IP on AM33xx need a special setting to handle High-speed cards.
Other platforms like TI81xx, OMAP4 may need this as-well. This depends
on the HSMMC IP timing closure done for the high speed cards.

From AM335x TRM (SPRUH73F - 18.3.12 Output Signals Generation)

The MMC/SD/SDIO output signals can be driven on either falling edge or
rising edge depending on the SD_HCTL[2] HSPE bit. This feature allows
to reach better timing performance, and thus to increase data transfer
frequency.

There are few pre-requisites for enabling the HSPE bit
- Controller should support High-Speed-Enable Bit and
- Controller should not be using DDR Mode and
- Controller should advertise that it supports High Speed in
  capabilities register and
- MMC/SD clock coming out of controller  25MHz

Signed-off-by: Hebbar, Gururaja gururaja.heb...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 .../devicetree/bindings/mmc/ti-omap-hsmmc.txt  |  1 +
 arch/arm/plat-omap/include/plat/mmc.h  |  1 +
 drivers/mmc/host/omap_hsmmc.c  | 30 +-
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt 
b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
index be76a23..ed271fc 100644
--- a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
+++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
@@ -19,6 +19,7 @@ ti,dual-volt: boolean, supports dual voltage cards
 supply-name examples are vmmc, vmmc_aux etc
 ti,non-removable: non-removable slot (like eMMC)
 ti,needs-special-reset: Requires a special softreset sequence
+ti,needs-special-hs-handling: HSMMC IP needs special setting for handling High 
Speed
 
 Example:
mmc1: mmc@0x4809c000 {
diff --git a/arch/arm/plat-omap/include/plat/mmc.h 
b/arch/arm/plat-omap/include/plat/mmc.h
index 8b4e4f2..346af5b 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -126,6 +126,7 @@ struct omap_mmc_platform_data {
/* we can put the features above into this variable */
 #define HSMMC_HAS_PBIAS(1  0)
 #define HSMMC_HAS_UPDATED_RESET(1  1)
+#define HSMMC_HAS_HSPE_SUPPORT (1  2)
unsigned features;
 
int switch_pin; /* gpio (card detect) */
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 571cd80..18d3f19 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -63,6 +63,7 @@
 
 #define VS18   (1  26)
 #define VS30   (1  25)
+#define HSS(1  21)
 #define SDVS18 (0x5  9)
 #define SDVS30 (0x6  9)
 #define SDVS33 (0x7  9)
@@ -90,6 +91,7 @@
 #define MSBS   (1  5)
 #define BCE(1  1)
 #define FOUR_BIT   (1  1)
+#define HSPE   (1  2)
 #define DDR(1  19)
 #define DW8(1  5)
 #define CC 0x1
@@ -495,6 +497,7 @@ static void omap_hsmmc_set_clock(struct omap_hsmmc_host 
*host)
struct mmc_ios *ios = host-mmc-ios;
unsigned long regval;
unsigned long timeout;
+   unsigned long clkdiv;
 
dev_vdbg(mmc_dev(host-mmc), Set clock to %uHz\n, ios-clock);
 
@@ -502,7 +505,8 @@ static void omap_hsmmc_set_clock(struct omap_hsmmc_host 
*host)
 
regval = OMAP_HSMMC_READ(host-base, SYSCTL);
regval = regval  ~(CLKD_MASK | DTO_MASK);
-   regval = regval | (calc_divisor(host, ios)  6) | (DTO  16);
+   clkdiv = calc_divisor(host, ios);
+   regval = regval | (clkdiv  6) | (DTO  16);
OMAP_HSMMC_WRITE(host-base, SYSCTL, regval);
OMAP_HSMMC_WRITE(host-base, SYSCTL,
OMAP_HSMMC_READ(host-base, SYSCTL) | ICE);
@@ -513,6 +517,27 @@ static void omap_hsmmc_set_clock(struct omap_hsmmc_host 
*host)
 time_before(jiffies, timeout))
cpu_relax();
 
+   /*
+* Enable High-Speed Support
+* Pre-Requisites
+*  - Controller should support High-Speed-Enable Bit
+*  - Controller should not be using DDR Mode
+*  - Controller should advertise that it supports High Speed
+*in capabilities register
+*  - MMC/SD clock coming out of controller  25MHz
+*/
+   if ((mmc_slot(host).features  HSMMC_HAS_HSPE_SUPPORT) 
+   (ios-timing != MMC_TIMING_UHS_DDR50) 
+   ((OMAP_HSMMC_READ(host-base, CAPA)  HSS) == HSS)) {
+   regval = OMAP_HSMMC_READ(host-base, HCTL);
+   if (clkdiv  (clk_get_rate(host-fclk)/clkdiv)  2500)
+   regval |= HSPE;
+   else
+   regval = ~HSPE;
+
+   OMAP_HSMMC_WRITE(host-base, HCTL, regval);
+   }
+
omap_hsmmc_start_clock(host

[PATCH 6/7] mmc: omap_hsmmc: convert critical failure reports to dev_err

2012-11-19 Thread Venkatraman S
Fatal errors for the driver are not reported when just error
debug is enabled. Convert selected dev_dbg to dev_err for
accurate error reporting.

Reported-by: Benoit Cousson b-cous...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index fad9250..9de0b9e 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -305,7 +305,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 
reg = regulator_get(host-dev, vmmc);
if (IS_ERR(reg)) {
-   dev_dbg(host-dev, vmmc regulator missing\n);
+   dev_err(host-dev, vmmc regulator missing\n);
return PTR_ERR(reg);
} else {
mmc_slot(host).set_power = omap_hsmmc_set_power;
@@ -1133,7 +1133,7 @@ static int omap_hsmmc_switch_opcond(struct 
omap_hsmmc_host *host, int vdd)
 
return 0;
 err:
-   dev_dbg(mmc_dev(host-mmc), Unable to switch operating voltage\n);
+   dev_err(mmc_dev(host-mmc), Unable to switch operating voltage\n);
return ret;
 }
 
@@ -1392,7 +1392,7 @@ omap_hsmmc_prepare_data(struct omap_hsmmc_host *host, 
struct mmc_request *req)
if (host-use_dma) {
ret = omap_hsmmc_start_dma_transfer(host, req);
if (ret != 0) {
-   dev_dbg(mmc_dev(host-mmc), MMC start dma failure\n);
+   dev_err(mmc_dev(host-mmc), MMC start dma failure\n);
return ret;
}
}
@@ -1927,13 +1927,13 @@ static int __devinit omap_hsmmc_probe(struct 
platform_device *pdev)
ret = request_irq(host-irq, omap_hsmmc_irq, 0,
mmc_hostname(mmc), host);
if (ret) {
-   dev_dbg(mmc_dev(host-mmc), Unable to grab HSMMC IRQ\n);
+   dev_err(mmc_dev(host-mmc), Unable to grab HSMMC IRQ\n);
goto err_irq;
}
 
if (pdata-init != NULL) {
if (pdata-init(pdev-dev) != 0) {
-   dev_dbg(mmc_dev(host-mmc),
+   dev_err(mmc_dev(host-mmc),
Unable to configure MMC IRQs\n);
goto err_irq_cd_init;
}
@@ -1956,7 +1956,7 @@ static int __devinit omap_hsmmc_probe(struct 
platform_device *pdev)
   IRQF_TRIGGER_RISING | 
IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
   mmc_hostname(mmc), host);
if (ret) {
-   dev_dbg(mmc_dev(host-mmc),
+   dev_err(mmc_dev(host-mmc),
Unable to grab MMC CD IRQ\n);
goto err_irq_cd;
}
-- 
1.8.0

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


[PATCH v2 7/7] mmc: omap_hsmmc: Cleanup up bitmap definitions of Interrupt Register

2012-11-19 Thread Venkatraman S
Define the most frequently used bitmasks of the Interrupt Enable /
Interrupt Status register with consistent naming ( with _EN suffix).

Use meaningful concatenation of bitfields for INT_EN_MASK, which shows
which interrupts are enabled by default.
No functional changes.

Signed-off-by: Venkatraman S svenk...@ti.com
Acked-by: Felipe Balbi ba...@ti.com
---
v1-v2:
 Balaji's comments to not set ERR_EN for INT_EN_MASK is now
 handled.

 drivers/mmc/host/omap_hsmmc.c | 56 ---
 1 file changed, 32 insertions(+), 24 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 9de0b9e..d0a912f 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -80,29 +80,17 @@
 #define CLKD_SHIFT 6
 #define DTO_MASK   0x000F
 #define DTO_SHIFT  16
-#define INT_EN_MASK0x307F0033
-#define BWR_ENABLE (1  4)
-#define BRR_ENABLE (1  5)
-#define DTO_ENABLE (1  20)
 #define INIT_STREAM(1  1)
 #define DP_SELECT  (1  21)
 #define DDIR   (1  4)
-#define DMA_EN 0x1
+#define DMAE   0x1
 #define MSBS   (1  5)
 #define BCE(1  1)
 #define FOUR_BIT   (1  1)
 #define HSPE   (1  2)
 #define DDR(1  19)
 #define DW8(1  5)
-#define CC 0x1
-#define TC 0x02
 #define OD 0x1
-#define ERR(1  15)
-#define CMD_TIMEOUT(1  16)
-#define DATA_TIMEOUT   (1  20)
-#define CMD_CRC(1  17)
-#define DATA_CRC   (1  21)
-#define CARD_ERR   (1  28)
 #define STAT_CLEAR 0x
 #define INIT_STREAM_CMD0x
 #define DUAL_VOLT_OCR_BIT  7
@@ -111,6 +99,26 @@
 #define SOFTRESET  (1  1)
 #define RESETDONE  (1  0)
 
+/* Interrupt masks for IE and ISE register */
+#define CC_EN  (1  0)
+#define TC_EN  (1  1)
+#define BWR_EN (1  4)
+#define BRR_EN (1  5)
+#define ERR_EN (1  15)
+#define CTO_EN (1  16)
+#define CCRC_EN(1  17)
+#define CEB_EN (1  18)
+#define CIE_EN (1  19)
+#define DTO_EN (1  20)
+#define DCRC_EN(1  21)
+#define DEB_EN (1  22)
+#define CERR_EN(1  28)
+#define BADA_EN(1  29)
+
+#define INT_EN_MASK(BADA_EN | CERR_EN | DEB_EN | DCRC_EN |\
+   DTO_EN | CIE_EN | CEB_EN | CCRC_EN | CTO_EN | \
+   BRR_EN | BWR_EN | TC_EN | CC_EN)
+
 #define MMC_AUTOSUSPEND_DELAY  100
 #define MMC_TIMEOUT_MS 20
 #define OMAP_MMC_MIN_CLOCK 40
@@ -458,13 +466,13 @@ static void omap_hsmmc_enable_irq(struct omap_hsmmc_host 
*host,
unsigned int irq_mask;
 
if (host-use_dma)
-   irq_mask = INT_EN_MASK  ~(BRR_ENABLE | BWR_ENABLE);
+   irq_mask = INT_EN_MASK  ~(BRR_EN | BWR_EN);
else
irq_mask = INT_EN_MASK;
 
/* Disable timeout for erases */
if (cmd-opcode == MMC_ERASE)
-   irq_mask = ~DTO_ENABLE;
+   irq_mask = ~DTO_EN;
 
OMAP_HSMMC_WRITE(host-base, STAT, STAT_CLEAR);
OMAP_HSMMC_WRITE(host-base, ISE, irq_mask);
@@ -702,8 +710,8 @@ static void send_init_stream(struct omap_hsmmc_host *host)
OMAP_HSMMC_WRITE(host-base, CMD, INIT_STREAM_CMD);
 
timeout = jiffies + msecs_to_jiffies(MMC_TIMEOUT_MS);
-   while ((reg != CC)  time_before(jiffies, timeout))
-   reg = OMAP_HSMMC_READ(host-base, STAT)  CC;
+   while ((reg != CC_EN)  time_before(jiffies, timeout))
+   reg = OMAP_HSMMC_READ(host-base, STAT)  CC_EN;
 
OMAP_HSMMC_WRITE(host-base, CON,
OMAP_HSMMC_READ(host-base, CON)  ~INIT_STREAM);
@@ -794,7 +802,7 @@ omap_hsmmc_start_command(struct omap_hsmmc_host *host, 
struct mmc_command *cmd,
}
 
if (host-use_dma)
-   cmdreg |= DMA_EN;
+   cmdreg |= DMAE;
 
host-req_in_progress = 1;
 
@@ -1018,14 +1026,14 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host 
*host, int status)
data = host-data;
dev_vdbg(mmc_dev(host-mmc), IRQ Status is %x\n, status);
 
-   if (status  ERR) {
+   if (status  ERR_EN) {
omap_hsmmc_dbg_report_irq(host, status);
 
-   if (status  (CMD_TIMEOUT | CMD_CRC))
+   if (status  (CTO_EN | CCRC_EN))
end_cmd = 1;
-   if (status  (CMD_TIMEOUT | DATA_TIMEOUT))
+   if (status  (CTO_EN | DTO_EN))
hsmmc_command_incomplete(host, -ETIMEDOUT, end_cmd

Re: [PATCH 4/5] mmc: omap_hsmmc: cleanup the bitmap definitions of Interrupt Register

2012-11-08 Thread Venkatraman S
On Wed, Nov 7, 2012 at 6:54 PM, Balaji T K balaj...@ti.com wrote:
 On Tuesday 06 November 2012 10:22 PM, Venkatraman S wrote:

 Define the most frequently used bitmasks of the Interrupt Enable /
 Interrupt Status register with consistent naming ( with _EN suffix).

 Use meaningful concatenation of bitfields for INT_EN_MASK, which shows
 which interrupts are enabled by default.
 No functional changes.

 Signed-off-by: Venkatraman S svenk...@ti.com


 Hi Venkat,
 Not sure if you had chance to look into my comments on Version 2 of this
 patch


 Acked-by: Felipe Balbi ba...@ti.com
 ---
   drivers/mmc/host/omap_hsmmc.c | 54
 +--
   1 file changed, 31 insertions(+), 23 deletions(-)

 diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
 index e91e85a..d16ef0f 100644
 --- a/drivers/mmc/host/omap_hsmmc.c
 +++ b/drivers/mmc/host/omap_hsmmc.c
 @@ -80,29 +80,17 @@
   #define CLKD_SHIFT6
   #define DTO_MASK  0x000F
   #define DTO_SHIFT 16
 -#define INT_EN_MASK0x307F0033
 -#define BWR_ENABLE (1  4)
 -#define BRR_ENABLE (1  5)
 -#define DTO_ENABLE (1  20)
   #define INIT_STREAM   (1  1)
   #define DP_SELECT (1  21)
   #define DDIR  (1  4)
 -#define DMA_EN 0x1
 +#define DMAE   0x1


 This change is not needed or may not be part of this patch.

Actually its about consistency in naming convention. As part of this
patch, the IE, ISE and STAT family of registers all use the _EN suffix
for the bitfields, so this one had to have something different.


   #define MSBS  (1  5)
   #define BCE   (1  1)
   #define FOUR_BIT  (1  1)
   #define HSPE  (1  2)
   #define DDR   (1  19)
   #define DW8   (1  5)
 -#define CC 0x1
 -#define TC 0x02
   #define OD0x1
 -#define ERR(1  15)
 -#define CMD_TIMEOUT(1  16)
 -#define DATA_TIMEOUT   (1  20)
 -#define CMD_CRC(1  17)
 -#define DATA_CRC   (1  21)
 -#define CARD_ERR   (1  28)
   #define STAT_CLEAR0x
   #define INIT_STREAM_CMD   0x
   #define DUAL_VOLT_OCR_BIT 7
 @@ -111,6 +99,26 @@
   #define SOFTRESET (1  1)
   #define RESETDONE (1  0)

 +/* Interrupt masks for IE and ISE register */
 +#define CC_EN  (1  0)
 +#define TC_EN  (1  1)


 You might want to retain CC, TC ... which has been defined and already
 used for in many places for MMCHS_STAT instead of CC_EN. CC_EN is not
 mentioned in TRM however CC is defined as bit field in TRM Register spec.
 So It would be better to reuse the previously defined CC, TC (and other bits
 fields) for MMCHS_IE, MMCHS_ISE inorder to reduce the number of #define's.


Probably yes - One way would be to use TRM fields as is, but sometimes
it leads to conflicts
like the DMAE/DMA_EN case.

Do you think it would be better to switch to _IE suffix instead of _EN ?

 +#define BWR_EN (1  4)
 +#define BRR_EN (1  5)
 +#define ERR_EN (1  15)


 ERR_EN is not applicable for Interrupt masks for IE and ISE register

Ok. The define would still be needed, but probably I shouldn't include
it in INT_EN_MASK then ?


 +#define CTO_EN (1  16)
 +#define CCRC_EN(1  17)
 +#define CEB_EN (1  18)
 +#define CIE_EN (1  19)
 +#define DTO_EN (1  20)
 +#define DCRC_EN(1  21)
 +#define DEB_EN (1  22)
 +#define CERR_EN(1  28)
 +#define BADA_EN(1  29)
 +
 +#define INT_EN_MASK(BADA_EN | CERR_EN | DEB_EN | DCRC_EN |\
 +   DTO_EN | CIE_EN | CEB_EN | CCRC_EN | CTO_EN | ERR_EN |\
 +   BRR_EN | BWR_EN | TC_EN | CC_EN)
 +
   #define MMC_AUTOSUSPEND_DELAY 100
   #define MMC_TIMEOUT_MS20
   #define OMAP_MMC_MIN_CLOCK40
 @@ -458,13 +466,13 @@ static void omap_hsmmc_enable_irq(struct
 omap_hsmmc_host *host,
 unsigned int irq_mask;

 if (host-use_dma)
 -   irq_mask = INT_EN_MASK  ~(BRR_ENABLE | BWR_ENABLE);
 +   irq_mask = INT_EN_MASK  ~(BRR_EN | BWR_EN);
 else
 irq_mask = INT_EN_MASK;

 /* Disable timeout for erases */
 if (cmd-opcode == MMC_ERASE)
 -   irq_mask = ~DTO_ENABLE;
 +   irq_mask = ~DTO_EN;

 OMAP_HSMMC_WRITE(host-base, STAT, STAT_CLEAR);
 OMAP_HSMMC_WRITE(host-base, ISE, irq_mask);
 @@ -702,8 +710,8 @@ static void send_init_stream(struct omap_hsmmc_host
 *host)
 OMAP_HSMMC_WRITE(host-base, CMD, INIT_STREAM_CMD);

 timeout

Re: [RFC/PATCH] mmc: omap_hsmmc: introduce omap_hsmmc_prepare/complete

2012-11-06 Thread Venkatraman S
On Mon, Oct 22, 2012 at 6:29 PM, Felipe Balbi ba...@ti.com wrote:
 prepare() is supposed to prevent new children from
 being registered. On the MMC subsystem, children
 (new cards) registration starts with the card
 detect IRQ.

 Move card detect IRQ disabling to prepare() so that
 no new cards will be registered while we're trying
 to suspend.

 Likewise, move card detect IRQ enabling to complete()
 so we only try to register new children after our MMC
 IP is back up.

 Signed-off-by: Felipe Balbi ba...@ti.com
 ---

 Venkat, do you think the patch below makes sense ?

Except for the minor nit mentioned below, it works well.
I'll include it in my patch series.


 cheers

  drivers/mmc/host/omap_hsmmc.c | 45 
 ---
  1 file changed, 25 insertions(+), 20 deletions(-)

 diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
 index 54bfd0c..4c8b41e 100644
 --- a/drivers/mmc/host/omap_hsmmc.c
 +++ b/drivers/mmc/host/omap_hsmmc.c
 @@ -2022,6 +2022,26 @@ static int __devexit omap_hsmmc_remove(struct 
 platform_device *pdev)
  }

  #ifdef CONFIG_PM
 +static int omap_hsmmc_prepare(struct device *dev)
 +{
 +   struct omap_hsmmc_host *host = dev_get_drvdata(dev);
 +
 +   if (host-pdata-suspend)
 +   return host-pdata-suspend(dev, host-slot_id);
 +
 +   return 0;
 +}
 +
 +static int omap_hsmmc_complete(struct device *dev)

The .complete() function prototype requires to return void.
This one emits a compilation warning.
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/5] mmc: omap_hsmmc: Few patches for omap_hsmmc

2012-11-06 Thread Venkatraman S
Hi Chris,
  Please review and merge the below patches.
The first one is a bug fix that would be required to be sent
for 3.7-rcX, others are intended for 3.8.

Thanks,
Venkat.
=

Felipe Balbi (1):
  mmc: omap_hsmmc: introduce omap_hsmmc_prepare/complete

Hebbar, Gururaja (1):
  mmc: omap_hsmmc: Enable HSPE bit for high speed cards

Venkatraman S (3):
  mmc: omap_hsmmc: Avoid host-cmd dereference during data transfer
failures
  mmc: omap_hsmmc: cleanup the bitmap definitions of Interrupt Register
  mmc: omap_hsmmc: convert critical failure reports to dev_err

 .../devicetree/bindings/mmc/ti-omap-hsmmc.txt  |   1 +
 arch/arm/plat-omap/include/plat/mmc.h  |   1 +
 drivers/mmc/host/omap_hsmmc.c  | 143 +
 3 files changed, 94 insertions(+), 51 deletions(-)

-- 
1.8.0

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


[PATCH 1/5] mmc: omap_hsmmc: Avoid host-cmd dereference during data transfer failures

2012-11-06 Thread Venkatraman S
Sometimes, a error occurs just after the Command has been reported
to be successful (CC=1) but before data transfer completes (TC=1).
Setting end_cmd=1 here leads to a NULL pointer dereference of
host-cmd as the command complete has previously been handled.

Set end_cmd only when command complete has not been handled
before, else a NULL pointer dereference occurs.

CC: sta...@vger.kernel.org
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 5434fd8..06d2e03 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -996,7 +996,8 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, 
int status)
else if (status  (CMD_CRC | DATA_CRC))
hsmmc_command_incomplete(host, -EILSEQ);
 
-   end_cmd = 1;
+   if (host-cmd)
+   end_cmd = 1;
if (host-data || host-response_busy) {
end_trans = 1;
host-response_busy = 0;
-- 
1.8.0

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


[PATCH 2/5] mmc: omap_hsmmc: Enable HSPE bit for high speed cards

2012-11-06 Thread Venkatraman S
From: Hebbar, Gururaja gururaja.heb...@ti.com

HSMMC IP on AM33xx need a special setting to handle High-speed cards.
Other platforms like TI81xx, OMAP4 may need this as-well. This depends
on the HSMMC IP timing closure done for the high speed cards.

From AM335x TRM (SPRUH73F - 18.3.12 Output Signals Generation)

The MMC/SD/SDIO output signals can be driven on either falling edge or
rising edge depending on the SD_HCTL[2] HSPE bit. This feature allows
to reach better timing performance, and thus to increase data transfer
frequency.

There are few pre-requisites for enabling the HSPE bit
- Controller should support High-Speed-Enable Bit and
- Controller should not be using DDR Mode and
- Controller should advertise that it supports High Speed in
  capabilities register and
- MMC/SD clock coming out of controller  25MHz

Signed-off-by: Hebbar, Gururaja gururaja.heb...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 .../devicetree/bindings/mmc/ti-omap-hsmmc.txt  |  1 +
 arch/arm/plat-omap/include/plat/mmc.h  |  1 +
 drivers/mmc/host/omap_hsmmc.c  | 30 +-
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt 
b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
index be76a23..ed271fc 100644
--- a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
+++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
@@ -19,6 +19,7 @@ ti,dual-volt: boolean, supports dual voltage cards
 supply-name examples are vmmc, vmmc_aux etc
 ti,non-removable: non-removable slot (like eMMC)
 ti,needs-special-reset: Requires a special softreset sequence
+ti,needs-special-hs-handling: HSMMC IP needs special setting for handling High 
Speed
 
 Example:
mmc1: mmc@0x4809c000 {
diff --git a/arch/arm/plat-omap/include/plat/mmc.h 
b/arch/arm/plat-omap/include/plat/mmc.h
index 8b4e4f2..346af5b 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -126,6 +126,7 @@ struct omap_mmc_platform_data {
/* we can put the features above into this variable */
 #define HSMMC_HAS_PBIAS(1  0)
 #define HSMMC_HAS_UPDATED_RESET(1  1)
+#define HSMMC_HAS_HSPE_SUPPORT (1  2)
unsigned features;
 
int switch_pin; /* gpio (card detect) */
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 06d2e03..c277da4 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -63,6 +63,7 @@
 
 #define VS18   (1  26)
 #define VS30   (1  25)
+#define HSS(1  21)
 #define SDVS18 (0x5  9)
 #define SDVS30 (0x6  9)
 #define SDVS33 (0x7  9)
@@ -90,6 +91,7 @@
 #define MSBS   (1  5)
 #define BCE(1  1)
 #define FOUR_BIT   (1  1)
+#define HSPE   (1  2)
 #define DDR(1  19)
 #define DW8(1  5)
 #define CC 0x1
@@ -495,6 +497,7 @@ static void omap_hsmmc_set_clock(struct omap_hsmmc_host 
*host)
struct mmc_ios *ios = host-mmc-ios;
unsigned long regval;
unsigned long timeout;
+   unsigned long clkdiv;
 
dev_vdbg(mmc_dev(host-mmc), Set clock to %uHz\n, ios-clock);
 
@@ -502,7 +505,8 @@ static void omap_hsmmc_set_clock(struct omap_hsmmc_host 
*host)
 
regval = OMAP_HSMMC_READ(host-base, SYSCTL);
regval = regval  ~(CLKD_MASK | DTO_MASK);
-   regval = regval | (calc_divisor(host, ios)  6) | (DTO  16);
+   clkdiv = calc_divisor(host, ios);
+   regval = regval | (clkdiv  6) | (DTO  16);
OMAP_HSMMC_WRITE(host-base, SYSCTL, regval);
OMAP_HSMMC_WRITE(host-base, SYSCTL,
OMAP_HSMMC_READ(host-base, SYSCTL) | ICE);
@@ -513,6 +517,27 @@ static void omap_hsmmc_set_clock(struct omap_hsmmc_host 
*host)
 time_before(jiffies, timeout))
cpu_relax();
 
+   /*
+* Enable High-Speed Support
+* Pre-Requisites
+*  - Controller should support High-Speed-Enable Bit
+*  - Controller should not be using DDR Mode
+*  - Controller should advertise that it supports High Speed
+*in capabilities register
+*  - MMC/SD clock coming out of controller  25MHz
+*/
+   if ((mmc_slot(host).features  HSMMC_HAS_HSPE_SUPPORT) 
+   (ios-timing != MMC_TIMING_UHS_DDR50) 
+   ((OMAP_HSMMC_READ(host-base, CAPA)  HSS) == HSS)) {
+   regval = OMAP_HSMMC_READ(host-base, HCTL);
+   if (clkdiv  (clk_get_rate(host-fclk)/clkdiv)  2500)
+   regval |= HSPE;
+   else
+   regval = ~HSPE;
+
+   OMAP_HSMMC_WRITE(host-base, HCTL, regval);
+   }
+
omap_hsmmc_start_clock(host

[PATCH 3/5] mmc: omap_hsmmc: introduce omap_hsmmc_prepare/complete

2012-11-06 Thread Venkatraman S
From: Felipe Balbi ba...@ti.com

prepare() is supposed to prevent new children from
being registered. On the MMC subsystem, children
(new cards) registration starts with the card
detect IRQ.

Move card detect IRQ disabling to prepare() so that
no new cards will be registered while we're trying
to suspend.

Likewise, move card detect IRQ enabling to complete()
so we only try to register new children after our MMC
IP is back up.

Signed-off-by: Felipe Balbi ba...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c | 44 +++
 1 file changed, 24 insertions(+), 20 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index c277da4..e91e85a 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2065,6 +2065,25 @@ static int __devexit omap_hsmmc_remove(struct 
platform_device *pdev)
 }
 
 #ifdef CONFIG_PM
+static int omap_hsmmc_prepare(struct device *dev)
+{
+   struct omap_hsmmc_host *host = dev_get_drvdata(dev);
+
+   if (host-pdata-suspend)
+   return host-pdata-suspend(dev, host-slot_id);
+
+   return 0;
+}
+
+static void omap_hsmmc_complete(struct device *dev)
+{
+   struct omap_hsmmc_host *host = dev_get_drvdata(dev);
+
+   if (host-pdata-resume)
+   host-pdata-resume(dev, host-slot_id);
+
+}
+
 static int omap_hsmmc_suspend(struct device *dev)
 {
int ret = 0;
@@ -2078,23 +2097,10 @@ static int omap_hsmmc_suspend(struct device *dev)
 
pm_runtime_get_sync(host-dev);
host-suspended = 1;
-   if (host-pdata-suspend) {
-   ret = host-pdata-suspend(dev, host-slot_id);
-   if (ret) {
-   dev_dbg(dev, Unable to handle MMC board
-level suspend\n);
-   host-suspended = 0;
-   return ret;
-   }
-   }
ret = mmc_suspend_host(host-mmc);
 
if (ret) {
host-suspended = 0;
-   if (host-pdata-resume) {
-   if (host-pdata-resume(dev, host-slot_id))
-   dev_dbg(dev, Unmask interrupt failed\n);
-   }
goto err;
}
 
@@ -2131,12 +2137,6 @@ static int omap_hsmmc_resume(struct device *dev)
if (!(host-mmc-pm_flags  MMC_PM_KEEP_POWER))
omap_hsmmc_conf_bus_power(host);
 
-   if (host-pdata-resume) {
-   ret = host-pdata-resume(dev, host-slot_id);
-   if (ret)
-   dev_dbg(dev, Unmask interrupt failed\n);
-   }
-
omap_hsmmc_protect_card(host);
 
/* Notify the core to resume the host */
@@ -2152,8 +2152,10 @@ static int omap_hsmmc_resume(struct device *dev)
 }
 
 #else
+#define omap_hsmmc_prepare NULL
+#define omap_hsmmc_completeNULL
 #define omap_hsmmc_suspend NULL
-#define omap_hsmmc_resume  NULL
+#define omap_hsmmc_resume  NULL
 #endif
 
 static int omap_hsmmc_runtime_suspend(struct device *dev)
@@ -2181,6 +2183,8 @@ static int omap_hsmmc_runtime_resume(struct device *dev)
 static struct dev_pm_ops omap_hsmmc_dev_pm_ops = {
.suspend= omap_hsmmc_suspend,
.resume = omap_hsmmc_resume,
+   .prepare= omap_hsmmc_prepare,
+   .complete   = omap_hsmmc_complete,
.runtime_suspend = omap_hsmmc_runtime_suspend,
.runtime_resume = omap_hsmmc_runtime_resume,
 };
-- 
1.8.0

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


[PATCH 4/5] mmc: omap_hsmmc: cleanup the bitmap definitions of Interrupt Register

2012-11-06 Thread Venkatraman S
Define the most frequently used bitmasks of the Interrupt Enable /
Interrupt Status register with consistent naming ( with _EN suffix).

Use meaningful concatenation of bitfields for INT_EN_MASK, which shows
which interrupts are enabled by default.
No functional changes.

Signed-off-by: Venkatraman S svenk...@ti.com
Acked-by: Felipe Balbi ba...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c | 54 +--
 1 file changed, 31 insertions(+), 23 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index e91e85a..d16ef0f 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -80,29 +80,17 @@
 #define CLKD_SHIFT 6
 #define DTO_MASK   0x000F
 #define DTO_SHIFT  16
-#define INT_EN_MASK0x307F0033
-#define BWR_ENABLE (1  4)
-#define BRR_ENABLE (1  5)
-#define DTO_ENABLE (1  20)
 #define INIT_STREAM(1  1)
 #define DP_SELECT  (1  21)
 #define DDIR   (1  4)
-#define DMA_EN 0x1
+#define DMAE   0x1
 #define MSBS   (1  5)
 #define BCE(1  1)
 #define FOUR_BIT   (1  1)
 #define HSPE   (1  2)
 #define DDR(1  19)
 #define DW8(1  5)
-#define CC 0x1
-#define TC 0x02
 #define OD 0x1
-#define ERR(1  15)
-#define CMD_TIMEOUT(1  16)
-#define DATA_TIMEOUT   (1  20)
-#define CMD_CRC(1  17)
-#define DATA_CRC   (1  21)
-#define CARD_ERR   (1  28)
 #define STAT_CLEAR 0x
 #define INIT_STREAM_CMD0x
 #define DUAL_VOLT_OCR_BIT  7
@@ -111,6 +99,26 @@
 #define SOFTRESET  (1  1)
 #define RESETDONE  (1  0)
 
+/* Interrupt masks for IE and ISE register */
+#define CC_EN  (1  0)
+#define TC_EN  (1  1)
+#define BWR_EN (1  4)
+#define BRR_EN (1  5)
+#define ERR_EN (1  15)
+#define CTO_EN (1  16)
+#define CCRC_EN(1  17)
+#define CEB_EN (1  18)
+#define CIE_EN (1  19)
+#define DTO_EN (1  20)
+#define DCRC_EN(1  21)
+#define DEB_EN (1  22)
+#define CERR_EN(1  28)
+#define BADA_EN(1  29)
+
+#define INT_EN_MASK(BADA_EN | CERR_EN | DEB_EN | DCRC_EN |\
+   DTO_EN | CIE_EN | CEB_EN | CCRC_EN | CTO_EN | ERR_EN |\
+   BRR_EN | BWR_EN | TC_EN | CC_EN)
+
 #define MMC_AUTOSUSPEND_DELAY  100
 #define MMC_TIMEOUT_MS 20
 #define OMAP_MMC_MIN_CLOCK 40
@@ -458,13 +466,13 @@ static void omap_hsmmc_enable_irq(struct omap_hsmmc_host 
*host,
unsigned int irq_mask;
 
if (host-use_dma)
-   irq_mask = INT_EN_MASK  ~(BRR_ENABLE | BWR_ENABLE);
+   irq_mask = INT_EN_MASK  ~(BRR_EN | BWR_EN);
else
irq_mask = INT_EN_MASK;
 
/* Disable timeout for erases */
if (cmd-opcode == MMC_ERASE)
-   irq_mask = ~DTO_ENABLE;
+   irq_mask = ~DTO_EN;
 
OMAP_HSMMC_WRITE(host-base, STAT, STAT_CLEAR);
OMAP_HSMMC_WRITE(host-base, ISE, irq_mask);
@@ -702,8 +710,8 @@ static void send_init_stream(struct omap_hsmmc_host *host)
OMAP_HSMMC_WRITE(host-base, CMD, INIT_STREAM_CMD);
 
timeout = jiffies + msecs_to_jiffies(MMC_TIMEOUT_MS);
-   while ((reg != CC)  time_before(jiffies, timeout))
-   reg = OMAP_HSMMC_READ(host-base, STAT)  CC;
+   while ((reg != CC_EN)  time_before(jiffies, timeout))
+   reg = OMAP_HSMMC_READ(host-base, STAT)  CC_EN;
 
OMAP_HSMMC_WRITE(host-base, CON,
OMAP_HSMMC_READ(host-base, CON)  ~INIT_STREAM);
@@ -794,7 +802,7 @@ omap_hsmmc_start_command(struct omap_hsmmc_host *host, 
struct mmc_command *cmd,
}
 
if (host-use_dma)
-   cmdreg |= DMA_EN;
+   cmdreg |= DMAE;
 
host-req_in_progress = 1;
 
@@ -1014,11 +1022,11 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host 
*host, int status)
data = host-data;
dev_vdbg(mmc_dev(host-mmc), IRQ Status is %x\n, status);
 
-   if (status  ERR) {
+   if (status  ERR_EN) {
omap_hsmmc_dbg_report_irq(host, status);
-   if (status  (CMD_TIMEOUT | DATA_TIMEOUT))
+   if (status  (CTO_EN | DTO_EN))
hsmmc_command_incomplete(host, -ETIMEDOUT);
-   else if (status  (CMD_CRC | DATA_CRC))
+   else if (status  (CCRC_EN | DCRC_EN))
hsmmc_command_incomplete(host, -EILSEQ);
 
if (host-cmd)
@@ -1029,9

[PATCH 5/5] mmc: omap_hsmmc: convert critical failure reports to dev_err

2012-11-06 Thread Venkatraman S
Fatal errors for the driver are not reported when just error
debug is enabled. Convert selected dev_dbg to dev_err for
accurate error reporting.

Reported-by: Benoit Cousson b-cous...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index d16ef0f..830c59b 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -313,7 +313,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 
reg = regulator_get(host-dev, vmmc);
if (IS_ERR(reg)) {
-   dev_dbg(host-dev, vmmc regulator missing\n);
+   dev_err(host-dev, vmmc regulator missing\n);
return PTR_ERR(reg);
} else {
mmc_slot(host).set_power = omap_hsmmc_set_power;
@@ -1136,7 +1136,7 @@ static int omap_hsmmc_switch_opcond(struct 
omap_hsmmc_host *host, int vdd)
 
return 0;
 err:
-   dev_dbg(mmc_dev(host-mmc), Unable to switch operating voltage\n);
+   dev_err(mmc_dev(host-mmc), Unable to switch operating voltage\n);
return ret;
 }
 
@@ -1395,7 +1395,7 @@ omap_hsmmc_prepare_data(struct omap_hsmmc_host *host, 
struct mmc_request *req)
if (host-use_dma) {
ret = omap_hsmmc_start_dma_transfer(host, req);
if (ret != 0) {
-   dev_dbg(mmc_dev(host-mmc), MMC start dma failure\n);
+   dev_err(mmc_dev(host-mmc), MMC start dma failure\n);
return ret;
}
}
@@ -1930,13 +1930,13 @@ static int __devinit omap_hsmmc_probe(struct 
platform_device *pdev)
ret = request_irq(host-irq, omap_hsmmc_irq, 0,
mmc_hostname(mmc), host);
if (ret) {
-   dev_dbg(mmc_dev(host-mmc), Unable to grab HSMMC IRQ\n);
+   dev_err(mmc_dev(host-mmc), Unable to grab HSMMC IRQ\n);
goto err_irq;
}
 
if (pdata-init != NULL) {
if (pdata-init(pdev-dev) != 0) {
-   dev_dbg(mmc_dev(host-mmc),
+   dev_err(mmc_dev(host-mmc),
Unable to configure MMC IRQs\n);
goto err_irq_cd_init;
}
@@ -1959,7 +1959,7 @@ static int __devinit omap_hsmmc_probe(struct 
platform_device *pdev)
   IRQF_TRIGGER_RISING | 
IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
   mmc_hostname(mmc), host);
if (ret) {
-   dev_dbg(mmc_dev(host-mmc),
+   dev_err(mmc_dev(host-mmc),
Unable to grab MMC CD IRQ\n);
goto err_irq_cd;
}
-- 
1.8.0

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


Re: [PATCH V3] mmc: omap_hsmmc: Enable HSPE bit for high speed cards

2012-10-31 Thread Venkatraman S
On Wed, Oct 31, 2012 at 5:56 PM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Wed, Oct 31, 2012 at 05:27:36PM +0530, Hebbar, Gururaja wrote:
 HSMMC IP on AM33xx need a special setting to handle High-speed cards.
 Other platforms like TI81xx, OMAP4 may need this as-well. This depends
 on the HSMMC IP timing closure done for the high speed cards.

 From AM335x TRM (SPRUH73F - 18.3.12 Output Signals Generation)

 The MMC/SD/SDIO output signals can be driven on either falling edge or
 rising edge depending on the SD_HCTL[2] HSPE bit. This feature allows
 to reach better timing performance, and thus to increase data transfer
 frequency.

 There are few pre-requisites for enabling the HSPE bit
 - Controller should support High-Speed-Enable Bit and
 - Controller should not be using DDR Mode and
 - Controller should advertise that it supports High Speed in
   capabilities register and
 - MMC/SD clock coming out of controller  25MHz

 Note:
 The implementation reuses the output of calc_divisor() so as to reduce
 code addition.

 Signed-off-by: Hebbar, Gururaja gururaja.heb...@ti.com

 this looks good to my eyes, hopefully I haven't missed anything:

 Reviewed-by: Felipe Balbi ba...@ti.com


Except for the excessively verbose comments which are just duplicating the code,
Quote
 +  * Enable High-Speed Support
 +  * Pre-Requisites
 +  *  - Controller should support High-Speed-Enable Bit
 +  *  - Controller should not be using DDR Mode
 +  *  - Controller should advertise that it supports High Speed
 +  *in capabilities register
 +  *  - MMC/SD clock coming out of controller  25MHz
 +  */
/Quote

I'm ok with this patch as well. I'm putting a few patches under test
including this one,
and will send it to Chris as part of that series.
I'll strip out the above mentioned comments, unless there are any objections.

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


Re: [RFC/PATCH] mmc: omap_hsmmc: introduce omap_hsmmc_prepare/complete

2012-10-26 Thread Venkatraman S

On Thursday 25 October 2012 11:34 PM, Felipe Balbi wrote:

Hi,

On Mon, Oct 22, 2012 at 04:27:08PM +0300, Felipe Balbi wrote:

On Mon, Oct 22, 2012 at 03:59:28PM +0300, Felipe Balbi wrote:

prepare() is supposed to prevent new children from
being registered. On the MMC subsystem, children
(new cards) registration starts with the card
detect IRQ.

Move card detect IRQ disabling to prepare() so that
no new cards will be registered while we're trying
to suspend.

Likewise, move card detect IRQ enabling to complete()
so we only try to register new children after our MMC
IP is back up.

Signed-off-by: Felipe Balbi ba...@ti.com
---

Venkat, do you think the patch below makes sense ?

btw, just checked suspend to ram with beagle and panda. We still have
our filesystem after waking up.

ps: you will [1] to test it:

[1] http://marc.info/?l=linux-arm-kernelm=135090724817604w=2

ping

I've been off for the past 3 days. Will test this on Monday once I'm 
back in office.

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


[PATCH 1/4] MMC: omap_hsmmc: claim pinctrl at probe time

2012-10-15 Thread Venkatraman S
From: Daniel Mack zon...@gmail.com

This allows DT-driven board to set up the pin mux only when the driver
is in use.

Signed-off-by: Daniel Mack zon...@gmail.com
Cc: Venkatraman S svenk...@ti.com
Cc: Chris Ball c...@laptop.org
Cc: Grant Likely grant.lik...@secretlab.ca
Cc: Rob Herring rob.herr...@calxeda.com
Cc: Linus Walleij linus.wall...@linaro.org
Cc: linux-omap@vger.kernel.org
Acked-by: Linus Walleij linus.wall...@linaro.org
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 54bfd0c..01eeeae 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -37,6 +37,7 @@
 #include linux/io.h
 #include linux/gpio.h
 #include linux/regulator/consumer.h
+#include linux/pinctrl/consumer.h
 #include linux/pm_runtime.h
 #include mach/hardware.h
 #include plat/mmc.h
@@ -1720,6 +1721,7 @@ static int __devinit omap_hsmmc_probe(struct 
platform_device *pdev)
const struct of_device_id *match;
dma_cap_mask_t mask;
unsigned tx_req, rx_req;
+   struct pinctrl *pinctrl;
 
match = of_match_device(of_match_ptr(omap_mmc_of_match), pdev-dev);
if (match) {
@@ -1923,6 +1925,11 @@ static int __devinit omap_hsmmc_probe(struct 
platform_device *pdev)
 
omap_hsmmc_disable_irq(host);
 
+   pinctrl = devm_pinctrl_get_select_default(pdev-dev);
+   if (IS_ERR(pinctrl))
+   dev_warn(pdev-dev,
+   pins are not configured from the driver\n);
+
omap_hsmmc_protect_card(host);
 
mmc_add_host(mmc);
-- 
1.7.11.1.25.g0e18bef

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


[PATCH 2/4] MMC: omap_hsmmc: add DT property for max bus frequency

2012-10-15 Thread Venkatraman S
From: Daniel Mack zon...@gmail.com

Maximum bus frequency can be limited by external circuitry like level
shifters etc. Allow passing this value from DT.

Signed-off-by: Daniel Mack zon...@gmail.com
Cc: Venkatraman S svenk...@ti.com
Cc: Chris Ball c...@laptop.org
Cc: Grant Likely grant.lik...@secretlab.ca
Cc: Rob Herring rob.herr...@calxeda.com
Cc: linux-omap@vger.kernel.org
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 01eeeae..a33ab74 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1674,7 +1674,7 @@ static struct omap_mmc_platform_data 
*of_get_hsmmc_pdata(struct device *dev)
 {
struct omap_mmc_platform_data *pdata;
struct device_node *np = dev-of_node;
-   u32 bus_width;
+   u32 bus_width, max_freq;
 
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
@@ -1701,6 +1701,9 @@ static struct omap_mmc_platform_data 
*of_get_hsmmc_pdata(struct device *dev)
if (of_find_property(np, ti,needs-special-reset, NULL))
pdata-slots[0].features |= HSMMC_HAS_UPDATED_RESET;
 
+   if (!of_property_read_u32(np, max-frequency, max_freq))
+   pdata-max_freq = max_freq;
+
return pdata;
 }
 #else
-- 
1.7.11.1.25.g0e18bef

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


[PATCH 3/4] mmc: omap_hsmmc: fix host reference after mmc_free_host

2012-10-15 Thread Venkatraman S
From: Balaji T K balaj...@ti.com

struct omap_hsmmc_host *host should not be accessed after mmc_free_host().
Reorder mmc_free_host() after iounmap(host-base).

Signed-off-by: Balaji T K balaj...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index a33ab74..a3929b7 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2019,8 +2019,8 @@ static int __devexit omap_hsmmc_remove(struct 
platform_device *pdev)
clk_put(host-dbclk);
}
 
-   mmc_free_host(host-mmc);
iounmap(host-base);
+   mmc_free_host(host-mmc);
omap_hsmmc_gpio_free(pdev-dev.platform_data);
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-- 
1.7.11.1.25.g0e18bef

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


[PATCH 4/4] mmc: omap_hsmmc: Fix NULL pointer dereference for dt boot

2012-10-15 Thread Venkatraman S
From: Balaji T K balaj...@ti.com

dev-platform_data is NULL in case of device tree boot,
instead use the saved version in struct omap_hsmmc_host.

Signed-off-by: Balaji T K balaj...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c | 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index a3929b7..0b5e7ab 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -179,7 +179,8 @@ struct omap_hsmmc_host {
 
 static int omap_hsmmc_card_detect(struct device *dev, int slot)
 {
-   struct omap_mmc_platform_data *mmc = dev-platform_data;
+   struct omap_hsmmc_host *host = dev_get_drvdata(dev);
+   struct omap_mmc_platform_data *mmc = host-pdata;
 
/* NOTE: assumes card detect signal is active-low */
return !gpio_get_value_cansleep(mmc-slots[0].switch_pin);
@@ -187,7 +188,8 @@ static int omap_hsmmc_card_detect(struct device *dev, int 
slot)
 
 static int omap_hsmmc_get_wp(struct device *dev, int slot)
 {
-   struct omap_mmc_platform_data *mmc = dev-platform_data;
+   struct omap_hsmmc_host *host = dev_get_drvdata(dev);
+   struct omap_mmc_platform_data *mmc = host-pdata;
 
/* NOTE: assumes write protect signal is active-high */
return gpio_get_value_cansleep(mmc-slots[0].gpio_wp);
@@ -195,7 +197,8 @@ static int omap_hsmmc_get_wp(struct device *dev, int slot)
 
 static int omap_hsmmc_get_cover_state(struct device *dev, int slot)
 {
-   struct omap_mmc_platform_data *mmc = dev-platform_data;
+   struct omap_hsmmc_host *host = dev_get_drvdata(dev);
+   struct omap_mmc_platform_data *mmc = host-pdata;
 
/* NOTE: assumes card detect signal is active-low */
return !gpio_get_value_cansleep(mmc-slots[0].switch_pin);
@@ -205,7 +208,8 @@ static int omap_hsmmc_get_cover_state(struct device *dev, 
int slot)
 
 static int omap_hsmmc_suspend_cdirq(struct device *dev, int slot)
 {
-   struct omap_mmc_platform_data *mmc = dev-platform_data;
+   struct omap_hsmmc_host *host = dev_get_drvdata(dev);
+   struct omap_mmc_platform_data *mmc = host-pdata;
 
disable_irq(mmc-slots[0].card_detect_irq);
return 0;
@@ -213,7 +217,8 @@ static int omap_hsmmc_suspend_cdirq(struct device *dev, int 
slot)
 
 static int omap_hsmmc_resume_cdirq(struct device *dev, int slot)
 {
-   struct omap_mmc_platform_data *mmc = dev-platform_data;
+   struct omap_hsmmc_host *host = dev_get_drvdata(dev);
+   struct omap_mmc_platform_data *mmc = host-pdata;
 
enable_irq(mmc-slots[0].card_detect_irq);
return 0;
@@ -2019,9 +2024,9 @@ static int __devexit omap_hsmmc_remove(struct 
platform_device *pdev)
clk_put(host-dbclk);
}
 
+   omap_hsmmc_gpio_free(host-pdata);
iounmap(host-base);
mmc_free_host(host-mmc);
-   omap_hsmmc_gpio_free(pdev-dev.platform_data);
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res)
-- 
1.7.11.1.25.g0e18bef

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


Re: [PATCH 0/4] MMC: some omap_hsmmc fixes

2012-10-15 Thread Venkatraman S
Daniel,
On Sat, Oct 13, 2012 at 2:31 PM, Daniel Mack zon...@gmail.com wrote:
 On 12.10.2012 12:58, Daniel Mack wrote:
 Here are some assorted patches for the omap_hsmmc driver that I need on
 top Linus' current development branch to make it work on a AM33xx board.

 1/4 and 2/4 qualify as bug fixes and I'm puzzled that these didn't hit
 anyone else yet.


 Daniel Mack (4):
   MMC: omap_hsmmc: set platform data after probe from DT node
   MMC: omap_hsmmc: fix DMA config block
   MMC: omap_hsmmc: claim pinctrl at probe time
   MMC: omap_hsmmc: add DT property for max bus frequency

 Ok, so 1/4 and 2/4 will be solved differently upstream, so they can be
 dropped.

 The other two remain, and 3/4 got an Acked-by Linus W.

Thanks.
I've just clubbed your two patches with Balaji's fixes and sent to Chris.
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Error when building modules for omap2plus_defconfig in mainline

2012-10-11 Thread Venkatraman S

Daily build on Linus's tree is failing for the past 2-3 days
make modules with omap2plus_defconfig..

ERROR: snd_hwparams_to_dma_slave_config [sound/soc/omap/snd-soc-omap.ko] 
undefined!
ERROR: snd_dmaengine_pcm_pointer [sound/soc/omap/snd-soc-omap.ko] undefined!
ERROR: snd_dmaengine_pcm_open [sound/soc/omap/snd-soc-omap.ko] undefined!
ERROR: snd_dmaengine_pcm_close [sound/soc/omap/snd-soc-omap.ko] undefined!
ERROR: snd_dmaengine_pcm_get_chan [sound/soc/omap/snd-soc-omap.ko] undefined!
ERROR: snd_dmaengine_pcm_trigger [sound/soc/omap/snd-soc-omap.ko] undefined!
make[2]: *** [__modpost] Error 1
make[1]: *** [modules] Error 2
make: *** [sub-make] Error 2

Just wanted to check if a fix is already on the way for -rc1 or someone is 
aware of it..

Thanks,
Venkat.


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


Re: [PATCH 09/16] ARM: OMAP: Split plat/mmc.h into local headers and platform_data

2012-10-05 Thread Venkatraman S
On Fri, Oct 5, 2012 at 3:34 AM, Tony Lindgren t...@atomide.com wrote:
 We need to remove this from plat for ARM common zImage
 support.

 Cc: Chris Ball c...@laptop.org
 Cc: Venkatraman S svenk...@ti.com
 Cc: linux-...@vger.kernel.org
 Signed-off-by: Tony Lindgren t...@atomide.com

Thanks Tony. I suppose this should go into your tree..
Acked-by: Venkatraman S svenk...@ti.com

 ---
  arch/arm/mach-omap1/board-h2-mmc.c |5 +--
  arch/arm/mach-omap1/board-h3-mmc.c |3 +-
  arch/arm/mach-omap1/board-htcherald.c  |2 +
  arch/arm/mach-omap1/board-innovator.c  |2 +
  arch/arm/mach-omap1/board-nokia770.c   |2 +
  arch/arm/mach-omap1/board-sx1-mmc.c|3 +-
  arch/arm/mach-omap1/devices.c  |2 +
  arch/arm/mach-omap1/mmc.h  |   18 +++
  arch/arm/mach-omap2/board-4430sdp.c|2 +
  arch/arm/mach-omap2/board-n8x0.c   |2 +
  arch/arm/mach-omap2/board-omap4panda.c |2 +
  arch/arm/mach-omap2/board-rm680.c  |2 +
  arch/arm/mach-omap2/hsmmc.c|2 +
  arch/arm/mach-omap2/mmc.h  |   23 ++
  arch/arm/mach-omap2/msdi.c |2 +
  arch/arm/mach-omap2/omap4-common.c |2 +
  arch/arm/mach-omap2/omap_hwmod_2420_data.c |2 +
  arch/arm/mach-omap2/omap_hwmod_2430_data.c |2 +
  arch/arm/mach-omap2/omap_hwmod_33xx_data.c |2 +
  arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |2 +
  arch/arm/mach-omap2/omap_hwmod_44xx_data.c |2 +
  drivers/mmc/host/omap.c|3 +-
  drivers/mmc/host/omap_hsmmc.c  |2 +
  include/linux/platform_data/mmc-omap.h |   45 
 +---
  24 files changed, 67 insertions(+), 67 deletions(-)
  create mode 100644 arch/arm/mach-omap1/mmc.h
  create mode 100644 arch/arm/mach-omap2/mmc.h
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2 1/2] mmc: omap_hsmmc: convert from IP timer to hrtimer

2012-08-28 Thread Venkatraman S
omap hsmmc controller IP has a built in timer that can be programmed to
guard against unresponsive operations. But its range is very narrow,
and the maximum countable time is a few seconds.

Card maintenance operations like BKOPS and MMC_ERASE and long
stream writes like packed command require timers of order of
several minutes, much beyond the capability of the IP timer.
So get rid of using the IP timer entirely and use kernel's hrtimer
functionality for guarding the device operations.
As part of this change, a workaround that disabled timeouts for
MMC_ERASE command is removed, and the arbitary timing of 100ms
is used only when the timeout is not explicitly specified by core.

A trivial change to get rid of unnecessary dealiasing of host-data
in omap_hsmmc_do_irq is also included.

Signed-off-by: Venkatraman S svenk...@ti.com
---

v1-v2:
   Fix typos in commit message.
   Add checks to handle subtle races between MMC IRQ and HRTIMER IRQ
   Mark set_guard_timer function as static
   (Felipe's comment to use macros for INT_EN_MASK is done as a separate patch )
 drivers/mmc/host/omap_hsmmc.c | 96 ++-
 1 file changed, 50 insertions(+), 46 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 9afdd20..57e86a4 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -79,7 +79,7 @@
 #define CLKD_SHIFT 6
 #define DTO_MASK   0x000F
 #define DTO_SHIFT  16
-#define INT_EN_MASK0x307F0033
+#define INT_EN_MASK0x306E0033
 #define BWR_ENABLE (1  4)
 #define BRR_ENABLE (1  5)
 #define DTO_ENABLE (1  20)
@@ -160,6 +160,7 @@ struct omap_hsmmc_host {
unsigned intdma_sg_idx;
unsigned char   bus_mode;
unsigned char   power_mode;
+   unsigned intns_per_clk_cycle;
int suspended;
int irq;
int use_dma, dma_ch;
@@ -172,6 +173,7 @@ struct omap_hsmmc_host {
int reqs_blocked;
int use_reg;
int req_in_progress;
+   struct hrtimer  guard_timer;
struct omap_hsmmc_next  next_data;
 
struct  omap_mmc_platform_data  *pdata;
@@ -455,10 +457,6 @@ static void omap_hsmmc_enable_irq(struct omap_hsmmc_host 
*host,
else
irq_mask = INT_EN_MASK;
 
-   /* Disable timeout for erases */
-   if (cmd-opcode == MMC_ERASE)
-   irq_mask = ~DTO_ENABLE;
-
OMAP_HSMMC_WRITE(host-base, STAT, STAT_CLEAR);
OMAP_HSMMC_WRITE(host-base, ISE, irq_mask);
OMAP_HSMMC_WRITE(host-base, IE, irq_mask);
@@ -508,6 +506,9 @@ static void omap_hsmmc_set_clock(struct omap_hsmmc_host 
*host)
 time_before(jiffies, timeout))
cpu_relax();
 
+   if (ios-clock)
+   host-ns_per_clk_cycle = DIV_ROUND_UP(NSEC_PER_SEC, ios-clock);
+
omap_hsmmc_start_clock(host);
 }
 
@@ -824,7 +825,7 @@ omap_hsmmc_xfer_done(struct omap_hsmmc_host *host, struct 
mmc_data *data)
omap_hsmmc_request_done(host, mrq);
return;
}
-
+   hrtimer_cancel(host-guard_timer);
host-data = NULL;
 
if (!data-error)
@@ -859,8 +860,11 @@ omap_hsmmc_cmd_done(struct omap_hsmmc_host *host, struct 
mmc_command *cmd)
cmd-resp[0] = OMAP_HSMMC_READ(host-base, RSP10);
}
}
-   if ((host-data == NULL  !host-response_busy) || cmd-error)
+   if ((host-data == NULL  !host-response_busy) || cmd-error) {
+   if (cmd-error != -ETIMEDOUT)
+   hrtimer_cancel(host-guard_timer);
omap_hsmmc_request_done(host, cmd-mrq);
+   }
 }
 
 /*
@@ -992,7 +996,7 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, 
int status)
hsmmc_command_incomplete(host, -EILSEQ);
 
end_cmd = 1;
-   if (host-data || host-response_busy) {
+   if (data || host-response_busy) {
end_trans = 1;
host-response_busy = 0;
}
@@ -1292,41 +1296,35 @@ static int omap_hsmmc_start_dma_transfer(struct 
omap_hsmmc_host *host,
return 0;
 }
 
-static void set_data_timeout(struct omap_hsmmc_host *host,
-unsigned int timeout_ns,
-unsigned int timeout_clks)
+static void set_guard_timer(struct omap_hsmmc_host *host,
+   unsigned long timeout_ms, unsigned long timeout_ns,
+   unsigned int timeout_clks)
 {
-   unsigned int timeout, cycle_ns;
-   uint32_t reg, clkd, dto = 0;
+   ktime_t gtime;
+   unsigned int sec, nsec;
 
-   reg = OMAP_HSMMC_READ(host-base, SYSCTL);
-   clkd = (reg  CLKD_MASK)  CLKD_SHIFT

[PATCH 2/2] mmc: omap_hsmmc: cleanup the bitmap definitions of Interrupt Register

2012-08-28 Thread Venkatraman S
Define the most frequently used bitmasks of the Interrupt Enable /
Interrupt Status register with consistent naming ( with _EN suffix).

Use meaningful concatenation of bitfields for INT_EN_MASK, which shows
which interrupts are enabled by default.
No functional changes.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c | 51 ---
 1 file changed, 29 insertions(+), 22 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 57e86a4..03c2362 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -79,28 +79,16 @@
 #define CLKD_SHIFT 6
 #define DTO_MASK   0x000F
 #define DTO_SHIFT  16
-#define INT_EN_MASK0x306E0033
-#define BWR_ENABLE (1  4)
-#define BRR_ENABLE (1  5)
-#define DTO_ENABLE (1  20)
 #define INIT_STREAM(1  1)
 #define DP_SELECT  (1  21)
 #define DDIR   (1  4)
-#define DMA_EN 0x1
+#define DMAE   0x1
 #define MSBS   (1  5)
 #define BCE(1  1)
 #define FOUR_BIT   (1  1)
 #define DDR(1  19)
 #define DW8(1  5)
-#define CC 0x1
-#define TC 0x02
 #define OD 0x1
-#define ERR(1  15)
-#define CMD_TIMEOUT(1  16)
-#define DATA_TIMEOUT   (1  20)
-#define CMD_CRC(1  17)
-#define DATA_CRC   (1  21)
-#define CARD_ERR   (1  28)
 #define STAT_CLEAR 0x
 #define INIT_STREAM_CMD0x
 #define DUAL_VOLT_OCR_BIT  7
@@ -109,6 +97,25 @@
 #define SOFTRESET  (1  1)
 #define RESETDONE  (1  0)
 
+/* Interrupt masks for IE and ISE register */
+#define CC_EN  (1  0)
+#define TC_EN  (1  1)
+#define BWR_EN (1  4)
+#define BRR_EN (1  5)
+#define ERR_EN (1  15)
+#define CTO_EN (1  16)
+#define CCRC_EN(1  17)
+#define CEB_EN (1  18)
+#define CIE_EN (1  19)
+#define DTO_EN (1  20)
+#define DCRC_EN(1  21)
+#define DEB_EN (1  22)
+#define CERR_EN(1  28)
+#define BADA_EN(1  29)
+
+#define INT_EN_MASK(BADA_EN | CERR_EN | DEB_EN | DCRC_EN | \
+   CIE_EN | CEB_EN | CCRC_EN | BRR_EN | BWR_EN | TC_EN | CC_EN)
+
 #define MMC_AUTOSUSPEND_DELAY  100
 #define MMC_TIMEOUT_MS 20
 #define OMAP_MMC_MIN_CLOCK 40
@@ -453,7 +460,7 @@ static void omap_hsmmc_enable_irq(struct omap_hsmmc_host 
*host,
unsigned int irq_mask;
 
if (host-use_dma)
-   irq_mask = INT_EN_MASK  ~(BRR_ENABLE | BWR_ENABLE);
+   irq_mask = INT_EN_MASK  ~(BRR_EN | BWR_EN);
else
irq_mask = INT_EN_MASK;
 
@@ -673,8 +680,8 @@ static void send_init_stream(struct omap_hsmmc_host *host)
OMAP_HSMMC_WRITE(host-base, CMD, INIT_STREAM_CMD);
 
timeout = jiffies + msecs_to_jiffies(MMC_TIMEOUT_MS);
-   while ((reg != CC)  time_before(jiffies, timeout))
-   reg = OMAP_HSMMC_READ(host-base, STAT)  CC;
+   while ((reg != CC_EN)  time_before(jiffies, timeout))
+   reg = OMAP_HSMMC_READ(host-base, STAT)  CC_EN;
 
OMAP_HSMMC_WRITE(host-base, CON,
OMAP_HSMMC_READ(host-base, CON)  ~INIT_STREAM);
@@ -765,7 +772,7 @@ omap_hsmmc_start_command(struct omap_hsmmc_host *host, 
struct mmc_command *cmd,
}
 
if (host-use_dma)
-   cmdreg |= DMA_EN;
+   cmdreg |= DMAE;
 
host-req_in_progress = 1;
 
@@ -988,11 +995,11 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host 
*host, int status)
data = host-data;
dev_vdbg(mmc_dev(host-mmc), IRQ Status is %x\n, status);
 
-   if (status  ERR) {
+   if (status  ERR_EN) {
omap_hsmmc_dbg_report_irq(host, status);
-   if (status  (CMD_TIMEOUT | DATA_TIMEOUT))
+   if (status  (CTO_EN | DTO_EN))
hsmmc_command_incomplete(host, -ETIMEDOUT);
-   else if (status  (CMD_CRC | DATA_CRC))
+   else if (status  (CCRC_EN | DCRC_EN))
hsmmc_command_incomplete(host, -EILSEQ);
 
end_cmd = 1;
@@ -1002,9 +1009,9 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host 
*host, int status)
}
}
 
-   if (end_cmd || ((status  CC)  host-cmd))
+   if (end_cmd || ((status  CC_EN)  host-cmd))
omap_hsmmc_cmd_done(host, host-cmd);
-   if ((end_trans || (status  TC))  host-mrq)
+   if ((end_trans || (status  TC_EN))  host-mrq)
omap_hsmmc_xfer_done(host, data

[PATCH 00/10] Assorted MMC / OMAP HSMMC patches

2012-08-17 Thread Venkatraman S
Essentially, a lot of cleanups leading up to adding a new
feature for OMAP HSMMC. The idea is to convert to the use
of software timer instead of IP timer for timekeeping, due
to the limitations of the counting range of the IP timer.

Also added myself as OMAP HSMMC maintainer.

Patch 9/10 is in draft state and needs more testing.

These patches are also available at
  git://github.com/svenkatr/linux.git my/mmc/3.6/hrtimer_updates

Venkatraman S (10):
  mmc: core: Add TRANsfer state to non-HPI state
  mmc: debugfs: Print ext_csd in ascending order
  mmc: omap: remove unused variables and includes
  mmc: omap: fix mmc_omap_report_irq to use dev_dbg macros
  mmc: omap_hsmmc: remove unused vars and includes
  mmc: omap_hsmmc: remove access to SYSCONFIG register
  mmc: omap_hsmmc: consolidate flush posted writes for HSMMC IRQs
  mmc: omap_hsmmc: consolidate error report handling of HSMMC IRQ
  mmc: omap_hsmmc: convert from IP timer to hrtimer
  mmc: omap_hsmmc: Move to Maintained state in MAINTAINERS

 MAINTAINERS   |   4 +-
 drivers/mmc/core/core.c   |   3 +-
 drivers/mmc/core/debugfs.c|   2 +-
 drivers/mmc/host/omap.c   |  39 
 drivers/mmc/host/omap_hsmmc.c | 212 --
 5 files changed, 103 insertions(+), 157 deletions(-)

-- 
1.7.11.1.25.g0e18bef

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


[PATCH 01/10] mmc: core: Add TRANsfer state to non-HPI state

2012-08-17 Thread Venkatraman S
HPI can be issued only in programming state to bring the card to
transfer state. If the card is already in transfer state, doing
a HPI is redundant.
Fix this by adding transfer state to the list of exceptions to
doing HPI and return without error.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/core/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 8ac5246..835c9f0 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -424,8 +424,9 @@ int mmc_interrupt_hpi(struct mmc_card *card)
case R1_STATE_IDLE:
case R1_STATE_READY:
case R1_STATE_STBY:
+   case R1_STATE_TRAN:
/*
-* In idle states, HPI is not needed and the caller
+* In idle and transfer states, HPI is not needed and the caller
 * can issue the next intended command immediately
 */
goto out;
-- 
1.7.11.1.25.g0e18bef

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


[PATCH 02/10] mmc: debugfs: Print ext_csd in ascending order

2012-08-17 Thread Venkatraman S
ext_csd exported through debugfs is printed in reverse order (from
byte 511 to 0), which causes confusion.
Fix the for loop to print ext_csd in natural order.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/core/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
index 9ab5b17..d96c643 100644
--- a/drivers/mmc/core/debugfs.c
+++ b/drivers/mmc/core/debugfs.c
@@ -281,7 +281,7 @@ static int mmc_ext_csd_open(struct inode *inode, struct 
file *filp)
if (err)
goto out_free;
 
-   for (i = 511; i = 0; i--)
+   for (i = 0; i  512; i++)
n += sprintf(buf + n, %02x, ext_csd[i]);
n += sprintf(buf + n, \n);
BUG_ON(n != EXT_CSD_STR_LEN);
-- 
1.7.11.1.25.g0e18bef

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


[PATCH 03/10] mmc: omap: remove unused variables and includes

2012-08-17 Thread Venkatraman S
Get rid of some unnecessary includes in the driver and
a few unused variables.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 50e08f0..0ec4e55 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -27,18 +27,10 @@
 #include linux/mmc/card.h
 #include linux/clk.h
 #include linux/scatterlist.h
-#include linux/i2c/tps65010.h
 #include linux/slab.h
 
-#include asm/io.h
-#include asm/irq.h
-
-#include plat/board.h
 #include plat/mmc.h
-#include asm/gpio.h
 #include plat/dma.h
-#include plat/mux.h
-#include plat/fpga.h
 
 #defineOMAP_MMC_REG_CMD0x00
 #defineOMAP_MMC_REG_ARGL   0x01
@@ -107,7 +99,6 @@ struct mmc_omap_slot {
u16 saved_con;
u16 bus_mode;
unsigned intfclk_freq;
-   unsignedpowered:1;
 
struct tasklet_struct   cover_tasklet;
struct timer_list   cover_timer;
@@ -139,7 +130,6 @@ struct mmc_omap_host {
unsigned intphys_base;
int irq;
unsigned char   bus_mode;
-   unsigned char   hw_bus_mode;
unsigned intreg_shift;
 
struct work_struct  cmd_abort_work;
-- 
1.7.11.1.25.g0e18bef

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


[PATCH 04/10] mmc: omap: fix mmc_omap_report_irq to use dev_dbg macros

2012-08-17 Thread Venkatraman S
The function mmc_omap_report_irq uses raw printks and the
actual output was disabled by a static variable. Make
the function use dev_vdbg macro and use it under the
standard CONFIG_MMC_DEBUG flag.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap.c | 29 +
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 0ec4e55..614f63c 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -679,22 +679,29 @@ mmc_omap_xfer_data(struct mmc_omap_host *host, int write)
}
 }
 
-static inline void mmc_omap_report_irq(u16 status)
+#ifdef CONFIG_MMC_DEBUG
+static void mmc_omap_report_irq(struct mmc_omap_host *host, u16 status)
 {
static const char *mmc_omap_status_bits[] = {
EOC, CD, CB, BRS, EOFB, DTO, DCRC, CTO,
CCRC, CRW, AF, AE, OCRB, CIRQ, CERR
};
-   int i, c = 0;
+   int i;
+   char res[64], *buf = res;
+
+   buf += sprintf(buf, MMC IRQ 0x%x:, status);
 
for (i = 0; i  ARRAY_SIZE(mmc_omap_status_bits); i++)
-   if (status  (1  i)) {
-   if (c)
-   printk( );
-   printk(%s, mmc_omap_status_bits[i]);
-   c++;
-   }
+   if (status  (1  i))
+   buf += sprintf(buf,  %s, mmc_omap_status_bits[i]);
+   dev_vdbg(mmc_dev(host-mmc), %s\n, res);
+}
+#else
+static void mmc_omap_report_irq(struct mmc_omap_host *host, u16 status)
+{
 }
+#endif
+
 
 static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
 {
@@ -728,12 +735,10 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
cmd = host-cmd-opcode;
else
cmd = -1;
-#ifdef CONFIG_MMC_DEBUG
dev_dbg(mmc_dev(host-mmc), MMC IRQ %04x (CMD %d): ,
status, cmd);
-   mmc_omap_report_irq(status);
-   printk(\n);
-#endif
+   mmc_omap_report_irq(host, status);
+
if (host-total_bytes_left) {
if ((status  OMAP_MMC_STAT_A_FULL) ||
(status  OMAP_MMC_STAT_END_OF_DATA))
-- 
1.7.11.1.25.g0e18bef

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


[PATCH 05/10] mmc: omap_hsmmc: remove unused vars and includes

2012-08-17 Thread Venkatraman S
Some straight forward cleanup of unnecessary #include's
and host variables. Some of the verbose and redundant
debug messages are converted to use dev_vdbg.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c | 14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index e180735..da4f5a7 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -35,7 +35,6 @@
 #include linux/mmc/core.h
 #include linux/mmc/mmc.h
 #include linux/io.h
-#include linux/semaphore.h
 #include linux/gpio.h
 #include linux/regulator/consumer.h
 #include linux/pm_runtime.h
@@ -162,8 +161,6 @@ struct omap_hsmmc_host {
unsigned intdma_sg_idx;
unsigned char   bus_mode;
unsigned char   power_mode;
-   u32 *buffer;
-   u32 bytesleft;
int suspended;
int irq;
int use_dma, dma_ch;
@@ -172,7 +169,6 @@ struct omap_hsmmc_host {
int slot_id;
int response_busy;
int context_loss;
-   int vdd;
int protect_card;
int reqs_blocked;
int use_reg;
@@ -496,7 +492,7 @@ static void omap_hsmmc_set_clock(struct omap_hsmmc_host 
*host)
unsigned long regval;
unsigned long timeout;
 
-   dev_dbg(mmc_dev(host-mmc), Set clock to %uHz\n, ios-clock);
+   dev_vdbg(mmc_dev(host-mmc), Set clock to %uHz\n, ios-clock);
 
omap_hsmmc_stop_clock(host);
 
@@ -746,7 +742,7 @@ omap_hsmmc_start_command(struct omap_hsmmc_host *host, 
struct mmc_command *cmd,
 {
int cmdreg = 0, resptype = 0, cmdtype = 0;
 
-   dev_dbg(mmc_dev(host-mmc), %s: CMD%d, argument 0x%08x\n,
+   dev_vdbg(mmc_dev(host-mmc), %s: CMD%d, argument 0x%08x\n,
mmc_hostname(host-mmc), cmd-opcode, cmd-arg);
host-cmd = cmd;
 
@@ -935,7 +931,7 @@ static void omap_hsmmc_dbg_report_irq(struct 
omap_hsmmc_host *host, u32 status)
buf += len;
}
 
-   dev_dbg(mmc_dev(host-mmc), %s\n, res);
+   dev_vdbg(mmc_dev(host-mmc), %s\n, res);
 }
 #else
 static inline void omap_hsmmc_dbg_report_irq(struct omap_hsmmc_host *host,
@@ -997,7 +993,7 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, 
int status)
}
 
data = host-data;
-   dev_dbg(mmc_dev(host-mmc), IRQ Status is %x\n, status);
+   dev_vdbg(mmc_dev(host-mmc), IRQ Status is %x\n, status);
 
if (status  ERR) {
omap_hsmmc_dbg_report_irq(host, status);
@@ -1502,12 +1498,10 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, 
struct mmc_ios *ios)
case MMC_POWER_OFF:
mmc_slot(host).set_power(host-dev, host-slot_id,
 0, 0);
-   host-vdd = 0;
break;
case MMC_POWER_UP:
mmc_slot(host).set_power(host-dev, host-slot_id,
 1, ios-vdd);
-   host-vdd = ios-vdd;
break;
case MMC_POWER_ON:
do_send_init_stream = 1;
-- 
1.7.11.1.25.g0e18bef

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


[PATCH 06/10] mmc: omap_hsmmc: remove access to SYSCONFIG register

2012-08-17 Thread Venkatraman S
SYSCONFIG register of HSMMC IP is managed by the omap hwmod
abstraction layer. Resetting the IP and configuring the correct
SYSCONFIG mode is centrally managed by hwmod.

Remove code which manipulates IP reset and SYSCONFIG directly in the
driver.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c | 24 ++--
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index da4f5a7..4bc55ac 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -44,7 +44,6 @@
 #include plat/cpu.h
 
 /* OMAP HSMMC Host Controller Registers */
-#define OMAP_HSMMC_SYSCONFIG   0x0010
 #define OMAP_HSMMC_SYSSTATUS   0x0014
 #define OMAP_HSMMC_CON 0x002C
 #define OMAP_HSMMC_BLK 0x0104
@@ -576,21 +575,8 @@ static int omap_hsmmc_context_restore(struct 
omap_hsmmc_host *host)
if (host-context_loss == context_loss)
return 1;
 
-   /* Wait for hardware reset */
-   timeout = jiffies + msecs_to_jiffies(MMC_TIMEOUT_MS);
-   while ((OMAP_HSMMC_READ(host-base, SYSSTATUS)  RESETDONE) != RESETDONE
-time_before(jiffies, timeout))
-   ;
-
-   /* Do software reset */
-   OMAP_HSMMC_WRITE(host-base, SYSCONFIG, SOFTRESET);
-   timeout = jiffies + msecs_to_jiffies(MMC_TIMEOUT_MS);
-   while ((OMAP_HSMMC_READ(host-base, SYSSTATUS)  RESETDONE) != RESETDONE
-time_before(jiffies, timeout))
-   ;
-
-   OMAP_HSMMC_WRITE(host-base, SYSCONFIG,
-   OMAP_HSMMC_READ(host-base, SYSCONFIG) | AUTOIDLE);
+   if (!OMAP_HSMMC_READ(host-base, SYSSTATUS)  RESETDONE)
+   return 1;
 
if (host-pdata-controller_flags  OMAP_HSMMC_SUPPORTS_DUAL_VOLT) {
if (host-power_mode != MMC_POWER_OFF 
@@ -1593,10 +1579,6 @@ static void omap_hsmmc_conf_bus_power(struct 
omap_hsmmc_host *host)
value = OMAP_HSMMC_READ(host-base, CAPA);
OMAP_HSMMC_WRITE(host-base, CAPA, value | capa);
 
-   /* Set the controller to AUTO IDLE mode */
-   value = OMAP_HSMMC_READ(host-base, SYSCONFIG);
-   OMAP_HSMMC_WRITE(host-base, SYSCONFIG, value | AUTOIDLE);
-
/* Set SD bus power bit */
set_sd_bus_power(host);
 }
@@ -1654,8 +1636,6 @@ static int omap_hsmmc_regs_show(struct seq_file *s, void 
*data)
 
pm_runtime_get_sync(host-dev);
 
-   seq_printf(s, SYSCONFIG:\t0x%08x\n,
-   OMAP_HSMMC_READ(host-base, SYSCONFIG));
seq_printf(s, CON:\t\t0x%08x\n,
OMAP_HSMMC_READ(host-base, CON));
seq_printf(s, HCTL:\t\t0x%08x\n,
-- 
1.7.11.1.25.g0e18bef

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


[PATCH 07/10] mmc: omap_hsmmc: consolidate flush posted writes for HSMMC IRQs

2012-08-17 Thread Venkatraman S
Flushing spurious IRQs from HSMMC IP is done twice in
omap_hsmmc_irq and omap_hsmmc_do_irq.
Consolidate them to one location.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c | 17 -
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 4bc55ac..20453c8 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -969,15 +969,6 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host 
*host, int status)
struct mmc_data *data;
int end_cmd = 0, end_trans = 0;
 
-   if (!host-req_in_progress) {
-   do {
-   OMAP_HSMMC_WRITE(host-base, STAT, status);
-   /* Flush posted write */
-   status = OMAP_HSMMC_READ(host-base, STAT);
-   } while (status  INT_EN_MASK);
-   return;
-   }
-
data = host-data;
dev_vdbg(mmc_dev(host-mmc), IRQ Status is %x\n, status);
 
@@ -1028,8 +1019,6 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host 
*host, int status)
}
}
 
-   OMAP_HSMMC_WRITE(host-base, STAT, status);
-
if (end_cmd || ((status  CC)  host-cmd))
omap_hsmmc_cmd_done(host, host-cmd);
if ((end_trans || (status  TC))  host-mrq)
@@ -1045,11 +1034,13 @@ static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id)
int status;
 
status = OMAP_HSMMC_READ(host-base, STAT);
-   do {
+   while (status  INT_EN_MASK  host-req_in_progress) {
omap_hsmmc_do_irq(host, status);
+
/* Flush posted write */
+   OMAP_HSMMC_WRITE(host-base, STAT, status);
status = OMAP_HSMMC_READ(host-base, STAT);
-   } while (status  INT_EN_MASK);
+   }
 
return IRQ_HANDLED;
 }
-- 
1.7.11.1.25.g0e18bef

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


[PATCH 08/10] mmc: omap_hsmmc: consolidate error report handling of HSMMC IRQ

2012-08-17 Thread Venkatraman S
Consolidate the duplicated code around the handling of CMD_TIMEOUT,
CMD_CRC, DATA_TIMEOUT, DATA_CRC and CARD_ERR handling into a
single function.
This generally shrinks code bloat, but is also required for implementing
software based guard timers.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c | 63 +++
 1 file changed, 21 insertions(+), 42 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 20453c8..9afdd20 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -964,6 +964,18 @@ static inline void omap_hsmmc_reset_controller_fsm(struct 
omap_hsmmc_host *host,
__func__);
 }
 
+static void hsmmc_command_incomplete(struct omap_hsmmc_host *host, int err)
+{
+   omap_hsmmc_reset_controller_fsm(host, SRC);
+   host-cmd-error = err;
+
+   if (host-data) {
+   omap_hsmmc_reset_controller_fsm(host, SRD);
+   omap_hsmmc_dma_cleanup(host, err);
+   }
+
+}
+
 static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, int status)
 {
struct mmc_data *data;
@@ -974,48 +986,15 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host 
*host, int status)
 
if (status  ERR) {
omap_hsmmc_dbg_report_irq(host, status);
-   if ((status  CMD_TIMEOUT) ||
-   (status  CMD_CRC)) {
-   if (host-cmd) {
-   if (status  CMD_TIMEOUT) {
-   omap_hsmmc_reset_controller_fsm(host,
-   SRC);
-   host-cmd-error = -ETIMEDOUT;
-   } else {
-   host-cmd-error = -EILSEQ;
-   }
-   end_cmd = 1;
-   }
-   if (host-data || host-response_busy) {
-   if (host-data)
-   omap_hsmmc_dma_cleanup(host,
-   -ETIMEDOUT);
-   host-response_busy = 0;
-   omap_hsmmc_reset_controller_fsm(host, SRD);
-   }
-   }
-   if ((status  DATA_TIMEOUT) ||
-   (status  DATA_CRC)) {
-   if (host-data || host-response_busy) {
-   int err = (status  DATA_TIMEOUT) ?
-   -ETIMEDOUT : -EILSEQ;
-
-   if (host-data)
-   omap_hsmmc_dma_cleanup(host, err);
-   else
-   host-mrq-cmd-error = err;
-   host-response_busy = 0;
-   omap_hsmmc_reset_controller_fsm(host, SRD);
-   end_trans = 1;
-   }
-   }
-   if (status  CARD_ERR) {
-   dev_dbg(mmc_dev(host-mmc),
-   Ignoring card err CMD%d\n, host-cmd-opcode);
-   if (host-cmd)
-   end_cmd = 1;
-   if (host-data)
-   end_trans = 1;
+   if (status  (CMD_TIMEOUT | DATA_TIMEOUT))
+   hsmmc_command_incomplete(host, -ETIMEDOUT);
+   else if (status  (CMD_CRC | DATA_CRC))
+   hsmmc_command_incomplete(host, -EILSEQ);
+
+   end_cmd = 1;
+   if (host-data || host-response_busy) {
+   end_trans = 1;
+   host-response_busy = 0;
}
}
 
-- 
1.7.11.1.25.g0e18bef

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


[PATCH 10/10] mmc: omap_hsmmc: Move to Maintained state in MAINTAINERS

2012-08-17 Thread Venkatraman S
I can continue to look after this driver.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 MAINTAINERS | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 72c2681..75e3c3e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4933,8 +4933,10 @@ S:   Maintained
 F: drivers/mmc/host/omap.c
 
 OMAP HS MMC SUPPORT
+M: Venkatraman S svenk...@ti.com
+L: linux-...@vger.kernel.org
 L: linux-omap@vger.kernel.org
-S: Orphan
+S: Maintained
 F: drivers/mmc/host/omap_hsmmc.c
 
 OMAP RANDOM NUMBER GENERATOR SUPPORT
-- 
1.7.11.1.25.g0e18bef

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


[PATCH 09/10] mmc: omap_hsmmc: convert from IP timer to hrtimer

2012-08-17 Thread Venkatraman S
omap hsmmc controller IP has an inbuilt timer that can be programmed to
guard against unresponsive operations. But it's range is very narrow,
and it's maximum countable time is a few seconds.

Card maintenance operations like BKOPS and SECURE DISCARD and long
stream writes like packed command require timers of order of
several minutes.
So get rid of using the IP timer entirely and use kernel's hrtimer
functionality for guarding the device operations.
As part of this change, a workaround that disabled timeouts for
MMC_ERASE commands is removed, and the arbitary timing of 100ms
is used only when the timeout is not explicitly specified by core.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c | 96 ++-
 1 file changed, 50 insertions(+), 46 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 9afdd20..8f7cebc 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -79,7 +79,7 @@
 #define CLKD_SHIFT 6
 #define DTO_MASK   0x000F
 #define DTO_SHIFT  16
-#define INT_EN_MASK0x307F0033
+#define INT_EN_MASK0x306E0033
 #define BWR_ENABLE (1  4)
 #define BRR_ENABLE (1  5)
 #define DTO_ENABLE (1  20)
@@ -160,6 +160,7 @@ struct omap_hsmmc_host {
unsigned intdma_sg_idx;
unsigned char   bus_mode;
unsigned char   power_mode;
+   unsigned intns_per_clk_cycle;
int suspended;
int irq;
int use_dma, dma_ch;
@@ -172,6 +173,7 @@ struct omap_hsmmc_host {
int reqs_blocked;
int use_reg;
int req_in_progress;
+   struct hrtimer  guard_timer;
struct omap_hsmmc_next  next_data;
 
struct  omap_mmc_platform_data  *pdata;
@@ -455,10 +457,6 @@ static void omap_hsmmc_enable_irq(struct omap_hsmmc_host 
*host,
else
irq_mask = INT_EN_MASK;
 
-   /* Disable timeout for erases */
-   if (cmd-opcode == MMC_ERASE)
-   irq_mask = ~DTO_ENABLE;
-
OMAP_HSMMC_WRITE(host-base, STAT, STAT_CLEAR);
OMAP_HSMMC_WRITE(host-base, ISE, irq_mask);
OMAP_HSMMC_WRITE(host-base, IE, irq_mask);
@@ -508,6 +506,9 @@ static void omap_hsmmc_set_clock(struct omap_hsmmc_host 
*host)
 time_before(jiffies, timeout))
cpu_relax();
 
+   if (ios-clock)
+   host-ns_per_clk_cycle = DIV_ROUND_UP(NSEC_PER_SEC, ios-clock);
+
omap_hsmmc_start_clock(host);
 }
 
@@ -824,7 +825,7 @@ omap_hsmmc_xfer_done(struct omap_hsmmc_host *host, struct 
mmc_data *data)
omap_hsmmc_request_done(host, mrq);
return;
}
-
+   hrtimer_cancel(host-guard_timer);
host-data = NULL;
 
if (!data-error)
@@ -859,8 +860,11 @@ omap_hsmmc_cmd_done(struct omap_hsmmc_host *host, struct 
mmc_command *cmd)
cmd-resp[0] = OMAP_HSMMC_READ(host-base, RSP10);
}
}
-   if ((host-data == NULL  !host-response_busy) || cmd-error)
+   if ((host-data == NULL  !host-response_busy) || cmd-error) {
+   if (cmd-error != -ETIMEDOUT)
+   hrtimer_cancel(host-guard_timer);
omap_hsmmc_request_done(host, cmd-mrq);
+   }
 }
 
 /*
@@ -992,7 +996,7 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, 
int status)
hsmmc_command_incomplete(host, -EILSEQ);
 
end_cmd = 1;
-   if (host-data || host-response_busy) {
+   if (data || host-response_busy) {
end_trans = 1;
host-response_busy = 0;
}
@@ -1292,41 +1296,35 @@ static int omap_hsmmc_start_dma_transfer(struct 
omap_hsmmc_host *host,
return 0;
 }
 
-static void set_data_timeout(struct omap_hsmmc_host *host,
-unsigned int timeout_ns,
-unsigned int timeout_clks)
+static void set_guard_timer(struct omap_hsmmc_host *host,
+   unsigned long timeout_ms, unsigned long timeout_ns,
+   unsigned int timeout_clks)
 {
-   unsigned int timeout, cycle_ns;
-   uint32_t reg, clkd, dto = 0;
+   ktime_t gtime;
+   unsigned int sec, nsec;
 
-   reg = OMAP_HSMMC_READ(host-base, SYSCTL);
-   clkd = (reg  CLKD_MASK)  CLKD_SHIFT;
-   if (clkd == 0)
-   clkd = 1;
+   sec = timeout_ms / MSEC_PER_SEC;
+   nsec = (timeout_ms % MSEC_PER_SEC) * NSEC_PER_MSEC + timeout_ns;
 
-   cycle_ns = 10 / (clk_get_rate(host-fclk) / clkd);
-   timeout = timeout_ns / cycle_ns;
-   timeout += timeout_clks;
-   if (timeout) {
-   while ((timeout  0x8000) == 0

[PATCH 1/2] ARM: OMAP2+: fix naming collision of variable nr_irqs

2012-06-25 Thread Venkatraman S
Using nr_irqs as local variable name triggers the sparse warning..
./arch/arm/mach-omap2/irq.c:265:6: warning: symbol 'nr_irqs' shadows an earlier 
one
./linux/include/linux/irqnr.h:26:12: originally declared here

Signed-off-by: Venkatraman S svenk...@ti.com
---
 arch/arm/mach-omap2/irq.c|8 
 arch/arm/mach-omap2/prm_common.c |8 
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index 6038a8c..4c35366 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -262,7 +262,7 @@ int __init omap_intc_of_init(struct device_node *node,
 struct device_node *parent)
 {
struct resource res;
-   u32 nr_irqs = 96;
+   u32 nr_irq = 96;
 
if (WARN_ON(!node))
return -ENODEV;
@@ -272,10 +272,10 @@ int __init omap_intc_of_init(struct device_node *node,
return -EINVAL;
}
 
-   if (of_property_read_u32(node, ti,intc-size, nr_irqs))
-   pr_warn(unable to get intc-size, default to %d\n, nr_irqs);
+   if (of_property_read_u32(node, ti,intc-size, nr_irq))
+   pr_warn(unable to get intc-size, default to %d\n, nr_irq);
 
-   omap_init_irq(res.start, nr_irqs, of_node_get(node));
+   omap_init_irq(res.start, nr_irq, of_node_get(node));
 
return 0;
 }
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index dfe00dd..534d732 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -85,7 +85,7 @@ static void omap_prcm_irq_handler(unsigned int irq, struct 
irq_desc *desc)
unsigned long priority_pending[OMAP_PRCM_MAX_NR_PENDING_REG];
struct irq_chip *chip = irq_desc_get_chip(desc);
unsigned int virtirq;
-   int nr_irqs = prcm_irq_setup-nr_regs * 32;
+   int nr_irq = prcm_irq_setup-nr_regs * 32;
 
/*
 * If we are suspended, mask all interrupts from PRCM level,
@@ -110,7 +110,7 @@ static void omap_prcm_irq_handler(unsigned int irq, struct 
irq_desc *desc)
prcm_irq_setup-read_pending_irqs(pending);
 
/* No bit set, then all IRQs are handled */
-   if (find_first_bit(pending, nr_irqs) = nr_irqs)
+   if (find_first_bit(pending, nr_irq) = nr_irq)
break;
 
omap_prcm_events_filter_priority(pending, priority_pending);
@@ -121,11 +121,11 @@ static void omap_prcm_irq_handler(unsigned int irq, 
struct irq_desc *desc)
 */
 
/* Serve priority events first */
-   for_each_set_bit(virtirq, priority_pending, nr_irqs)
+   for_each_set_bit(virtirq, priority_pending, nr_irq)
generic_handle_irq(prcm_irq_setup-base_irq + virtirq);
 
/* Serve normal events next */
-   for_each_set_bit(virtirq, pending, nr_irqs)
+   for_each_set_bit(virtirq, pending, nr_irq)
generic_handle_irq(prcm_irq_setup-base_irq + virtirq);
}
if (chip-irq_ack)
-- 
1.7.0.4

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


[PATCH 2/2] ARM: OMAP2+: use proper type for keymap data in boardfiles.

2012-06-25 Thread Venkatraman S
This fixes the sparse warnings...
arch/arm/mach-omap2/board-igep0020.c:482:14:
 warning: incorrect type in initializer (different signedness)
arch/arm/mach-omap2/board-4430sdp.c:200:14:
 warning: incorrect type in initializer (different signedness)

Signed-off-by: Venkatraman S svenk...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c  |2 +-
 arch/arm/mach-omap2/board-igep0020.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 8e17284..af7be39 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -64,7 +64,7 @@
 #define GPIO_WIFI_PMENA54
 #define GPIO_WIFI_IRQ  53
 
-static const int sdp4430_keymap[] = {
+static const uint32_t sdp4430_keymap[] = {
KEY(0, 0, KEY_E),
KEY(0, 1, KEY_R),
KEY(0, 2, KEY_T),
diff --git a/arch/arm/mach-omap2/board-igep0020.c 
b/arch/arm/mach-omap2/board-igep0020.c
index 7491529..c138944 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -459,7 +459,7 @@ static struct platform_device *igep_devices[] __initdata = {
igep_vwlan_device,
 };
 
-static int igep2_keymap[] = {
+static const uint32_t igep2_keymap[] = {
KEY(0, 0, KEY_LEFT),
KEY(0, 1, KEY_RIGHT),
KEY(0, 2, KEY_A),
-- 
1.7.0.4

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


[PATCH] spi: omap2-mcspi: fix section mismatch regression in probe

2012-06-19 Thread Venkatraman S
Commit 7d6b6d83(make it behave as a module) annotated probe with
__devinit, but a referenced function was not.

This introduced a section mismatch warning:
WARNING: vmlinux.o(.devinit.text+0x3eec): Section mismatch in reference
from the function omap2_mcspi_probe() to the function
.init.text:omap2_mcspi_master_setup()

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/spi/spi-omap2-mcspi.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 46ef5fe..1618e89 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1031,7 +1031,7 @@ static int omap2_mcspi_transfer_one_message(struct 
spi_master *master,
return 0;
 }
 
-static int __init omap2_mcspi_master_setup(struct omap2_mcspi *mcspi)
+static int __devinit omap2_mcspi_master_setup(struct omap2_mcspi *mcspi)
 {
struct spi_master   *master = mcspi-master;
struct omap2_mcspi_regs *ctx = mcspi-ctx;
-- 
1.7.0.4

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


[PATCH 0/3] mmc: omap: driver registration cleanups

2012-05-08 Thread Venkatraman S
Cleanups for the legacy omap mmc driver to remove clutter and
make it well behaved as module.

Venkatraman S (3):
  mmc: omap: convert to per instance workqueue
  mmc: omap: make it behave well as module
  mmc: omap: convert to module_platform_driver

 drivers/mmc/host/omap.c |   48 +++---
 1 files changed, 16 insertions(+), 32 deletions(-)

-- 
1.7.5.4

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


[PATCH 1/3] mmc: omap: convert to per instance workqueue

2012-05-08 Thread Venkatraman S
Currently, a global mmc_omap_wq is created for all instances of
omap hosts, which can lead to races and doesn't lend itself to
unload the module cleanly.
Instead, create per instance workqueue and remove the common workqueue.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap.c |   29 -
 1 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 887c0e5..2d7628e 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -169,11 +169,11 @@ struct mmc_omap_host {
struct timer_list   clk_timer;
spinlock_t  clk_lock; /* for changing enabled state */
unsigned intfclk_enabled:1;
+   struct workqueue_struct *mmc_omap_wq;
 
struct omap_mmc_platform_data *pdata;
 };
 
-static struct workqueue_struct *mmc_omap_wq;
 
 static void mmc_omap_fclk_offdelay(struct mmc_omap_slot *slot)
 {
@@ -291,7 +291,7 @@ static void mmc_omap_release_slot(struct mmc_omap_slot 
*slot, int clk_enabled)
host-next_slot = new_slot;
host-mmc = new_slot-mmc;
spin_unlock_irqrestore(host-slot_lock, flags);
-   queue_work(mmc_omap_wq, host-slot_release_work);
+   queue_work(host-mmc_omap_wq, host-slot_release_work);
return;
}
 
@@ -459,7 +459,7 @@ mmc_omap_xfer_done(struct mmc_omap_host *host, struct 
mmc_data *data)
}
 
host-stop_data = data;
-   queue_work(mmc_omap_wq, host-send_stop_work);
+   queue_work(host-mmc_omap_wq, host-send_stop_work);
 }
 
 static void
@@ -639,7 +639,7 @@ mmc_omap_cmd_timer(unsigned long data)
OMAP_MMC_WRITE(host, IE, 0);
disable_irq(host-irq);
host-abort = 1;
-   queue_work(mmc_omap_wq, host-cmd_abort_work);
+   queue_work(host-mmc_omap_wq, host-cmd_abort_work);
}
spin_unlock_irqrestore(host-slot_lock, flags);
 }
@@ -828,7 +828,7 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
host-abort = 1;
OMAP_MMC_WRITE(host, IE, 0);
disable_irq_nosync(host-irq);
-   queue_work(mmc_omap_wq, host-cmd_abort_work);
+   queue_work(host-mmc_omap_wq, host-cmd_abort_work);
return IRQ_HANDLED;
}
 
@@ -1389,7 +1389,7 @@ static void mmc_omap_remove_slot(struct mmc_omap_slot 
*slot)
 
tasklet_kill(slot-cover_tasklet);
del_timer_sync(slot-cover_timer);
-   flush_workqueue(mmc_omap_wq);
+   flush_workqueue(slot-host-mmc_omap_wq);
 
mmc_remove_host(mmc);
mmc_free_host(mmc);
@@ -1497,6 +1497,10 @@ static int __init mmc_omap_probe(struct platform_device 
*pdev)
 
host-reg_shift = (cpu_is_omap7xx() ? 1 : 2);
 
+   host-mmc_omap_wq = alloc_workqueue(mmc_omap, 0, 0);
+   if (!host-mmc_omap_wq)
+   goto err_plat_cleanup;
+
return 0;
 
 err_plat_cleanup:
@@ -1542,6 +1546,7 @@ static int mmc_omap_remove(struct platform_device *pdev)
iounmap(host-virt_base);
release_mem_region(pdev-resource[0].start,
   pdev-resource[0].end - pdev-resource[0].start + 1);
+   destroy_workqueue(host-mmc_omap_wq);
 
kfree(host);
 
@@ -1610,22 +1615,12 @@ static struct platform_driver mmc_omap_driver = {
 
 static int __init mmc_omap_init(void)
 {
-   int ret;
-
-   mmc_omap_wq = alloc_workqueue(mmc_omap, 0, 0);
-   if (!mmc_omap_wq)
-   return -ENOMEM;
-
-   ret = platform_driver_probe(mmc_omap_driver, mmc_omap_probe);
-   if (ret)
-   destroy_workqueue(mmc_omap_wq);
-   return ret;
+   return platform_driver_probe(mmc_omap_driver, mmc_omap_probe);
 }
 
 static void __exit mmc_omap_exit(void)
 {
platform_driver_unregister(mmc_omap_driver);
-   destroy_workqueue(mmc_omap_wq);
 }
 
 module_init(mmc_omap_init);
-- 
1.7.5.4

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


[PATCH 2/3] mmc: omap: make it behave well as module

2012-05-08 Thread Venkatraman S
Use proper __devinit and __devexit annotation for driver
functions. Instantiate the probe function for driver_ops
instead of a probe in the register function.

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

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 2d7628e..0056bd8 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1395,7 +1395,7 @@ static void mmc_omap_remove_slot(struct mmc_omap_slot 
*slot)
mmc_free_host(mmc);
 }
 
-static int __init mmc_omap_probe(struct platform_device *pdev)
+static int __devinit mmc_omap_probe(struct platform_device *pdev)
 {
struct omap_mmc_platform_data *pdata = pdev-dev.platform_data;
struct mmc_omap_host *host = NULL;
@@ -1522,7 +1522,7 @@ err_free_mem_region:
return ret;
 }
 
-static int mmc_omap_remove(struct platform_device *pdev)
+static int __devexit mmc_omap_remove(struct platform_device *pdev)
 {
struct mmc_omap_host *host = platform_get_drvdata(pdev);
int i;
@@ -1604,7 +1604,8 @@ static int mmc_omap_resume(struct platform_device *pdev)
 #endif
 
 static struct platform_driver mmc_omap_driver = {
-   .remove = mmc_omap_remove,
+   .probe  = mmc_omap_probe,
+   .remove = __devexit_p(mmc_omap_remove),
.suspend= mmc_omap_suspend,
.resume = mmc_omap_resume,
.driver = {
@@ -1615,7 +1616,7 @@ static struct platform_driver mmc_omap_driver = {
 
 static int __init mmc_omap_init(void)
 {
-   return platform_driver_probe(mmc_omap_driver, mmc_omap_probe);
+   return platform_driver_register(mmc_omap_driver);
 }
 
 static void __exit mmc_omap_exit(void)
-- 
1.7.5.4

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


[PATCH 3/3] mmc: omap: convert to module_platform_driver

2012-05-08 Thread Venkatraman S
Get rid of boilerplate code by using module_platform_driver macro,
no functional changes.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap.c |   14 +-
 1 files changed, 1 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 0056bd8..552196c 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1614,19 +1614,7 @@ static struct platform_driver mmc_omap_driver = {
},
 };
 
-static int __init mmc_omap_init(void)
-{
-   return platform_driver_register(mmc_omap_driver);
-}
-
-static void __exit mmc_omap_exit(void)
-{
-   platform_driver_unregister(mmc_omap_driver);
-}
-
-module_init(mmc_omap_init);
-module_exit(mmc_omap_exit);
-
+module_platform_driver(mmc_omap_driver);
 MODULE_DESCRIPTION(OMAP Multimedia Card driver);
 MODULE_LICENSE(GPL);
 MODULE_ALIAS(platform: DRIVER_NAME);
-- 
1.7.5.4

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


[PATCH v2 15/16] mmc: Update preempted request with CORRECTLY_PRG_SECTORS_NUM info

2012-05-03 Thread Venkatraman S
Ongoing request that was preempted during 'programming' state is partially
completed. Number of correctly programmed sectors is available in the
ext_csd field CORRECTLY_PRG_SECTORS_NUM. Read this field to update
the bytes_xfered field of the request

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/core/core.c |   26 --
 include/linux/mmc/mmc.h |4 
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index e6430f8..354dd7a 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -122,6 +122,23 @@ static inline void mmc_should_fail_request(struct mmc_host 
*host,
 
 #endif /* CONFIG_FAIL_MMC_REQUEST */
 
+static int mmc_get_programmed_sectors(struct mmc_card *card, int *nsectors)
+{
+   int err;
+   u8 ext_csd[512];
+
+   mmc_claim_host(card-host);
+   err = mmc_send_ext_csd(card, ext_csd);
+   mmc_release_host(card-host);
+   if (err)
+   return err;
+   *nsectors = ext_csd[EXT_CSD_C_PRG_SECTORS_NUM0] +
+   (ext_csd[EXT_CSD_C_PRG_SECTORS_NUM1]  7) +
+   (ext_csd[EXT_CSD_C_PRG_SECTORS_NUM2]  15) +
+   (ext_csd[EXT_CSD_C_PRG_SECTORS_NUM3]  23);
+
+   return 0;
+}
 /**
  * mmc_request_done - finish processing an MMC request
  * @host: MMC host which completed request
@@ -470,6 +487,7 @@ int mmc_preempt_foreground_request(struct mmc_card *card,
struct mmc_request *req)
 {
int ret;
+   int nsectors;
 
ret = mmc_abort_req(card-host, req);
if (ret == -ENOSYS)
@@ -490,8 +508,12 @@ int mmc_preempt_foreground_request(struct mmc_card *card,
 */
if (req-data  req-data-error) {
mmc_interrupt_hpi(card);
-   /* TODO : Take out the CORRECTLY_PRG_SECTORS_NUM
-* from ext_csd and add it to the request */
+
+   ret = mmc_get_programmed_sectors(card, nsectors);
+   if (ret)
+   req-data-bytes_xfered = 0;
+   else
+   req-data-bytes_xfered = nsectors * 512;
}
 
return 0;
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index ec2f195..4a3453f 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -315,6 +315,10 @@ struct _mmc_csd {
 #define EXT_CSD_PWR_CL_200_360 237 /* RO */
 #define EXT_CSD_PWR_CL_DDR_52_195  238 /* RO */
 #define EXT_CSD_PWR_CL_DDR_52_360  239 /* RO */
+#define EXT_CSD_C_PRG_SECTORS_NUM0 242 /* RO */
+#define EXT_CSD_C_PRG_SECTORS_NUM1 243 /* RO */
+#define EXT_CSD_C_PRG_SECTORS_NUM2 244 /* RO */
+#define EXT_CSD_C_PRG_SECTORS_NUM3 245 /* RO */
 #define EXT_CSD_POWER_OFF_LONG_TIME247 /* RO */
 #define EXT_CSD_GENERIC_CMD6_TIME  248 /* RO */
 #define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */
-- 
1.7.10.rc2

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


[PATCH v2 16/16] mmc: omap_hsmmc: Implement abort_req host_ops

2012-05-03 Thread Venkatraman S
Provide the abort_req implementation for omap_hsmmc host.

When invoked, the host controller should stop the transfer
and end the ongoing request as early as possible.

If the aborted command is a data transfer command, dma setup is
aborted and a STOP command is issued. The transfer state is
marked as an error (except when the command has almost completed
while receiving the abort request, in which case finish the command
normally).

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   55 ++---
 1 file changed, 51 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index d15b149..a4da478 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -177,6 +177,7 @@ struct omap_hsmmc_host {
int reqs_blocked;
int use_reg;
int req_in_progress;
+   int abort_in_progress;
unsigned intflags;
struct omap_hsmmc_next  next_data;
 
@@ -982,6 +983,7 @@ static inline void omap_hsmmc_reset_controller_fsm(struct 
omap_hsmmc_host *host,
 static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, int status)
 {
struct mmc_data *data;
+   int err = 0;
int end_cmd = 0, end_trans = 0;
 
if (!host-req_in_progress) {
@@ -993,6 +995,11 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host 
*host, int status)
return;
}
 
+   if (host-abort_in_progress) {
+   end_trans = 1;
+   end_cmd = 1;
+   }
+
data = host-data;
dev_dbg(mmc_dev(host-mmc), IRQ Status is %x\n, status);
 
@@ -1021,7 +1028,7 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host 
*host, int status)
if ((status  DATA_TIMEOUT) ||
(status  DATA_CRC)) {
if (host-data || host-response_busy) {
-   int err = (status  DATA_TIMEOUT) ?
+   err = (status  DATA_TIMEOUT) ?
-ETIMEDOUT : -EILSEQ;
 
if (host-data)
@@ -1045,10 +1052,13 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host 
*host, int status)
 
OMAP_HSMMC_WRITE(host-base, STAT, status);
 
-   if (end_cmd || ((status  CC)  host-cmd))
+   if ((end_cmd || (status  CC))  host-cmd)
omap_hsmmc_cmd_done(host, host-cmd);
-   if ((end_trans || (status  TC))  host-mrq)
+   if ((end_trans || (status  TC))  host-mrq) {
+   if (data)
+   data-error = err;
omap_hsmmc_xfer_done(host, data);
+   }
 }
 
 /*
@@ -1257,7 +1267,7 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, 
void *cb_data)
}
 
spin_lock_irqsave(host-irq_lock, flags);
-   if (host-dma_ch  0) {
+   if (host-dma_ch  0 || host-abort_in_progress) {
spin_unlock_irqrestore(host-irq_lock, flags);
return;
}
@@ -1478,6 +1488,40 @@ static void omap_hsmmc_pre_req(struct mmc_host *mmc, 
struct mmc_request *mrq,
mrq-data-host_cookie = 0;
 }
 
+static int omap_hsmmc_abort_req(struct mmc_host *mmc, struct mmc_request *req)
+{
+   struct omap_hsmmc_host *host = mmc_priv(mmc);
+   unsigned long flags;
+
+   if (!host-req_in_progress) {
+   dev_dbg(mmc_dev(host-mmc), No request to abort\n);
+   return -EINVAL;
+   }
+   if (req  req != host-mrq) {
+   dev_dbg(mmc_dev(host-mmc), Non matching abort request\n);
+   return -EINVAL;
+   }
+   spin_lock_irqsave(host-irq_lock, flags);
+   host-abort_in_progress = 1;
+   omap_hsmmc_disable_irq(host);
+   spin_unlock_irqrestore(host-irq_lock, flags);
+
+   host-response_busy = 0;
+
+   if (host-data) {
+   struct mmc_data *dat = host-data;
+   omap_hsmmc_dma_cleanup(host, -EIO);
+   dev_dbg(mmc_dev(host-mmc), Aborting Transfer\n);
+   omap_hsmmc_xfer_done(host, dat);
+   } else if (host-cmd) {
+   dev_dbg(mmc_dev(host-mmc), Aborting Command\n);
+   omap_hsmmc_cmd_done(host, host-cmd);
+   }
+
+   dev_dbg(mmc_dev(host-mmc), Request %pK aborted\n, req);
+   return 0;
+
+}
 /*
  * Request function. for read/write operation
  */
@@ -1488,6 +1532,8 @@ static void omap_hsmmc_request(struct mmc_host *mmc, 
struct mmc_request *req)
 
BUG_ON(host-req_in_progress);
BUG_ON(host-dma_ch != -1);
+   host-abort_in_progress = 0;
+
if (host-protect_card) {
if (host-reqs_blocked  3) {
/*
@@ -1664,6 +1710,7 @@ static const struct mmc_host_ops omap_hsmmc_ops = {
.disable = omap_hsmmc_disable_fclk,
.post_req = omap_hsmmc_post_req

[PATCHv2 00/16] [FS, MM, block, MMC]: eMMC High Priority Interrupt Feature

2012-05-03 Thread Venkatraman S
Standard eMMC (Embedded MultiMedia Card) specification expects to execute
one request at a time. If some requests are more important than others, they
can't be aborted while the flash procedure is in progress.

New versions of the eMMC standard (4.41 and above) specfies a feature 
called High Priority Interrupt (HPI). This enables an ongoing transaction
to be aborted using a special command (HPI command) so that the card is ready
to receive new commands immediately. Then the new request can be submitted
to the card, and optionally the interrupted command can be resumed again.

Some restrictions exist on when and how the command can be used. For example,
only write and write-like commands (ERASE) can be preempted, and the urgent
request must be a read.

In order to support this in software,
a) At the top level, some policy decisions have to be made on what is
worth preempting for.
This implementation uses the demand paging requests and swap
read requests as potential reads worth preempting an ongoing long write.
This is expected to provide improved responsiveness for smarphones
with multitasking capabilities - example would be launch a email application
while a video capture session (which causes long writes) is ongoing.
b) At the block handler, the higher priority request should be queued
  ahead of the pending requests in the elevator
c) At the MMC block and core level, transactions have to executed to 
enforce the rules of the MMC spec and make a reasonable tradeoff if the
ongoing command is really worth preempting. (For example, is it too close
to completing already ?).
The current implementation uses a fixed time logic. If 10ms has
already elapsed since the first request was submitted, then a new high
priority request would not cause a HPI, as it is expected that the first
request would finish soon. Further work is needed to dynamically tune
this value (maybe through sysfs) or automatically determine based on
average write times of previous requests.
d) At the lowest level (MMC host controllers), support interface to 
provide a transition path for ongoing transactions to be aborted and the
controller to be ready to receive next command.

More information about this feature can be found at
Jedec Specification:-
http://www.jedec.org/standards-documents/docs/jesd84-a441
Presentation on eMMC4.41 features:-
http://www.jedec.org/sites/default/files/Victor_Tsai.pdf

Acknowledgements:-  
In no particular order, thanks to Arnd Bergmann and  Saugata Das
from Linaro, Ilan Smith and Alex Lemberg from Sandisk, Luca Porzio from Micron
Technologies, Yejin Moon, Jae Hoon Chung from Samsung and others.


v1 - v2:-
* Convert threshold for hpi usage to a tuning parameter (sysfs)
* Add Documentation/ABI for all sysfs entries
* Add implementation of abort for OMAP controller
* Rebased to 3.4-rc4 + mmc-next

This patch series depends on a few other related cleanups
in MMC driver. All the patches and the dependent series can be
pulled from 
git://github.com/svenkatr/linux.git my/mmc/3.4/foreground-hpiv2


Ilan Smith (3):
  FS: Added demand paging markers to filesystem
  MM: Added page swapping markers to memory management
  block: treat DMPG and SWAPIN requests as special

Venkatraman S (13):
  block: add queue attributes to manage dpmg and swapin requests
  block: add sysfs attributes for runtime control of dpmg and swapin
  block: Documentation: add sysfs ABI for expedite_dmpg and expedite_swapin
  mmc: core: helper function for finding preemptible command
  mmc: core: add preemptibility tracking fields to mmc command
  mmc: core: Add MMC abort interface
  mmc: block: Detect HPI support in card and host controller
  mmc: core: Implement foreground request preemption procedure
  mmc: sysfs: Add sysfs entry for tuning preempt_time_threshold
  mmc: Documentation: Add sysfs ABI for hpi_time_threshold
  mmc: block: Implement HPI invocation and handling logic.
  mmc: Update preempted request with CORRECTLY_PRG_SECTORS_NUM info
  mmc: omap_hsmmc: Implement abort_req host_ops

 Documentation/ABI/testing/sysfs-block   |   12 ++
 Documentation/ABI/testing/sysfs-devices-mmc |   12 ++
 block/blk-core.c|   18 +++
 block/blk-sysfs.c   |   16 +++
 block/elevator.c|   14 ++-
 drivers/mmc/card/block.c|  143 --
 drivers/mmc/card/queue.h|1 +
 drivers/mmc/core/core.c |   67 ++
 drivers/mmc/core/mmc.c  |   25 
 drivers/mmc/host/omap_hsmmc.c   |   55 -
 fs/mpage.c  |2 +
 include/linux/bio.h |8 ++
 include/linux/blk_types.h

[PATCH v2 02/16] MM: Added page swapping markers to memory management

2012-05-03 Thread Venkatraman S
From: Ilan Smith ilan.sm...@sandisk.com

Add attribute to identify swapin requests
Mark memory management requests with swapin requests

Signed-off-by: Ilan Smith ilan.sm...@sandisk.com
Signed-off-by: Alex Lemberg alex.lemb...@sandisk.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 include/linux/bio.h   |1 +
 include/linux/blk_types.h |2 ++
 mm/page_io.c  |3 ++-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/linux/bio.h b/include/linux/bio.h
index 264e0ef..8494b2f 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -63,6 +63,7 @@ static inline bool bio_rw_flagged(struct bio *bio, unsigned 
long flag)
 }
 
 #define bio_dmpg(bio)  bio_rw_flagged(bio, REQ_RW_DMPG)
+#define bio_swapin(bio)bio_rw_flagged(bio, REQ_RW_SWAPIN)
 
 /*
  * various member access, note that bio_data should of course not be used
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 87feb80..df2b9ea 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -151,6 +151,7 @@ enum rq_flag_bits {
__REQ_IO_STAT,  /* account I/O stat */
__REQ_MIXED_MERGE,  /* merge of different types, fail separately */
__REQ_RW_DMPG,
+   __REQ_RW_SWAPIN,
__REQ_NR_BITS,  /* stops here */
 };
 
@@ -193,5 +194,6 @@ enum rq_flag_bits {
 #define REQ_MIXED_MERGE(1  __REQ_MIXED_MERGE)
 #define REQ_SECURE (1  __REQ_SECURE)
 #define REQ_RW_DMPG(1  __REQ_RW_DMPG)
+#define REQ_RW_SWAPIN  (1  __REQ_RW_SWAPIN)
 
 #endif /* __LINUX_BLK_TYPES_H */
diff --git a/mm/page_io.c b/mm/page_io.c
index dc76b4d..a148bea 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -128,8 +128,9 @@ int swap_readpage(struct page *page)
ret = -ENOMEM;
goto out;
}
+   bio-bi_rw |= REQ_RW_SWAPIN;
count_vm_event(PSWPIN);
-   submit_bio(READ, bio);
+   submit_bio(READ | REQ_RW_SWAPIN, bio);
 out:
return ret;
 }
-- 
1.7.10.rc2

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


[PATCH v2 03/16] block: add queue attributes to manage dpmg and swapin requests

2012-05-03 Thread Venkatraman S
Add block queue properties to identify and manage demand paging
and swapin requests differently.

Signed-off-by: Ilan Smith ilan.sm...@sandisk.com
Signed-off-by: Alex Lemberg alex.lemb...@sandisk.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 include/linux/blkdev.h |8 
 1 file changed, 8 insertions(+)

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 2aa2466..e9187d4 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -420,6 +420,8 @@ struct request_queue {
 #define QUEUE_FLAG_ADD_RANDOM  16  /* Contributes to random pool */
 #define QUEUE_FLAG_SECDISCARD  17  /* supports SECDISCARD */
 #define QUEUE_FLAG_SAME_FORCE  18  /* force complete on same CPU */
+#define QUEUE_FLAG_EXP_DMPG19  /* Expedite Demand paging requests */
+#define QUEUE_FLAG_EXP_SWAPIN  20  /* Expedit page swapping */
 
 #define QUEUE_FLAG_DEFAULT ((1  QUEUE_FLAG_IO_STAT) |\
 (1  QUEUE_FLAG_STACKABLE)|   \
@@ -502,6 +504,12 @@ static inline void queue_flag_clear(unsigned int flag, 
struct request_queue *q)
 #define blk_queue_secdiscard(q)(blk_queue_discard(q)  \
test_bit(QUEUE_FLAG_SECDISCARD, (q)-queue_flags))
 
+#define blk_queue_exp_dmpg(q) \
+   test_bit(QUEUE_FLAG_EXP_DMPG, (q)-queue_flags)
+
+#define blk_queue_exp_swapin(q) \
+   test_bit(QUEUE_FLAG_EXP_SWAPIN, (q)-queue_flags)
+
 #define blk_noretry_request(rq) \
((rq)-cmd_flags  (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \
 REQ_FAILFAST_DRIVER))
-- 
1.7.10.rc2

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


[PATCH v2 05/16] block: Documentation: add sysfs ABI for expedite_dmpg and expedite_swapin

2012-05-03 Thread Venkatraman S
Add description on the usage of expedite_dmpg and
expedite_swapin.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 Documentation/ABI/testing/sysfs-block |   12 
 1 file changed, 12 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-block 
b/Documentation/ABI/testing/sysfs-block
index c1eb41c..0fb9fef 100644
--- a/Documentation/ABI/testing/sysfs-block
+++ b/Documentation/ABI/testing/sysfs-block
@@ -206,3 +206,15 @@ Description:
when a discarded area is read the discard_zeroes_data
parameter will be set to one. Otherwise it will be 0 and
the result of reading a discarded area is undefined.
+
+What:  /sys/block/disk/queue/expedite_demandpaging
+What:  /sys/block/disk/queue/expedite_swapin
+Date:  April 2012
+Contact:   Venkatraman S svenk...@ti.com
+Description:
+   For latency improvements, some storage devices could
+   provide a mechanism for servicing demand paging and
+   swapin requests in a high priority manner. Setting
+   these flags to 1 would get the requests marked with
+   REQ_RW_DMPG or REQ_RW_SWAPIN to be moved to the front
+   of elevator queue.
-- 
1.7.10.rc2

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


[PATCH v2 04/16] block: add sysfs attributes for runtime control of dpmg and swapin

2012-05-03 Thread Venkatraman S
sysfs entries for DPMG and SWAPIN requests so that they can
be set/reset from userspace.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 block/blk-sysfs.c |   16 
 1 file changed, 16 insertions(+)

diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index cf15001..764de9f 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -213,6 +213,8 @@ queue_store_##name(struct request_queue *q, const char 
*page, size_t count) \
 }
 
 QUEUE_SYSFS_BIT_FNS(nonrot, NONROT, 1);
+QUEUE_SYSFS_BIT_FNS(expedite_dmpg, EXP_DMPG, 0);
+QUEUE_SYSFS_BIT_FNS(expedite_swapin, EXP_SWAPIN, 0);
 QUEUE_SYSFS_BIT_FNS(random, ADD_RANDOM, 0);
 QUEUE_SYSFS_BIT_FNS(iostats, IO_STAT, 0);
 #undef QUEUE_SYSFS_BIT_FNS
@@ -387,6 +389,18 @@ static struct queue_sysfs_entry queue_random_entry = {
.store = queue_store_random,
 };
 
+static struct queue_sysfs_entry queue_dmpg_entry = {
+   .attr = {.name = expedite_demandpaging, .mode = S_IRUGO | S_IWUSR },
+   .show = queue_show_expedite_dmpg,
+   .store = queue_store_expedite_dmpg,
+};
+
+static struct queue_sysfs_entry queue_swapin_entry = {
+   .attr = {.name = expedite_swapping, .mode = S_IRUGO | S_IWUSR },
+   .show = queue_show_expedite_swapin,
+   .store = queue_store_expedite_swapin,
+};
+
 static struct attribute *default_attrs[] = {
queue_requests_entry.attr,
queue_ra_entry.attr,
@@ -409,6 +423,8 @@ static struct attribute *default_attrs[] = {
queue_rq_affinity_entry.attr,
queue_iostats_entry.attr,
queue_random_entry.attr,
+   queue_dmpg_entry.attr,
+   queue_swapin_entry.attr,
NULL,
 };
 
-- 
1.7.10.rc2

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


[PATCH v2 07/16] mmc: core: helper function for finding preemptible command

2012-05-03 Thread Venkatraman S
According to table30 in eMMC spec, only some commands
can be preempted by foreground HPI. Provide a helper function
for the HPI procedure to identify if the command is
preemptible.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 include/linux/mmc/core.h |   13 +
 1 file changed, 13 insertions(+)

diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 1b431c7..680e256 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -10,6 +10,7 @@
 
 #include linux/interrupt.h
 #include linux/completion.h
+#include linux/mmc/mmc.h
 
 struct request;
 struct mmc_data;
@@ -192,6 +193,18 @@ static inline void mmc_claim_host(struct mmc_host *host)
__mmc_claim_host(host, NULL);
 }
 
+static inline bool mmc_is_preemptible_command(struct mmc_command *cmd)
+{
+   if ((cmd-opcode == MMC_SWITCH  (cmd-arg == EXT_CSD_BKOPS_START ||
+   cmd-arg == EXT_CSD_SANITIZE_START ||
+   cmd-arg == EXT_CSD_FLUSH_CACHE))
+   || (cmd-opcode == MMC_ERASE)
+   || (cmd-opcode == MMC_WRITE_MULTIPLE_BLOCK)
+   || (cmd-opcode == MMC_WRITE_BLOCK))
+   return true;
+   return false;
+}
+
 extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max);
 
 #endif /* LINUX_MMC_CORE_H */
-- 
1.7.10.rc2

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


[PATCH v2 08/16] mmc: core: add preemptibility tracking fields to mmc command

2012-05-03 Thread Venkatraman S
Set a preemptibility command atrribute to MMC commands. This
can be later used by write (multi block), trim etc for
evaluating if a HPI is applicable.

Note the starting time of executing a command so a decision
can be made if it is too late for preemption.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/core/core.c  |5 +
 include/linux/mmc/core.h |4 
 2 files changed, 9 insertions(+)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index c4cd6fb..b4152ca 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -258,6 +258,11 @@ static int __mmc_start_req(struct mmc_host *host, struct 
mmc_request *mrq)
complete(mrq-completion);
return -ENOMEDIUM;
}
+   if (mmc_is_preemptible_command(mrq-cmd))
+   mrq-cmd-cmd_attr |= MMC_CMD_PREEMPTIBLE;
+   else
+   mrq-cmd-cmd_attr = ~MMC_CMD_PREEMPTIBLE;
+   mrq-cmd-started_time = jiffies;
mmc_start_request(host, mrq);
return 0;
 }
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 680e256..d86144e 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -76,6 +76,10 @@ struct mmc_command {
  */
 #define mmc_cmd_type(cmd)  ((cmd)-flags  MMC_CMD_MASK)
 
+   unsigned intcmd_attr; /*Runtime attributes of the command */
+#define MMC_CMD_PREEMPTIBLEBIT(0)
+#define MMC_CMD_PREEMPTED  BIT(1)
+   unsigned long   started_time;
unsigned intretries;/* max number of retries */
unsigned interror;  /* command error */
 
-- 
1.7.10.rc2

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


[PATCH v2 09/16] mmc: core: Add MMC abort interface

2012-05-03 Thread Venkatraman S
HPI (and possibly other) procedures require that an ongoing
mmc request issued to a controller be aborted in the middle
of a transaction. Define a abort interface function to the
controller so that individual host controllers can safely
abort a request, stop the dma and cleanup their statemachine
etc. The implementation is controller dependant

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/core/core.c  |8 
 include/linux/mmc/host.h |1 +
 2 files changed, 9 insertions(+)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index b4152ca..3f0e927 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -328,6 +328,14 @@ static void mmc_post_req(struct mmc_host *host, struct 
mmc_request *mrq,
}
 }
 
+static int mmc_abort_req(struct mmc_host *host, struct mmc_request *req)
+{
+   if (host-ops-abort_req)
+   return host-ops-abort_req(host, req);
+
+   return -ENOSYS;
+}
+
 /**
  * mmc_start_req - start a non-blocking request
  * @host: MMC host to start command
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 0707d22..d700703 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -98,6 +98,7 @@ struct mmc_host_ops {
int err);
void(*pre_req)(struct mmc_host *host, struct mmc_request *req,
   bool is_first_req);
+   int (*abort_req)(struct mmc_host *host, struct mmc_request *req);
void(*request)(struct mmc_host *host, struct mmc_request *req);
/*
 * Avoid calling these three functions too often or in a fast path,
-- 
1.7.10.rc2

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


[PATCH v2 12/16] mmc: sysfs: Add sysfs entry for tuning preempt_time_threshold

2012-05-03 Thread Venkatraman S
When High Priority Interrupt (HPI) is enabled, ongoing requests
might be preempted. It is worthwhile to not preempt some requests
which have progressed in the underlying driver for some time.

The threshold of elapsed time after which HPI is not useful can
be tuned on a per-device basis, using the hpi_time_threshold
sysfs entry.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/core/mmc.c   |   25 +
 include/linux/mmc/card.h |1 +
 2 files changed, 26 insertions(+)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 54df5ad..b7dbea1 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -624,6 +624,30 @@ MMC_DEV_ATTR(enhanced_area_offset, %llu\n,
card-ext_csd.enhanced_area_offset);
 MMC_DEV_ATTR(enhanced_area_size, %u\n, card-ext_csd.enhanced_area_size);
 
+static ssize_t mmc_hpi_threhold_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct mmc_card *card = mmc_dev_to_card(dev);
+   return sprintf(buf, %d\n, card-preempt_time_threshold);
+}
+
+static ssize_t mmc_hpi_threshold_store(struct device *dev,
+   struct device_attribute *attr,
+   const char *buf, size_t count)
+{
+   unsigned long threshold;
+   struct mmc_card *card = mmc_dev_to_card(dev);
+
+   if (kstrtoul(buf, 0, threshold))
+   return -EINVAL;
+   if (threshold)
+   card-preempt_time_threshold = threshold;
+   return count;
+}
+
+DEVICE_ATTR(hpi_time_threshold, S_IRWXU, mmc_hpi_threhold_show,
+   mmc_hpi_threshold_store);
+
 static struct attribute *mmc_std_attrs[] = {
dev_attr_cid.attr,
dev_attr_csd.attr,
@@ -638,6 +662,7 @@ static struct attribute *mmc_std_attrs[] = {
dev_attr_serial.attr,
dev_attr_enhanced_area_offset.attr,
dev_attr_enhanced_area_size.attr,
+   dev_attr_hpi_time_threshold.attr,
NULL,
 };
 
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 629b823..2a0da29 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -245,6 +245,7 @@ struct mmc_card {
unsigned interase_shift;/* if erase unit is power 2 */
unsigned intpref_erase; /* in sectors */
u8  erased_byte;/* value of erased bytes */
+   unsigned int preempt_time_threshold;/* ms for checking hpi usage */
 
u32 raw_cid[4]; /* raw card CID */
u32 raw_csd[4]; /* raw card CSD */
-- 
1.7.10.rc2

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


[PATCH v2 14/16] mmc: block: Implement HPI invocation and handling logic.

2012-05-03 Thread Venkatraman S
Intercept command which require high priority treatment.
If the ongoing command can be preempted according to JEDEC HPI
definition and sufficient window exist to complete an ongoing
request, invoke HPI and abort the current request, and issue
the high priority request.
Otherwise, process the command normally.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/card/block.c |  131 +++---
 drivers/mmc/card/queue.h |1 +
 2 files changed, 124 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 11833e4..3dd662b 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -1276,7 +1276,7 @@ static int mmc_blk_cmd_err(struct mmc_blk_data *md, 
struct mmc_card *card,
return ret;
 }
 
-static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
+static int mmc_blk_execute_rw_rq(struct mmc_queue *mq, struct request *rqc)
 {
struct mmc_blk_data *md = mq-data;
struct mmc_card *card = md-queue.card;
@@ -1285,22 +1285,31 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, 
struct request *rqc)
enum mmc_blk_status status;
struct mmc_queue_req *mq_rq;
struct request *req;
-   struct mmc_async_req *areq;
+   struct mmc_async_req *prev_req, *cur_req;
 
if (!rqc  !mq-mqrq_prev-req)
return 0;
 
+   mq-mqrq_interrupted = NULL;
+
do {
if (rqc) {
mmc_blk_rw_rq_prep(mq-mqrq_cur, card, 0, mq);
-   areq = mq-mqrq_cur-mmc_active;
-   } else
-   areq = NULL;
-   areq = mmc_start_req(card-host, areq, (int *) status);
-   if (!areq)
+   cur_req = mq-mqrq_cur-mmc_active;
+   } else {
+   cur_req = NULL;
+   }
+   prev_req = mmc_start_req(card-host, cur_req, (int *) status);
+   if (!prev_req)
return 0;
 
-   mq_rq = container_of(areq, struct mmc_queue_req, mmc_active);
+   if (cur_req 
+   cur_req-mrq-cmd-cmd_attr  MMC_CMD_PREEMPTIBLE) {
+   mq-mqrq_interrupted = mq-mqrq_cur;
+   }
+
+   mq_rq = container_of(prev_req,
+   struct mmc_queue_req, mmc_active);
brq = mq_rq-brq;
req = mq_rq-req;
type = rq_data_dir(req) == READ ? MMC_BLK_READ : MMC_BLK_WRITE;
@@ -1406,6 +1415,112 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, 
struct request *rqc)
return 0;
 }
 
+#define HPI_CHECK  (REQ_RW_SWAPIN | REQ_RW_DMPG)
+
+static bool mmc_can_do_foreground_hpi(struct mmc_queue *mq,
+   struct request *req, unsigned int thpi)
+{
+
+   /*
+* If some time has elapsed since the issuing of previous write
+* command, or if the size of the request was too small, there's
+* no point in preempting it. Check if it's worthwhile to preempt
+*/
+   int time_elapsed = jiffies_to_msecs(jiffies -
+   mq-mqrq_cur-mmc_active.mrq-cmd-started_time);
+
+   if (time_elapsed = thpi)
+   return true;
+
+   return false;
+}
+
+/*
+ * When a HPI command had been given for a foreground
+ * request, the host controller will finish the request,
+ * the completion request has to be handled differently
+ */
+static struct mmc_async_req *mmc_handle_aborted_request(struct mmc_queue *mq,
+   int hpi_err)
+{
+   struct mmc_async_req *areq;
+   struct mmc_request *mrq;
+   struct mmc_queue_req *mq_rq;
+   struct mmc_blk_data *md = mq-data;
+   struct request *req;
+
+   BUG_ON(!mq-mqrq_interrupted);
+
+   areq = mq-mqrq_interrupted-mmc_active;
+   mrq = areq-mrq;
+
+   /* Error checking is TBD */
+   mq_rq = container_of(areq, struct mmc_queue_req, mmc_active);
+   req = mq_rq-req;
+   mmc_queue_bounce_post(mq_rq);
+
+   spin_lock_irq(md-lock);
+   /*
+* TODO. Do the error translation as done in
+* blk_err_check here and propogate
+* the partial transfer status if applicable
+*/
+   __blk_end_request(req, -EIO, 0);
+   spin_unlock_irq(md-lock);
+   return areq;
+}
+
+static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
+{
+   int ret;
+   struct mmc_blk_data *md = mq-data;
+   struct mmc_card *card = md-queue.card;
+   struct mmc_async_req *areq;
+
+   if (req  md-flags  MMC_HPI_SUPPORT) {
+   if (!((req-cmd_flags  HPI_CHECK)  mq-mqrq_interrupted))
+   goto no_preempt;
+   if (!mmc_can_do_foreground_hpi(mq, req,
+   card-preempt_time_threshold))
+   goto no_preempt;
+
+   pr_debug(Pre-empting ongoing request %pK\n

[PATCH v2 13/16] mmc: Documentation: Add sysfs ABI for hpi_time_threshold

2012-05-03 Thread Venkatraman S
hpi_time_threshold can be set to configure elapsed time in ms,
after which an ongoing request will not be preempted.
Explain the hpi_time_threhold parameter for MMC devices.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 Documentation/ABI/testing/sysfs-devices-mmc |   12 
 1 file changed, 12 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-devices-mmc 
b/Documentation/ABI/testing/sysfs-devices-mmc
index 5a50ab6..133dba5 100644
--- a/Documentation/ABI/testing/sysfs-devices-mmc
+++ b/Documentation/ABI/testing/sysfs-devices-mmc
@@ -19,3 +19,15 @@ Description:
is enabled, this attribute will indicate the size of enhanced
data area. If not, this attribute will be -EINVAL.
Unit KByte. Format decimal.
+
+What:  /sys/devices/.../mmc_host/mmcX/mmcX:/hpi_time_threshold
+Date:  April 2012
+Contact:   Venkatraman S svenk...@ti.com
+Description:
+   High Priority Interrupt is a new feature defined in eMMC4.4
+   standard. If this feature is enabled, stack needs to decide
+   till what time since the last issued request is considered
+   preemptible. This attribute value (in milliseconds) is
+   used for arriving at the most optimal value for a specific
+   card. Default is zero, which also disables the feature, as
+   the request becomes non-preemptible immediately.
-- 
1.7.10.rc2

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


[PATCH v2 10/16] mmc: block: Detect HPI support in card and host controller

2012-05-03 Thread Venkatraman S
If both the card and host controller support HPI related
operations, set a flag in MMC queue to remember it.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/card/block.c |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index dabec55..11833e4 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -88,6 +88,7 @@ struct mmc_blk_data {
unsigned intflags;
 #define MMC_BLK_CMD23  (1  0)/* Can do SET_BLOCK_COUNT for 
multiblock */
 #define MMC_BLK_REL_WR (1  1)/* MMC Reliable write support */
+#define MMC_HPI_SUPPORT(1  2)
 
unsigned intusage;
unsigned intread_only;
@@ -1548,12 +1549,15 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct 
mmc_card *card,
md-flags |= MMC_BLK_CMD23;
}
 
-   if (mmc_card_mmc(card) 
-   md-flags  MMC_BLK_CMD23 
+   if (mmc_card_mmc(card)) {
+   if (md-flags  MMC_BLK_CMD23 
((card-ext_csd.rel_param  EXT_CSD_WR_REL_PARAM_EN) ||
 card-ext_csd.rel_sectors)) {
-   md-flags |= MMC_BLK_REL_WR;
-   blk_queue_flush(md-queue.queue, REQ_FLUSH | REQ_FUA);
+   md-flags |= MMC_BLK_REL_WR;
+   blk_queue_flush(md-queue.queue, REQ_FLUSH | REQ_FUA);
+   }
+   if (card-host-ops-abort_req  card-ext_csd.hpi_en)
+   md-flags |= MMC_HPI_SUPPORT;
}
 
return md;
-- 
1.7.10.rc2

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


[PATCH v2 11/16] mmc: core: Implement foreground request preemption procedure

2012-05-03 Thread Venkatraman S
When invoked, ongoing command at the host controller should abort
and completion should be invoked.

It's quite possible that the interruption will race with the
successful completion of the command. If so, HPI is invoked
only when the low level driver sets an error flag for the
aborted request.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/core/core.c  |   32 
 include/linux/mmc/core.h |2 ++
 2 files changed, 34 insertions(+)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 3f0e927..e6430f8 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -466,6 +466,38 @@ out:
 }
 EXPORT_SYMBOL(mmc_interrupt_hpi);
 
+int mmc_preempt_foreground_request(struct mmc_card *card,
+   struct mmc_request *req)
+{
+   int ret;
+
+   ret = mmc_abort_req(card-host, req);
+   if (ret == -ENOSYS)
+   return ret;
+   /*
+* Whether or not abort was successful, the command is
+* still under the host controller's context.
+* Should wait for the completion to be returned.
+*/
+   wait_for_completion(req-completion);
+   /*
+* Checkpoint the aborted request.
+* If error is set, the request completed partially,
+* and the ext_csd field CORRECTLY_PRG_SECTORS_NUM
+* contains the number of blocks written to the device.
+* If error is not set, the request was completed
+* successfully and there is no need to try it again.
+*/
+   if (req-data  req-data-error) {
+   mmc_interrupt_hpi(card);
+   /* TODO : Take out the CORRECTLY_PRG_SECTORS_NUM
+* from ext_csd and add it to the request */
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL(mmc_preempt_foreground_request);
+
 /**
  * mmc_wait_for_cmd - start a command and wait for completion
  * @host: MMC host to start command
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index d86144e..e2d55c6 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -144,6 +144,8 @@ extern struct mmc_async_req *mmc_start_req(struct mmc_host 
*,
 extern int mmc_interrupt_hpi(struct mmc_card *);
 extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *);
 extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
+extern int mmc_preempt_foreground_request(struct mmc_card *card,
+   struct mmc_request *req);
 extern int mmc_app_cmd(struct mmc_host *, struct mmc_card *);
 extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
struct mmc_command *, int);
-- 
1.7.10.rc2

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


[PATCH v2 06/16] block: treat DMPG and SWAPIN requests as special

2012-05-03 Thread Venkatraman S
From: Ilan Smith ilan.sm...@sandisk.com

When exp_swapin and exp_dmpg are set, treat read requests
marked with DMPG and SWAPIN as high priority and move to
the front of the queue.

Signed-off-by: Ilan Smith ilan.sm...@sandisk.com
Signed-off-by: Alex Lemberg alex.lemb...@sandisk.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 block/blk-core.c |   18 ++
 block/elevator.c |   14 +-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 1f61b74..7a1b98b 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1306,6 +1306,12 @@ void init_request_from_bio(struct request *req, struct 
bio *bio)
if (bio-bi_rw  REQ_RAHEAD)
req-cmd_flags |= REQ_FAILFAST_MASK;
 
+   if (bio_swapin(bio)  blk_queue_exp_swapin(req-q))
+   req-cmd_flags |= REQ_RW_SWAPIN | REQ_NOMERGE;
+
+   if (bio_dmpg(bio)  blk_queue_exp_dmpg(req-q))
+   req-cmd_flags |= REQ_RW_DMPG | REQ_NOMERGE;
+
req-errors = 0;
req-__sector = bio-bi_sector;
req-ioprio = bio_prio(bio);
@@ -1333,6 +1339,18 @@ void blk_queue_bio(struct request_queue *q, struct bio 
*bio)
goto get_rq;
}
 
+   if (bio_swapin(bio)  blk_queue_exp_swapin(q)) {
+   spin_lock_irq(q-queue_lock);
+   where = ELEVATOR_INSERT_FLUSH;
+   goto get_rq;
+   }
+
+   if (bio_dmpg(bio)  blk_queue_exp_dmpg(q)) {
+   spin_lock_irq(q-queue_lock);
+   where = ELEVATOR_INSERT_FLUSH;
+   goto get_rq;
+   }
+
/*
 * Check if we can merge with the plugged list before grabbing
 * any locks.
diff --git a/block/elevator.c b/block/elevator.c
index f016855..76d571b 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -367,7 +367,8 @@ void elv_dispatch_sort(struct request_queue *q, struct 
request *rq)
q-nr_sorted--;
 
boundary = q-end_sector;
-   stop_flags = REQ_SOFTBARRIER | REQ_STARTED;
+   stop_flags = REQ_SOFTBARRIER | REQ_STARTED
+   | REQ_RW_SWAPIN | REQ_RW_DMPG ;
list_for_each_prev(entry, q-queue_head) {
struct request *pos = list_entry_rq(entry);
 
@@ -585,6 +586,17 @@ void elv_quiesce_end(struct request_queue *q)
 
 void __elv_add_request(struct request_queue *q, struct request *rq, int where)
 {
+   unsigned int hpi_flags = REQ_RW_DMPG | REQ_RW_SWAPIN;
+
+   if (rq-cmd_flags  hpi_flags) {
+   /*
+* Insert swap-in or demand page requests at the front. This
+* causes them to be queued in the reversed order.
+*/
+   where = ELEVATOR_INSERT_FRONT;
+   } else
+
+
trace_block_rq_insert(q, rq);
 
rq-q = q;
-- 
1.7.10.rc2

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


[PATCH v2 01/16] FS: Added demand paging markers to filesystem

2012-05-03 Thread Venkatraman S
From: Ilan Smith ilan.sm...@sandisk.com

Add attribute to identify demand paging requests.
Mark readpages with demand paging attribute.

Signed-off-by: Ilan Smith ilan.sm...@sandisk.com
Signed-off-by: Alex Lemberg alex.lemb...@sandisk.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 fs/mpage.c|2 ++
 include/linux/bio.h   |7 +++
 include/linux/blk_types.h |2 ++
 3 files changed, 11 insertions(+)

diff --git a/fs/mpage.c b/fs/mpage.c
index 0face1c..8b144f5 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -386,6 +386,8 @@ mpage_readpages(struct address_space *mapping, struct 
list_head *pages,
last_block_in_bio, map_bh,
first_logical_block,
get_block);
+   if (bio)
+   bio-bi_rw |= REQ_RW_DMPG;
}
page_cache_release(page);
}
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 4d94eb8..264e0ef 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -57,6 +57,13 @@
(bio)-bi_rw |= ((unsigned long) (prio)  BIO_PRIO_SHIFT); \
 } while (0)
 
+static inline bool bio_rw_flagged(struct bio *bio, unsigned long flag)
+{
+   return ((bio-bi_rw  flag)  != 0);
+}
+
+#define bio_dmpg(bio)  bio_rw_flagged(bio, REQ_RW_DMPG)
+
 /*
  * various member access, note that bio_data should of course not be used
  * on highmem page vectors
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 4053cbd..87feb80 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -150,6 +150,7 @@ enum rq_flag_bits {
__REQ_FLUSH_SEQ,/* request for flush sequence */
__REQ_IO_STAT,  /* account I/O stat */
__REQ_MIXED_MERGE,  /* merge of different types, fail separately */
+   __REQ_RW_DMPG,
__REQ_NR_BITS,  /* stops here */
 };
 
@@ -191,5 +192,6 @@ enum rq_flag_bits {
 #define REQ_IO_STAT(1  __REQ_IO_STAT)
 #define REQ_MIXED_MERGE(1  __REQ_MIXED_MERGE)
 #define REQ_SECURE (1  __REQ_SECURE)
+#define REQ_RW_DMPG(1  __REQ_RW_DMPG)
 
 #endif /* __LINUX_BLK_TYPES_H */
-- 
1.7.10.rc2

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


[PATCH 1/3] mmc: omap_hsmmc: release correct resource

2012-04-18 Thread Venkatraman S
From: Russell King - ARM Linux li...@arm.linux.org.uk

res can be one of several resources, as this variable is re-used several
times during probe.  This can cause the wrong resource parameters to be
passed to release_mem_region().

Get the original memory resource before calling release_mem_region().

Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 4254b6f..d15b149 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2042,7 +2042,9 @@ err1:
 err_alloc:
omap_hsmmc_gpio_free(pdata);
 err:
-   release_mem_region(res-start, resource_size(res));
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   if (res)
+   release_mem_region(res-start, resource_size(res));
return ret;
 }
 
-- 
1.7.10.rc2

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


[PATCH 2/3] mmc: omap_hsmmc: Add fclk frequency to debufs

2012-04-18 Thread Venkatraman S
From: Viswanath Puttagunta vi...@ti.com

Add mmc functional clock frequency to list of
internal state variables to display for debug.

Signed-off-by: Viswanath Puttagunta vi...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index d15b149..d046ba2 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1683,8 +1683,9 @@ static int omap_hsmmc_regs_show(struct seq_file *s, void 
*data)
if (host-pdata-get_context_loss_count)
context_loss = host-pdata-get_context_loss_count(host-dev);
 
-   seq_printf(s, mmc%d:\n ctx_loss:\t%d:%d\n\nregs:\n,
-   mmc-index, host-context_loss, context_loss);
+   seq_printf(s, mmc%d:\n ctx_loss:\t%d:%d\n fclk:\t\t%lu Hz\n\nregs:\n,
+   mmc-index, host-context_loss, context_loss,
+   clk_get_rate(host-fclk));
 
if (host-suspended) {
seq_printf(s, host suspended, can't read registers\n);
-- 
1.7.10.rc2

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


[PATCH 3/3] mmc: omap_hsmmc: If probe fails, give out error messages

2012-04-18 Thread Venkatraman S
From: Rajendra Nayak rna...@ti.com

Giving out debug messages even in case of probe failure seems
not very useful. Make them error messages instead.

Signed-off-by: Rajendra Nayak rna...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
Cc: Chris Ball c...@laptop.org
Cc: linux-...@vger.kernel.org
---
 drivers/mmc/host/omap_hsmmc.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index d046ba2..6d3ceab 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1956,13 +1956,13 @@ static int __devinit omap_hsmmc_probe(struct 
platform_device *pdev)
ret = request_irq(host-irq, omap_hsmmc_irq, 0,
mmc_hostname(mmc), host);
if (ret) {
-   dev_dbg(mmc_dev(host-mmc), Unable to grab HSMMC IRQ\n);
+   dev_err(mmc_dev(host-mmc), Unable to grab HSMMC IRQ\n);
goto err_irq;
}
 
if (pdata-init != NULL) {
if (pdata-init(pdev-dev) != 0) {
-   dev_dbg(mmc_dev(host-mmc),
+   dev_err(mmc_dev(host-mmc),
Unable to configure MMC IRQs\n);
goto err_irq_cd_init;
}
@@ -1985,7 +1985,7 @@ static int __devinit omap_hsmmc_probe(struct 
platform_device *pdev)
   IRQF_TRIGGER_RISING | 
IRQF_TRIGGER_FALLING,
   mmc_hostname(mmc), host);
if (ret) {
-   dev_dbg(mmc_dev(host-mmc),
+   dev_err(mmc_dev(host-mmc),
Unable to grab MMC CD IRQ\n);
goto err_irq_cd;
}
-- 
1.7.10.rc2

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


[PATCH] mmc: omap_hsmmc: release correct resource

2012-04-18 Thread Venkatraman S
From: Russell King rmk+ker...@arm.linux.org.uk

res can be one of several resources, as this variable is re-used several
times during probe.  This can cause the wrong resource parameters to be
passed to release_mem_region().

Get the original memory resource before calling release_mem_region().

Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 4254b6f..d15b149 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2042,7 +2042,9 @@ err1:
 err_alloc:
omap_hsmmc_gpio_free(pdata);
 err:
-   release_mem_region(res-start, resource_size(res));
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   if (res)
+   release_mem_region(res-start, resource_size(res));
return ret;
 }
 
-- 
1.7.10.rc2

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


[PATCH 1/2] mmc: omap_hsmmc: Add fclk frequency to debufs

2012-04-18 Thread Venkatraman S
From: Viswanath Puttagunta vi...@ti.com

Add mmc functional clock frequency to list of
internal state variables to display for debug.

Signed-off-by: Viswanath Puttagunta vi...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
v1 - v2: Restored indentation to be consistent
  as the rest of the file.
 drivers/mmc/host/omap_hsmmc.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index d15b149..5d0ce20 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1683,8 +1683,9 @@ static int omap_hsmmc_regs_show(struct seq_file *s, void 
*data)
if (host-pdata-get_context_loss_count)
context_loss = host-pdata-get_context_loss_count(host-dev);
 
-   seq_printf(s, mmc%d:\n ctx_loss:\t%d:%d\n\nregs:\n,
-   mmc-index, host-context_loss, context_loss);
+   seq_printf(s, mmc%d:\n ctx_loss:\t%d:%d\n fclk:\t\t%lu Hz\n\nregs:\n,
+   mmc-index, host-context_loss, context_loss,
+   clk_get_rate(host-fclk));
 
if (host-suspended) {
seq_printf(s, host suspended, can't read registers\n);
-- 
1.7.10.rc2

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


[PATCH 0/4] mmc: omap_hsmmc: Additional cleanups / features

2012-04-09 Thread Venkatraman S
Hi Chris,
  As discussed previously [1], I've rebased the previous 2 patches
that you decided to queue for 3.5, plus 2 additional cleanups.

Best regards,
Venkat.

[1] http://marc.info/?l=linux-mmcm=16030703924w=2

The following changes since commit 3bdc9ba892d6a294d16e9e6e0c4041926aa3d58c:

  mmc: use really long write timeout to deal with crappy cards (2012-04-05 
20:32:34 -0400)

are available in the git repository at:

  git://github.com/svenkatr/linux.git mmc-omap_hsmmc-next

for you to fetch changes up to 11c6cb1453f55b21e50fd891b3981a98a572d314:

  mmc: omap_hsmmc: Cleanup use of cpu_is_* for debounce_clock (2012-04-09 
11:58:22 +0530)


Balaji T K (2):
  mmc: omap_hsmmc: Enable Auto CMD12
  mmc: omap_hsmmc: add DDR support to omap_hsmmc

Rajendra Nayak (1):
  mmc: omap_hsmmc: Cleanup use of cpu_is_* for debounce_clock

Venkatraman S (1):
  mmc: omap_hsmmc: use spinlock IRQ safe variant

 drivers/mmc/host/omap_hsmmc.c |   78 
+---
 1 file changed, 45 insertions(+), 33 deletions(-)

-- 
1.7.10.rc2

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


[PATCH RESEND 1/4] mmc: omap_hsmmc: Enable Auto CMD12

2012-04-09 Thread Venkatraman S
From: Balaji T K balaj...@ti.com

Enable Auto-CMD12 for multi block read/write on HSMMC
Tested on OMAP4430, OMAP3430 and OMAP2430 SDP

Signed-off-by: Balaji T K balaj...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 5c2b1c1..1fcacb6 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -85,6 +85,7 @@
 #define BRR_ENABLE (1  5)
 #define DTO_ENABLE (1  20)
 #define INIT_STREAM(1  1)
+#define ACEN_ACMD12(1  2)
 #define DP_SELECT  (1  21)
 #define DDIR   (1  4)
 #define DMA_EN 0x1
@@ -115,6 +116,7 @@
 #define OMAP_MMC_MAX_CLOCK 5200
 #define DRIVER_NAMEomap_hsmmc
 
+#define AUTO_CMD12 (1  0)/* Auto CMD12 support */
 /*
  * One controller can have multiple slots, like on some omap boards using
  * omap.c controller driver. Luckily this is not currently done on any known
@@ -175,6 +177,7 @@ struct omap_hsmmc_host {
int reqs_blocked;
int use_reg;
int req_in_progress;
+   unsigned intflags;
struct omap_hsmmc_next  next_data;
 
struct  omap_mmc_platform_data  *pdata;
@@ -766,6 +769,8 @@ omap_hsmmc_start_command(struct omap_hsmmc_host *host, 
struct mmc_command *cmd,
cmdtype = 0x3;
 
cmdreg = (cmd-opcode  24) | (resptype  16) | (cmdtype  22);
+   if ((host-flags  AUTO_CMD12)  mmc_op_multi(cmd-opcode))
+   cmdreg |= ACEN_ACMD12;
 
if (data) {
cmdreg |= DP_SELECT | MSBS | BCE;
@@ -837,11 +842,14 @@ omap_hsmmc_xfer_done(struct omap_hsmmc_host *host, struct 
mmc_data *data)
else
data-bytes_xfered = 0;
 
-   if (!data-stop) {
+   if (data-stop  ((!(host-flags  AUTO_CMD12)) || data-error)) {
+   omap_hsmmc_start_command(host, data-stop, NULL);
+   } else {
+   if (data-stop)
+   data-stop-resp[0] = OMAP_HSMMC_READ(host-base,
+   RSP76);
omap_hsmmc_request_done(host, data-mrq);
-   return;
}
-   omap_hsmmc_start_command(host, data-stop, NULL);
 }
 
 /*
@@ -1844,6 +1852,7 @@ static int __devinit omap_hsmmc_probe(struct 
platform_device *pdev)
host-mapbase   = res-start + pdata-reg_offset;
host-base  = ioremap(host-mapbase, SZ_4K);
host-power_mode = MMC_POWER_OFF;
+   host-flags = AUTO_CMD12;
host-next_data.cookie = 1;
 
platform_set_drvdata(pdev, host);
-- 
1.7.10.rc2

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


[PATCH RESEND 2/4] mmc: omap_hsmmc: add DDR support to omap_hsmmc

2012-04-09 Thread Venkatraman S
From: Balaji T K balaj...@ti.com

Add Dual data rate support for omap_hsmmc

Signed-off-by: Balaji T K balaj...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 1fcacb6..9e701f3 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -92,6 +92,7 @@
 #define MSBS   (1  5)
 #define BCE(1  1)
 #define FOUR_BIT   (1  1)
+#define DDR(1  19)
 #define DW8(1  5)
 #define CC 0x1
 #define TC 0x02
@@ -523,6 +524,10 @@ static void omap_hsmmc_set_bus_width(struct 
omap_hsmmc_host *host)
u32 con;
 
con = OMAP_HSMMC_READ(host-base, CON);
+   if (ios-timing == MMC_TIMING_UHS_DDR50)
+   con |= DDR; /* configure in DDR mode */
+   else
+   con = ~DDR;
switch (ios-bus_width) {
case MMC_BUS_WIDTH_8:
OMAP_HSMMC_WRITE(host-base, CON, con | DW8);
-- 
1.7.10.rc2

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


[PATCH 3/4] mmc: omap_hsmmc: use spinlock IRQ safe variant

2012-04-09 Thread Venkatraman S
Prevent possible races between HSMMC/DMA IRQs and next requests.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 9e701f3..e8f296d 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -806,11 +806,12 @@ omap_hsmmc_get_dma_dir(struct omap_hsmmc_host *host, 
struct mmc_data *data)
 static void omap_hsmmc_request_done(struct omap_hsmmc_host *host, struct 
mmc_request *mrq)
 {
int dma_ch;
+   unsigned long flags;
 
-   spin_lock(host-irq_lock);
+   spin_lock_irqsave(host-irq_lock, flags);
host-req_in_progress = 0;
dma_ch = host-dma_ch;
-   spin_unlock(host-irq_lock);
+   spin_unlock_irqrestore(host-irq_lock, flags);
 
omap_hsmmc_disable_irq(host);
/* Do not complete the request if DMA is still in progress */
@@ -887,13 +888,14 @@ omap_hsmmc_cmd_done(struct omap_hsmmc_host *host, struct 
mmc_command *cmd)
 static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno)
 {
int dma_ch;
+   unsigned long flags;
 
host-data-error = errno;
 
-   spin_lock(host-irq_lock);
+   spin_lock_irqsave(host-irq_lock, flags);
dma_ch = host-dma_ch;
host-dma_ch = -1;
-   spin_unlock(host-irq_lock);
+   spin_unlock_irqrestore(host-irq_lock, flags);
 
if (host-use_dma  dma_ch != -1) {
dma_unmap_sg(mmc_dev(host-mmc), host-data-sg,
@@ -1247,6 +1249,7 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, 
void *cb_data)
struct omap_hsmmc_host *host = cb_data;
struct mmc_data *data;
int dma_ch, req_in_progress;
+   unsigned long flags;
 
if (!(ch_status  OMAP_DMA_BLOCK_IRQ)) {
dev_warn(mmc_dev(host-mmc), unexpected dma status %x\n,
@@ -1254,9 +1257,9 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, 
void *cb_data)
return;
}
 
-   spin_lock(host-irq_lock);
+   spin_lock_irqsave(host-irq_lock, flags);
if (host-dma_ch  0) {
-   spin_unlock(host-irq_lock);
+   spin_unlock_irqrestore(host-irq_lock, flags);
return;
}
 
@@ -1266,7 +1269,7 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, 
void *cb_data)
/* Fire up the next transfer. */
omap_hsmmc_config_dma_params(host, data,
   data-sg + host-dma_sg_idx);
-   spin_unlock(host-irq_lock);
+   spin_unlock_irqrestore(host-irq_lock, flags);
return;
}
 
@@ -1277,7 +1280,7 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, 
void *cb_data)
req_in_progress = host-req_in_progress;
dma_ch = host-dma_ch;
host-dma_ch = -1;
-   spin_unlock(host-irq_lock);
+   spin_unlock_irqrestore(host-irq_lock, flags);
 
omap_free_dma(dma_ch);
 
-- 
1.7.10.rc2

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


[PATCH 4/4] mmc: omap_hsmmc: Cleanup use of cpu_is_* for debounce_clock

2012-04-09 Thread Venkatraman S
From: Rajendra Nayak rna...@ti.com

There really does not seem to be a need to use cpu_is_*
check for getting the debounce clock as clkdev is
perfectly capable of handling situations when certain
clocks are only available on select platforms.

Also get rid of the 'got_dbclk' flag and instead use the
dbclk clock pointer to know if a valid debounce clock
exists for the platform.

Signed-off-by: Rajendra Nayak rna...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   39 +--
 1 file changed, 17 insertions(+), 22 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index e8f296d..ea8afcb 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -170,7 +170,6 @@ struct omap_hsmmc_host {
int use_dma, dma_ch;
int dma_line_tx, dma_line_rx;
int slot_id;
-   int got_dbclk;
int response_busy;
int context_loss;
int vdd;
@@ -1097,7 +1096,7 @@ static int omap_hsmmc_switch_opcond(struct 
omap_hsmmc_host *host, int vdd)
 
/* Disable the clocks */
pm_runtime_put_sync(host-dev);
-   if (host-got_dbclk)
+   if (host-dbclk)
clk_disable(host-dbclk);
 
/* Turn the power off */
@@ -1108,7 +1107,7 @@ static int omap_hsmmc_switch_opcond(struct 
omap_hsmmc_host *host, int vdd)
ret = mmc_slot(host).set_power(host-dev, host-slot_id, 1,
   vdd);
pm_runtime_get_sync(host-dev);
-   if (host-got_dbclk)
+   if (host-dbclk)
clk_enable(host-dbclk);
 
if (ret != 0)
@@ -1902,21 +1901,17 @@ static int __devinit omap_hsmmc_probe(struct 
platform_device *pdev)
 
omap_hsmmc_context_save(host);
 
-   if (cpu_is_omap2430()) {
-   host-dbclk = clk_get(pdev-dev, mmchsdb_fck);
-   /*
-* MMC can still work without debounce clock.
-*/
-   if (IS_ERR(host-dbclk))
-   dev_warn(mmc_dev(host-mmc),
-   Failed to get debounce clock\n);
-   else
-   host-got_dbclk = 1;
-
-   if (host-got_dbclk)
-   if (clk_enable(host-dbclk) != 0)
-   dev_dbg(mmc_dev(host-mmc), Enabling debounce
-clk failed\n);
+   host-dbclk = clk_get(pdev-dev, mmchsdb_fck);
+   /*
+* MMC can still work without debounce clock.
+*/
+   if (IS_ERR(host-dbclk)) {
+   dev_warn(mmc_dev(host-mmc), Failed to get debounce clk\n);
+   host-dbclk = NULL;
+   } else if (clk_enable(host-dbclk) != 0) {
+   dev_warn(mmc_dev(host-mmc), Failed to enable debounce clk\n);
+   clk_put(host-dbclk);
+   host-dbclk = NULL;
}
 
/* Since we do only SG emulation, we can have as many segs
@@ -2036,7 +2031,7 @@ err_irq:
pm_runtime_put_sync(host-dev);
pm_runtime_disable(host-dev);
clk_put(host-fclk);
-   if (host-got_dbclk) {
+   if (host-dbclk) {
clk_disable(host-dbclk);
clk_put(host-dbclk);
}
@@ -2069,7 +2064,7 @@ static int __devexit omap_hsmmc_remove(struct 
platform_device *pdev)
pm_runtime_put_sync(host-dev);
pm_runtime_disable(host-dev);
clk_put(host-fclk);
-   if (host-got_dbclk) {
+   if (host-dbclk) {
clk_disable(host-dbclk);
clk_put(host-dbclk);
}
@@ -2127,7 +2122,7 @@ static int omap_hsmmc_suspend(struct device *dev)
OMAP_HSMMC_READ(host-base, HCTL)  ~SDBP);
}
 
-   if (host-got_dbclk)
+   if (host-dbclk)
clk_disable(host-dbclk);
 err:
pm_runtime_put_sync(host-dev);
@@ -2148,7 +2143,7 @@ static int omap_hsmmc_resume(struct device *dev)
 
pm_runtime_get_sync(host-dev);
 
-   if (host-got_dbclk)
+   if (host-dbclk)
clk_enable(host-dbclk);
 
if (!(host-mmc-pm_flags  MMC_PM_KEEP_POWER))
-- 
1.7.10.rc2

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


[PATCH 0/8][git pull] mmc: omap: Assorted fixes for 3.4 merge window

2012-03-16 Thread Venkatraman S
Chris,
   Here are a group of fixes posted by Felipe and Balaji for the
OMAP hsmmc driver in the past few days. 
   I've rebased them to the lastest mmc-next and posted them
here again. These have also been tested on OMAP4 development platform.

Please feel to apply directly or pull if that's convenient.

Changes since yesterday (v1):-
Fixed formatting issues as suggested by Felipe
Marked some patches for stable.

The following changes since commit 5f0390f10c0e9c9c504cdbf4af802252628a2490:

  mmc: omap_hsmmc: Avoid a regulator voltage change with dt (2012-03-14 
11:33:20 -0400)

are available in the git repository at:

  git://github.com/svenkatr/linux.git omap-mmc-pending-for-3.4

for you to fetch changes up to 8d54766b608915035b47616ea564e4e9b4dda29c:

  mmc: omap4: hsmmc: fix module re-insertion (2012-03-16 11:38:41 +0530)


Balaji T K (5):
  mmc: omap: Enable Auto CMD12
  mmc: omap: add DDR support to omap_hsmmc
  mmc: omap: use runtime put sync in probe error patch
  mmc: omap: context save after enabling runtime pm
  mmc: omap4: hsmmc: fix module re-insertion

Felipe Balbi (3):
  mmc: host: omap_hsmmc: trivial cleanups
  mmc: host: omap_hsmmc: make it behave well as a module
  mmc: host: omap_hsmmc: convert to module_platform_driver

 drivers/mmc/host/omap_hsmmc.c |  202 
++
 1 file changed, 97 insertions(+), 105 deletions(-)

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


[PATCH v2 1/8] mmc: omap: Enable Auto CMD12

2012-03-16 Thread Venkatraman S
From: Balaji T K balaj...@ti.com

Enable Auto-CMD12 for multi block read/write on HSMMC
Tested on OMAP4430, OMAP3430 and OMAP2430 SDP

Signed-off-by: Balaji T K balaj...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index f29e1a2..a9ffd70 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -85,6 +85,7 @@
 #define BRR_ENABLE (1  5)
 #define DTO_ENABLE (1  20)
 #define INIT_STREAM(1  1)
+#define ACEN_ACMD12(1  2)
 #define DP_SELECT  (1  21)
 #define DDIR   (1  4)
 #define DMA_EN 0x1
@@ -115,6 +116,7 @@
 #define OMAP_MMC_MAX_CLOCK 5200
 #define DRIVER_NAMEomap_hsmmc
 
+#define AUTO_CMD12 (1  0)/* Auto CMD12 support */
 /*
  * One controller can have multiple slots, like on some omap boards using
  * omap.c controller driver. Luckily this is not currently done on any known
@@ -175,6 +177,7 @@ struct omap_hsmmc_host {
int reqs_blocked;
int use_reg;
int req_in_progress;
+   unsigned intflags;
struct omap_hsmmc_next  next_data;
 
struct  omap_mmc_platform_data  *pdata;
@@ -766,6 +769,8 @@ omap_hsmmc_start_command(struct omap_hsmmc_host *host, 
struct mmc_command *cmd,
cmdtype = 0x3;
 
cmdreg = (cmd-opcode  24) | (resptype  16) | (cmdtype  22);
+   if ((host-flags  AUTO_CMD12)  mmc_op_multi(cmd-opcode))
+   cmdreg |= ACEN_ACMD12;
 
if (data) {
cmdreg |= DP_SELECT | MSBS | BCE;
@@ -837,11 +842,15 @@ omap_hsmmc_xfer_done(struct omap_hsmmc_host *host, struct 
mmc_data *data)
else
data-bytes_xfered = 0;
 
-   if (!data-stop) {
+   if (data-stop  ((!(host-flags  AUTO_CMD12)) || data-error)) {
+   omap_hsmmc_start_command(host, data-stop, NULL);
+   }
+   else {
+   if (data-stop)
+   data-stop-resp[0] = OMAP_HSMMC_READ(host-base,
+   RSP76);
omap_hsmmc_request_done(host, data-mrq);
-   return;
}
-   omap_hsmmc_start_command(host, data-stop, NULL);
 }
 
 /*
@@ -1826,6 +1835,7 @@ static int __init omap_hsmmc_probe(struct platform_device 
*pdev)
host-mapbase   = res-start;
host-base  = ioremap(host-mapbase, SZ_4K);
host-power_mode = MMC_POWER_OFF;
+   host-flags = AUTO_CMD12;
host-next_data.cookie = 1;
 
platform_set_drvdata(pdev, host);
-- 
1.7.10.rc0.41.gfa678

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


[PATCH v2 2/8] mmc: omap: add DDR support to omap_hsmmc

2012-03-16 Thread Venkatraman S
From: Balaji T K balaj...@ti.com

Add Dual data rate support for omap_hsmmc

Signed-off-by: Balaji T K balaj...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index a9ffd70..d682c5e 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -92,6 +92,7 @@
 #define MSBS   (1  5)
 #define BCE(1  1)
 #define FOUR_BIT   (1  1)
+#define DDR(1  19)
 #define DW8(1  5)
 #define CC 0x1
 #define TC 0x02
@@ -523,6 +524,10 @@ static void omap_hsmmc_set_bus_width(struct 
omap_hsmmc_host *host)
u32 con;
 
con = OMAP_HSMMC_READ(host-base, CON);
+   if (ios-timing == MMC_TIMING_UHS_DDR50)
+   con |= DDR; /* configure in DDR mode */
+   else
+   con = ~DDR;
switch (ios-bus_width) {
case MMC_BUS_WIDTH_8:
OMAP_HSMMC_WRITE(host-base, CON, con | DW8);
-- 
1.7.10.rc0.41.gfa678

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


[PATCH v2 3/8] mmc: omap: use runtime put sync in probe error patch

2012-03-16 Thread Venkatraman S
From: Balaji T K balaj...@ti.com

pm_runtime_put_sync instead of autosuspend pm runtime API
because iounmap(host-base) follows immediately.

Reported-by: Rajendra Nayak rna...@ti.com
Signed-off-by: Balaji T K balaj...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
Cc: stable sta...@vger.kernel.org
---
 drivers/mmc/host/omap_hsmmc.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index d682c5e..baa06f9 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2013,8 +2013,7 @@ err_reg:
 err_irq_cd_init:
free_irq(host-irq, host);
 err_irq:
-   pm_runtime_mark_last_busy(host-dev);
-   pm_runtime_put_autosuspend(host-dev);
+   pm_runtime_put_sync(host-dev);
pm_runtime_disable(host-dev);
clk_put(host-fclk);
if (host-got_dbclk) {
-- 
1.7.10.rc0.41.gfa678

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


[PATCH v2 4/8] mmc: omap: context save after enabling runtime pm

2012-03-16 Thread Venkatraman S
From: Balaji T K balaj...@ti.com

call context save api after enabling runtime pm
to make sure register access in context save api happens with clk enabled.

Signed-off-by: Balaji T K balaj...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
Cc: stable sta...@vger.kernel.org
---
 drivers/mmc/host/omap_hsmmc.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index baa06f9..2822442 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1870,8 +1870,6 @@ static int __init omap_hsmmc_probe(struct platform_device 
*pdev)
goto err1;
}
 
-   omap_hsmmc_context_save(host);
-
if (host-pdata-controller_flags  OMAP_HSMMC_BROKEN_MULTIBLOCK_READ) {
dev_info(pdev-dev, multiblock reads disabled due to 35xx 
erratum 2.1.1.128; MMC read performance may suffer\n);
mmc-caps2 |= MMC_CAP2_NO_MULTI_READ;
@@ -1882,6 +1880,8 @@ static int __init omap_hsmmc_probe(struct platform_device 
*pdev)
pm_runtime_set_autosuspend_delay(host-dev, MMC_AUTOSUSPEND_DELAY);
pm_runtime_use_autosuspend(host-dev);
 
+   omap_hsmmc_context_save(host);
+
if (cpu_is_omap2430()) {
host-dbclk = clk_get(pdev-dev, mmchsdb_fck);
/*
-- 
1.7.10.rc0.41.gfa678

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


[PATCH v2 5/8] mmc: host: omap_hsmmc: trivial cleanups

2012-03-16 Thread Venkatraman S
From: Felipe Balbi ba...@ti.com

a bunch of non-functional cleanups to the omap_hsmmc
driver.

It basically decreases indentation level, drop unneded
dereferences and drop unneded accesses to the platform_device
structure.

Signed-off-by: Felipe Balbi ba...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |  147 -
 1 file changed, 70 insertions(+), 77 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 2822442..c16c552 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2036,30 +2036,28 @@ static int omap_hsmmc_remove(struct platform_device 
*pdev)
struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
struct resource *res;
 
-   if (host) {
-   pm_runtime_get_sync(host-dev);
-   mmc_remove_host(host-mmc);
-   if (host-use_reg)
-   omap_hsmmc_reg_put(host);
-   if (host-pdata-cleanup)
-   host-pdata-cleanup(pdev-dev);
-   free_irq(host-irq, host);
-   if (mmc_slot(host).card_detect_irq)
-   free_irq(mmc_slot(host).card_detect_irq, host);
-
-   pm_runtime_put_sync(host-dev);
-   pm_runtime_disable(host-dev);
-   clk_put(host-fclk);
-   if (host-got_dbclk) {
-   clk_disable(host-dbclk);
-   clk_put(host-dbclk);
-   }
+   pm_runtime_get_sync(host-dev);
+   mmc_remove_host(host-mmc);
+   if (host-use_reg)
+   omap_hsmmc_reg_put(host);
+   if (host-pdata-cleanup)
+   host-pdata-cleanup(pdev-dev);
+   free_irq(host-irq, host);
+   if (mmc_slot(host).card_detect_irq)
+   free_irq(mmc_slot(host).card_detect_irq, host);
 
-   mmc_free_host(host-mmc);
-   iounmap(host-base);
-   omap_hsmmc_gpio_free(pdev-dev.platform_data);
+   pm_runtime_put_sync(host-dev);
+   pm_runtime_disable(host-dev);
+   clk_put(host-fclk);
+   if (host-got_dbclk) {
+   clk_disable(host-dbclk);
+   clk_put(host-dbclk);
}
 
+   mmc_free_host(host-mmc);
+   iounmap(host-base);
+   omap_hsmmc_gpio_free(pdev-dev.platform_data);
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res)
release_mem_region(res-start, resource_size(res));
@@ -2072,49 +2070,45 @@ static int omap_hsmmc_remove(struct platform_device 
*pdev)
 static int omap_hsmmc_suspend(struct device *dev)
 {
int ret = 0;
-   struct platform_device *pdev = to_platform_device(dev);
-   struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
+   struct omap_hsmmc_host *host = dev_get_drvdata(dev);
 
-   if (host  host-suspended)
+   if (!host)
return 0;
 
-   if (host) {
-   pm_runtime_get_sync(host-dev);
-   host-suspended = 1;
-   if (host-pdata-suspend) {
-   ret = host-pdata-suspend(pdev-dev,
-   host-slot_id);
-   if (ret) {
-   dev_dbg(mmc_dev(host-mmc),
-   Unable to handle MMC board
-level suspend\n);
-   host-suspended = 0;
-   return ret;
-   }
-   }
-   ret = mmc_suspend_host(host-mmc);
+   if (host  host-suspended)
+   return 0;
 
+   pm_runtime_get_sync(host-dev);
+   host-suspended = 1;
+   if (host-pdata-suspend) {
+   ret = host-pdata-suspend(dev, host-slot_id);
if (ret) {
+   dev_dbg(dev, Unable to handle MMC board
+level suspend\n);
host-suspended = 0;
-   if (host-pdata-resume) {
-   ret = host-pdata-resume(pdev-dev,
- host-slot_id);
-   if (ret)
-   dev_dbg(mmc_dev(host-mmc),
-   Unmask interrupt failed\n);
-   }
-   goto err;
+   return ret;
}
+   }
+   ret = mmc_suspend_host(host-mmc);
 
-   if (!(host-mmc-pm_flags  MMC_PM_KEEP_POWER)) {
-   omap_hsmmc_disable_irq(host);
-   OMAP_HSMMC_WRITE(host-base, HCTL,
-   OMAP_HSMMC_READ(host-base, HCTL)  ~SDBP);
+   if (ret) {
+   host-suspended = 0;
+   if (host-pdata-resume) {
+   ret = host-pdata

[PATCH v2 6/8] mmc: host: omap_hsmmc: make it behave well as a module

2012-03-16 Thread Venkatraman S
From: Felipe Balbi ba...@ti.com

if we put probe() on __init section, that will never
work for multiple module insertions/removals.

In order to make it work properly, move probe to
__devinit section and use platform_driver_register()
instead of platform_driver_probe().

Signed-off-by: Felipe Balbi ba...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index c16c552..bcb8c5d 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1779,7 +1779,7 @@ static inline struct omap_mmc_platform_data
 }
 #endif
 
-static int __init omap_hsmmc_probe(struct platform_device *pdev)
+static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
 {
struct omap_mmc_platform_data *pdata = pdev-dev.platform_data;
struct mmc_host *mmc;
@@ -2031,7 +2031,7 @@ err:
return ret;
 }
 
-static int omap_hsmmc_remove(struct platform_device *pdev)
+static int __devexit omap_hsmmc_remove(struct platform_device *pdev)
 {
struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
struct resource *res;
@@ -2189,7 +2189,8 @@ static struct dev_pm_ops omap_hsmmc_dev_pm_ops = {
 };
 
 static struct platform_driver omap_hsmmc_driver = {
-   .remove = omap_hsmmc_remove,
+   .probe  = omap_hsmmc_probe,
+   .remove = __devexit_p(omap_hsmmc_remove),
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
@@ -2201,7 +2202,7 @@ static struct platform_driver omap_hsmmc_driver = {
 static int __init omap_hsmmc_init(void)
 {
/* Register the MMC driver */
-   return platform_driver_probe(omap_hsmmc_driver, omap_hsmmc_probe);
+   return platform_driver_register(omap_hsmmc_driver);
 }
 
 static void __exit omap_hsmmc_cleanup(void)
-- 
1.7.10.rc0.41.gfa678

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


[PATCH v2 8/8] mmc: omap4: hsmmc: fix module re-insertion

2012-03-16 Thread Venkatraman S
From: Balaji T K balaj...@ti.com

OMAP4 and OMAP3 HSMMC IP registers differ by 0x100 offset.
Addng the offset to platform_device resource structure
increments the start address for every insmod operation.
MMC command fails on re-insertion as module due to incorrect register base.
Fix this by updating the ioremap base address only.

Signed-off-by: Balaji T K balaj...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 6411f9a..6bef2a8 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1812,8 +1812,6 @@ static int __devinit omap_hsmmc_probe(struct 
platform_device *pdev)
if (res == NULL || irq  0)
return -ENXIO;
 
-   res-start += pdata-reg_offset;
-   res-end += pdata-reg_offset;
res = request_mem_region(res-start, resource_size(res), pdev-name);
if (res == NULL)
return -EBUSY;
@@ -1837,7 +1835,7 @@ static int __devinit omap_hsmmc_probe(struct 
platform_device *pdev)
host-dma_ch= -1;
host-irq   = irq;
host-slot_id   = 0;
-   host-mapbase   = res-start;
+   host-mapbase   = res-start + pdata-reg_offset;
host-base  = ioremap(host-mapbase, SZ_4K);
host-power_mode = MMC_POWER_OFF;
host-flags = AUTO_CMD12;
-- 
1.7.10.rc0.41.gfa678

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


[PATCH v2 7/8] mmc: host: omap_hsmmc: convert to module_platform_driver

2012-03-16 Thread Venkatraman S
From: Felipe Balbi ba...@ti.com

this will delete some boilerplate code, no functional
changes.

Signed-off-by: Felipe Balbi ba...@ti.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   16 +---
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index bcb8c5d..6411f9a 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2199,21 +2199,7 @@ static struct platform_driver omap_hsmmc_driver = {
},
 };
 
-static int __init omap_hsmmc_init(void)
-{
-   /* Register the MMC driver */
-   return platform_driver_register(omap_hsmmc_driver);
-}
-
-static void __exit omap_hsmmc_cleanup(void)
-{
-   /* Unregister MMC driver */
-   platform_driver_unregister(omap_hsmmc_driver);
-}
-
-module_init(omap_hsmmc_init);
-module_exit(omap_hsmmc_cleanup);
-
+module_platform_driver(omap_hsmmc_driver);
 MODULE_DESCRIPTION(OMAP High Speed Multimedia Card driver);
 MODULE_LICENSE(GPL);
 MODULE_ALIAS(platform: DRIVER_NAME);
-- 
1.7.10.rc0.41.gfa678

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


[PATCH 0/8][git pull] mmc: omap: Assorted fixes for 3.4 merge window

2012-03-15 Thread Venkatraman S
Chris,
   Here are a group of fixes posted by Felipe and Balaji for the
OMAP hsmmc driver in the past few days. 
   I've rebased them to the lastest mmc-next and posted them
here again. These have also been tested on OMAP4 development platform.

Please feel to apply directly or pull if that's convenient.

The following changes since commit 5f0390f10c0e9c9c504cdbf4af802252628a2490:

  mmc: omap_hsmmc: Avoid a regulator voltage change with dt (2012-03-14 
11:33:20 -0400)

are available in the git repository at:

  git://github.com/svenkatr/linux.git omap-mmc-pending-for-3.4

for you to fetch changes up to a6caaa13374ab72e37f9cb2e4cebfe3d266fbaf3:

  mmc: omap4: hsmmc: fix module re-insertion (2012-03-15 19:45:49 +0530)


Balaji T K (5):
  mmc: omap: Enable Auto CMD12
  mmc: omap: add DDR support to omap_hsmmc
  mmc: omap: use runtime put sync in probe error patch
  mmc: omap: context save after enabling runtime pm
  mmc: omap4: hsmmc: fix module re-insertion

Felipe Balbi (3):
  mmc: host: omap_hsmmc: trivial cleanups
  mmc: host: omap_hsmmc: make it behave well as a module
  mmc: host: omap_hsmmc: convert to module_platform_driver

 drivers/mmc/host/omap_hsmmc.c |  203 
++---
 1 file changed, 98 insertions(+), 105 deletions(-)

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


[PATCH RESEND 1/8] mmc: omap: Enable Auto CMD12

2012-03-15 Thread Venkatraman S
From: Balaji T K balaj...@ti.com

Enable Auto-CMD12 for multi block read/write on HSMMC
Tested on OMAP4430, OMAP3430 and OMAP2430 SDP

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index f29e1a2..b1e9be7 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -85,6 +85,7 @@
 #define BRR_ENABLE (1  5)
 #define DTO_ENABLE (1  20)
 #define INIT_STREAM(1  1)
+#define ACEN_ACMD12(1  2)
 #define DP_SELECT  (1  21)
 #define DDIR   (1  4)
 #define DMA_EN 0x1
@@ -115,6 +116,7 @@
 #define OMAP_MMC_MAX_CLOCK 5200
 #define DRIVER_NAMEomap_hsmmc
 
+#define AUTO_CMD12 (1  0)/* Auto CMD12 support */
 /*
  * One controller can have multiple slots, like on some omap boards using
  * omap.c controller driver. Luckily this is not currently done on any known
@@ -175,6 +177,7 @@ struct omap_hsmmc_host {
int reqs_blocked;
int use_reg;
int req_in_progress;
+   unsigned intflags;
struct omap_hsmmc_next  next_data;
 
struct  omap_mmc_platform_data  *pdata;
@@ -766,6 +769,8 @@ omap_hsmmc_start_command(struct omap_hsmmc_host *host, 
struct mmc_command *cmd,
cmdtype = 0x3;
 
cmdreg = (cmd-opcode  24) | (resptype  16) | (cmdtype  22);
+   if ((host-flags  AUTO_CMD12)  mmc_op_multi(cmd-opcode))
+   cmdreg |= ACEN_ACMD12;
 
if (data) {
cmdreg |= DP_SELECT | MSBS | BCE;
@@ -837,11 +842,16 @@ omap_hsmmc_xfer_done(struct omap_hsmmc_host *host, struct 
mmc_data *data)
else
data-bytes_xfered = 0;
 
-   if (!data-stop) {
+   if (data-stop  ((!(host-flags  AUTO_CMD12)) || data-error))
+   omap_hsmmc_start_command(host, data-stop, NULL);
+   else {
+   if (data-stop)
+   data-stop-resp[0] = OMAP_HSMMC_READ(host-base,
+   RSP76);
omap_hsmmc_request_done(host, data-mrq);
-   return;
}
-   omap_hsmmc_start_command(host, data-stop, NULL);
+
+   return;
 }
 
 /*
@@ -1826,6 +1836,7 @@ static int __init omap_hsmmc_probe(struct platform_device 
*pdev)
host-mapbase   = res-start;
host-base  = ioremap(host-mapbase, SZ_4K);
host-power_mode = MMC_POWER_OFF;
+   host-flags = AUTO_CMD12;
host-next_data.cookie = 1;
 
platform_set_drvdata(pdev, host);
-- 
1.7.10.rc0.41.gfa678

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


[PATCH RESEND 2/8] mmc: omap: add DDR support to omap_hsmmc

2012-03-15 Thread Venkatraman S
From: Balaji T K balaj...@ti.com

Add Dual data rate support for omap_hsmmc

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index b1e9be7..db8af43 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -92,6 +92,7 @@
 #define MSBS   (1  5)
 #define BCE(1  1)
 #define FOUR_BIT   (1  1)
+#define DDR(1  19)
 #define DW8(1  5)
 #define CC 0x1
 #define TC 0x02
@@ -523,6 +524,10 @@ static void omap_hsmmc_set_bus_width(struct 
omap_hsmmc_host *host)
u32 con;
 
con = OMAP_HSMMC_READ(host-base, CON);
+   if (ios-timing == MMC_TIMING_UHS_DDR50)
+   con |= DDR; /* configure in DDR mode */
+   else
+   con = ~DDR;
switch (ios-bus_width) {
case MMC_BUS_WIDTH_8:
OMAP_HSMMC_WRITE(host-base, CON, con | DW8);
-- 
1.7.10.rc0.41.gfa678

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


[PATCH RESEND 3/8] mmc: omap: use runtime put sync in probe error patch

2012-03-15 Thread Venkatraman S
From: Balaji T K balaj...@ti.com

pm_runtime_put_sync instead of autosuspend pm runtime API
because iounmap(host-base) follows immediately.

Reported-by: Rajendra Nayak rna...@ti.com
Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index db8af43..0f8d34b 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2014,8 +2014,7 @@ err_reg:
 err_irq_cd_init:
free_irq(host-irq, host);
 err_irq:
-   pm_runtime_mark_last_busy(host-dev);
-   pm_runtime_put_autosuspend(host-dev);
+   pm_runtime_put_sync(host-dev);
pm_runtime_disable(host-dev);
clk_put(host-fclk);
if (host-got_dbclk) {
-- 
1.7.10.rc0.41.gfa678

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


[PATCH RESEND 4/8] mmc: omap: context save after enabling runtime pm

2012-03-15 Thread Venkatraman S
From: Balaji T K balaj...@ti.com

call context save api after enabling runtime pm
to make sure register access in context save api happens with clk enabled.

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 0f8d34b..9fa2f39 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1871,8 +1871,6 @@ static int __init omap_hsmmc_probe(struct platform_device 
*pdev)
goto err1;
}
 
-   omap_hsmmc_context_save(host);
-
if (host-pdata-controller_flags  OMAP_HSMMC_BROKEN_MULTIBLOCK_READ) {
dev_info(pdev-dev, multiblock reads disabled due to 35xx 
erratum 2.1.1.128; MMC read performance may suffer\n);
mmc-caps2 |= MMC_CAP2_NO_MULTI_READ;
@@ -1883,6 +1881,8 @@ static int __init omap_hsmmc_probe(struct platform_device 
*pdev)
pm_runtime_set_autosuspend_delay(host-dev, MMC_AUTOSUSPEND_DELAY);
pm_runtime_use_autosuspend(host-dev);
 
+   omap_hsmmc_context_save(host);
+
if (cpu_is_omap2430()) {
host-dbclk = clk_get(pdev-dev, mmchsdb_fck);
/*
-- 
1.7.10.rc0.41.gfa678

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


[PATCH RESEND 5/8] mmc: host: omap_hsmmc: trivial cleanups

2012-03-15 Thread Venkatraman S
From: Felipe Balbi ba...@ti.com

a bunch of non-functional cleanups to the omap_hsmmc
driver.

It basically decreases indentation level, drop unneded
dereferences and drop unneded accesses to the platform_device
structure.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |  147 -
 1 file changed, 70 insertions(+), 77 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 9fa2f39..6b30782 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2037,30 +2037,28 @@ static int omap_hsmmc_remove(struct platform_device 
*pdev)
struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
struct resource *res;
 
-   if (host) {
-   pm_runtime_get_sync(host-dev);
-   mmc_remove_host(host-mmc);
-   if (host-use_reg)
-   omap_hsmmc_reg_put(host);
-   if (host-pdata-cleanup)
-   host-pdata-cleanup(pdev-dev);
-   free_irq(host-irq, host);
-   if (mmc_slot(host).card_detect_irq)
-   free_irq(mmc_slot(host).card_detect_irq, host);
-
-   pm_runtime_put_sync(host-dev);
-   pm_runtime_disable(host-dev);
-   clk_put(host-fclk);
-   if (host-got_dbclk) {
-   clk_disable(host-dbclk);
-   clk_put(host-dbclk);
-   }
+   pm_runtime_get_sync(host-dev);
+   mmc_remove_host(host-mmc);
+   if (host-use_reg)
+   omap_hsmmc_reg_put(host);
+   if (host-pdata-cleanup)
+   host-pdata-cleanup(pdev-dev);
+   free_irq(host-irq, host);
+   if (mmc_slot(host).card_detect_irq)
+   free_irq(mmc_slot(host).card_detect_irq, host);
 
-   mmc_free_host(host-mmc);
-   iounmap(host-base);
-   omap_hsmmc_gpio_free(pdev-dev.platform_data);
+   pm_runtime_put_sync(host-dev);
+   pm_runtime_disable(host-dev);
+   clk_put(host-fclk);
+   if (host-got_dbclk) {
+   clk_disable(host-dbclk);
+   clk_put(host-dbclk);
}
 
+   mmc_free_host(host-mmc);
+   iounmap(host-base);
+   omap_hsmmc_gpio_free(pdev-dev.platform_data);
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res)
release_mem_region(res-start, resource_size(res));
@@ -2073,49 +2071,45 @@ static int omap_hsmmc_remove(struct platform_device 
*pdev)
 static int omap_hsmmc_suspend(struct device *dev)
 {
int ret = 0;
-   struct platform_device *pdev = to_platform_device(dev);
-   struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
+   struct omap_hsmmc_host *host = dev_get_drvdata(dev);
 
-   if (host  host-suspended)
+   if (!host)
return 0;
 
-   if (host) {
-   pm_runtime_get_sync(host-dev);
-   host-suspended = 1;
-   if (host-pdata-suspend) {
-   ret = host-pdata-suspend(pdev-dev,
-   host-slot_id);
-   if (ret) {
-   dev_dbg(mmc_dev(host-mmc),
-   Unable to handle MMC board
-level suspend\n);
-   host-suspended = 0;
-   return ret;
-   }
-   }
-   ret = mmc_suspend_host(host-mmc);
+   if (host  host-suspended)
+   return 0;
 
+   pm_runtime_get_sync(host-dev);
+   host-suspended = 1;
+   if (host-pdata-suspend) {
+   ret = host-pdata-suspend(dev, host-slot_id);
if (ret) {
+   dev_dbg(dev, Unable to handle MMC board
+level suspend\n);
host-suspended = 0;
-   if (host-pdata-resume) {
-   ret = host-pdata-resume(pdev-dev,
- host-slot_id);
-   if (ret)
-   dev_dbg(mmc_dev(host-mmc),
-   Unmask interrupt failed\n);
-   }
-   goto err;
+   return ret;
}
+   }
+   ret = mmc_suspend_host(host-mmc);
 
-   if (!(host-mmc-pm_flags  MMC_PM_KEEP_POWER)) {
-   omap_hsmmc_disable_irq(host);
-   OMAP_HSMMC_WRITE(host-base, HCTL,
-   OMAP_HSMMC_READ(host-base, HCTL)  ~SDBP);
+   if (ret) {
+   host-suspended = 0;
+   if (host-pdata-resume) {
+   ret = host-pdata-resume(dev, host-slot_id);
+ 

[PATCH RESEND 6/8] mmc: host: omap_hsmmc: make it behave well as a module

2012-03-15 Thread Venkatraman S
From: Felipe Balbi ba...@ti.com

if we put probe() on __init section, that will never
work for multiple module insertions/removals.

In order to make it work properly, move probe to
__devinit section and use platform_driver_register()
instead of platform_driver_probe().

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 6b30782..67cb63e 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1780,7 +1780,7 @@ static inline struct omap_mmc_platform_data
 }
 #endif
 
-static int __init omap_hsmmc_probe(struct platform_device *pdev)
+static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
 {
struct omap_mmc_platform_data *pdata = pdev-dev.platform_data;
struct mmc_host *mmc;
@@ -2032,7 +2032,7 @@ err:
return ret;
 }
 
-static int omap_hsmmc_remove(struct platform_device *pdev)
+static int __devexit omap_hsmmc_remove(struct platform_device *pdev)
 {
struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
struct resource *res;
@@ -2190,7 +2190,8 @@ static struct dev_pm_ops omap_hsmmc_dev_pm_ops = {
 };
 
 static struct platform_driver omap_hsmmc_driver = {
-   .remove = omap_hsmmc_remove,
+   .probe  = omap_hsmmc_probe,
+   .remove = __devexit_p(omap_hsmmc_remove),
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
@@ -2202,7 +2203,7 @@ static struct platform_driver omap_hsmmc_driver = {
 static int __init omap_hsmmc_init(void)
 {
/* Register the MMC driver */
-   return platform_driver_probe(omap_hsmmc_driver, omap_hsmmc_probe);
+   return platform_driver_register(omap_hsmmc_driver);
 }
 
 static void __exit omap_hsmmc_cleanup(void)
-- 
1.7.10.rc0.41.gfa678

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


[PATCH RESEND 7/8] mmc: host: omap_hsmmc: convert to module_platform_driver

2012-03-15 Thread Venkatraman S
From: Felipe Balbi ba...@ti.com

this will delete some boilerplate code, no functional
changes.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   16 +---
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 67cb63e..4476b26 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2200,21 +2200,7 @@ static struct platform_driver omap_hsmmc_driver = {
},
 };
 
-static int __init omap_hsmmc_init(void)
-{
-   /* Register the MMC driver */
-   return platform_driver_register(omap_hsmmc_driver);
-}
-
-static void __exit omap_hsmmc_cleanup(void)
-{
-   /* Unregister MMC driver */
-   platform_driver_unregister(omap_hsmmc_driver);
-}
-
-module_init(omap_hsmmc_init);
-module_exit(omap_hsmmc_cleanup);
-
+module_platform_driver(omap_hsmmc_driver);
 MODULE_DESCRIPTION(OMAP High Speed Multimedia Card driver);
 MODULE_LICENSE(GPL);
 MODULE_ALIAS(platform: DRIVER_NAME);
-- 
1.7.10.rc0.41.gfa678

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


[PATCH RESEND 8/8] mmc: omap4: hsmmc: fix module re-insertion

2012-03-15 Thread Venkatraman S
From: Balaji T K balaj...@ti.com

OMAP4 and OMAP3 HSMMC IP registers differ by 0x100 offset.
Addng the offset to platform_device resource structure
increments the start address for every insmod operation.
MMC command fails on re-insertion as module due to incorrect register base.
Fix this by updating the ioremap base address only.

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 4476b26..f324cf4 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1813,8 +1813,6 @@ static int __devinit omap_hsmmc_probe(struct 
platform_device *pdev)
if (res == NULL || irq  0)
return -ENXIO;
 
-   res-start += pdata-reg_offset;
-   res-end += pdata-reg_offset;
res = request_mem_region(res-start, resource_size(res), pdev-name);
if (res == NULL)
return -EBUSY;
@@ -1838,7 +1836,7 @@ static int __devinit omap_hsmmc_probe(struct 
platform_device *pdev)
host-dma_ch= -1;
host-irq   = irq;
host-slot_id   = 0;
-   host-mapbase   = res-start;
+   host-mapbase   = res-start + pdata-reg_offset;
host-base  = ioremap(host-mapbase, SZ_4K);
host-power_mode = MMC_POWER_OFF;
host-flags = AUTO_CMD12;
-- 
1.7.10.rc0.41.gfa678

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


[PATCH] mmc: omap: remove clock rate hard coding

2011-12-20 Thread Venkatraman S
From: Balaji TK balaj...@ti.com

MMC master clock rate can vary for each instance of the MMC controller
on the device. Use clk_get_rate instead to get the value.

  Signed-off-by: Balaji TK  balaj...@ti.com
  Reviewed-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index d5fe43d..5b35c7e 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -120,7 +120,6 @@
 
 #define MMC_AUTOSUSPEND_DELAY  100
 #define MMC_TIMEOUT_MS 20
-#define OMAP_MMC_MASTER_CLOCK  9600
 #define OMAP_MMC_MIN_CLOCK 40
 #define OMAP_MMC_MAX_CLOCK 5200
 #define DRIVER_NAMEomap_hsmmc
@@ -598,12 +597,12 @@ static void omap_hsmmc_disable_irq(struct omap_hsmmc_host 
*host)
 }
 
 /* Calculate divisor for the given clock frequency */
-static u16 calc_divisor(struct mmc_ios *ios)
+static u16 calc_divisor(struct omap_hsmmc_host *host, struct mmc_ios *ios)
 {
u16 dsor = 0;
 
if (ios-clock) {
-   dsor = DIV_ROUND_UP(OMAP_MMC_MASTER_CLOCK, ios-clock);
+   dsor = DIV_ROUND_UP(clk_get_rate(host-fclk), ios-clock);
if (dsor  250)
dsor = 250;
}
@@ -623,7 +622,7 @@ static void omap_hsmmc_set_clock(struct omap_hsmmc_host 
*host)
 
regval = OMAP_HSMMC_READ(host-base, SYSCTL);
regval = regval  ~(CLKD_MASK | DTO_MASK);
-   regval = regval | (calc_divisor(ios)  6) | (DTO  16);
+   regval = regval | (calc_divisor(host, ios)  6) | (DTO  16);
OMAP_HSMMC_WRITE(host-base, SYSCTL, regval);
OMAP_HSMMC_WRITE(host-base, SYSCTL,
OMAP_HSMMC_READ(host-base, SYSCTL) | ICE);
-- 
1.7.1

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


[PATCH 1/2] omap: hsmmc: Normalize dma cleanup operations

2011-09-01 Thread Venkatraman S
Reuse omap_hsmmc_dma_cleanup even for normal dma teardown in
omap_hsmmc_dma_cb. Consolidate multiple points of dma unmap into a 
single location in post_req function, to prevent double unmapping.

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

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 21e4a79..5b7776c 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -999,7 +999,8 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host 
*host, int errno)
 {
int dma_ch;
 
-   host-data-error = errno;
+   if (host-data)
+   host-data-error = errno;
 
spin_lock(host-irq_lock);
dma_ch = host-dma_ch;
@@ -1007,12 +1008,8 @@ static void omap_hsmmc_dma_cleanup(struct 
omap_hsmmc_host *host, int errno)
spin_unlock(host-irq_lock);
 
if (host-use_dma  dma_ch != -1) {
-   dma_unmap_sg(mmc_dev(host-mmc), host-data-sg,
-   host-data-sg_len,
-   omap_hsmmc_get_dma_dir(host, host-data));
omap_free_dma(dma_ch);
}
-   host-data = NULL;
 }
 
 /*
@@ -1370,7 +1367,7 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, 
void *cb_data)
 {
struct omap_hsmmc_host *host = cb_data;
struct mmc_data *data;
-   int dma_ch, req_in_progress;
+   int req_in_progress;
 
if (!(ch_status  OMAP_DMA_BLOCK_IRQ)) {
dev_warn(mmc_dev(host-mmc), unexpected dma status %x\n,
@@ -1394,16 +1391,9 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, 
void *cb_data)
return;
}
 
-   if (!data-host_cookie)
-   dma_unmap_sg(mmc_dev(host-mmc), data-sg, data-sg_len,
-omap_hsmmc_get_dma_dir(host, data));
-
req_in_progress = host-req_in_progress;
-   dma_ch = host-dma_ch;
-   host-dma_ch = -1;
spin_unlock(host-irq_lock);
-
-   omap_free_dma(dma_ch);
+   omap_hsmmc_dma_cleanup(host, 0);
 
/* If DMA has finished after TC, complete the request */
if (!req_in_progress) {
@@ -1575,7 +1565,7 @@ static void omap_hsmmc_post_req(struct mmc_host *mmc, 
struct mmc_request *mrq,
struct omap_hsmmc_host *host = mmc_priv(mmc);
struct mmc_data *data = mrq-data;
 
-   if (host-use_dma) {
+   if (data-host_cookie) {
dma_unmap_sg(mmc_dev(host-mmc), data-sg, data-sg_len,
 omap_hsmmc_get_dma_dir(host, data));
data-host_cookie = 0;
-- 
1.7.1

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


[PATCH 0/2] omap: hsmmc: Cleanup omap hsmmc dma routines

2011-09-01 Thread Venkatraman S
The first patch substitutes the dma_cleanup function in place of 
the body of the code which does the same thing. The dma unmap
operation is now restricted just to the post_req function.

The second patch minimizes holding spin lock during dma
configuration, where it is not necessary.

Venkatraman S (2):
  omap: hsmmc: normalize dma cleanup operations
  omap: hsmmc: don't hold spinlock during dma configuration

 drivers/mmc/host/omap_hsmmc.c |   22 ++
 1 files changed, 6 insertions(+), 16 deletions(-)

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


[PATCH 2/2] omap: hsmmc: Don't hold spinlock during dma configuration

2011-09-01 Thread Venkatraman S
No need to hold the spinlock during a rather long dma configuration
sequence inside dma callback, which doesn't need it.

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

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 5b7776c..c5fd413 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1384,10 +1384,10 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, 
void *cb_data)
data = host-mrq-data;
host-dma_sg_idx++;
if (host-dma_sg_idx  host-dma_len) {
+   spin_unlock(host-irq_lock);
/* Fire up the next transfer. */
omap_hsmmc_config_dma_params(host, data,
   data-sg + host-dma_sg_idx);
-   spin_unlock(host-irq_lock);
return;
}
 
-- 
1.7.1

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


[PATCH 0/2] OMAP: Update nr_irqs field in machine descriptors

2011-08-24 Thread Venkatraman S
As part of an effort to get single ARM kernel binary [1],
multiple  definitions of NR_IRQS under various platforms
have to be reconciled and abstracted away from common code.

This patch series takes the small step of populating the 
machine descriptors with the pre-existing nr_irqs field.
Eventually, the common irq handler code will only look at this
field and not the compile time constant.

[1]: 
https://blueprints.launchpad.net/ubuntu/+spec/kernel-maverick-arm-single-zimage

Venkatraman S (2):
  omap2+: Populate nr_irqs field in machine descriptors
  omap1: Populate nr_irqs field in machine descriptors

 arch/arm/mach-omap1/board-ams-delta.c  |1 +
 arch/arm/mach-omap1/board-fsample.c|1 +
 arch/arm/mach-omap1/board-generic.c|1 +
 arch/arm/mach-omap1/board-h2.c |1 +
 arch/arm/mach-omap1/board-h3.c |1 +
 arch/arm/mach-omap1/board-htcherald.c  |1 +
 arch/arm/mach-omap1/board-innovator.c  |1 +
 arch/arm/mach-omap1/board-nokia770.c   |1 +
 arch/arm/mach-omap1/board-osk.c|1 +
 arch/arm/mach-omap1/board-palmte.c |1 +
 arch/arm/mach-omap1/board-palmtt.c |1 +
 arch/arm/mach-omap1/board-palmz71.c|1 +
 arch/arm/mach-omap1/board-perseus2.c   |1 +
 arch/arm/mach-omap1/board-sx1.c|1 +
 arch/arm/mach-omap1/board-voiceblue.c  |1 +
 arch/arm/mach-omap2/board-2430sdp.c|1 +
 arch/arm/mach-omap2/board-3430sdp.c|1 +
 arch/arm/mach-omap2/board-3630sdp.c|1 +
 arch/arm/mach-omap2/board-4430sdp.c|1 +
 arch/arm/mach-omap2/board-am3517crane.c|1 +
 arch/arm/mach-omap2/board-am3517evm.c  |1 +
 arch/arm/mach-omap2/board-apollon.c|1 +
 arch/arm/mach-omap2/board-cm-t35.c |2 ++
 arch/arm/mach-omap2/board-cm-t3517.c   |1 +
 arch/arm/mach-omap2/board-devkit8000.c |1 +
 arch/arm/mach-omap2/board-generic.c|1 +
 arch/arm/mach-omap2/board-h4.c |1 +
 arch/arm/mach-omap2/board-igep0020.c   |2 ++
 arch/arm/mach-omap2/board-ldp.c|1 +
 arch/arm/mach-omap2/board-n8x0.c   |3 +++
 arch/arm/mach-omap2/board-omap3beagle.c|1 +
 arch/arm/mach-omap2/board-omap3evm.c   |1 +
 arch/arm/mach-omap2/board-omap3logic.c |2 ++
 arch/arm/mach-omap2/board-omap3pandora.c   |1 +
 arch/arm/mach-omap2/board-omap3stalker.c   |1 +
 arch/arm/mach-omap2/board-omap3touchbook.c |1 +
 arch/arm/mach-omap2/board-omap4panda.c |1 +
 arch/arm/mach-omap2/board-overo.c  |1 +
 arch/arm/mach-omap2/board-rm680.c  |1 +
 arch/arm/mach-omap2/board-rx51.c   |1 +
 arch/arm/mach-omap2/board-ti8168evm.c  |1 +
 arch/arm/mach-omap2/board-zoom.c   |2 ++
 42 files changed, 48 insertions(+), 0 deletions(-)

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


[PATCH 1/2] omap2+: Populate nr_irqs field in machine descriptors

2011-08-24 Thread Venkatraman S
Machine descriptors in board files should have valid
nr_irqs value so that irq handler code can probe it.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 arch/arm/mach-omap2/board-2430sdp.c|1 +
 arch/arm/mach-omap2/board-3430sdp.c|1 +
 arch/arm/mach-omap2/board-3630sdp.c|1 +
 arch/arm/mach-omap2/board-4430sdp.c|1 +
 arch/arm/mach-omap2/board-am3517crane.c|1 +
 arch/arm/mach-omap2/board-am3517evm.c  |1 +
 arch/arm/mach-omap2/board-apollon.c|1 +
 arch/arm/mach-omap2/board-cm-t35.c |2 ++
 arch/arm/mach-omap2/board-cm-t3517.c   |1 +
 arch/arm/mach-omap2/board-devkit8000.c |1 +
 arch/arm/mach-omap2/board-generic.c|1 +
 arch/arm/mach-omap2/board-h4.c |1 +
 arch/arm/mach-omap2/board-igep0020.c   |2 ++
 arch/arm/mach-omap2/board-ldp.c|1 +
 arch/arm/mach-omap2/board-n8x0.c   |3 +++
 arch/arm/mach-omap2/board-omap3beagle.c|1 +
 arch/arm/mach-omap2/board-omap3evm.c   |1 +
 arch/arm/mach-omap2/board-omap3logic.c |2 ++
 arch/arm/mach-omap2/board-omap3pandora.c   |1 +
 arch/arm/mach-omap2/board-omap3stalker.c   |1 +
 arch/arm/mach-omap2/board-omap3touchbook.c |1 +
 arch/arm/mach-omap2/board-omap4panda.c |1 +
 arch/arm/mach-omap2/board-overo.c  |1 +
 arch/arm/mach-omap2/board-rm680.c  |1 +
 arch/arm/mach-omap2/board-rx51.c   |1 +
 arch/arm/mach-omap2/board-ti8168evm.c  |1 +
 arch/arm/mach-omap2/board-zoom.c   |2 ++
 27 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-2430sdp.c 
b/arch/arm/mach-omap2/board-2430sdp.c
index 2028464..68edea8 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -263,4 +263,5 @@ MACHINE_START(OMAP_2430SDP, OMAP2430 sdp2430 board)
.init_irq   = omap2_init_irq,
.init_machine   = omap_2430sdp_init,
.timer  = omap2_timer,
+   .nr_irqs= NR_IRQS,
 MACHINE_END
diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index bd600cf..e4a323b 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -736,4 +736,5 @@ MACHINE_START(OMAP_3430SDP, OMAP3430 3430SDP board)
.init_irq   = omap3_init_irq,
.init_machine   = omap_3430sdp_init,
.timer  = omap3_timer,
+   .nr_irqs= NR_IRQS,
 MACHINE_END
diff --git a/arch/arm/mach-omap2/board-3630sdp.c 
b/arch/arm/mach-omap2/board-3630sdp.c
index e4f37b5..2183ea8 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -222,4 +222,5 @@ MACHINE_START(OMAP_3630SDP, OMAP 3630SDP board)
.init_irq   = omap3_init_irq,
.init_machine   = omap_sdp_init,
.timer  = omap3_timer,
+   .nr_irqs= NR_IRQS,
 MACHINE_END
diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index c7cef44..88e7848 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -845,4 +845,5 @@ MACHINE_START(OMAP_4430SDP, OMAP4430 4430SDP board)
.init_irq   = gic_init_irq,
.init_machine   = omap_4430sdp_init,
.timer  = omap4_timer,
+   .nr_irqs= NR_IRQS,
 MACHINE_END
diff --git a/arch/arm/mach-omap2/board-am3517crane.c 
b/arch/arm/mach-omap2/board-am3517crane.c
index 933e935..6d494d6 100644
--- a/arch/arm/mach-omap2/board-am3517crane.c
+++ b/arch/arm/mach-omap2/board-am3517crane.c
@@ -105,4 +105,5 @@ MACHINE_START(CRANEBOARD, AM3517/05 CRANEBOARD)
.init_irq   = omap3_init_irq,
.init_machine   = am3517_crane_init,
.timer  = omap3_timer,
+   .nr_irqs= NR_IRQS,
 MACHINE_END
diff --git a/arch/arm/mach-omap2/board-am3517evm.c 
b/arch/arm/mach-omap2/board-am3517evm.c
index f3006c3..f5f169c 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -497,4 +497,5 @@ MACHINE_START(OMAP3517EVM, OMAP3517/AM3517 EVM)
.init_irq   = omap3_init_irq,
.init_machine   = am3517_evm_init,
.timer  = omap3_timer,
+   .nr_irqs= NR_IRQS,
 MACHINE_END
diff --git a/arch/arm/mach-omap2/board-apollon.c 
b/arch/arm/mach-omap2/board-apollon.c
index 7021170..b817a0d 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -357,4 +357,5 @@ MACHINE_START(OMAP_APOLLON, OMAP24xx Apollon)
.init_irq   = omap2_init_irq,
.init_machine   = omap_apollon_init,
.timer  = omap2_timer,
+   .nr_irqs= NR_IRQS,
 MACHINE_END
diff --git a/arch/arm/mach-omap2/board-cm-t35.c 
b/arch/arm/mach-omap2/board-cm-t35.c
index 3af8aab..d22ec1c 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -641,6 +641,7

[PATCH 2/2] omap1: Populate nr_irqs field in machine descriptors

2011-08-24 Thread Venkatraman S
Machine descriptors in board files should have valid
nr_irqs value so that irq handler code can probe it.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 arch/arm/mach-omap1/board-ams-delta.c |1 +
 arch/arm/mach-omap1/board-fsample.c   |1 +
 arch/arm/mach-omap1/board-generic.c   |1 +
 arch/arm/mach-omap1/board-h2.c|1 +
 arch/arm/mach-omap1/board-h3.c|1 +
 arch/arm/mach-omap1/board-htcherald.c |1 +
 arch/arm/mach-omap1/board-innovator.c |1 +
 arch/arm/mach-omap1/board-nokia770.c  |1 +
 arch/arm/mach-omap1/board-osk.c   |1 +
 arch/arm/mach-omap1/board-palmte.c|1 +
 arch/arm/mach-omap1/board-palmtt.c|1 +
 arch/arm/mach-omap1/board-palmz71.c   |1 +
 arch/arm/mach-omap1/board-perseus2.c  |1 +
 arch/arm/mach-omap1/board-sx1.c   |1 +
 arch/arm/mach-omap1/board-voiceblue.c |1 +
 15 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap1/board-ams-delta.c 
b/arch/arm/mach-omap1/board-ams-delta.c
index 312ea6b..496c07f 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -392,6 +392,7 @@ MACHINE_START(AMS_DELTA, Amstrad E3 (Delta))
.init_irq   = ams_delta_init_irq,
.init_machine   = ams_delta_init,
.timer  = omap1_timer,
+   .nr_irqs= NR_IRQS,
 MACHINE_END
 
 EXPORT_SYMBOL(ams_delta_latch1_write);
diff --git a/arch/arm/mach-omap1/board-fsample.c 
b/arch/arm/mach-omap1/board-fsample.c
index a6b1bea..c76373e 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -395,4 +395,5 @@ MACHINE_START(OMAP_FSAMPLE, OMAP730 F-Sample)
.init_irq   = omap_fsample_init_irq,
.init_machine   = omap_fsample_init,
.timer  = omap1_timer,
+   .nr_irqs= NR_IRQS,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-generic.c 
b/arch/arm/mach-omap1/board-generic.c
index 04fc356..f5cec3e 100644
--- a/arch/arm/mach-omap1/board-generic.c
+++ b/arch/arm/mach-omap1/board-generic.c
@@ -100,4 +100,5 @@ MACHINE_START(OMAP_GENERIC, Generic OMAP1510/1610/1710)
.init_irq   = omap_generic_init_irq,
.init_machine   = omap_generic_init,
.timer  = omap1_timer,
+   .nr_irqs= NR_IRQS,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index cb7fb1a..7dca560 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -467,4 +467,5 @@ MACHINE_START(OMAP_H2, TI-H2)
.init_irq   = h2_init_irq,
.init_machine   = h2_init,
.timer  = omap1_timer,
+   .nr_irqs= NR_IRQS,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 31f3487..bd27504 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -455,4 +455,5 @@ MACHINE_START(OMAP_H3, TI OMAP1710 H3 board)
.init_irq   = h3_init_irq,
.init_machine   = h3_init,
.timer  = omap1_timer,
+   .nr_irqs= NR_IRQS,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-htcherald.c 
b/arch/arm/mach-omap1/board-htcherald.c
index 36e06ea..380310c 100644
--- a/arch/arm/mach-omap1/board-htcherald.c
+++ b/arch/arm/mach-omap1/board-htcherald.c
@@ -617,4 +617,5 @@ MACHINE_START(HERALD, HTC Herald)
.init_irq   = htcherald_init_irq,
.init_machine   = htcherald_init,
.timer  = omap1_timer,
+   .nr_irqs= NR_IRQS,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-innovator.c 
b/arch/arm/mach-omap1/board-innovator.c
index 0b1ba46..64b9764 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -465,4 +465,5 @@ MACHINE_START(OMAP_INNOVATOR, TI-Innovator)
.init_irq   = innovator_init_irq,
.init_machine   = innovator_init,
.timer  = omap1_timer,
+   .nr_irqs= NR_IRQS,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-nokia770.c 
b/arch/arm/mach-omap1/board-nokia770.c
index 5469ce2..77e8bad 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -270,4 +270,5 @@ MACHINE_START(NOKIA770, Nokia 770)
.init_irq   = omap_nokia770_init_irq,
.init_machine   = omap_nokia770_init,
.timer  = omap1_timer,
+   .nr_irqs= NR_IRQS,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index b08a213..5c9f6ec 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -589,4 +589,5 @@ MACHINE_START(OMAP_OSK, TI-OSK)
.init_irq   = osk_init_irq,
.init_machine   = osk_init,
.timer  = omap1_timer,
+   .nr_irqs= NR_IRQS,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-palmte.c 
b/arch/arm/mach-omap1/board-palmte.c
index 459cb6b..8266a65 100644
--- a/arch/arm/mach

configuration warnings with omap_3630sdp_defconfig in 2.6.35-rc5

2010-07-20 Thread Venkatraman S
While trying to build omap_3630sdp_defconfig on Linus's 2.6.35-rc5, I
get these warnings..
I understand these could be related to the recent defconfig changes.
I will try to investigate; posted here to know if anyone has found a
fix already..
--
scripts/kconfig/conf -s arch/arm/Kconfig
can't copy type 0
warning: (USB_MUSB_HDRC_HCD  USB_SUPPORT  USB_MUSB_HDRC 
(USB_MUSB_HOST || USB_MUSB_OTG)  USB_GADGET_MUSB_HDRC ||
USB_MUSB_OTG  choice  USB  USB_GADGET  PM  EXPERIMENTAL)
selects USB_OTG which has unmet direct dependencies (USB_GADGET_OMAP
 ARCH_OMAP_OTG  USB_OHCI_HCD)
warning: (USB_MUSB_HDRC_HCD  USB_SUPPORT  USB_MUSB_HDRC 
(USB_MUSB_HOST || USB_MUSB_OTG)  USB_GADGET_MUSB_HDRC ||
USB_MUSB_OTG  choice  USB  USB_GADGET  PM  EXPERIMENTAL)
selects USB_OTG which has unmet direct dependencies (USB_GADGET_OMAP
 ARCH_OMAP_OTG  USB_OHCI_HCD)
--

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


  1   2   >