mmc: sdhci: Clear SDHCI_CLOCK_CONTROL before configuring the new value
Subsystems (2)
PATCH 1/9 mmc: sdhci: Clear SDHCI_CLOCK_CONTROL before configuring the new value
This patch completely clears the SDHCI_CLOCK_CONTROL register before the new value is configured instead of just clearing the 2 bits SDHCI_CLOCK_CARD_EN and SDHCI_CLOCK_INT_EN. Without this change, some clock configurations will lead to the "Internal clock never stabilised." error message on the Xenon SDHCI controller used on the Marvell Armada 3700 and 7k/8k ARM64 SoCs.
The Linux SDHCI core driver also writes 0 to this register before the new value is configured. So this patch simplifies the driver a bit and brings the U-Boot driver more in-line with the Linux one.
--- drivers/mmc/sdhci.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mmc/sdhci.c +2 -4
@@ -295,7 +295,7 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,static int sdhci_set_clock (struct mmc *mmc,unsigned int clock) {struct sdhci_host *host = mmc->priv; -unsigned int div, clk =0 , timeout, reg; +unsigned int div, clk =0 , timeout;/* Wait max 20 ms */ timeout =200 ;
@@ -311,9 +311,7 @@ static int sdhci_set_clock(struct mmc *mmc, unsigned int clock)udelay (100 ); } - reg =sdhci_readw (host,SDHCI_CLOCK_CONTROL ); - reg &= ~(SDHCI_CLOCK_CARD_EN |SDHCI_CLOCK_INT_EN ); -sdhci_writew (host, reg,SDHCI_CLOCK_CONTROL ); +sdhci_writew (host,0 ,SDHCI_CLOCK_CONTROL );if (clock ==0 )return 0 ;
Signature · 1 line
2.11.0
PATCH 1/9 mmc: sdhci: Clear SDHCI_CLOCK_CONTROL before configuring the new value
Quoted 7 lines · Stefan Roese
This patch completely clears the
SDHCI_CLOCK_CONTROLregister before the new value is configured instead of just clearing the 2 bitsSDHCI_CLOCK_CARD_ENandSDHCI_CLOCK_INT_EN. Without this change, some clock configurations will lead to the "Internal clock never stabilised." error message on the Xenon SDHCI controller used on the Marvell Armada 3700 and 7k/8k ARM64 SoCs.
Quoted 8 lines
The Linux SDHCI core driver also writes 0 to this register before the new value is configured. So this patch simplifies the driver a bit and brings the U-Boot driver more in-line with the Linux one.
Signed-off-by Stefan Roese <[email protected]>Cc Jaehoon Chung <[email protected]>Cc Siva Durga Prasad Paladugu <[email protected]>Cc Michal Simek <[email protected]>
Whole series applied to u-boot-marvell/master
Thanks,
Stefan
PATCH 2/9 mmc: sdhci: Add support for optional controller specific set_ios_post()
In reply to Stefan RoeseSome SDHCI drivers might need to do some special controller configuration after the common clock set_ios() function has been called (speed / width configuration). This patch adds a call to the newly created function set_ios_port() when its configured in the host driver.
This will be used by the Xenon SDHCI controller driver used on the Marvell Armada 3700 and 7k/8k ARM64 SoCs.
--- drivers/mmc/sdhci.c | 4 ++++ include/sdhci.h | 1 + 2 files changed, 5 insertions(+)
drivers/mmc/sdhci.c +4 -0
@@ -458,6 +458,10 @@ static int sdhci_set_ios(struct mmc *mmc)sdhci_writeb (host, ctrl,SDHCI_HOST_CONTROL ); +/* If available, call the driver specific "post" set_ios() function */ +if (host->ops && host->ops->set_ios_post) + host->ops->set_ios_post (host); +return 0 ; }
include/sdhci.h +1 -0
@@ -235,6 +235,7 @@ struct sdhci_ops {#endif int (*get_cd)(struct sdhci_host *host);void (*set_control_reg)(struct sdhci_host *host); +void (*set_ios_post)(struct sdhci_host *host);void (*set_clock)(struct sdhci_host *host,u32 div); };
Signature · 1 line
2.11.0
PATCH 2/9 mmc: sdhci: Add support for optional controller specific set_ios_post()
Quoted 11 lines · Stefan Roese
Some SDHCI drivers might need to do some special controller configuration after the common clock
set_ios()function has been called (speed / width configuration). This patch adds a call to the newly created functionset_ios_port()when its configured in the host driver.This will be used by the Xenon SDHCI controller driver used on the Marvell Armada 3700 and 7k/8k ARM64 SoCs.
Signed-off-by Stefan Roese <[email protected]>Cc Jaehoon Chung <[email protected]>Cc Simon Glass <[email protected]>
Quoted 33 lines
--- drivers/mmc/sdhci.c | 4 ++++ include/sdhci.h | 1 + 2 files changed, 5 insertions(+)drivers/mmc/sdhci.c +4
-0@@ -458,6 +458,10 @@ static int sdhci_set_ios(struct mmc *mmc)sdhci_writeb (host, ctrl,SDHCI_HOST_CONTROL ); +/* If available, call the driver specific "post" set_ios() function */ +if (host->ops && host->ops->set_ios_post) + host->ops->set_ios_post (host); +return 0 ; }include/sdhci.h +1
-0@@ -235,6 +235,7 @@ struct sdhci_ops {#endif int (*get_cd)(struct sdhci_host *host);void (*set_control_reg)(struct sdhci_host *host); +void (*set_ios_post)(struct sdhci_host *host);void (*set_clock)(struct sdhci_host *host,u32 div); };
PATCH 3/9 mmc: Add Marvell Xenon SDHCI controller driver
In reply to Stefan RoeseThis driver implementes platform specific code for the Xenon SDHCI controller which is integrated in the Marvell MVEBU Armada 37xx and Armada 7k / 8K SoCs.
History:
This driver is ported from the Marvell U-Boot version 2015.01 which is written by Victor Gu <[email protected]> with minor changes ported from the Linux driver which is written by Ziji Hu <[email protected]>.
--- drivers/mmc/Kconfig | 11 + drivers/mmc/Makefile | 1 + drivers/mmc/xenon_sdhci.c | 589 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 601 insertions(+) create mode 100644 drivers/mmc/xenon_sdhci.c
drivers/mmc/Kconfig +11 -0
@@ -287,6 +287,17 @@ config MMC_SDHCI_SPEAR If unsure, say N. +config MMC_XENON_SDHCI + bool "SDHCI support for the Xenon SDHCI controller" + depends on MMC_SDHCI && DM_MMC && OF_CONTROL + help + Support for Xenon SDHCI host controller on Marvell Armada 3700 + 7k/8k ARM SoCs platforms + + If you have a controller with this interface, say Y here. + + If unsure, say N. + config MMC_SDHCI_TEGRA bool "SDHCI platform support for the Tegra SD/MMC Controller" depends on TEGRA
drivers/mmc/Makefile +1 -0
@@ -68,6 +68,7 @@ obj-$(CONFIG_MMC_SDHCI_MV) += mv_sdhci.o obj-$(CONFIG_MMC_SDHCI_S5P) += s5p_sdhci.o obj-$(CONFIG_MMC_SDHCI_SPEAR) += spear_sdhci.o obj-$(CONFIG_MMC_SDHCI_TEGRA) += tegra_mmc.o +obj-$(CONFIG_MMC_XENON_SDHCI) += xenon_sdhci.o obj-$(CONFIG_MMC_SUNXI) += sunxi_mmc.o obj-$(CONFIG_MMC_UNIPHIER) += uniphier-sd.o
drivers/mmc/xenon_sdhci.c new file +589 -0
589 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH 3/9 mmc: Add Marvell Xenon SDHCI controller driver
Hi Stefan,
2017-01-19 16:39 GMT+09:00 Stefan Roese <[email protected]>:
Quoted 12 lines
drivers/mmc/Kconfig +4
-0@@ -287,6 +287,17 @@ config MMC_SDHCI_SPEAR If unsure, say N. +config MMC_XENON_SDHCI + bool "SDHCI support for the Xenon SDHCI controller" + depends on MMC_SDHCI && DM_MMC && OF_CONTROL + help
drivers/mmc/Kconfig config MMC_SDHCI_SPEAR · line 303
Quoted 10 lines
drivers/mmc/Kconfig +7
-0+ Support for Xenon SDHCI host controller on Marvell Armada 3700 + 7k/8k ARM SoCs platforms + + If you have a controller with this interface, say Y here. + + If unsure, say N. + config MMC_SDHCI_TEGRA bool "SDHCI platform support for the Tegra SD/MMC Controller" depends on TEGRA
Can you rename the CONFIG symbol to MMC_SDHCI_XENON, please?
The renaming is underway, but I want to make this consistent in the MMC subsystem in the end.
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 3/9 mmc: Add Marvell Xenon SDHCI controller driver
Hi Masahiro,
Quoted 18 lines · Masahiro Yamada
2017-01-19 16:39 GMT+09:00 Stefan Roese <[email protected]>:
Quoted 17 lines
drivers/mmc/Kconfig +9
-0@@ -287,6 +287,17 @@ config MMC_SDHCI_SPEAR If unsure, say N. +config MMC_XENON_SDHCI + bool "SDHCI support for the Xenon SDHCI controller" + depends on MMC_SDHCI && DM_MMC && OF_CONTROL + help + Support for Xenon SDHCI host controller on Marvell Armada 3700 + 7k/8k ARM SoCs platforms + + If you have a controller with this interface, say Y here. +
Quoted 8 lines
drivers/mmc/Kconfig config MMC_SDHCI_SPEAR · line 303
Quoted 5 lines
drivers/mmc/Kconfig +2
-0+ If unsure, say N. + config MMC_SDHCI_TEGRA bool "SDHCI platform support for the Tegra SD/MMC Controller" depends on TEGRACan you rename the CONFIG symbol to
MMC_SDHCI_XENON, please?
Sure.
Quoted 2 lines
The renaming is underway, but I want to make this consistent in the MMC subsystem in the end.
Thanks for working on this. I'll queue this change in v2 and will send it in a few days.
Thanks,
Stefan
PATCH 4/9 arm64: mvebu: Armada 3700: Add SDHCI device tree nodes
In reply to Stefan RoeseThis patch adds the SDHCI device tree nodes to the Armada 3700 dtsi file.
--- arch/arm/dts/armada-37xx.dtsi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/arm/dts/armada-37xx.dtsi +16 -0
@@ -133,6 +133,22 @@ }; }; + sdhci0: sdhci at d0000 { + compatible = "marvell,armada-3700-sdhci", + "marvell,sdhci-xenon"; + reg = <0xd0000 0x300 + 0x1e808 0x4>; + status = "disabled"; + }; + + sdhci1: sdhci at d8000 { + compatible = "marvell,armada-3700-sdhci", + "marvell,sdhci-xenon"; + reg = <0xd8000 0x300 + 0x17808 0x4>; + status = "disabled"; + }; + sata: sata at e0000 { compatible = "marvell,armada-3700-ahci"; reg = <0xe0000 0x2000>;
Signature · 1 line
2.11.0
PATCH 5/9 arm64: mvebu: Armada 3720-db: Add SDHCI device tree nodes
In reply to Stefan RoeseThis patch adds the SDHCI device tree nodes to the Armada 3700-db dts file.
--- arch/arm/dts/armada-3720-db.dts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
arch/arm/dts/armada-3720-db.dts +21 -0
@@ -94,6 +94,27 @@ status = "okay"; }; +&sdhci0 { + bus-width = <4>; + status = "okay"; +}; + +&sdhci1 { + non-removable; + bus-width = <8>; + mmc-ddr-1_8v; + mmc-hs400-1_8v; + marvell,pad-type = "fixed-1-8v"; + status = "okay"; + + #address-cells = <1>; + #size-cells = <0>; + mmccard: mmccard at 0 { + compatible = "mmc-card"; + reg = <0>; + }; +}; + &spi0 { status = "okay";
Signature · 1 line
2.11.0
PATCH 6/9 arm64: mvebu: Enable SDHCI/MMC support for the db-88f3720
In reply to Stefan RoeseThis patch enables the MMC support for the SDHCI controller on the Armada 3700 db-88f3720 board.
--- configs/mvebu_db-88f3720_defconfig | 6 +++++- include/configs/mvebu_db-88f3720.h | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-)
configs/mvebu_db-88f3720_defconfig +5 -1
@@ -2,7 +2,6 @@ CONFIG_ARM=y CONFIG_ARCH_MVEBU=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_MVEBU_DB_88F3720=y -# CONFIG_MMC is not set CONFIG_DEFAULT_DEVICE_TREE="armada-3720-db" CONFIG_AHCI=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
@@ -11,6 +10,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_BOARDINFO is not set # CONFIG_CMD_IMLS is not set # CONFIG_CMD_FLASH is not set +CONFIG_CMD_MMC=y CONFIG_CMD_SF=y CONFIG_CMD_SPI=y CONFIG_CMD_I2C=y
@@ -31,6 +31,10 @@ CONFIG_BLOCK_CACHE=y CONFIG_DM_I2C=y CONFIG_DM_I2C_COMPAT=y CONFIG_MISC=y +CONFIG_DM_MMC=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_SDMA=y +CONFIG_MMC_XENON_SDHCI=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y
include/configs/mvebu_db-88f3720.h +3 -0
@@ -128,6 +128,9 @@#define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ CONFIG_SYS_SCSI_MAX_LUN) +/* MMC/SD IP block */ +#define CONFIG_GENERIC_MMC +#define CONFIG_SUPPORT_VFAT /* DISK Partition support */
Signature · 1 line
2.11.0
PATCH 7/9 arm64: mvebu: Armada 7k/8k: Add SDHCI device tree nodes
In reply to Stefan RoeseThis patch adds the SDHCI device tree nodes to the Armada AP806 dtsi file which is used by the Armada 7k/8K SoCs.
--- arch/arm/dts/armada-ap806.dtsi | 8 ++++++++ arch/arm/dts/armada-cp110-master.dtsi | 8 ++++++++ 2 files changed, 16 insertions(+)
arch/arm/dts/armada-ap806.dtsi +8 -0
@@ -234,6 +234,14 @@ }; + ap_sdhci0: sdhci at 6e0000 { + compatible = "marvell,armada-8k-sdhci"; + reg = <0x6e0000 0x300>; + interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>; + dma-coherent; + status = "disabled"; + }; + ap_syscon: system-controller at 6f4000 { compatible = "marvell,ap806-system-controller", "syscon";
arch/arm/dts/armada-cp110-master.dtsi +8 -0
@@ -206,6 +206,14 @@ utmi-port = <UTMI_PHY_TO_USB_HOST1>; status = "disabled"; }; + + cpm_sdhci0: sdhci at 780000 { + compatible = "marvell,armada-8k-sdhci"; + reg = <0x780000 0x300>; + interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>; + dma-coherent; + status = "disabled"; + }; }; cpm_pcie0: pcie at f2600000 {
Signature · 1 line
2.11.0
PATCH 8/9 arm64: mvebu: Armada 7040-db: Add SDHCI device tree nodes
In reply to Stefan RoeseThis patch adds the SDHCI device tree nodes to the Armada 7040-db dts file.
--- arch/arm/dts/armada-7040-db.dts | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
arch/arm/dts/armada-7040-db.dts +14 -0
@@ -195,3 +195,17 @@ &cpm_utmi1 { status = "okay"; }; + +&ap_sdhci0 { + status = "okay"; + bus-width = <4>; + no-1-8-v; + non-removable; +}; + +&cpm_sdhci0 { + status = "okay"; + bus-width = <4>; + no-1-8-v; + non-removable; +};
Signature · 1 line
2.11.0
PATCH 1/9 mmc: sdhci: Clear SDHCI_CLOCK_CONTROL before configuring the new value
In reply to Stefan RoeseQuoted 7 lines · Stefan Roese
This patch completely clears the
SDHCI_CLOCK_CONTROLregister before the new value is configured instead of just clearing the 2 bitsSDHCI_CLOCK_CARD_ENandSDHCI_CLOCK_INT_EN. Without this change, some clock configurations will lead to the "Internal clock never stabilised." error message on the Xenon SDHCI controller used on the Marvell Armada 3700 and 7k/8k ARM64 SoCs.
Quoted 8 lines
The Linux SDHCI core driver also writes 0 to this register before the new value is configured. So this patch simplifies the driver a bit and brings the U-Boot driver more in-line with the Linux one.
Signed-off-by Stefan Roese <[email protected]>Cc Jaehoon Chung <[email protected]>Cc Siva Durga Prasad Paladugu <[email protected]>Cc Michal Simek <[email protected]>
Quoted 29 lines
--- drivers/mmc/sdhci.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/mmc/sdhci.c +2
-4@@ -295,7 +295,7 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,static int sdhci_set_clock (struct mmc *mmc,unsigned int clock) {struct sdhci_host *host = mmc->priv; -unsigned int div, clk =0 , timeout, reg; +unsigned int div, clk =0 , timeout;/* Wait max 20 ms */ timeout =200 ;@@ -311,9 +311,7 @@ static int sdhci_set_clock(struct mmc *mmc, unsigned int clock)udelay (100 ); } - reg =sdhci_readw (host,SDHCI_CLOCK_CONTROL ); - reg &= ~(SDHCI_CLOCK_CARD_EN |SDHCI_CLOCK_INT_EN ); -sdhci_writew (host, reg,SDHCI_CLOCK_CONTROL ); +sdhci_writew (host,0 ,SDHCI_CLOCK_CONTROL );if (clock ==0 )return 0 ;
PATCH 9/9 arm64: mvebu: Enable SDHCI/MMC support for the db-88f7040/8040
In reply to Stefan RoeseThis patch enables the MMC support for the SDHCI controller on the Armada 7k db-88f7040 and the Armada 8k db-88f8040 board.
--- configs/mvebu_db-88f7040_defconfig | 5 ++++- configs/mvebu_db-88f8040_defconfig | 5 ++++- include/configs/mvebu_armada-8k.h | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-)
configs/mvebu_db-88f7040_defconfig +4 -1
@@ -2,7 +2,6 @@ CONFIG_ARM=y CONFIG_ARCH_MVEBU=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_MVEBU_ARMADA_8K=y -# CONFIG_MMC is not set CONFIG_DEFAULT_DEVICE_TREE="armada-7040-db" CONFIG_SMBIOS_PRODUCT_NAME="" CONFIG_AHCI=y
@@ -13,6 +12,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_HUSH_PARSER=y # CONFIG_CMD_IMLS is not set # CONFIG_CMD_FLASH is not set +CONFIG_CMD_MMC=y CONFIG_CMD_SF=y CONFIG_CMD_SPI=y CONFIG_CMD_I2C=y
@@ -34,6 +34,9 @@ CONFIG_BLOCK_CACHE=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y CONFIG_MISC=y +CONFIG_DM_MMC=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_XENON_SDHCI=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y
configs/mvebu_db-88f8040_defconfig +4 -1
@@ -2,7 +2,6 @@ CONFIG_ARM=y CONFIG_ARCH_MVEBU=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_MVEBU_ARMADA_8K=y -# CONFIG_MMC is not set CONFIG_DEFAULT_DEVICE_TREE="armada-8040-db" CONFIG_SMBIOS_PRODUCT_NAME="" CONFIG_AHCI=y
@@ -13,6 +12,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_HUSH_PARSER=y # CONFIG_CMD_IMLS is not set # CONFIG_CMD_FLASH is not set +CONFIG_CMD_MMC=y CONFIG_CMD_SF=y CONFIG_CMD_SPI=y CONFIG_CMD_I2C=y
@@ -34,6 +34,9 @@ CONFIG_BLOCK_CACHE=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y CONFIG_MISC=y +CONFIG_DM_MMC=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_XENON_SDHCI=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y
include/configs/mvebu_armada-8k.h +3 -0
@@ -117,6 +117,9 @@#define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ CONFIG_SYS_SCSI_MAX_LUN) +/* MMC/SD IP block */ +#define CONFIG_GENERIC_MMC +#define CONFIG_SUPPORT_VFAT /* DISK Partition support */
Signature · 1 line
2.11.0