From 49b23e035d96227e1d760e26a50688804de175ed Mon Sep 17 00:00:00 2001 From: VlaoMao Date: Fri, 22 Sep 2017 18:49:02 +0300 Subject: [PATCH 1/8] pci: mvebu: Increase size of PCIe default mapping Increase size PCI memory mapping from 32MiB to 128MiB. Signed-off-by: VlaoMao Signed-off-by: Stefan Roese --- drivers/pci/pci_mvebu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c index da0aa29865..076a63f210 100644 --- a/drivers/pci/pci_mvebu.c +++ b/drivers/pci/pci_mvebu.c @@ -82,11 +82,11 @@ struct mvebu_pcie { /* * MVEBU PCIe controller needs MEMORY and I/O BARs to be mapped - * into SoCs address space. Each controller will map 32M of MEM + * into SoCs address space. Each controller will map 128M of MEM * and 64K of I/O space when registered. */ static void __iomem *mvebu_pcie_membase = (void __iomem *)MBUS_PCI_MEM_BASE; -#define PCIE_MEM_SIZE (32 << 20) +#define PCIE_MEM_SIZE (128 << 20) #if defined(CONFIG_ARMADA_38X) #define PCIE_BASE(if) \ From 9b2526f2e13fc532258882f967baa5a90e03ccc7 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Fri, 6 Oct 2017 09:11:38 +0200 Subject: [PATCH 2/8] arm: mvebu: theadorable_debug_defconfig: Enable setexpr command The setexpr command is useful for scripting, lets enable it for this platform. Signed-off-by: Stefan Roese --- configs/theadorable_debug_defconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/configs/theadorable_debug_defconfig b/configs/theadorable_debug_defconfig index 75d592e452..863d6ce3d0 100644 --- a/configs/theadorable_debug_defconfig +++ b/configs/theadorable_debug_defconfig @@ -26,7 +26,6 @@ CONFIG_CMD_PCI=y CONFIG_CMD_SF=y CONFIG_CMD_SPI=y CONFIG_CMD_USB=y -# CONFIG_CMD_SETEXPR is not set CONFIG_CMD_TFTPPUT=y CONFIG_CMD_DHCP=y CONFIG_CMD_MII=y From 6f1a522589046364f6264aeda7116900668b1f20 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 15 Oct 2017 07:03:40 +0200 Subject: [PATCH 3/8] arm: mvebu: configs: Enable DISTRO_DEFAULTS for MACCHIATObin Enable DISTRO_DEFAULTS for mvebu_db_armada8k_defconfig mvebu_mcbin-88f8040_defconfig Signed-off-by: Heinrich Schuchardt Reviewed-by: Stefan Roese Signed-off-by: Stefan Roese --- configs/mvebu_db_armada8k_defconfig | 1 + configs/mvebu_mcbin-88f8040_defconfig | 1 + 2 files changed, 2 insertions(+) diff --git a/configs/mvebu_db_armada8k_defconfig b/configs/mvebu_db_armada8k_defconfig index 9fa4d9f98c..cffb3d06e6 100644 --- a/configs/mvebu_db_armada8k_defconfig +++ b/configs/mvebu_db_armada8k_defconfig @@ -3,6 +3,7 @@ CONFIG_ARCH_MVEBU=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_MVEBU_ARMADA_8K=y CONFIG_DEFAULT_DEVICE_TREE="armada-8040-db" +CONFIG_DISTRO_DEFAULTS=y CONFIG_SMBIOS_PRODUCT_NAME="" CONFIG_DEBUG_UART=y CONFIG_AHCI=y diff --git a/configs/mvebu_mcbin-88f8040_defconfig b/configs/mvebu_mcbin-88f8040_defconfig index 9afe651872..f779793082 100644 --- a/configs/mvebu_mcbin-88f8040_defconfig +++ b/configs/mvebu_mcbin-88f8040_defconfig @@ -3,6 +3,7 @@ CONFIG_ARCH_MVEBU=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_MVEBU_ARMADA_8K=y CONFIG_DEFAULT_DEVICE_TREE="armada-8040-mcbin" +CONFIG_DISTRO_DEFAULTS=y CONFIG_SMBIOS_PRODUCT_NAME="" CONFIG_DEBUG_UART=y CONFIG_AHCI=y From d3d036af8c0ee848c4113dc609bbd6ab26ebc6cb Mon Sep 17 00:00:00 2001 From: Jon Nettleton Date: Mon, 6 Nov 2017 10:33:19 +0200 Subject: [PATCH 4/8] mvebu: usb: xhci: a38x support This makes the initial changes need to support the a38x series of SOCs. It adds the device-tree identifier as well as changing the board_support function to take the IO address designated by device-tree. Signed-off-by: Jon Nettleton [baruch: use fdt_addr_t; update 37xx and 8K implementations] Signed-off-by: Baruch Siach Signed-off-by: Stefan Roese --- board/Marvell/mvebu_armada-37xx/board.c | 2 +- board/Marvell/mvebu_armada-8k/board.c | 2 +- drivers/usb/host/xhci-mvebu.c | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c index 8dc1f46d97..ac3e3a392f 100644 --- a/board/Marvell/mvebu_armada-37xx/board.c +++ b/board/Marvell/mvebu_armada-37xx/board.c @@ -123,7 +123,7 @@ int board_ahci_enable(void) } /* Board specific xHCI enable code */ -int board_xhci_enable(void) +int board_xhci_enable(fdt_addr_t base) { struct udevice *dev; int ret; diff --git a/board/Marvell/mvebu_armada-8k/board.c b/board/Marvell/mvebu_armada-8k/board.c index 7d1b5d9f62..f4eabfb14f 100644 --- a/board/Marvell/mvebu_armada-8k/board.c +++ b/board/Marvell/mvebu_armada-8k/board.c @@ -95,7 +95,7 @@ int board_xhci_config(void) return 0; } -int board_xhci_enable(void) +int board_xhci_enable(fdt_addr_t base) { struct udevice *dev; int ret; diff --git a/drivers/usb/host/xhci-mvebu.c b/drivers/usb/host/xhci-mvebu.c index b9201a5a6a..dbdfce38da 100644 --- a/drivers/usb/host/xhci-mvebu.c +++ b/drivers/usb/host/xhci-mvebu.c @@ -35,7 +35,7 @@ struct mvebu_xhci { * Dummy implementation that can be overwritten by a board * specific function */ -__weak int board_xhci_enable(void) +__weak int board_xhci_enable(fdt_addr_t base) { return 0; } @@ -62,7 +62,7 @@ static int xhci_usb_probe(struct udevice *dev) } /* Enable USB xHCI (VBUS, reset etc) in board specific code */ - board_xhci_enable(); + board_xhci_enable(devfdt_get_addr_index(dev, 1)); return xhci_register(dev, ctx->hcd, hcor); } @@ -85,6 +85,7 @@ static int xhci_usb_ofdata_to_platdata(struct udevice *dev) static const struct udevice_id xhci_usb_ids[] = { { .compatible = "marvell,armada3700-xhci" }, + { .compatible = "marvell,armada-380-xhci" }, { .compatible = "marvell,armada-8k-xhci" }, { } }; From 78aa018f079598082087a3b7a319a82d486982fb Mon Sep 17 00:00:00 2001 From: Jon Nettleton Date: Mon, 6 Nov 2017 10:33:20 +0200 Subject: [PATCH 5/8] arm: mvebu: Add board_setup for xhci hardware This fixes the USB 3.0 support for the a38x SOC. Signed-off-by: Jon Nettleton [baruch: use fdt_addr_t] Signed-off-by: Baruch Siach Signed-off-by: Stefan Roese --- arch/arm/mach-mvebu/cpu.c | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c index 74a63dd656..7c64a68388 100644 --- a/arch/arm/mach-mvebu/cpu.c +++ b/arch/arm/mach-mvebu/cpu.c @@ -554,6 +554,47 @@ void scsi_init(void) } #endif +#ifdef CONFIG_USB_XHCI_MVEBU +#define USB3_MAX_WINDOWS 4 +#define USB3_WIN_CTRL(w) (0x0 + ((w) * 8)) +#define USB3_WIN_BASE(w) (0x4 + ((w) * 8)) + +static void xhci_mvebu_mbus_config(void __iomem *base, + const struct mbus_dram_target_info *dram) +{ + int i; + + for (i = 0; i < USB3_MAX_WINDOWS; i++) { + writel(0, base + USB3_WIN_CTRL(i)); + writel(0, base + USB3_WIN_BASE(i)); + } + + for (i = 0; i < dram->num_cs; i++) { + const struct mbus_dram_window *cs = dram->cs + i; + + /* Write size, attributes and target id to control register */ + writel(((cs->size - 1) & 0xffff0000) | (cs->mbus_attr << 8) | + (dram->mbus_dram_target_id << 4) | 1, + base + USB3_WIN_CTRL(i)); + + /* Write base address to base register */ + writel((cs->base & 0xffff0000), base + USB3_WIN_BASE(i)); + } +} + +int board_xhci_enable(fdt_addr_t base) +{ + const struct mbus_dram_target_info *dram; + + printf("MVEBU XHCI INIT controller @ 0x%lx\n", base); + + dram = mvebu_mbus_dram_info(); + xhci_mvebu_mbus_config((void __iomem *)base, dram); + + return 0; +} +#endif + void enable_caches(void) { /* Avoid problem with e.g. neta ethernet driver */ From b4b06ac6f767b833acf7cf6e7533ead2f4425378 Mon Sep 17 00:00:00 2001 From: Jon Nettleton Date: Mon, 6 Nov 2017 10:33:21 +0200 Subject: [PATCH 6/8] arm: mvebu: clearfog: enable XHCI USB Enable the driver by default for the clearfog boards since the external port is configured for XHCI. Signed-off-by: Jon Nettleton [baruch: split from the SoC setup patch] Signed-off-by: Baruch Siach Signed-off-by: Stefan Roese --- configs/clearfog_defconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig index fa9f04a9d8..3de204346d 100644 --- a/configs/clearfog_defconfig +++ b/configs/clearfog_defconfig @@ -43,5 +43,6 @@ CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYS_NS16550=y CONFIG_USB=y CONFIG_DM_USB=y -CONFIG_USB_EHCI_HCD=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_MVEBU=y CONFIG_USB_STORAGE=y From 962b8fef91fbfa58c1045bee4d9a73c72b46c829 Mon Sep 17 00:00:00 2001 From: Jon Nettleton Date: Mon, 13 Nov 2017 07:04:30 +0200 Subject: [PATCH 7/8] arm: mvebu: clearfog: Fix SPI-NOR flash access The production variant of the SPI flash used by the clearfog devices are based on winbond chips. Additionally enable SPI_FLASH_BAR since some variants will have 16MB of flash that requires this to be enabled. Remove the default speed and mode; these values are taken from the device tree when CONFIG_DM_SPI_FLASH is enabled. Add default bus, so that 'sf' detects the SPI flash by default. Signed-off-by: Jon Nettleton [baruch: remove speed/mode; add bus; move winbond to defconfig] Signed-off-by: Baruch Siach Signed-off-by: Stefan Roese --- configs/clearfog_defconfig | 3 +++ include/configs/clearfog.h | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig index 3de204346d..5fa645a45e 100644 --- a/configs/clearfog_defconfig +++ b/configs/clearfog_defconfig @@ -46,3 +46,6 @@ CONFIG_DM_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_MVEBU=y CONFIG_USB_STORAGE=y +CONFIG_SPI_FLASH_BAR=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_MTD=y diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h index 5061f6c6fd..bf87bac300 100644 --- a/include/configs/clearfog.h +++ b/include/configs/clearfog.h @@ -33,9 +33,7 @@ #define CONFIG_SYS_I2C_SPEED 100000 /* SPI NOR flash default params, used by sf commands */ -#define CONFIG_SF_DEFAULT_SPEED 1000000 -#define CONFIG_SF_DEFAULT_MODE SPI_MODE_3 -#define CONFIG_SPI_FLASH_STMICRO +#define CONFIG_SF_DEFAULT_BUS 1 /* * SDIO/MMC Card Configuration From 8c1ce928f498774a3e2c3aa03534b6e6ca6d4759 Mon Sep 17 00:00:00 2001 From: Baruch Siach Date: Mon, 13 Nov 2017 07:04:31 +0200 Subject: [PATCH 8/8] arm: mvebu: clearfog: update SPI flash DT description All current ClearFog SOMs have the SPI flash populated. Enable SPI flash in the device tree. Add an alias to the SPI bus so that the 'sf' command can probe the flash on bus 1. Add the "spi-flash" compatible string to make the standard SPI flash driver probe the device. Reviewed-by: Jagan Teki Signed-off-by: Baruch Siach Signed-off-by: Stefan Roese --- arch/arm/dts/armada-388-clearfog.dts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/arch/arm/dts/armada-388-clearfog.dts b/arch/arm/dts/armada-388-clearfog.dts index b2dfd56435..bc52bc0167 100644 --- a/arch/arm/dts/armada-388-clearfog.dts +++ b/arch/arm/dts/armada-388-clearfog.dts @@ -61,6 +61,7 @@ ethernet1 = ð0; ethernet2 = ð1; ethernet3 = ð2; + spi1 = &spi1; }; chosen { @@ -330,11 +331,9 @@ status = "okay"; }; - spi@10680 { + spi1: spi@10680 { /* - * We don't seem to have the W25Q32 on the - * A1 Rev 2.0 boards, so disable SPI. - * CS0: W25Q32 (doesn't appear to be present) + * CS0: W25Q32 * CS1: * CS2: mikrobus */ @@ -345,10 +344,9 @@ spi-flash@0 { #address-cells = <1>; #size-cells = <0>; - compatible = "w25q32", "jedec,spi-nor"; + compatible = "w25q32", "jedec,spi-nor", "spi-flash"; reg = <0>; /* Chip select 0 */ spi-max-frequency = <3000000>; - status = "disabled"; }; };