[U-Boot] [PATCH v1 00/10] 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

Add missing space before a comment delimiter.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
---
drivers/mmc/mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 456c1b4cc9..ede528dc5a 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -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 */

Subject: [PATCH v1 01/10] mmc: add missing space before comment delimiter
Add missing space before a comment delimiter.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
drivers/mmc/mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 456c1b4cc9..ede528dc5a 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -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;
Reviewed-by: Peng Fan peng.fan@nxp.com
/* Test for SD version 2 */
2.21.0

On Mon, May 20, 2019 at 3:45 AM Marcel Ziswiler marcel@ziswiler.com wrote:
Add missing space before a comment delimiter.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
drivers/mmc/mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 456c1b4cc9..ede528dc5a 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -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
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Reviewed-by: Igor Opaniuk igor.opaniuk@toradex.com

On Mon, May 20, 2019 at 02:44:53AM +0200, Marcel Ziswiler wrote:
Add missing space before a comment delimiter.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com Reviewed-by: Peng Fan peng.fan@nxp.com Reviewed-by: Igor Opaniuk igor.opaniuk@toradex.com
Applied to u-boot/next, thanks!

Annotate endifs to make CONFIG_IS_ENABLED(DM_MMC) or not more obvious.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
---
drivers/mmc/fsl_esdhc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index 1b7de74a72..0742cd64e1 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -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

On Sun, May 19, 2019 at 9:45 PM Marcel Ziswiler marcel@ziswiler.com wrote:
Annotate endifs to make CONFIG_IS_ENABLED(DM_MMC) or not more obvious.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
Reviewed-by: Fabio Estevam festevam@gmail.com
Thanks

Subject: [PATCH v1 02/10] mmc: fsl_esdhc: annotate endifs
Annotate endifs to make CONFIG_IS_ENABLED(DM_MMC) or not more obvious.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
drivers/mmc/fsl_esdhc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index 1b7de74a72..0742cd64e1 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -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
Reviewed-by: Peng Fan peng.fan@nxp.com
-- 2.21.0

On Mon, May 20, 2019 at 3:46 AM Marcel Ziswiler marcel@ziswiler.com wrote:
Annotate endifs to make CONFIG_IS_ENABLED(DM_MMC) or not more obvious.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
drivers/mmc/fsl_esdhc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index 1b7de74a72..0742cd64e1 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -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
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Reviewed-by: Igor Opaniuk igor.opaniuk@toradex.com

Clean-up platform data include file by using BIT macro and converting indentation with spaces to tabs.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
---
include/dm/platform_data/serial_pxa.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/dm/platform_data/serial_pxa.h b/include/dm/platform_data/serial_pxa.h index 408c00885d..b78bdb6409 100644 --- a/include/dm/platform_data/serial_pxa.h +++ b/include/dm/platform_data/serial_pxa.h @@ -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;

On 5/20/19 2:44 AM, Marcel Ziswiler wrote:
Clean-up platform data include file by using BIT macro and converting indentation with spaces to tabs.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
include/dm/platform_data/serial_pxa.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/dm/platform_data/serial_pxa.h b/include/dm/platform_data/serial_pxa.h index 408c00885d..b78bdb6409 100644 --- a/include/dm/platform_data/serial_pxa.h +++ b/include/dm/platform_data/serial_pxa.h @@ -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
So while we're messing around with this, can we also s/[uU]art/UART/ and s/cpu/CPU/ and s/gpio/GPIO/ ?
*/ struct pxa_serial_platdata { struct pxa_uart_regs *base;

On Mon, May 20, 2019 at 02:44:55AM +0200, Marcel Ziswiler wrote:
Clean-up platform data include file by using BIT macro and converting indentation with spaces to tabs.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
Applied to u-boot/next, thanks!

Allow for CONFIG_DM_MMC with platform data rather than CONFIG_OF_CONTROL.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
---
Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile index 6eb08a5724..eb08aaea75 100644 --- a/Makefile +++ b/Makefile @@ -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."

Hi Marcel,
On Sun, 19 May 2019 at 18:45, Marcel Ziswiler marcel@ziswiler.com wrote:
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?
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Regards, Simon

On Mon, May 20, 2019 at 02:44:56AM +0200, Marcel Ziswiler wrote:
Allow for CONFIG_DM_MMC with platform data rather than CONFIG_OF_CONTROL.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
Applied to u-boot/next, thanks!

Gracefully handle alias seq in the platform data rather than OF case.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
---
drivers/core/read.c | 4 +++- include/dm/read.h | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/core/read.c b/drivers/core/read.c index 6bda077a34..670ffe5dc5 100644 --- a/drivers/core/read.c +++ b/drivers/core/read.c @@ -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; diff --git a/include/dm/read.h b/include/dm/read.h index 60b727cbd8..a8ffbe42ac 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -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,

Hi Marcel,
On Sun, 19 May 2019 at 18:45, Marcel Ziswiler marcel@ziswiler.com wrote:
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

On Mon, May 20, 2019 at 02:44:57AM +0200, Marcel Ziswiler wrote:
Gracefully handle alias seq in the platform data rather than OF case.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
Applied to u-boot/next, thanks!

Move CONFIG_PXA_MMC_GENERIC to Kconfig.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
---
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(-)
diff --git a/configs/colibri_pxa270_defconfig b/configs/colibri_pxa270_defconfig index 492ee9eaaf..a3c07d5887 100644 --- a/configs/colibri_pxa270_defconfig +++ b/configs/colibri_pxa270_defconfig @@ -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 diff --git a/configs/zipitz2_defconfig b/configs/zipitz2_defconfig index 509adcffd9..9590d16593 100644 --- a/configs/zipitz2_defconfig +++ b/configs/zipitz2_defconfig @@ -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 diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index c23299ea96..d89140e520 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -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 diff --git a/include/configs/pxa-common.h b/include/configs/pxa-common.h index e25800a095..ba315b3fb8 100644 --- a/include/configs/pxa-common.h +++ b/include/configs/pxa-common.h @@ -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 */ diff --git a/include/configs/zipitz2.h b/include/configs/zipitz2.h index 24fea68a11..cf8f6ff671 100644 --- a/include/configs/zipitz2.h +++ b/include/configs/zipitz2.h @@ -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 */ diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index b16bc6ae34..511287ada0 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -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

On Sun, 19 May 2019 at 18:45, Marcel Ziswiler marcel@ziswiler.com wrote:
Move CONFIG_PXA_MMC_GENERIC to Kconfig.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
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(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, May 20, 2019 at 02:44:58AM +0200, Marcel Ziswiler wrote:
Move CONFIG_PXA_MMC_GENERIC to Kconfig.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

Add driver model (DM) support.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
---
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
diff --git a/drivers/mmc/pxa_mmc_gen.c b/drivers/mmc/pxa_mmc_gen.c index a4dcdb5cff..08a5ca36a1 100644 --- a/drivers/mmc/pxa_mmc_gen.c +++ b/drivers/mmc/pxa_mmc_gen.c @@ -2,6 +2,9 @@ /* * Copyright (C) 2010 Marek Vasut marek.vasut@gmail.com * + * Modified to add driver model (DM) support + * Copyright (C) 2019 Marcel Ziswiler marcel@ziswiler.com + * * 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(®s->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(®s->rxfifo); - }
if (readl(®s->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), - ®s->i_mask); + ®s->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) */ diff --git a/include/dm/platform_data/pxa_mmc_gen.h b/include/dm/platform_data/pxa_mmc_gen.h new file mode 100644 index 0000000000..9875bab2cf --- /dev/null +++ b/include/dm/platform_data/pxa_mmc_gen.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2019 Marcel Ziswiler marcel.ziswiler@toradex.com + */ + +#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 */

On 5/20/19 2:44 AM, Marcel Ziswiler wrote:
Add driver model (DM) support.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
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
diff --git a/drivers/mmc/pxa_mmc_gen.c b/drivers/mmc/pxa_mmc_gen.c index a4dcdb5cff..08a5ca36a1 100644 --- a/drivers/mmc/pxa_mmc_gen.c +++ b/drivers/mmc/pxa_mmc_gen.c @@ -2,6 +2,9 @@ /*
- Copyright (C) 2010 Marek Vasut marek.vasut@gmail.com
- Modified to add driver model (DM) support
- Copyright (C) 2019 Marcel Ziswiler marcel@ziswiler.com
*/
- 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)
u32 just like you do in the next hunk ?
I think you might want to split the cleanup from DM conversion.
{ 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
*/ a = readl(®s->res) & 0xffff;
- discard the upper 8 bits of the first 16-bit word.
@@ -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))
BIT(31)
[...]
+#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);
goto err1; }card_index);
@@ -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 */
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.
- 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,
Are you sure about this one ? I vaguely remember that Colibri PXA board I have has card detect signal ...
- .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) */ diff --git a/include/dm/platform_data/pxa_mmc_gen.h b/include/dm/platform_data/pxa_mmc_gen.h new file mode 100644 index 0000000000..9875bab2cf --- /dev/null +++ b/include/dm/platform_data/pxa_mmc_gen.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/*
- Copyright (c) 2019 Marcel Ziswiler marcel.ziswiler@toradex.com
- */
+#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 */

On Mon, May 20, 2019 at 02:44:59AM +0200, Marcel Ziswiler wrote:
Add driver model (DM) support.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
Applied to u-boot/next, thanks!

Enable CONFIG_CMD_DM.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
---
configs/colibri_pxa270_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/colibri_pxa270_defconfig b/configs/colibri_pxa270_defconfig index a3c07d5887..c9d7e4e7ce 100644 --- a/configs/colibri_pxa270_defconfig +++ b/configs/colibri_pxa270_defconfig @@ -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

On 5/20/19 2:45 AM, Marcel Ziswiler wrote:
Enable CONFIG_CMD_DM.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
configs/colibri_pxa270_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/colibri_pxa270_defconfig b/configs/colibri_pxa270_defconfig index a3c07d5887..c9d7e4e7ce 100644 --- a/configs/colibri_pxa270_defconfig +++ b/configs/colibri_pxa270_defconfig @@ -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 ?

On Mon, May 20, 2019 at 02:45:00AM +0200, Marcel Ziswiler wrote:
Enable CONFIG_CMD_DM.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
Applied to u-boot/next, thanks!

Add MMC platform data.
While at it also fix trivial checkpatch.pl issues.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
---
board/toradex/colibri_pxa270/colibri_pxa270.c | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/board/toradex/colibri_pxa270/colibri_pxa270.c b/board/toradex/colibri_pxa270/colibri_pxa270.c index e9e17508a5..507bf579cf 100644 --- a/board/toradex/colibri_pxa270/colibri_pxa270.c +++ b/board/toradex/colibri_pxa270/colibri_pxa270.c @@ -3,7 +3,7 @@ * Toradex Colibri PXA270 Support * * Copyright (C) 2010 Marek Vasut marek.vasut@gmail.com - * Copyright (C) 2016 Marcel Ziswiler marcel.ziswiler@toradex.com + * Copyright (C) 2016-2019 Marcel Ziswiler marcel.ziswiler@toradex.com */
#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 = {

On 5/20/19 2:45 AM, Marcel Ziswiler wrote:
Add MMC platform data.
While at it also fix trivial checkpatch.pl issues.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
board/toradex/colibri_pxa270/colibri_pxa270.c | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/board/toradex/colibri_pxa270/colibri_pxa270.c b/board/toradex/colibri_pxa270/colibri_pxa270.c index e9e17508a5..507bf579cf 100644 --- a/board/toradex/colibri_pxa270/colibri_pxa270.c +++ b/board/toradex/colibri_pxa270/colibri_pxa270.c @@ -3,7 +3,7 @@
- Toradex Colibri PXA270 Support
- Copyright (C) 2010 Marek Vasut marek.vasut@gmail.com
- Copyright (C) 2016 Marcel Ziswiler marcel.ziswiler@toradex.com
*/
- Copyright (C) 2016-2019 Marcel Ziswiler marcel.ziswiler@toradex.com
#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);
setbits_le32(UHCRHDB, GEN_MASK(17, 19)); I think ?
/* 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 = {

On Mon, May 20, 2019 at 02:45:01AM +0200, Marcel Ziswiler wrote:
Add MMC platform data.
While at it also fix trivial checkpatch.pl issues.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
Applied to u-boot/next, thanks!

Enable CONFIG_DM_MMC.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
---
configs/colibri_pxa270_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/colibri_pxa270_defconfig b/configs/colibri_pxa270_defconfig index c9d7e4e7ce..609855fe7d 100644 --- a/configs/colibri_pxa270_defconfig +++ b/configs/colibri_pxa270_defconfig @@ -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

On Mon, May 20, 2019 at 3:48 AM Marcel Ziswiler marcel@ziswiler.com wrote:
Enable CONFIG_DM_MMC.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com
configs/colibri_pxa270_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/colibri_pxa270_defconfig b/configs/colibri_pxa270_defconfig index c9d7e4e7ce..609855fe7d 100644 --- a/configs/colibri_pxa270_defconfig +++ b/configs/colibri_pxa270_defconfig @@ -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
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Reviewed-by: Igor Opaniuk igor.opaniuk@toradex.com

On Mon, May 20, 2019 at 02:45:02AM +0200, Marcel Ziswiler wrote:
Enable CONFIG_DM_MMC.
Signed-off-by: Marcel Ziswiler marcel@ziswiler.com Reviewed-by: Igor Opaniuk igor.opaniuk@toradex.com
Applied to u-boot/next, thanks!
participants (8)
-
Fabio Estevam
-
Igor Opaniuk
-
Igor Opaniuk
-
Marcel Ziswiler
-
Marek Vasut
-
Peng Fan
-
Simon Glass
-
Tom Rini