fix and enhancement patches for sdhci
cover fix and enhancement patches for sdhci
This seris fix several issue like flush cache and build warning. And give this generic driver enhancement for timeout when transferring data and additional structure member to access in platform self driver.
Lei Wen (4):
mmc: sdhci: fix cache flush
mmc: sdhci: fix build warning
mmc: sdhci: add mmc structure for host
mmc: sdhci: add timeout for data transfer
drivers/mmc/sdhci.c | 12 ++++++++++-- include/sdhci.h | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-)
PATCH 1/4 mmc: sdhci: fix cache flush
Only flush the memory range needed.
--- drivers/mmc/sdhci.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mmc/sdhci.c +1 -1
@@ -196,7 +196,7 @@ int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,sdhci_writel (host, cmd->cmdarg,SDHCI_ARGUMENT );#ifdef CONFIG_MMC_SDMA -flush_cache (0 , ~0 ); +flush_cache (start_addr, trans_bytes);#endif sdhci_writew (host,SDHCI_MAKE_CMD (cmd->cmdidx, flags),SDHCI_COMMAND ); do {
Signature · 1 line
1.7.0.4
PATCH 2/4 mmc: sdhci: fix build warning
In reply to Lei WenIf CONFIG_MMC_SDHCI_IO_ACCESSORS is defined, the following warning would shows up:
include/sdhci.h:224: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:224: warning: its scope is only this definition or declaration, which is probably not what you want include/sdhci.h:225: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:226: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:227: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:228: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:229: warning: 'struct sdhci_host' declared inside parameter list
--- include/sdhci.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
include/sdhci.h +1 -0
@@ -219,6 +219,7 @@*/ #define SDHCI_DEFAULT_BOUNDARY_SIZE (512 * 1024)#define SDHCI_DEFAULT_BOUNDARY_ARG (7) +struct sdhci_host ;struct sdhci_ops {#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS u32 (*read_l)(struct sdhci_host *host,int reg);
Signature · 1 line
1.7.0.4
PATCH 2/4 mmc: sdhci: fix build warning
Quoted 2 lines · Lei Wen
If
CONFIG_MMC_SDHCI_IO_ACCESSORSis defined, the following warning would shows up:
[...]
include/sdhci.h line 225
Quoted 13 lines
include/sdhci.h +1
-0@@ -219,6 +219,7 @@*/ #define SDHCI_DEFAULT_BOUNDARY_SIZE (512 * 1024)#define SDHCI_DEFAULT_BOUNDARY_ARG (7) +struct sdhci_host ;struct sdhci_ops {#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS u32 (*read_l)(struct sdhci_host *host,int reg);
Dear Lei Wen,
Please keep the newlines so it's not such an uniform blob of code. Thanks!
Cheers
PATCH 2/4 mmc: sdhci: fix build warning
Marek,
Quoted 22 lines · Marek Vasut
Quoted 2 lines · Lei Wen
If
CONFIG_MMC_SDHCI_IO_ACCESSORSis defined, the following warning would shows up:[...]
Quoted 6 lines
include/sdhci.h +0
-0@@ -219,6 +219,7 @@Quoted 7 lines
? */
?#defineSDHCI_DEFAULT_BOUNDARY_SIZE?(512 * 1024) ?#defineSDHCI_DEFAULT_BOUNDARY_ARG? (7)
+structsdhci_host;
?structsdhci_ops{
?#ifdefCONFIG_MMC_SDHCI_IO_ACCESSORS
? ? ? u32 ? ? ? ? ? ? (*read_l)(structsdhci_host*host, int reg);Dear Lei Wen,
Quoted 2 lines
Please keep the newlines so it's not such an uniform blob of code. Thanks!
Got it,
Thanks,
Lei
PATCH 3/4 mmc: sdhci: add mmc structure for host
In reply to Lei WenSo that sdhci host would tell in the driver that the mmc current attributes.
--- drivers/mmc/sdhci.c | 1 + include/sdhci.h | 2 ++ 2 files changed, 3 insertions(+), 0 deletions(-)
drivers/mmc/sdhci.c +1 -0
@@ -377,6 +377,7 @@ int add_sdhci(struct sdhci_host *host, u32 max_clk, u32 min_clk) } mmc->priv = host; + host->mmc = mmc;sprintf (mmc->name,"%s" , host->name); mmc->send_cmd = sdhci_send_command;
include/sdhci.h +2 -0
@@ -27,6 +27,7 @@#define __SDHCI_HW_H#include <asm/io.h> +#include <mmc.h> /* * Controller registers */
@@ -237,6 +238,7 @@ struct sdhci_host {unsigned int quirks;unsigned int version;unsigned int clock; +struct mmc *mmc;const struct sdhci_ops *ops; };
Signature · 1 line
1.7.0.4
PATCH 4/4 mmc: sdhci: add timeout for data transfer
In reply to Lei Wen--- drivers/mmc/sdhci.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
drivers/mmc/sdhci.c +8 -1
@@ -81,8 +81,9 @@ static void sdhci_transfer_pio(struct sdhci_host *host, struct mmc_data *data)static int sdhci_transfer_data (struct sdhci_host *host,struct mmc_data *data,unsigned int start_addr) { -unsigned int stat, rdy, mask, block =0 ; +unsigned int stat, rdy, mask, timeout, block =0 ; + timeout =10000 ; rdy =SDHCI_INT_SPACE_AVAIL |SDHCI_INT_DATA_AVAIL ; mask =SDHCI_DATA_AVAILABLE |SDHCI_SPACE_AVAILABLE ; do {
@@ -108,6 +109,12 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data, sdhci_writel(host, start_addr, SDHCI_DMA_ADDRESS); }#endif +if (timeout-- >0 ) +udelay (10 ); +else { +printf ("Transfer data timeout\n" ); +return -1 ; + } }while (!(stat &SDHCI_INT_DATA_END ));return 0 ; }
Signature · 1 line
1.7.0.4
v2 cover fix and enhancement patches for sdhci
In reply to Lei WenThis seris fix several issue like flush cache and build warning. And give this generic driver enhancement for timeout when transferring data and additional structure member to access in platform self driver.
Changelog:
V2: code style change.
Lei Wen (4):
mmc: sdhci: fix cache flush
mmc: sdhci: fix build warning
mmc: sdhci: add mmc structure for host
mmc: sdhci: add timeout for data transfer
drivers/mmc/sdhci.c | 12 ++++++++++-- include/sdhci.h | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-)
v3 cover fix and enhancement patches for sdhci
This seris fix several issue like flush cache and build warning. And give this generic driver enhancement for timeout when transferring data and additional structure member to access in platform self driver.
Changelog:
V2: code style change.
V3: add another fix of sdma handling bug including in this series
Lei Wen (5):
mmc: sdhci: fix cache flush
mmc: sdhci: fix build warning
mmc: sdhci: add mmc structure for host
mmc: sdhci: add timeout for data transfer
mmc: sdhci: fix sdma bug for large file transfer
drivers/mmc/sdhci.c | 14 +++++++++++--- include/sdhci.h | 5 +++++ 2 files changed, 16 insertions(+), 3 deletions(-)
v4 cover fix and enhancement patches for sdhci
This seris fix several issue like flush cache and build warning. And give this generic driver enhancement for timeout when transferring data and additional structure member to access in platform self driver.
Changelog:
V2: code style change.
V3: add another fix of sdma handling bug including in this series
V4: minor code style change
Lei Wen (5):
mmc: sdhci: fix cache flush
mmc: sdhci: fix build warning
mmc: sdhci: add mmc structure for host
mmc: sdhci: add timeout for data transfer
mmc: sdhci: fix sdma bug for large file transfer
drivers/mmc/sdhci.c | 14 +++++++++++--- include/sdhci.h | 6 ++++++ 2 files changed, 17 insertions(+), 3 deletions(-)
v4 cover fix and enhancement patches for sdhci
Hi Andy,
Quoted 16 lines · Lei Wen
This seris fix several issue like flush cache and build warning. And give this generic driver enhancement for timeout when transferring data and additional structure member to access in platform self driver.
Changelog:
V2: code style change.
V3: add another fix of sdma handling bug including in this series
V4: minor code style changeLei Wen (5):
?mmc: sdhci: fix cache flush
?mmc: sdhci: fix build warning
?mmc: sdhci: add mmc structure for host
?mmc: sdhci: add timeout for data transfer
?mmc: sdhci: fix sdma bug for large file transfer
Quoted 4 lines
?drivers/mmc/sdhci.c | ? 14 +++++++++++--- ?include/sdhci.h ? ? | ? ?6 ++++++
?2 files changed, 17 insertions(+), 3 deletions(-)
Any comment for this patch series?
Thanks,
Lei
v4 cover fix and enhancement patches for sdhci
Hi Andy,
Quoted 19 lines · Lei Wen
Hi Andy,
Quoted 16 lines · Lei Wen
This seris fix several issue like flush cache and build warning. And give this generic driver enhancement for timeout when transferring data and additional structure member to access in platform self driver.
Changelog:
V2: code style change.
V3: add another fix of sdma handling bug including in this series
V4: minor code style changeLei Wen (5):
?mmc: sdhci: fix cache flush
?mmc: sdhci: fix build warning
?mmc: sdhci: add mmc structure for host
?mmc: sdhci: add timeout for data transfer
?mmc: sdhci: fix sdma bug for large file transfer
Quoted 7 lines
Quoted 4 lines
?drivers/mmc/sdhci.c | ? 14 +++++++++++--- ?include/sdhci.h ? ? | ? ?6 ++++++
?2 files changed, 17 insertions(+), 3 deletions(-)Any comment for this patch series?
Any comments?
Thanks,
Lei
v4 cover fix and enhancement patches for sdhci
Sorry for the delay, I am currently processing my patch backlog. I will be applying them today.
Quoted 35 lines · Lei Wen
Hi Andy,
Quoted 19 lines · Lei Wen
Hi Andy,
Quoted 16 lines · Lei Wen
This seris fix several issue like flush cache and build warning. And give this generic driver enhancement for timeout when transferring data and additional structure member to access in platform self driver.
Changelog:
V2: code style change.
V3: add another fix of sdma handling bug including in this series
V4: minor code style changeLei Wen (5):
mmc: sdhci: fix cache flush
mmc: sdhci: fix build warning
mmc: sdhci: add mmc structure for host
mmc: sdhci: add timeout for data transfer
mmc: sdhci: fix sdma bug for large file transferQuoted 7 lines
Quoted 4 lines
drivers/mmc/sdhci.c | 14 +++++++++++--- include/sdhci.h | 6 ++++++ 2 files changed, 17 insertions(+), 3 deletions(-)Any comment for this patch series?
Any comments?
Thanks,
Lei
PATCH v4 1/5 mmc: sdhci: fix cache flush
In reply to Lei WenOnly flush the memory range needed.
---
Changelog:
V2: no change
V3: no change
V4: no change
drivers/mmc/sdhci.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mmc/sdhci.c +1 -1
@@ -196,7 +196,7 @@ int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,sdhci_writel (host, cmd->cmdarg,SDHCI_ARGUMENT );#ifdef CONFIG_MMC_SDMA -flush_cache (0 , ~0 ); +flush_cache (start_addr, trans_bytes);#endif sdhci_writew (host,SDHCI_MAKE_CMD (cmd->cmdidx, flags),SDHCI_COMMAND ); do {
Signature · 1 line
1.7.0.4
PATCH v4 2/5 mmc: sdhci: fix build warning
In reply to Lei WenIf CONFIG_MMC_SDHCI_IO_ACCESSORS is defined, the following warning would shows up:
include/sdhci.h:224: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:224: warning: its scope is only this definition or declaration, which is probably not what you want include/sdhci.h:225: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:226: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:227: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:228: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:229: warning: 'struct sdhci_host' declared inside parameter list
---
Changelog:
V2: code style change
V2.1: delete "Change-Id"
V3: no change
V4: no change
include/sdhci.h | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
include/sdhci.h +3 -0
@@ -214,6 +214,9 @@*/ #define SDHCI_QUIRK_32BIT_DMA_ADDR (1 << 0) +/* to make gcc happy */ +struct sdhci_host ; +/* * Host SDMA buffer boundary. Valid values from 4K to 512K in powers of 2. */
Signature · 1 line
1.7.0.4
PATCH v4 3/5 mmc: sdhci: add mmc structure for host
In reply to Lei WenSo that sdhci host would tell in the driver that the mmc current attributes.
---
Changelog:
V2: no change
V3: no change
V4: add empty line after mmc.h include
drivers/mmc/sdhci.c | 1 + include/sdhci.h | 3 +++ 2 files changed, 4 insertions(+), 0 deletions(-)
drivers/mmc/sdhci.c +1 -0
@@ -377,6 +377,7 @@ int add_sdhci(struct sdhci_host *host, u32 max_clk, u32 min_clk) } mmc->priv = host; + host->mmc = mmc;sprintf (mmc->name,"%s" , host->name); mmc->send_cmd = sdhci_send_command;
include/sdhci.h +3 -0
@@ -27,6 +27,8 @@#define __SDHCI_HW_H#include <asm/io.h> +#include <mmc.h> +/* * Controller registers */
@@ -239,6 +241,7 @@ struct sdhci_host {unsigned int quirks;unsigned int version;unsigned int clock; +struct mmc *mmc;const struct sdhci_ops *ops; };
Signature · 1 line
1.7.0.4
PATCH v4 4/5 mmc: sdhci: add timeout for data transfer
In reply to Lei Wen---
Changelog:
V2: no change
V3: no change
V4: no change
drivers/mmc/sdhci.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
drivers/mmc/sdhci.c +8 -1
@@ -81,8 +81,9 @@ static void sdhci_transfer_pio(struct sdhci_host *host, struct mmc_data *data)static int sdhci_transfer_data (struct sdhci_host *host,struct mmc_data *data,unsigned int start_addr) { -unsigned int stat, rdy, mask, block =0 ; +unsigned int stat, rdy, mask, timeout, block =0 ; + timeout =10000 ; rdy =SDHCI_INT_SPACE_AVAIL |SDHCI_INT_DATA_AVAIL ; mask =SDHCI_DATA_AVAILABLE |SDHCI_SPACE_AVAILABLE ; do {
@@ -108,6 +109,12 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data, sdhci_writel(host, start_addr, SDHCI_DMA_ADDRESS); }#endif +if (timeout-- >0 ) +udelay (10 ); +else { +printf ("Transfer data timeout\n" ); +return -1 ; + } }while (!(stat &SDHCI_INT_DATA_END ));return 0 ; }
Signature · 1 line
1.7.0.4
PATCH v4 5/5 mmc: sdhci: fix sdma bug for large file transfer
In reply to Lei WenSDHCI spec need to reset the sdma base address while the software try to accorss the 512k bytes address boundary. When meet such accross behavior, sdhci controller would generate a interrupt automatically, and software need handle this.
---
Changelog:
V2: no change
V3: new added fix for sdma bug
V4: no change
drivers/mmc/sdhci.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mmc/sdhci.c +1 -1
@@ -104,7 +104,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data,#ifdef CONFIG_MMC_SDMA if (stat &SDHCI_INT_DMA_END ) {sdhci_writel (host,SDHCI_INT_DMA_END ,SDHCI_INT_STATUS ); - start_addr &=SDHCI_DEFAULT_BOUNDARY_SIZE -1 ; + start_addr &= ~(SDHCI_DEFAULT_BOUNDARY_SIZE -1 ); start_addr +=SDHCI_DEFAULT_BOUNDARY_SIZE ;sdhci_writel (host, start_addr,SDHCI_DMA_ADDRESS ); }
Signature · 1 line
1.7.0.4
PATCH v3 1/5 mmc: sdhci: fix cache flush
In reply to Lei WenOnly flush the memory range needed.
---
Changelog:
V2: no change
V3: no change
drivers/mmc/sdhci.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mmc/sdhci.c +1 -1
@@ -196,7 +196,7 @@ int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,sdhci_writel (host, cmd->cmdarg,SDHCI_ARGUMENT );#ifdef CONFIG_MMC_SDMA -flush_cache (0 , ~0 ); +flush_cache (start_addr, trans_bytes);#endif sdhci_writew (host,SDHCI_MAKE_CMD (cmd->cmdidx, flags),SDHCI_COMMAND ); do {
Signature · 1 line
1.7.0.4
PATCH v3 2/5 mmc: sdhci: fix build warning
In reply to Lei WenIf CONFIG_MMC_SDHCI_IO_ACCESSORS is defined, the following warning would shows up:
include/sdhci.h:224: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:224: warning: its scope is only this definition or declaration, which is probably not what you want include/sdhci.h:225: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:226: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:227: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:228: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:229: warning: 'struct sdhci_host' declared inside parameter list
---
Changelog:
V2: code style change
V2.1: delete "Change-Id"
V3: no change
include/sdhci.h | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
include/sdhci.h +3 -0
@@ -214,6 +214,9 @@*/ #define SDHCI_QUIRK_32BIT_DMA_ADDR (1 << 0) +/* to make gcc happy */ +struct sdhci_host ; +/* * Host SDMA buffer boundary. Valid values from 4K to 512K in powers of 2. */
Signature · 1 line
1.7.0.4
PATCH v3 3/5 mmc: sdhci: add mmc structure for host
In reply to Lei WenSo that sdhci host would tell in the driver that the mmc current attributes.
---
Changelog:
V2: no change
V3: no change
drivers/mmc/sdhci.c | 1 + include/sdhci.h | 2 ++ 2 files changed, 3 insertions(+), 0 deletions(-)
drivers/mmc/sdhci.c +1 -0
@@ -377,6 +377,7 @@ int add_sdhci(struct sdhci_host *host, u32 max_clk, u32 min_clk) } mmc->priv = host; + host->mmc = mmc;sprintf (mmc->name,"%s" , host->name); mmc->send_cmd = sdhci_send_command;
include/sdhci.h +2 -0
@@ -27,6 +27,7 @@#define __SDHCI_HW_H#include <asm/io.h> +#include <mmc.h> /* * Controller registers */
@@ -239,6 +240,7 @@ struct sdhci_host {unsigned int quirks;unsigned int version;unsigned int clock; +struct mmc *mmc;const struct sdhci_ops *ops; };
Signature · 1 line
1.7.0.4
PATCH v3 3/5 mmc: sdhci: add mmc structure for host
Hello.
Quoted 4 lines · Lei Wen
So that sdhci host would tell in the driver that the mmc current attributes.
Signed-off-by Lei Wen<[email protected]>
[...]
include/sdhci.h line 30
Quoted 9 lines
include/sdhci.h +1
-0@@ -27,6 +27,7 @@#define __SDHCI_HW_H#include <asm/io.h> +#include <mmc.h>
Why remove empty line here?
include/sdhci.h line 33
Quoted 3 lines
include/sdhci.h +0
-0/* * Controller registers */
WBR, Sergei
PATCH v3 3/5 mmc: sdhci: add mmc structure for host
Hi Sergei,
Quoted 17 lines · Sergei Shtylyov
Hello.
Quoted 4 lines · Lei Wen
So that sdhci host would tell in the driver that the mmc current attributes.
Signed-off-by Lei Wen<[email protected]>[...]
Quoted 7 lines
include/sdhci.h +0
-0@@ -27,6 +27,7 @@? #define
__SDHCI_HW_H
Quoted 5 lines
Quoted 2 lines
? #include<asm/io.h>
+#include<mmc.h>? ?Why remove empty line here?
Thanks for pointing that out! I would repost which keep the empty line.
Best regards,
Lei
PATCH v3 4/5 mmc: sdhci: add timeout for data transfer
In reply to Lei Wen---
Changelog:
V2: no change
V3: no change
drivers/mmc/sdhci.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
drivers/mmc/sdhci.c +8 -1
@@ -81,8 +81,9 @@ static void sdhci_transfer_pio(struct sdhci_host *host, struct mmc_data *data)static int sdhci_transfer_data (struct sdhci_host *host,struct mmc_data *data,unsigned int start_addr) { -unsigned int stat, rdy, mask, block =0 ; +unsigned int stat, rdy, mask, timeout, block =0 ; + timeout =10000 ; rdy =SDHCI_INT_SPACE_AVAIL |SDHCI_INT_DATA_AVAIL ; mask =SDHCI_DATA_AVAILABLE |SDHCI_SPACE_AVAILABLE ; do {
@@ -108,6 +109,12 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data, sdhci_writel(host, start_addr, SDHCI_DMA_ADDRESS); }#endif +if (timeout-- >0 ) +udelay (10 ); +else { +printf ("Transfer data timeout\n" ); +return -1 ; + } }while (!(stat &SDHCI_INT_DATA_END ));return 0 ; }
Signature · 1 line
1.7.0.4
PATCH v3 5/5 mmc: sdhci: fix sdma bug for large file transfer
In reply to Lei WenSDHCI spec need to reset the sdma base address while the software try to accorss the 512k bytes address boundary. When meet such accross behavior, sdhci controller would generate a interrupt automatically, and software need handle this.
---
Changelog:
V2: no change
V3: new added fix for sdma bug
drivers/mmc/sdhci.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mmc/sdhci.c +1 -1
@@ -104,7 +104,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data,#ifdef CONFIG_MMC_SDMA if (stat &SDHCI_INT_DMA_END ) {sdhci_writel (host,SDHCI_INT_DMA_END ,SDHCI_INT_STATUS ); - start_addr &=SDHCI_DEFAULT_BOUNDARY_SIZE -1 ; + start_addr &= ~(SDHCI_DEFAULT_BOUNDARY_SIZE -1 ); start_addr +=SDHCI_DEFAULT_BOUNDARY_SIZE ;sdhci_writel (host, start_addr,SDHCI_DMA_ADDRESS ); }
Signature · 1 line
1.7.0.4
PATCH v2 1/4 mmc: sdhci: fix cache flush
In reply to Lei WenOnly flush the memory range needed.
---
Changelog:
V2: no change
drivers/mmc/sdhci.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mmc/sdhci.c +1 -1
@@ -196,7 +196,7 @@ int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,sdhci_writel (host, cmd->cmdarg,SDHCI_ARGUMENT );#ifdef CONFIG_MMC_SDMA -flush_cache (0 , ~0 ); +flush_cache (start_addr, trans_bytes);#endif sdhci_writew (host,SDHCI_MAKE_CMD (cmd->cmdidx, flags),SDHCI_COMMAND ); do {
Signature · 1 line
1.7.0.4
PATCH v2 2/4 mmc: sdhci: fix build warning
In reply to Lei WenIf CONFIG_MMC_SDHCI_IO_ACCESSORS is defined, the following warning would shows up:
include/sdhci.h:224: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:224: warning: its scope is only this definition or declaration, which is probably not what you want include/sdhci.h:225: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:226: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:227: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:228: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:229: warning: 'struct sdhci_host' declared inside parameter list
---
Changelog:
V2: code style change
include/sdhci.h | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
include/sdhci.h +3 -0
@@ -214,6 +214,9 @@*/ #define SDHCI_QUIRK_32BIT_DMA_ADDR (1 << 0) +/* to make gcc happy */ +struct sdhci_host ; +/* * Host SDMA buffer boundary. Valid values from 4K to 512K in powers of 2. */
Signature · 1 line
1.7.0.4
PATCH 2/4 mmc: sdhci: fix build warning
If CONFIG_MMC_SDHCI_IO_ACCESSORS is defined, the following warning would shows up:
include/sdhci.h:224: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:224: warning: its scope is only this definition or declaration, which is probably not what you want include/sdhci.h:225: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:226: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:227: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:228: warning: 'struct sdhci_host' declared inside parameter listinclude/sdhci.h:229: warning: 'struct sdhci_host' declared inside parameter list
---
Changelog:
V2: code style change
V2.1: delete "Change-Id"
include/sdhci.h | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
include/sdhci.h +3 -0
@@ -214,6 +214,9 @@*/ #define SDHCI_QUIRK_32BIT_DMA_ADDR (1 << 0) +/* to make gcc happy */ +struct sdhci_host ; +/* * Host SDMA buffer boundary. Valid values from 4K to 512K in powers of 2. */
Signature · 1 line
1.7.0.4
PATCH v2 3/4 mmc: sdhci: add mmc structure for host
In reply to Lei WenSo that sdhci host would tell in the driver that the mmc current attributes.
---
Changelog:
V2: no change
drivers/mmc/sdhci.c | 1 + include/sdhci.h | 2 ++ 2 files changed, 3 insertions(+), 0 deletions(-)
drivers/mmc/sdhci.c +1 -0
@@ -377,6 +377,7 @@ int add_sdhci(struct sdhci_host *host, u32 max_clk, u32 min_clk) } mmc->priv = host; + host->mmc = mmc;sprintf (mmc->name,"%s" , host->name); mmc->send_cmd = sdhci_send_command;
include/sdhci.h +2 -0
@@ -27,6 +27,7 @@#define __SDHCI_HW_H#include <asm/io.h> +#include <mmc.h> /* * Controller registers */
@@ -237,6 +238,7 @@ struct sdhci_host {unsigned int quirks;unsigned int version;unsigned int clock; +struct mmc *mmc;const struct sdhci_ops *ops; };
Signature · 1 line
1.7.0.4
PATCH v2 4/4 mmc: sdhci: add timeout for data transfer
In reply to Lei Wen---
Changelog:
V2: no change
drivers/mmc/sdhci.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
drivers/mmc/sdhci.c +8 -1
@@ -81,8 +81,9 @@ static void sdhci_transfer_pio(struct sdhci_host *host, struct mmc_data *data)static int sdhci_transfer_data (struct sdhci_host *host,struct mmc_data *data,unsigned int start_addr) { -unsigned int stat, rdy, mask, block =0 ; +unsigned int stat, rdy, mask, timeout, block =0 ; + timeout =10000 ; rdy =SDHCI_INT_SPACE_AVAIL |SDHCI_INT_DATA_AVAIL ; mask =SDHCI_DATA_AVAILABLE |SDHCI_SPACE_AVAILABLE ; do {
@@ -108,6 +109,12 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data, sdhci_writel(host, start_addr, SDHCI_DMA_ADDRESS); }#endif +if (timeout-- >0 ) +udelay (10 ); +else { +printf ("Transfer data timeout\n" ); +return -1 ; + } }while (!(stat &SDHCI_INT_DATA_END ));return 0 ; }
Signature · 1 line
1.7.0.4