[U-Boot] [PATCH v2 00/12] Add Marvell ESPRESSOBin community board support

From: Konstantin Porotchkin kostap@marvell.com
This patch set adds support for Marvell ESPRESSOBin community board. The Marvell ESPRESSOBin is a tiny board made by Globalscale and available on KickStarter project site. It has (current board version 3.1.1): - Dual core Cortex-A53 @1.2GHz CPU (Marvell Armada-3720) - 512MB/1GB/2GB DDR3 RAM (depends on selected configuration) - Mini-PCIe 2.0 slot - Single SATA-3 port with Molex SATA power connector - USB 2.0 port - USB 3.0 port - Gigabit Ethernet switch with 3 ports - Micro-SD socket - Soldering pads for (unpopulated) eMMC chip - Two 46-pin GPIO connectors. - SPI boot flash - Boot source selection jumpers (SPI/SATA/UART/Auto) - Micro JTAG connector (10 pin) - Micro USB serial port
Changes for v2: - The patch set has grew by 2 patches: - Changed naming of common A37xx files from board-specific to platform (mvebu_db-88f3720 =>> mvebu_armada-37xx) - Removed CONFIG_DM_I2C_COMPAT from board configuration files as advised by compilation warning - Rebase all related files on top of newly named platform and on top of "Prepare v2017.03-rc2" commit - Beatify the Topaz initialization code by using register names instead of numeric address values - Added missing include in board support code
Konstantin Porotchkin (12): arm64: mvebu: Rename the db-88f3720 to armada-37xx platform arm64: a37xx: Enable Marvell ETH PHY support arm64: a37xx: Enable bubt command support on A3720-DB arm64: a37xx: dts: Add pin control nodes to DT arm64: a37xx: Handle pin controls in early board init mvebu: neta: Add support for board init function mvebu: neta: a37xx: Add fixed link support to neta driver mvebu: a37xx: Add init for ESPRESSBin Topaz switch arm64: dts: Add device tree for ESPRESSOBin board arm64: mvebu: Add default config for ESPRESSOBin board arm64: a37xx: Disable DB configurations on ESPRESSOBin board arm64: a37xx: Remove DM_I2C_COMPAT from the board config
arch/arm/dts/Makefile | 1 + arch/arm/dts/armada-3720-espressobin.dts | 135 +++++++++++++++ arch/arm/dts/armada-37xx.dtsi | 14 ++ arch/arm/mach-mvebu/Kconfig | 10 +- board/Marvell/mvebu_armada-37xx/MAINTAINERS | 6 + board/Marvell/mvebu_armada-37xx/Makefile | 7 + board/Marvell/mvebu_armada-37xx/board.c | 258 ++++++++++++++++++++++++++++ board/Marvell/mvebu_db-88f3720/MAINTAINERS | 6 - board/Marvell/mvebu_db-88f3720/Makefile | 7 - board/Marvell/mvebu_db-88f3720/board.c | 134 --------------- configs/mvebu_db-88f3720_defconfig | 6 +- configs/mvebu_espressobin-88f3720_defconfig | 66 +++++++ drivers/net/mvneta.c | 125 +++++++++++--- include/configs/mvebu_armada-37xx.h | 131 ++++++++++++++ include/configs/mvebu_db-88f3720.h | 130 -------------- 15 files changed, 724 insertions(+), 312 deletions(-) create mode 100644 arch/arm/dts/armada-3720-espressobin.dts create mode 100644 board/Marvell/mvebu_armada-37xx/MAINTAINERS create mode 100644 board/Marvell/mvebu_armada-37xx/Makefile create mode 100644 board/Marvell/mvebu_armada-37xx/board.c delete mode 100644 board/Marvell/mvebu_db-88f3720/MAINTAINERS delete mode 100644 board/Marvell/mvebu_db-88f3720/Makefile delete mode 100644 board/Marvell/mvebu_db-88f3720/board.c create mode 100644 configs/mvebu_espressobin-88f3720_defconfig create mode 100644 include/configs/mvebu_armada-37xx.h delete mode 100644 include/configs/mvebu_db-88f3720.h

From: Konstantin Porotchkin kostap@marvell.com
Modify the file names and deifinitions relater to Marvell db-77f3720 board support. Convert these names to more generic armada-37xx platform for future addition of more boards based on the same SoC family.
Signed-off-by: Konstantin Porotchkin kostap@marvell.com Cc: Stefan Roese sr@denx.de Cc: Igal Liberman igall@marvell.com Cc: Nadav Haklai nadavh@marvell.com --- Changes for v2: - This patch was missing in the v1
arch/arm/mach-mvebu/Kconfig | 10 +-- board/Marvell/mvebu_armada-37xx/MAINTAINERS | 6 ++ board/Marvell/mvebu_armada-37xx/Makefile | 7 ++ board/Marvell/mvebu_armada-37xx/board.c | 134 ++++++++++++++++++++++++++++ board/Marvell/mvebu_db-88f3720/MAINTAINERS | 6 -- board/Marvell/mvebu_db-88f3720/Makefile | 7 -- board/Marvell/mvebu_db-88f3720/board.c | 134 ---------------------------- configs/mvebu_db-88f3720_defconfig | 2 +- include/configs/mvebu_armada-37xx.h | 130 +++++++++++++++++++++++++++ include/configs/mvebu_db-88f3720.h | 130 --------------------------- 10 files changed, 283 insertions(+), 283 deletions(-) create mode 100644 board/Marvell/mvebu_armada-37xx/MAINTAINERS create mode 100644 board/Marvell/mvebu_armada-37xx/Makefile create mode 100644 board/Marvell/mvebu_armada-37xx/board.c delete mode 100644 board/Marvell/mvebu_db-88f3720/MAINTAINERS delete mode 100644 board/Marvell/mvebu_db-88f3720/Makefile delete mode 100644 board/Marvell/mvebu_db-88f3720/board.c create mode 100644 include/configs/mvebu_armada-37xx.h delete mode 100644 include/configs/mvebu_db-88f3720.h
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 412bda4..a256c2f 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -74,8 +74,8 @@ config TARGET_CLEARFOG bool "Support ClearFog" select 88F6820
-config TARGET_MVEBU_DB_88F3720 - bool "Support DB-88F3720 Armada 3720" +config TARGET_MVEBU_ARMADA_37XX + bool "Support Armada 37xx platforms" select ARMADA_3700
config TARGET_DB_88F6720 @@ -116,7 +116,7 @@ endchoice
config SYS_BOARD default "clearfog" if TARGET_CLEARFOG - default "mvebu_db-88f3720" if TARGET_MVEBU_DB_88F3720 + default "mvebu_armada-37xx" if TARGET_MVEBU_ARMADA_37XX default "db-88f6720" if TARGET_DB_88F6720 default "db-88f6820-gp" if TARGET_DB_88F6820_GP default "db-88f6820-amc" if TARGET_DB_88F6820_AMC @@ -128,7 +128,7 @@ config SYS_BOARD
config SYS_CONFIG_NAME default "clearfog" if TARGET_CLEARFOG - default "mvebu_db-88f3720" if TARGET_MVEBU_DB_88F3720 + default "mvebu_armada-37xx" if TARGET_MVEBU_ARMADA_37XX default "db-88f6720" if TARGET_DB_88F6720 default "db-88f6820-gp" if TARGET_DB_88F6820_GP default "db-88f6820-amc" if TARGET_DB_88F6820_AMC @@ -140,7 +140,7 @@ config SYS_CONFIG_NAME
config SYS_VENDOR default "Marvell" if TARGET_DB_MV784MP_GP - default "Marvell" if TARGET_MVEBU_DB_88F3720 + default "Marvell" if TARGET_MVEBU_ARMADA_37XX default "Marvell" if TARGET_DB_88F6720 default "Marvell" if TARGET_DB_88F6820_GP default "Marvell" if TARGET_DB_88F6820_AMC diff --git a/board/Marvell/mvebu_armada-37xx/MAINTAINERS b/board/Marvell/mvebu_armada-37xx/MAINTAINERS new file mode 100644 index 0000000..52a3869 --- /dev/null +++ b/board/Marvell/mvebu_armada-37xx/MAINTAINERS @@ -0,0 +1,6 @@ +MVEBU_DB_88F3720 BOARD +M: Stefan Roese sr@denx.de +S: Maintained +F: board/Marvell/mvebu_armada-37xx/ +F: include/configs/mvebu_armada-37xx.h +F: configs/mvebu_db-88f3720_defconfig diff --git a/board/Marvell/mvebu_armada-37xx/Makefile b/board/Marvell/mvebu_armada-37xx/Makefile new file mode 100644 index 0000000..ed39738 --- /dev/null +++ b/board/Marvell/mvebu_armada-37xx/Makefile @@ -0,0 +1,7 @@ +# +# Copyright (C) 2016 Stefan Roese sr@denx.de +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y := board.o diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c new file mode 100644 index 0000000..edf88c7 --- /dev/null +++ b/board/Marvell/mvebu_armada-37xx/board.c @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2016 Stefan Roese sr@denx.de + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <common.h> +#include <i2c.h> +#include <asm/io.h> +#include <asm/arch/cpu.h> +#include <asm/arch/soc.h> + +DECLARE_GLOBAL_DATA_PTR; + +/* IO expander I2C device */ +#define I2C_IO_EXP_ADDR 0x22 +#define I2C_IO_CFG_REG_0 0x6 +#define I2C_IO_DATA_OUT_REG_0 0x2 +#define I2C_IO_REG_0_SATA_OFF 2 +#define I2C_IO_REG_0_USB_H_OFF 1 + +int board_early_init_f(void) +{ + /* Nothing to do (yet), perhaps later some pin-muxing etc */ + + return 0; +} + +int board_init(void) +{ + /* adress of boot parameters */ + gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; + + return 0; +} + +/* Board specific AHCI / SATA enable code */ +int board_ahci_enable(void) +{ + struct udevice *dev; + int ret; + u8 buf[8]; + + /* Configure IO exander PCA9555: 7bit address 0x22 */ + ret = i2c_get_chip_for_busnum(0, I2C_IO_EXP_ADDR, 1, &dev); + if (ret) { + printf("Cannot find PCA9555: %d\n", ret); + return 0; + } + + ret = dm_i2c_read(dev, I2C_IO_CFG_REG_0, buf, 1); + if (ret) { + printf("Failed to read IO expander value via I2C\n"); + return -EIO; + } + + /* + * Enable SATA power via IO expander connected via I2C by setting + * the corresponding bit to output mode to enable power for SATA + */ + buf[0] &= ~(1 << I2C_IO_REG_0_SATA_OFF); + ret = dm_i2c_write(dev, I2C_IO_CFG_REG_0, buf, 1); + if (ret) { + printf("Failed to set IO expander via I2C\n"); + return -EIO; + } + + return 0; +} + +/* Board specific xHCI enable code */ +int board_xhci_enable(void) +{ + struct udevice *dev; + int ret; + u8 buf[8]; + + /* Configure IO exander PCA9555: 7bit address 0x22 */ + ret = i2c_get_chip_for_busnum(0, I2C_IO_EXP_ADDR, 1, &dev); + if (ret) { + printf("Cannot find PCA9555: %d\n", ret); + return 0; + } + + printf("Enable USB VBUS\n"); + + /* + * Read configuration (direction) and set VBUS pin as output + * (reset pin = output) + */ + ret = dm_i2c_read(dev, I2C_IO_CFG_REG_0, buf, 1); + if (ret) { + printf("Failed to read IO expander value via I2C\n"); + return -EIO; + } + buf[0] &= ~(1 << I2C_IO_REG_0_USB_H_OFF); + ret = dm_i2c_write(dev, I2C_IO_CFG_REG_0, buf, 1); + if (ret) { + printf("Failed to set IO expander via I2C\n"); + return -EIO; + } + + /* Read VBUS output value and disable it */ + ret = dm_i2c_read(dev, I2C_IO_DATA_OUT_REG_0, buf, 1); + if (ret) { + printf("Failed to read IO expander value via I2C\n"); + return -EIO; + } + buf[0] &= ~(1 << I2C_IO_REG_0_USB_H_OFF); + ret = dm_i2c_write(dev, I2C_IO_DATA_OUT_REG_0, buf, 1); + if (ret) { + printf("Failed to set IO expander via I2C\n"); + return -EIO; + } + + /* + * Required delay for configuration to settle - must wait for + * power on port is disabled in case VBUS signal was high, + * required 3 seconds delay to let VBUS signal fully settle down + */ + mdelay(3000); + + /* Enable VBUS power: Set output value of VBUS pin as enabled */ + buf[0] |= (1 << I2C_IO_REG_0_USB_H_OFF); + ret = dm_i2c_write(dev, I2C_IO_DATA_OUT_REG_0, buf, 1); + if (ret) { + printf("Failed to set IO expander via I2C\n"); + return -EIO; + } + + mdelay(500); /* required delay to let output value settle */ + + return 0; +} diff --git a/board/Marvell/mvebu_db-88f3720/MAINTAINERS b/board/Marvell/mvebu_db-88f3720/MAINTAINERS deleted file mode 100644 index 4e80917..0000000 --- a/board/Marvell/mvebu_db-88f3720/MAINTAINERS +++ /dev/null @@ -1,6 +0,0 @@ -MVEBU_DB_88F3720 BOARD -M: Stefan Roese sr@denx.de -S: Maintained -F: board/Marvell/mvebu_db-88f3720/ -F: include/configs/mvebu_db-88f3720.h -F: configs/mvebu_db-88f3720_defconfig diff --git a/board/Marvell/mvebu_db-88f3720/Makefile b/board/Marvell/mvebu_db-88f3720/Makefile deleted file mode 100644 index ed39738..0000000 --- a/board/Marvell/mvebu_db-88f3720/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# -# Copyright (C) 2016 Stefan Roese sr@denx.de -# -# SPDX-License-Identifier: GPL-2.0+ -# - -obj-y := board.o diff --git a/board/Marvell/mvebu_db-88f3720/board.c b/board/Marvell/mvebu_db-88f3720/board.c deleted file mode 100644 index edf88c7..0000000 --- a/board/Marvell/mvebu_db-88f3720/board.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (C) 2016 Stefan Roese sr@denx.de - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <common.h> -#include <i2c.h> -#include <asm/io.h> -#include <asm/arch/cpu.h> -#include <asm/arch/soc.h> - -DECLARE_GLOBAL_DATA_PTR; - -/* IO expander I2C device */ -#define I2C_IO_EXP_ADDR 0x22 -#define I2C_IO_CFG_REG_0 0x6 -#define I2C_IO_DATA_OUT_REG_0 0x2 -#define I2C_IO_REG_0_SATA_OFF 2 -#define I2C_IO_REG_0_USB_H_OFF 1 - -int board_early_init_f(void) -{ - /* Nothing to do (yet), perhaps later some pin-muxing etc */ - - return 0; -} - -int board_init(void) -{ - /* adress of boot parameters */ - gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; - - return 0; -} - -/* Board specific AHCI / SATA enable code */ -int board_ahci_enable(void) -{ - struct udevice *dev; - int ret; - u8 buf[8]; - - /* Configure IO exander PCA9555: 7bit address 0x22 */ - ret = i2c_get_chip_for_busnum(0, I2C_IO_EXP_ADDR, 1, &dev); - if (ret) { - printf("Cannot find PCA9555: %d\n", ret); - return 0; - } - - ret = dm_i2c_read(dev, I2C_IO_CFG_REG_0, buf, 1); - if (ret) { - printf("Failed to read IO expander value via I2C\n"); - return -EIO; - } - - /* - * Enable SATA power via IO expander connected via I2C by setting - * the corresponding bit to output mode to enable power for SATA - */ - buf[0] &= ~(1 << I2C_IO_REG_0_SATA_OFF); - ret = dm_i2c_write(dev, I2C_IO_CFG_REG_0, buf, 1); - if (ret) { - printf("Failed to set IO expander via I2C\n"); - return -EIO; - } - - return 0; -} - -/* Board specific xHCI enable code */ -int board_xhci_enable(void) -{ - struct udevice *dev; - int ret; - u8 buf[8]; - - /* Configure IO exander PCA9555: 7bit address 0x22 */ - ret = i2c_get_chip_for_busnum(0, I2C_IO_EXP_ADDR, 1, &dev); - if (ret) { - printf("Cannot find PCA9555: %d\n", ret); - return 0; - } - - printf("Enable USB VBUS\n"); - - /* - * Read configuration (direction) and set VBUS pin as output - * (reset pin = output) - */ - ret = dm_i2c_read(dev, I2C_IO_CFG_REG_0, buf, 1); - if (ret) { - printf("Failed to read IO expander value via I2C\n"); - return -EIO; - } - buf[0] &= ~(1 << I2C_IO_REG_0_USB_H_OFF); - ret = dm_i2c_write(dev, I2C_IO_CFG_REG_0, buf, 1); - if (ret) { - printf("Failed to set IO expander via I2C\n"); - return -EIO; - } - - /* Read VBUS output value and disable it */ - ret = dm_i2c_read(dev, I2C_IO_DATA_OUT_REG_0, buf, 1); - if (ret) { - printf("Failed to read IO expander value via I2C\n"); - return -EIO; - } - buf[0] &= ~(1 << I2C_IO_REG_0_USB_H_OFF); - ret = dm_i2c_write(dev, I2C_IO_DATA_OUT_REG_0, buf, 1); - if (ret) { - printf("Failed to set IO expander via I2C\n"); - return -EIO; - } - - /* - * Required delay for configuration to settle - must wait for - * power on port is disabled in case VBUS signal was high, - * required 3 seconds delay to let VBUS signal fully settle down - */ - mdelay(3000); - - /* Enable VBUS power: Set output value of VBUS pin as enabled */ - buf[0] |= (1 << I2C_IO_REG_0_USB_H_OFF); - ret = dm_i2c_write(dev, I2C_IO_DATA_OUT_REG_0, buf, 1); - if (ret) { - printf("Failed to set IO expander via I2C\n"); - return -EIO; - } - - mdelay(500); /* required delay to let output value settle */ - - return 0; -} diff --git a/configs/mvebu_db-88f3720_defconfig b/configs/mvebu_db-88f3720_defconfig index 80f2599..4286695 100644 --- a/configs/mvebu_db-88f3720_defconfig +++ b/configs/mvebu_db-88f3720_defconfig @@ -1,7 +1,7 @@ CONFIG_ARM=y CONFIG_ARCH_MVEBU=y CONFIG_SYS_MALLOC_F_LEN=0x2000 -CONFIG_TARGET_MVEBU_DB_88F3720=y +CONFIG_TARGET_MVEBU_ARMADA_37XX=y CONFIG_DEFAULT_DEVICE_TREE="armada-3720-db" CONFIG_AHCI=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set diff --git a/include/configs/mvebu_armada-37xx.h b/include/configs/mvebu_armada-37xx.h new file mode 100644 index 0000000..f5adfef --- /dev/null +++ b/include/configs/mvebu_armada-37xx.h @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2016 Stefan Roese sr@denx.de + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef _CONFIG_MVEBU_ARMADA_37XX_H +#define _CONFIG_MVEBU_ARMADA_37XX_H + +/* + * High Level Configuration Options (easy to change) + */ +#define CONFIG_DISPLAY_BOARDINFO_LATE + +#define CONFIG_SYS_TEXT_BASE 0x00000000 + +/* additions for new ARM relocation support */ +#define CONFIG_SYS_SDRAM_BASE 0x00000000 + +#define CONFIG_NR_DRAM_BANKS 1 + +/* auto boot */ +#define CONFIG_PREBOOT + +#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, \ + 115200, 230400, 460800, 921600 } + +/* + * For booting Linux, the board info and command line data + * have to be in the first 8 MB of memory, since this is + * the maximum mapped by the Linux kernel during initialization. + */ +#define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */ +#define CONFIG_INITRD_TAG /* enable INITRD tag */ +#define CONFIG_SETUP_MEMORY_TAGS /* enable memory tag */ + +#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buff Size */ +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE \ + +sizeof(CONFIG_SYS_PROMPT) + 16) /* Print Buff */ + +/* + * Size of malloc() pool + */ +#define CONFIG_SYS_MALLOC_LEN (4 << 20) /* 4MiB for malloc() */ + +/* + * Other required minimal configurations + */ +#define CONFIG_SYS_LONGHELP +#define CONFIG_AUTO_COMPLETE +#define CONFIG_CMDLINE_EDITING +#define CONFIG_ARCH_CPU_INIT /* call arch_cpu_init() */ +#define CONFIG_SYS_LOAD_ADDR 0x00800000 /* default load adr- 8M */ +#define CONFIG_SYS_MEMTEST_START 0x00800000 /* 8M */ +#define CONFIG_SYS_MEMTEST_END 0x00ffffff /*(_16M -1) */ +#define CONFIG_SYS_RESET_ADDRESS 0xffff0000 /* Rst Vector Adr */ +#define CONFIG_SYS_MAXARGS 32 /* max number of command args */ + +#define CONFIG_SYS_ALT_MEMTEST + +/* End of 16M scrubbed by training in bootrom */ +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE + 0xFF0000) + +/* + * I2C + */ +#define CONFIG_I2C_MV +#define CONFIG_SYS_I2C_SLAVE 0x0 + +/* + * SPI Flash configuration + */ +#define CONFIG_ENV_SPI_BUS 0 +#define CONFIG_ENV_SPI_CS 0 + +/* SPI NOR flash default params, used by sf commands */ +#define CONFIG_SF_DEFAULT_SPEED 1000000 +#define CONFIG_SF_DEFAULT_MODE SPI_MODE_0 +#define CONFIG_ENV_SPI_MODE CONFIG_SF_DEFAULT_MODE + +/* Environment in SPI NOR flash */ +#define CONFIG_ENV_IS_IN_SPI_FLASH +#define CONFIG_ENV_OFFSET 0x180000 /* as Marvell U-Boot version */ +#define CONFIG_ENV_SIZE (64 << 10) /* 64KiB */ +#define CONFIG_ENV_SECT_SIZE (64 << 10) /* 64KiB sectors */ + +/* + * Ethernet Driver configuration + */ +#define CONFIG_MVNETA /* Enable Marvell Gbe Controller Driver */ +#define CONFIG_ENV_OVERWRITE /* ethaddr can be reprogrammed */ +#define CONFIG_PHY_GIGE /* GbE speed/duplex detect */ +#define CONFIG_ARP_TIMEOUT 200 +#define CONFIG_NET_RETRY_COUNT 50 + +/* USB 2.0 */ +#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3 + +/* USB 3.0 */ +#define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 3 + +#define CONFIG_USB_MAX_CONTROLLER_COUNT (CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS + \ + CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS) + +/* USB ethernet */ +#define CONFIG_USB_HOST_ETHER +#define CONFIG_USB_ETHER_ASIX +#define CONFIG_USB_ETHER_MCS7830 +#define CONFIG_USB_ETHER_RTL8152 +#define CONFIG_USB_ETHER_SMSC95XX + +/* + * SATA/SCSI/AHCI configuration + */ +#define CONFIG_SCSI +#define CONFIG_SCSI_AHCI +#define CONFIG_SCSI_AHCI_PLAT +#define CONFIG_LIBATA +#define CONFIG_LBA48 +#define CONFIG_SYS_64BIT_LBA + +#define CONFIG_SYS_SCSI_MAX_SCSI_ID 2 +#define CONFIG_SYS_SCSI_MAX_LUN 1 +#define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ + CONFIG_SYS_SCSI_MAX_LUN) + +#define CONFIG_SUPPORT_VFAT + +#endif /* _CONFIG_MVEBU_ARMADA_37XX_H */ diff --git a/include/configs/mvebu_db-88f3720.h b/include/configs/mvebu_db-88f3720.h deleted file mode 100644 index 753ed1e..0000000 --- a/include/configs/mvebu_db-88f3720.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2016 Stefan Roese sr@denx.de - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#ifndef _CONFIG_MVEBU_DB_88F3720_H -#define _CONFIG_MVEBU_DB_88F3720_H - -/* - * High Level Configuration Options (easy to change) - */ -#define CONFIG_DISPLAY_BOARDINFO_LATE - -#define CONFIG_SYS_TEXT_BASE 0x00000000 - -/* additions for new ARM relocation support */ -#define CONFIG_SYS_SDRAM_BASE 0x00000000 - -#define CONFIG_NR_DRAM_BANKS 1 - -/* auto boot */ -#define CONFIG_PREBOOT - -#define CONFIG_BAUDRATE 115200 -#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, \ - 115200, 230400, 460800, 921600 } - -/* - * For booting Linux, the board info and command line data - * have to be in the first 8 MB of memory, since this is - * the maximum mapped by the Linux kernel during initialization. - */ -#define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */ -#define CONFIG_INITRD_TAG /* enable INITRD tag */ -#define CONFIG_SETUP_MEMORY_TAGS /* enable memory tag */ - -#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buff Size */ -#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE \ - +sizeof(CONFIG_SYS_PROMPT) + 16) /* Print Buff */ - -/* - * Size of malloc() pool - */ -#define CONFIG_SYS_MALLOC_LEN (4 << 20) /* 4MiB for malloc() */ - -/* - * Other required minimal configurations - */ -#define CONFIG_SYS_LONGHELP -#define CONFIG_AUTO_COMPLETE -#define CONFIG_CMDLINE_EDITING -#define CONFIG_ARCH_CPU_INIT /* call arch_cpu_init() */ -#define CONFIG_SYS_LOAD_ADDR 0x00800000 /* default load adr- 8M */ -#define CONFIG_SYS_MEMTEST_START 0x00800000 /* 8M */ -#define CONFIG_SYS_MEMTEST_END 0x00ffffff /*(_16M -1) */ -#define CONFIG_SYS_RESET_ADDRESS 0xffff0000 /* Rst Vector Adr */ -#define CONFIG_SYS_MAXARGS 32 /* max number of command args */ - -#define CONFIG_SYS_ALT_MEMTEST - -/* End of 16M scrubbed by training in bootrom */ -#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE + 0xFF0000) - -/* - * I2C - */ -#define CONFIG_I2C_MV -#define CONFIG_SYS_I2C_SLAVE 0x0 - -/* - * SPI Flash configuration - */ -#define CONFIG_ENV_SPI_BUS 0 -#define CONFIG_ENV_SPI_CS 0 - -/* SPI NOR flash default params, used by sf commands */ -#define CONFIG_SF_DEFAULT_SPEED 1000000 -#define CONFIG_SF_DEFAULT_MODE SPI_MODE_0 -#define CONFIG_ENV_SPI_MODE CONFIG_SF_DEFAULT_MODE - -/* Environment in SPI NOR flash */ -#define CONFIG_ENV_IS_IN_SPI_FLASH -#define CONFIG_ENV_OFFSET 0x180000 /* as Marvell U-Boot version */ -#define CONFIG_ENV_SIZE (64 << 10) /* 64KiB */ -#define CONFIG_ENV_SECT_SIZE (64 << 10) /* 64KiB sectors */ - -/* - * Ethernet Driver configuration - */ -#define CONFIG_MVNETA /* Enable Marvell Gbe Controller Driver */ -#define CONFIG_ENV_OVERWRITE /* ethaddr can be reprogrammed */ -#define CONFIG_PHY_GIGE /* GbE speed/duplex detect */ -#define CONFIG_ARP_TIMEOUT 200 -#define CONFIG_NET_RETRY_COUNT 50 - -/* USB 2.0 */ -#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3 - -/* USB 3.0 */ -#define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 3 - -#define CONFIG_USB_MAX_CONTROLLER_COUNT (CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS + \ - CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS) - -/* USB ethernet */ -#define CONFIG_USB_HOST_ETHER -#define CONFIG_USB_ETHER_ASIX -#define CONFIG_USB_ETHER_MCS7830 -#define CONFIG_USB_ETHER_RTL8152 -#define CONFIG_USB_ETHER_SMSC95XX - -/* - * SATA/SCSI/AHCI configuration - */ -#define CONFIG_SCSI -#define CONFIG_SCSI_AHCI -#define CONFIG_SCSI_AHCI_PLAT -#define CONFIG_LIBATA -#define CONFIG_LBA48 -#define CONFIG_SYS_64BIT_LBA - -#define CONFIG_SYS_SCSI_MAX_SCSI_ID 2 -#define CONFIG_SYS_SCSI_MAX_LUN 1 -#define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ - CONFIG_SYS_SCSI_MAX_LUN) - -#define CONFIG_SUPPORT_VFAT - -#endif /* _CONFIG_MVEBU_DB_88F3720_H */

On 16.02.2017 12:52, kostap@marvell.com wrote:
From: Konstantin Porotchkin kostap@marvell.com
Modify the file names and deifinitions relater to Marvell db-77f3720 board support. Convert these names to more generic armada-37xx platform for future addition of more boards based on the same SoC family.
Signed-off-by: Konstantin Porotchkin kostap@marvell.com Cc: Stefan Roese sr@denx.de Cc: Igal Liberman igall@marvell.com Cc: Nadav Haklai nadavh@marvell.com
Complete series applied to u-boot-mavell/master.
Thanks, Stefan

From: Konstantin Porotchkin kostap@marvell.com
Enable support for Marvell Ethernet PHYs on A37xx platforms
Signed-off-by: Konstantin Porotchkin kostap@marvell.com Cc: Stefan Roese sr@denx.de Cc: Igal Liberman igall@marvell.com Cc: Nadav Haklai nadavh@marvell.com --- Changes for v2: - No changes, rebased on top of new platform file
include/configs/mvebu_armada-37xx.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/include/configs/mvebu_armada-37xx.h b/include/configs/mvebu_armada-37xx.h index f5adfef..fd2ae8e 100644 --- a/include/configs/mvebu_armada-37xx.h +++ b/include/configs/mvebu_armada-37xx.h @@ -93,6 +93,7 @@ #define CONFIG_PHY_GIGE /* GbE speed/duplex detect */ #define CONFIG_ARP_TIMEOUT 200 #define CONFIG_NET_RETRY_COUNT 50 +#define CONFIG_PHY_MARVELL
/* USB 2.0 */ #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3

From: Konstantin Porotchkin kostap@marvell.com
Enable mvebu bubt command support on A3720 DB
Signed-off-by: Konstantin Porotchkin kostap@marvell.com Cc: Stefan Roese sr@denx.de Cc: Igal Liberman igall@marvell.com Cc: Nadav Haklai nadavh@marvell.com --- Changes for v2: - No changes
configs/mvebu_db-88f3720_defconfig | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/configs/mvebu_db-88f3720_defconfig b/configs/mvebu_db-88f3720_defconfig index 4286695..bdb96e9 100644 --- a/configs/mvebu_db-88f3720_defconfig +++ b/configs/mvebu_db-88f3720_defconfig @@ -33,6 +33,9 @@ CONFIG_CMD_FS_GENERIC=y CONFIG_MAC_PARTITION=y CONFIG_ISO_PARTITION=y CONFIG_EFI_PARTITION=y +CONFIG_CMD_MVEBU_BUBT=y +CONFIG_SHA1=y +CONFIG_SHA256=y CONFIG_BLOCK_CACHE=y CONFIG_DM_I2C=y CONFIG_DM_I2C_COMPAT=y

From: Konstantin Porotchkin kostap@marvell.com
Add pin control nodes for North and South bridges to Armada-37xx DT
Signed-off-by: Konstantin Porotchkin kostap@marvell.com Cc: Stefan Roese sr@denx.de Cc: Igal Liberman igall@marvell.com Cc: Nadav Haklai nadavh@marvell.com --- arch/arm/dts/armada-37xx.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+) Changes for v2: - No changes, rebased on top of new platform files
diff --git a/arch/arm/dts/armada-37xx.dtsi b/arch/arm/dts/armada-37xx.dtsi index 062f2a6..5bea63b 100644 --- a/arch/arm/dts/armada-37xx.dtsi +++ b/arch/arm/dts/armada-37xx.dtsi @@ -193,6 +193,20 @@ status = "disabled"; };
+ pinctl0: pinctl@13830 { /* north bridge */ + compatible = "marvell,armada-3700-pinctl"; + bank-name = "armada-3700-nb"; + reg = <0x13830 0x4>; + pin-count = <36>; + }; + + pinctl1: pinctl@18830 { /* south bridge */ + compatible = "marvell,armada-3700-pinctl"; + bank-name = "armada-3700-sb"; + reg = <0x18830 0x4>; + pin-count = <30>; + }; + comphy: comphy@18300 { compatible = "marvell,mvebu-comphy", "marvell,comphy-armada-3700"; reg = <0x18300 0x28>,

From: Konstantin Porotchkin kostap@marvell.com
Fix the default pin control values in a board-specific function on early board init stage. This fix allows the NETA driver to work in RGMII mode until the full-featured pin control driver gets introduced.
Signed-off-by: Konstantin Porotchkin kostap@marvell.com Cc: Stefan Roese sr@denx.de Cc: Igal Liberman igall@marvell.com Cc: Nadav Haklai nadavh@marvell.com --- Changes for v2: - No changes, rebased on top of new platform files
board/Marvell/mvebu_armada-37xx/board.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c index edf88c7..3337f3f 100644 --- a/board/Marvell/mvebu_armada-37xx/board.c +++ b/board/Marvell/mvebu_armada-37xx/board.c @@ -19,9 +19,33 @@ DECLARE_GLOBAL_DATA_PTR; #define I2C_IO_REG_0_SATA_OFF 2 #define I2C_IO_REG_0_USB_H_OFF 1
+#define PINCTRL_NB_REG_VALUE 0x000173fa +#define PINCTRL_SB_REG_VALUE 0x00007a23 + int board_early_init_f(void) { - /* Nothing to do (yet), perhaps later some pin-muxing etc */ + const void *blob = gd->fdt_blob; + const char *bank_name; + const char *compat = "marvell,armada-3700-pinctl"; + int off, len; + void __iomem *addr; + + /* FIXME + * Temporary WA for setting correct pin control values + * until the real pin control driver is awailable. + */ + off = fdt_node_offset_by_compatible(blob, -1, compat); + while (off != -FDT_ERR_NOTFOUND) { + bank_name = fdt_getprop(blob, off, "bank-name", &len); + addr = (void __iomem *)fdtdec_get_addr_size_auto_noparent( + blob, off, "reg", 0, NULL, true); + if (!strncmp(bank_name, "armada-3700-nb", len)) + writel(PINCTRL_NB_REG_VALUE, addr); + else if (!strncmp(bank_name, "armada-3700-sb", len)) + writel(PINCTRL_SB_REG_VALUE, addr); + + off = fdt_node_offset_by_compatible(blob, off, compat); + }
return 0; }

From: Konstantin Porotchkin kostap@marvell.com
Add ability to use board-specific initialization flow to NETA driver (for instance Ethernet switch bring-up)
Signed-off-by: Konstantin Porotchkin kostap@marvell.com Cc: Stefan Roese sr@denx.de Cc: Igal Liberman igall@marvell.com Cc: Nadav Haklai nadavh@marvell.com --- Changes for v2: - No changes
drivers/net/mvneta.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c index 674075f..a1e2136 100644 --- a/drivers/net/mvneta.c +++ b/drivers/net/mvneta.c @@ -404,6 +404,15 @@ static struct buffer_location buffer_loc; */ #define BD_SPACE (1 << 20)
+/* + * Dummy implementation that can be overwritten by a board + * specific function + */ +__weak int board_network_enable(struct mii_dev *bus) +{ + return 0; +} + /* Utility/helper methods */
/* Write helper method */ @@ -1615,6 +1624,7 @@ static int mvneta_probe(struct udevice *dev) struct mii_dev *bus; unsigned long addr; void *bd_space; + int ret;
/* * Allocate buffer area for descs and rx_buffers. This is only @@ -1664,7 +1674,11 @@ static int mvneta_probe(struct udevice *dev) bus->priv = (void *)pp; pp->bus = bus;
- return mdio_register(bus); + ret = mdio_register(bus); + if (ret) + return ret; + + return board_network_enable(bus); }
static void mvneta_stop(struct udevice *dev)

From: Konstantin Porotchkin kostap@marvell.com
Add support for fixed link to NETA driver. This feature requreed for proper support of SFP modules and onboard connected devices like Ethernet switches
Signed-off-by: Konstantin Porotchkin kostap@marvell.com Signed-off-by: Terry Zhou bjzhou@marvell.com Cc: Stefan Roese sr@denx.de Cc: Igal Liberman igall@marvell.com Cc: Nadav Haklai nadavh@marvell.com --- Changes for v2: - No changes
drivers/net/mvneta.c | 109 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 82 insertions(+), 27 deletions(-)
diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c index a1e2136..8881cc7 100644 --- a/drivers/net/mvneta.c +++ b/drivers/net/mvneta.c @@ -191,11 +191,16 @@ DECLARE_GLOBAL_DATA_PTR; #define MVNETA_GMAC_AUTONEG_CONFIG 0x2c0c #define MVNETA_GMAC_FORCE_LINK_DOWN BIT(0) #define MVNETA_GMAC_FORCE_LINK_PASS BIT(1) +#define MVNETA_GMAC_FORCE_LINK_UP (BIT(0) | BIT(1)) +#define MVNETA_GMAC_IB_BYPASS_AN_EN BIT(3) #define MVNETA_GMAC_CONFIG_MII_SPEED BIT(5) #define MVNETA_GMAC_CONFIG_GMII_SPEED BIT(6) #define MVNETA_GMAC_AN_SPEED_EN BIT(7) +#define MVNETA_GMAC_SET_FC_EN BIT(8) +#define MVNETA_GMAC_ADVERT_FC_EN BIT(9) #define MVNETA_GMAC_CONFIG_FULL_DUPLEX BIT(12) #define MVNETA_GMAC_AN_DUPLEX_EN BIT(13) +#define MVNETA_GMAC_SAMPLE_TX_CFG_EN BIT(15) #define MVNETA_MIB_COUNTERS_BASE 0x3080 #define MVNETA_MIB_LATE_COLLISION 0x7c #define MVNETA_DA_FILT_SPEC_MCAST 0x3400 @@ -566,6 +571,13 @@ static void mvneta_rxq_buf_size_set(struct mvneta_port *pp, mvreg_write(pp, MVNETA_RXQ_SIZE_REG(rxq->id), val); }
+static int mvneta_port_is_fixed_link(struct mvneta_port *pp) +{ + /* phy_addr is set to invalid value for fixed link */ + return pp->phyaddr > PHY_MAX_ADDR; +} + + /* Start the Ethernet port RX and TX activity */ static void mvneta_port_up(struct mvneta_port *pp) { @@ -816,10 +828,12 @@ static void mvneta_defaults_set(struct mvneta_port *pp) /* Assign port SDMA configuration */ mvreg_write(pp, MVNETA_SDMA_CONFIG, val);
- /* Enable PHY polling in hardware for U-Boot */ - val = mvreg_read(pp, MVNETA_UNIT_CONTROL); - val |= MVNETA_PHY_POLLING_ENABLE; - mvreg_write(pp, MVNETA_UNIT_CONTROL, val); + /* Enable PHY polling in hardware if not in fixed-link mode */ + if (!mvneta_port_is_fixed_link(pp)) { + val = mvreg_read(pp, MVNETA_UNIT_CONTROL); + val |= MVNETA_PHY_POLLING_ENABLE; + mvreg_write(pp, MVNETA_UNIT_CONTROL, val); + }
mvneta_set_ucast_table(pp, -1); mvneta_set_special_mcast_table(pp, -1); @@ -1137,6 +1151,11 @@ static void mvneta_adjust_link(struct udevice *dev) struct phy_device *phydev = pp->phydev; int status_change = 0;
+ if (mvneta_port_is_fixed_link(pp)) { + debug("Using fixed link, skip link adjust\n"); + return; + } + if (phydev->link) { if ((pp->speed != phydev->speed) || (pp->duplex != phydev->duplex)) { @@ -1507,28 +1526,54 @@ static int mvneta_start(struct udevice *dev) mvneta_port_power_up(pp, pp->phy_interface);
if (!pp->init || pp->link == 0) { - /* Set phy address of the port */ - mvreg_write(pp, MVNETA_PHY_ADDR, pp->phyaddr); - phydev = phy_connect(pp->bus, pp->phyaddr, dev, - pp->phy_interface); - - pp->phydev = phydev; - phy_config(phydev); - phy_startup(phydev); - if (!phydev->link) { - printf("%s: No link.\n", phydev->dev->name); - return -1; - } + if (mvneta_port_is_fixed_link(pp)) { + u32 val;
- /* Full init on first call */ - mvneta_init(dev); - pp->init = 1; - } else { - /* Upon all following calls, this is enough */ - mvneta_port_up(pp); - mvneta_port_enable(pp); + pp->init = 1; + pp->link = 1; + mvneta_init(dev); + + val = MVNETA_GMAC_FORCE_LINK_UP | + MVNETA_GMAC_IB_BYPASS_AN_EN | + MVNETA_GMAC_SET_FC_EN | + MVNETA_GMAC_ADVERT_FC_EN | + MVNETA_GMAC_SAMPLE_TX_CFG_EN; + + if (pp->duplex) + val |= MVNETA_GMAC_CONFIG_FULL_DUPLEX; + + if (pp->speed == SPEED_1000) + val |= MVNETA_GMAC_CONFIG_GMII_SPEED; + else if (pp->speed == SPEED_100) + val |= MVNETA_GMAC_CONFIG_MII_SPEED; + + mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val); + } else { + /* Set phy address of the port */ + mvreg_write(pp, MVNETA_PHY_ADDR, pp->phyaddr); + + phydev = phy_connect(pp->bus, pp->phyaddr, dev, + pp->phy_interface); + + pp->phydev = phydev; + phy_config(phydev); + phy_startup(phydev); + if (!phydev->link) { + printf("%s: No link.\n", phydev->dev->name); + return -1; + } + + /* Full init on first call */ + mvneta_init(dev); + pp->init = 1; + return 0; + } }
+ /* Upon all following calls, this is enough */ + mvneta_port_up(pp); + mvneta_port_enable(pp); + return 0; }
@@ -1625,6 +1670,7 @@ static int mvneta_probe(struct udevice *dev) unsigned long addr; void *bd_space; int ret; + int fl_node;
/* * Allocate buffer area for descs and rx_buffers. This is only @@ -1657,10 +1703,19 @@ static int mvneta_probe(struct udevice *dev) /* PHY interface is already decoded in mvneta_ofdata_to_platdata() */ pp->phy_interface = pdata->phy_interface;
- /* Now read phyaddr from DT */ - addr = fdtdec_get_int(blob, node, "phy", 0); - addr = fdt_node_offset_by_phandle(blob, addr); - pp->phyaddr = fdtdec_get_int(blob, addr, "reg", 0); + /* fetch 'fixed-link' property from 'neta' node */ + fl_node = fdt_subnode_offset(blob, node, "fixed-link"); + if (fl_node != -FDT_ERR_NOTFOUND) { + /* set phy_addr to invalid value for fixed link */ + pp->phyaddr = PHY_MAX_ADDR + 1; + pp->duplex = fdtdec_get_bool(blob, fl_node, "full-duplex"); + pp->speed = fdtdec_get_int(blob, fl_node, "speed", 0); + } else { + /* Now read phyaddr from DT */ + addr = fdtdec_get_int(blob, node, "phy", 0); + addr = fdt_node_offset_by_phandle(blob, addr); + pp->phyaddr = fdtdec_get_int(blob, addr, "reg", 0); + }
bus = mdio_alloc(); if (!bus) {

From: Konstantin Porotchkin kostap@marvell.com
Implement the board-specific network init function for ESPRESSOBin community board, setting the on-board Topaz switch port to forward mode and allow network connection through any of the available Etherenet ports.
Signed-off-by: Konstantin Porotchkin kostap@marvell.com Cc: Stefan Roese sr@denx.de Cc: Igal Liberman igall@marvell.com Cc: Nadav Haklai nadavh@marvell.com Cc: Joe Hershberger joe.hershberger@ni.com --- Changes for v2: - Change SMI registers from numeric values to symbols for better readability - Add missing <dm.h> include
board/Marvell/mvebu_armada-37xx/board.c | 91 +++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+)
diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c index 3337f3f..b9878bf 100644 --- a/board/Marvell/mvebu_armada-37xx/board.c +++ b/board/Marvell/mvebu_armada-37xx/board.c @@ -5,7 +5,9 @@ */
#include <common.h> +#include <dm.h> #include <i2c.h> +#include <phy.h> #include <asm/io.h> #include <asm/arch/cpu.h> #include <asm/arch/soc.h> @@ -22,6 +24,29 @@ DECLARE_GLOBAL_DATA_PTR; #define PINCTRL_NB_REG_VALUE 0x000173fa #define PINCTRL_SB_REG_VALUE 0x00007a23
+/* Ethernet switch registers */ +/* SMI addresses for multi-chip mode */ +#define MVEBU_PORT_CTRL_SMI_ADDR(p) (16 + (p)) +#define MVEBU_SW_G2_SMI_ADDR (28) + +/* Multi-chip mode */ +#define MVEBU_SW_SMI_DATA_REG (1) +#define MVEBU_SW_SMI_CMD_REG (0) + #define SW_SMI_CMD_REG_ADDR_OFF 0 + #define SW_SMI_CMD_DEV_ADDR_OFF 5 + #define SW_SMI_CMD_SMI_OP_OFF 10 + #define SW_SMI_CMD_SMI_MODE_OFF 12 + #define SW_SMI_CMD_SMI_BUSY_OFF 15 + +/* Single-chip mode */ +/* Switch Port Registers */ +#define MVEBU_SW_LINK_CTRL_REG (1) +#define MVEBU_SW_PORT_CTRL_REG (4) + +/* Global 2 Registers */ +#define MVEBU_G2_SMI_PHY_CMD_REG (24) +#define MVEBU_G2_SMI_PHY_DATA_REG (25) + int board_early_init_f(void) { const void *blob = gd->fdt_blob; @@ -156,3 +181,69 @@ int board_xhci_enable(void)
return 0; } + +/* Helper function for accessing switch devices in multi-chip connection mode */ +static int mii_multi_chip_mode_write(struct mii_dev *bus, int dev_smi_addr, + int smi_addr, int reg, u16 value) +{ + u16 smi_cmd = 0; + + if (bus->write(bus, dev_smi_addr, 0, + MVEBU_SW_SMI_DATA_REG, value) != 0) { + printf("Error writing to the PHY addr=%02x reg=%02x\n", + smi_addr, reg); + return -EFAULT; + } + + smi_cmd = (1 << SW_SMI_CMD_SMI_BUSY_OFF) | + (1 << SW_SMI_CMD_SMI_MODE_OFF) | + (1 << SW_SMI_CMD_SMI_OP_OFF) | + (smi_addr << SW_SMI_CMD_DEV_ADDR_OFF) | + (reg << SW_SMI_CMD_REG_ADDR_OFF); + if (bus->write(bus, dev_smi_addr, 0, + MVEBU_SW_SMI_CMD_REG, smi_cmd) != 0) { + printf("Error writing to the PHY addr=%02x reg=%02x\n", + smi_addr, reg); + return -EFAULT; + } + + return 0; +} + +/* Bring-up board-specific network stuff */ +int board_network_enable(struct mii_dev *bus) +{ + if (!of_machine_is_compatible("marvell,armada-3720-espressobin")) + return 0; + + /* + * FIXME: remove this code once Topaz driver gets available + * A3720 Community Board Only + * Configure Topaz switch (88E6341) + * Set port 0,1,2,3 to forwarding Mode (through Switch Port registers) + */ + mii_multi_chip_mode_write(bus, 1, MVEBU_PORT_CTRL_SMI_ADDR(0), + MVEBU_SW_PORT_CTRL_REG, 0x7f); + mii_multi_chip_mode_write(bus, 1, MVEBU_PORT_CTRL_SMI_ADDR(1), + MVEBU_SW_PORT_CTRL_REG, 0x7f); + mii_multi_chip_mode_write(bus, 1, MVEBU_PORT_CTRL_SMI_ADDR(2), + MVEBU_SW_PORT_CTRL_REG, 0x7f); + mii_multi_chip_mode_write(bus, 1, MVEBU_PORT_CTRL_SMI_ADDR(3), + MVEBU_SW_PORT_CTRL_REG, 0x7f); + + /* RGMII Delay on Port 0 (CPU port), force link to 1000Mbps */ + mii_multi_chip_mode_write(bus, 1, MVEBU_PORT_CTRL_SMI_ADDR(0), + MVEBU_SW_LINK_CTRL_REG, 0xe002); + + /* Power up PHY 1, 2, 3 (through Global 2 registers) */ + mii_multi_chip_mode_write(bus, 1, MVEBU_SW_G2_SMI_ADDR, + MVEBU_G2_SMI_PHY_DATA_REG, 0x1140); + mii_multi_chip_mode_write(bus, 1, MVEBU_SW_G2_SMI_ADDR, + MVEBU_G2_SMI_PHY_CMD_REG, 0x9620); + mii_multi_chip_mode_write(bus, 1, MVEBU_SW_G2_SMI_ADDR, + MVEBU_G2_SMI_PHY_CMD_REG, 0x9640); + mii_multi_chip_mode_write(bus, 1, MVEBU_SW_G2_SMI_ADDR, + MVEBU_G2_SMI_PHY_CMD_REG, 0x9660); + + return 0; +}

On Thu, Feb 16, 2017 at 5:52 AM, kostap@marvell.com wrote:
From: Konstantin Porotchkin kostap@marvell.com
Implement the board-specific network init function for ESPRESSOBin community board, setting the on-board Topaz switch port to forward mode and allow network connection through any of the available Etherenet ports.
Signed-off-by: Konstantin Porotchkin kostap@marvell.com Cc: Stefan Roese sr@denx.de Cc: Igal Liberman igall@marvell.com Cc: Nadav Haklai nadavh@marvell.com Cc: Joe Hershberger joe.hershberger@ni.com
Reviewed-by: Joe Hershberger joe.hershberger@ni.com

From: Konstantin Porotchkin kostap@marvell.com
Initial DTS file for Marvell ESPRESSOBin comunity board based on Armada-3720 SoC. The Marvell ESPRESSOBin is a tiny board made by Globalscale and available on KickStarter site. It has dual core Armv8 Marvell SoC (Armada-3720) with 512MB/1GB/2GB DDR3 RAM, mini-PCIe 2.0 slot, single SATA-3 port, USB 2.0 and USB 3.0 interfaces, Gigabit Ethernet switch with 3 ports, micro-SD socket and two 46-pin GPIO connectors.
Signed-off-by: Konstantin Porotchkin kostap@marvell.com Cc: Stefan Roese sr@denx.de Cc: Igal Liberman igall@marvell.com Cc: Nadav Haklai nadavh@marvell.com --- Changes for v2: - No changes
arch/arm/dts/Makefile | 1 + arch/arm/dts/armada-3720-espressobin.dts | 135 +++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 arch/arm/dts/armada-3720-espressobin.dts
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index eb68c20..d85210c 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -70,6 +70,7 @@ dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \
dtb-$(CONFIG_ARCH_MVEBU) += \ armada-3720-db.dtb \ + armada-3720-espressobin.dtb \ armada-375-db.dtb \ armada-388-clearfog.dtb \ armada-388-gp.dtb \ diff --git a/arch/arm/dts/armada-3720-espressobin.dts b/arch/arm/dts/armada-3720-espressobin.dts new file mode 100644 index 0000000..aa6587a --- /dev/null +++ b/arch/arm/dts/armada-3720-espressobin.dts @@ -0,0 +1,135 @@ +/* + * Device Tree file for Marvell Armada 3720 community board + * (ESPRESSOBin) + * Copyright (C) 2016 Marvell + * + * Gregory CLEMENT gregory.clement@free-electrons.com + * Konstantin Porotchkin kostap@marvell.com + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This file is distributed in the hope that it will be useful + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Or, alternatively + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/dts-v1/; + +#include "armada-372x.dtsi" + +/ { + model = "Marvell Armada 3720 Community Board ESPRESSOBin"; + compatible = "marvell,armada-3720-espressobin", "marvell,armada3720", "marvell,armada3710"; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + aliases { + ethernet0 = ð0; + i2c0 = &i2c0; + spi0 = &spi0; + }; + + memory { + device_type = "memory"; + reg = <0x00000000 0x00000000 0x00000000 0x20000000>; + }; +}; + +&comphy { + max-lanes = <3>; + phy0 { + phy-type = <PHY_TYPE_PEX0>; + phy-speed = <PHY_SPEED_2_5G>; + }; + + phy1 { + phy-type = <PHY_TYPE_USB3_HOST0>; + phy-speed = <PHY_SPEED_5G>; + }; + + phy2 { + phy-type = <PHY_TYPE_SATA0>; + phy-speed = <PHY_SPEED_5G>; + }; +}; + +ð0 { + status = "okay"; + phy-mode = "rgmii"; + phy_addr = <0x1>; + fixed-link { + speed = <1000>; + full-duplex; + }; +}; + +&i2c0 { + status = "okay"; +}; + +/* CON3 */ +&sata { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + spi-flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "st,m25p128", "spi-flash"; + reg = <0>; /* Chip select 0 */ + spi-max-frequency = <50000000>; + m25p,fast-read; + }; +}; + +/* Exported on the micro USB connector CON32 through an FTDI */ +&uart0 { + status = "okay"; +}; + +/* CON29 */ +&usb2 { + status = "okay"; +}; + +/* CON31 */ +&usb3 { + status = "okay"; +};

From: Konstantin Porotchkin kostap@marvell.com
Add initial default configuration for Marvell ESPRESSOBin community board based on Aramda-3720 SoC
Signed-off-by: Konstantin Porotchkin kostap@marvell.com Cc: Stefan Roese sr@denx.de Cc: Igal Liberman igall@marvell.com Cc: Nadav Haklai nadavh@marvell.com --- Changes for v2: - Use the new target name TARGET_MVEBU_ARMADA_37XX
configs/mvebu_espressobin-88f3720_defconfig | 67 +++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 configs/mvebu_espressobin-88f3720_defconfig
diff --git a/configs/mvebu_espressobin-88f3720_defconfig b/configs/mvebu_espressobin-88f3720_defconfig new file mode 100644 index 0000000..d1749bc --- /dev/null +++ b/configs/mvebu_espressobin-88f3720_defconfig @@ -0,0 +1,67 @@ +CONFIG_ARM=y +CONFIG_ARCH_MVEBU=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_TARGET_MVEBU_ARMADA_37XX=y +CONFIG_DEFAULT_DEVICE_TREE="armada-3720-espressobin" +CONFIG_AHCI=y +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +CONFIG_SYS_CONSOLE_INFO_QUIET=y +# CONFIG_DISPLAY_CPUINFO is not set +# CONFIG_DISPLAY_BOARDINFO is not set +CONFIG_ARCH_EARLY_INIT_R=y +CONFIG_BOARD_EARLY_INIT_F=y +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_MMC=y +CONFIG_CMD_PART=y +CONFIG_CMD_SF=y +CONFIG_CMD_SPI=y +CONFIG_CMD_I2C=y +CONFIG_CMD_USB=y +# CONFIG_CMD_FPGA is not set +# CONFIG_CMD_SETEXPR is not set +CONFIG_CMD_TFTPPUT=y +CONFIG_CMD_DHCP=y +CONFIG_CMD_MII=y +CONFIG_CMD_PING=y +CONFIG_CMD_CACHE=y +CONFIG_CMD_TIME=y +CONFIG_CMD_EXT4=y +CONFIG_CMD_EXT4_WRITE=y +CONFIG_CMD_FAT=y +CONFIG_CMD_FS_GENERIC=y +CONFIG_MAC_PARTITION=y +CONFIG_ISO_PARTITION=y +CONFIG_EFI_PARTITION=y +CONFIG_CMD_MVEBU_BUBT=y +CONFIG_SHA1=y +CONFIG_SHA256=y +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_SDHCI_XENON=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_PHYLIB=y +CONFIG_MVEBU_COMPHY_SUPPORT=y +# CONFIG_SPL_SERIAL_PRESENT is not set +CONFIG_DEBUG_UART=y +CONFIG_DEBUG_MVEBU_A3700_UART=y +CONFIG_DEBUG_UART_BASE=0xd0012000 +CONFIG_DEBUG_UART_CLOCK=25804800 +CONFIG_DEBUG_UART_SHIFT=2 +CONFIG_DEBUG_UART_ANNOUNCE=y +CONFIG_MVEBU_A3700_UART=y +CONFIG_MVEBU_A3700_SPI=y +CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_STORAGE=y

From: Konstantin Porotchkin kostap@marvell.com
Bypass XHCI and AHCi board configuration flow on ESPRESSOBin community board. The community board does not have i2c expander and USB VBUS is always on, so the scan for AHCi and USB devices can be faster without unneded configurations.
Signed-off-by: Konstantin Porotchkin kostap@marvell.com Cc: Stefan Roese sr@denx.de Cc: Igal Liberman igall@marvell.com Cc: Nadav Haklai nadavh@marvell.com --- Changes for v2: - Check if the mashine is NOT compatible with DB instead of checking that if machine is compatible with ESPRESSOBin:wq
board/Marvell/mvebu_armada-37xx/board.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c index b9878bf..8dc1f46 100644 --- a/board/Marvell/mvebu_armada-37xx/board.c +++ b/board/Marvell/mvebu_armada-37xx/board.c @@ -21,6 +21,7 @@ DECLARE_GLOBAL_DATA_PTR; #define I2C_IO_REG_0_SATA_OFF 2 #define I2C_IO_REG_0_USB_H_OFF 1
+/* The pin control values are the same for DB and Espressobin */ #define PINCTRL_NB_REG_VALUE 0x000173fa #define PINCTRL_SB_REG_VALUE 0x00007a23
@@ -90,6 +91,10 @@ int board_ahci_enable(void) int ret; u8 buf[8];
+ /* Only DB requres this configuration */ + if (!of_machine_is_compatible("marvell,armada-3720-db")) + return 0; + /* Configure IO exander PCA9555: 7bit address 0x22 */ ret = i2c_get_chip_for_busnum(0, I2C_IO_EXP_ADDR, 1, &dev); if (ret) { @@ -124,6 +129,10 @@ int board_xhci_enable(void) int ret; u8 buf[8];
+ /* Only DB requres this configuration */ + if (!of_machine_is_compatible("marvell,armada-3720-db")) + return 0; + /* Configure IO exander PCA9555: 7bit address 0x22 */ ret = i2c_get_chip_for_busnum(0, I2C_IO_EXP_ADDR, 1, &dev); if (ret) {

From: Konstantin Porotchkin kostap@marvell.com
Remove DM_I2C_COMPAT from the board configurations for Armada 37xx platform boards for supressing the buid tim warning.
Signed-off-by: Konstantin Porotchkin kostap@marvell.com Cc: Stefan Roese sr@denx.de Cc: Igal Liberman igall@marvell.com Cc: Nadav Haklai nadavh@marvell.com --- Changes for v2: - This patch was missing in v1
configs/mvebu_db-88f3720_defconfig | 1 - configs/mvebu_espressobin-88f3720_defconfig | 1 - 2 files changed, 2 deletions(-)
diff --git a/configs/mvebu_db-88f3720_defconfig b/configs/mvebu_db-88f3720_defconfig index bdb96e9..3e548a8 100644 --- a/configs/mvebu_db-88f3720_defconfig +++ b/configs/mvebu_db-88f3720_defconfig @@ -38,7 +38,6 @@ CONFIG_SHA1=y CONFIG_SHA256=y CONFIG_BLOCK_CACHE=y CONFIG_DM_I2C=y -CONFIG_DM_I2C_COMPAT=y CONFIG_MISC=y CONFIG_DM_MMC=y CONFIG_MMC_SDHCI=y diff --git a/configs/mvebu_espressobin-88f3720_defconfig b/configs/mvebu_espressobin-88f3720_defconfig index d1749bc..f02ae64 100644 --- a/configs/mvebu_espressobin-88f3720_defconfig +++ b/configs/mvebu_espressobin-88f3720_defconfig @@ -38,7 +38,6 @@ CONFIG_SHA1=y CONFIG_SHA256=y CONFIG_BLOCK_CACHE=y CONFIG_DM_I2C=y -CONFIG_DM_I2C_COMPAT=y CONFIG_MISC=y CONFIG_DM_MMC=y CONFIG_MMC_SDHCI=y
participants (3)
-
Joe Hershberger
-
kostap@marvell.com
-
Stefan Roese