mmc: sdhci-of-dwcmshc: Add CQE support
Subsystems (3)
v4 cover mmc: sdhci-of-dwcmshc: Add CQE support
Hello!
This is implementation of SDHCI CQE support for sdhci-of-dwcmshc driver. For enabling CQE support just set 'supports-cqe' in your DevTree file for appropriate mmc node.
Also, while implementing CQE support for the driver, I faced with a problem which I will describe below.
According to the IP block documentation CQE works only with "AMDA-2 only" mode which is activated only with v4 mode enabled. I see in dwcmshc_probe() function that v4 mode gets enabled only for 'sdhci_dwcmshc_bf3_pdata' platform data.
So my question is: is it correct to enable v4 mode for all platform data if 'SDHCI_CAN_64BIT_V4' bit is set in hw?
Because I`m afraid that enabling v4 mode for some platforms could break them down. On the other hand, if host controller says that it can do v4 (caps & SDHCI_CAN_64BIT_V4), lets do v4 or disable it manualy by some quirk. Anyway - RFC.
v2:
- Added dwcmshc specific cqe_disable hook to prevent losing in-flight cmd when an ioctl is issued and cqe_disable is called;
- Added processing 128Mb boundary for the host memory data buffer size and the data buffer. For implementing this processing an extra callback is added to the struct 'sdhci_ops'.
- Fixed typo.
v3:
- Fix warning reported by kernel test robot:
| Reported-by: kernel test robot <[email protected]> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
v4:
- Data reset moved to custom driver tuning hook.
- Removed unnecessary dwcmshc_sdhci_cqe_disable() func
- Removed unnecessary dwcmshc_cqhci_set_tran_desc. Export and use cqhci_set_tran_desc() instead.
- Provide a hook for cqhci_set_tran_desc() instead of cqhci_prep_tran_desc().
- Fix typo: int_clok_disable --> int_clock_disable
Thanks in advance, Sergey.
Sergey Khimich (2):
mmc: cqhci: Add cqhci set_tran_desc() callback
mmc: sdhci-of-dwcmshc: Implement SDHCI CQE support
drivers/mmc/host/Kconfig | 1 + drivers/mmc/host/cqhci-core.c | 10 +- drivers/mmc/host/cqhci.h | 5 + drivers/mmc/host/sdhci-of-dwcmshc.c | 181 +++++++++++++++++++++++++++- 4 files changed, 192 insertions(+), 5 deletions(-)
Signature · 1 line
2.30.2
PATCH v4 1/2 mmc: cqhci: Add cqhci set_tran_desc() callback
From: Sergey Khimich <[email protected]>
There are could be specific limitations for some mmc controllers for setting cqhci transfer descriptors. So add callback to allow implement driver specific function.
--- drivers/mmc/host/cqhci-core.c | 10 +++++++--- drivers/mmc/host/cqhci.h | 5 +++++ 2 files changed, 12 insertions(+), 3 deletions(-)
drivers/mmc/host/cqhci-core.c +7 -3
@@ -474,8 +474,8 @@ static int cqhci_dma_map(struct mmc_host *host, struct mmc_request *mrq)return sg_count; } -static void cqhci_set_tran_desc (u8 *desc,dma_addr_t addr,int len,bool end, -bool dma64) +void cqhci_set_tran_desc (u8 *desc,dma_addr_t addr,int len,bool end, +bool dma64) {__le32 *attr = (__le32 __force *)desc;
@@ -522,7 +522,11 @@ static int cqhci_prep_tran_desc(struct mmc_request *mrq,if ((i+1 ) == sg_count) end = true; -cqhci_set_tran_desc (desc, addr, len, end, dma64); +if (cq_host->ops->set_tran_desc) + cq_host->ops->set_tran_desc (cq_host, &desc, addr, len, end, dma64); +else +cqhci_set_tran_desc (desc, addr, len, end, dma64); + desc += cq_host->trans_desc_len; }
drivers/mmc/host/cqhci.h +5 -0
@@ -217,6 +217,7 @@ struct cqhci_host_ops;struct mmc_host ;struct mmc_request ;struct cqhci_slot ; +struct mmc_data ;struct cqhci_host {const struct cqhci_host_ops *ops;
@@ -293,6 +294,9 @@ struct cqhci_host_ops {int (*program_key)(struct cqhci_host *cq_host,const union cqhci_crypto_cfg_entry *cfg,int slot);#endif +void (*set_tran_desc)(struct cqhci_host *cq_host,u8 **desc, +dma_addr_t addr,int len,bool end,bool dma64); + };static inline void cqhci_writel (struct cqhci_host *host,u32 val,int reg)
@@ -318,6 +322,7 @@ irqreturn_t cqhci_irq(struct mmc_host *mmc, u32 intmask, int cmd_error,int cqhci_init (struct cqhci_host *cq_host,struct mmc_host *mmc,bool dma64);struct cqhci_host *cqhci_pltfm_init (struct platform_device *pdev);int cqhci_deactivate (struct mmc_host *mmc); +void cqhci_set_tran_desc (u8 *desc,dma_addr_t addr,int len,bool end,bool dma64);static inline int cqhci_suspend (struct mmc_host *mmc) {return cqhci_deactivate (mmc);
Signature · 1 line
2.30.2
PATCH v4 2/2 mmc: sdhci-of-dwcmshc: Implement SDHCI CQE support
In reply to Sergey KhimichFrom: Sergey Khimich <[email protected]>
For enabling CQE support just set 'supports-cqe' in your DevTree file for appropriate mmc node.
--- drivers/mmc/host/Kconfig | 1 + drivers/mmc/host/sdhci-of-dwcmshc.c | 181 +++++++++++++++++++++++++++- 2 files changed, 180 insertions(+), 2 deletions(-)
drivers/mmc/host/Kconfig +1 -0
@@ -233,6 +233,7 @@ config MMC_SDHCI_OF_DWCMSHC depends on MMC_SDHCI_PLTFM depends on OF depends on COMMON_CLK + select MMC_CQHCI help This selects Synopsys DesignWare Cores Mobile Storage Controller support.
drivers/mmc/host/sdhci-of-dwcmshc.c +179 -2
250 lines not on this page · raw message
Signature · 1 line
2.30.2
kernel test robot
build botRe: [PATCH v4 2/2] mmc: sdhci-of-dwcmshc: Implement SDHCI CQE support
kernel test robot noticed the following build warnings:
Hi Sergey,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on ulf-hansson-mmc-mirror/next v6.7-rc7] [cannot apply to next-20231222]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Sergey-Khimich/mmc-cqhci-Add-cqhci-set_tran_desc-callback/20231229-181345 base: linus/master patch link: https://lore.kernel.org/r/20231229101128.392089-3-serghox%40gmail.com patch subject: [PATCH v4 2/2] mmc: sdhci-of-dwcmshc: Implement SDHCI CQE support config: i386-buildonly-randconfig-001-20231230 (https://download.01.org/0day-ci/archive/20231230/[email protected]/config) compiler: ClangBuiltLinux clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231230/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/mmc/host/sdhci-of-dwcmshc.c:224:5: warning: no previous prototype for function 'dwcmshc_execute_tuning' [-Wmissing-prototypes]
224 | int dwcmshc_execute_tuning(struct mmc_host *mmc, u32 opcode)
| ^
drivers/mmc/host/sdhci-of-dwcmshc.c:224:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
224 | int dwcmshc_execute_tuning(struct mmc_host *mmc, u32 opcode)
| ^
| static 1 warning generated.
vim +/dwcmshc_execute_tuning +224 drivers/mmc/host/sdhci-of-dwcmshc.c
223
> 224 int dwcmshc_execute_tuning(struct mmc_host *mmc, u32 opcode)
225 {
226 int err = sdhci_execute_tuning(mmc, opcode);
227 struct sdhci_host *host = mmc_priv(mmc);
228
229 if (err)
230 return err;
231
232 /*
233 * Tuning can leave the IP in an active state (Buffer Read Enable bit
234 * set) which prevents the entry to low power states (i.e. S0i3). Data
235 * reset will clear it.
236 */
237 sdhci_reset(host, SDHCI_RESET_DATA);
238
239 return 0;
240 }
241
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH v4 2/2] mmc: sdhci-of-dwcmshc: Implement SDHCI CQE support
In reply to Sergey Khimichkernel test robot noticed the following build warnings:
Hi Sergey,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on ulf-hansson-mmc-mirror/next v6.7-rc7] [cannot apply to next-20231222]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Sergey-Khimich/mmc-cqhci-Add-cqhci-set_tran_desc-callback/20231229-181345 base: linus/master patch link: https://lore.kernel.org/r/20231229101128.392089-3-serghox%40gmail.com patch subject: [PATCH v4 2/2] mmc: sdhci-of-dwcmshc: Implement SDHCI CQE support config: arm64-defconfig (https://download.01.org/0day-ci/archive/20231230/[email protected]/config) compiler: aarch64-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231230/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/mmc/host/sdhci-of-dwcmshc.c:224:5: warning: no previous prototype for 'dwcmshc_execute_tuning' [-Wmissing-prototypes]
224 | int dwcmshc_execute_tuning(struct mmc_host *mmc, u32 opcode)
| ^~~~~~~~~~~~~~~~~~~~~~
vim +/dwcmshc_execute_tuning +224 drivers/mmc/host/sdhci-of-dwcmshc.c
223
> 224 int dwcmshc_execute_tuning(struct mmc_host *mmc, u32 opcode)
225 {
226 int err = sdhci_execute_tuning(mmc, opcode);
227 struct sdhci_host *host = mmc_priv(mmc);
228
229 if (err)
230 return err;
231
232 /*
233 * Tuning can leave the IP in an active state (Buffer Read Enable bit
234 * set) which prevents the entry to low power states (i.e. S0i3). Data
235 * reset will clear it.
236 */
237 sdhci_reset(host, SDHCI_RESET_DATA);
238
239 return 0;
240 }
241
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki