Skip to contentSkip to conversation

Add ethernet driver for MediaTek SoCs

PATCH New Weijie Gao 4 participants 28 messages Dec 20, 2018 – Jan 16, 2019

Subsystems (8)
lore
Share & tools
lore

Weijie Gao

author
#0 lore raw

cover Add ethernet driver for MediaTek SoCs

This patch series mainly add ethernet support for MeidaTek MT7623/MT7629:

The ethernet related patches:
- Add reset controller: currently binds with the ethsys to provide reset capabilities for ethernet components.
- Ethernet driver: supports one GMAC only. Uses MT7530 gigabit switch for MT7623 and built-in gigabit PHY for MT7629.

Other patch:
- SMP support for MT7629: allow kernel to make use of two cores.

Mark Lee (5):
ethernet: MediaTek: add ethernet driver for MediaTek ARM-based SoCs
arm: dts: add ethernet related node for MT7623 SoC
arm: dts: add ethernet related node for MT7629 SoC
arm: MediaTek: add ethernet support for MT7623 boards
arm: MediaTek: add ethernet support for MT7629 boards

Weijie Gao (6):
mt7623: fix a typo in include/configs/mt7623.h
mt7629: use linux kernel compatible SMP initialization
reset: MedaiTek: add reset controller driver for MediaTek SoCs
clk: MediaTek: bind ethsys reset controller
MAINTAINERS: ARM MEDIATEK: update file entries
configs: MediaTek: use OF_SEPARATE instead of OF_EMBED

 MAINTAINERS                                   |    2 +
 arch/arm/dts/mt7623.dtsi                      |   21 +-
 arch/arm/dts/mt7623n-bananapi-bpi-r2.dts      |   13 +
 arch/arm/dts/mt7629-rfb.dts                   |   11 +
 arch/arm/dts/mt7629.dtsi                      |   43 +
 arch/arm/include/asm/arch-mediatek/reset.h    |   13 +
 arch/arm/mach-mediatek/mt7629/lowlevel_init.S |   52 +-
 configs/mt7623n_bpir2_defconfig               |    8 +-
 configs/mt7629_rfb_defconfig                  |    7 +-
 drivers/clk/mediatek/clk-mt7623.c             |   15 +
 drivers/clk/mediatek/clk-mt7629.c             |   15 +
 drivers/clk/mediatek/clk-mtk.h                |    2 +
 drivers/net/Kconfig                           |   10 +
 drivers/net/Makefile                          |    1 +
 drivers/net/mtk_eth.c                         | 1175 +++++++++++++++++
 drivers/net/mtk_eth.h                         |  286 ++++
 drivers/reset/Kconfig                         |    7 +
 drivers/reset/Makefile                        |    1 +
 drivers/reset/reset-mediatek.c                |  102 ++
 include/configs/mt7623.h                      |    7 +-
 include/configs/mt7629.h                      |    5 +
 include/dt-bindings/reset/mtk-reset.h         |   18 +
 22 files changed, 1802 insertions(+), 12 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-mediatek/reset.h
 create mode 100644 drivers/net/mtk_eth.c
 create mode 100644 drivers/net/mtk_eth.h
 create mode 100644 drivers/reset/reset-mediatek.c
 create mode 100644 include/dt-bindings/reset/mtk-reset.h
Signature · 1 line
2.18.0
author
#1 lore raw

PATCH 1/11 mt7623: fix a typo in include/configs/mt7623.h

Fix typo: neede -> needed

---
 include/configs/mt7623.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/mt7623.h +1 -1
index 68da920e300..ba763501cf2 100644
@@ -46,7 +46,7 @@
 /* DRAM */
 #define CONFIG_SYS_SDRAM_BASE		0x80000000
 
-/* This is neede for kernel booting */
+/* This is needed for kernel booting */
 #define FDT_HIGH			"fdt_high=0xac000000\0"
 
 /* Extra environment variables */
Signature · 1 line
2.18.0
#2 lore raw

PATCH 1/11 mt7623: fix a typo in include/configs/mt7623.h

Quoted 3 lines · Weijie Gao

Fix typo: neede -> needed

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181227/1a89afe4/attachment.sig>
author
#3 lore raw

PATCH 2/11 mt7629: use linux kernel compatible SMP initialization

In reply to Weijie Gao

This patch changes mt7629 to use the compatible platform SMP initialization method of linux kernel.

---
 arch/arm/mach-mediatek/mt7629/lowlevel_init.S | 52 ++++++++++++++++---
 1 file changed, 44 insertions(+), 8 deletions(-)
arch/arm/mach-mediatek/mt7629/lowlevel_init.S +44 -8
index 90dd4ea48e4..3375796b797 100644
@@ -5,6 +5,14 @@
 
 #include <linux/linkage.h>
 
+#define WAIT_CODE_SRAM_BASE	0x0010ff00
+
+#define SLAVE_JUMP_REG		0x10202034
+#define SLAVE1_MAGIC_REG	0x10202038
+#define SLAVE1_MAGIC_NUM	0x534c4131
+
+#define GIC_CPU_BASE		0x10320000
+
 ENTRY(lowlevel_init)
 
 #ifndef CONFIG_SPL_BUILD
@@ -28,6 +36,7 @@ ENTRY(lowlevel_init)
 	mrc	p15, 0, r0, c0, c0, 5
 	ands	r1, r0, #0x40000000
 	bne	go			@ Go if UP
+	/* read slave CPU number */
 	ands	r0, r0, #0x0f
 	beq	go			@ Go if core0 on primary core tile
 	b	secondary
@@ -37,14 +46,41 @@ go:
 	mov	pc, lr
 
 secondary:
-	/* read slave CPU number into r0 firstly */
-	mrc	p15, 0, r0, c0, c0, 5
-	and	r0, r0, #0x0f
+	/* enable GIC as cores will be waken up by IPI */
+	ldr	r2, =GIC_CPU_BASE
+	mov	r1, #0xf0
+	str	r1, [r2, #4]
+	mov	r1, #1
+	str	r1, [r2, #0]
+
+	ldr	r1, [r2]
+	orr	r1, #1
+	str	r1, [r2]
+
+	/* copy wait code into SRAM */
+	ldr	r0, =slave_cpu_wait
+	ldm	r0, {r1 - r8}		@ slave_cpu_wait has eight insns
+	ldr	r0, =WAIT_CODE_SRAM_BASE
+	stm	r0, {r1 - r8}
+
+	/* pass args to slave_cpu_wait */
+	ldr	r0, =SLAVE1_MAGIC_REG
+	ldr	r1, =SLAVE1_MAGIC_NUM
+
+	/* jump to wait code in SRAM */
+	ldr	pc, =WAIT_CODE_SRAM_BASE
 
-loop:
-	dsb
-	isb
-	wfi				@Zzz...
-	b	loop
 #endif
 ENDPROC(lowlevel_init)
+
+/* This function will be copied into SRAM */
+ENTRY(slave_cpu_wait)
+	wfi
+	ldr	r2, [r0]
+	cmp	r2, r1
+	bne	slave_cpu_wait
+	movw	r0, #:lower16:SLAVE_JUMP_REG
+	movt	r0, #:upper16:SLAVE_JUMP_REG
+	ldr	r1, [r0]
+	mov	pc, r1
+ENDPROC(slave_cpu_wait)
Signature · 1 line
2.18.0
#4 lore raw

PATCH 2/11 mt7629: use linux kernel compatible SMP initialization

Quoted 4 lines · Weijie Gao

This patch changes mt7629 to use the compatible platform SMP initialization method of linux kernel.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181227/301c3397/attachment.sig>
author
#5 lore raw

PATCH 3/11 reset: MedaiTek: add reset controller driver for MediaTek SoCs

In reply to Weijie Gao

This patch adds reset controller driver for MediaTek SoCs.

---
 arch/arm/include/asm/arch-mediatek/reset.h |  13 +++
 drivers/reset/Kconfig                      |   7 ++
 drivers/reset/Makefile                     |   1 +
 drivers/reset/reset-mediatek.c             | 102 +++++++++++++++++++++
 include/dt-bindings/reset/mtk-reset.h      |  18 ++++
 5 files changed, 141 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-mediatek/reset.h
 create mode 100644 drivers/reset/reset-mediatek.c
 create mode 100644 include/dt-bindings/reset/mtk-reset.h
arch/arm/include/asm/arch-mediatek/reset.h new file +13 -0
new file mode 100644
index 00000000000..9704666d24e
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2018 MediaTek Inc.
+ */
+
+#ifndef __MEDIATEK_RESET_H
+#define __MEDIATEK_RESET_H
+
+#include <dm.h>
+
+int mediatek_reset_bind(struct udevice *pdev, u32 regofs, u32 num_regs);
+
+#endif	/* __MEDIATEK_RESET_H */
drivers/reset/Kconfig +7 -0
index 9c5208b7da5..3a6d61f440c 100644
@@ -106,4 +106,11 @@ config RESET_SOCFPGA
 	help
 	  Support for reset controller on SoCFPGA platform.
 
+config RESET_MEDIATEK
+	bool "Reset controller driver for MediaTek SoCs"
+	depends on DM_RESET && ARCH_MEDIATEK && CLK
+	default y
+	help
+	  Support for reset controller on MediaTek SoCs.
+
 endmenu
drivers/reset/Makefile +1 -0
index f4520878b7c..8a4dcab8f64 100644
@@ -17,3 +17,4 @@ obj-$(CONFIG_AST2500_RESET) += ast2500-reset.o
 obj-$(CONFIG_RESET_ROCKCHIP) += reset-rockchip.o
 obj-$(CONFIG_RESET_MESON) += reset-meson.o
 obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o
+obj-$(CONFIG_RESET_MEDIATEK) += reset-mediatek.o
drivers/reset/reset-mediatek.c new file +102 -0

102 lines not on this page · raw message

include/dt-bindings/reset/mtk-reset.h new file +18 -0
new file mode 100644
index 00000000000..5f0a74f280c
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2018 MediaTek Inc.
+ */
+
+#ifndef _DT_BINDINGS_MTK_RESET_H_
+#define _DT_BINDINGS_MTK_RESET_H_
+
+/* ETHSYS */
+#define ETHSYS_PPE_RST			31
+#define ETHSYS_EPHY_RST			24
+#define ETHSYS_GMAC_RST			23
+#define ETHSYS_ESW_RST			16
+#define ETHSYS_FE_RST			6
+#define ETHSYS_MCM_RST			2
+#define ETHSYS_SYS_RST			0
+
+#endif /* _DT_BINDINGS_MTK_RESET_H_ */
Signature · 1 line
2.18.0
#6 lore raw

PATCH 3/11 reset: MedaiTek: add reset controller driver for MediaTek SoCs

Hi,

here you have a small typo in commit-Message (Subject) "MedaiTek:"

as of Tom tells me there is a problem with SMP-Initialisation, you may need a v2 and can fix this typo

regards Frank

#7 lore raw

PATCH 3/11 reset: MedaiTek: add reset controller driver for MediaTek SoCs

In reply to Weijie Gao
Quoted 4 lines · Weijie Gao

This patch adds reset controller driver for MediaTek SoCs.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190115/646c74c0/attachment.sig>
author
#8 lore raw

PATCH 4/11 clk: MediaTek: bind ethsys reset controller

In reply to Weijie Gao

The ethsys contains not only the clock gating controller, but also the reset controller for the whole ethernet subsystem and its components.

This patch adds binding of the reset controller so that the ethernet node can have references on it.

---
 drivers/clk/mediatek/clk-mt7623.c | 15 +++++++++++++++
 drivers/clk/mediatek/clk-mt7629.c | 15 +++++++++++++++
 drivers/clk/mediatek/clk-mtk.h    |  2 ++
 3 files changed, 32 insertions(+)
drivers/clk/mediatek/clk-mt7623.c +15 -0
index c6b09d8e18d..87ad4f79ced 100644
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <asm/arch-mediatek/reset.h>
 #include <asm/io.h>
 #include <dt-bindings/clock/mt7623-clk.h>
 
@@ -782,6 +783,19 @@ static int mt7623_ethsys_probe(struct udevice *dev)
 	return mtk_common_clk_gate_init(dev, &mt7623_clk_tree, eth_cgs);
 }
 
+static int mt7623_ethsys_bind(struct udevice *dev)
+{
+	int ret = 0;
+
+#if CONFIG_IS_ENABLED(RESET_MEDIATEK)
+	ret = mediatek_reset_bind(dev, ETHSYS_RST_CTRL_OFS, 1);
+	if (ret)
+		debug("Warning: failed to bind ethsys reset controller\n");
+#endif
+
+	return ret;
+}
+
 static const struct udevice_id mt7623_apmixed_compat[] = {
 	{ .compatible = "mediatek,mt7623-apmixedsys" },
 	{ }
@@ -865,6 +879,7 @@ U_BOOT_DRIVER(mtk_clk_ethsys) = {
 	.id = UCLASS_CLK,
 	.of_match = mt7623_ethsys_compat,
 	.probe = mt7623_ethsys_probe,
+	.bind = mt7623_ethsys_bind,
 	.priv_auto_alloc_size = sizeof(struct mtk_cg_priv),
 	.ops = &mtk_clk_gate_ops,
 };
drivers/clk/mediatek/clk-mt7629.c +15 -0
index 2601b6cf30d..6a9f60139c0 100644
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <asm/arch-mediatek/reset.h>
 #include <asm/io.h>
 #include <dt-bindings/clock/mt7629-clk.h>
 
@@ -602,6 +603,19 @@ static int mt7629_ethsys_probe(struct udevice *dev)
 	return mtk_common_clk_gate_init(dev, &mt7629_clk_tree, eth_cgs);
 }
 
+static int mt7629_ethsys_bind(struct udevice *dev)
+{
+	int ret = 0;
+
+#if CONFIG_IS_ENABLED(RESET_MEDIATEK)
+	ret = mediatek_reset_bind(dev, ETHSYS_RST_CTRL_OFS, 1);
+	if (ret)
+		debug("Warning: failed to bind ethsys reset controller\n");
+#endif
+
+	return ret;
+}
+
 static int mt7629_sgmiisys_probe(struct udevice *dev)
 {
 	return mtk_common_clk_gate_init(dev, &mt7629_clk_tree, sgmii_cgs);
@@ -695,6 +709,7 @@ U_BOOT_DRIVER(mtk_clk_ethsys) = {
 	.id = UCLASS_CLK,
 	.of_match = mt7629_ethsys_compat,
 	.probe = mt7629_ethsys_probe,
+	.bind = mt7629_ethsys_bind,
 	.priv_auto_alloc_size = sizeof(struct mtk_cg_priv),
 	.ops = &mtk_clk_gate_ops,
 };
drivers/clk/mediatek/clk-mtk.h +2 -0
index 74152ed9c6e..7847388b2a1 100644
@@ -23,6 +23,8 @@
 #define CLK_PARENT_TOPCKGEN		BIT(5)
 #define CLK_PARENT_MASK			GENMASK(5, 4)
 
+#define ETHSYS_RST_CTRL_OFS		0x34
+
 /* struct mtk_pll_data - hardware-specific PLLs data */
 struct mtk_pll_data {
 	const int id;
Signature · 1 line
2.18.0
#9 lore raw

PATCH 4/11 clk: MediaTek: bind ethsys reset controller

Quoted 7 lines · Weijie Gao

The ethsys contains not only the clock gating controller, but also the reset controller for the whole ethernet subsystem and its components.

This patch adds binding of the reset controller so that the ethernet node can have references on it.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190115/cc400310/attachment.sig>
author
#10 lore raw

PATCH 5/11 ethernet: MediaTek: add ethernet driver for MediaTek ARM-based SoCs

In reply to Weijie Gao

This patch adds ethernet support for Mediatek ARM-based SoCs, including a minimum setup of the integrated switch.

---
 drivers/net/Kconfig   |   10 +
 drivers/net/Makefile  |    1 +
 drivers/net/mtk_eth.c | 1175 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/mtk_eth.h |  286 ++++++++++
 4 files changed, 1472 insertions(+)
 create mode 100644 drivers/net/mtk_eth.c
 create mode 100644 drivers/net/mtk_eth.h
drivers/net/Kconfig +10 -0
index 8fb365fc5d2..470aa8d0b9e 100644
@@ -495,4 +495,14 @@ config TSEC_ENET
 	  This driver implements support for the (Enhanced) Three-Speed
 	  Ethernet Controller found on Freescale SoCs.
 
+config MEDIATEK_ETH
+	bool "MediaTek Ethernet GMAC Driver"
+	depends on DM_ETH
+	select PHYLIB
+	select DM_GPIO
+	select DM_RESET
+	help
+	  This Driver support MediaTek Ethernet GMAC
+	  Say Y to enable support for the MediaTek Ethernet GMAC.
+
 endif # NETDEVICES
drivers/net/Makefile +1 -0
index 99056aa041d..f3740a6fe1d 100644
@@ -72,3 +72,4 @@ obj-$(CONFIG_DWC_ETH_QOS) += dwc_eth_qos.o
 obj-$(CONFIG_FSL_PFE) += pfe_eth/
 obj-$(CONFIG_SNI_AVE) += sni_ave.o
 obj-y += ti/
+obj-$(CONFIG_MEDIATEK_ETH) += mtk_eth.o
drivers/net/mtk_eth.c new file +1175 -0

1,175 lines not on this page · raw message

drivers/net/mtk_eth.h new file +286 -0

286 lines not on this page · raw message

Signature · 1 line
2.18.0
#11 lore raw

PATCH 5/11 ethernet: MediaTek: add ethernet driver for MediaTek ARM-based SoCs

Hi,

nice to see ethernet-driver for bananapi r2 :)

but i have a problem while building:

drivers/net/mtk_eth.c: In function ‘mtk_eth_probe’:
drivers/net/mtk_eth.c:1014:3: warning: implicit declaration of function ‘noncached_alloc’; did you mean ‘kmem_cache_alloc’? [-Wimplicit-function-declaration]
noncached_alloc(sizeof(struct pdma_txdesc) * NUM_TX_DESC,
^~~~~~~~~~~~~~~
kmem_cache_alloc

searched for it:

./arch/arm/include/asm/system.h:571:phys_addr_t noncached_alloc(size_t size, size_t align);

and tried to fix by adding

#include <asm/system.h>

to drivers/net/mtk_eth.c, but still present. currently working on 2018-11, but 2019-01-rc2 seems to have no related change.

uploaded my staging here:

https://github.com/frank-w/u-boot/tree/bpi-r2_eth

any idea what i'm missing?

regards Frank

Quoted 7 lines

Gesendet: Donnerstag, 20. Dezember 2018 um 09:12 Uhr
Von: "Weijie Gao" <[email protected]>

drivers/net/mtk_eth.c new file +0 -0
new file mode 100644
index 00000000000..cc09404830a

...

Quoted 7 lines
drivers/net/mtk_eth.c new file +7 -0
+	/* Prepare for tx/rx rings */
+	priv->tx_ring_noc = (struct pdma_txdesc *)
+		noncached_alloc(sizeof(struct pdma_txdesc) * NUM_TX_DESC,
+				ARCH_DMA_MINALIGN);
+	priv->rx_ring_noc = (struct pdma_rxdesc *)
+		noncached_alloc(sizeof(struct pdma_rxdesc) * NUM_RX_DESC,
+				ARCH_DMA_MINALIGN);
#12 lore raw

PATCH 5/11 ethernet: MediaTek: add ethernet driver for MediaTek ARM-based SoCs

with 2019-rc it comiles fine and loads kernel over tftp (wan-port).

U-Boot 2019.01-rc2-00012-g645c7a0418 (Dec 20 2018 - 10:56:50 +0100)

CPU:   MediaTek MT7623 E3
DRAM:  2 GiB
MMC:   mmc at 11230000: 0, mmc at 11240000: 1
In:    serial
Out:   serial
Err:   serial

Net:
Warning: ethernet at 1b100000 (eth0) using random MAC address - fe:6f:b4:ff:e0:48
eth0: ethernet at 1b100000
U-Boot> setenv ipaddr 192.168.0.11
U-Boot> setenv netmask 255.255.255.0
U-Boot> setenv serverip 192.168.0.10
U-Boot> setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait ip=dhcp U-Boot> setenv bootfile uImage_4.19.0-rc1-hdmiv5
U-Boot> tftp 0x80200000 ${bootfile}
Using ethernet at 1b100000 device
TFTP from server 192.168.0.10; our IP address is 192.168.0.11
Filename 'uImage_4.19.0-rc1-hdmiv5'.
Load address: 0x80200000
Loading: #################################################################

         #################################################################      
         #################################################################      
         #################################################################      
         #################################################################      
         #################################################################      
         #################################################################      
         #################################################################      
         #################################################################      
         #################################################################      
         #################################################################      
         #################################################################      
         #################################################################      
         #################################################################      
         #################################################################      
         #################################################################      
         #################################################################      
         #################################################################      
         ################################################                       
         263.7 KiB/s

done
Bytes transferred = 6231491 (5f15c3 hex) U-Boot> bootm 0x80200000
## Booting kernel from Legacy Image at 80200000 ...

   Image Name:   Linux Kernel 4.19.0-rc1-hdmiv5                                 
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    6231427 Bytes = 5.9 MiB

Load Address: 80008000
Entry Point: 80008000
Verifying Checksum ... OK
Loading Kernel Image ... OK

Starting kernel ...

so i need to look why it's not working on 2018-11...

regards Frank

#13 lore raw

PATCH 5/11 ethernet: MediaTek: add ethernet driver for MediaTek ARM-based SoCs

In reply to Frank Wunderlich

found it

missed this line in mt7623.h (git am breaked there because of my own changes and i only added 2 lines)

#define CONFIG_SYS_NONCACHED_MEMORY SZ_1M

compile works now

regards Frank

#14 lore raw

PATCH 5/11 ethernet: MediaTek: add ethernet driver for MediaTek ARM-based SoCs

In reply to Weijie Gao
Quoted 7 lines · Weijie Gao

This patch adds ethernet support for Mediatek ARM-based SoCs, including a minimum setup of the integrated switch.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190115/8e7d7e7f/attachment.sig>
author
#15 lore raw

PATCH 6/11 arm: dts: add ethernet related node for MT7623 SoC

In reply to Weijie Gao

This patch adds ethernet gmac node for MT7623 with MT7530 gigabit switch.

---
 arch/arm/dts/mt7623.dtsi                 | 21 ++++++++++++++++++++-
 arch/arm/dts/mt7623n-bananapi-bpi-r2.dts | 13 +++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)
arch/arm/dts/mt7623.dtsi +20 -1
index f50f4ef1b92..448d1d73810 100644
@@ -10,6 +10,7 @@
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/power/mt7623-power.h>
+#include <dt-bindings/reset/mtk-reset.h>
 #include "skeleton.dtsi"
 
 / {
@@ -248,8 +249,26 @@
 	};
 
 	ethsys: syscon at 1b000000 {
-		compatible = "mediatek,mt7623-ethsys";
+		compatible = "mediatek,mt7623-ethsys", "syscon";
 		reg = <0x1b000000 0x1000>;
 		#clock-cells = <1>;
+		#reset-cells = <1>;
+	};
+
+	eth: ethernet at 1b100000 {
+		compatible = "mediatek,mt7623-eth", "syscon";
+		reg = <0x1b100000 0x20000>;
+		clocks = <&topckgen CLK_TOP_ETHIF_SEL>,
+			 <&ethsys CLK_ETHSYS_ESW>,
+			 <&ethsys CLK_ETHSYS_GP1>,
+			 <&ethsys CLK_ETHSYS_GP2>,
+			 <&apmixedsys CLK_APMIXED_TRGPLL>;
+		clock-names = "ethif", "esw", "gp1", "gp2", "trgpll";
+		power-domains = <&scpsys MT7623_POWER_DOMAIN_ETH>;
+		resets = <&ethsys ETHSYS_FE_RST>,
+			 <&ethsys ETHSYS_MCM_RST>;
+		reset-names = "fe", "mcm";
+		mediatek,ethsys = <&ethsys>;
+		status = "disabled";
 	};
 };
arch/arm/dts/mt7623n-bananapi-bpi-r2.dts +13 -0
index 84a77fde443..51628bb6399 100644
@@ -67,6 +67,19 @@
 	};
 };
 
+&eth {
+	status = "okay";
+	mediatek,gmac-id = <0>;
+	phy-mode = "rgmii";
+	mediatek,switch = "mt7530";
+	reset-gpios = <&gpio 33 GPIO_ACTIVE_HIGH>;
+
+	fixed-link {
+		speed = <1000>;
+		full-duplex;
+	};
+};
+
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins_default>;
Signature · 1 line
2.18.0
#16 lore raw

PATCH 6/11 arm: dts: add ethernet related node for MT7623 SoC

Quoted 3 lines · Weijie Gao

This patch adds ethernet gmac node for MT7623 with MT7530 gigabit switch.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190115/c6ca5cee/attachment.sig>
author
#17 lore raw

PATCH 7/11 arm: dts: add ethernet related node for MT7629 SoC

In reply to Weijie Gao

This patch adds ethernet gmac node for MT7629 with internal gigabit phy.

---
 arch/arm/dts/mt7629-rfb.dts | 11 ++++++++++
 arch/arm/dts/mt7629.dtsi    | 43 +++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)
arch/arm/dts/mt7629-rfb.dts +11 -0
index a6d28a060f3..95d10aa6d32 100644
@@ -22,6 +22,17 @@
 	};
 };
 
+&eth {
+	status = "okay";
+	mediatek,gmac-id = <1>;
+	phy-mode = "gmii";
+	phy-handle = <&phy0>;
+
+	phy0: ethernet-phy at 0 {
+		reg = <0>;
+	};
+};
+
 &pinctrl {
 	qspi_pins: qspi-pins {
 		mux {
arch/arm/dts/mt7629.dtsi +43 -0

55 lines not on this page · raw message

Signature · 1 line
2.18.0
#18 lore raw

PATCH 7/11 arm: dts: add ethernet related node for MT7629 SoC

Quoted 3 lines · Weijie Gao

This patch adds ethernet gmac node for MT7629 with internal gigabit phy.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190115/9872658c/attachment.sig>
author
#19 lore raw

PATCH 8/11 arm: MediaTek: add ethernet support for MT7623 boards

In reply to Weijie Gao

Enable ethernet related configs to mt7623n_bpir2_defconfig. Add default IP addresses.
Enable noncached memory region required by ethernet driver.

---
 configs/mt7623n_bpir2_defconfig | 6 ++++++
 include/configs/mt7623.h        | 5 +++++
 2 files changed, 11 insertions(+)
configs/mt7623n_bpir2_defconfig +6 -0
index 3a4de72e233..792a78d80c0 100644
@@ -29,6 +29,7 @@ CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_EMBED=y
 CONFIG_DEFAULT_DEVICE_TREE="mt7623n-bananapi-bpi-r2"
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 # CONFIG_BLOCK_CACHE is not set
@@ -38,6 +39,11 @@ CONFIG_DM_MMC=y
 # CONFIG_MMC_QUIRKS is not set
 CONFIG_MMC_HS400_SUPPORT=y
 CONFIG_MMC_MTK=y
+CONFIG_DM_RESET=y
+CONFIG_RESET_MEDIATEK=y
+CONFIG_PHY_FIXED=y
+CONFIG_DM_ETH=y
+CONFIG_MEDIATEK_ETH=y
 CONFIG_PINCTRL=y
 CONFIG_PINCONF=y
 CONFIG_PINCTRL_MT7623=y
include/configs/mt7623.h +5 -0
index ba763501cf2..5129c83da8f 100644
@@ -24,6 +24,7 @@
 
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN		SZ_4M
+#define CONFIG_SYS_NONCACHED_MEMORY	SZ_1M
 
 /* Environment */
 #define CONFIG_ENV_SIZE			SZ_4K
@@ -53,4 +54,8 @@
 #define CONFIG_EXTRA_ENV_SETTINGS	\
 	FDT_HIGH
 
+/* Ethernet */
+#define CONFIG_IPADDR			192.168.1.1
+#define CONFIG_SERVERIP			192.168.1.2
+
 #endif
Signature · 1 line
2.18.0
#20 lore raw

PATCH 8/11 arm: MediaTek: add ethernet support for MT7623 boards

Quoted 5 lines · Weijie Gao

Enable ethernet related configs to mt7623n_bpir2_defconfig. Add default IP addresses.
Enable noncached memory region required by ethernet driver.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190115/f217dfc4/attachment.sig>
author
#21 lore raw

PATCH 9/11 arm: MediaTek: add ethernet support for MT7629 boards

In reply to Weijie Gao

Enable ethernet related configs to mt7629_rfb_defconfig. Add default IP addresses.
Enable noncached memory region required by ethernet driver.

---
 configs/mt7629_rfb_defconfig | 5 +++++
 include/configs/mt7629.h     | 5 +++++
 2 files changed, 10 insertions(+)
configs/mt7629_rfb_defconfig +5 -0
index 1729d13c3d3..fdd5f575774 100644
@@ -32,6 +32,7 @@ CONFIG_CMD_PING=y
 CONFIG_OF_EMBED=y
 CONFIG_DEFAULT_DEVICE_TREE="mt7629-rfb"
 CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-parents"
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_REGMAP=y
 CONFIG_SPL_REGMAP=y
@@ -51,6 +52,10 @@ CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_DM_RESET=y
+CONFIG_RESET_MEDIATEK=y
+CONFIG_DM_ETH=y
+CONFIG_MEDIATEK_ETH=y
 CONFIG_PINCTRL=y
 CONFIG_PINCONF=y
 CONFIG_PINCTRL_MT7629=y
include/configs/mt7629.h +5 -0
index a665a5eb7f2..9910d8c89a6 100644
@@ -24,6 +24,7 @@
 
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN		SZ_4M
+#define CONFIG_SYS_NONCACHED_MEMORY	SZ_1M
 
 /* Environment */
 #define CONFIG_ENV_SIZE			SZ_4K
@@ -54,4 +55,8 @@
 /* DRAM */
 #define CONFIG_SYS_SDRAM_BASE		0x40000000
 
+/* Ethernet */
+#define CONFIG_IPADDR			192.168.1.1
+#define CONFIG_SERVERIP			192.168.1.2
+
 #endif
Signature · 1 line
2.18.0
#22 lore raw

PATCH 9/11 arm: MediaTek: add ethernet support for MT7629 boards

Quoted 5 lines · Weijie Gao

Enable ethernet related configs to mt7629_rfb_defconfig. Add default IP addresses.
Enable noncached memory region required by ethernet driver.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190115/95869597/attachment.sig>
author
#23 lore raw

PATCH 10/11 MAINTAINERS: ARM MEDIATEK: update file entries

In reply to Weijie Gao

This patch adds new file entries for MediaTek SoCs

---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)
MAINTAINERS +2 -0
index 0cec39c542d..54218ee5e9d 100644
@@ -176,6 +176,8 @@ F:	drivers/ram/mediatek/
 F:	drivers/spi/mtk_qspi.c
 F:	drivers/timer/mtk_timer.c
 F:	drivers/watchdog/mtk_wdt.c
+F:	drivers/net/mtk_eth.c
+F:	drivers/reset/reset-mediatek.c
 F:	tools/mtk_image.c
 F:	tools/mtk_image.h
 N:	mediatek
Signature · 1 line
2.18.0
#24 lore raw

PATCH 10/11 MAINTAINERS: ARM MEDIATEK: update file entries

Quoted 3 lines · Weijie Gao

This patch adds new file entries for MediaTek SoCs

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190115/02db8717/attachment.sig>
author
#25 lore raw

PATCH 11/11 configs: MediaTek: use OF_SEPARATE instead of OF_EMBED

In reply to Weijie Gao

This patch replace OF_EMBED with OF_SEPARATE of defconfig files of MediaTek boards because now OF_EMBED is only used for debugging purpose.

---
 configs/mt7623n_bpir2_defconfig | 2 +-
 configs/mt7629_rfb_defconfig    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
configs/mt7623n_bpir2_defconfig +1 -1
index 792a78d80c0..1a973672627 100644
@@ -27,7 +27,7 @@ CONFIG_CMD_READ=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
-CONFIG_OF_EMBED=y
+CONFIG_OF_SEPARATE=y
 CONFIG_DEFAULT_DEVICE_TREE="mt7623n-bananapi-bpi-r2"
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_REGMAP=y
configs/mt7629_rfb_defconfig +1 -1
index fdd5f575774..1da9932dcd9 100644
@@ -29,7 +29,7 @@ CONFIG_CMD_SF_TEST=y
 # CONFIG_CMD_NFS is not set
 CONFIG_CMD_PING=y
 # CONFIG_PARTITIONS is not set
-CONFIG_OF_EMBED=y
+CONFIG_OF_SEPARATE=y
 CONFIG_DEFAULT_DEVICE_TREE="mt7629-rfb"
 CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-parents"
 CONFIG_NET_RANDOM_ETHADDR=y
Signature · 1 line
2.18.0
#26 lore raw

PATCH 11/11 configs: MediaTek: use OF_SEPARATE instead of OF_EMBED

Quoted 9 lines · Weijie Gao

This patch replace OF_EMBED with OF_SEPARATE of defconfig files of MediaTek boards because now OF_EMBED is only used for debugging purpose.

---
 configs/mt7623n_bpir2_defconfig | 2 +-
 configs/mt7629_rfb_defconfig    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
#27 lore raw

PATCH 11/11 configs: MediaTek: use OF_SEPARATE instead of OF_EMBED

In reply to Weijie Gao
Quoted 5 lines · Weijie Gao

This patch replace OF_EMBED with OF_SEPARATE of defconfig files of MediaTek boards because now OF_EMBED is only used for debugging purpose.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190115/7d65f136/attachment.sig>