Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 39181EB64D9 for ; Thu, 15 Jun 2023 09:37:15 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8D5FA86287; Thu, 15 Jun 2023 11:37:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=starfivetech.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 5FA1A862AA; Thu, 15 Jun 2023 11:37:09 +0200 (CEST) Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by phobos.denx.de (Postfix) with ESMTP id 8408285F4F for ; Thu, 15 Jun 2023 11:37:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=starfivetech.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=yanhong.wang@starfivetech.com Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id ED37D24E20C; Thu, 15 Jun 2023 17:36:58 +0800 (CST) Received: from EXMBX073.cuchost.com (172.16.6.83) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 15 Jun 2023 17:36:58 +0800 Received: from wyh-VirtualBox.starfivetech.com (171.223.208.138) by EXMBX073.cuchost.com (172.16.6.83) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 15 Jun 2023 17:36:57 +0800 From: Yanhong Wang To: , Rick Chen , Leo , Joe Hershberger , "Ramon Fried" CC: Yanhong Wang , Torsten Duwe , Leyfoon Tan , "samin . guo" , Walker Chen , "Hal Feng" Subject: [PATCH v5 00/11] Add ethernet driver for StarFive JH7110 SoC Date: Thu, 15 Jun 2023 17:36:41 +0800 Message-ID: <20230615093652.23161-1-yanhong.wang@starfivetech.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Originating-IP: [171.223.208.138] X-ClientProxiedBy: EXCAS064.cuchost.com (172.16.6.24) To EXMBX073.cuchost.com (172.16.6.83) X-YovoleRuleAgent: yovoleflag Content-Transfer-Encoding: quoted-printable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean This series of patches base on the latest branch/master,and adds ethernet support for the StarFive JH7110 RISC-V SoC. The series includes EEPROM, PHY and MAC drivers. The PHY model is YT8531 (from Motorcomm Inc), and the MAC version is dwmac-5.20 (from Synopsys DesignWare).=20 The implementation of the phy driver is ported from linux, but it has been adjusted for the u-boot framework. EEPROM stores board-related information, such as DDR capacity,=20 PCB version, MAC address, etc. The main difference between StarFive VisionFive 2 1.2A and 1.3B is=20 gmac, but the difference in gmac is not defined in DT, but reads the=20 PCB version from EEPROM, and then dynamically configures the difference of gmac according to different PCB versions, which is compatible=20 with 1.2A and 1.3B versions, which is more user-friendly. The PHY and MAC driver has been tested on the StarFive VisionFive 2 1.2A and 1.3B boards and works normally. For more information and support,you can visit RVspace wiki[1].=09 [1] https://wiki.rvspace.org/ v5: - Reorder a series of patches to make each patch is independent. - Move CONFIG_DEFAULT_FDT_FILE and CONFIG_DEFAULT_DEVICE_TREE changes to = patch 4. - Move the definition of 'board_fdt_blob_setup' to patch 9. v4: - Reworded the definition of the 'pbuf' variable in visionfive2-i2c-eepro= m.c=20 from a const pointer to const union.=20 - Added the section (".data") attribute to the 'pbuf' and 'has_been_read'= global=20 variables in visionfive2-i2-eeprom.c. v3: - Added EEPROM support. - Combine the board device tree of 1.2A and 1.3B into one. - Removed the delay configuration of gmac phy clock from DT. - Dynamically configure gmac differences of 1.2A and 1.3B to DT according= to the PCB version. - DDR capacity information is read from EEPROM first, if not, it is defin= ed by default in DT. v2: - Reworded the phy driver. Added platform private data struct to save the= =20 configuration data read from dts. - Reworded the MAC driver. Added platform private data struct to save the= =20 configuration data read from dts. Previous versions: v1 - https://patchwork.ozlabs.org/project/uboot/cover/20230317010536.1786= 0-1-yanhong.wang@starfivetech.com/ v2 - https://patchwork.ozlabs.org/project/uboot/cover/20230329102720.2543= 9-1-yanhong.wang@starfivetech.com/ v3 - https://patchwork.ozlabs.org/project/uboot/cover/20230428022515.2939= 3-1-yanhong.wang@starfivetech.com/ v4 - https://patchwork.ozlabs.org/project/uboot/cover/20230525093637.3136= 4-1-yanhong.wang@starfivetech.com/ Yanhong Wang (11): net: phy: Add driver for Motorcomm yt8531 gigabit ethernet phy net: dwc_eth_qos: Add StarFive ethernet driver glue layer riscv: dts: jh7110: Add ethernet device tree nodes riscv: dts: jh7110: Combine the board device tree files of 1.2A and 1.3B doc: board: starfive:=E3=80=80Reword the make defconfig information configs: starfive: Enable ethernet configuration for StarFive VisionFive2 eeprom: starfive: Enable ID EEPROM configuration riscv: dts: starfive: Add support eeprom device tree node configs: starfive: Enable ID EEPROM configuration ram: starfive: Read memory size information from EEPROM board: starfive: Dynamic configuration of DT for 1.2A and 1.3B arch/riscv/cpu/jh7110/spl.c | 32 +- arch/riscv/dts/Makefile | 3 +- ... jh7110-starfive-visionfive-2-u-boot.dtsi} | 39 +- .../jh7110-starfive-visionfive-2-v1.2a.dts | 12 - ...10-starfive-visionfive-2-v1.3b-u-boot.dtsi | 69 --- ...b.dts =3D> jh7110-starfive-visionfive-2.dts} | 3 +- .../dts/jh7110-starfive-visionfive-2.dtsi | 40 ++ arch/riscv/dts/jh7110.dtsi | 69 +++ arch/riscv/include/asm/arch-jh7110/eeprom.h | 13 + board/starfive/visionfive2/Makefile | 1 + board/starfive/visionfive2/spl.c | 157 +++++ .../visionfive2/starfive_visionfive2.c | 13 + .../visionfive2/visionfive2-i2c-eeprom.c | 561 ++++++++++++++++++ configs/starfive_visionfive2_defconfig | 32 +- doc/board/starfive/visionfive2.rst | 6 +- drivers/net/Kconfig | 7 + drivers/net/Makefile | 1 + drivers/net/dwc_eth_qos.c | 6 + drivers/net/dwc_eth_qos.h | 1 + drivers/net/dwc_eth_qos_starfive.c | 249 ++++++++ drivers/net/phy/Kconfig | 6 + drivers/net/phy/Makefile | 1 + drivers/net/phy/motorcomm.c | 437 ++++++++++++++ drivers/ram/starfive/starfive_ddr.c | 2 - 24 files changed, 1665 insertions(+), 95 deletions(-) rename arch/riscv/dts/{jh7110-starfive-visionfive-2-v1.2a-u-boot.dtsi =3D= > jh7110-starfive-visionfive-2-u-boot.dtsi} (58%) delete mode 100644 arch/riscv/dts/jh7110-starfive-visionfive-2-v1.2a.dts delete mode 100644 arch/riscv/dts/jh7110-starfive-visionfive-2-v1.3b-u-b= oot.dtsi rename arch/riscv/dts/{jh7110-starfive-visionfive-2-v1.3b.dts =3D> jh711= 0-starfive-visionfive-2.dts} (65%) create mode 100644 arch/riscv/include/asm/arch-jh7110/eeprom.h create mode 100644 board/starfive/visionfive2/visionfive2-i2c-eeprom.c create mode 100644 drivers/net/dwc_eth_qos_starfive.c create mode 100644 drivers/net/phy/motorcomm.c base-commit: 19b77d3d23966a0d6dbb3c86187765f11100fb6f --=20 2.17.1