All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-boot,0/4] Add ethernet support for MT7622
@ 2020-01-21 11:31 MarkLee
  2020-01-21 11:31 ` [U-boot, 1/4] eth: mtk-eth: add sgmii mode support in mediatek eth driver MarkLee
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: MarkLee @ 2020-01-21 11:31 UTC (permalink / raw)
  To: u-boot

This patch series adds and enable ethernet support for MT7622, including
	1. add sgmii mode support in mediatek eth driver
	2. add mt7622 support in mediatek eth driver
	3. add ethernet and sgmii dts node for mt7622
	4. enable mt7622 ethernet support in defconfig


MarkLee (4):
  eth: mtk-eth: add sgmii mode support in mediatek eth driver
  eth: mtk-eth: add mt7622 support in mediatek eth driver
  arm: dts: mediatek: add ethernet and sgmii dts node for mt7622
  configs: mediatek: enable mt7622 ethernet support

 arch/arm/dts/mt7622-rfb.dts  | 13 ++++++++++
 arch/arm/dts/mt7622.dtsi     | 45 +++++++++++++++++++++++++++++++++
 configs/mt7622_rfb_defconfig |  4 +++
 drivers/net/mtk_eth.c        | 49 +++++++++++++++++++++++++++++++++++-
 drivers/net/mtk_eth.h        | 15 +++++++++++
 5 files changed, 125 insertions(+), 1 deletion(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-boot, 1/4] eth: mtk-eth: add sgmii mode support in mediatek eth driver
  2020-01-21 11:31 [U-boot,0/4] Add ethernet support for MT7622 MarkLee
@ 2020-01-21 11:31 ` MarkLee
  2020-02-08  0:06   ` Tom Rini
  2020-01-21 11:31 ` [U-boot,2/4] eth: mtk-eth: add mt7622 " MarkLee
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: MarkLee @ 2020-01-21 11:31 UTC (permalink / raw)
  To: u-boot

This patch add sgmii init part for the mediatek SoC that
support sgmii mode. It is a must for mt7622.

Signed-off-by: MarkLee <Mark-MC.Lee@mediatek.com>
---
 drivers/net/mtk_eth.c | 44 +++++++++++++++++++++++++++++++++++++++++++
 drivers/net/mtk_eth.h | 15 +++++++++++++++
 2 files changed, 59 insertions(+)

diff --git a/drivers/net/mtk_eth.c b/drivers/net/mtk_eth.c
index c22e590387..8354e82244 100644
--- a/drivers/net/mtk_eth.c
+++ b/drivers/net/mtk_eth.c
@@ -151,6 +151,7 @@ struct mtk_eth_priv {
 	void __iomem *fe_base;
 	void __iomem *gmac_base;
 	void __iomem *ethsys_base;
+	void __iomem *sgmii_base;
 
 	struct mii_dev *mdio_bus;
 	int (*mii_read)(struct mtk_eth_priv *priv, u8 phy, u8 reg);
@@ -750,6 +751,24 @@ static int mtk_phy_probe(struct udevice *dev)
 	return 0;
 }
 
+static void mtk_sgmii_init(struct mtk_eth_priv *priv)
+{
+	/* Set SGMII GEN2 speed(2.5G) */
+	clrsetbits_le32(priv->sgmii_base + SGMSYS_GEN2_SPEED,
+			SGMSYS_SPEED_2500, SGMSYS_SPEED_2500);
+
+	/* Disable SGMII AN */
+	clrsetbits_le32(priv->sgmii_base + SGMSYS_PCS_CONTROL_1,
+			SGMII_AN_ENABLE, 0);
+
+	/* SGMII force mode setting */
+	writel(SGMII_FORCE_MODE, priv->sgmii_base + SGMSYS_SGMII_MODE);
+
+	/* Release PHYA power down state */
+	clrsetbits_le32(priv->sgmii_base + SGMSYS_QPHY_PWR_STATE_CTRL,
+			SGMII_PHYA_PWD, 0);
+}
+
 static void mtk_mac_init(struct mtk_eth_priv *priv)
 {
 	int i, ge_mode = 0;
@@ -758,8 +777,13 @@ static void mtk_mac_init(struct mtk_eth_priv *priv)
 	switch (priv->phy_interface) {
 	case PHY_INTERFACE_MODE_RGMII_RXID:
 	case PHY_INTERFACE_MODE_RGMII:
+		ge_mode = GE_MODE_RGMII;
+		break;
 	case PHY_INTERFACE_MODE_SGMII:
 		ge_mode = GE_MODE_RGMII;
+		mtk_ethsys_rmw(priv, ETHSYS_SYSCFG0_REG, SYSCFG0_SGMII_SEL_M,
+			       SYSCFG0_SGMII_SEL(priv->gmac_id));
+		mtk_sgmii_init(priv);
 		break;
 	case PHY_INTERFACE_MODE_MII:
 	case PHY_INTERFACE_MODE_GMII:
@@ -1104,6 +1128,26 @@ static int mtk_eth_ofdata_to_platdata(struct udevice *dev)
 		}
 	}
 
+	if (priv->phy_interface == PHY_INTERFACE_MODE_SGMII) {
+		/* get corresponding sgmii phandle */
+		ret = dev_read_phandle_with_args(dev, "mediatek,sgmiisys",
+						 NULL, 0, 0, &args);
+		if (ret)
+			return ret;
+
+		regmap = syscon_node_to_regmap(args.node);
+
+		if (IS_ERR(regmap))
+			return PTR_ERR(regmap);
+
+		priv->sgmii_base = regmap_get_range(regmap, 0);
+
+		if (!priv->sgmii_base) {
+			dev_err(dev, "Unable to find sgmii\n");
+			return -ENODEV;
+		}
+	}
+
 	/* check for switch first, otherwise phy will be used */
 	priv->sw = SW_NONE;
 	priv->switch_init = NULL;
diff --git a/drivers/net/mtk_eth.h b/drivers/net/mtk_eth.h
index fe89a03739..9bb037d440 100644
--- a/drivers/net/mtk_eth.h
+++ b/drivers/net/mtk_eth.h
@@ -20,6 +20,8 @@
 #define ETHSYS_SYSCFG0_REG		0x14
 #define SYSCFG0_GE_MODE_S(n)		(12 + ((n) * 2))
 #define SYSCFG0_GE_MODE_M		0x3
+#define SYSCFG0_SGMII_SEL_M		(0x3 << 8)
+#define SYSCFG0_SGMII_SEL(gmac)		((!(gmac)) ? BIT(9) : BIT(8))
 
 #define ETHSYS_CLKCFG0_REG		0x2c
 #define ETHSYS_TRGMII_CLK_SEL362_5	BIT(11)
@@ -30,6 +32,19 @@
 #define GE_MODE_MII_PHY			2
 #define GE_MODE_RMII			3
 
+/* SGMII subsystem config registers */
+#define SGMSYS_PCS_CONTROL_1		0x0
+#define SGMII_AN_ENABLE			BIT(12)
+
+#define SGMSYS_SGMII_MODE		0x20
+#define SGMII_FORCE_MODE		0x31120019
+
+#define SGMSYS_QPHY_PWR_STATE_CTRL	0xe8
+#define SGMII_PHYA_PWD			BIT(4)
+
+#define SGMSYS_GEN2_SPEED		0x2028
+#define SGMSYS_SPEED_2500		BIT(2)
+
 /* Frame Engine Registers */
 
 /* PDMA */
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [U-boot,2/4] eth: mtk-eth: add mt7622 support in mediatek eth driver
  2020-01-21 11:31 [U-boot,0/4] Add ethernet support for MT7622 MarkLee
  2020-01-21 11:31 ` [U-boot, 1/4] eth: mtk-eth: add sgmii mode support in mediatek eth driver MarkLee
@ 2020-01-21 11:31 ` MarkLee
  2020-02-08  0:06   ` [U-boot, 2/4] " Tom Rini
  2020-01-21 11:31 ` [U-boot, 3/4] arm: dts: mediatek: add ethernet and sgmii dts node for mt7622 MarkLee
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: MarkLee @ 2020-01-21 11:31 UTC (permalink / raw)
  To: u-boot

This patch add mt7622 support in mediatek eth driver

Signed-off-by: MarkLee <Mark-MC.Lee@mediatek.com>
---
 drivers/net/mtk_eth.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mtk_eth.c b/drivers/net/mtk_eth.c
index 7721ffb46c..85bbc2a3c5 100644
--- a/drivers/net/mtk_eth.c
+++ b/drivers/net/mtk_eth.c
@@ -136,7 +136,8 @@ enum mtk_switch {
 
 enum mtk_soc {
 	SOC_MT7623,
-	SOC_MT7629
+	SOC_MT7629,
+	SOC_MT7622
 };
 
 struct mtk_eth_priv {
@@ -1196,6 +1197,7 @@ static int mtk_eth_ofdata_to_platdata(struct udevice *dev)
 static const struct udevice_id mtk_eth_ids[] = {
 	{ .compatible = "mediatek,mt7629-eth", .data = SOC_MT7629 },
 	{ .compatible = "mediatek,mt7623-eth", .data = SOC_MT7623 },
+	{ .compatible = "mediatek,mt7622-eth", .data = SOC_MT7622 },
 	{}
 };
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [U-boot, 3/4] arm: dts: mediatek: add ethernet and sgmii dts node for mt7622
  2020-01-21 11:31 [U-boot,0/4] Add ethernet support for MT7622 MarkLee
  2020-01-21 11:31 ` [U-boot, 1/4] eth: mtk-eth: add sgmii mode support in mediatek eth driver MarkLee
  2020-01-21 11:31 ` [U-boot,2/4] eth: mtk-eth: add mt7622 " MarkLee
@ 2020-01-21 11:31 ` MarkLee
  2020-02-08  0:06   ` Tom Rini
  2020-01-21 11:32 ` [U-boot,4/4] configs: mediatek: enable mt7622 ethernet support MarkLee
  2020-01-21 12:53 ` Aw: [U-boot,0/4] Add ethernet support for MT7622 Frank Wunderlich
  4 siblings, 1 reply; 14+ messages in thread
From: MarkLee @ 2020-01-21 11:31 UTC (permalink / raw)
  To: u-boot

This patch add eth and sgmii dts node for mt7622 to support ethernet

Signed-off-by: MarkLee <Mark-MC.Lee@mediatek.com>
---
 arch/arm/dts/mt7622-rfb.dts | 13 +++++++++++
 arch/arm/dts/mt7622.dtsi    | 45 +++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+)

diff --git a/arch/arm/dts/mt7622-rfb.dts b/arch/arm/dts/mt7622-rfb.dts
index ec30f5c6eb..f05c3fe14d 100644
--- a/arch/arm/dts/mt7622-rfb.dts
+++ b/arch/arm/dts/mt7622-rfb.dts
@@ -178,3 +178,16 @@
 	pinctrl-0 = <&watchdog_pins>;
 	status = "okay";
 };
+
+&eth {
+	status = "okay";
+	mediatek,gmac-id = <0>;
+	phy-mode = "sgmii";
+	mediatek,switch = "mt7531";
+	reset-gpios = <&gpio 54 GPIO_ACTIVE_HIGH>;
+
+	fixed-link {
+		speed = <1000>;
+		full-duplex;
+	};
+};
diff --git a/arch/arm/dts/mt7622.dtsi b/arch/arm/dts/mt7622.dtsi
index 7dcca5c6af..1e8ec9b48b 100644
--- a/arch/arm/dts/mt7622.dtsi
+++ b/arch/arm/dts/mt7622.dtsi
@@ -7,6 +7,9 @@
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/clock/mt7622-clk.h>
+#include <dt-bindings/power/mt7629-power.h>
+#include <dt-bindings/reset/mt7629-reset.h>
+#include <dt-bindings/gpio/gpio.h>
 
 / {
 	compatible = "mediatek,mt7622";
@@ -182,4 +185,46 @@
 		clock-names = "source", "hclk";
 		status = "disabled";
 	};
+
+	ethsys: syscon at 1b000000 {
+		compatible = "mediatek,mt7622-ethsys", "syscon";
+		reg = <0x1b000000 0x1000>;
+		#clock-cells = <1>;
+		#reset-cells = <1>;
+	};
+
+	eth: ethernet at 1b100000 {
+		compatible = "mediatek,mt7622-eth", "syscon";
+		reg = <0x1b100000 0x20000>;
+		clocks = <&topckgen CLK_TOP_ETH_SEL>,
+			 <&ethsys CLK_ETH_ESW_EN>,
+			 <&ethsys CLK_ETH_GP0_EN>,
+			 <&ethsys CLK_ETH_GP1_EN>,
+			 <&ethsys CLK_ETH_GP2_EN>,
+			 <&sgmiisys CLK_SGMII_TX250M_EN>,
+			 <&sgmiisys CLK_SGMII_RX250M_EN>,
+			 <&sgmiisys CLK_SGMII_CDR_REF>,
+			 <&sgmiisys CLK_SGMII_CDR_FB>,
+			 <&topckgen CLK_TOP_SGMIIPLL>,
+			 <&apmixedsys CLK_APMIXED_ETH2PLL>;
+		clock-names = "ethif", "esw", "gp0", "gp1", "gp2",
+			      "sgmii_tx250m", "sgmii_rx250m",
+			      "sgmii_cdr_ref", "sgmii_cdr_fb", "sgmii_ck",
+			      "eth2pll";
+		power-domains = <&scpsys MT7629_POWER_DOMAIN_ETHSYS>;
+		resets = <&ethsys ETHSYS_FE_RST>;
+		reset-names = "fe";
+		mediatek,ethsys = <&ethsys>;
+		mediatek,sgmiisys = <&sgmiisys>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		status = "disabled";
+	};
+
+	sgmiisys: sgmiisys at 1b128000 {
+		compatible = "mediatek,mt7622-sgmiisys", "syscon";
+		reg = <0x1b128000 0x3000>;
+		#clock-cells = <1>;
+	};
+
 };
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [U-boot,4/4] configs: mediatek: enable mt7622 ethernet support
  2020-01-21 11:31 [U-boot,0/4] Add ethernet support for MT7622 MarkLee
                   ` (2 preceding siblings ...)
  2020-01-21 11:31 ` [U-boot, 3/4] arm: dts: mediatek: add ethernet and sgmii dts node for mt7622 MarkLee
@ 2020-01-21 11:32 ` MarkLee
  2020-01-27 18:49   ` Tom Rini
  2020-02-08  0:06   ` Tom Rini
  2020-01-21 12:53 ` Aw: [U-boot,0/4] Add ethernet support for MT7622 Frank Wunderlich
  4 siblings, 2 replies; 14+ messages in thread
From: MarkLee @ 2020-01-21 11:32 UTC (permalink / raw)
  To: u-boot

This patch enable mt7622 ethernet support in its defconfig

Signed-off-by: MarkLee <Mark-MC.Lee@mediatek.com>
---
 configs/mt7622_rfb_defconfig | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/configs/mt7622_rfb_defconfig b/configs/mt7622_rfb_defconfig
index e1917e70e7..806087a3d6 100644
--- a/configs/mt7622_rfb_defconfig
+++ b/configs/mt7622_rfb_defconfig
@@ -34,6 +34,10 @@ CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_DM_ETH=y
+CONFIG_PHY_FIXED=y
+CONFIG_MEDIATEK_ETH=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_CMD_PING=y
 CONFIG_PINCTRL=y
 CONFIG_PINCONF=y
 CONFIG_PINCTRL_MT7622=y
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Aw: [U-boot,0/4] Add ethernet support for MT7622
  2020-01-21 11:31 [U-boot,0/4] Add ethernet support for MT7622 MarkLee
                   ` (3 preceding siblings ...)
  2020-01-21 11:32 ` [U-boot,4/4] configs: mediatek: enable mt7622 ethernet support MarkLee
@ 2020-01-21 12:53 ` Frank Wunderlich
  2020-01-22  8:43   ` mtk15127
  4 siblings, 1 reply; 14+ messages in thread
From: Frank Wunderlich @ 2020-01-21 12:53 UTC (permalink / raw)
  To: u-boot

Hi Mark,

does it depend on another patch(set)?

i got unsupported switch, because in eth-driver [1] there is a check only for mt7530 (else print this error) and in dts [2], mediatek,switch is set to mt7531 (which is right, but trigger the error).

i found no patch adding check for mt7531 (or change this check) in patchwork

[1] https://github.com/frank-w/u-boot/blob/aed9e2af65651d036d742b30f8b4ce2d5f4d215a/drivers/net/mtk_eth.c#L1162
[2] https://github.com/frank-w/u-boot/blob/29464fe9546c83ad34fdcc395f6e45a9a8538631/arch/arm/dts/mt7622-rfb.dts#L186

regards Frank

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Aw: [U-boot,0/4] Add ethernet support for MT7622
  2020-01-21 12:53 ` Aw: [U-boot,0/4] Add ethernet support for MT7622 Frank Wunderlich
@ 2020-01-22  8:43   ` mtk15127
  2020-01-26 11:53     ` Aw: " Frank Wunderlich
  0 siblings, 1 reply; 14+ messages in thread
From: mtk15127 @ 2020-01-22  8:43 UTC (permalink / raw)
  To: u-boot

On Tue, 2020-01-21 at 13:53 +0100, Frank Wunderlich wrote:
> Hi Mark,
> 
> does it depend on another patch(set)?
> 
> i got unsupported switch, because in eth-driver [1] there is a check only for mt7530 (else print this error) and in dts [2], mediatek,switch is set to mt7531 (which is right, but trigger the error).
> 
> i found no patch adding check for mt7531 (or change this check) in patchwork
> 
> [1] https://github.com/frank-w/u-boot/blob/aed9e2af65651d036d742b30f8b4ce2d5f4d215a/drivers/net/mtk_eth.c#L1162
> [2] https://github.com/frank-w/u-boot/blob/29464fe9546c83ad34fdcc395f6e45a9a8538631/arch/arm/dts/mt7622-rfb.dts#L186
> 
> regards Frank

Hi Frank :
  This patches set just focus on adding mt7622 into mtk eth MAC driver
with sgmii support, and yes for some mt7622 product(bpi-r64..etc) that
has a internal switch(mt7531) still need patches to support mt7531 to
make networking function work fully. 
  
  We do have plan to send a separate patches for mt7531 switch once this
mt7622 eth patch set accepted by uBoot. Thanks to you put a big
spotlight on mt7622 development, we will do it asap.
  
Mark

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Aw: Re:  [U-boot,0/4] Add ethernet support for MT7622
  2020-01-22  8:43   ` mtk15127
@ 2020-01-26 11:53     ` Frank Wunderlich
  0 siblings, 0 replies; 14+ messages in thread
From: Frank Wunderlich @ 2020-01-26 11:53 UTC (permalink / raw)
  To: u-boot

Hi

> Gesendet: Mittwoch, 22. Januar 2020 um 09:43 Uhr
> Von: "mtk15127" <Mark-MC.Lee@mediatek.com>

>   This patches set just focus on adding mt7622 into mtk eth MAC driver
> with sgmii support, and yes for some mt7622 product(bpi-r64..etc) that
> has a internal switch(mt7531) still need patches to support mt7531 to
> make networking function work fully.

i wondered about changes in ref-board dts. does it contain also mt7531 as switch?
imho we need an extra dts for bpi-r64 because ram is different (1G instead of 256M) and
for future changes which are only for r64.

> We do have plan to send a separate patches for mt7531 switch once this
> mt7622 eth patch set accepted by uBoot.

@tom is this Patchset ok or does it need any changes? any way to merge it in actual merge-window,
so mark can work on switch-part?

@Mark, is there any pre-release of switch-driver that i can try before you post to mailinglist?

regards Frank

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-boot,4/4] configs: mediatek: enable mt7622 ethernet support
  2020-01-21 11:32 ` [U-boot,4/4] configs: mediatek: enable mt7622 ethernet support MarkLee
@ 2020-01-27 18:49   ` Tom Rini
  2020-01-28 12:03     ` Aw: " Frank Wunderlich
  2020-02-08  0:06   ` Tom Rini
  1 sibling, 1 reply; 14+ messages in thread
From: Tom Rini @ 2020-01-27 18:49 UTC (permalink / raw)
  To: u-boot

On Tue, Jan 21, 2020 at 07:32:00PM +0800, MarkLee wrote:

> This patch enable mt7622 ethernet support in its defconfig
> 
> Signed-off-by: MarkLee <Mark-MC.Lee@mediatek.com>
> ---
>  configs/mt7622_rfb_defconfig | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/configs/mt7622_rfb_defconfig b/configs/mt7622_rfb_defconfig
> index e1917e70e7..806087a3d6 100644
> --- a/configs/mt7622_rfb_defconfig
> +++ b/configs/mt7622_rfb_defconfig
> @@ -34,6 +34,10 @@ CONFIG_SPI_FLASH_SPANSION=y
>  CONFIG_SPI_FLASH_STMICRO=y
>  CONFIG_SPI_FLASH_WINBOND=y
>  CONFIG_DM_ETH=y
> +CONFIG_PHY_FIXED=y
> +CONFIG_MEDIATEK_ETH=y
> +CONFIG_NET_RANDOM_ETHADDR=y
> +CONFIG_CMD_PING=y
>  CONFIG_PINCTRL=y
>  CONFIG_PINCONF=y
>  CONFIG_PINCTRL_MT7622=y

This leads to warnings in the ethernet driver:
drivers/net/mtk_eth.c: In function 'mtk_eth_fifo_init':
drivers/net/mtk_eth.c:856:21: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  flush_dcache_range((u32)pkt_base, (u32)(pkt_base + TOTAL_PKT_BUF_SIZE));
                     ^
drivers/net/mtk_eth.c:856:36: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
                                    ^
drivers/net/mtk_eth.c: In function 'mtk_eth_send':
drivers/net/mtk_eth.c:968:21: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  flush_dcache_range((u32)pkt_base, (u32)pkt_base +
drivers/net/mtk_eth.c:968:36: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
drivers/net/mtk_eth.c: In function 'mtk_eth_recv':
drivers/net/mtk_eth.c:994:26: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  invalidate_dcache_range((u32)pkt_base, (u32)pkt_base +
                          ^
drivers/net/mtk_eth.c:994:41: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
                                         ^
drivers/net/mtk_eth.c: In function 'mtk_eth_probe':
drivers/net/mtk_eth.c:1026:18: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
  priv->fe_base = (void *)iobase;
                  ^
drivers/net/mtk_eth.c:1029:20: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
  priv->gmac_base = (void *)(iobase + GMAC_BASE);

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200127/9bf5dc26/attachment.sig>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Aw: Re: [U-boot,4/4] configs: mediatek: enable mt7622 ethernet support
  2020-01-27 18:49   ` Tom Rini
@ 2020-01-28 12:03     ` Frank Wunderlich
  0 siblings, 0 replies; 14+ messages in thread
From: Frank Wunderlich @ 2020-01-28 12:03 UTC (permalink / raw)
  To: u-boot

Hi tom,

thanks for testing

imho the first 3 can be fixed by this:

diff --git a/drivers/net/mtk_eth.c b/drivers/net/mtk_eth.c
index 6cffc3f32a..d13020a624 100644
--- a/drivers/net/mtk_eth.c
+++ b/drivers/net/mtk_eth.c
@@ -853,7 +853,7 @@ static void mtk_eth_fifo_init(struct mtk_eth_priv *priv)
        memset(priv->rx_ring_noc, 0, NUM_RX_DESC * sizeof(struct pdma_rxdesc));
        memset(priv->pkt_pool, 0, TOTAL_PKT_BUF_SIZE);

-       flush_dcache_range((u32)pkt_base, (u32)(pkt_base + TOTAL_PKT_BUF_SIZE));
+       flush_dcache_range((int)pkt_base, (int)(pkt_base + TOTAL_PKT_BUF_SIZE));

        priv->rx_dma_owner_idx0 = 0;
        priv->tx_cpu_owner_idx0 = 0;
@@ -965,7 +965,7 @@ static int mtk_eth_send(struct udevice *dev, void *packet, int length)

        pkt_base = (void *)phys_to_virt(priv->tx_ring_noc[idx].txd_info1.SDP0);
        memcpy(pkt_base, packet, length);
-       flush_dcache_range((u32)pkt_base, (u32)pkt_base +
+       flush_dcache_range((int)pkt_base, (int)pkt_base +
                           roundup(length, ARCH_DMA_MINALIGN));

        priv->tx_ring_noc[idx].txd_info2.SDL0 = length;
@@ -991,8 +991,8 @@ static int mtk_eth_recv(struct udevice *dev, int flags, uchar **packetp)

        length = priv->rx_ring_noc[idx].rxd_info2.PLEN0;
        pkt_base = (void *)phys_to_virt(priv->rx_ring_noc[idx].rxd_info1.PDP0);
-       invalidate_dcache_range((u32)pkt_base, (u32)pkt_base +
-                               roundup(length, ARCH_DMA_MINALIGN));
+       invalidate_dcache_range((int)pkt_base, (unsigned int)(pkt_base +
+                               roundup(length, ARCH_DMA_MINALIGN)));

        if (packetp)
                *packetp = pkt_base;

did not get the last 2 (after fixing the first 3)...

i can send full patch if it's ok

regards Frank


> Gesendet: Montag, 27. Januar 2020 um 19:49 Uhr
> Von: "Tom Rini" <trini@konsulko.com>
> An: MarkLee <Mark-MC.Lee@mediatek.com>
> Cc: "Albert Aribaud" <albert.u.boot@aribaud.net>, "Ryder Lee" <ryder.lee@mediatek.com>, "Steven Liu" <steven.liu@mediatek.com>, "Joe Hershberger" <joe.hershberger@ni.com>, u-boot at lists.denx.de, GSS_MTK_Uboot_upstream <GSS_MTK_Uboot_upstream@mediatek.com>
> Betreff: Re: [U-boot,4/4] configs: mediatek: enable mt7622 ethernet support
>
> On Tue, Jan 21, 2020 at 07:32:00PM +0800, MarkLee wrote:
>
> > This patch enable mt7622 ethernet support in its defconfig
> >
> > Signed-off-by: MarkLee <Mark-MC.Lee@mediatek.com>
> > ---
> >  configs/mt7622_rfb_defconfig | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/configs/mt7622_rfb_defconfig b/configs/mt7622_rfb_defconfig
> > index e1917e70e7..806087a3d6 100644
> > --- a/configs/mt7622_rfb_defconfig
> > +++ b/configs/mt7622_rfb_defconfig
> > @@ -34,6 +34,10 @@ CONFIG_SPI_FLASH_SPANSION=y
> >  CONFIG_SPI_FLASH_STMICRO=y
> >  CONFIG_SPI_FLASH_WINBOND=y
> >  CONFIG_DM_ETH=y
> > +CONFIG_PHY_FIXED=y
> > +CONFIG_MEDIATEK_ETH=y
> > +CONFIG_NET_RANDOM_ETHADDR=y
> > +CONFIG_CMD_PING=y
> >  CONFIG_PINCTRL=y
> >  CONFIG_PINCONF=y
> >  CONFIG_PINCTRL_MT7622=y
>
> This leads to warnings in the ethernet driver:
> drivers/net/mtk_eth.c: In function 'mtk_eth_fifo_init':
> drivers/net/mtk_eth.c:856:21: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>   flush_dcache_range((u32)pkt_base, (u32)(pkt_base + TOTAL_PKT_BUF_SIZE));
>                      ^
> drivers/net/mtk_eth.c:856:36: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>                                     ^
> drivers/net/mtk_eth.c: In function 'mtk_eth_send':
> drivers/net/mtk_eth.c:968:21: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>   flush_dcache_range((u32)pkt_base, (u32)pkt_base +
> drivers/net/mtk_eth.c:968:36: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
> drivers/net/mtk_eth.c: In function 'mtk_eth_recv':
> drivers/net/mtk_eth.c:994:26: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>   invalidate_dcache_range((u32)pkt_base, (u32)pkt_base +
>                           ^
> drivers/net/mtk_eth.c:994:41: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>                                          ^
> drivers/net/mtk_eth.c: In function 'mtk_eth_probe':
> drivers/net/mtk_eth.c:1026:18: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>   priv->fe_base = (void *)iobase;
>                   ^
> drivers/net/mtk_eth.c:1029:20: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>   priv->gmac_base = (void *)(iobase + GMAC_BASE);
>
> --
> Tom
>

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [U-boot, 1/4] eth: mtk-eth: add sgmii mode support in mediatek eth driver
  2020-01-21 11:31 ` [U-boot, 1/4] eth: mtk-eth: add sgmii mode support in mediatek eth driver MarkLee
@ 2020-02-08  0:06   ` Tom Rini
  0 siblings, 0 replies; 14+ messages in thread
From: Tom Rini @ 2020-02-08  0:06 UTC (permalink / raw)
  To: u-boot

On Tue, Jan 21, 2020 at 07:31:57PM +0800, MarkLee wrote:

> This patch add sgmii init part for the mediatek SoC that
> support sgmii mode. It is a must for mt7622.
> 
> Signed-off-by: MarkLee <Mark-MC.Lee@mediatek.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200207/56925056/attachment.sig>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-boot, 2/4] eth: mtk-eth: add mt7622 support in mediatek eth driver
  2020-01-21 11:31 ` [U-boot,2/4] eth: mtk-eth: add mt7622 " MarkLee
@ 2020-02-08  0:06   ` Tom Rini
  0 siblings, 0 replies; 14+ messages in thread
From: Tom Rini @ 2020-02-08  0:06 UTC (permalink / raw)
  To: u-boot

On Tue, Jan 21, 2020 at 07:31:58PM +0800, MarkLee wrote:

> This patch add mt7622 support in mediatek eth driver
> 
> Signed-off-by: MarkLee <Mark-MC.Lee@mediatek.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200207/1bee8d71/attachment.sig>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-boot, 3/4] arm: dts: mediatek: add ethernet and sgmii dts node for mt7622
  2020-01-21 11:31 ` [U-boot, 3/4] arm: dts: mediatek: add ethernet and sgmii dts node for mt7622 MarkLee
@ 2020-02-08  0:06   ` Tom Rini
  0 siblings, 0 replies; 14+ messages in thread
From: Tom Rini @ 2020-02-08  0:06 UTC (permalink / raw)
  To: u-boot

On Tue, Jan 21, 2020 at 07:31:59PM +0800, MarkLee wrote:

> This patch add eth and sgmii dts node for mt7622 to support ethernet
> 
> Signed-off-by: MarkLee <Mark-MC.Lee@mediatek.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200207/5eea21b4/attachment.sig>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-boot,4/4] configs: mediatek: enable mt7622 ethernet support
  2020-01-21 11:32 ` [U-boot,4/4] configs: mediatek: enable mt7622 ethernet support MarkLee
  2020-01-27 18:49   ` Tom Rini
@ 2020-02-08  0:06   ` Tom Rini
  1 sibling, 0 replies; 14+ messages in thread
From: Tom Rini @ 2020-02-08  0:06 UTC (permalink / raw)
  To: u-boot

On Tue, Jan 21, 2020 at 07:32:00PM +0800, MarkLee wrote:

> This patch enable mt7622 ethernet support in its defconfig
> 
> Signed-off-by: MarkLee <Mark-MC.Lee@mediatek.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200207/37773e3c/attachment.sig>

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-02-08  0:06 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-21 11:31 [U-boot,0/4] Add ethernet support for MT7622 MarkLee
2020-01-21 11:31 ` [U-boot, 1/4] eth: mtk-eth: add sgmii mode support in mediatek eth driver MarkLee
2020-02-08  0:06   ` Tom Rini
2020-01-21 11:31 ` [U-boot,2/4] eth: mtk-eth: add mt7622 " MarkLee
2020-02-08  0:06   ` [U-boot, 2/4] " Tom Rini
2020-01-21 11:31 ` [U-boot, 3/4] arm: dts: mediatek: add ethernet and sgmii dts node for mt7622 MarkLee
2020-02-08  0:06   ` Tom Rini
2020-01-21 11:32 ` [U-boot,4/4] configs: mediatek: enable mt7622 ethernet support MarkLee
2020-01-27 18:49   ` Tom Rini
2020-01-28 12:03     ` Aw: " Frank Wunderlich
2020-02-08  0:06   ` Tom Rini
2020-01-21 12:53 ` Aw: [U-boot,0/4] Add ethernet support for MT7622 Frank Wunderlich
2020-01-22  8:43   ` mtk15127
2020-01-26 11:53     ` Aw: " Frank Wunderlich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.