[U-Boot] [PATCH 00/12] ARM: uniphier: UniPhier SoC updates for v2016.11-rc1

I want to get this series in during this merge window.
- DM migration * remove legacy xHCI driver * convert MMC driver to CONFIG_BLOCK - Pinctrl driver improvements * New pin-group * Macro cleanup - Misc fixes, cleanups * Fix DRAM size of LD21 SoC * Consolidate board init functions
Masahiro Yamada (12): ARM: uniphier: sort select:s alphabetically usb: uniphier: remove UniPhier xHCI driver and select DM_USB ARM: uniphier: delete unnecessary xHCI pin-mux settings ARM: uniphier: enable Generic EHCI driver for Pro4 SoC mmc: uniphier-sd: migrate to CONFIG_BLK pinctrl: uniphier: add System Bus pin-mux settings pinctrl: uniphier: move register base macros from header to .c file ARM: uniphier: remove IECTRL setup code of LD4 SoC ARM: uniphier: use checkboard() instead of misc_init_f() ARM: uniphier: merge board init functions into board_init() ARM: uniphier: fix DRAM size of LD21 SoC package ARM: uniphier: introduce flags to adjust DRAM timing for LD20/LD21
arch/arm/Kconfig | 16 ++-- arch/arm/mach-uniphier/Makefile | 5 +- arch/arm/mach-uniphier/board_common.c | 20 ----- arch/arm/mach-uniphier/board_early_init_r.c | 15 ---- .../{board_early_init_f.c => board_init.c} | 12 ++- arch/arm/mach-uniphier/boards.c | 29 +++++++- arch/arm/mach-uniphier/init.h | 12 ++- arch/arm/mach-uniphier/micro-support-card.c | 2 +- arch/arm/mach-uniphier/micro-support-card.h | 12 +-- arch/arm/mach-uniphier/pinctrl/pinctrl-ld20.c | 12 --- arch/arm/mach-uniphier/pinctrl/pinctrl-ld4.c | 6 -- arch/arm/mach-uniphier/pinctrl/pinctrl-ld6b.c | 11 --- arch/arm/mach-uniphier/pinctrl/pinctrl-pro4.c | 7 -- arch/arm/mach-uniphier/pinctrl/pinctrl-pro5.c | 7 -- arch/arm/mach-uniphier/pinctrl/pinctrl-pxs2.c | 11 --- arch/arm/mach-uniphier/print_misc_info.c | 12 --- configs/uniphier_ld4_sld8_defconfig | 1 - configs/uniphier_pro4_defconfig | 2 + configs/uniphier_sld3_defconfig | 1 - drivers/mmc/Kconfig | 1 + drivers/mmc/uniphier-sd.c | 50 ++++++------- drivers/pinctrl/uniphier/pinctrl-uniphier-core.c | 4 + drivers/pinctrl/uniphier/pinctrl-uniphier-ld11.c | 9 +++ drivers/pinctrl/uniphier/pinctrl-uniphier-ld20.c | 9 +++ drivers/pinctrl/uniphier/pinctrl-uniphier-ld4.c | 18 +++++ drivers/pinctrl/uniphier/pinctrl-uniphier-ld6b.c | 21 ++++++ drivers/pinctrl/uniphier/pinctrl-uniphier-pro4.c | 30 ++++++++ drivers/pinctrl/uniphier/pinctrl-uniphier-pro5.c | 30 ++++++++ drivers/pinctrl/uniphier/pinctrl-uniphier-pxs2.c | 9 +++ drivers/pinctrl/uniphier/pinctrl-uniphier-sld8.c | 21 ++++++ drivers/pinctrl/uniphier/pinctrl-uniphier.h | 4 - drivers/usb/host/Kconfig | 7 -- drivers/usb/host/Makefile | 1 - drivers/usb/host/xhci-uniphier.c | 85 ---------------------- include/configs/uniphier.h | 3 - include/fdtdec.h | 1 - lib/fdtdec.c | 1 - 37 files changed, 238 insertions(+), 259 deletions(-) delete mode 100644 arch/arm/mach-uniphier/board_common.c delete mode 100644 arch/arm/mach-uniphier/board_early_init_r.c rename arch/arm/mach-uniphier/{board_early_init_f.c => board_init.c} (94%) delete mode 100644 arch/arm/mach-uniphier/print_misc_info.c delete mode 100644 drivers/usb/host/xhci-uniphier.c

ARCH_UNIPHIER is having more and more select:s. Sort them in case a select is accidentally duplicated.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
arch/arm/Kconfig | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index e63309a..f7b6f0d 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -856,17 +856,17 @@ config TARGET_COLIBRI_PXA270 config ARCH_UNIPHIER bool "Socionext UniPhier SoCs" select CLK_UNIPHIER - select SUPPORT_SPL - select SPL - select OF_CONTROL - select SPL_OF_CONTROL - select OF_LIBFDT select DM - select SPL_DM select DM_GPIO - select DM_SERIAL select DM_I2C select DM_MMC + select DM_SERIAL + select OF_CONTROL + select OF_LIBFDT + select SPL + select SPL_DM + select SPL_OF_CONTROL + select SUPPORT_SPL help Support for UniPhier SoC family developed by Socionext Inc. (formerly, System LSI Business Division of Panasonic Corporation)

This driver has not been converted to Driver Model, and it is an obstacle to migrate other block device drivers. Remove it for now.
The UniPhier SoCs already use a DM-based EHCI driver, so now ARCH_UNIPHIER can select DM_USB.
These two changes must be done atomically because removing the legacy driver causes a build error.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com Reviewed-by: Marek Vasut marex@denx.de ---
arch/arm/Kconfig | 1 + configs/uniphier_ld4_sld8_defconfig | 1 - configs/uniphier_sld3_defconfig | 1 - drivers/usb/host/Kconfig | 7 --- drivers/usb/host/Makefile | 1 - drivers/usb/host/xhci-uniphier.c | 85 ------------------------------------- include/fdtdec.h | 1 - lib/fdtdec.c | 1 - 8 files changed, 1 insertion(+), 97 deletions(-) delete mode 100644 drivers/usb/host/xhci-uniphier.c
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index f7b6f0d..512e326 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -861,6 +861,7 @@ config ARCH_UNIPHIER select DM_I2C select DM_MMC select DM_SERIAL + select DM_USB select OF_CONTROL select OF_LIBFDT select SPL diff --git a/configs/uniphier_ld4_sld8_defconfig b/configs/uniphier_ld4_sld8_defconfig index e3ad160..89d3de4 100644 --- a/configs/uniphier_ld4_sld8_defconfig +++ b/configs/uniphier_ld4_sld8_defconfig @@ -32,7 +32,6 @@ CONFIG_SPL_NAND_DENALI=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_USB=y -CONFIG_DM_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_GENERIC=y CONFIG_USB_STORAGE=y diff --git a/configs/uniphier_sld3_defconfig b/configs/uniphier_sld3_defconfig index 1c5cece..8781fe6 100644 --- a/configs/uniphier_sld3_defconfig +++ b/configs/uniphier_sld3_defconfig @@ -30,7 +30,6 @@ CONFIG_SYS_NAND_DENALI_64BIT=y CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES=8 CONFIG_SPL_NAND_DENALI=y CONFIG_USB=y -CONFIG_DM_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_GENERIC=y CONFIG_USB_STORAGE=y diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index e0699d4..42e8a9f 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -15,13 +15,6 @@ config USB_XHCI_HCD
if USB_XHCI_HCD
-config USB_XHCI_UNIPHIER - bool "Support for UniPhier on-chip xHCI USB controller" - depends on ARCH_UNIPHIER - default y - ---help--- - Enables support for the on-chip xHCI controller on UniPhier SoCs. - config USB_XHCI_DWC3 bool "DesignWare USB3 DRD Core Support" help diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 620d114..55190bb 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -62,7 +62,6 @@ obj-$(CONFIG_USB_XHCI_EXYNOS) += xhci-exynos5.o obj-$(CONFIG_USB_XHCI_FSL) += xhci-fsl.o obj-$(CONFIG_USB_XHCI_OMAP) += xhci-omap.o obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o -obj-$(CONFIG_USB_XHCI_UNIPHIER) += xhci-uniphier.o
# designware obj-$(CONFIG_USB_DWC2) += dwc2.o diff --git a/drivers/usb/host/xhci-uniphier.c b/drivers/usb/host/xhci-uniphier.c deleted file mode 100644 index 1b3f3d2..0000000 --- a/drivers/usb/host/xhci-uniphier.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2015 Masahiro Yamada yamada.masahiro@socionext.com - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <common.h> -#include <linux/err.h> -#include <linux/io.h> -#include <usb.h> -#include <fdtdec.h> -#include "xhci.h" - -static int get_uniphier_xhci_base(int index, struct xhci_hccr **base) -{ - DECLARE_GLOBAL_DATA_PTR; - int node_list[2]; - fdt_addr_t addr; - int count; - - count = fdtdec_find_aliases_for_id(gd->fdt_blob, "usb", - COMPAT_SOCIONEXT_XHCI, node_list, - ARRAY_SIZE(node_list)); - - if (index >= count) - return -ENODEV; - - addr = fdtdec_get_addr(gd->fdt_blob, node_list[index], "reg"); - if (addr == FDT_ADDR_T_NONE) - return -ENODEV; - - *base = (struct xhci_hccr *)addr; - - return 0; -} - -#define USB3_RST_CTRL 0x00100040 -#define IOMMU_RST_N (1 << 5) -#define LINK_RST_N (1 << 4) - -static void uniphier_xhci_reset(void __iomem *base, int on) -{ - u32 tmp; - - tmp = readl(base + USB3_RST_CTRL); - - if (on) - tmp &= ~(IOMMU_RST_N | LINK_RST_N); - else - tmp |= IOMMU_RST_N | LINK_RST_N; - - writel(tmp, base + USB3_RST_CTRL); -} - -int xhci_hcd_init(int index, struct xhci_hccr **hccr, struct xhci_hcor **hcor) -{ - int ret; - struct xhci_hccr *cr; - struct xhci_hcor *or; - - ret = get_uniphier_xhci_base(index, &cr); - if (ret < 0) - return ret; - - uniphier_xhci_reset(cr, 0); - - or = (void *)cr + HC_LENGTH(xhci_readl(&cr->cr_capbase)); - - *hccr = cr; - *hcor = or; - - return 0; -} - -void xhci_hcd_stop(int index) -{ - int ret; - struct xhci_hccr *cr; - - ret = get_uniphier_xhci_base(index, &cr); - if (ret < 0) - return; - - uniphier_xhci_reset(cr, 1); -} diff --git a/include/fdtdec.h b/include/fdtdec.h index aeb6bab..27887c8 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -148,7 +148,6 @@ enum fdt_compat_id { COMPAT_INTEL_MICROCODE, /* Intel microcode update */ COMPAT_AMS_AS3722, /* AMS AS3722 PMIC */ COMPAT_INTEL_QRK_MRC, /* Intel Quark MRC */ - COMPAT_SOCIONEXT_XHCI, /* Socionext UniPhier xHCI */ COMPAT_ALTERA_SOCFPGA_DWMAC, /* SoCFPGA Ethernet controller */ COMPAT_ALTERA_SOCFPGA_DWMMC, /* SoCFPGA DWMMC controller */ COMPAT_ALTERA_SOCFPGA_DWC2USB, /* SoCFPGA DWC2 USB controller */ diff --git a/lib/fdtdec.c b/lib/fdtdec.c index e638ca5..4defb90 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -59,7 +59,6 @@ static const char * const compat_names[COMPAT_COUNT] = { COMPAT(INTEL_MICROCODE, "intel,microcode"), COMPAT(AMS_AS3722, "ams,as3722"), COMPAT(INTEL_QRK_MRC, "intel,quark-mrc"), - COMPAT(SOCIONEXT_XHCI, "socionext,uniphier-xhci"), COMPAT(ALTERA_SOCFPGA_DWMAC, "altr,socfpga-stmmac"), COMPAT(ALTERA_SOCFPGA_DWMMC, "altr,socfpga-dw-mshc"), COMPAT(ALTERA_SOCFPGA_DWC2USB, "snps,dwc2"),

These ad-hoc pinmux settings were used for the legacy xHCI driver, which has gone now.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
arch/arm/mach-uniphier/pinctrl/pinctrl-ld20.c | 12 ------------ arch/arm/mach-uniphier/pinctrl/pinctrl-ld6b.c | 11 ----------- arch/arm/mach-uniphier/pinctrl/pinctrl-pro4.c | 7 ------- arch/arm/mach-uniphier/pinctrl/pinctrl-pro5.c | 7 ------- arch/arm/mach-uniphier/pinctrl/pinctrl-pxs2.c | 11 ----------- 5 files changed, 48 deletions(-)
diff --git a/arch/arm/mach-uniphier/pinctrl/pinctrl-ld20.c b/arch/arm/mach-uniphier/pinctrl/pinctrl-ld20.c index 645b901..ec4c414 100644 --- a/arch/arm/mach-uniphier/pinctrl/pinctrl-ld20.c +++ b/arch/arm/mach-uniphier/pinctrl/pinctrl-ld20.c @@ -32,18 +32,6 @@ void uniphier_ld20_pin_init(void) sg_set_iectrl_range(3, 17); #endif
-#ifdef CONFIG_USB_XHCI_UNIPHIER - sg_set_pinsel(46, 0, 8, 4); /* USB0VBUS -> USB0VBUS */ - sg_set_pinsel(47, 0, 8, 4); /* USB0OD -> USB0OD */ - sg_set_pinsel(48, 0, 8, 4); /* USB1VBUS -> USB1VBUS */ - sg_set_pinsel(49, 0, 8, 4); /* USB1OD -> USB1OD */ - sg_set_pinsel(50, 0, 8, 4); /* USB2VBUS -> USB2VBUS */ - sg_set_pinsel(51, 0, 8, 4); /* USB2OD -> USB2OD */ - sg_set_pinsel(52, 0, 8, 4); /* USB3VBUS -> USB3VBUS */ - sg_set_pinsel(53, 0, 8, 4); /* USB3OD -> USB3OD */ - sg_set_iectrl_range(46, 53); -#endif - sg_set_pinsel(149, 14, 8, 4); /* XIRQ0 -> XIRQ0 */ sg_set_iectrl(149); sg_set_pinsel(153, 14, 8, 4); /* XIRQ4 -> XIRQ4 */ diff --git a/arch/arm/mach-uniphier/pinctrl/pinctrl-ld6b.c b/arch/arm/mach-uniphier/pinctrl/pinctrl-ld6b.c index 913722b..f3b7115 100644 --- a/arch/arm/mach-uniphier/pinctrl/pinctrl-ld6b.c +++ b/arch/arm/mach-uniphier/pinctrl/pinctrl-ld6b.c @@ -32,15 +32,4 @@ void uniphier_ld6b_pin_init(void) sg_set_pinsel(45, 0, 8, 4); /* NFD6 -> NFD6 */ sg_set_pinsel(46, 0, 8, 4); /* NFD7 -> NFD7 */ #endif - -#ifdef CONFIG_USB_XHCI_UNIPHIER - sg_set_pinsel(56, 0, 8, 4); /* USB0VBUS -> USB0VBUS */ - sg_set_pinsel(57, 0, 8, 4); /* USB0OD -> USB0OD */ - sg_set_pinsel(58, 0, 8, 4); /* USB1VBUS -> USB1VBUS */ - sg_set_pinsel(59, 0, 8, 4); /* USB1OD -> USB1OD */ - sg_set_pinsel(60, 0, 8, 4); /* USB2VBUS -> USB2VBUS */ - sg_set_pinsel(61, 0, 8, 4); /* USB2OD -> USB2OD */ - sg_set_pinsel(62, 0, 8, 4); /* USB3VBUS -> USB3VBUS */ - sg_set_pinsel(63, 0, 8, 4); /* USB3OD -> USB3OD */ -#endif } diff --git a/arch/arm/mach-uniphier/pinctrl/pinctrl-pro4.c b/arch/arm/mach-uniphier/pinctrl/pinctrl-pro4.c index 3796491..871d3ef 100644 --- a/arch/arm/mach-uniphier/pinctrl/pinctrl-pro4.c +++ b/arch/arm/mach-uniphier/pinctrl/pinctrl-pro4.c @@ -33,12 +33,5 @@ void uniphier_pro4_pin_init(void) /* sg_set_pinsel(132, 1, 4, 8); */ /* TXD2 -> XNFCE1 */ #endif
-#ifdef CONFIG_USB_XHCI_UNIPHIER - sg_set_pinsel(180, 0, 4, 8); /* USB0VBUS -> USB0VBUS */ - sg_set_pinsel(181, 0, 4, 8); /* USB0OD -> USB0OD */ - sg_set_pinsel(182, 0, 4, 8); /* USB1VBUS -> USB1VBUS */ - sg_set_pinsel(183, 0, 4, 8); /* USB1OD -> USB1OD */ -#endif - writel(1, SG_LOADPINCTRL); } diff --git a/arch/arm/mach-uniphier/pinctrl/pinctrl-pro5.c b/arch/arm/mach-uniphier/pinctrl/pinctrl-pro5.c index 32ba923..58dff18 100644 --- a/arch/arm/mach-uniphier/pinctrl/pinctrl-pro5.c +++ b/arch/arm/mach-uniphier/pinctrl/pinctrl-pro5.c @@ -33,12 +33,5 @@ void uniphier_pro5_pin_init(void) sg_set_pinsel(35, 0, 4, 8); /* NFD7 -> NFD7 */ #endif
-#ifdef CONFIG_USB_XHCI_UNIPHIER - sg_set_pinsel(124, 0, 4, 8); /* USB0VBUS -> USB0VBUS */ - sg_set_pinsel(125, 0, 4, 8); /* USB0OD -> USB0OD */ - sg_set_pinsel(126, 0, 4, 8); /* USB1VBUS -> USB1VBUS */ - sg_set_pinsel(127, 0, 4, 8); /* USB1OD -> USB1OD */ -#endif - writel(1, SG_LOADPINCTRL); } diff --git a/arch/arm/mach-uniphier/pinctrl/pinctrl-pxs2.c b/arch/arm/mach-uniphier/pinctrl/pinctrl-pxs2.c index 2d62ab3..fc59205 100644 --- a/arch/arm/mach-uniphier/pinctrl/pinctrl-pxs2.c +++ b/arch/arm/mach-uniphier/pinctrl/pinctrl-pxs2.c @@ -32,15 +32,4 @@ void uniphier_pxs2_pin_init(void) sg_set_pinsel(45, 8, 8, 4); /* NFD6 -> NFD6 */ sg_set_pinsel(46, 8, 8, 4); /* NFD7 -> NFD7 */ #endif - -#ifdef CONFIG_USB_XHCI_UNIPHIER - sg_set_pinsel(56, 8, 8, 4); /* USB0VBUS -> USB0VBUS */ - sg_set_pinsel(57, 8, 8, 4); /* USB0OD -> USB0OD */ - sg_set_pinsel(58, 8, 8, 4); /* USB1VBUS -> USB1VBUS */ - sg_set_pinsel(59, 8, 8, 4); /* USB1OD -> USB1OD */ - sg_set_pinsel(60, 8, 8, 4); /* USB2VBUS -> USB2VBUS */ - sg_set_pinsel(61, 8, 8, 4); /* USB2OD -> USB2OD */ - sg_set_pinsel(62, 8, 8, 4); /* USB3VBUS -> USB3VBUS */ - sg_set_pinsel(63, 8, 8, 4); /* USB3OD -> USB3OD */ -#endif }

This SoC is equipped with two EHCI cores and two xHCI cores. Enable the generic EHCI driver for the former.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
configs/uniphier_pro4_defconfig | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/configs/uniphier_pro4_defconfig b/configs/uniphier_pro4_defconfig index a7dcc56..ddc582d 100644 --- a/configs/uniphier_pro4_defconfig +++ b/configs/uniphier_pro4_defconfig @@ -32,4 +32,6 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_USB=y CONFIG_USB_XHCI_HCD=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_GENERIC=y CONFIG_USB_STORAGE=y

This is the state-of-the-art MMC driver implementation.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com Reviewed-by: Simon Glass sjg@chromium.org ---
arch/arm/Kconfig | 1 + drivers/mmc/Kconfig | 1 + drivers/mmc/uniphier-sd.c | 50 +++++++++++++++++++++++------------------------ 3 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 512e326..498658d 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -855,6 +855,7 @@ config TARGET_COLIBRI_PXA270
config ARCH_UNIPHIER bool "Socionext UniPhier SoCs" + select BLK select CLK_UNIPHIER select DM select DM_GPIO diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index a71afa5..ba9a723 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -80,6 +80,7 @@ config ROCKCHIP_SDHCI config MMC_UNIPHIER bool "UniPhier SD/MMC Host Controller support" depends on ARCH_UNIPHIER + depends on BLK select DM_MMC_OPS help This selects support for the SD/MMC Host Controller on UniPhier SoCs. diff --git a/drivers/mmc/uniphier-sd.c b/drivers/mmc/uniphier-sd.c index 701b26f..4af7fdb 100644 --- a/drivers/mmc/uniphier-sd.c +++ b/drivers/mmc/uniphier-sd.c @@ -119,9 +119,12 @@ DECLARE_GLOBAL_DATA_PTR; /* alignment required by the DMA engine of this controller */ #define UNIPHIER_SD_DMA_MINALIGN 0x10
-struct uniphier_sd_priv { +struct uniphier_sd_plat { struct mmc_config cfg; - struct mmc *mmc; + struct mmc mmc; +}; + +struct uniphier_sd_priv { void __iomem *regbase; unsigned long mclk; unsigned int version; @@ -654,8 +657,16 @@ static void uniphier_sd_host_init(struct uniphier_sd_priv *priv) } }
+static int uniphier_sd_bind(struct udevice *dev) +{ + struct uniphier_sd_plat *plat = dev_get_platdata(dev); + + return mmc_bind(dev, &plat->mmc, &plat->cfg); +} + static int uniphier_sd_probe(struct udevice *dev) { + struct uniphier_sd_plat *plat = dev_get_platdata(dev); struct uniphier_sd_priv *priv = dev_get_priv(dev); struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); fdt_addr_t base; @@ -691,15 +702,15 @@ static int uniphier_sd_probe(struct udevice *dev) return ret; }
- priv->cfg.name = dev->name; - priv->cfg.host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS; + plat->cfg.name = dev->name; + plat->cfg.host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS;
switch (fdtdec_get_int(gd->fdt_blob, dev->of_offset, "bus-width", 1)) { case 8: - priv->cfg.host_caps |= MMC_MODE_8BIT; + plat->cfg.host_caps |= MMC_MODE_8BIT; break; case 4: - priv->cfg.host_caps |= MMC_MODE_4BIT; + plat->cfg.host_caps |= MMC_MODE_4BIT; break; case 1: break; @@ -722,27 +733,13 @@ static int uniphier_sd_probe(struct udevice *dev)
uniphier_sd_host_init(priv);
- priv->cfg.voltages = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34; - priv->cfg.f_min = priv->mclk / + plat->cfg.voltages = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34; + plat->cfg.f_min = priv->mclk / (priv->caps & UNIPHIER_SD_CAP_DIV1024 ? 1024 : 512); - priv->cfg.f_max = priv->mclk; - priv->cfg.b_max = U32_MAX; /* max value of UNIPHIER_SD_SECCNT */ - - priv->mmc = mmc_create(&priv->cfg, priv); - if (!priv->mmc) - return -EIO; - - upriv->mmc = priv->mmc; - priv->mmc->dev = dev; - - return 0; -} - -static int uniphier_sd_remove(struct udevice *dev) -{ - struct uniphier_sd_priv *priv = dev_get_priv(dev); + plat->cfg.f_max = priv->mclk; + plat->cfg.b_max = U32_MAX; /* max value of UNIPHIER_SD_SECCNT */
- mmc_destroy(priv->mmc); + upriv->mmc = &plat->mmc;
return 0; } @@ -756,8 +753,9 @@ U_BOOT_DRIVER(uniphier_mmc) = { .name = "uniphier-mmc", .id = UCLASS_MMC, .of_match = uniphier_sd_match, + .bind = uniphier_sd_bind, .probe = uniphier_sd_probe, - .remove = uniphier_sd_remove, .priv_auto_alloc_size = sizeof(struct uniphier_sd_priv), + .platdata_auto_alloc_size = sizeof(struct uniphier_sd_plat), .ops = &uniphier_sd_ops, };

This is needed to get access to UniPhier System Bus (external bus).
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
drivers/pinctrl/uniphier/pinctrl-uniphier-ld11.c | 9 +++++++ drivers/pinctrl/uniphier/pinctrl-uniphier-ld20.c | 9 +++++++ drivers/pinctrl/uniphier/pinctrl-uniphier-ld4.c | 18 ++++++++++++++ drivers/pinctrl/uniphier/pinctrl-uniphier-ld6b.c | 21 +++++++++++++++++ drivers/pinctrl/uniphier/pinctrl-uniphier-pro4.c | 30 ++++++++++++++++++++++++ drivers/pinctrl/uniphier/pinctrl-uniphier-pro5.c | 30 ++++++++++++++++++++++++ drivers/pinctrl/uniphier/pinctrl-uniphier-pxs2.c | 9 +++++++ drivers/pinctrl/uniphier/pinctrl-uniphier-sld8.c | 21 +++++++++++++++++ 8 files changed, 147 insertions(+)
diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-ld11.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-ld11.c index e42602b..1d318d8 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-ld11.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-ld11.c @@ -28,6 +28,12 @@ static const int i2c4_muxvals[] = {1, 1}; static const unsigned nand_pins[] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17}; static const int nand_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static const unsigned system_bus_pins[] = {1, 2, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17}; +static const int system_bus_muxvals[] = {0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2}; +static const unsigned system_bus_cs1_pins[] = {0}; +static const int system_bus_cs1_muxvals[] = {0}; static const unsigned uart0_pins[] = {54, 55}; static const int uart0_muxvals[] = {0, 0}; static const unsigned uart1_pins[] = {58, 59}; @@ -52,6 +58,8 @@ static const struct uniphier_pinctrl_group uniphier_ld11_groups[] = { UNIPHIER_PINCTRL_GROUP(i2c3), UNIPHIER_PINCTRL_GROUP(i2c4), UNIPHIER_PINCTRL_GROUP(nand), + UNIPHIER_PINCTRL_GROUP_SPL(system_bus), + UNIPHIER_PINCTRL_GROUP_SPL(system_bus_cs1), UNIPHIER_PINCTRL_GROUP_SPL(uart0), UNIPHIER_PINCTRL_GROUP_SPL(uart1), UNIPHIER_PINCTRL_GROUP_SPL(uart2), @@ -69,6 +77,7 @@ static const char * const uniphier_ld11_functions[] = { UNIPHIER_PINMUX_FUNCTION(i2c3), UNIPHIER_PINMUX_FUNCTION(i2c4), UNIPHIER_PINMUX_FUNCTION(nand), + UNIPHIER_PINMUX_FUNCTION_SPL(system_bus), UNIPHIER_PINMUX_FUNCTION_SPL(uart0), UNIPHIER_PINMUX_FUNCTION_SPL(uart1), UNIPHIER_PINMUX_FUNCTION_SPL(uart2), diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-ld20.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-ld20.c index d6ae512..4ca39e6 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-ld20.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-ld20.c @@ -34,6 +34,12 @@ static const unsigned nand_pins[] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, static const int nand_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; static const unsigned sd_pins[] = {10, 11, 12, 13, 14, 15, 16, 17}; static const int sd_muxvals[] = {3, 3, 3, 3, 3, 3, 3, 3}; /* No SDVOLC */ +static const unsigned system_bus_pins[] = {1, 2, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17}; +static const int system_bus_muxvals[] = {0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2}; +static const unsigned system_bus_cs1_pins[] = {0}; +static const int system_bus_cs1_muxvals[] = {0}; static const unsigned uart0_pins[] = {54, 55}; static const int uart0_muxvals[] = {0, 0}; static const unsigned uart1_pins[] = {58, 59}; @@ -62,6 +68,8 @@ static const struct uniphier_pinctrl_group uniphier_ld20_groups[] = { UNIPHIER_PINCTRL_GROUP(i2c4), UNIPHIER_PINCTRL_GROUP(nand), UNIPHIER_PINCTRL_GROUP(sd), + UNIPHIER_PINCTRL_GROUP_SPL(system_bus), + UNIPHIER_PINCTRL_GROUP_SPL(system_bus_cs1), UNIPHIER_PINCTRL_GROUP_SPL(uart0), UNIPHIER_PINCTRL_GROUP_SPL(uart1), UNIPHIER_PINCTRL_GROUP_SPL(uart2), @@ -82,6 +90,7 @@ static const char * const uniphier_ld20_functions[] = { UNIPHIER_PINMUX_FUNCTION(i2c4), UNIPHIER_PINMUX_FUNCTION(nand), UNIPHIER_PINMUX_FUNCTION(sd), + UNIPHIER_PINMUX_FUNCTION_SPL(system_bus), UNIPHIER_PINMUX_FUNCTION_SPL(uart0), UNIPHIER_PINMUX_FUNCTION_SPL(uart1), UNIPHIER_PINMUX_FUNCTION_SPL(uart2), diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-ld4.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-ld4.c index 955858a..9b3db9d 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-ld4.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-ld4.c @@ -51,6 +51,18 @@ static const unsigned nand_cs1_pins[] = {22, 23}; static const int nand_cs1_muxvals[] = {0, 0}; static const unsigned sd_pins[] = {44, 45, 46, 47, 48, 49, 50, 51, 52}; static const int sd_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; +static const unsigned system_bus_pins[] = {16, 17, 18, 19, 20, 165, 166, 167, + 168, 169, 170, 171, 172, 173}; +static const int system_bus_muxvals[] = {0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, + -1, -1, -1}; +static const unsigned system_bus_cs0_pins[] = {155}; +static const int system_bus_cs0_muxvals[] = {1}; +static const unsigned system_bus_cs1_pins[] = {174}; +static const int system_bus_cs1_muxvals[] = {-1}; +static const unsigned system_bus_cs2_pins[] = {64}; +static const int system_bus_cs2_muxvals[] = {1}; +static const unsigned system_bus_cs3_pins[] = {156}; +static const int system_bus_cs3_muxvals[] = {1}; static const unsigned uart0_pins[] = {85, 88}; static const int uart0_muxvals[] = {1, 1}; static const unsigned uart1_pins[] = {155, 156}; @@ -82,6 +94,11 @@ static const struct uniphier_pinctrl_group uniphier_ld4_groups[] = { UNIPHIER_PINCTRL_GROUP(nand), UNIPHIER_PINCTRL_GROUP(nand_cs1), UNIPHIER_PINCTRL_GROUP(sd), + UNIPHIER_PINCTRL_GROUP(system_bus), + UNIPHIER_PINCTRL_GROUP(system_bus_cs0), + UNIPHIER_PINCTRL_GROUP(system_bus_cs1), + UNIPHIER_PINCTRL_GROUP(system_bus_cs2), + UNIPHIER_PINCTRL_GROUP(system_bus_cs3), UNIPHIER_PINCTRL_GROUP_SPL(uart0), UNIPHIER_PINCTRL_GROUP_SPL(uart1), UNIPHIER_PINCTRL_GROUP_SPL(uart1b), @@ -103,6 +120,7 @@ static const char * const uniphier_ld4_functions[] = { UNIPHIER_PINMUX_FUNCTION(i2c3), UNIPHIER_PINMUX_FUNCTION(nand), UNIPHIER_PINMUX_FUNCTION(sd), + UNIPHIER_PINMUX_FUNCTION(system_bus), UNIPHIER_PINMUX_FUNCTION_SPL(uart0), UNIPHIER_PINMUX_FUNCTION_SPL(uart1), UNIPHIER_PINMUX_FUNCTION_SPL(uart2), diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-ld6b.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-ld6b.c index 5f9407e..80d782c 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-ld6b.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-ld6b.c @@ -48,6 +48,20 @@ static const unsigned nand_cs1_pins[] = {37, 38}; static const int nand_cs1_muxvals[] = {0, 0}; static const unsigned sd_pins[] = {47, 48, 49, 50, 51, 52, 53, 54, 55}; static const int sd_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; +static const unsigned system_bus_pins[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13}; +static const int system_bus_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0}; +static const unsigned system_bus_cs1_pins[] = {14}; +static const int system_bus_cs1_muxvals[] = {0}; +static const unsigned system_bus_cs2_pins[] = {37}; +static const int system_bus_cs2_muxvals[] = {6}; +static const unsigned system_bus_cs3_pins[] = {38}; +static const int system_bus_cs3_muxvals[] = {6}; +static const unsigned system_bus_cs4_pins[] = {115}; +static const int system_bus_cs4_muxvals[] = {6}; +static const unsigned system_bus_cs5_pins[] = {55}; +static const int system_bus_cs5_muxvals[] = {6}; static const unsigned uart0_pins[] = {135, 136}; static const int uart0_muxvals[] = {3, 3}; static const unsigned uart0b_pins[] = {11, 12}; @@ -81,6 +95,12 @@ static const struct uniphier_pinctrl_group uniphier_ld6b_groups[] = { UNIPHIER_PINCTRL_GROUP(nand), UNIPHIER_PINCTRL_GROUP(nand_cs1), UNIPHIER_PINCTRL_GROUP(sd), + UNIPHIER_PINCTRL_GROUP(system_bus), + UNIPHIER_PINCTRL_GROUP(system_bus_cs1), + UNIPHIER_PINCTRL_GROUP(system_bus_cs2), + UNIPHIER_PINCTRL_GROUP(system_bus_cs3), + UNIPHIER_PINCTRL_GROUP(system_bus_cs4), + UNIPHIER_PINCTRL_GROUP(system_bus_cs5), UNIPHIER_PINCTRL_GROUP_SPL(uart0), UNIPHIER_PINCTRL_GROUP_SPL(uart0b), UNIPHIER_PINCTRL_GROUP_SPL(uart1), @@ -103,6 +123,7 @@ static const char * const uniphier_ld6b_functions[] = { UNIPHIER_PINMUX_FUNCTION(i2c3), UNIPHIER_PINMUX_FUNCTION(nand), UNIPHIER_PINMUX_FUNCTION(sd), + UNIPHIER_PINMUX_FUNCTION(system_bus), UNIPHIER_PINMUX_FUNCTION_SPL(uart0), UNIPHIER_PINMUX_FUNCTION_SPL(uart1), UNIPHIER_PINMUX_FUNCTION_SPL(uart2), diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-pro4.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-pro4.c index 6f349dc..f1624da 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-pro4.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-pro4.c @@ -53,6 +53,26 @@ static const int sd_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; static const unsigned sd1_pins[] = {319, 320, 321, 322, 323, 324, 325, 326, 327}; static const int sd1_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; +static const unsigned system_bus_pins[] = {25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38}; +static const int system_bus_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0}; +static const unsigned system_bus_cs0_pins[] = {318}; +static const int system_bus_cs0_muxvals[] = {5}; +static const unsigned system_bus_cs1_pins[] = {24}; +static const int system_bus_cs1_muxvals[] = {0}; +static const unsigned system_bus_cs2_pins[] = {315}; +static const int system_bus_cs2_muxvals[] = {5}; +static const unsigned system_bus_cs3_pins[] = {313}; +static const int system_bus_cs3_muxvals[] = {5}; +static const unsigned system_bus_cs4_pins[] = {305}; +static const int system_bus_cs4_muxvals[] = {5}; +static const unsigned system_bus_cs5_pins[] = {303}; +static const int system_bus_cs5_muxvals[] = {6}; +static const unsigned system_bus_cs6_pins[] = {307}; +static const int system_bus_cs6_muxvals[] = {6}; +static const unsigned system_bus_cs7_pins[] = {312}; +static const int system_bus_cs7_muxvals[] = {6}; static const unsigned uart0_pins[] = {127, 128}; static const int uart0_muxvals[] = {0, 0}; static const unsigned uart1_pins[] = {129, 130}; @@ -86,6 +106,15 @@ static const struct uniphier_pinctrl_group uniphier_pro4_groups[] = { UNIPHIER_PINCTRL_GROUP(nand_cs1), UNIPHIER_PINCTRL_GROUP(sd), UNIPHIER_PINCTRL_GROUP(sd1), + UNIPHIER_PINCTRL_GROUP(system_bus), + UNIPHIER_PINCTRL_GROUP(system_bus_cs0), + UNIPHIER_PINCTRL_GROUP(system_bus_cs1), + UNIPHIER_PINCTRL_GROUP(system_bus_cs2), + UNIPHIER_PINCTRL_GROUP(system_bus_cs3), + UNIPHIER_PINCTRL_GROUP(system_bus_cs4), + UNIPHIER_PINCTRL_GROUP(system_bus_cs5), + UNIPHIER_PINCTRL_GROUP(system_bus_cs6), + UNIPHIER_PINCTRL_GROUP(system_bus_cs7), UNIPHIER_PINCTRL_GROUP_SPL(uart0), UNIPHIER_PINCTRL_GROUP_SPL(uart1), UNIPHIER_PINCTRL_GROUP_SPL(uart2), @@ -109,6 +138,7 @@ static const char * const uniphier_pro4_functions[] = { UNIPHIER_PINMUX_FUNCTION(nand), UNIPHIER_PINMUX_FUNCTION(sd), UNIPHIER_PINMUX_FUNCTION(sd1), + UNIPHIER_PINMUX_FUNCTION(system_bus), UNIPHIER_PINMUX_FUNCTION_SPL(uart0), UNIPHIER_PINMUX_FUNCTION_SPL(uart1), UNIPHIER_PINMUX_FUNCTION_SPL(uart2), diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-pro5.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-pro5.c index 268cdea..9670f25 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-pro5.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-pro5.c @@ -50,6 +50,26 @@ static const unsigned nand_cs1_pins[] = {26, 27}; static const int nand_cs1_muxvals[] = {0, 0}; static const unsigned sd_pins[] = {250, 251, 252, 253, 254, 255, 256, 257, 258}; static const int sd_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; +static const unsigned system_bus_pins[] = {4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17}; +static const int system_bus_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0}; +static const unsigned system_bus_cs0_pins[] = {105}; +static const int system_bus_cs0_muxvals[] = {1}; +static const unsigned system_bus_cs1_pins[] = {18}; +static const int system_bus_cs1_muxvals[] = {0}; +static const unsigned system_bus_cs2_pins[] = {106}; +static const int system_bus_cs2_muxvals[] = {1}; +static const unsigned system_bus_cs3_pins[] = {100}; +static const int system_bus_cs3_muxvals[] = {1}; +static const unsigned system_bus_cs4_pins[] = {101}; +static const int system_bus_cs4_muxvals[] = {1}; +static const unsigned system_bus_cs5_pins[] = {102}; +static const int system_bus_cs5_muxvals[] = {1}; +static const unsigned system_bus_cs6_pins[] = {69}; +static const int system_bus_cs6_muxvals[] = {5}; +static const unsigned system_bus_cs7_pins[] = {70}; +static const int system_bus_cs7_muxvals[] = {5}; static const unsigned uart0_pins[] = {47, 48}; static const int uart0_muxvals[] = {0, 0}; static const unsigned uart0b_pins[] = {227, 228}; @@ -81,6 +101,15 @@ static const struct uniphier_pinctrl_group uniphier_pro5_groups[] = { UNIPHIER_PINCTRL_GROUP(nand), UNIPHIER_PINCTRL_GROUP(nand_cs1), UNIPHIER_PINCTRL_GROUP(sd), + UNIPHIER_PINCTRL_GROUP(system_bus), + UNIPHIER_PINCTRL_GROUP(system_bus_cs0), + UNIPHIER_PINCTRL_GROUP(system_bus_cs1), + UNIPHIER_PINCTRL_GROUP(system_bus_cs2), + UNIPHIER_PINCTRL_GROUP(system_bus_cs3), + UNIPHIER_PINCTRL_GROUP(system_bus_cs4), + UNIPHIER_PINCTRL_GROUP(system_bus_cs5), + UNIPHIER_PINCTRL_GROUP(system_bus_cs6), + UNIPHIER_PINCTRL_GROUP(system_bus_cs7), UNIPHIER_PINCTRL_GROUP_SPL(uart0), UNIPHIER_PINCTRL_GROUP_SPL(uart0b), UNIPHIER_PINCTRL_GROUP_SPL(uart1), @@ -101,6 +130,7 @@ static const char * const uniphier_pro5_functions[] = { UNIPHIER_PINMUX_FUNCTION(i2c6), UNIPHIER_PINMUX_FUNCTION(nand), UNIPHIER_PINMUX_FUNCTION(sd), + UNIPHIER_PINMUX_FUNCTION(system_bus), UNIPHIER_PINMUX_FUNCTION_SPL(uart0), UNIPHIER_PINMUX_FUNCTION_SPL(uart1), UNIPHIER_PINMUX_FUNCTION_SPL(uart2), diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-pxs2.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-pxs2.c index b534274..1d29170 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-pxs2.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-pxs2.c @@ -53,6 +53,12 @@ static const unsigned nand_cs1_pins[] = {37, 38}; static const int nand_cs1_muxvals[] = {8, 8}; static const unsigned sd_pins[] = {47, 48, 49, 50, 51, 52, 53, 54, 55}; static const int sd_muxvals[] = {8, 8, 8, 8, 8, 8, 8, 8, 8}; +static const unsigned system_bus_pins[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13}; +static const int system_bus_muxvals[] = {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8}; +static const unsigned system_bus_cs1_pins[] = {14}; +static const int system_bus_cs1_muxvals[] = {8}; static const unsigned uart0_pins[] = {217, 218}; static const int uart0_muxvals[] = {8, 8}; static const unsigned uart0b_pins[] = {179, 180}; @@ -89,6 +95,8 @@ static const struct uniphier_pinctrl_group uniphier_pxs2_groups[] = { UNIPHIER_PINCTRL_GROUP(nand), UNIPHIER_PINCTRL_GROUP(nand_cs1), UNIPHIER_PINCTRL_GROUP(sd), + UNIPHIER_PINCTRL_GROUP(system_bus), + UNIPHIER_PINCTRL_GROUP(system_bus_cs1), UNIPHIER_PINCTRL_GROUP_SPL(uart0), UNIPHIER_PINCTRL_GROUP_SPL(uart0b), UNIPHIER_PINCTRL_GROUP_SPL(uart1), @@ -114,6 +122,7 @@ static const char * const uniphier_pxs2_functions[] = { UNIPHIER_PINMUX_FUNCTION(i2c6), UNIPHIER_PINMUX_FUNCTION(nand), UNIPHIER_PINMUX_FUNCTION(sd), + UNIPHIER_PINMUX_FUNCTION(system_bus), UNIPHIER_PINMUX_FUNCTION_SPL(uart0), UNIPHIER_PINMUX_FUNCTION_SPL(uart1), UNIPHIER_PINMUX_FUNCTION_SPL(uart2), diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-sld8.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-sld8.c index a85e055..471fb67 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-sld8.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-sld8.c @@ -65,6 +65,20 @@ static const unsigned nand_cs1_pins[] = {22, 23}; static const int nand_cs1_muxvals[] = {0, 0}; static const unsigned sd_pins[] = {32, 33, 34, 35, 36, 37, 38, 39, 40}; static const int sd_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; +static const unsigned system_bus_pins[] = {136, 137, 138, 139, 140, 141, 142, + 143, 144, 145, 146, 147, 148, 149}; +static const int system_bus_muxvals[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1}; +static const unsigned system_bus_cs1_pins[] = {150}; +static const int system_bus_cs1_muxvals[] = {-1}; +static const unsigned system_bus_cs2_pins[] = {10}; +static const int system_bus_cs2_muxvals[] = {1}; +static const unsigned system_bus_cs3_pins[] = {11}; +static const int system_bus_cs3_muxvals[] = {1}; +static const unsigned system_bus_cs4_pins[] = {12}; +static const int system_bus_cs4_muxvals[] = {1}; +static const unsigned system_bus_cs5_pins[] = {13}; +static const int system_bus_cs5_muxvals[] = {1}; static const unsigned uart0_pins[] = {70, 71}; static const int uart0_muxvals[] = {3, 3}; static const unsigned uart1_pins[] = {114, 115}; @@ -92,6 +106,12 @@ static const struct uniphier_pinctrl_group uniphier_sld8_groups[] = { UNIPHIER_PINCTRL_GROUP(nand), UNIPHIER_PINCTRL_GROUP(nand_cs1), UNIPHIER_PINCTRL_GROUP(sd), + UNIPHIER_PINCTRL_GROUP(system_bus), + UNIPHIER_PINCTRL_GROUP(system_bus_cs1), + UNIPHIER_PINCTRL_GROUP(system_bus_cs2), + UNIPHIER_PINCTRL_GROUP(system_bus_cs3), + UNIPHIER_PINCTRL_GROUP(system_bus_cs4), + UNIPHIER_PINCTRL_GROUP(system_bus_cs5), UNIPHIER_PINCTRL_GROUP_SPL(uart0), UNIPHIER_PINCTRL_GROUP_SPL(uart1), UNIPHIER_PINCTRL_GROUP_SPL(uart2), @@ -111,6 +131,7 @@ static const char * const uniphier_sld8_functions[] = { UNIPHIER_PINMUX_FUNCTION(i2c3), UNIPHIER_PINMUX_FUNCTION(nand), UNIPHIER_PINMUX_FUNCTION(sd), + UNIPHIER_PINMUX_FUNCTION(system_bus), UNIPHIER_PINMUX_FUNCTION_SPL(uart0), UNIPHIER_PINMUX_FUNCTION_SPL(uart1), UNIPHIER_PINMUX_FUNCTION_SPL(uart2),

These macros are only referenced in pinctrl-uniphier-core.c, so they need not reside in a header file.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
drivers/pinctrl/uniphier/pinctrl-uniphier-core.c | 4 ++++ drivers/pinctrl/uniphier/pinctrl-uniphier.h | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c index 3f891f1..f2fe313 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c @@ -13,6 +13,10 @@
#include "pinctrl-uniphier.h"
+#define UNIPHIER_PINCTRL_PINMUX_BASE 0x1000 +#define UNIPHIER_PINCTRL_LOAD_PINMUX 0x1700 +#define UNIPHIER_PINCTRL_IECTRL 0x1d00 + static const char *uniphier_pinctrl_dummy_name = "_dummy";
static int uniphier_pinctrl_get_groups_count(struct udevice *dev) diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier.h b/drivers/pinctrl/uniphier/pinctrl-uniphier.h index 4de5b03..76ea1be 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier.h +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier.h @@ -13,10 +13,6 @@ #include <linux/kernel.h> #include <linux/types.h>
-#define UNIPHIER_PINCTRL_PINMUX_BASE 0x1000 -#define UNIPHIER_PINCTRL_LOAD_PINMUX 0x1700 -#define UNIPHIER_PINCTRL_IECTRL 0x1d00 - #define UNIPHIER_PIN_ATTR_PACKED(iectrl) (iectrl)
static inline unsigned int uniphier_pin_get_iectrl(unsigned long data)

This should be handled by the pinctrl driver.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
arch/arm/mach-uniphier/pinctrl/pinctrl-ld4.c | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/arch/arm/mach-uniphier/pinctrl/pinctrl-ld4.c b/arch/arm/mach-uniphier/pinctrl/pinctrl-ld4.c index 625d40c..7ff85b6 100644 --- a/arch/arm/mach-uniphier/pinctrl/pinctrl-ld4.c +++ b/arch/arm/mach-uniphier/pinctrl/pinctrl-ld4.c @@ -11,8 +11,6 @@
void uniphier_ld4_pin_init(void) { - u32 tmp; - /* Comment format: PAD Name -> Function Name */
#ifdef CONFIG_NAND_DENALI @@ -34,8 +32,4 @@ void uniphier_ld4_pin_init(void) sg_set_pinsel(30, 0, 8, 4); /* MMCDAT6 -> NFD6_GB */ sg_set_pinsel(31, 0, 8, 4); /* MMCDAT7 -> NFD7_GB */ #endif - - tmp = readl(SG_IECTRL); - tmp |= 0x41; - writel(tmp, SG_IECTRL); }

We can use checkboard() stub to show additional board information, so misc_init_f() should not be used for this purpose.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
arch/arm/mach-uniphier/Makefile | 1 - arch/arm/mach-uniphier/micro-support-card.c | 2 +- arch/arm/mach-uniphier/micro-support-card.h | 12 +++--------- arch/arm/mach-uniphier/print_misc_info.c | 12 ------------ include/configs/uniphier.h | 1 - 5 files changed, 4 insertions(+), 24 deletions(-) delete mode 100644 arch/arm/mach-uniphier/print_misc_info.c
diff --git a/arch/arm/mach-uniphier/Makefile b/arch/arm/mach-uniphier/Makefile index 774ea99..2e92e15 100644 --- a/arch/arm/mach-uniphier/Makefile +++ b/arch/arm/mach-uniphier/Makefile @@ -11,7 +11,6 @@ else
obj-$(CONFIG_BOARD_EARLY_INIT_F) += board_early_init_f.o obj-$(CONFIG_DISPLAY_CPUINFO) += cpu_info.o -obj-$(CONFIG_MISC_INIT_F) += print_misc_info.o obj-y += dram_init.o obj-y += board_common.o obj-$(CONFIG_BOARD_EARLY_INIT_R) += board_early_init_r.o diff --git a/arch/arm/mach-uniphier/micro-support-card.c b/arch/arm/mach-uniphier/micro-support-card.c index 6987d1e..04e6558 100644 --- a/arch/arm/mach-uniphier/micro-support-card.c +++ b/arch/arm/mach-uniphier/micro-support-card.c @@ -49,7 +49,7 @@ static int support_card_show_revision(void) return 0; }
-int check_support_card(void) +int checkboard(void) { printf("SC: Micro Support Card "); return support_card_show_revision(); diff --git a/arch/arm/mach-uniphier/micro-support-card.h b/arch/arm/mach-uniphier/micro-support-card.h index 5da0ada..630c98d 100644 --- a/arch/arm/mach-uniphier/micro-support-card.h +++ b/arch/arm/mach-uniphier/micro-support-card.h @@ -4,14 +4,13 @@ * SPDX-License-Identifier: GPL-2.0+ */
-#ifndef ARCH_BOARD_H -#define ARCH_BOARD_H +#ifndef MICRO_SUPPORT_CARD_H +#define MICRO_SUPPORT_CARD_H
#if defined(CONFIG_MICRO_SUPPORT_CARD) void support_card_reset(void); void support_card_init(void); void support_card_late_init(void); -int check_support_card(void); void led_puts(const char *s); #else static inline void support_card_reset(void) @@ -26,14 +25,9 @@ static inline void support_card_late_init(void) { }
-static inline int check_support_card(void) -{ - return 0; -} - static inline void led_puts(const char *s) { } #endif
-#endif /* ARCH_BOARD_H */ +#endif /* MICRO_SUPPORT_CARD_H */ diff --git a/arch/arm/mach-uniphier/print_misc_info.c b/arch/arm/mach-uniphier/print_misc_info.c deleted file mode 100644 index 695b7ae..0000000 --- a/arch/arm/mach-uniphier/print_misc_info.c +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (C) 2015 Masahiro Yamada yamada.masahiro@socionext.com - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include "micro-support-card.h" - -int misc_init_f(void) -{ - return check_support_card(); -} diff --git a/include/configs/uniphier.h b/include/configs/uniphier.h index b3ca46b..1e601b9 100644 --- a/include/configs/uniphier.h +++ b/include/configs/uniphier.h @@ -31,7 +31,6 @@
#define CONFIG_DISPLAY_CPUINFO #define CONFIG_DISPLAY_BOARDINFO -#define CONFIG_MISC_INIT_F #define CONFIG_BOARD_EARLY_INIT_F #define CONFIG_BOARD_EARLY_INIT_R #define CONFIG_BOARD_LATE_INIT

Currently, the UniPhier platform calls several init functions in the following order:
[1] spl_board_init() [2] board_early_init_f() [3] board_init() [4] board_early_init_r() [5] board_late_init()
The serial console is not ready at the point of [2], so we want to avoid using [2] from the view point of debuggability. Fortunately, all of the initialization in [2] can be delayed until [3]. I see no good reason to split into [3] and [4]. So, merge [2] through [4].
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
arch/arm/mach-uniphier/Makefile | 4 +--- arch/arm/mach-uniphier/board_common.c | 20 -------------------- arch/arm/mach-uniphier/board_early_init_r.c | 15 --------------- .../{board_early_init_f.c => board_init.c} | 12 +++++++++++- arch/arm/mach-uniphier/init.h | 1 + include/configs/uniphier.h | 2 -- 6 files changed, 13 insertions(+), 41 deletions(-) delete mode 100644 arch/arm/mach-uniphier/board_common.c delete mode 100644 arch/arm/mach-uniphier/board_early_init_r.c rename arch/arm/mach-uniphier/{board_early_init_f.c => board_init.c} (94%)
diff --git a/arch/arm/mach-uniphier/Makefile b/arch/arm/mach-uniphier/Makefile index 2e92e15..1fe5199 100644 --- a/arch/arm/mach-uniphier/Makefile +++ b/arch/arm/mach-uniphier/Makefile @@ -9,11 +9,9 @@ obj-$(CONFIG_MICRO_SUPPORT_CARD) += sbc/
else
-obj-$(CONFIG_BOARD_EARLY_INIT_F) += board_early_init_f.o obj-$(CONFIG_DISPLAY_CPUINFO) += cpu_info.o obj-y += dram_init.o -obj-y += board_common.o -obj-$(CONFIG_BOARD_EARLY_INIT_R) += board_early_init_r.o +obj-y += board_init.o obj-$(CONFIG_BOARD_LATE_INIT) += board_late_init.o obj-y += reset.o
diff --git a/arch/arm/mach-uniphier/board_common.c b/arch/arm/mach-uniphier/board_common.c deleted file mode 100644 index 330d690..0000000 --- a/arch/arm/mach-uniphier/board_common.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2012-2015 Masahiro Yamada yamada.masahiro@socionext.com - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <common.h> - -#include "micro-support-card.h" - -void uniphier_smp_kick_all_cpus(void); - -int board_init(void) -{ - led_puts("Uboo"); -#ifdef CONFIG_ARM64 - uniphier_smp_kick_all_cpus(); -#endif - return 0; -} diff --git a/arch/arm/mach-uniphier/board_early_init_r.c b/arch/arm/mach-uniphier/board_early_init_r.c deleted file mode 100644 index b26da36..0000000 --- a/arch/arm/mach-uniphier/board_early_init_r.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (C) 2014-2015 Masahiro Yamada yamada.masahiro@socionext.com - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <common.h> - -#include "micro-support-card.h" - -int board_early_init_r(void) -{ - support_card_late_init(); - return 0; -} diff --git a/arch/arm/mach-uniphier/board_early_init_f.c b/arch/arm/mach-uniphier/board_init.c similarity index 94% rename from arch/arm/mach-uniphier/board_early_init_f.c rename to arch/arm/mach-uniphier/board_init.c index d35d38d..754e2c8 100644 --- a/arch/arm/mach-uniphier/board_early_init_f.c +++ b/arch/arm/mach-uniphier/board_init.c @@ -45,7 +45,7 @@ static void uniphier_setup_xirq(void) writel(tmp, 0x55000090); }
-int board_early_init_f(void) +int board_init(void) { led_puts("U0");
@@ -122,5 +122,15 @@ int board_early_init_f(void)
led_puts("U2");
+ support_card_late_init(); + + led_puts("U3"); + +#ifdef CONFIG_ARM64 + uniphier_smp_kick_all_cpus(); +#endif + + led_puts("Uboo"); + return 0; } diff --git a/arch/arm/mach-uniphier/init.h b/arch/arm/mach-uniphier/init.h index db80074..a2fedbc 100644 --- a/arch/arm/mach-uniphier/init.h +++ b/arch/arm/mach-uniphier/init.h @@ -115,6 +115,7 @@ void uniphier_pxs2_clk_init(void); void uniphier_ld11_clk_init(void); void uniphier_ld20_clk_init(void);
+void uniphier_smp_kick_all_cpus(void); void cci500_init(int nr_slaves);
#define pr_err(fmt, args...) printf(fmt, ##args) diff --git a/include/configs/uniphier.h b/include/configs/uniphier.h index 1e601b9..f835ff1 100644 --- a/include/configs/uniphier.h +++ b/include/configs/uniphier.h @@ -31,8 +31,6 @@
#define CONFIG_DISPLAY_CPUINFO #define CONFIG_DISPLAY_BOARDINFO -#define CONFIG_BOARD_EARLY_INIT_F -#define CONFIG_BOARD_EARLY_INIT_R #define CONFIG_BOARD_LATE_INIT
#define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024)

Each DRAM channel size of LD21 is half of that of LD20.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
arch/arm/mach-uniphier/boards.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-uniphier/boards.c b/arch/arm/mach-uniphier/boards.c index 20093d8..f54f464 100644 --- a/arch/arm/mach-uniphier/boards.c +++ b/arch/arm/mach-uniphier/boards.c @@ -209,12 +209,12 @@ static const struct uniphier_board_data uniphier_ld21_data = { .dram_nr_ch = 2, .dram_ch[0] = { .base = 0x80000000, - .size = 0x40000000, + .size = 0x20000000, .width = 32, }, .dram_ch[1] = { .base = 0xc0000000, - .size = 0x40000000, + .size = 0x20000000, .width = 32, }, .flags = UNIPHIER_BD_PACKAGE_LD21,

Unfortunately, this SoC needs per-board adjustment between clock and address/command lines. This flag will be passed to the DRAM init function and used for compensating the difference of DRAM timing parameters.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
arch/arm/mach-uniphier/boards.c | 25 ++++++++++++++++++++++++- arch/arm/mach-uniphier/init.h | 11 ++++++++--- 2 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-uniphier/boards.c b/arch/arm/mach-uniphier/boards.c index f54f464..1dececb 100644 --- a/arch/arm/mach-uniphier/boards.c +++ b/arch/arm/mach-uniphier/boards.c @@ -184,6 +184,27 @@ static const struct uniphier_board_data uniphier_ld11_data = { #endif
#if defined(CONFIG_ARCH_UNIPHIER_LD20) +static const struct uniphier_board_data uniphier_ld20_ref_data = { + .dram_freq = 1866, + .dram_nr_ch = 3, + .dram_ch[0] = { + .base = 0x80000000, + .size = 0x40000000, + .width = 32, + }, + .dram_ch[1] = { + .base = 0xc0000000, + .size = 0x40000000, + .width = 32, + }, + .dram_ch[2] = { + .base = 0x100000000UL, + .size = 0x40000000, + .width = 32, + }, + .flags = UNIPHIER_BD_BOARD_LD20_REF, +}; + static const struct uniphier_board_data uniphier_ld20_data = { .dram_freq = 1866, .dram_nr_ch = 3, @@ -202,6 +223,7 @@ static const struct uniphier_board_data uniphier_ld20_data = { .size = 0x40000000, .width = 32, }, + .flags = UNIPHIER_BD_BOARD_LD20_GLOBAL, };
static const struct uniphier_board_data uniphier_ld21_data = { @@ -217,7 +239,7 @@ static const struct uniphier_board_data uniphier_ld21_data = { .size = 0x20000000, .width = 32, }, - .flags = UNIPHIER_BD_PACKAGE_LD21, + .flags = UNIPHIER_BD_BOARD_LD21_GLOBAL, }; #endif
@@ -255,6 +277,7 @@ static const struct uniphier_board_id uniphier_boards[] = { #endif #if defined(CONFIG_ARCH_UNIPHIER_LD20) { "socionext,ph1-ld21", &uniphier_ld21_data, }, + { "socionext,ph1-ld20-ref", &uniphier_ld20_ref_data, }, { "socionext,ph1-ld20", &uniphier_ld20_data, }, #endif }; diff --git a/arch/arm/mach-uniphier/init.h b/arch/arm/mach-uniphier/init.h index a2fedbc..406d5d0 100644 --- a/arch/arm/mach-uniphier/init.h +++ b/arch/arm/mach-uniphier/init.h @@ -23,9 +23,14 @@ struct uniphier_board_data { unsigned int dram_nr_ch; struct uniphier_dram_ch dram_ch[UNIPHIER_MAX_NR_DRAM_CH]; unsigned int flags; -#define UNIPHIER_BD_DDR3PLUS BIT(2) -#define UNIPHIER_BD_PACKAGE_LD21 1 -#define UNIPHIER_BD_PACKAGE_TYPE(f) ((f) & 0x3) + +#define UNIPHIER_BD_DDR3PLUS BIT(2) + +#define UNIPHIER_BD_BOARD_GET_TYPE(f) ((f) & 0x3) +#define UNIPHIER_BD_BOARD_LD20_REF 0 /* LD20 reference */ +#define UNIPHIER_BD_BOARD_LD20_GLOBAL 1 /* LD20 TV Set */ +#define UNIPHIER_BD_BOARD_LD21_REF 2 /* LD21 reference */ +#define UNIPHIER_BD_BOARD_LD21_GLOBAL 3 /* LD21 TV Set */ };
const struct uniphier_board_data *uniphier_get_board_param(void);

2016-09-14 1:05 GMT+09:00 Masahiro Yamada yamada.masahiro@socionext.com:
I want to get this series in during this merge window.
- DM migration
- remove legacy xHCI driver
- convert MMC driver to CONFIG_BLOCK
- Pinctrl driver improvements
- New pin-group
- Macro cleanup
- Misc fixes, cleanups
- Fix DRAM size of LD21 SoC
- Consolidate board init functions
Masahiro Yamada (12): ARM: uniphier: sort select:s alphabetically usb: uniphier: remove UniPhier xHCI driver and select DM_USB ARM: uniphier: delete unnecessary xHCI pin-mux settings ARM: uniphier: enable Generic EHCI driver for Pro4 SoC mmc: uniphier-sd: migrate to CONFIG_BLK pinctrl: uniphier: add System Bus pin-mux settings pinctrl: uniphier: move register base macros from header to .c file ARM: uniphier: remove IECTRL setup code of LD4 SoC ARM: uniphier: use checkboard() instead of misc_init_f() ARM: uniphier: merge board init functions into board_init() ARM: uniphier: fix DRAM size of LD21 SoC package ARM: uniphier: introduce flags to adjust DRAM timing for LD20/LD21
Series, applied to u-boot-uniphier.
participants (1)
-
Masahiro Yamada