Skip to contentSkip to conversation

Add Marvell ESPRESSOBin community board support

PATCH New kostap at marvell.com 3 participants 15 messages Feb 16, 2017 – Mar 24, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover Add Marvell ESPRESSOBin community board support

From: Konstantin Porotchkin <[email protected]>

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
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/12 arm64: mvebu: Rename the db-88f3720 to armada-37xx platform

From: Konstantin Porotchkin <[email protected]>

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.

Cc Stefan Roese <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Nadav Haklai <[email protected]>

---
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
arch/arm/mach-mvebu/Kconfig +5 -5
index 412bda4..a256c2f 100644
@@ -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
board/Marvell/mvebu_armada-37xx/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000..52a3869
@@ -0,0 +1,6 @@
+MVEBU_DB_88F3720 BOARD
+M:	Stefan Roese <[email protected]>
+S:	Maintained
+F:	board/Marvell/mvebu_armada-37xx/
+F:	include/configs/mvebu_armada-37xx.h
+F:	configs/mvebu_db-88f3720_defconfig
board/Marvell/mvebu_armada-37xx/Makefile new file +7 -0
new file mode 100644
index 0000000..ed39738
@@ -0,0 +1,7 @@
+#
+# Copyright (C) 2016 Stefan Roese <[email protected]>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= board.o
board/Marvell/mvebu_armada-37xx/board.c new file +134 -0

134 lines not on this page · raw message

board/Marvell/mvebu_db-88f3720/MAINTAINERS deleted +0 -6
deleted file mode 100644
index 4e80917..0000000
@@ -1,6 +0,0 @@
-MVEBU_DB_88F3720 BOARD
-M:	Stefan Roese <[email protected]>
-S:	Maintained
-F:	board/Marvell/mvebu_db-88f3720/
-F:	include/configs/mvebu_db-88f3720.h
-F:	configs/mvebu_db-88f3720_defconfig
board/Marvell/mvebu_db-88f3720/Makefile deleted +0 -7
deleted file mode 100644
index ed39738..0000000
@@ -1,7 +0,0 @@
-#
-# Copyright (C) 2016 Stefan Roese <[email protected]>
-#
-# SPDX-License-Identifier:	GPL-2.0+
-#
-
-obj-y	:= board.o
board/Marvell/mvebu_db-88f3720/board.c deleted +0 -134

134 lines not on this page · raw message

configs/mvebu_db-88f3720_defconfig +1 -1
index 80f2599..4286695 100644
@@ -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
include/configs/mvebu_armada-37xx.h new file +130 -0

130 lines not on this page · raw message

include/configs/mvebu_db-88f3720.h deleted +0 -130

130 lines not on this page · raw message

Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 1/12 arm64: mvebu: Rename the db-88f3720 to armada-37xx platform

Quoted 11 lines · kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

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.

Cc Stefan Roese <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Nadav Haklai <[email protected]>

Complete series applied to u-boot-mavell/master.

Thanks,
Stefan

#3 lore raw

PATCH v2 2/12 arm64: a37xx: Enable Marvell ETH PHY support

In reply to kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

Enable support for Marvell Ethernet PHYs on A37xx platforms

Cc Stefan Roese <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Nadav Haklai <[email protected]>

---
Changes for v2:
- No changes, rebased on top of new platform file

 include/configs/mvebu_armada-37xx.h | 1 +
 1 file changed, 1 insertion(+)
include/configs/mvebu_armada-37xx.h +1 -0
index f5adfef..fd2ae8e 100644
@@ -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
Signature · 1 line
2.7.4
#4 lore raw

PATCH v2 3/12 arm64: a37xx: Enable bubt command support on A3720-DB

In reply to kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

Enable mvebu bubt command support on A3720 DB

Cc Stefan Roese <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Nadav Haklai <[email protected]>

---
Changes for v2:
- No changes

 configs/mvebu_db-88f3720_defconfig | 3 +++
 1 file changed, 3 insertions(+)
configs/mvebu_db-88f3720_defconfig +3 -0
index 4286695..bdb96e9 100644
@@ -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
Signature · 1 line
2.7.4
#5 lore raw

PATCH v2 4/12 arm64: a37xx: dts: Add pin control nodes to DT

In reply to kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

Add pin control nodes for North and South bridges to Armada-37xx DT

Cc Stefan Roese <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Nadav Haklai <[email protected]>
---
 arch/arm/dts/armada-37xx.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Changes for v2:
- No changes, rebased on top of new platform files

arch/arm/dts/armada-37xx.dtsi +14 -0
index 062f2a6..5bea63b 100644
@@ -193,6 +193,20 @@
 				status = "disabled";
 			};
 
+			pinctl0: pinctl at 13830 { /* north bridge */
+				compatible = "marvell,armada-3700-pinctl";
+				bank-name = "armada-3700-nb";
+				reg = <0x13830 0x4>;
+				pin-count = <36>;
+			};
+
+			pinctl1: pinctl at 18830 { /* south bridge */
+				compatible = "marvell,armada-3700-pinctl";
+				bank-name = "armada-3700-sb";
+				reg = <0x18830 0x4>;
+				pin-count = <30>;
+			};
+
 			comphy: comphy at 18300 {
 				compatible = "marvell,mvebu-comphy", "marvell,comphy-armada-3700";
 				reg = <0x18300 0x28>,
Signature · 1 line
2.7.4
#6 lore raw

PATCH v2 5/12 arm64: a37xx: Handle pin controls in early board init

In reply to kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

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.

Cc Stefan Roese <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Nadav Haklai <[email protected]>

---
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(-)
board/Marvell/mvebu_armada-37xx/board.c +25 -1
index edf88c7..3337f3f 100644
@@ -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;
 }
Signature · 1 line
2.7.4
#7 lore raw

PATCH v2 6/12 mvebu: neta: Add support for board init function

In reply to kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

Add ability to use board-specific initialization flow to NETA driver (for instance Ethernet switch bring-up)

Cc Stefan Roese <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Nadav Haklai <[email protected]>

---
Changes for v2:
- No changes

 drivers/net/mvneta.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/net/mvneta.c +15 -1
index 674075f..a1e2136 100644
@@ -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)
Signature · 1 line
2.7.4
#8 lore raw

PATCH v2 7/12 mvebu: neta: a37xx: Add fixed link support to neta driver

In reply to kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

Add support for fixed link to NETA driver. This feature requreed for proper support of SFP modules and onboard connected devices like Ethernet switches

---
Changes for v2:
- No changes

 drivers/net/mvneta.c | 109 ++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 82 insertions(+), 27 deletions(-)
drivers/net/mvneta.c +82 -27
index a1e2136..8881cc7 100644
@@ -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) {
Signature · 1 line
2.7.4
#9 lore raw

PATCH v2 8/12 mvebu: a37xx: Add init for ESPRESSBin Topaz switch

In reply to kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

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.

Cc Stefan Roese <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Nadav Haklai <[email protected]>
Cc Joe Hershberger <[email protected]>

---
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(+)
board/Marvell/mvebu_armada-37xx/board.c +91 -0
index 3337f3f..b9878bf 100644
@@ -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;
+}
Signature · 1 line
2.7.4
#10 lore raw

PATCH v2 8/12 mvebu: a37xx: Add init for ESPRESSBin Topaz switch

Quoted 7 lines · On Thu, Feb 16, 2017 at 5:52 AM, <[email protected]> wrote:

From: Konstantin Porotchkin <[email protected]>

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.

Quoted 5 lines
Cc Stefan Roese <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Nadav Haklai <[email protected]>
Cc Joe Hershberger <[email protected]>
#11 lore raw

PATCH v2 9/12 arm64: dts: Add device tree for ESPRESSOBin board

In reply to kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

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.

Cc Stefan Roese <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Nadav Haklai <[email protected]>

---
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
arch/arm/dts/Makefile +1 -0
index eb68c20..d85210c 100644
@@ -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			\
arch/arm/dts/armada-3720-espressobin.dts new file +135 -0

135 lines not on this page · raw message

Signature · 1 line
2.7.4
#12 lore raw

PATCH v2 10/12 arm64: mvebu: Add default config for ESPRESSOBin board

In reply to kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

Add initial default configuration for Marvell ESPRESSOBin community board based on Aramda-3720 SoC

Cc Stefan Roese <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Nadav Haklai <[email protected]>

---
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
configs/mvebu_espressobin-88f3720_defconfig new file +67 -0
new file mode 100644
index 0000000..d1749bc
@@ -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
Signature · 1 line
2.7.4
#13 lore raw

PATCH v2 11/12 arm64: a37xx: Disable DB configurations on ESPRESSOBin board

In reply to kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

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.

Cc Stefan Roese <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Nadav Haklai <[email protected]>

---
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(+)
board/Marvell/mvebu_armada-37xx/board.c +9 -0
index b9878bf..8dc1f46 100644
@@ -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) {
Signature · 1 line
2.7.4
#14 lore raw

PATCH v2 12/12 arm64: a37xx: Remove DM_I2C_COMPAT from the board config

In reply to kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

Remove DM_I2C_COMPAT from the board configurations for Armada 37xx platform boards for supressing the buid tim warning.

Cc Stefan Roese <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Nadav Haklai <[email protected]>

---
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(-)
configs/mvebu_db-88f3720_defconfig +0 -1
index bdb96e9..3e548a8 100644
@@ -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
configs/mvebu_espressobin-88f3720_defconfig +0 -1
index d1749bc..f02ae64 100644
@@ -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
Signature · 1 line
2.7.4