Skip to contentSkip to conversation

Add SD/SDIO control driver for Sunplus SP7021 SoC

PATCH Superseded Li-hao Kuo 3 participants 6 messages Dec 24, 2021 – Jan 4, 2022

Subsystems (2)

v3 of 11 Superseded Latest is v11 →

lore
Share & tools
lore

Li-hao Kuo

author
#0 lore raw

v3 cover Add SD/SDIO control driver for Sunplus SP7021 SoC

This is a patch series for SD/SDIO driver for Sunplus SP7021 SoC.

Sunplus SP7021 is an ARM Cortex A7 (4 cores) based SoC. It integrates many peripherals (ex: UART, I2C, SPI, SDIO, eMMC, USB, SD card and etc.) into a single chip. It is designed for industrial control.

Refer to:
https://sunplus-tibbo.atlassian.net/wiki/spaces/doc/overview
https://tibbo.com/store/plus1.html

Li-hao Kuo (2):
mmc: Add SD/SDIO driver for Sunplus SP7021 devicetree bindings mmc Add bindings doc for Sunplus SP7021

 .../devicetree/bindings/mmc/sunplus-sd2.yaml       |   73 ++
 MAINTAINERS                                        |    7 +
 drivers/mmc/host/Kconfig                           |   12 +
 drivers/mmc/host/Makefile                          |    1 +
 drivers/mmc/host/sunplus_sd2.c                     | 1107 ++++++++++++++++++++
 5 files changed, 1200 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml
 create mode 100644 drivers/mmc/host/sunplus_sd2.c
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v3 1/2 mmc: Add SD/SDIO driver for Sunplus SP7021

Add SD/SDIO driver for Sunplus SP7021.

---
Changes in v3:
- Addressed all comments from Mr. Rob Herring
- Modified SD/SDIO driver.

 MAINTAINERS                    |    6 +
 drivers/mmc/host/Kconfig       |   12 +
 drivers/mmc/host/Makefile      |    1 +
 drivers/mmc/host/sunplus_sd2.c | 1107 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 1126 insertions(+)
 create mode 100644 drivers/mmc/host/sunplus_sd2.c
MAINTAINERS +6 -0
index 8912b2c..2c1d9e8 100644
@@ -18242,6 +18242,12 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/net/ethernet/dlink/sundance.c
 
+SUNPLUS SD/SDIO HOST CONTROLLER INTERFACE DRIVER
+M:	Li-hao Kuo <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/mmc/host/sunplus_sd2.c
+
 SUPERH
 M:	Yoshinori Sato <[email protected]>
 M:	Rich Felker <[email protected]>
drivers/mmc/host/Kconfig +12 -0
index 5af8494..612c8af 100644
@@ -1091,5 +1091,17 @@ config MMC_OWL
 	  This selects support for the SD/MMC Host Controller on
 	  Actions Semi Owl SoCs.
 
+config MMC_SP_SDV2
+	tristate "Sunplus SP7021 SD/SDIO Controller"
+	depends on SOC_SP7021 || COMPILE_TEST
+	help
+	  This selects the Sunplus Host Controller Interface
+	  support present in Sunplus SP7021 SoCs. The controller
+	  supports SD/SDIO devices.
+
+	  If you have a controller with this interface, say Y or M here.
+
+	  If unsure, say N.
+
 config MMC_SDHCI_EXTERNAL_DMA
 	bool
drivers/mmc/host/Makefile +1 -0
index ea36d37..167aa5c 100644
@@ -101,6 +101,7 @@ obj-$(CONFIG_MMC_CQHCI)			+= cqhci.o
 cqhci-y					+= cqhci-core.o
 cqhci-$(CONFIG_MMC_CRYPTO)		+= cqhci-crypto.o
 obj-$(CONFIG_MMC_HSQ)			+= mmc_hsq.o
+obj-$(CONFIG_MMC_SP_SDV2)		+= sunplus_sd2.o
 
 ifeq ($(CONFIG_CB710_DEBUG),y)
 	CFLAGS-cb710-mmc	+= -DDEBUG
drivers/mmc/host/sunplus_sd2.c new file +1107 -0

1,107 lines not on this page · raw message

Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH v3 1/2] mmc: Add SD/SDIO driver for Sunplus SP7021

I love your patch! Perhaps something to improve:

Hi Li-hao,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pza/reset/next]
[also build test WARNING on robh/for-next ulf-hansson-mmc-mirror/next linus/master v5.16-rc7 next-20211224] [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]

url:    https://github.com/0day-ci/linux/commits/Li-hao-Kuo/Add-SD-SDIO-control-driver-for-Sunplus-SP7021-SoC/20211224-140704
base:   https://git.pengutronix.de/git/pza/linux reset/next
config: parisc-randconfig-c004-20211228 (https://download.01.org/0day-ci/archive/20211229/202112290015.gY5j9jw5-lkp(a)intel.com/config)
compiler: hppa-linux-gcc (GCC) 11.2.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/16ea62b9e9561c6054da687edb9f8603d1e7a158
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Li-hao-Kuo/Add-SD-SDIO-control-driver-for-Sunplus-SP7021-SoC/20211224-140704 git checkout 16ea62b9e9561c6054da687edb9f8603d1e7a158
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=parisc SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

drivers/mmc/host/sunplus_sd2.c: In function 'spsdc_set_bus_timing':
drivers/mmc/host/sunplus_sd2.c:280:15: warning: variable 'timing_name' set but not used [-Wunused-but-set-variable]

     280 |         char *timing_name;
         |               ^~~~~~~~~~~
   drivers/mmc/host/sunplus_sd2.c: In function 'spsdc_set_bus_width':
   drivers/mmc/host/sunplus_sd2.c:300:13: warning: variable 'bus_width' set but not used [-Wunused-but-set-variable]
     300 |         int bus_width;
         |             ^~~~~~~~~
   drivers/mmc/host/sunplus_sd2.c: At top level:
   drivers/mmc/host/sunplus_sd2.c:743:13: warning: no previous prototype for 'spsdc_irq' [-Wmissing-prototypes]
     743 | irqreturn_t spsdc_irq(int irq, void *dev_id)
         |             ^~~~~~~~~
   drivers/mmc/host/sunplus_sd2.c:849:5: warning: no previous prototype for 'spsdc_get_cd' [-Wmissing-prototypes]
     849 | int spsdc_get_cd(struct mmc_host *mmc)
         |     ^~~~~~~~~~~~
   drivers/mmc/host/sunplus_sd2.c: In function 'spsdc_request':
>> drivers/mmc/host/sunplus_sd2.c:775:9: warning: ignoring return value of 'mutex_lock_interruptible' declared with attribute 'warn_unused_result' [-Wunused-result]
     775 |         mutex_lock_interruptible(&host->mrq_lock);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +775 drivers/mmc/host/sunplus_sd2.c

767
768 static void spsdc_request(struct mmc_host *mmc, struct mmc_request *mrq)
769 {
770 struct spsdc_host *host = mmc_priv(mmc);
771 struct mmc_command *cmd;
772 struct mmc_data *data;
773 int bus_width = mmc->ios.bus_width;
774

 > 775		mutex_lock_interruptible(&host->mrq_lock);

776 host->mrq = mrq;
777 data = mrq->data;
778 cmd = mrq->cmd;
779
780 if (cmd->opcode == SD_IO_RW_EXTENDED && bus_width ==
781 MMC_BUS_WIDTH_4 && data->blocks * data->blksz <= 4) {
782 if (__switch_sdio_bus_width(host, MMC_BUS_WIDTH_1)) {
783 cmd->error = -1;
784 host->mrq = NULL;
785 mutex_unlock(&host->mrq_lock);
786 mmc_request_done(host->mmc, mrq);
787 return;
788 }
789 host->restore_4bit_sdio_bus = 1;
790 }
791
792 spsdc_prepare_cmd(host, cmd);
793 /* we need manually read response R2. */
794 if (unlikely(cmd->flags & MMC_RSP_136)) {
795 spsdc_trigger_transaction(host);
796 spsdc_get_rsp(host, cmd);
797 spsdc_wait_finish(host);
798 spsdc_check_error(host, mrq);
799 host->mrq = NULL;
800 mutex_unlock(&host->mrq_lock);
801 mmc_request_done(host->mmc, mrq);
802 } else {
803 if (data)
804 spsdc_prepare_data(host, data);
805
806 if ((host->dmapio_mode && data) == SPSDC_PIO_MODE) {
807 u32 value;
808 /* pio data transfer do not use interrupt */
809 value = readl(host->base + SPSD2_SD_INT_REG);
810 value &= ~SPSDC_SDINT_SDCMPEN;
811 writel(value, host->base + SPSD2_SD_INT_REG);
812 spsdc_trigger_transaction(host);
813 spsdc_xfer_data_pio(host, data);
814 spsdc_wait_finish(host);
815 spsdc_finish_request(host, mrq);
816 } else {
817 if (!(host->use_int || host->dma_use_int)) {
818 spsdc_trigger_transaction(host);
819 spsdc_wait_finish(host);
820 spsdc_finish_request(host, mrq);
821 } else {
822 spsdc_trigger_transaction(host);
823 }
824 }
825 }
826 }
827

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#3 lore raw

Re: [PATCH v3 1/2] mmc: Add SD/SDIO driver for Sunplus SP7021

In reply to Li-hao Kuo
I love your patch! Perhaps something to improve:

Hi Li-hao,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pza/reset/next]
[also build test WARNING on robh/for-next ulf-hansson-mmc-mirror/next linus/master v5.16-rc7 next-20211224] [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]

url:    https://github.com/0day-ci/linux/commits/Li-hao-Kuo/Add-SD-SDIO-control-driver-for-Sunplus-SP7021-SoC/20211224-140704
base:   https://git.pengutronix.de/git/pza/linux reset/next
config: sparc64-randconfig-c003-20211228 (https://download.01.org/0day-ci/archive/20211230/202112300248.VVmtGRgf-lkp(a)intel.com/config)
compiler: sparc64-linux-gcc (GCC) 11.2.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/16ea62b9e9561c6054da687edb9f8603d1e7a158
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Li-hao-Kuo/Add-SD-SDIO-control-driver-for-Sunplus-SP7021-SoC/20211224-140704 git checkout 16ea62b9e9561c6054da687edb9f8603d1e7a158
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=sparc64 SHELL=/bin/bash drivers/mmc/host/

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

drivers/mmc/host/sunplus_sd2.c: In function 'spsdc_set_bus_timing':

>> drivers/mmc/host/sunplus_sd2.c:280:15: warning: variable 'timing_name' set but not used [-Wunused-but-set-variable]
     280 |         char *timing_name;
         |               ^~~~~~~~~~~
   drivers/mmc/host/sunplus_sd2.c: In function 'spsdc_set_bus_width':
>> drivers/mmc/host/sunplus_sd2.c:300:13: warning: variable 'bus_width' set but not used [-Wunused-but-set-variable]
     300 |         int bus_width;
         |             ^~~~~~~~~
   drivers/mmc/host/sunplus_sd2.c: At top level:
>> drivers/mmc/host/sunplus_sd2.c:743:13: warning: no previous prototype for 'spsdc_irq' [-Wmissing-prototypes]
     743 | irqreturn_t spsdc_irq(int irq, void *dev_id)
         |             ^~~~~~~~~
>> drivers/mmc/host/sunplus_sd2.c:849:5: warning: no previous prototype for 'spsdc_get_cd' [-Wmissing-prototypes]
     849 | int spsdc_get_cd(struct mmc_host *mmc)
         |     ^~~~~~~~~~~~
   drivers/mmc/host/sunplus_sd2.c: In function 'spsdc_drv_probe':
>> drivers/mmc/host/sunplus_sd2.c:980:16: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     980 |         mode = (int)of_device_get_match_data(&pdev->dev);
         |                ^
   In file included from include/linux/notifier.h:14,
                    from include/linux/clk.h:14,
                    from drivers/mmc/host/sunplus_sd2.c:8:
   drivers/mmc/host/sunplus_sd2.c: In function 'spsdc_request':
>> include/linux/mutex.h:188:40: warning: ignoring return value of 'mutex_lock_interruptible_nested' declared with attribute 'warn_unused_result' [-Wunused-result]
     188 | #define mutex_lock_interruptible(lock) mutex_lock_interruptible_nested(lock, 0)
         |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mmc/host/sunplus_sd2.c:775:9: note: in expansion of macro 'mutex_lock_interruptible'
     775 |         mutex_lock_interruptible(&host->mrq_lock);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~
--
   drivers/mmc/host/sunplus_sd2.c:175: warning: Function parameter or member 'host' not described in 'spsdc_wait_finish'
>> drivers/mmc/host/sunplus_sd2.c:175: warning: expecting prototype for wait for transaction done, return(). Prototype was for spsdc_wait_finish() instead
   drivers/mmc/host/sunplus_sd2.c:326: warning: Function parameter or member 'host' not described in 'spsdc_select_mode'
   drivers/mmc/host/sunplus_sd2.c:326: warning: Function parameter or member 'mode' not described in 'spsdc_select_mode'
>> drivers/mmc/host/sunplus_sd2.c:326: warning: expecting prototype for select the working mode of controller(). Prototype was for spsdc_select_mode() instead
>> drivers/mmc/host/sunplus_sd2.c:563: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
    * check if error during transaction.
   drivers/mmc/host/sunplus_sd2.c:705: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
    * 1. unmap scatterlist if needed;
   drivers/mmc/host/sunplus_sd2.c:850: warning: Function parameter or member 'mmc' not described in 'spsdc_get_cd'
>> drivers/mmc/host/sunplus_sd2.c:850: warning: expecting prototype for Return values for the get_cd callback should be(). Prototype was for spsdc_get_cd() instead

vim +/timing_name +280 drivers/mmc/host/sunplus_sd2.c

170
171 /**
172 * wait for transaction done, return -1 if error.
173 */
174 static inline int spsdc_wait_finish(struct spsdc_host *host)

 > 175	{
   176		/* Wait for transaction finish */
   177		unsigned long timeout = jiffies + msecs_to_jiffies(5000);
   178	
   179		while (!time_after(jiffies, timeout)) {
   180			if (readl(host->base + SPSD2_SD_STATE_REG) & SPSDC_STATE_FINISH)
   181				return 0;
   182			if (readl(host->base + SPSD2_SD_STATE_REG) & SPSDC_STATE_ERROR)
   183				return -1;
   184		}
   185		return -1;
   186	}
   187	
   188	static inline int spsdc_wait_sdstatus(struct spsdc_host *host, unsigned int status_bit)
   189	{
   190		unsigned long timeout = jiffies + msecs_to_jiffies(5000);
   191	
   192		while (!time_after(jiffies, timeout)) {
   193			if (readl(host->base + SPSD2_SD_STATUS_REG) & status_bit)
   194				return 0;
   195			if (readl(host->base + SPSD2_SD_STATE_REG) & SPSDC_STATE_ERROR)
   196				return -1;
   197		}
   198		return -1;
   199	}
   200	
   201	#define spsdc_wait_rspbuf_full(host) spsdc_wait_sdstatus(host, SPSDC_STS_RSP_BUF_FULL)
   202	#define spsdc_wait_rxbuf_full(host) spsdc_wait_sdstatus(host, SPSDC_STS_RX_BUF_FULL)
   203	#define spsdc_wait_txbuf_empty(host) spsdc_wait_sdstatus(host, SPSDC_STS_TX_BUF_EMP)
   204	
   205	static void spsdc_get_rsp(struct spsdc_host *host, struct mmc_command *cmd)
   206	{
   207		u32 value0_3, value4_5;
   208	
   209		if (unlikely(!(cmd->flags & MMC_RSP_PRESENT)))
   210			return;
   211		if (unlikely(cmd->flags & MMC_RSP_136)) {
   212			if (spsdc_wait_rspbuf_full(host))
   213				return;
   214			value0_3 = readl(host->base + SPSD2_SD_RSP_BUF0_3_REG);
   215			value4_5 = readl(host->base + SPSD2_SD_RSP_BUF4_5_REG) & 0xffff;
   216			cmd->resp[0] = (value0_3 << 8) | (value4_5 >> 8);
   217			cmd->resp[1] = value4_5 << 24;
   218			if (spsdc_wait_rspbuf_full(host))
   219				return;
   220			value0_3 = readl(host->base + SPSD2_SD_RSP_BUF0_3_REG);
   221			value4_5 = readl(host->base + SPSD2_SD_RSP_BUF4_5_REG) & 0xffff;
   222			cmd->resp[1] |= value0_3 >> 8;
   223			cmd->resp[2] = value0_3 << 24;
   224			cmd->resp[2] |= value4_5 << 8;
   225			if (spsdc_wait_rspbuf_full(host))
   226				return;
   227			value0_3 = readl(host->base + SPSD2_SD_RSP_BUF0_3_REG);
   228			value4_5 = readl(host->base + SPSD2_SD_RSP_BUF4_5_REG) & 0xffff;
   229			cmd->resp[2] |= value0_3 >> 24;
   230			cmd->resp[3] = value0_3 << 8;
   231			cmd->resp[3] |= value4_5 >> 8;
   232		} else {
   233			if (spsdc_wait_rspbuf_full(host))
   234				return;
   235			value0_3 = readl(host->base + SPSD2_SD_RSP_BUF0_3_REG);
   236			value4_5 = readl(host->base + SPSD2_SD_RSP_BUF4_5_REG) & 0xffff;
   237			cmd->resp[0] = (value0_3 << 8) | (value4_5 >> 8);
   238			cmd->resp[1] = value4_5 << 24;
   239		}
   240	}
   241	
   242	static void spsdc_set_bus_clk(struct spsdc_host *host, int clk)
   243	{
   244		unsigned int clkdiv;
   245		int f_min = host->mmc->f_min;
   246		int f_max = host->mmc->f_max;
   247		u32 value = readl(host->base + SPSD2_SD_CONF_REG);
   248	
   249		if (clk < f_min)
   250			clk = f_min;
   251		if (clk > f_max)
   252			clk = f_max;
   253	
   254		// SD 2.0 only max set to 50Mhz CLK
   255		if (clk >= SPSDC_50M_CLK)
   256			clk = f_max;
   257	
   258		clkdiv = (clk_get_rate(host->clk) + clk) / clk - 1;
   259		if (clkdiv > 0xfff)
   260			clkdiv = 0xfff;
   261	
   262		value &= ~SPSDC_CONF_CLK_DIV;
   263		value |= FIELD_PREP(SPSDC_CONF_CLK_DIV, clkdiv);
   264		writel(value, host->base + SPSD2_SD_CONF_REG);
   265		/* In order to reduce the frequency of context switch,
   266		 * if it is high speed or upper, we do not use interrupt
   267		 * when send a command that without data.
   268		 */
   269		if (clk > 25000000)
   270			host->use_int = 0;
   271		else
   272			host->use_int = 1;
   273	}
   274	
   275	static void spsdc_set_bus_timing(struct spsdc_host *host, unsigned int timing)
   276	{
   277		u32 value = readl(host->base + SPSD2_SD_TIMING_CONF0_REG);
   278		int clkdiv = FIELD_GET(SPSDC_CONF_CLK_DIV, readl(host->base + SPSD2_SD_CONF_REG));
   279		int delay = (clkdiv / 2 < 7) ? clkdiv / 2 : 7;
 > 280		char *timing_name;
   281	
   282		switch (timing) {
   283		case MMC_TIMING_LEGACY:
   284			value &= ~SPSDC_TIMING_CONF0_HS_EN;
   285			timing_name = "legacy";
   286			break;
   287		case MMC_TIMING_SD_HS:
   288		case MMC_TIMING_MMC_HS:
   289			value |= SPSDC_TIMING_CONF0_HS_EN |
   290				FIELD_PREP(SPSDC_TIMING_CONF0_WRTD, delay);
   291			timing_name = "hs";
   292			break;
   293		}
   294		writel(value, host->base + SPSD2_SD_TIMING_CONF0_REG);
   295	}
   296	
   297	static void spsdc_set_bus_width(struct spsdc_host *host, int width)
   298	{
   299		u32 value = readl(host->base + SPSD2_SD_CONF_REG);
 > 300		int bus_width;
   301	
   302		switch (width) {
   303		case MMC_BUS_WIDTH_8:
   304			value &= ~SPSDC_CONF_4BIT_MODE;
   305			value |= SPSDC_CONF_MMC8BIT;
   306			bus_width = 8;
   307			break;
   308		case MMC_BUS_WIDTH_4:
   309			value |= SPSDC_CONF_4BIT_MODE;
   310			value &= ~SPSDC_CONF_MMC8BIT;
   311			bus_width = 4;
   312			break;
   313		default:
   314			value &= ~SPSDC_CONF_4BIT_MODE;
   315			value &= ~SPSDC_CONF_MMC8BIT;
   316			bus_width = 1;
   317			break;
   318		};
   319		writel(value, host->base + SPSD2_SD_CONF_REG);
   320	}
   321	
   322	/**
   323	 * select the working mode of controller: sd/sdio/emmc
   324	 */
   325	static void spsdc_select_mode(struct spsdc_host *host, int mode)
 > 326	{

327 u32 value = readl(host->base + SPSD2_SD_CONF_REG);
328
329 host->mode = mode;
330 /* set `sdmmcmode', as it will sample data at fall edge
331 * of SD bus clock if `sdmmcmode' is not set when
332 * `sd_high_speed_en' is not set, which is not compliant
333 * with SD specification
334 */
335 value |= SPSDC_CONF_SD_MODE;
336 switch (mode) {
337 case SPSDC_MODE_EMMC:
338 value &= ~SPSDC_CONF_SDIO_MODE;
339 writel(value, host->base + SPSD2_SD_CONF_REG);
340 break;
341 case SPSDC_MODE_SDIO:
342 value |= SPSDC_CONF_SDIO_MODE;
343 writel(value, host->base + SPSD2_SD_CONF_REG);
344 value = readl(host->base + SPSD2_SDIO_CTRL_REG);
345 value |= SPSDC_SDIO_CTRL_MULTI_TRIG;
346 writel(value, host->base + SPSD2_SDIO_CTRL_REG);
347 break;
348 case SPSDC_MODE_SD:
349 default:
350 value &= ~SPSDC_CONF_SDIO_MODE;
351 host->mode = SPSDC_MODE_SD;
352 writel(value, host->base + SPSD2_SD_CONF_REG);
353 break;
354 }
355 }
356

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

author
#4 lore raw

PATCH v3 2/2 devicetree bindings mmc Add bindings doc for Sunplus SP7021

In reply to Li-hao Kuo

Add devicetree bindings mmc Add bindings doc for Sunplus SP7021

---
Changes in v3:
- Addressed all comments from Mr. Rob Herring
- Modified SD/SDIO driver.

 .../devicetree/bindings/mmc/sunplus-sd2.yaml       | 73 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 2 files changed, 74 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml
Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml new file +73 -0
new file mode 100644
index 0000000..2f96e35
@@ -0,0 +1,73 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright (C) Sunplus Co., Ltd.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mmc/sunplus-sd2.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sunplus SD/SDIO controller
+
+maintainers:
+  - Li-hao Kuo <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - sunplus,sp7021-card
+      - sunplus,sp7021-sdio
+
+  reg:
+    items:
+      - description: Base address and length of the SD/SDIO registers
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  max-frequency: true
+
+allOf:
+  - $ref: "mmc-controller.yaml"
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - resets
+  - pinctrl-names
+  - pinctrl-0
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/sp-sp7021.h>
+    #include <dt-bindings/reset/sp-sp7021.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    sdcard: sdcard@9c003e80 {
+       compatible = "sunplus,sp7021-card";
+       reg = <0x9c003e80 0x280>;
+       interrupts = <21 IRQ_TYPE_LEVEL_HIGH>;
+       clocks = <&clkc CARD_CTL1>;
+       resets = <&rstc RST_CARD_CTL1>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc1_mux &mmc1_mux_cd>;
+       max-frequency = <52000000>;
+    };
+    sdio: mmc@9c008400 {
+       compatible = "sunplus,sp7021-sdio";
+       reg = <0x9c008400 0x280>;
+       interrupts = <21 IRQ_TYPE_LEVEL_HIGH>;
+       clocks = <&clkc CARD_CTL1>;
+       resets = <&rstc RST_CARD_CTL1>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pins_sdio>;
+       max-frequency = <52000000>;
+    };
+...
\ No newline at end of file
MAINTAINERS +1 -0
index 2c1d9e8..297d512 100644
@@ -18246,6 +18246,7 @@ SUNPLUS SD/SDIO HOST CONTROLLER INTERFACE DRIVER
 M:	Li-hao Kuo <[email protected]>
 L:	[email protected]
 S:	Maintained
+F:	Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml
 F:	drivers/mmc/host/sunplus_sd2.c
 
 SUPERH
Signature · 1 line
2.7.4
maintainer
#5 lore raw

Re: [PATCH v3 2/2] devicetree bindings mmc Add bindings doc for Sunplus SP7021

Quoted 6 lines · Li-hao Kuo

Add devicetree bindings mmc Add bindings doc for Sunplus SP7021

---
Changes in v3:
- Addressed all comments from Mr. Rob Herring

No. The subject is still wrong and my comments on compatible still remain. For the latter, I just replied on the original thread.

Quoted 1 line

- Modified SD/SDIO driver.

Wrong patch. And modified how? You need to list the changes from the last version one by one. This list should give the reviewer a clue as to which parts need to be reviewed again so we don't have to review the whole thing again nor remember what we said to change. The reviewer has probably reviewed 10s to 100 patches since the last version and doesn't remember what they said.

Quoted 102 lines
 .../devicetree/bindings/mmc/sunplus-sd2.yaml       | 73 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 2 files changed, 74 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml
Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml new file +73 -0
new file mode 100644
index 0000000..2f96e35
@@ -0,0 +1,73 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright (C) Sunplus Co., Ltd.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mmc/sunplus-sd2.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sunplus SD/SDIO controller
+
+maintainers:
+  - Li-hao Kuo <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - sunplus,sp7021-card
+      - sunplus,sp7021-sdio
+
+  reg:
+    items:
+      - description: Base address and length of the SD/SDIO registers
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  max-frequency: true
+
+allOf:
+  - $ref: "mmc-controller.yaml"
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - resets
+  - pinctrl-names
+  - pinctrl-0
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/sp-sp7021.h>
+    #include <dt-bindings/reset/sp-sp7021.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    sdcard: sdcard@9c003e80 {
+       compatible = "sunplus,sp7021-card";
+       reg = <0x9c003e80 0x280>;
+       interrupts = <21 IRQ_TYPE_LEVEL_HIGH>;
+       clocks = <&clkc CARD_CTL1>;
+       resets = <&rstc RST_CARD_CTL1>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc1_mux &mmc1_mux_cd>;
+       max-frequency = <52000000>;
+    };
+    sdio: mmc@9c008400 {
+       compatible = "sunplus,sp7021-sdio";
+       reg = <0x9c008400 0x280>;
+       interrupts = <21 IRQ_TYPE_LEVEL_HIGH>;
+       clocks = <&clkc CARD_CTL1>;
+       resets = <&rstc RST_CARD_CTL1>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pins_sdio>;
+       max-frequency = <52000000>;
+    };
+...
\ No newline at end of file
MAINTAINERS +1 -0
index 2c1d9e8..297d512 100644
@@ -18246,6 +18246,7 @@ SUNPLUS SD/SDIO HOST CONTROLLER INTERFACE DRIVER
 M:	Li-hao Kuo <[email protected]>
 L:	[email protected]
 S:	Maintained
+F:	Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml
 F:	drivers/mmc/host/sunplus_sd2.c
 
 SUPERH
Signature · 1 line
2.7.4