Skip to contentSkip to conversation

arm: pxa: mmc: add driver model support

PATCH New Marcel Ziswiler 8 participants 33 messages May 20, 2019 – Jun 30, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover arm: pxa: mmc: add driver model support

This series, after some initial clean-up, ultimately adds support for the driver model (DM) in the PXA MMC driver.

Marcel Ziswiler (10):
mmc: add missing space before comment delimiter
mmc: fsl_esdhc: annotate endifs
serial: pxa: clean-up platform data include file
Makefile: allow dm_mmc without of_control
dm: core: gracefully handle alias seq without of
kconfig: mmc: move pxa_mmc_generic to kconfig
arm: pxa: mmc: add driver model support
colibri_pxa270_defconfig: enable cmd_dm
colibri_pxa270: add mmc platform data
colibri_pxa270_defconfig: enable dm_mmc

 Makefile                                      |   2 +-
 board/toradex/colibri_pxa270/colibri_pxa270.c |  20 ++-
 configs/colibri_pxa270_defconfig              |   3 +
 configs/zipitz2_defconfig                     |   1 +
 drivers/core/read.c                           |   4 +-
 drivers/mmc/Kconfig                           |   8 +
 drivers/mmc/fsl_esdhc.c                       |   4 +-
 drivers/mmc/mmc.c                             |   2 +-
 drivers/mmc/pxa_mmc_gen.c                     | 160 +++++++++++++++---
 include/configs/pxa-common.h                  |   7 -
 include/configs/zipitz2.h                     |   8 -
 include/dm/platform_data/pxa_mmc_gen.h        |  22 +++
 include/dm/platform_data/serial_pxa.h         |   8 +-
 include/dm/read.h                             |   4 +
 scripts/config_whitelist.txt                  |   1 -
 15 files changed, 196 insertions(+), 58 deletions(-)
 create mode 100644 include/dm/platform_data/pxa_mmc_gen.h
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/10 mmc: add missing space before comment delimiter

Add missing space before a comment delimiter.

---

 drivers/mmc/mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/mmc.c +1 -1
index 456c1b4cc9..ede528dc5a 100644
@@ -2672,7 +2672,7 @@ retry:
 	if (err)
 		return err;
 
-	/* The internal partition reset to user partition(0) at every CMD0*/
+	/* The internal partition reset to user partition(0) at every CMD0 */
 	mmc_get_blk_desc(mmc)->hwpart = 0;
 
 	/* Test for SD version 2 */
Signature · 1 line
2.21.0
#2 lore raw

PATCH 1/10 mmc: add missing space before comment delimiter

Quoted 16 lines

Subject: [PATCH v1 01/10] mmc: add missing space before comment delimiter

Add missing space before a comment delimiter.

---

 drivers/mmc/mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/mmc.c index renamed from drivers/mmc/mmc.c +0 -0

456c1b4cc9..ede528dc5a 100644

drivers/mmc/mmc.c retry: · line 2676

Quoted 6 lines
drivers/mmc/mmc.c +1 -1
@@ -2672,7 +2672,7 @@ retry:
 	if (err)
 		return err;
 
-	/* The internal partition reset to user partition(0) at every CMD0*/
+	/* The internal partition reset to user partition(0) at every CMD0 */
 	mmc_get_blk_desc(mmc)->hwpart = 0;
Quoted 4 lines
drivers/mmc/mmc.c +0 -1
 	/* Test for SD version 2 */
--

2.21.0

#3 lore raw

PATCH 1/10 mmc: add missing space before comment delimiter

In reply to Marcel Ziswiler
Quoted 26 lines · Marcel Ziswiler

Add missing space before a comment delimiter.

---

 drivers/mmc/mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/mmc.c +1 -2
index 456c1b4cc9..ede528dc5a 100644
@@ -2672,7 +2672,7 @@ retry:
        if (err)
                return err;
 
-       /* The internal partition reset to user partition(0) at every CMD0*/
+       /* The internal partition reset to user partition(0) at every CMD0 */
        mmc_get_blk_desc(mmc)->hwpart = 0;
 
        /* Test for SD version 2 */
--

2.21.0

Quoted 4 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Signature · 8 lines
Best regards - Freundliche Grüsse - Meilleures salutations

Senior Development Engineer,
Igor Opaniuk

Toradex AG
Altsagenstrasse 5 | 6048 Horw/Luzern | Switzerland | T: +41 41 500 48
00 (main line)
#4 lore raw

PATCH 1/10 mmc: add missing space before comment delimiter

In reply to Marcel Ziswiler
Quoted 5 lines · Marcel Ziswiler

Add missing space before a comment delimiter.

Applied to u-boot/next, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200630/40f250c8/attachment.sig>
#5 lore raw

PATCH 2/10 mmc: fsl_esdhc: annotate endifs

In reply to Marcel Ziswiler

Annotate endifs to make CONFIG_IS_ENABLED(DM_MMC) or not more obvious.

---

 drivers/mmc/fsl_esdhc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/fsl_esdhc.c +2 -2
index 1b7de74a72..0742cd64e1 100644
@@ -1372,7 +1372,7 @@ int fsl_esdhc_mmc_init(bd_t *bis)
 	cfg->sdhc_clk = gd->arch.sdhc_clk;
 	return fsl_esdhc_initialize(bis, cfg);
 }
-#endif
+#endif /* !CONFIG_IS_ENABLED(DM_MMC) */
 
 #ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
 void mmc_adapter_card_type_ident(void)
@@ -1635,7 +1635,7 @@ static const struct dm_mmc_ops fsl_esdhc_ops = {
 	.execute_tuning	= fsl_esdhc_execute_tuning,
 #endif
 };
-#endif
+#endif /* CONFIG_IS_ENABLED(DM_MMC) */
 
 static struct esdhc_soc_data usdhc_imx7d_data = {
 	.flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING
Signature · 1 line
2.21.0
#7 lore raw

PATCH 2/10 mmc: fsl_esdhc: annotate endifs

In reply to Marcel Ziswiler
Quoted 24 lines

Subject: [PATCH v1 02/10] mmc: fsl_esdhc: annotate endifs

Annotate endifs to make CONFIG_IS_ENABLED(DM_MMC) or not more obvious.

---

 drivers/mmc/fsl_esdhc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/fsl_esdhc.c index renamed from drivers/mmc/fsl_esdhc.c +0 -0

1b7de74a72..0742cd64e1 100644

drivers/mmc/fsl_esdhc.c +1 -0
@@ -1372,7 +1372,7 @@ int fsl_esdhc_mmc_init(bd_t *bis)
 	cfg->sdhc_clk = gd->arch.sdhc_clk;
 	return fsl_esdhc_initialize(bis, cfg);  } -#endif
+#endif /* !CONFIG_IS_ENABLED(DM_MMC) */
 
 #ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
 void mmc_adapter_card_type_ident(void)

drivers/mmc/fsl_esdhc.c static const struct dm_mmc_ops fsl_esdhc_ops = { · line 1641

Quoted 8 lines
drivers/mmc/fsl_esdhc.c +1 -1
@@ -1635,7 +1635,7 @@ static const struct dm_mmc_ops fsl_esdhc_ops = {
 	.execute_tuning	= fsl_esdhc_execute_tuning,
 #endif
 };
-#endif
+#endif /* CONFIG_IS_ENABLED(DM_MMC) */
 
 static struct esdhc_soc_data usdhc_imx7d_data = {
 	.flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING
Quoted 2 lines

--
2.21.0

#8 lore raw

PATCH 2/10 mmc: fsl_esdhc: annotate endifs

In reply to Marcel Ziswiler
Quoted 35 lines · Marcel Ziswiler

Annotate endifs to make CONFIG_IS_ENABLED(DM_MMC) or not more obvious.

---

 drivers/mmc/fsl_esdhc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/fsl_esdhc.c +2 -3
index 1b7de74a72..0742cd64e1 100644
@@ -1372,7 +1372,7 @@ int fsl_esdhc_mmc_init(bd_t *bis)
        cfg->sdhc_clk = gd->arch.sdhc_clk;
        return fsl_esdhc_initialize(bis, cfg);
 }
-#endif
+#endif /* !CONFIG_IS_ENABLED(DM_MMC) */
 
 #ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
 void mmc_adapter_card_type_ident(void)
@@ -1635,7 +1635,7 @@ static const struct dm_mmc_ops fsl_esdhc_ops = {
        .execute_tuning = fsl_esdhc_execute_tuning,
 #endif
 };
-#endif
+#endif /* CONFIG_IS_ENABLED(DM_MMC) */
 
 static struct esdhc_soc_data usdhc_imx7d_data = {
        .flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING
--

2.21.0

Quoted 4 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Signature · 8 lines
Best regards - Freundliche Grüsse - Meilleures salutations

Senior Development Engineer,
Igor Opaniuk

Toradex AG
Altsagenstrasse 5 | 6048 Horw/Luzern | Switzerland | T: +41 41 500 48
00 (main line)
#9 lore raw

PATCH 3/10 serial: pxa: clean-up platform data include file

In reply to Marcel Ziswiler

Clean-up platform data include file by using BIT macro and converting indentation with spaces to tabs.

---

 include/dm/platform_data/serial_pxa.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
include/dm/platform_data/serial_pxa.h +4 -4
index 408c00885d..b78bdb6409 100644
@@ -17,7 +17,7 @@
 #define FFUART_INDEX	1
 #define STUART_INDEX	2
 #elif CONFIG_CPU_PXA25X
-#define UART_CLK_BASE	(1 << 4)	/* HWUART */
+#define UART_CLK_BASE	BIT(4)	/* HWUART */
 #define UART_CLK_REG	CKEN
 #define HWUART_INDEX	0
 #define STUART_INDEX	1
@@ -42,9 +42,9 @@
 /*
  * struct pxa_serial_platdata - information about a PXA port
  *
- * @base:               Uart port base register address
- * @port:               Uart port index, for cpu with pinmux for uart / gpio
- * baudrtatre:          Uart port baudrate
+ * @base:	Uart port base register address
+ * @port:	Uart port index, for cpu with pinmux for uart / gpio
+ * baudrtatre:	Uart port baudrate
  */
 struct pxa_serial_platdata {
 	struct pxa_uart_regs *base;
Signature · 1 line
2.21.0
#10 lore raw

PATCH 3/10 serial: pxa: clean-up platform data include file

Quoted 24 lines · Marcel Ziswiler

Clean-up platform data include file by using BIT macro and converting indentation with spaces to tabs.

---

 include/dm/platform_data/serial_pxa.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
include/dm/platform_data/serial_pxa.h +1 -1
index 408c00885d..b78bdb6409 100644
@@ -17,7 +17,7 @@
 #define FFUART_INDEX	1
 #define STUART_INDEX	2
 #elif CONFIG_CPU_PXA25X
-#define UART_CLK_BASE	(1 << 4)	/* HWUART */
+#define UART_CLK_BASE	BIT(4)	/* HWUART */
 #define UART_CLK_REG	CKEN
 #define HWUART_INDEX	0
 #define STUART_INDEX	1

include/dm/platform_data/serial_pxa.h line 47

Quoted 9 lines
include/dm/platform_data/serial_pxa.h +3 -3
@@ -42,9 +42,9 @@
 /*
  * struct pxa_serial_platdata - information about a PXA port
  *
- * @base:               Uart port base register address
- * @port:               Uart port index, for cpu with pinmux for uart / gpio
- * baudrtatre:          Uart port baudrate
+ * @base:	Uart port base register address
+ * @port:	Uart port index, for cpu with pinmux for uart / gpio
+ * baudrtatre:	Uart port baudrate

So while we're messing around with this, can we also s/[uU]art/UART/ and s/cpu/CPU/ and s/gpio/GPIO/ ?

Quoted 4 lines
include/dm/platform_data/serial_pxa.h +0 -0
  */
 struct pxa_serial_platdata {
 	struct pxa_uart_regs *base;
Signature · 2 lines
Best regards,
Marek Vasut
#11 lore raw

PATCH 3/10 serial: pxa: clean-up platform data include file

In reply to Marcel Ziswiler
Quoted 4 lines · Marcel Ziswiler

Clean-up platform data include file by using BIT macro and converting indentation with spaces to tabs.

Applied to u-boot/next, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200630/987d0983/attachment.sig>
#12 lore raw

PATCH 4/10 Makefile: allow dm_mmc without of_control

In reply to Marcel Ziswiler

Allow for CONFIG_DM_MMC with platform data rather than CONFIG_OF_CONTROL.

---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 6eb08a5724..eb08aaea75 100644
@@ -926,7 +926,7 @@ ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y)
 	@echo >&2 "===================================================="
 endif
 ifeq ($(CONFIG_MMC),y)
-ifneq ($(CONFIG_DM_MMC)$(CONFIG_OF_CONTROL)$(CONFIG_BLK),yyy)
+ifneq ($(CONFIG_DM_MMC)$(CONFIG_BLK),yy)
 	@echo >&2 "===================== WARNING ======================"
 	@echo >&2 "This board does not use CONFIG_DM_MMC. Please update"
 	@echo >&2 "the board to use CONFIG_DM_MMC before the v2019.04 release."
Signature · 1 line
2.21.0
#13 lore raw

PATCH 4/10 Makefile: allow dm_mmc without of_control

Hi Marcel,

Quoted 3 lines · Marcel Ziswiler

Allow for CONFIG_DM_MMC with platform data rather than CONFIG_OF_CONTROL.

I don't think we want this.

Or put it another way, why do we want this? Can you add a motivation here?

Can you use OF_PLATDATA instead?

Quoted 7 lines

---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Regards,
Simon

#14 lore raw

PATCH 4/10 Makefile: allow dm_mmc without of_control

In reply to Marcel Ziswiler
Quoted 4 lines · Marcel Ziswiler

Allow for CONFIG_DM_MMC with platform data rather than CONFIG_OF_CONTROL.

Applied to u-boot/next, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200630/76a4bdc8/attachment.sig>
#15 lore raw

PATCH 5/10 dm: core: gracefully handle alias seq without of

In reply to Marcel Ziswiler

Gracefully handle alias seq in the platform data rather than OF case.

---

 drivers/core/read.c | 4 +++-
 include/dm/read.h   | 4 ++++
 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/core/read.c +3 -1
index 6bda077a34..670ffe5dc5 100644
@@ -212,15 +212,17 @@ int dev_read_alias_seq(struct udevice *dev, int *devnump)
 {
 	ofnode node = dev_ofnode(dev);
 	const char *uc_name = dev->uclass->uc_drv->name;
-	int ret;
+	int ret = -ENOTSUPP;
 
 	if (ofnode_is_np(node)) {
 		ret = of_alias_get_id(ofnode_to_np(node), uc_name);
 		if (ret >= 0)
 			*devnump = ret;
 	} else {
+#if CONFIG_IS_ENABLED(OF_CONTROL)
 		ret = fdtdec_get_alias_seq(gd->fdt_blob, uc_name,
 					   ofnode_to_offset(node), devnump);
+#endif
 	}
 
 	return ret;
include/dm/read.h +4 -0
index 60b727cbd8..a8ffbe42ac 100644
@@ -702,8 +702,12 @@ static inline const void *dev_read_prop(struct udevice *dev,
 
 static inline int dev_read_alias_seq(struct udevice *dev, int *devnump)
 {
+#if CONFIG_IS_ENABLED(OF_CONTROL)
 	return fdtdec_get_alias_seq(gd->fdt_blob, dev->uclass->uc_drv->name,
 				    dev_of_offset(dev), devnump);
+#else
+	return -ENOTSUPP;
+#endif
 }
 
 static inline int dev_read_u32_array(struct udevice *dev, const char *propname,
Signature · 1 line
2.21.0
#16 lore raw

PATCH 5/10 dm: core: gracefully handle alias seq without of

Hi Marcel,

Quoted 2 lines · Marcel Ziswiler

Gracefully handle alias seq in the platform data rather than OF case.

I don't understand why this is needed or what it does.

Also if this is changing behaviour, then there should be a test for it.

Regards,
Simon

#17 lore raw

PATCH 5/10 dm: core: gracefully handle alias seq without of

In reply to Marcel Ziswiler
Quoted 3 lines · Marcel Ziswiler

Gracefully handle alias seq in the platform data rather than OF case.

Applied to u-boot/next, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200630/11dbe921/attachment.sig>
#18 lore raw

PATCH 6/10 kconfig: mmc: move pxa_mmc_generic to kconfig

In reply to Marcel Ziswiler

Move CONFIG_PXA_MMC_GENERIC to Kconfig.

---

 configs/colibri_pxa270_defconfig | 1 +
 configs/zipitz2_defconfig        | 1 +
 drivers/mmc/Kconfig              | 8 ++++++++
 include/configs/pxa-common.h     | 7 -------
 include/configs/zipitz2.h        | 8 --------
 scripts/config_whitelist.txt     | 1 -
 6 files changed, 10 insertions(+), 16 deletions(-)
configs/colibri_pxa270_defconfig +1 -0
index 492ee9eaaf..a3c07d5887 100644
@@ -27,6 +27,7 @@ CONFIG_CMD_FAT=y
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM=y
+CONFIG_PXA_MMC_GENERIC=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
configs/zipitz2_defconfig +1 -0
index 509adcffd9..9590d16593 100644
@@ -11,6 +11,7 @@ CONFIG_HUSH_PARSER=y
 # CONFIG_AUTO_COMPLETE is not set
 CONFIG_SYS_PROMPT="$ "
 CONFIG_CMD_MMC=y
+CONFIG_PXA_MMC_GENERIC=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
drivers/mmc/Kconfig +8 -0
index c23299ea96..d89140e520 100644
@@ -274,6 +274,14 @@ config MMC_PCI
 
 	  If unsure, say N.
 
+config PXA_MMC_GENERIC
+	bool "Support for MMC controllers on PXA"
+	help
+	  This selects MMC controllers on PXA.
+	  If you are on a PXA architecture, say Y here.
+
+	  If unsure, say N.
+
 config MMC_OMAP_HS
 	bool "TI OMAP High Speed Multimedia Card Interface support"
 	select DM_REGULATOR_PBIAS if DM_MMC && DM_REGULATOR
include/configs/pxa-common.h +0 -7
index e25800a095..ba315b3fb8 100644
@@ -17,13 +17,6 @@
 #define	CONFIG_KGDB_BAUDRATE		230400
 #endif
 
-/*
- * MMC Card Configuration
- */
-#ifdef	CONFIG_CMD_MMC
-#define	CONFIG_PXA_MMC_GENERIC
-#endif
-
 /*
  * OHCI USB
  */
include/configs/zipitz2.h +0 -8
index 24fea68a11..cf8f6ff671 100644
@@ -47,14 +47,6 @@
  * Bootloader Components Configuration
  */
 
-/*
- * MMC Card Configuration
- */
-#ifdef	CONFIG_CMD_MMC
-#define	CONFIG_PXA_MMC_GENERIC
-#define	CONFIG_SYS_MMC_BASE		0xF0000000
-#endif
-
 /*
  * SPI and LCD
  */
scripts/config_whitelist.txt +0 -1
index b16bc6ae34..511287ada0 100644
@@ -1533,7 +1533,6 @@ CONFIG_PSRAM_SCFG
 CONFIG_PWM
 CONFIG_PWM_IMX
 CONFIG_PXA_LCD
-CONFIG_PXA_MMC_GENERIC
 CONFIG_PXA_PWR_I2C
 CONFIG_PXA_STD_I2C
 CONFIG_PXA_VGA
Signature · 1 line
2.21.0
#19 lore raw

PATCH 6/10 kconfig: mmc: move pxa_mmc_generic to kconfig

Quoted 7 lines · Marcel Ziswiler

Move CONFIG_PXA_MMC_GENERIC to Kconfig.

---

Quoted 7 lines
 configs/colibri_pxa270_defconfig | 1 +
 configs/zipitz2_defconfig        | 1 +
 drivers/mmc/Kconfig              | 8 ++++++++
 include/configs/pxa-common.h     | 7 -------
 include/configs/zipitz2.h        | 8 --------
 scripts/config_whitelist.txt     | 1 -
 6 files changed, 10 insertions(+), 16 deletions(-)
#20 lore raw

PATCH 6/10 kconfig: mmc: move pxa_mmc_generic to kconfig

In reply to Marcel Ziswiler
Quoted 4 lines · Marcel Ziswiler

Move CONFIG_PXA_MMC_GENERIC to Kconfig.

Applied to u-boot/next, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200630/037f170d/attachment.sig>
#21 lore raw

PATCH 7/10 arm: pxa: mmc: add driver model support

In reply to Marcel Ziswiler

Add driver model (DM) support.

---

 drivers/mmc/pxa_mmc_gen.c              | 160 ++++++++++++++++++++-----
 include/dm/platform_data/pxa_mmc_gen.h |  22 ++++
 2 files changed, 154 insertions(+), 28 deletions(-)
 create mode 100644 include/dm/platform_data/pxa_mmc_gen.h
drivers/mmc/pxa_mmc_gen.c +132 -28
index a4dcdb5cff..08a5ca36a1 100644
@@ -2,6 +2,9 @@
 /*
  * Copyright (C) 2010 Marek Vasut <[email protected]>
  *
+ * Modified to add driver model (DM) support
+ * Copyright (C) 2019 Marcel Ziswiler <[email protected]>
+ *
  * Loosely based on the old code and Linux's PXA MMC driver
  */
 
@@ -10,6 +13,8 @@
 #include <asm/arch/regs-mmc.h>
 #include <linux/errno.h>
 #include <asm/io.h>
+#include <dm.h>
+#include <dm/platform_data/pxa_mmc_gen.h>
 #include <malloc.h>
 #include <mmc.h>
 
@@ -95,7 +100,7 @@ static int pxa_mmc_stop_clock(struct mmc *mmc)
 }
 
 static int pxa_mmc_start_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
-				uint32_t cmdat)
+			     uint32_t cmdat)
 {
 	struct pxa_mmc_priv *priv = mmc->priv;
 	struct pxa_mmc_regs *regs = priv->regs;
@@ -142,7 +147,7 @@ static int pxa_mmc_cmd_done(struct mmc *mmc, struct mmc_cmd *cmd)
 {
 	struct pxa_mmc_priv *priv = mmc->priv;
 	struct pxa_mmc_regs *regs = priv->regs;
-	uint32_t a, b, c;
+	u32 a, b, c;
 	int i;
 	int stat;
 
@@ -151,7 +156,7 @@ static int pxa_mmc_cmd_done(struct mmc *mmc, struct mmc_cmd *cmd)
 
 	/*
 	 * Linux says:
-	 * Did I mention this is Sick.  We always need to
+	 * Did I mention this is Sick. We always need to
 	 * discard the upper 8 bits of the first 16-bit word.
 	 */
 	a = readl(&regs->res) & 0xffff;
@@ -163,13 +168,13 @@ static int pxa_mmc_cmd_done(struct mmc *mmc, struct mmc_cmd *cmd)
 	}
 
 	/* The command response didn't arrive */
-	if (stat & MMC_STAT_TIME_OUT_RESPONSE)
+	if (stat & MMC_STAT_TIME_OUT_RESPONSE) {
 		return -ETIMEDOUT;
-	else if (stat & MMC_STAT_RES_CRC_ERROR
-			&& cmd->resp_type & MMC_RSP_CRC) {
-#ifdef	PXAMMC_CRC_SKIP
-		if (cmd->resp_type & MMC_RSP_136
-				&& cmd->response[0] & (1 << 31))
+	} else if (stat & MMC_STAT_RES_CRC_ERROR &&
+		   cmd->resp_type & MMC_RSP_CRC) {
+#ifdef PXAMMC_CRC_SKIP
+		if (cmd->resp_type & MMC_RSP_136 &&
+		    cmd->response[0] & (1 << 31))
 			printf("Ignoring CRC, this may be dangerous!\n");
 		else
 #endif
@@ -184,8 +189,8 @@ static int pxa_mmc_do_read_xfer(struct mmc *mmc, struct mmc_data *data)
 {
 	struct pxa_mmc_priv *priv = mmc->priv;
 	struct pxa_mmc_regs *regs = priv->regs;
-	uint32_t len;
-	uint32_t *buf = (uint32_t *)data->dest;
+	u32 len;
+	u32 *buf = (uint32_t *)data->dest;
 	int size;
 	int ret;
 
@@ -201,7 +206,6 @@ static int pxa_mmc_do_read_xfer(struct mmc *mmc, struct mmc_data *data)
 			/* Read data into the buffer */
 			while (size--)
 				*buf++ = readl(&regs->rxfifo);
-
 		}
 
 		if (readl(&regs->stat) & MMC_STAT_ERRORS)
@@ -220,8 +224,8 @@ static int pxa_mmc_do_write_xfer(struct mmc *mmc, struct mmc_data *data)
 {
 	struct pxa_mmc_priv *priv = mmc->priv;
 	struct pxa_mmc_regs *regs = priv->regs;
-	uint32_t len;
-	uint32_t *buf = (uint32_t *)data->src;
+	u32 len;
+	u32 *buf = (uint32_t *)data->src;
 	int size;
 	int ret;
 
@@ -258,12 +262,11 @@ static int pxa_mmc_do_write_xfer(struct mmc *mmc, struct mmc_data *data)
 	return 0;
 }
 
-static int pxa_mmc_request(struct mmc *mmc, struct mmc_cmd *cmd,
-				struct mmc_data *data)
+static int pxa_mmc_send_cmd_common(struct pxa_mmc_priv *priv, struct mmc *mmc,
+				   struct mmc_cmd *cmd, struct mmc_data *data)
 {
-	struct pxa_mmc_priv *priv = mmc->priv;
 	struct pxa_mmc_regs *regs = priv->regs;
-	uint32_t cmdat = 0;
+	u32 cmdat = 0;
 	int ret;
 
 	/* Stop the controller */
@@ -312,12 +315,11 @@ static int pxa_mmc_request(struct mmc *mmc, struct mmc_cmd *cmd,
 	return 0;
 }
 
-static int pxa_mmc_set_ios(struct mmc *mmc)
+static int pxa_mmc_set_ios_common(struct pxa_mmc_priv *priv, struct mmc *mmc)
 {
-	struct pxa_mmc_priv *priv = mmc->priv;
 	struct pxa_mmc_regs *regs = priv->regs;
-	uint32_t tmp;
-	uint32_t pxa_mmc_clock;
+	u32 tmp;
+	u32 pxa_mmc_clock;
 
 	if (!mmc->clock) {
 		pxa_mmc_stop_clock(mmc);
@@ -345,9 +347,8 @@ static int pxa_mmc_set_ios(struct mmc *mmc)
 	return 0;
 }
 
-static int pxa_mmc_init(struct mmc *mmc)
+static int pxa_mmc_init_common(struct pxa_mmc_priv *priv, struct mmc *mmc)
 {
-	struct pxa_mmc_priv *priv = mmc->priv;
 	struct pxa_mmc_regs *regs = priv->regs;
 
 	/* Make sure the clock are stopped */
@@ -361,10 +362,34 @@ static int pxa_mmc_init(struct mmc *mmc)
 
 	/* Mask all interrupts */
 	writel(~(MMC_I_MASK_TXFIFO_WR_REQ | MMC_I_MASK_RXFIFO_RD_REQ),
-		&regs->i_mask);
+	       &regs->i_mask);
+
 	return 0;
 }
 
+#if !CONFIG_IS_ENABLED(DM_MMC)
+static int pxa_mmc_init(struct mmc *mmc)
+{
+	struct pxa_mmc_priv *priv = mmc->priv;
+
+	return pxa_mmc_init_common(priv, mmc);
+}
+
+static int pxa_mmc_request(struct mmc *mmc, struct mmc_cmd *cmd,
+			   struct mmc_data *data)
+{
+	struct pxa_mmc_priv *priv = mmc->priv;
+
+	return pxa_mmc_send_cmd_common(priv, mmc, cmd, data);
+}
+
+static int pxa_mmc_set_ios(struct mmc *mmc)
+{
+	struct pxa_mmc_priv *priv = mmc->priv;
+
+	return pxa_mmc_set_ios_common(priv, mmc);
+}
+
 static const struct mmc_ops pxa_mmc_ops = {
 	.send_cmd	= pxa_mmc_request,
 	.set_ios	= pxa_mmc_set_ios,
@@ -385,7 +410,7 @@ int pxa_mmc_register(int card_index)
 {
 	struct mmc *mmc;
 	struct pxa_mmc_priv *priv;
-	uint32_t reg;
+	u32 reg;
 	int ret = -ENOMEM;
 
 	priv = malloc(sizeof(struct pxa_mmc_priv));
@@ -404,7 +429,7 @@ int pxa_mmc_register(int card_index)
 	default:
 		ret = -EINVAL;
 		printf("PXA MMC: Invalid MMC controller ID (card_index = %d)\n",
-			card_index);
+		       card_index);
 		goto err1;
 	}
 
@@ -419,7 +444,7 @@ int pxa_mmc_register(int card_index)
 #endif
 
 	mmc = mmc_create(&pxa_mmc_cfg, priv);
-	if (mmc == NULL)
+	if (!mmc)
 		goto err1;
 
 	return 0;
@@ -429,3 +454,82 @@ err1:
 err0:
 	return ret;
 }
+#else /* !CONFIG_IS_ENABLED(DM_MMC) */
+static int pxa_mmc_probe(struct udevice *dev)
+{
+	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+	struct pxa_mmc_plat *plat = dev_get_platdata(dev);
+	struct mmc_config *cfg = &plat->cfg;
+	struct mmc *mmc = &plat->mmc;
+	struct pxa_mmc_priv *priv = dev_get_priv(dev);
+	u32 reg;
+
+	upriv->mmc = mmc;
+
+	cfg->b_max	= CONFIG_SYS_MMC_MAX_BLK_COUNT;
+	cfg->f_max	= PXAMMC_MAX_SPEED;
+	cfg->f_min	= PXAMMC_MIN_SPEED;
+	cfg->host_caps	= PXAMMC_HOST_CAPS;
+	cfg->name	= dev->name;
+	cfg->voltages	= MMC_VDD_32_33 | MMC_VDD_33_34;
+
+	mmc->priv = priv;
+
+	priv->regs = plat->base;
+
+#ifndef	CONFIG_CPU_MONAHANS	/* PXA2xx */
+	reg = readl(CKEN);
+	reg |= CKEN12_MMC;
+	writel(reg, CKEN);
+#else				/* PXA3xx */
+	reg = readl(CKENA);
+	reg |= CKENA_12_MMC0 | CKENA_13_MMC1;
+	writel(reg, CKENA);
+#endif
+
+	return pxa_mmc_init_common(priv, mmc);
+}
+
+static int pxa_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
+			    struct mmc_data *data)
+{
+	struct pxa_mmc_plat *plat = dev_get_platdata(dev);
+	struct pxa_mmc_priv *priv = dev_get_priv(dev);
+
+	return pxa_mmc_send_cmd_common(priv, &plat->mmc, cmd, data);
+}
+
+static int pxa_mmc_set_ios(struct udevice *dev)
+{
+	struct pxa_mmc_plat *plat = dev_get_platdata(dev);
+	struct pxa_mmc_priv *priv = dev_get_priv(dev);
+
+	return pxa_mmc_set_ios_common(priv, &plat->mmc);
+}
+
+static const struct dm_mmc_ops pxa_mmc_ops = {
+	.get_cd			= NULL,
+	.send_cmd		= pxa_mmc_send_cmd,
+	.set_ios		= pxa_mmc_set_ios,
+};
+
+#if CONFIG_IS_ENABLED(BLK)
+static int pxa_mmc_bind(struct udevice *dev)
+{
+	struct pxa_mmc_plat *plat = dev_get_platdata(dev);
+
+	return mmc_bind(dev, &plat->mmc, &plat->cfg);
+}
+#endif
+
+U_BOOT_DRIVER(pxa_mmc) = {
+#if CONFIG_IS_ENABLED(BLK)
+	.bind	= pxa_mmc_bind,
+#endif
+	.id	= UCLASS_MMC,
+	.name	= "pxa_mmc",
+	.ops	= &pxa_mmc_ops,
+	.priv_auto_alloc_size = sizeof(struct pxa_mmc_priv),
+	.probe	= pxa_mmc_probe,
+};
+#endif /* !CONFIG_IS_ENABLED(DM_MMC) */
include/dm/platform_data/pxa_mmc_gen.h new file +22 -0
new file mode 100644
index 0000000000..9875bab2cf
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2019 Marcel Ziswiler <[email protected]>
+ */
+
+#ifndef __PXA_MMC_GEN_H
+#define __PXA_MMC_GEN_H
+
+#include <mmc.h>
+
+/*
+ * struct pxa_mmc_platdata - information about a PXA MMC controller
+ *
+ * @base:	MMC controller base register address
+ */
+struct pxa_mmc_plat {
+	struct mmc_config	cfg;
+	struct mmc		mmc;
+	struct pxa_mmc_regs	*base;
+};
+
+#endif /* __PXA_MMC_GEN_H */
Signature · 1 line
2.21.0
#22 lore raw

PATCH 7/10 arm: pxa: mmc: add driver model support

Quoted 35 lines · Marcel Ziswiler

Add driver model (DM) support.

---

 drivers/mmc/pxa_mmc_gen.c              | 160 ++++++++++++++++++++-----
 include/dm/platform_data/pxa_mmc_gen.h |  22 ++++
 2 files changed, 154 insertions(+), 28 deletions(-)
 create mode 100644 include/dm/platform_data/pxa_mmc_gen.h
drivers/mmc/pxa_mmc_gen.c +5 -0
index a4dcdb5cff..08a5ca36a1 100644
@@ -2,6 +2,9 @@
 /*
  * Copyright (C) 2010 Marek Vasut <[email protected]>
  *
+ * Modified to add driver model (DM) support
+ * Copyright (C) 2019 Marcel Ziswiler <[email protected]>
+ *
  * Loosely based on the old code and Linux's PXA MMC driver
  */
 
@@ -10,6 +13,8 @@
 #include <asm/arch/regs-mmc.h>
 #include <linux/errno.h>
 #include <asm/io.h>
+#include <dm.h>
+#include <dm/platform_data/pxa_mmc_gen.h>
 #include <malloc.h>
 #include <mmc.h>
 

drivers/mmc/pxa_mmc_gen.c static int pxa_mmc_stop_clock(struct mmc *mmc) · line 103

Quoted 5 lines
drivers/mmc/pxa_mmc_gen.c +1 -1
@@ -95,7 +100,7 @@ static int pxa_mmc_stop_clock(struct mmc *mmc)
 }
 
 static int pxa_mmc_start_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
-				uint32_t cmdat)
+			     uint32_t cmdat)

u32 just like you do in the next hunk ?

I think you might want to split the cleanup from DM conversion.

Quoted 28 lines
drivers/mmc/pxa_mmc_gen.c +3 -3
 {
 	struct pxa_mmc_priv *priv = mmc->priv;
 	struct pxa_mmc_regs *regs = priv->regs;
@@ -142,7 +147,7 @@ static int pxa_mmc_cmd_done(struct mmc *mmc, struct mmc_cmd *cmd)
 {
 	struct pxa_mmc_priv *priv = mmc->priv;
 	struct pxa_mmc_regs *regs = priv->regs;
-	uint32_t a, b, c;
+	u32 a, b, c;
 	int i;
 	int stat;
 
@@ -151,7 +156,7 @@ static int pxa_mmc_cmd_done(struct mmc *mmc, struct mmc_cmd *cmd)
 
 	/*
 	 * Linux says:
-	 * Did I mention this is Sick.  We always need to
+	 * Did I mention this is Sick. We always need to
 	 * discard the upper 8 bits of the first 16-bit word.
 	 */
 	a = readl(&regs->res) & 0xffff;
@@ -163,13 +168,13 @@ static int pxa_mmc_cmd_done(struct mmc *mmc, struct mmc_cmd *cmd)
 	}
 
 	/* The command response didn't arrive */
-	if (stat & MMC_STAT_TIME_OUT_RESPONSE)
+	if (stat & MMC_STAT_TIME_OUT_RESPONSE) {
 		return -ETIMEDOUT;

drivers/mmc/pxa_mmc_gen.c static int pxa_mmc_cmd_done(struct mmc *mmc, struct mmc_cmd *cmd) · line 177

Quoted 10 lines
drivers/mmc/pxa_mmc_gen.c +5 -5
-	else if (stat & MMC_STAT_RES_CRC_ERROR
-			&& cmd->resp_type & MMC_RSP_CRC) {
-#ifdef	PXAMMC_CRC_SKIP
-		if (cmd->resp_type & MMC_RSP_136
-				&& cmd->response[0] & (1 << 31))
+	} else if (stat & MMC_STAT_RES_CRC_ERROR &&
+		   cmd->resp_type & MMC_RSP_CRC) {
+#ifdef PXAMMC_CRC_SKIP
+		if (cmd->resp_type & MMC_RSP_136 &&
+		    cmd->response[0] & (1 << 31))

BIT(31)

[...]

Quoted 75 lines
drivers/mmc/pxa_mmc_gen.c +44 -3
+#if !CONFIG_IS_ENABLED(DM_MMC)
+static int pxa_mmc_init(struct mmc *mmc)
+{
+	struct pxa_mmc_priv *priv = mmc->priv;
+
+	return pxa_mmc_init_common(priv, mmc);
+}
+
+static int pxa_mmc_request(struct mmc *mmc, struct mmc_cmd *cmd,
+			   struct mmc_data *data)
+{
+	struct pxa_mmc_priv *priv = mmc->priv;
+
+	return pxa_mmc_send_cmd_common(priv, mmc, cmd, data);
+}
+
+static int pxa_mmc_set_ios(struct mmc *mmc)
+{
+	struct pxa_mmc_priv *priv = mmc->priv;
+
+	return pxa_mmc_set_ios_common(priv, mmc);
+}
+
 static const struct mmc_ops pxa_mmc_ops = {
 	.send_cmd	= pxa_mmc_request,
 	.set_ios	= pxa_mmc_set_ios,
@@ -385,7 +410,7 @@ int pxa_mmc_register(int card_index)
 {
 	struct mmc *mmc;
 	struct pxa_mmc_priv *priv;
-	uint32_t reg;
+	u32 reg;
 	int ret = -ENOMEM;
 
 	priv = malloc(sizeof(struct pxa_mmc_priv));
@@ -404,7 +429,7 @@ int pxa_mmc_register(int card_index)
 	default:
 		ret = -EINVAL;
 		printf("PXA MMC: Invalid MMC controller ID (card_index = %d)\n",
-			card_index);
+		       card_index);
 		goto err1;
 	}
 
@@ -419,7 +444,7 @@ int pxa_mmc_register(int card_index)
 #endif
 
 	mmc = mmc_create(&pxa_mmc_cfg, priv);
-	if (mmc == NULL)
+	if (!mmc)
 		goto err1;
 
 	return 0;
@@ -429,3 +454,82 @@ err1:
 err0:
 	return ret;
 }
+#else /* !CONFIG_IS_ENABLED(DM_MMC) */
+static int pxa_mmc_probe(struct udevice *dev)
+{
+	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+	struct pxa_mmc_plat *plat = dev_get_platdata(dev);
+	struct mmc_config *cfg = &plat->cfg;
+	struct mmc *mmc = &plat->mmc;
+	struct pxa_mmc_priv *priv = dev_get_priv(dev);
+	u32 reg;
+
+	upriv->mmc = mmc;
+
+	cfg->b_max	= CONFIG_SYS_MMC_MAX_BLK_COUNT;
+	cfg->f_max	= PXAMMC_MAX_SPEED;
+	cfg->f_min	= PXAMMC_MIN_SPEED;
+	cfg->host_caps	= PXAMMC_HOST_CAPS;
+	cfg->name	= dev->name;
+	cfg->voltages	= MMC_VDD_32_33 | MMC_VDD_33_34;

drivers/mmc/pxa_mmc_gen.c err1: · line 484

Quoted 10 lines
drivers/mmc/pxa_mmc_gen.c +10 -0
+
+	mmc->priv = priv;
+
+	priv->regs = plat->base;
+
+#ifndef	CONFIG_CPU_MONAHANS	/* PXA2xx */
+	reg = readl(CKEN);
+	reg |= CKEN12_MMC;
+	writel(reg, CKEN);
+#else				/* PXA3xx */

We no longer support PXA3xx (Monahans) , just drop this.

And if you're really eager, feel free to pluck out all the #if.*CPU_MONAHANS all over the codebase.

Quoted 17 lines
drivers/mmc/pxa_mmc_gen.c +17 -0
+	reg = readl(CKENA);
+	reg |= CKENA_12_MMC0 | CKENA_13_MMC1;
+	writel(reg, CKENA);
+#endif
+
+	return pxa_mmc_init_common(priv, mmc);
+}
+
+static int pxa_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
+			    struct mmc_data *data)
+{
+	struct pxa_mmc_plat *plat = dev_get_platdata(dev);
+	struct pxa_mmc_priv *priv = dev_get_priv(dev);
+
+	return pxa_mmc_send_cmd_common(priv, &plat->mmc, cmd, data);
+}
+

drivers/mmc/pxa_mmc_gen.c err1: · line 511

Quoted 10 lines
drivers/mmc/pxa_mmc_gen.c +10 -0
+static int pxa_mmc_set_ios(struct udevice *dev)
+{
+	struct pxa_mmc_plat *plat = dev_get_platdata(dev);
+	struct pxa_mmc_priv *priv = dev_get_priv(dev);
+
+	return pxa_mmc_set_ios_common(priv, &plat->mmc);
+}
+
+static const struct dm_mmc_ops pxa_mmc_ops = {
+	.get_cd			= NULL,

Are you sure about this one ? I vaguely remember that Colibri PXA board I have has card detect signal ...

Quoted 53 lines
drivers/mmc/pxa_mmc_gen.c +24 -0
+	.send_cmd		= pxa_mmc_send_cmd,
+	.set_ios		= pxa_mmc_set_ios,
+};
+
+#if CONFIG_IS_ENABLED(BLK)
+static int pxa_mmc_bind(struct udevice *dev)
+{
+	struct pxa_mmc_plat *plat = dev_get_platdata(dev);
+
+	return mmc_bind(dev, &plat->mmc, &plat->cfg);
+}
+#endif
+
+U_BOOT_DRIVER(pxa_mmc) = {
+#if CONFIG_IS_ENABLED(BLK)
+	.bind	= pxa_mmc_bind,
+#endif
+	.id	= UCLASS_MMC,
+	.name	= "pxa_mmc",
+	.ops	= &pxa_mmc_ops,
+	.priv_auto_alloc_size = sizeof(struct pxa_mmc_priv),
+	.probe	= pxa_mmc_probe,
+};
+#endif /* !CONFIG_IS_ENABLED(DM_MMC) */
include/dm/platform_data/pxa_mmc_gen.h new file +22 -0
new file mode 100644
index 0000000000..9875bab2cf
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2019 Marcel Ziswiler <[email protected]>
+ */
+
+#ifndef __PXA_MMC_GEN_H
+#define __PXA_MMC_GEN_H
+
+#include <mmc.h>
+
+/*
+ * struct pxa_mmc_platdata - information about a PXA MMC controller
+ *
+ * @base:	MMC controller base register address
+ */
+struct pxa_mmc_plat {
+	struct mmc_config	cfg;
+	struct mmc		mmc;
+	struct pxa_mmc_regs	*base;
+};
+
+#endif /* __PXA_MMC_GEN_H */
Signature · 2 lines
Best regards,
Marek Vasut
#23 lore raw

PATCH 7/10 arm: pxa: mmc: add driver model support

In reply to Marcel Ziswiler
Quoted 3 lines · Marcel Ziswiler

Add driver model (DM) support.

Applied to u-boot/next, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200630/b3e0449f/attachment.sig>
#24 lore raw

PATCH 8/10 colibri_pxa270_defconfig: enable cmd_dm

In reply to Marcel Ziswiler

Enable CONFIG_CMD_DM.

---

 configs/colibri_pxa270_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/colibri_pxa270_defconfig +1 -0
index a3c07d5887..c9d7e4e7ce 100644
@@ -15,6 +15,7 @@ CONFIG_SYS_PROMPT="$ "
 # CONFIG_CMD_ELF is not set
 # CONFIG_CMD_EXPORTENV is not set
 # CONFIG_CMD_IMPORTENV is not set
+CONFIG_CMD_DM=y
 # CONFIG_CMD_LOADB is not set
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_MMC=y
Signature · 1 line
2.21.0
#25 lore raw

PATCH 8/10 colibri_pxa270_defconfig: enable cmd_dm

Quoted 15 lines · Marcel Ziswiler

Enable CONFIG_CMD_DM.

---

 configs/colibri_pxa270_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/colibri_pxa270_defconfig +0 -0
index a3c07d5887..c9d7e4e7ce 100644

configs/colibri_pxa270_defconfig CONFIG_SYS_PROMPT="$ " · line 21

Quoted 7 lines
configs/colibri_pxa270_defconfig +1 -0
@@ -15,6 +15,7 @@ CONFIG_SYS_PROMPT="$ "
 # CONFIG_CMD_ELF is not set
 # CONFIG_CMD_EXPORTENV is not set
 # CONFIG_CMD_IMPORTENV is not set
+CONFIG_CMD_DM=y
 # CONFIG_CMD_LOADB is not set
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_MMC=y

Can you just imply it somewhere in arch/arm/ instead ?

Signature · 2 lines
Best regards,
Marek Vasut
#26 lore raw

PATCH 8/10 colibri_pxa270_defconfig: enable cmd_dm

In reply to Marcel Ziswiler
Quoted 3 lines · Marcel Ziswiler

Enable CONFIG_CMD_DM.

Applied to u-boot/next, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200630/2a38730f/attachment.sig>
#27 lore raw

PATCH 9/10 colibri_pxa270: add mmc platform data

In reply to Marcel Ziswiler

Add MMC platform data.

While at it also fix trivial checkpatch.pl issues.

---

 board/toradex/colibri_pxa270/colibri_pxa270.c | 20 ++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
board/toradex/colibri_pxa270/colibri_pxa270.c +15 -5
index e9e17508a5..507bf579cf 100644
@@ -3,7 +3,7 @@
  * Toradex Colibri PXA270 Support
  *
  * Copyright (C) 2010 Marek Vasut <[email protected]>
- * Copyright (C) 2016 Marcel Ziswiler <[email protected]>
+ * Copyright (C) 2016-2019 Marcel Ziswiler <[email protected]>
  */
 
 #include <common.h>
@@ -14,6 +14,7 @@
 #include <asm/arch/regs-uart.h>
 #include <asm/io.h>
 #include <dm/platdata.h>
+#include <dm/platform_data/pxa_mmc_gen.h>
 #include <dm/platform_data/serial_pxa.h>
 #include <netdev.h>
 #include <serial.h>
@@ -32,7 +33,7 @@ int board_init(void)
 	/* arch number of Toradex Colibri PXA270 */
 	gd->bd->bi_arch_number = MACH_TYPE_COLIBRI;
 
-	/* adress of boot parameters */
+	/* address of boot parameters */
 	gd->bd->bi_boot_params = 0xa0000100;
 
 	return 0;
@@ -82,7 +83,7 @@ int board_usb_init(int index, enum usb_init_type init)
 	writel(readl(UHCRHDA) | 0x100, UHCRHDA);
 
 	/* Set port power control mask bits, only 3 ports. */
-	writel(readl(UHCRHDB) | (0x7<<17), UHCRHDB);
+	writel(readl(UHCRHDB) | (0x7 << 17), UHCRHDB);
 
 	/* enable port 2 */
 	writel(readl(UP2OCR) | UP2OCR_HXOE | UP2OCR_HXS |
@@ -106,8 +107,6 @@ void usb_board_stop(void)
 	udelay(10);
 
 	writel(readl(CKEN) & ~CKEN10_USBHOST, CKEN);
-
-	return;
 }
 #endif
 
@@ -119,11 +118,22 @@ int board_eth_init(bd_t *bis)
 #endif
 
 #ifdef	CONFIG_CMD_MMC
+#if !CONFIG_IS_ENABLED(DM_MMC)
 int board_mmc_init(bd_t *bis)
 {
 	pxa_mmc_register(0);
 	return 0;
 }
+#else /* !CONFIG_IS_ENABLED(DM_MMC) */
+static const struct pxa_mmc_plat mmc_platdata = {
+	.base = (struct pxa_mmc_regs *)MMC0_BASE,
+};
+
+U_BOOT_DEVICE(pxa_mmcs) = {
+	.name = "pxa_mmc",
+	.platdata = &mmc_platdata,
+};
+#endif /* !CONFIG_IS_ENABLED(DM_MMC) */
 #endif
 
 static const struct pxa_serial_platdata serial_platdata = {
Signature · 1 line
2.21.0
#28 lore raw

PATCH 9/10 colibri_pxa270: add mmc platform data

Quoted 42 lines · Marcel Ziswiler

Add MMC platform data.

While at it also fix trivial checkpatch.pl issues.

---

 board/toradex/colibri_pxa270/colibri_pxa270.c | 20 ++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
board/toradex/colibri_pxa270/colibri_pxa270.c +3 -2
index e9e17508a5..507bf579cf 100644
@@ -3,7 +3,7 @@
  * Toradex Colibri PXA270 Support
  *
  * Copyright (C) 2010 Marek Vasut <[email protected]>
- * Copyright (C) 2016 Marcel Ziswiler <[email protected]>
+ * Copyright (C) 2016-2019 Marcel Ziswiler <[email protected]>
  */
 
 #include <common.h>
@@ -14,6 +14,7 @@
 #include <asm/arch/regs-uart.h>
 #include <asm/io.h>
 #include <dm/platdata.h>
+#include <dm/platform_data/pxa_mmc_gen.h>
 #include <dm/platform_data/serial_pxa.h>
 #include <netdev.h>
 #include <serial.h>
@@ -32,7 +33,7 @@ int board_init(void)
 	/* arch number of Toradex Colibri PXA270 */
 	gd->bd->bi_arch_number = MACH_TYPE_COLIBRI;
 
-	/* adress of boot parameters */
+	/* address of boot parameters */
 	gd->bd->bi_boot_params = 0xa0000100;
 
 	return 0;

board/toradex/colibri_pxa270/colibri_pxa270.c int board_usb_init(int index, enum usb_init_type init) · line 86

Quoted 5 lines
board/toradex/colibri_pxa270/colibri_pxa270.c +1 -1
@@ -82,7 +83,7 @@ int board_usb_init(int index, enum usb_init_type init)
 	writel(readl(UHCRHDA) | 0x100, UHCRHDA);
 
 	/* Set port power control mask bits, only 3 ports. */
-	writel(readl(UHCRHDB) | (0x7<<17), UHCRHDB);
+	writel(readl(UHCRHDB) | (0x7 << 17), UHCRHDB);

setbits_le32(UHCRHDB, GEN_MASK(17, 19)); I think ?

Quoted 35 lines
board/toradex/colibri_pxa270/colibri_pxa270.c +11 -2
 	/* enable port 2 */
 	writel(readl(UP2OCR) | UP2OCR_HXOE | UP2OCR_HXS |
@@ -106,8 +107,6 @@ void usb_board_stop(void)
 	udelay(10);
 
 	writel(readl(CKEN) & ~CKEN10_USBHOST, CKEN);
-
-	return;
 }
 #endif
 
@@ -119,11 +118,22 @@ int board_eth_init(bd_t *bis)
 #endif
 
 #ifdef	CONFIG_CMD_MMC
+#if !CONFIG_IS_ENABLED(DM_MMC)
 int board_mmc_init(bd_t *bis)
 {
 	pxa_mmc_register(0);
 	return 0;
 }
+#else /* !CONFIG_IS_ENABLED(DM_MMC) */
+static const struct pxa_mmc_plat mmc_platdata = {
+	.base = (struct pxa_mmc_regs *)MMC0_BASE,
+};
+
+U_BOOT_DEVICE(pxa_mmcs) = {
+	.name = "pxa_mmc",
+	.platdata = &mmc_platdata,
+};
+#endif /* !CONFIG_IS_ENABLED(DM_MMC) */
 #endif
 
 static const struct pxa_serial_platdata serial_platdata = {
Signature · 2 lines
Best regards,
Marek Vasut
#29 lore raw

PATCH 9/10 colibri_pxa270: add mmc platform data

In reply to Marcel Ziswiler
Quoted 5 lines · Marcel Ziswiler

Add MMC platform data.

While at it also fix trivial checkpatch.pl issues.

Applied to u-boot/next, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200630/4dc380b6/attachment.sig>
#30 lore raw

PATCH 10/10 colibri_pxa270_defconfig: enable dm_mmc

In reply to Marcel Ziswiler

Enable CONFIG_DM_MMC.

---

 configs/colibri_pxa270_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/colibri_pxa270_defconfig +1 -0
index c9d7e4e7ce..609855fe7d 100644
@@ -28,6 +28,7 @@ CONFIG_CMD_FAT=y
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM=y
+CONFIG_DM_MMC=y
 CONFIG_PXA_MMC_GENERIC=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
Signature · 1 line
2.21.0
#31 lore raw

PATCH 10/10 colibri_pxa270_defconfig: enable dm_mmc

Quoted 25 lines · Marcel Ziswiler

Enable CONFIG_DM_MMC.

---

 configs/colibri_pxa270_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/colibri_pxa270_defconfig +1 -1
index c9d7e4e7ce..609855fe7d 100644
@@ -28,6 +28,7 @@ CONFIG_CMD_FAT=y
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM=y
+CONFIG_DM_MMC=y
 CONFIG_PXA_MMC_GENERIC=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
--

2.21.0

Quoted 4 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Signature · 8 lines
Best regards - Freundliche Grüsse - Meilleures salutations

Igor Opaniuk

mailto: igor.opaniuk at gmail.com
skype: igor.opanyuk
+380 (93) 836 40 67
http://ua.linkedin.com/in/iopaniuk
#32 lore raw

PATCH 10/10 colibri_pxa270_defconfig: enable dm_mmc

In reply to Marcel Ziswiler
Quoted 4 lines · Marcel Ziswiler

Enable CONFIG_DM_MMC.

Applied to u-boot/next, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200630/b87bddd6/attachment.sig>