Add DesignWare Mobile mmc driver
Subsystems (4)
v2 cover Add DesignWare Mobile mmc driver
We added Synopsys DesignWare mmc cmdq driver and also added Realtek mmc driver to make good use of it.
Jyan Chou (4):
mmc: solve DMA boundary limitation of CQHCI driver
mmc: Add Synopsys DesignWare mmc cmdq host driver
mmc: Add dw mobile mmc cmdq rtk driver
dt-bindings: mmc: Add dt-bindings for realtek mmc driver
.../bindings/mmc/realtek-dw-mshc.yaml | 150 ++ drivers/mmc/host/Kconfig | 22 + drivers/mmc/host/Makefile | 2 + drivers/mmc/host/cqhci-core.c | 8 +- drivers/mmc/host/cqhci.h | 5 + drivers/mmc/host/dw_mmc_cqe-rtk.c | 992 ++++++++++ drivers/mmc/host/dw_mmc_cqe-rtk.h | 160 ++ drivers/mmc/host/dw_mmc_cqe.c | 1610 +++++++++++++++++ drivers/mmc/host/dw_mmc_cqe.h | 445 +++++ 9 files changed, 3393 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml create mode 100644 drivers/mmc/host/dw_mmc_cqe-rtk.c create mode 100644 drivers/mmc/host/dw_mmc_cqe-rtk.h create mode 100644 drivers/mmc/host/dw_mmc_cqe.c create mode 100644 drivers/mmc/host/dw_mmc_cqe.h
Signature · 1 line
2.42.0
PATCH v3 1/4 mmc: solve DMA boundary limitation of CQHCI driver
Due to synopsys data book's description, it had a limitation while using DMA that buffer size and start address must not exceed 128 MB.
We add an option setup_tran_desc to make tran_desc setting flexible.
---
v2 -> v3:
- Fix auto test compile warning.
v1 -> v2:
- Export cqhci_set_tran_desc for setting the descriptor's callback function.
v0 -> v1:
- Separate different patch supports into single patch.
---
--- drivers/mmc/host/cqhci-core.c | 8 +++++++- drivers/mmc/host/cqhci.h | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/mmc/host/cqhci-core.c +7 -1
@@ -474,7 +474,7 @@ 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, +void cqhci_set_tran_desc (u8 *desc,dma_addr_t addr,int len,bool end,bool dma64) {__le32 *attr = (__le32 __force *)desc;
@@ -495,6 +495,7 @@ static void cqhci_set_tran_desc(u8 *desc, dma_addr_t addr, int len, bool end, dataddr[0 ] =cpu_to_le32 (addr); } } +EXPORT_SYMBOL (cqhci_set_tran_desc);static int cqhci_prep_tran_desc (struct mmc_request *mrq,struct cqhci_host *cq_host,int tag)
@@ -516,6 +517,11 @@ static int cqhci_prep_tran_desc(struct mmc_request *mrq, desc =get_trans_desc (cq_host, tag); +if (cq_host->ops->setup_tran_desc) { + cq_host->ops->setup_tran_desc (data, cq_host, desc, sg_count); +return 0 ; + } +for_each_sg (data->sg, sg, sg_count, i) { addr =sg_dma_address (sg); len =sg_dma_len (sg);
drivers/mmc/host/cqhci.h +5 -0
@@ -216,6 +216,7 @@ union cqhci_crypto_cfg_entry {struct cqhci_host_ops ;struct mmc_host ;struct mmc_request ; +struct mmc_data ;struct cqhci_slot ;struct cqhci_host {
@@ -289,6 +290,8 @@ struct cqhci_host_ops { u64 *data);void (*pre_enable)(struct mmc_host *mmc);void (*post_disable)(struct mmc_host *mmc); +void (*setup_tran_desc)(struct mmc_data *data, +struct cqhci_host *cq_host,u8 *desc,int sg_count);#ifdef CONFIG_MMC_CRYPTO int (*program_key)(struct cqhci_host *cq_host,const union cqhci_crypto_cfg_entry *cfg,int slot);
@@ -322,6 +325,8 @@ static inline int cqhci_suspend(struct mmc_host *mmc) {return cqhci_deactivate (mmc); } + +void cqhci_set_tran_desc (u8 *desc,dma_addr_t addr,int len,bool end,bool dma64);int cqhci_resume (struct mmc_host *mmc);#endif
Signature · 1 line
2.42.0
PATCH v3 2/4 mmc: Add Synopsys DesignWare mmc cmdq host driver
In reply to Jyan ChouWe implemented cmdq feature on Synopsys DesignWare mmc driver. The difference between dw_mmc.c and dw_mmc_cqe.c were distinct register definitions, mmc user flow and the addition of cmdq.
New version of User Guide had modify mmc driver's usage flow, we may need to renew code to precisely follow user guide.
More over, We added a wait status function to satisfy synopsys user guide's description, since this flow might be specific in synopsys host driver only.
—--
v1 -> v2:
- Remove dw_mci_cqe_set_tran_desc due to the duplicated function.
- Add ->pre_enable() / ->post_disable()
v0 -> v1:
- Seperate different support into single patch.
- Fix the compiler complains.
---
--- drivers/mmc/host/Kconfig | 13 + drivers/mmc/host/Makefile | 1 + drivers/mmc/host/dw_mmc_cqe.c | 1610 +++++++++++++++++++++++++++++++++ drivers/mmc/host/dw_mmc_cqe.h | 445 +++++++++ 4 files changed, 2069 insertions(+) create mode 100644 drivers/mmc/host/dw_mmc_cqe.c create mode 100644 drivers/mmc/host/dw_mmc_cqe.h
drivers/mmc/host/Kconfig +13 -0
@@ -762,6 +762,19 @@ config MMC_DW_PLTFM If unsure, say Y. +config MMC_DW_CQE + tristate "Synopsys DesignWare Memory Card with CQE Interface" + depends on ARC || ARM || ARM64 || MIPS || COMPILE_TEST + select MMC_CQHCI + help + This selects support for the Synopsys DesignWare Mobile Storage IP + block after JEDEC Standard version 5.1. Select this option for SD and + MMC interfaces that use command queue. + + If you have a controller with this interface, say Y or M here. + + If unsure, say Y. + config MMC_DW_BLUEFIELD tristate "BlueField specific extensions for Synopsys DW Memory Card Interface" depends on MMC_DW
drivers/mmc/host/Makefile +1 -0
@@ -55,6 +55,7 @@ obj-$(CONFIG_MMC_DW_K3) += dw_mmc-k3.o obj-$(CONFIG_MMC_DW_PCI) += dw_mmc-pci.o obj-$(CONFIG_MMC_DW_ROCKCHIP) += dw_mmc-rockchip.o obj-$(CONFIG_MMC_DW_STARFIVE) += dw_mmc-starfive.o +obj-$(CONFIG_MMC_DW_CQE) += dw_mmc_cqe.o obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o obj-$(CONFIG_MMC_VUB300) += vub300.o
drivers/mmc/host/dw_mmc_cqe.c new file +1610 -0
1,610 lines not on this page · raw message
drivers/mmc/host/dw_mmc_cqe.h new file +445 -0
445 lines not on this page · raw message
Signature · 1 line
2.42.0
Re: [PATCH V3][2/4] mmc: Add Synopsys DesignWare mmc cmdq host driver
Quoted 19 lines · Jyan Chou
We implemented cmdq feature on Synopsys DesignWare mmc driver. The difference between
dw_mmc.canddw_mmc_cqe.cwere distinct register definitions, mmc user flow and the addition of cmdq.New version of User Guide had modify mmc driver's usage flow, we may need to renew code to precisely follow user guide.
More over, We added a wait status function to satisfy synopsys user guide's description, since this flow might be specific in synopsys host driver only.
Signed-off-by Jyan Chou <[email protected]>drivers/mmc/host/Kconfig +0
-0
drivers/mmc/host/Kconfig config MMC_DW_PLTFM · line 767
Quoted 6 lines
drivers/mmc/host/Kconfig +3
-0@@ -762,6 +762,19 @@ config MMC_DW_PLTFM If unsure, say Y. +config MMC_DW_CQE + tristate "Synopsys DesignWare Memory Card with CQE Interface" + depends on ARC || ARM || ARM64 || MIPS || COMPILE_TEST
Why do you need these specific architectures? For a generic driver, it should not make a difference which architecture it is built for, and it seems silly to exclude e.g. RISCV here.
Maybe just use 'depends on OF'.
drivers/mmc/host/Kconfig config MMC_DW_PLTFM · line 768
Quoted 1 line
drivers/mmc/host/Kconfig +1
-0+DECLARE_COMPLETION(dw_mci_wait);
I'm worried by the use of all these blocking and busy-waiting primitives in the driver. In addition to the completion, I see a tasklet, a timer, various readl_poll_timeout, and more.
In an ideal block device implementation, none of these should be needed, as the block requests should get queued up from the blk_mq logic and completed when an interrupt happens.
In mmc, this is traditionally a bit more complex, but I would hope we can avoid most of the additional deferral in new drivers, and explain why the other ones are needed when this is not possible.
Let's have a look at them individually.
drivers/mmc/host/Kconfig config MMC_DW_PLTFM · line 777
Quoted 9 lines
drivers/mmc/host/Kconfig +9
-0+#if defined(CONFIG_DEBUG_FS) +static int dw_mci_cqe_req_show(struct seq_file *s, void *v) +{ + struct dw_mci_slot *slot = s->private; + struct mmc_request *mrq; + struct mmc_command *cmd; + struct mmc_command *stop; + struct mmc_data *data; +
You should not need an #ifdef around the debugfs helpers, if you use the registration interface correctly, it all gets dropped by dead code elimination.
Quoted 3 lines
drivers/mmc/host/Kconfig +3
-0+static int dw_mci_cqe_start_command(struct dw_mci *host, + struct mmc_command *cmd, u32 cmd_flags) +{
....
drivers/mmc/host/Kconfig
Quoted 4 lines
drivers/mmc/host/Kconfig +4
-0+ + host->int_waiting = &dw_mci_wait; + end = jiffies + msecs_to_jiffies(DW_MCI_TIMEOUT_Ms); + mod_timer(&host->timer, end);
This is just a timeout that happens when the command does not complete within the expected time, right? If so that is probably fine.
drivers/mmc/host/Kconfig
Quoted 5 lines
drivers/mmc/host/Kconfig +5
-0+ spin_lock_irqsave(&host->irq_lock, flags); + mcq_writew(host, CMD_R, cmd_flags); + spin_unlock_irqrestore(&host->irq_lock, flags); + + wait_for_completion(host->int_waiting);
This is odd for a couple of reasons:
- an MMIO write is not serialized by a spinlock because the bus fabric between the CPU and the device has no concept of locking, so if you actually rely on the lock to do something here, that is likely broken
- Using spin_lock_irqsave() implies that this function can be called from both atomic and non-atomic context, but then you have a blocking function right after it, so you could have used the much cheaper spin_lock_irq() here, if the lock is in fact useful
- The function is named ..._start_command(), which to me implies that it just pushes an operation to the device, but does not actually wait for it, so the wait_for_completion() seems misplaced here.
Quoted 18 lines
drivers/mmc/host/Kconfig +2
-0+ if (xfer_flag == 1) { + ret = readl_poll_timeout(host->regs + SDMMC_NORMAL_INT_STAT_R,status,
drivers/mmc/host/Kconfig +9
-0+ (status & SDMMC_XFER_COMPLETE) == + SDMMC_XFER_COMPLETE, 10, DW_MCI_TIMEOUT); + if (ret) { + /*error interrupt detected*/ + if ((mcq_readw(host, NORMAL_INT_STAT_R) & SDMMC_ERR_INTERRUPT) && + host->tuning) + dev_info(host->dev, "Tuning error ... keep tuning\n"); + else + dev_err(host->dev, "Timeout waiting xfer complete, status =0x%x\n",
drivers/mmc/host/Kconfig +4
-0+ (status & 0xffff)); + } + } else { + ret = readl_poll_timeout(host->regs + SDMMC_NORMAL_INT_STAT_R,status,
drivers/mmc/host/Kconfig
Quoted 5 lines
drivers/mmc/host/Kconfig +5
-0+ (status & SDMMC_CMD_COMPLETE) == + SDMMC_CMD_COMPLETE, 10, DW_MCI_TIMEOUT); + if (ret) + dev_err(host->dev, "Timeout waiting cmd request complete\n"); + }
And these appear to defer the operation even more: regardless of the xfer_flag, you always end up in an expensive poll loop that starts a timer. If these are expected to not need the timer in normal operation, please add some comments to explain the logic, otherwise this may need to be restructured in a way that waits for an interrupt instead of a slow timer.
Quoted 38 lines
drivers/mmc/host/Kconfig +2
-0+ +static int dw_mci_cqe_wait_status(struct dw_mci *host, struct
mmc_command*cmd, u32 *status)drivers/mmc/host/Kconfig +35
-0+{ + struct mmc_command wait; + u32 cmdr; + u32 cur_state; + unsigned long timeend; + int err = 0; + + /* According to Synopsys userguide, we need to send wait command after + * stop cmd to check current status + */ + + wait = host->stat_ready; + memset(&wait, 0, sizeof(struct mmc_command)); + + timeend = jiffies + msecs_to_jiffies(500); + do { + wait.opcode = MMC_SEND_STATUS; + wait.arg = 1 << 16; + wait.flags = MMC_RSP_SPI_R2 | MMC_RSP_R1 | MMC_CMD_AC; + wait.data = NULL; + cmdr = (wait.opcode << 8) | SDMMC_RESP_LEN_48 | + SDMMC_CMD_CHK_RESP_CRC | SDMMC_CMD_IDX_CHK_ENABLE; + + mcq_writew(host, XFER_MODE_R, 0); + mcq_writel(host, ARGUMENT_R, wait.arg); + err = dw_mci_cqe_start_command(host, &wait, cmdr); + if (err) { + dw_mci_cqe_reset(host); + break; + } + + dw_mci_cqe_read_rsp(host, &wait, wait.resp); + *status = wait.resp[0]; + cur_state = R1_CURRENT_STATE(wait.resp[0]); + err = -DW_MCI_NOT_READY;
drivers/mmc/host/Kconfig
Quoted 10 lines
drivers/mmc/host/Kconfig +10
-0+ if (cur_state == R1_STATE_TRAN) { + if (wait.resp[0] & R1_READY_FOR_DATA) { + err = 0; + break; + } + } + } while (time_before(jiffies, timeend)); + + return err; +}
My first impression here was that this is a 500ms busy loop, which would have been crazy, but I now see that it actually blocks in the dw_mci_cqe_start_command() function I commented on above, so it probably does the right thing here.
This would still be clearer if you changed the ..._start_command() function to just start the command without blocking and then had the waiting bit in the function called ...wait_status().
Quoted 11 lines
+static void
dw_mci_cqe_submit_data(struct dw_mci *host, struct mmc_data *data)drivers/mmc/host/Kconfig +9
-0+{ + u32 dir = 0; + + host->sg = NULL; + host->data = data; + + if (data->flags & MMC_DATA_READ) + dir = DMA_FROM_DEVICE; + else
drivers/mmc/host/Kconfig
Quoted 10 lines
drivers/mmc/host/Kconfig +10
-0+ dir = DMA_TO_DEVICE; + + host->dma_nents = dma_map_sg(mmc_dev(host->slot->mmc), + data->sg, data->sg_len, dir); + host->sg = data->sg; + + host->using_dma = 1; + + dw_mci_cqe_submit_data_dma(host); +}
I think this is based on what the mmc layer expects you to do, but I would point out that dma_map_sg() is a fairly expensive operation on some chips, so it would be nice to be able to map the buffers in advance and not at the time when they are about to be submitted.
Quoted 21 lines
+static void
dw_mci_cqe_request(struct mmc_host *mmc, struct mmc_request *mrq)drivers/mmc/host/Kconfig +19
-0+{ + struct dw_mci_slot *slot = mmc_priv(mmc); + struct dw_mci *host = slot->host; + + WARN_ON(slot->mrq); + + /* + * The check for card presence and queueing of the request must be + * atomic, otherwise the card could be removed in between and the + * request wouldn't fail until another card was inserted. + */ + + if (!dw_mci_cqe_get_cd(mmc)) { + mrq->cmd->error = -ENOMEDIUM; + mmc_request_done(mmc, mrq); + return; + } + + down_write(&host->cr_rw_sem);
drivers/mmc/host/Kconfig
Quoted 10 lines
drivers/mmc/host/Kconfig +10
-0+ + slot->mrq = mrq; + host->mrq = mrq; + + dw_mci_cqe_start_request(host, slot); + + tasklet_schedule(&host->tasklet); + + up_write(&host->cr_rw_sem); +}
The tasklet function pretty much only calls mmc_request_done(), which I think can be called from any context, so why do you need to defer to a tasklet here?
Quoted 6 lines
drivers/mmc/host/Kconfig +6
-0+ +/* Register access macros */ +#define mcq_readl(dev, reg) \ + readl_relaxed((dev)->regs + SDMMC_##reg) +#define mcq_writel(dev, reg, value) \ + writel_relaxed((value), (dev)->regs + SDMMC_##reg)
drivers/mmc/host/Kconfig
Quoted 10 lines
drivers/mmc/host/Kconfig +10
-0+ +#define mcq_readw(dev, reg) \ + readw_relaxed((dev)->regs + SDMMC_##reg) +#define mcq_writew(dev, reg, value) \ + writew_relaxed((value), (dev)->regs + SDMMC_##reg) + +#define mcq_readb(dev, reg) \ + readb_relaxed((dev)->regs + SDMMC_##reg) +#define mcq_writeb(dev, reg, value) \ + writeb_relaxed((value), (dev)->regs + SDMMC_##reg)
The use of _relaxed MMIO helpers is probably a bug here, as this skips the serialization against DMA and leads to incorrect data.
Anything that is not performance critical or that interacts with DMA should use the normal readl/writel functions instead of the relaxed ones.
drivers/mmc/host/Kconfig
Quoted 6 lines
drivers/mmc/host/Kconfig +6
-0+#define dw_mci_get_int(dev) \ + do { \ + dev->normal_interrupt = mcq_readw(dev, NORMAL_INT_STAT_R); \ + dev->error_interrupt = mcq_readw(dev, ERROR_INT_STAT_R); \ + dev->auto_error_interrupt = mcq_readw(dev, AUTO_CMD_STAT_R); \ + } while (0)
You only have two callers of this, so I think this would be clearer when you open-code it.
drivers/mmc/host/Kconfig
Quoted 9 lines
drivers/mmc/host/Kconfig +4
-0+/*clear status register, we always keep the card interrupt*/ +#define dw_mci_clr_int(dev) \ + do { \ + mcq_writew(dev, ERROR_INT_STAT_R, mcq_readw(dev, ERROR_INT_STAT_R) &
0xffff); \drivers/mmc/host/Kconfig +1
-0+ mcq_writew(dev, NORMAL_INT_STAT_R, mcq_readw(dev, NORMAL_INT_STAT_R)&
0xffff); \drivers/mmc/host/Kconfig +1
-0+ } while (0)
Same here.
drivers/mmc/host/Kconfig
Quoted 12 lines
drivers/mmc/host/Kconfig +12
-0+/* Board platform data */ +struct dw_mci_board { + unsigned int bus_hz; /* Clock speed at the cclk_in pad */ + u32 caps; /* Capabilities */ + u32 caps2; /* More capabilities */ + u32 pm_caps; /* PM capabilities */ + + /* delay in mS before detecting cards after interrupt */ + u32 detect_delay_ms; + + struct reset_control *rstc; +};
This looks like an artifact from pre-DT days, just fold this into the dw_mci structure directly.
Arnd
PATCH v3 3/4 mmc: Add dw mobile mmc cmdq rtk driver
In reply to Jyan ChouAdd Realtek mmc driver to make good use Synopsys
DesignWare mmc cmdq host driver.
---
v0 -> v1:
1. Seperate different support into single patch.
2. Fix the compiler complains.
---
--- drivers/mmc/host/Kconfig | 9 + drivers/mmc/host/Makefile | 1 + drivers/mmc/host/dw_mmc_cqe-rtk.c | 992 ++++++++++++++++++++++++++++++ drivers/mmc/host/dw_mmc_cqe-rtk.h | 160 +++++ 4 files changed, 1162 insertions(+) create mode 100644 drivers/mmc/host/dw_mmc_cqe-rtk.c create mode 100644 drivers/mmc/host/dw_mmc_cqe-rtk.h
drivers/mmc/host/Kconfig +9 -0
@@ -775,6 +775,15 @@ config MMC_DW_CQE If unsure, say Y. +config MMC_DW_CQE_RTK + tristate "Realtek Soc's specific extensions for Synopsys DW Memory Card Interface" + depends on MMC_DW_CQE + select REGULATOR_FIXED_VOLTAGE + help + This selects support for Realtek SoC specific extensions to the + Synopsys DesignWare Memory Card Interface driver. Select this option + for platforms after RTD16xxb SoC's. + config MMC_DW_BLUEFIELD tristate "BlueField specific extensions for Synopsys DW Memory Card Interface" depends on MMC_DW
drivers/mmc/host/Makefile +1 -0
@@ -56,6 +56,7 @@ obj-$(CONFIG_MMC_DW_PCI) += dw_mmc-pci.o obj-$(CONFIG_MMC_DW_ROCKCHIP) += dw_mmc-rockchip.o obj-$(CONFIG_MMC_DW_STARFIVE) += dw_mmc-starfive.o obj-$(CONFIG_MMC_DW_CQE) += dw_mmc_cqe.o +obj-$(CONFIG_MMC_DW_CQE_RTK) += dw_mmc_cqe-rtk.o obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o obj-$(CONFIG_MMC_VUB300) += vub300.o
drivers/mmc/host/dw_mmc_cqe-rtk.c new file +992 -0
992 lines not on this page · raw message
drivers/mmc/host/dw_mmc_cqe-rtk.h new file +160 -0
160 lines not on this page · raw message
Signature · 1 line
2.42.0
Re: [PATCH V3][3/4] mmc: Add dw mobile mmc cmdq rtk driver
Quoted 14 lines · Jyan Chou
Add Realtek mmc driver to make good use Synopsys
DesignWare mmc cmdq host driver.Signed-off-by Jyan Chou <[email protected]>---
drivers/mmc/host/dw_mmc_cqe-rtk.c new file +7
-0+static int dw_mci_rtk_init (struct dw_mci *host) +{ +struct dw_mci_rtkemmc_host *priv = host->priv; + + host->pdata->caps2 =MMC_CAP2_NO_SDIO |MMC_CAP2_NO_SD ; + +if (priv->emmc_mode >=2 )
drivers/mmc/host/dw_mmc_cqe-rtk.c line 805
Quoted 10 lines
drivers/mmc/host/dw_mmc_cqe-rtk.c new file +10
-0+ host->pdata->caps2 |=MMC_CAP2_HS200_1_8V_SDR ; +if (priv->emmc_mode >=3 ) { + host->pdata->caps |=MMC_CAP_1_8V_DDR ; + host->pdata->caps2 |=MMC_CAP2_HS400_1_8V ; + } + +if (priv->is_cqe >0 ) + host->pdata->caps2 |= (MMC_CAP2_CQE |MMC_CAP2_CQE_DCMD ); + +/*In Realtek Platform, only using 32bit DMA*/
Use Linux coding style. This driver looks like one for staging, not ready for submission. :/
Quoted 33 lines
drivers/mmc/host/dw_mmc_cqe-rtk.c new file +33
-0+ host->dma_64bit_address =0 ; + +/*In Realtek Platform, do not use PIO mode by default*/ + host->use_dma =TRANS_MODE_DMA ; + + host->irq_flags =IRQF_SHARED ; + +mcq_writel (host,CP ,0x0 ); + +/*Enable L4 gated*/ +mcq_writel (host,OTHER1 ,mcq_readl (host,OTHER1 ) & + ~(SDMMC_L4_GATED_DIS |SDMMC_L4_GATED_DIS1 )); + +mcq_writel (host,OTHER1 ,mcq_readl (host,OTHER1 ) & + (~(SDMMC_DQS_CTRL_GATE_DIS |SDMMC_DBUS_MAS_GATING_DIS ))); + +/*Set the eMMC wrapper little Endian*/ +mcq_writel (host,AHB ,mcq_readl (host,AHB ) |SDMMC_AHB_BIG ); + +mcq_writel (host,OTHER1 , +mcq_readl (host,OTHER1 ) |SDMMC_STARK_CARD_STOP_ENABLE ); + +/*set eMMC instead of nand*/ +regmap_update_bits_base (priv->m2tmx,SDMMC_NAND_DMA_SEL , +SDMMC_SRAM_DMA_SEL ,SDMMC_SRAM_DMA_SEL ,NULL , false, true); + +/*Set the clk initial phase*/ +dw_mci_rtk_phase_tuning (host,0 ,0 ); + +return 0 ; +} + +#ifdef CONFIG_PM
drivers/mmc/host/dw_mmc_cqe-rtk.c line 848
Quoted 10 lines
drivers/mmc/host/dw_mmc_cqe-rtk.c new file +10
-0+static int dw_mci_rtk_suspend (struct device *dev) +{ +struct dw_mci *host =dev_get_drvdata (dev); +int ret =0 ; + + ret =dw_mci_cqe_runtime_suspend (dev); + +mcq_writel (host,AHB ,0 ); +dev_info (dev,"AHB=0x%x, dw_mci_cqe_suspend ret=%d\n" , +mcq_readl (host,AHB ), ret);
Drop useless success/function entry/exit messages..
Quoted 5 lines
drivers/mmc/host/dw_mmc_cqe-rtk.c new file +5
-0+ +return ret; +} + +static int dw_mci_rtk_resume (struct device *dev)
drivers/mmc/host/dw_mmc_cqe-rtk.c line 863
Quoted 10 lines
drivers/mmc/host/dw_mmc_cqe-rtk.c new file +10
-0+{ +struct dw_mci *host =dev_get_drvdata (dev); +int ret =0 ; + +mcq_writel (host,AHB ,mcq_readl (host,AHB ) |SDMMC_AHB_BIG ); + + ret =dw_mci_cqe_runtime_resume (dev); + +dev_info (dev,"AHB=0x%x, dw_mci_cqe_resume ret=%d\n" , +mcq_readl (host,AHB ), ret);
Drop useless success/function entry/exit messages..
drivers/mmc/host/dw_mmc_cqe-rtk.c line 870
Quoted 7 lines
drivers/mmc/host/dw_mmc_cqe-rtk.c new file +7
-0+ + return ret; +} +#else +static int dw_mci_rtk_suspend (struct device *dev) +{ +dev_err (dev,"User should enable CONFIG_PM kernel config\n" );
Why? This is not an error. If it were, then it should be build stage error.
Quoted 111 lines
drivers/mmc/host/dw_mmc_cqe-rtk.c new file +111
-0+ +return 0 ; +} + +static int dw_mci_rtk_resume (struct device *dev) +{ +dev_err (dev,"User should enable CONFIG_PM kernel config\n" ); + +return 0 ; +} +#endif /*CONFIG_PM*/ +static const struct dev_pm_ops rtk_dev_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(dw_mci_rtk_suspend, + dw_mci_rtk_resume) +SET_RUNTIME_PM_OPS (dw_mci_cqe_runtime_suspend, + dw_mci_cqe_runtime_resume, +NULL ) +}; + +static void dw_mci_rtk_shutdown (struct platform_device *pdev) +{ +dev_info (&pdev->dev,"[eMMC] Shutdown\n" ); +dw_mci_cqe_runtime_resume (&pdev->dev); +} + +static unsigned long dw_mci_rtk_dwmmc_caps[1 ] = { +MMC_CAP_4_BIT_DATA |MMC_CAP_8_BIT_DATA | +MMC_CAP_SD_HIGHSPEED |MMC_CAP_MMC_HIGHSPEED | +MMC_CAP_NONREMOVABLE |MMC_CAP_CMD23 , +}; + +static const struct dw_mci_drv_data rtk_drv_data = { + .caps = dw_mci_rtk_dwmmc_caps, + .num_caps =ARRAY_SIZE (dw_mci_rtk_dwmmc_caps), + .set_ios = dw_mci_rtk_set_ios, + .execute_tuning = dw_mci_rtk_execute_tuning, + .parse_dt = dw_mci_rtk_parse_dt, + .init = dw_mci_rtk_init, + .prepare_hs400_tuning = dw_mci_rtk_prepare_hs400_tuning, + .hs400_complete = dw_mci_rtk_hs400_complete, + .init_card = dw_mci_rtk_init_card, +}; + +static const struct of_device_id dw_mci_rtk_match[] = { + { .compatible ="realtek,rtd-dw-cqe-emmc" , + .data = &rtk_drv_data }, + {}, +}; +MODULE_DEVICE_TABLE (of, dw_mci_rtk_match); + +int dw_mci_cqe_pltfm_register (struct platform_device *pdev, +const struct dw_mci_drv_data *drv_data) +{ +struct dw_mci *host; +struct resource *regs; + + host =devm_kzalloc (&pdev->dev,sizeof (struct dw_mci ),GFP_KERNEL ); +if (!host) +return -ENOMEM ; + + host->irq =platform_get_irq (pdev,0 ); +if (host->irq <0 ) +return host->irq; + + host->drv_data = drv_data; + host->pdev = pdev; + host->dev = &pdev->dev; + host->irq_flags =0 ; + host->pdata = pdev->dev.platform_data; + + regs =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + host->regs =devm_ioremap_resource (&pdev->dev, regs); +if (IS_ERR (host->regs)) +return PTR_ERR (host->regs); + +/* Get registers' physical base address */ + host->phy_regs = regs->start; + +platform_set_drvdata (pdev, host); + +return dw_mci_cqe_probe (host); +} + +static int dw_mci_rtk_probe (struct platform_device *pdev) +{ +const struct dw_mci_drv_data *drv_data; +const struct of_device_id *match; + +if (!pdev->dev.of_node) +return -ENODEV ; + + match =of_match_node (dw_mci_rtk_match, pdev->dev.of_node); + drv_data = match->data; + +return dw_mci_cqe_pltfm_register (pdev, drv_data); +} + +int dw_mci_rtk_remove (struct platform_device *pdev) +{ +struct dw_mci *host =platform_get_drvdata (pdev); + +dw_mci_cqe_remove (host); +return 0 ; +} + +static struct platform_driver dw_mci_rtk_pltfm_driver = { + .probe = dw_mci_rtk_probe, + .remove = dw_mci_rtk_remove, + .driver = { + .name ="dwmmc_cqe_rtk" , + .of_match_table = dw_mci_rtk_match,
drivers/mmc/host/dw_mmc_cqe-rtk.c line 991
Quoted 10 lines
drivers/mmc/host/dw_mmc_cqe-rtk.c new file +10
-0+ .pm = &rtk_dev_pm_ops, + }, + .shutdown = dw_mci_rtk_shutdown, +}; + +module_platform_driver (dw_mci_rtk_pltfm_driver); + +MODULE_AUTHOR ("<[email protected]>" ); +MODULE_DESCRIPTION (" Specific Driver Extension" ); +MODULE_ALIAS ("platform:dwmmc_cqe_rtk" );
You should not need MODULE_ALIAS() in normal cases. If you need it, usually it means your device ID table is wrong.
Best regards,
Krzysztof
RE: [PATCH V3][3/4] mmc: Add dw mobile mmc cmdq rtk driver
Hi Krzysztof,
Quoted 1 line
Use Linux coding style. This driver looks like one for staging, not ready for submission. :/
We had modified our code to match Linux coding style.
Quoted 4 lines
drivers/mmc/host/dw_mmc_cqe-rtk.c line 848
Quoted 3 lines
drivers/mmc/host/dw_mmc_cqe-rtk.c new file +3
-0+mcq_writel (host,AHB ,0 ); +dev_info (dev,"AHB=0x%x, dw_mci_cqe_suspend ret=%d\n" , +mcq_readl (host,AHB ), ret);Drop useless success/function entry/exit messages..
We had drop useless function.
Quoted 1 line
Why? This is not an error. If it were, then it should be build stage error.
It was our mistake to use dev_err here, we had corrected it.
Quoted 1 line
You should not need
MODULE_ALIAS()in normal cases. If you need it, usually it means your device ID table is wrong.
We had removed MODULE_ALIAS().
Please check our new post below, thanks.
https://patchwork.kernel.org/project/linux-mmc/patch/[email protected]/
-----Original Message-----
From: Krzysztof Kozlowski <[email protected]>
Sent: Monday, October 23, 2023 4:04 PM
To: Jyan Chou [周芷安] <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH V3][3/4] mmc: Add dw mobile mmc cmdq rtk driver
External mail.
Quoted 14 lines · Jyan Chou
Add Realtek mmc driver to make good use Synopsys DesignWare mmc cmdq host driver.
Signed-off-by Jyan Chou <[email protected]>---
drivers/mmc/host/dw_mmc_cqe-rtk.c new file +7
-0+static int dw_mci_rtk_init (struct dw_mci *host) { +struct dw_mci_rtkemmc_host *priv = host->priv; + + host->pdata->caps2 =MMC_CAP2_NO_SDIO |MMC_CAP2_NO_SD ; + +if (priv->emmc_mode >=2 ) + host->pdata->caps2 |=MMC_CAP2_HS200_1_8V_SDR ;
drivers/mmc/host/dw_mmc_cqe-rtk.c line 805
Quoted 10 lines
drivers/mmc/host/dw_mmc_cqe-rtk.c new file +10
-0+if (priv->emmc_mode >=3 ) { + host->pdata->caps |=MMC_CAP_1_8V_DDR ; + host->pdata->caps2 |=MMC_CAP2_HS400_1_8V ; + } + +if (priv->is_cqe >0 ) + host->pdata->caps2 |= (MMC_CAP2_CQE | +MMC_CAP2_CQE_DCMD ); + +/*In Realtek Platform, only using 32bit DMA*/
Use Linux coding style. This driver looks like one for staging, not ready for submission. :/
Quoted 35 lines
drivers/mmc/host/dw_mmc_cqe-rtk.c new file +35
-0+ host->dma_64bit_address =0 ; + +/*In Realtek Platform, do not use PIO mode by default*/ + host->use_dma =TRANS_MODE_DMA ; + + host->irq_flags =IRQF_SHARED ; + +mcq_writel (host,CP ,0x0 ); + +/*Enable L4 gated*/ +mcq_writel (host,OTHER1 ,mcq_readl (host,OTHER1 ) & + ~(SDMMC_L4_GATED_DIS |SDMMC_L4_GATED_DIS1 )); + +mcq_writel (host,OTHER1 ,mcq_readl (host,OTHER1 ) & + (~(SDMMC_DQS_CTRL_GATE_DIS | +SDMMC_DBUS_MAS_GATING_DIS ))); + +/*Set the eMMC wrapper little Endian*/ +mcq_writel (host,AHB ,mcq_readl (host,AHB ) |SDMMC_AHB_BIG ); + +mcq_writel (host,OTHER1 , +mcq_readl (host,OTHER1 ) | +SDMMC_STARK_CARD_STOP_ENABLE ); + +/*set eMMC instead of nand*/ +regmap_update_bits_base (priv->m2tmx,SDMMC_NAND_DMA_SEL , +SDMMC_SRAM_DMA_SEL ,SDMMC_SRAM_DMA_SEL , +NULL , false, true); + +/*Set the clk initial phase*/ +dw_mci_rtk_phase_tuning (host,0 ,0 ); + +return 0 ; +} +
drivers/mmc/host/dw_mmc_cqe-rtk.c line 848
Quoted 10 lines
drivers/mmc/host/dw_mmc_cqe-rtk.c new file +10
-0+#ifdef CONFIG_PM +static int dw_mci_rtk_suspend (struct device *dev) { +struct dw_mci *host =dev_get_drvdata (dev); +int ret =0 ; + + ret =dw_mci_cqe_runtime_suspend (dev); + +mcq_writel (host,AHB ,0 ); +dev_info (dev,"AHB=0x%x, dw_mci_cqe_suspend ret=%d\n" , +mcq_readl (host,AHB ), ret);
Drop useless success/function entry/exit messages..
Quoted 4 lines
drivers/mmc/host/dw_mmc_cqe-rtk.c new file +4
-0+ +return ret; +} +
drivers/mmc/host/dw_mmc_cqe-rtk.c line 863
Quoted 10 lines
drivers/mmc/host/dw_mmc_cqe-rtk.c new file +10
-0+static int dw_mci_rtk_resume (struct device *dev) { +struct dw_mci *host =dev_get_drvdata (dev); +int ret =0 ; + +mcq_writel (host,AHB ,mcq_readl (host,AHB ) |SDMMC_AHB_BIG ); + + ret =dw_mci_cqe_runtime_resume (dev); + +dev_info (dev,"AHB=0x%x, dw_mci_cqe_resume ret=%d\n" , +mcq_readl (host,AHB ), ret);
Drop useless success/function entry/exit messages..
drivers/mmc/host/dw_mmc_cqe-rtk.c line 870
Quoted 6 lines
drivers/mmc/host/dw_mmc_cqe-rtk.c new file +6
-0+ + return ret; +} +#else +static int dw_mci_rtk_suspend (struct device *dev) { +dev_err (dev,"User should enable CONFIG_PM kernel config\n" );
Why? This is not an error. If it were, then it should be build stage error.
Quoted 104 lines
drivers/mmc/host/dw_mmc_cqe-rtk.c new file +104
-0+ +return 0 ; +} + +static int dw_mci_rtk_resume (struct device *dev) { +dev_err (dev,"User should enable CONFIG_PM kernel config\n" ); + +return 0 ; +} +#endif /*CONFIG_PM*/ +static const struct dev_pm_ops rtk_dev_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(dw_mci_rtk_suspend, + dw_mci_rtk_resume) +SET_RUNTIME_PM_OPS (dw_mci_cqe_runtime_suspend, + dw_mci_cqe_runtime_resume, +NULL ) +}; + +static void dw_mci_rtk_shutdown (struct platform_device *pdev) { +dev_info (&pdev->dev,"[eMMC] Shutdown\n" ); +dw_mci_cqe_runtime_resume (&pdev->dev); +} + +static unsigned long dw_mci_rtk_dwmmc_caps[1 ] = { +MMC_CAP_4_BIT_DATA |MMC_CAP_8_BIT_DATA | +MMC_CAP_SD_HIGHSPEED |MMC_CAP_MMC_HIGHSPEED | +MMC_CAP_NONREMOVABLE |MMC_CAP_CMD23 , }; + +static const struct dw_mci_drv_data rtk_drv_data = { + .caps = dw_mci_rtk_dwmmc_caps, + .num_caps =ARRAY_SIZE (dw_mci_rtk_dwmmc_caps), + .set_ios = dw_mci_rtk_set_ios, + .execute_tuning = dw_mci_rtk_execute_tuning, + .parse_dt = dw_mci_rtk_parse_dt, + .init = dw_mci_rtk_init, + .prepare_hs400_tuning = dw_mci_rtk_prepare_hs400_tuning, + .hs400_complete = dw_mci_rtk_hs400_complete, + .init_card = dw_mci_rtk_init_card, +}; + +static const struct of_device_id dw_mci_rtk_match[] = { + { .compatible ="realtek,rtd-dw-cqe-emmc" , + .data = &rtk_drv_data }, + {}, +}; +MODULE_DEVICE_TABLE (of, dw_mci_rtk_match); + +int dw_mci_cqe_pltfm_register (struct platform_device *pdev, +const struct dw_mci_drv_data *drv_data) { +struct dw_mci *host; +struct resource *regs; + + host =devm_kzalloc (&pdev->dev,sizeof (struct dw_mci ),GFP_KERNEL ); +if (!host) +return -ENOMEM ; + + host->irq =platform_get_irq (pdev,0 ); +if (host->irq <0 ) +return host->irq; + + host->drv_data = drv_data; + host->pdev = pdev; + host->dev = &pdev->dev; + host->irq_flags =0 ; + host->pdata = pdev->dev.platform_data; + + regs =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + host->regs =devm_ioremap_resource (&pdev->dev, regs); +if (IS_ERR (host->regs)) +return PTR_ERR (host->regs); + +/* Get registers' physical base address */ + host->phy_regs = regs->start; + +platform_set_drvdata (pdev, host); + +return dw_mci_cqe_probe (host); +} + +static int dw_mci_rtk_probe (struct platform_device *pdev) { +const struct dw_mci_drv_data *drv_data; +const struct of_device_id *match; + +if (!pdev->dev.of_node) +return -ENODEV ; + + match =of_match_node (dw_mci_rtk_match, pdev->dev.of_node); + drv_data = match->data; + +return dw_mci_cqe_pltfm_register (pdev, drv_data); } + +int dw_mci_rtk_remove (struct platform_device *pdev) { +struct dw_mci *host =platform_get_drvdata (pdev); + +dw_mci_cqe_remove (host); +return 0 ; +} + +static struct platform_driver dw_mci_rtk_pltfm_driver = { + .probe = dw_mci_rtk_probe, + .remove = dw_mci_rtk_remove, + .driver = { + .name ="dwmmc_cqe_rtk" , + .of_match_table = dw_mci_rtk_match,
drivers/mmc/host/dw_mmc_cqe-rtk.c line 991
Quoted 10 lines
drivers/mmc/host/dw_mmc_cqe-rtk.c new file +10
-0+ .pm = &rtk_dev_pm_ops, + }, + .shutdown = dw_mci_rtk_shutdown, +}; + +module_platform_driver (dw_mci_rtk_pltfm_driver); + +MODULE_AUTHOR ("<[email protected]>" ); +MODULE_DESCRIPTION (" Specific Driver Extension" ); +MODULE_ALIAS ("platform:dwmmc_cqe_rtk" );
You should not need MODULE_ALIAS() in normal cases. If you need it, usually it means your device ID table is wrong.
Best regards,
Krzysztof
Re: [PATCH V3][3/4] mmc: Add dw mobile mmc cmdq rtk driver
Quoted 5 lines · Jyan Chou [周芷安]
Hi Krzysztof,
Quoted 1 line
Use Linux coding style. This driver looks like one for staging, not ready for submission. :/
We had modified our code to match Linux coding style.
Unfortunately, not much...
Quoted 11 lines
Quoted 5 lines
drivers/mmc/host/dw_mmc_cqe-rtk.c line 848
Quoted 4 lines
drivers/mmc/host/dw_mmc_cqe-rtk.c new file +3
-0+mcq_writel (host,AHB ,0 ); +dev_info (dev,"AHB=0x%x, dw_mci_cqe_suspend ret=%d\n" , +mcq_readl (host,AHB ), ret);Drop useless success/function entry/exit messages..
We had drop useless function.
Quoted 1 line
Why? This is not an error. If it were, then it should be build stage error.
It was our mistake to use
dev_errhere, we had corrected it.
I have no clue what you are referring to. Respond inline as requested by mailing list etiquette.
Quoted 6 lines
Quoted 2 lines
You should not need
MODULE_ALIAS()in normal cases. If you need it, usually it means your device ID table is wrong.We had removed
MODULE_ALIAS().
Please check our new post below, thanks.
https://patchwork.kernel.org/project/linux-mmc/patch/[email protected]/
Please rework the driver from scratch to look like Linux driver. It was not looking at the beginning at all.
Best regards,
Krzysztof
PATCH v3 4/4 dt-bindings: mmc: Add dt-bindings for realtek mmc driver
In reply to Jyan ChouDocument the device-tree bindings for Realtek SoCs mmc driver.
---
v2 -> v3:
- Modify dt-bindings' content and description.
- Fix coding style.
- Update the list of maintainers.
v0 -> v2:
- Add dt-bindings.
---
--- .../bindings/mmc/realtek-dw-mshc.yaml | 150 ++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +150 -0
@@ -0,0 +1,150 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mmc/realtek-dw-mshc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Realtek designware mobile storage host controller + +description: + Realtek uses the Synopsys designware mobile storage host controller + to interface a SoC with storage medium. This file documents the Realtek + specific extensions. + +allOf: + - $ref: synopsys-dw-mshc-common.yaml# + +maintainers: + - Jyan Chou <[email protected]> + +properties: + compatible: + enum: + - realtek,rtd-dw-cqe-emmc + reg: + maxItems: 2 + + reg-names: + maxItems: 2 + + interrupts: + maxItems: 1 + + cqe: + maxItems: 1 + + clocks: + minItems: 2 + maxItems: 4 + + clock-names: + minItems: 2 + maxItems: 4 + + clock-freq-min-max: + description: + Clk frequency should be in the interval. + + resets: + maxItems: 1 + + reset-names: + const: reset + + speed-step: + maxItems: 1 + + pinctrl-0: + description: + should contain default/high speed pin ctrl. + maxItems: 1 + + pinctrl-1: + description: + should contain sdr50 mode pin ctrl. + maxItems: 1 + + pinctrl-2: + description: + should contain ddr50 mode pin ctrl. + maxItems: 1 + + pinctrl-3: + description: + should contain hs200 speed pin ctrl. + maxItems: 1 + + pinctrl-4: + description: + should contain hs400 speed pin ctrl. + maxItems: 1 + + pinctrl-5: + description: + should contain tune0 pin ctrl. + maxItems: 1 + + pinctrl-6: + description: + should contain tune1 pin ctrl. + maxItems: 1 + + pinctrl-7: + description: + should contain tune2 pin ctrl. + maxItems: 1 + + pinctrl-8: + description: + should contain tune3 pin ctrl. + maxItems: 1 + + pinctrl-9: + description: + should contain tune4 pin ctrl. + maxItems: 1 + + pinctrl-names: + maxItems: 10 + +required: + - compatible + - reg + - reg-names + - interrupts + - clocks + - clock-names + - pinctrl-names + +unevaluatedProperties: false + +examples: + - | + emmc: mmc@12000 { + compatible = "realtek,rtd-dw-cqe-emmc"; + reg = <0x00012000 0x00600>, + <0x00012180 0x00060>; + reg-names = "emmc", "cqhci"; + interrupts = <0 42 4>; + clocks = <&cc 22>, <&cc 26>, <&cc 121>, <&cc 122>; + clock-names = "biu", "ciu", "vp0", "vp1"; + clock-freq-min-max = <300000 400000000>; + clock-frequency = <400000>; + vmmc-supply = <®_vcc1v8>; + resets = <&rst 20>; + reset-names = "reset"; + speed-step = <3>; + cqe = <1>; + pinctrl-names = "default", "sdr50", "ddr50", "hs200", "hs400", + "tune0", "tune1", "tune2", "tune3", "tune4"; + pinctrl-0 = <&emmc_pins_sdr50>; + pinctrl-1 = <&emmc_pins_sdr50>; + pinctrl-2 = <&emmc_pins_ddr50>; + pinctrl-3 = <&emmc_pins_hs200>; + pinctrl-4 = <&emmc_pins_hs400>; + pinctrl-5 = <&emmc_pins_tune0>; + pinctrl-6 = <&emmc_pins_tune1>; + pinctrl-7 = <&emmc_pins_tune2>; + pinctrl-8 = <&emmc_pins_tune3>; + pinctrl-9 = <&emmc_pins_tune4>; + };
Signature · 1 line
2.42.0
Re: [PATCH V3][4/4] dt-bindings: mmc: Add dt-bindings for realtek mmc driver
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml
Quoted 23 lines · Jyan Chou
Document the device-tree bindings for Realtek SoCs mmc driver.
Signed-off-by Jyan Chou <[email protected]>---
v2 -> v3:
- Modify dt-bindings' content and description.
- Fix coding style.
- Update the list of maintainers.v0 -> v2:
- Add dt-bindings.
------ .../bindings/mmc/realtek-dw-mshc.yaml | 150 ++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yamlDocumentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +0
-0
Filename matching compatible.
BTW, before you respond, be sure you have fixed your email client. In your last response everything was not properly wrapped (not matching mailing list discussion style).
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml line 7
Quoted 8 lines
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +7
-0@@ -0,0 +1,150 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mmc/realtek-dw-mshc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Realtek designware mobile storage host controller
DesignWare
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml line 10
Quoted 3 lines
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +3
-0+ +description: + Realtek uses the Synopsys designware mobile storage host controller
DesignWare
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml line 23
Quoted 13 lines
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +13
-0+ to interface a SoC with storage medium. This file documents the Realtek + specific extensions. + +allOf: + - $ref: synopsys-dw-mshc-common.yaml# + +maintainers: + - Jyan Chou <[email protected]> + +properties: + compatible: + enum: + - realtek,rtd-dw-cqe-emmc
Compatibles should have SoC-specific part. It does not look like you have one here.
Missing blank line
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml line 25
Quoted 2 lines
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +2
-0+ reg: + maxItems: 2
You need to describe the items.
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml line 28
Quoted 3 lines
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +3
-0+ + reg-names: + maxItems: 2
You need to describe the items.
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml line 34
Quoted 6 lines
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +6
-0+ + interrupts: + maxItems: 1 + + cqe: + maxItems: 1
Looks like some custom property. If it is a generic one, where is it documented? If it is custom, missing vendor prefix and description. Detailed description.
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml line 38
Quoted 4 lines
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +4
-0+ + clocks: + minItems: 2 + maxItems: 4
No. This is variable. You need fixed number of items (because why exactly the same device would have different number of clocks?) and you need to describe them.
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml line 42
Quoted 4 lines
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +4
-0+ + clock-names: + minItems: 2 + maxItems: 4
You need to describe the items.
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml line 46
Quoted 4 lines
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +4
-0+ + clock-freq-min-max: + description: + Clk frequency should be in the interval.
No, drop property.
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml line 52
Quoted 6 lines
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +6
-0+ + resets: + maxItems: 1 + + reset-names: + const: reset
And here you describe the item? The only place when it is not needed? Drop entierly.
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml line 55
Quoted 3 lines
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +3
-0+ + speed-step: + maxItems: 1
Drop.
Quoted 85 lines
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +85
-0+ + pinctrl-0: + description: + should contain default/high speed pin ctrl. + maxItems: 1 + + pinctrl-1: + description: + should contain sdr50 mode pin ctrl. + maxItems: 1 + + pinctrl-2: + description: + should contain ddr50 mode pin ctrl. + maxItems: 1 + + pinctrl-3: + description: + should contain hs200 speed pin ctrl. + maxItems: 1 + + pinctrl-4: + description: + should contain hs400 speed pin ctrl. + maxItems: 1 + + pinctrl-5: + description: + should contain tune0 pin ctrl. + maxItems: 1 + + pinctrl-6: + description: + should contain tune1 pin ctrl. + maxItems: 1 + + pinctrl-7: + description: + should contain tune2 pin ctrl. + maxItems: 1 + + pinctrl-8: + description: + should contain tune3 pin ctrl. + maxItems: 1 + + pinctrl-9: + description: + should contain tune4 pin ctrl. + maxItems: 1 + + pinctrl-names: + maxItems: 10 + +required: + - compatible + - reg + - reg-names + - interrupts + - clocks + - clock-names + - pinctrl-names + +unevaluatedProperties: false + +examples: + - | + emmc: mmc@12000 { + compatible = "realtek,rtd-dw-cqe-emmc"; + reg = <0x00012000 0x00600>, + <0x00012180 0x00060>; + reg-names = "emmc", "cqhci"; + interrupts = <0 42 4>; + clocks = <&cc 22>, <&cc 26>, <&cc 121>, <&cc 122>; + clock-names = "biu", "ciu", "vp0", "vp1"; + clock-freq-min-max = <300000 400000000>; + clock-frequency = <400000>; + vmmc-supply = <®_vcc1v8>; + resets = <&rst 20>; + reset-names = "reset"; + speed-step = <3>; + cqe = <1>; + pinctrl-names = "default", "sdr50", "ddr50", "hs200", "hs400", + "tune0", "tune1", "tune2", "tune3", "tune4"; + pinctrl-0 = <&emmc_pins_sdr50>;
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml line 150
Quoted 10 lines
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +10
-0+ pinctrl-1 = <&emmc_pins_sdr50>; + pinctrl-2 = <&emmc_pins_ddr50>; + pinctrl-3 = <&emmc_pins_hs200>; + pinctrl-4 = <&emmc_pins_hs400>; + pinctrl-5 = <&emmc_pins_tune0>; + pinctrl-6 = <&emmc_pins_tune1>; + pinctrl-7 = <&emmc_pins_tune2>; + pinctrl-8 = <&emmc_pins_tune3>; + pinctrl-9 = <&emmc_pins_tune4>; + };
Fix indentation.
Best regards,
Krzysztof
Re: [PATCH V3][4/4] dt-bindings: mmc: Add dt-bindings for realtek mmc driver
Quoted 80 lines · Krzysztof Kozlowski
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml
Quoted 23 lines · Jyan Chou
Document the device-tree bindings for Realtek SoCs mmc driver.
Signed-off-by Jyan Chou <[email protected]>---
v2 -> v3:
- Modify dt-bindings' content and description.
- Fix coding style.
- Update the list of maintainers.v0 -> v2:
- Add dt-bindings.
------ .../bindings/mmc/realtek-dw-mshc.yaml | 150 ++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yamlDocumentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +0
-0Filename matching compatible.
BTW, before you respond, be sure you have fixed your email client. In your last response everything was not properly wrapped (not matching mailing list discussion style).
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml line 7
Quoted 8 lines
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +7
-0@@ -0,0 +1,150 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mmc/realtek-dw-mshc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Realtek designware mobile storage host controllerDesignWare
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml line 10
Quoted 3 lines
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +3
-0+ +description: + Realtek uses the Synopsys designware mobile storage host controllerDesignWare
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml line 23
Quoted 13 lines
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +13
-0+ to interface a SoC with storage medium. This file documents the Realtek + specific extensions. + +allOf: + - $ref: synopsys-dw-mshc-common.yaml# + +maintainers: + - Jyan Chou <[email protected]> + +properties: + compatible: + enum: + - realtek,rtd-dw-cqe-emmcCompatibles should have SoC-specific part. It does not look like you have one here.
Missing blank line
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml line 25
Quoted 2 lines
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +2
-0+ reg: + maxItems: 2You need to describe the items.
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml line 28
Quoted 3 lines
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +3
-0+ + reg-names: + maxItems: 2You need to describe the items.
Quoted 10 lines
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml line 34
Quoted 6 lines
Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml new file +6
-0+ + interrupts: + maxItems: 1 + + cqe: + maxItems: 1Looks like some custom property. If it is a generic one, where is it documented? If it is custom, missing vendor prefix and description. Detailed description.
There's common properties related to CQE. Use them.
Rob
Rob Herring
maintainerRe: [PATCH V3][4/4] dt-bindings: mmc: Add dt-bindings for realtek mmc driver
In reply to Jyan ChouQuoted 10 lines · Jyan Chou
Document the device-tree bindings for Realtek SoCs mmc driver.
Signed-off-by Jyan Chou <[email protected]>---
v2 -> v3:
- Modify dt-bindings' content and description.
- Fix coding style.
- Update the list of maintainers.
Quoted 8 lines
v0 -> v2:
- Add dt-bindings.
------ .../bindings/mmc/realtek-dw-mshc.yaml | 150 ++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml: cqe: missing type definition /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml: clock-freq-min-max: missing type definition /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mmc/realtek-dw-mshc.yaml: speed-step: missing type definition
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.