Skip to contentSkip to conversation

Add FU740 chip and HiFive Unmatched board support

PATCH Superseded Green Wan 3 participants 15 messages Mar 16, 2021 – Mar 18, 2021

Subsystems (7)

v2 of 12 Superseded Latest is v12 →

lore
Share & tools
lore

Green Wan

author
#0 lore raw

v2 cover Add FU740 chip and HiFive Unmatched board support

This patch set is to add SiFive fu740 chip and HiFive Unmatched board support. Patches are split into several parts:

- [PATCH 1/8] dts for fu740
- [PATCH 2/8] support for fu740 cpu
- [PATCH 3/8- 5/8] support for fu740 clk and ram
- [PATCH 6/8] add pcie driver
- [PATCH 7/8] add unmatched board
- [PATCH 8/8] add fu740 support to macb driver

Description

- For fu740 cpu support, reuse most of fu540 cpu.
- For prci driver, add one abstract layer to separate fu540 and fu740. Move orignal fu540 code to separate files.
- For pcie driver, it depends on gpio, prci, clk and reset drivers to do init&reset works.
- Align with Linux DT file.

Tests and patch checks

- Able to boot both unmatched and unleashed boards.
- PCIe tests
. M.2 NVMe SSD
. e1000 compatibale ethernet adapter (ping&tftpboot) . pci-to-usb adapter(usb mass storage)
- checkpatch is performed. To keep code derived from other boards the same, ignore some warnings/errors in [PATCH 7/8].

Changlogs
- V2
. Rebase to unleashed rename patch
. remove unnessaary fu540 changes
. split ram driver patch into 2 to keep 'git mv' info . use a shorter name for unmatched support
. Remove redundant&incorrect temperature-sensor in DT . Remove unnecessary USB EHCI & OHCI from defconfig . Revised fu740 doc
. Fixed year of copyright
. Add reviewed-by received in v1 patch

David Abdurachmanov (1):
drivers: net: macb: add fu740 support

Green Wan (7):
riscv: dts: add fu740 support
riscv: cpu: fu740: Add support for cpu fu740
drivers: clk: add fu740 support
drivers: ram: sifive: rename fu540_ddr to sifive_ddr
drivers: ram: add fu740 support
drivers: pci: add pcie support for fu740
board: sifive: add HiFive Unmatched board support

 arch/riscv/Kconfig                                 |    5 +
 arch/riscv/cpu/fu740/Kconfig                       |   37 +
 arch/riscv/cpu/fu740/Makefile                      |   12 +
 arch/riscv/cpu/fu740/cache.c                       |   55 +
 arch/riscv/cpu/fu740/cpu.c                         |   22 +
 arch/riscv/cpu/fu740/dram.c                        |   38 +
 arch/riscv/cpu/fu740/spl.c                         |   23 +
 arch/riscv/dts/Makefile                            |    1 +
 arch/riscv/dts/fu740-c000-u-boot.dtsi              |  105 ++
 arch/riscv/dts/fu740-c000.dtsi                     |  329 +++++
 arch/riscv/dts/fu740-hifive-unmatched-a00-ddr.dtsi | 1489 ++++++++++++++++++++
 arch/riscv/dts/hifive-unmatched-a00-u-boot.dtsi    |   40 +
 arch/riscv/dts/hifive-unmatched-a00.dts            |  253 ++++
 arch/riscv/include/asm/arch-fu740/cache.h          |   14 +
 arch/riscv/include/asm/arch-fu740/clk.h            |   14 +
 arch/riscv/include/asm/arch-fu740/gpio.h           |   38 +
 arch/riscv/include/asm/arch-fu740/reset.h          |   13 +
 arch/riscv/include/asm/arch-fu740/spl.h            |   14 +
 arch/riscv/lib/sifive_clint.c                      |    1 -
 board/sifive/unmatched/Kconfig                     |   50 +
 board/sifive/unmatched/MAINTAINERS                 |    9 +
 board/sifive/unmatched/Makefile                    |    9 +
 board/sifive/unmatched/hifive-unmatched-fu740.c    |   24 +
 board/sifive/unmatched/spl.c                       |   85 ++
 common/spl/Kconfig                                 |    4 +-
 configs/sifive_unmatched_defconfig                 |   53 +
 doc/board/sifive/hifive_unmatched_fu740.rst        |  536 +++++++
 drivers/clk/sifive/Kconfig                         |    8 +-
 drivers/clk/sifive/Makefile                        |    4 +-
 drivers/clk/sifive/fu540-prci.c                    |  769 +---------
 drivers/clk/sifive/fu540-prci.h                    |   22 +
 drivers/clk/sifive/fu740-prci.c                    |  158 +++
 drivers/clk/sifive/fu740-prci.h                    |   22 +
 drivers/clk/sifive/sifive-prci.c                   |  733 ++++++++++
 drivers/clk/sifive/sifive-prci.h                   |  323 +++++
 drivers/net/macb.c                                 |    8 +-
 drivers/pci/Kconfig                                |    9 +
 drivers/pci/Makefile                               |    1 +
 drivers/pci/pcie_sifive.c                          |  797 +++++++++++
 drivers/pci/pcie_sifive.h                          |  374 +++++
 drivers/ram/sifive/Kconfig                         |    8 +-
 drivers/ram/sifive/Makefile                        |    2 +-
 drivers/ram/sifive/fu540_ddr.c                     |  410 ------
 drivers/ram/sifive/sifive_ddr.c                    |  410 ++++++
 drivers/reset/Kconfig                              |    2 +-
 include/configs/sifive-unmatched.h                 |   85 ++
 include/dt-bindings/clock/sifive-fu740-prci.h      |   25 +
 include/dt-bindings/reset/sifive-fu740-prci.h      |   19 +
 48 files changed, 6289 insertions(+), 1173 deletions(-)
 create mode 100644 arch/riscv/cpu/fu740/Kconfig
 create mode 100644 arch/riscv/cpu/fu740/Makefile
 create mode 100644 arch/riscv/cpu/fu740/cache.c
 create mode 100644 arch/riscv/cpu/fu740/cpu.c
 create mode 100644 arch/riscv/cpu/fu740/dram.c
 create mode 100644 arch/riscv/cpu/fu740/spl.c
 create mode 100644 arch/riscv/dts/fu740-c000-u-boot.dtsi
 create mode 100644 arch/riscv/dts/fu740-c000.dtsi
 create mode 100644 arch/riscv/dts/fu740-hifive-unmatched-a00-ddr.dtsi
 create mode 100644 arch/riscv/dts/hifive-unmatched-a00-u-boot.dtsi
 create mode 100644 arch/riscv/dts/hifive-unmatched-a00.dts
 create mode 100644 arch/riscv/include/asm/arch-fu740/cache.h
 create mode 100644 arch/riscv/include/asm/arch-fu740/clk.h
 create mode 100644 arch/riscv/include/asm/arch-fu740/gpio.h
 create mode 100644 arch/riscv/include/asm/arch-fu740/reset.h
 create mode 100644 arch/riscv/include/asm/arch-fu740/spl.h
 create mode 100644 board/sifive/unmatched/Kconfig
 create mode 100644 board/sifive/unmatched/MAINTAINERS
 create mode 100644 board/sifive/unmatched/Makefile
 create mode 100644 board/sifive/unmatched/hifive-unmatched-fu740.c
 create mode 100644 board/sifive/unmatched/spl.c
 create mode 100644 configs/sifive_unmatched_defconfig
 create mode 100644 doc/board/sifive/hifive_unmatched_fu740.rst
 create mode 100644 drivers/clk/sifive/fu540-prci.h
 create mode 100644 drivers/clk/sifive/fu740-prci.c
 create mode 100644 drivers/clk/sifive/fu740-prci.h
 create mode 100644 drivers/clk/sifive/sifive-prci.c
 create mode 100644 drivers/clk/sifive/sifive-prci.h
 create mode 100644 drivers/pci/pcie_sifive.c
 create mode 100644 drivers/pci/pcie_sifive.h
 delete mode 100644 drivers/ram/sifive/fu540_ddr.c
 create mode 100644 drivers/ram/sifive/sifive_ddr.c
 create mode 100644 include/configs/sifive-unmatched.h
 create mode 100644 include/dt-bindings/clock/sifive-fu740-prci.h
 create mode 100644 include/dt-bindings/reset/sifive-fu740-prci.h
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v2 1/8 riscv: dts: add fu740 support

Add dts support for fu740. The HiFive Unmatched support is based on fu740 cpu and drivers in following patch set.

---
 arch/riscv/dts/Makefile                       |   1 +
 arch/riscv/dts/fu740-c000-u-boot.dtsi         | 105 ++++++++
 arch/riscv/dts/fu740-c000.dtsi                | 329 ++++++++++++++++++++++++++
 include/dt-bindings/clock/sifive-fu740-prci.h |  25 ++
 include/dt-bindings/reset/sifive-fu740-prci.h |  19 ++
 5 files changed, 479 insertions(+)
 create mode 100644 arch/riscv/dts/fu740-c000-u-boot.dtsi
 create mode 100644 arch/riscv/dts/fu740-c000.dtsi
 create mode 100644 include/dt-bindings/clock/sifive-fu740-prci.h
 create mode 100644 include/dt-bindings/reset/sifive-fu740-prci.h
arch/riscv/dts/Makefile +1 -0
index 8138d89..ed32f56 100644
@@ -2,6 +2,7 @@
 
 dtb-$(CONFIG_TARGET_AX25_AE350) += ae350_32.dtb ae350_64.dtb
 dtb-$(CONFIG_TARGET_SIFIVE_UNLEASHED) += hifive-unleashed-a00.dtb
+dtb-$(CONFIG_TARGET_SIFIVE_UNMATCHED) += hifive-unmatched-a00.dtb
 dtb-$(CONFIG_TARGET_SIPEED_MAIX) += k210-maix-bit.dtb
 dtb-$(CONFIG_TARGET_MICROCHIP_ICICLE) += microchip-mpfs-icicle-kit.dtb
 
arch/riscv/dts/fu740-c000-u-boot.dtsi new file +105 -0

105 lines not on this page · raw message

arch/riscv/dts/fu740-c000.dtsi new file +329 -0

329 lines not on this page · raw message

include/dt-bindings/clock/sifive-fu740-prci.h new file +25 -0
new file mode 100644
index 0000000..c122478
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
+/*
+ * Copyright (C) 2020-2021 SiFive, Inc.
+ * Wesley Terpstra
+ * Paul Walmsley
+ * Zong Li
+ * Pragnesh Patel
+ */
+
+#ifndef __DT_BINDINGS_CLOCK_SIFIVE_FU740_PRCI_H
+#define __DT_BINDINGS_CLOCK_SIFIVE_FU740_PRCI_H
+
+/* Clock indexes for use by Device Tree data and the PRCI driver */
+
+#define PRCI_CLK_COREPLL	0
+#define PRCI_CLK_DDRPLL		1
+#define PRCI_CLK_GEMGXLPLL	2
+#define PRCI_CLK_DVFSCOREPLL	3
+#define PRCI_CLK_HFPCLKPLL	4
+#define PRCI_CLK_CLTXPLL	5
+#define PRCI_CLK_TLCLK		6
+#define PRCI_CLK_PCLK		7
+#define PRCI_CLK_PCIEAUX	8
+
+#endif
include/dt-bindings/reset/sifive-fu740-prci.h new file +19 -0
new file mode 100644
index 0000000..02210f4
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
+/*
+ * Copyright (C) 2020-2021 Sifive, Inc.
+ * Author: Pragnesh Patel <[email protected]>
+ */
+
+#ifndef __DT_BINDINGS_RESET_SIFIVE_FU740_PRCI_H
+#define __DT_BINDINGS_RESET_SIFIVE_FU740_PRCI_H
+
+/* Reset indexes for use by device tree data and the PRCI driver */
+#define PRCI_RST_DDR_CTRL_N		0
+#define PRCI_RST_DDR_AXI_N		1
+#define PRCI_RST_DDR_AHB_N		2
+#define PRCI_RST_DDR_PHY_N		3
+#define PRCI_RST_PCIE_POWER_UP_N	4
+#define PRCI_RST_GEMGXL_N		5
+#define PRCI_RST_CLTX_N			6
+
+#endif
Signature · 1 line
2.7.4
author
#2 lore raw

PATCH v2 2/8 riscv: cpu: fu740: Add support for cpu fu740

In reply to Green Wan

Add SiFive fu740 cpu to support RISC-V arch

---
 arch/riscv/Kconfig                        |  1 +
 arch/riscv/cpu/fu740/Kconfig              | 37 +++++++++++++++++++++
 arch/riscv/cpu/fu740/Makefile             | 12 +++++++
 arch/riscv/cpu/fu740/cache.c              | 55 +++++++++++++++++++++++++++++++
 arch/riscv/cpu/fu740/cpu.c                | 22 +++++++++++++
 arch/riscv/cpu/fu740/dram.c               | 38 +++++++++++++++++++++
 arch/riscv/cpu/fu740/spl.c                | 23 +++++++++++++
 arch/riscv/include/asm/arch-fu740/cache.h | 14 ++++++++
 arch/riscv/include/asm/arch-fu740/clk.h   | 14 ++++++++
 arch/riscv/include/asm/arch-fu740/gpio.h  | 38 +++++++++++++++++++++
 arch/riscv/include/asm/arch-fu740/reset.h | 13 ++++++++
 arch/riscv/include/asm/arch-fu740/spl.h   | 14 ++++++++
 arch/riscv/lib/sifive_clint.c             |  1 -
 13 files changed, 281 insertions(+), 1 deletion(-)
 create mode 100644 arch/riscv/cpu/fu740/Kconfig
 create mode 100644 arch/riscv/cpu/fu740/Makefile
 create mode 100644 arch/riscv/cpu/fu740/cache.c
 create mode 100644 arch/riscv/cpu/fu740/cpu.c
 create mode 100644 arch/riscv/cpu/fu740/dram.c
 create mode 100644 arch/riscv/cpu/fu740/spl.c
 create mode 100644 arch/riscv/include/asm/arch-fu740/cache.h
 create mode 100644 arch/riscv/include/asm/arch-fu740/clk.h
 create mode 100644 arch/riscv/include/asm/arch-fu740/gpio.h
 create mode 100644 arch/riscv/include/asm/arch-fu740/reset.h
 create mode 100644 arch/riscv/include/asm/arch-fu740/spl.h
arch/riscv/Kconfig +1 -0
index e8494c2..323c358 100644
@@ -61,6 +61,7 @@ source "board/sipeed/maix/Kconfig"
 # platform-specific options below
 source "arch/riscv/cpu/ax25/Kconfig"
 source "arch/riscv/cpu/fu540/Kconfig"
+source "arch/riscv/cpu/fu740/Kconfig"
 source "arch/riscv/cpu/generic/Kconfig"
 
 # architecture-specific options below
arch/riscv/cpu/fu740/Kconfig new file +37 -0
new file mode 100644
index 0000000..689e54d
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2020-2021 SiFive, Inc
+# Pragnesh Patel <[email protected]>
+
+config SIFIVE_FU740
+	bool
+	select ARCH_EARLY_INIT_R
+	select RAM
+	select SPL_RAM if SPL
+	imply CPU
+	imply CPU_RISCV
+	imply RISCV_TIMER if (RISCV_SMODE || SPL_RISCV_SMODE)
+	imply SIFIVE_CLINT if (RISCV_MMODE || SPL_RISCV_MMODE)
+	imply CMD_CPU
+	imply SPL_CPU_SUPPORT
+	imply SPL_OPENSBI
+	imply SPL_LOAD_FIT
+	imply SMP
+	imply CLK_SIFIVE
+	imply CLK_SIFIVE_PRCI
+	imply SIFIVE_SERIAL
+	imply MACB
+	imply MII
+	imply SPI
+	imply SPI_SIFIVE
+	imply MMC
+	imply MMC_SPI
+	imply MMC_BROKEN_CD
+	imply CMD_MMC
+	imply DM_GPIO
+	imply SIFIVE_GPIO
+	imply CMD_GPIO
+	imply MISC
+	imply SIFIVE_OTP
+	imply DM_PWM
+	imply PWM_SIFIVE
arch/riscv/cpu/fu740/Makefile new file +12 -0
new file mode 100644
index 0000000..5ef8ac1
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2020-2021 SiFive, Inc
+# Pragnesh Patel <[email protected]>
+
+ifeq ($(CONFIG_SPL_BUILD),y)
+obj-y += spl.o
+else
+obj-y += dram.o
+obj-y += cpu.o
+obj-y += cache.o
+endif
arch/riscv/cpu/fu740/cache.c new file +55 -0

55 lines not on this page · raw message

arch/riscv/cpu/fu740/cpu.c new file +22 -0
new file mode 100644
index 0000000..f13c189
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018, Bin Meng <[email protected]>
+ */
+
+#include <irq_func.h>
+#include <asm/cache.h>
+
+/*
+ * cleanup_before_linux() is called just before we call linux
+ * it prepares the processor for linux
+ *
+ * we disable interrupt and caches.
+ */
+int cleanup_before_linux(void)
+{
+	disable_interrupts();
+
+	cache_flush();
+
+	return 0;
+}
arch/riscv/cpu/fu740/dram.c new file +38 -0
new file mode 100644
index 0000000..1dc77ef
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018, Bin Meng <[email protected]>
+ */
+
+#include <common.h>
+#include <fdtdec.h>
+#include <init.h>
+#include <linux/sizes.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+	return fdtdec_setup_mem_size_base();
+}
+
+int dram_init_banksize(void)
+{
+	return fdtdec_setup_memory_banksize();
+}
+
+ulong board_get_usable_ram_top(ulong total_size)
+{
+#ifdef CONFIG_64BIT
+	/*
+	 * Ensure that we run from first 4GB so that all
+	 * addresses used by U-Boot are 32bit addresses.
+	 *
+	 * This in-turn ensures that 32bit DMA capable
+	 * devices work fine because DMA mapping APIs will
+	 * provide 32bit DMA addresses only.
+	 */
+	if (gd->ram_top > SZ_4G)
+		return SZ_4G;
+#endif
+	return gd->ram_top;
+}
arch/riscv/cpu/fu740/spl.c new file +23 -0
new file mode 100644
index 0000000..ea0b228
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2020-201 SiFive, Inc
+ * Pragnesh Patel <[email protected]>
+ */
+
+#include <dm.h>
+#include <log.h>
+
+int spl_soc_init(void)
+{
+	int ret;
+	struct udevice *dev;
+
+	/* DDR init */
+	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
+	if (ret) {
+		debug("DRAM init failed: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
arch/riscv/include/asm/arch-fu740/cache.h new file +14 -0
new file mode 100644
index 0000000..7d4fe99
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2020-2021 SiFive, Inc.
+ *
+ * Authors:
+ *   Pragnesh Patel <[email protected]>
+ */
+
+#ifndef _CACHE_SIFIVE_H
+#define _CACHE_SIFIVE_H
+
+int cache_enable_ways(void);
+
+#endif /* _CACHE_SIFIVE_H */
arch/riscv/include/asm/arch-fu740/clk.h new file +14 -0
new file mode 100644
index 0000000..9f88361
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2020-2021 SiFive Inc
+ *
+ * Authors:
+ *   Pragnesh Patel <[email protected]>
+ */
+
+#ifndef __CLK_SIFIVE_H
+#define __CLK_SIFIVE_H
+
+/* Note: This is a placeholder header for driver compilation. */
+
+#endif
arch/riscv/include/asm/arch-fu740/gpio.h new file +38 -0
new file mode 100644
index 0000000..908e2e5
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2020-2021 SiFive, Inc.
+ */
+
+#ifndef _GPIO_SIFIVE_H
+#define _GPIO_SIFIVE_H
+
+#define GPIO_INPUT_VAL	0x00
+#define GPIO_INPUT_EN	0x04
+#define GPIO_OUTPUT_EN	0x08
+#define GPIO_OUTPUT_VAL	0x0C
+#define GPIO_RISE_IE	0x18
+#define GPIO_RISE_IP	0x1C
+#define GPIO_FALL_IE	0x20
+#define GPIO_FALL_IP	0x24
+#define GPIO_HIGH_IE	0x28
+#define GPIO_HIGH_IP	0x2C
+#define GPIO_LOW_IE	0x30
+#define GPIO_LOW_IP	0x34
+#define GPIO_OUTPUT_XOR	0x40
+
+#define NR_GPIOS	16
+
+enum gpio_state {
+	LOW,
+	HIGH
+};
+
+/* Details about a GPIO bank */
+struct sifive_gpio_plat {
+	void *base;     /* address of registers in physical memory */
+};
+
+#define SIFIVE_GENERIC_GPIO_NR(port, index) \
+		(((port) * NR_GPIOS) + ((index) & (NR_GPIOS - 1)))
+
+#endif /* _GPIO_SIFIVE_H */
arch/riscv/include/asm/arch-fu740/reset.h new file +13 -0
new file mode 100644
index 0000000..538ef87
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2020-2021 SiFive, Inc.
+ *
+ * Author: Sagar Kadam <[email protected]>
+ */
+
+#ifndef __RESET_SIFIVE_H
+#define __RESET_SIFIVE_H
+
+int sifive_reset_bind(struct udevice *dev, ulong count);
+
+#endif
arch/riscv/include/asm/arch-fu740/spl.h new file +14 -0
new file mode 100644
index 0000000..15ad9e7
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2020-2021 SiFive, Inc.
+ *
+ * Authors:
+ *   Pragnesh Patel <[email protected]>
+ */
+
+#ifndef _SPL_SIFIVE_H
+#define _SPL_SIFIVE_H
+
+int spl_soc_init(void);
+
+#endif /* _SPL_SIFIVE_H */
arch/riscv/lib/sifive_clint.c +0 -1
index ab22395..cfa288a 100644
@@ -10,7 +10,6 @@
 
 #include <common.h>
 #include <dm.h>
-#include <asm/global_data.h>
 #include <asm/io.h>
 #include <asm/smp.h>
 #include <linux/err.h>
Signature · 1 line
2.7.4
author
#3 lore raw

PATCH v2 3/8 drivers: clk: add fu740 support

In reply to Green Wan

Add fu740 support. One abstract layer is added for supporting multiple chips such as fu540 and fu740.

---
 drivers/clk/sifive/Kconfig       |   8 +-
 drivers/clk/sifive/Makefile      |   4 +-
 drivers/clk/sifive/fu540-prci.c  | 769 ++-------------------------------------
 drivers/clk/sifive/fu540-prci.h  |  22 ++
 drivers/clk/sifive/fu740-prci.c  | 158 ++++++++
 drivers/clk/sifive/fu740-prci.h  |  22 ++
 drivers/clk/sifive/sifive-prci.c | 733 +++++++++++++++++++++++++++++++++++++
 drivers/clk/sifive/sifive-prci.h | 323 ++++++++++++++++
 8 files changed, 1286 insertions(+), 753 deletions(-)
 create mode 100644 drivers/clk/sifive/fu540-prci.h
 create mode 100644 drivers/clk/sifive/fu740-prci.c
 create mode 100644 drivers/clk/sifive/fu740-prci.h
 create mode 100644 drivers/clk/sifive/sifive-prci.c
 create mode 100644 drivers/clk/sifive/sifive-prci.h
drivers/clk/sifive/Kconfig +4 -4
index c4d0a1f..20fc004 100644
@@ -6,11 +6,11 @@ config CLK_SIFIVE
 	help
 	  SoC drivers for SiFive Linux-capable SoCs.
 
-config CLK_SIFIVE_FU540_PRCI
-	bool "PRCI driver for SiFive FU540 SoCs"
+config CLK_SIFIVE_PRCI
+	bool "PRCI driver for SiFive SoCs"
 	depends on CLK_SIFIVE
 	select CLK_ANALOGBITS_WRPLL_CLN28HPC
 	help
 	  Supports the Power Reset Clock interface (PRCI) IP block found in
-	  FU540 SoCs.  If this kernel is meant to run on a SiFive FU540 SoC,
-	  enable this driver.
+	  FU540/FU740 SoCs. If this kernel is meant to run on a SiFive FU540/
+	  FU740 SoCs, enable this driver.
drivers/clk/sifive/Makefile +3 -1
index b224279..51348b1 100644
@@ -1,3 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0+
 
-obj-$(CONFIG_CLK_SIFIVE_FU540_PRCI)		+= fu540-prci.o
+obj-y += sifive-prci.o
+
+obj-$(CONFIG_CLK_SIFIVE_PRCI) += fu540-prci.o fu740-prci.o
drivers/clk/sifive/fu540-prci.c +21 -748

807 lines not on this page · raw message

drivers/clk/sifive/fu540-prci.h new file +22 -0
new file mode 100644
index 0000000..1133011
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2020-2021 SiFive, Inc.
+ * Zong Li
+ * Pragnesh Patel
+ */
+
+#ifndef __SIFIVE_CLK_FU540_PRCI_H
+#define __SIFIVE_CLK_FU540_PRCI_H
+
+#include "sifive-prci.h"
+
+#define NUM_CLOCK_FU540	4
+
+extern struct __prci_clock __prci_init_clocks_fu540[NUM_CLOCK_FU540];
+
+static const struct prci_clk_desc prci_clk_fu540 = {
+	.clks = __prci_init_clocks_fu540,
+	.num_clks = ARRAY_SIZE(__prci_init_clocks_fu540),
+};
+
+#endif /* __SIFIVE_CLK_FU540_PRCI_H */
drivers/clk/sifive/fu740-prci.c new file +158 -0

158 lines not on this page · raw message

drivers/clk/sifive/fu740-prci.h new file +22 -0
new file mode 100644
index 0000000..b74f078
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2020-2021 SiFive, Inc.
+ * Zong Li
+ * Pragnesh Patel
+ */
+
+#ifndef __SIFIVE_CLK_FU740_PRCI_H
+#define __SIFIVE_CLK_FU740_PRCI_H
+
+#include "sifive-prci.h"
+
+#define NUM_CLOCK_FU740		9
+
+extern struct __prci_clock __prci_init_clocks_fu740[NUM_CLOCK_FU740];
+
+static const struct prci_clk_desc prci_clk_fu740 = {
+	.clks = __prci_init_clocks_fu740,
+	.num_clks = ARRAY_SIZE(__prci_init_clocks_fu740),
+};
+
+#endif /* __SIFIVE_CLK_FU740_PRCI_H */
drivers/clk/sifive/sifive-prci.c new file +733 -0

733 lines not on this page · raw message

drivers/clk/sifive/sifive-prci.h new file +323 -0

323 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#4 lore raw

PATCH v2 4/8 drivers: ram: sifive: rename fu540_ddr to sifive_ddr

In reply to Green Wan

Rename fu540_ddr.c to sifive_ddr.c for supporting both of fu540 and fu740. To avoid 'git mv' info missing, sifive_ddr.c chagnes are included in next patch.

---
 drivers/ram/sifive/Kconfig      |   6 +-
 drivers/ram/sifive/Makefile     |   2 +-
 drivers/ram/sifive/fu540_ddr.c  | 410 ----------------------------------------
 drivers/ram/sifive/sifive_ddr.c | 410 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 414 insertions(+), 414 deletions(-)
 delete mode 100644 drivers/ram/sifive/fu540_ddr.c
 create mode 100644 drivers/ram/sifive/sifive_ddr.c
drivers/ram/sifive/Kconfig +3 -3
index 08de692..a93cd0e 100644
@@ -5,9 +5,9 @@ config RAM_SIFIVE
 	help
 	  This enables support for ram drivers of SiFive SoCs.
 
-config SIFIVE_FU540_DDR
-	bool "SiFive FU540 DDR driver"
+config SIFIVE_DDR
+	bool "SiFive DDR driver"
 	depends on RAM_SIFIVE
 	default y if TARGET_SIFIVE_UNLEASHED
 	help
-	  This enables DDR support for the platforms based on SiFive FU540 SoC.
+	  This enables DDR support for the platforms based on SiFive SoC.
drivers/ram/sifive/Makefile +1 -1
index d66efec..4ef89f8 100644
@@ -3,4 +3,4 @@
 # Copyright (c) 2020 SiFive, Inc
 #
 
-obj-$(CONFIG_SIFIVE_FU540_DDR) += fu540_ddr.o
+obj-$(CONFIG_SIFIVE_DDR) += sifive_ddr.o
drivers/ram/sifive/fu540_ddr.c deleted +0 -410

410 lines not on this page · raw message

drivers/ram/sifive/sifive_ddr.c new file +410 -0

410 lines not on this page · raw message

Signature · 1 line
2.7.4
#5 lore raw

PATCH v2 4/8 drivers: ram: sifive: rename fu540_ddr to sifive_ddr

Hi Green,

Quoted 3 lines · Green Wan

Rename fu540_ddr.c to sifive_ddr.c for supporting both of fu540 and fu740. To avoid 'git mv' info missing, sifive_ddr.c chagnes are

typo: changes

Quoted 8 lines

included in next patch.

---
 drivers/ram/sifive/Kconfig      |   6 +-
 drivers/ram/sifive/Makefile     |   2 +-
 drivers/ram/sifive/fu540_ddr.c  | 410 ----------------------------------------
 drivers/ram/sifive/sifive_ddr.c | 410 ++++++++++++++++++++++++++++++++++++++++

It looks you did not use "git format-patch -M" to detect the rename

Quoted 4 lines
 4 files changed, 414 insertions(+), 414 deletions(-)
 delete mode 100644 drivers/ram/sifive/fu540_ddr.c
 create mode 100644 drivers/ram/sifive/sifive_ddr.c

Regards,
Bin

author
#6 lore raw

PATCH v2 4/8 drivers: ram: sifive: rename fu540_ddr to sifive_ddr

Quoted 9 lines · Bin Meng

Hi Green,

Quoted 3 lines · Green Wan

Rename fu540_ddr.c to sifive_ddr.c for supporting both of fu540 and fu740. To avoid 'git mv' info missing, sifive_ddr.c chagnes are

typo: changes

will fix it.

Quoted 8 lines
Quoted 8 lines

included in next patch.

---
 drivers/ram/sifive/Kconfig      |   6 +-
 drivers/ram/sifive/Makefile     |   2 +-
 drivers/ram/sifive/fu540_ddr.c  | 410
Quoted 6 lines

----------------------------------------

Quoted 1 line
 drivers/ram/sifive/sifive_ddr.c | 410

++++++++++++++++++++++++++++++++++++++++

It looks you did not use "git format-patch -M" to detect the rename

Mmh, I do use " git format-patch -M" to create the patches. Don't know why it does work for me. I'll do it again.

Quoted 9 lines
Quoted 5 lines
 4 files changed, 414 insertions(+), 414 deletions(-)
 delete mode 100644 drivers/ram/sifive/fu540_ddr.c
 create mode 100644 drivers/ram/sifive/sifive_ddr.c

Regards,
Bin

author
#7 lore raw

PATCH v2 5/8 drivers: ram: add fu740 support

In reply to Green Wan

Add fu740 support for ram

---
 drivers/ram/sifive/Kconfig      |  2 +-
 drivers/ram/sifive/sifive_ddr.c | 88 ++++++++++++++++++++---------------------
 2 files changed, 45 insertions(+), 45 deletions(-)
drivers/ram/sifive/Kconfig +1 -1
index a93cd0e..0aaac02 100644
@@ -8,6 +8,6 @@ config RAM_SIFIVE
 config SIFIVE_DDR
 	bool "SiFive DDR driver"
 	depends on RAM_SIFIVE
-	default y if TARGET_SIFIVE_UNLEASHED
+	default y if TARGET_SIFIVE_UNLEASHED || TARGET_SIFIVE_UNMATCHED
 	help
 	  This enables DDR support for the platforms based on SiFive SoC.
drivers/ram/sifive/sifive_ddr.c +44 -44

231 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#8 lore raw

PATCH v2 6/8 drivers: pci: add pcie support for fu740

In reply to Green Wan

Add pcie driver for SiFive fu740, the driver depends on fu740 gpio, clk and reset driver to do init. Force running at Gen1 for better capatible enumeration.

Several devices are tested:
a) M.2 NVMe SSD
b) USB-to-PCI adapter
c) Ethernet adapter (E1000 compatible)

---
 drivers/pci/Kconfig       |   9 +
 drivers/pci/Makefile      |   1 +
 drivers/pci/pcie_sifive.c | 797 ++++++++++++++++++++++++++++++++++++++++++++++
 drivers/pci/pcie_sifive.h | 374 ++++++++++++++++++++++
 4 files changed, 1181 insertions(+)
 create mode 100644 drivers/pci/pcie_sifive.c
 create mode 100644 drivers/pci/pcie_sifive.h
drivers/pci/Kconfig +9 -0
index ba41787..b078e76 100644
@@ -97,6 +97,15 @@ config PCIE_DW_MVEBU
 	  Armada-8K SoCs. The PCIe controller on Armada-8K is based on
 	  DesignWare hardware.
 
+config PCIE_SIFIVE_FU740
+	bool "Enable SiFive FU740 PCIe"
+	depends on CLK_SIFIVE_PRCI
+	depends on RESET_SIFIVE
+	depends on SIFIVE_GPIO
+	help
+	  Say Y here if you want to enable PCIe controller support on
+	  FU740.
+
 config PCIE_FSL
 	bool "FSL PowerPC PCIe support"
 	depends on DM_PCI
drivers/pci/Makefile +1 -0
index 5ed94bc..5400d59 100644
@@ -51,3 +51,4 @@ obj-$(CONFIG_PCIE_ROCKCHIP) += pcie_rockchip.o
 obj-$(CONFIG_PCIE_DW_ROCKCHIP) += pcie_dw_rockchip.o
 obj-$(CONFIG_PCI_BRCMSTB) += pcie_brcmstb.o
 obj-$(CONFIG_PCI_OCTEONTX) += pci_octeontx.o
+obj-$(CONFIG_PCIE_SIFIVE_FU740) += pcie_sifive.o
drivers/pci/pcie_sifive.c new file +797 -0

797 lines not on this page · raw message

drivers/pci/pcie_sifive.h new file +374 -0

374 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#9 lore raw

PATCH v2 7/8 board: sifive: add HiFive Unmatched board support

In reply to Green Wan

Add dts, defconfig and board support for HiFive Unmatched.

---
 arch/riscv/Kconfig                                 |    4 +
 arch/riscv/dts/fu740-hifive-unmatched-a00-ddr.dtsi | 1489 ++++++++++++++++++++
 arch/riscv/dts/hifive-unmatched-a00-u-boot.dtsi    |   40 +
 arch/riscv/dts/hifive-unmatched-a00.dts            |  253 ++++
 board/sifive/unmatched/Kconfig                     |   50 +
 board/sifive/unmatched/MAINTAINERS                 |    9 +
 board/sifive/unmatched/Makefile                    |    9 +
 board/sifive/unmatched/hifive-unmatched-fu740.c    |   24 +
 board/sifive/unmatched/spl.c                       |   85 ++
 common/spl/Kconfig                                 |    4 +-
 configs/sifive_unmatched_defconfig                 |   53 +
 doc/board/sifive/hifive_unmatched_fu740.rst        |  536 +++++++
 drivers/reset/Kconfig                              |    2 +-
 include/configs/sifive-unmatched.h                 |   85 ++
 14 files changed, 2640 insertions(+), 3 deletions(-)
 create mode 100644 arch/riscv/dts/fu740-hifive-unmatched-a00-ddr.dtsi
 create mode 100644 arch/riscv/dts/hifive-unmatched-a00-u-boot.dtsi
 create mode 100644 arch/riscv/dts/hifive-unmatched-a00.dts
 create mode 100644 board/sifive/unmatched/Kconfig
 create mode 100644 board/sifive/unmatched/MAINTAINERS
 create mode 100644 board/sifive/unmatched/Makefile
 create mode 100644 board/sifive/unmatched/hifive-unmatched-fu740.c
 create mode 100644 board/sifive/unmatched/spl.c
 create mode 100644 configs/sifive_unmatched_defconfig
 create mode 100644 doc/board/sifive/hifive_unmatched_fu740.rst
 create mode 100644 include/configs/sifive-unmatched.h
arch/riscv/Kconfig +4 -0
index 323c358..7c053ac 100644
@@ -20,6 +20,9 @@ config TARGET_QEMU_VIRT
 config TARGET_SIFIVE_UNLEASHED
 	bool "Support SiFive Unleashed Board"
 
+config TARGET_SIFIVE_UNMATCHED
+	bool "Support SiFive Unmatched Board"
+
 config TARGET_SIPEED_MAIX
 	bool "Support Sipeed Maix Board"
 
@@ -56,6 +59,7 @@ source "board/AndesTech/ax25-ae350/Kconfig"
 source "board/emulation/qemu-riscv/Kconfig"
 source "board/microchip/mpfs_icicle/Kconfig"
 source "board/sifive/unleashed/Kconfig"
+source "board/sifive/unmatched/Kconfig"
 source "board/sipeed/maix/Kconfig"
 
 # platform-specific options below
arch/riscv/dts/fu740-hifive-unmatched-a00-ddr.dtsi new file +1489 -0

1,489 lines not on this page · raw message

arch/riscv/dts/hifive-unmatched-a00-u-boot.dtsi new file +40 -0
new file mode 100644
index 0000000..3dcd2b4
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2020-2021 SiFive, Inc
+ */
+
+#include "fu740-c000-u-boot.dtsi"
+#include "fu740-hifive-unmatched-a00-ddr.dtsi"
+
+/ {
+	aliases {
+		spi0 = &spi0;
+	};
+
+	memory at 80000000 {
+		u-boot,dm-spl;
+	};
+
+	hfclk {
+		u-boot,dm-spl;
+	};
+
+	rtcclk {
+		u-boot,dm-spl;
+	};
+
+};
+
+&clint {
+	clocks = <&rtcclk>;
+};
+
+&spi0 {
+	mmc at 0 {
+		u-boot,dm-spl;
+	};
+};
+
+&gpio {
+	u-boot,dm-spl;
+};
arch/riscv/dts/hifive-unmatched-a00.dts new file +253 -0

253 lines not on this page · raw message

board/sifive/unmatched/Kconfig new file +50 -0

50 lines not on this page · raw message

board/sifive/unmatched/MAINTAINERS new file +9 -0
new file mode 100644
index 0000000..94c9510
@@ -0,0 +1,9 @@
+SiFive HiFive Unmatched FU740 BOARD
+M:	Paul Walmsley <[email protected]>
+M:	Pragnesh Patel <[email protected]>
+M:	Green Wan <[email protected]>
+S:	Maintained
+F:	board/sifive/unmatched/
+F:	doc/board/sifive/hifive-unmatched-fu740.rst
+F:	include/configs/sifive-unmatched.h
+F:	configs/sifive_unmatched_defconfig
board/sifive/unmatched/Makefile new file +9 -0
new file mode 100644
index 0000000..f50c2bc
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (c) 2020-2021 SiFive, Inc
+
+obj-y   += hifive-unmatched-fu740.o
+
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+endif
board/sifive/unmatched/hifive-unmatched-fu740.c new file +24 -0
new file mode 100644
index 0000000..6d60559
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2020-2021, SiFive Inc
+ *
+ * Authors:
+ *   Pragnesh Patel <[email protected]>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <asm/arch/cache.h>
+
+int board_init(void)
+{
+	int ret;
+
+	/* enable all cache ways */
+	ret = cache_enable_ways();
+	if (ret) {
+		debug("%s: could not enable cache ways\n", __func__);
+		return ret;
+	}
+	return 0;
+}
board/sifive/unmatched/spl.c new file +85 -0

85 lines not on this page · raw message

common/spl/Kconfig +2 -2
index 6e6a790..3acd8fa 100644
@@ -318,7 +318,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
 		     ARCH_ROCKCHIP || ARCH_MVEBU ||  ARCH_SOCFPGA || \
 		     ARCH_AT91 || ARCH_ZYNQ || ARCH_KEYSTONE || OMAP34XX || \
 		     OMAP44XX || OMAP54XX || AM33XX || AM43XX || \
-		     TARGET_SIFIVE_UNLEASHED
+		     TARGET_SIFIVE_UNLEASHED || TARGET_SIFIVE_UNMATCHED
 	help
 	  Use sector number for specifying U-Boot location on MMC/SD in
 	  raw mode.
@@ -335,7 +335,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
 	default 0x300 if ARCH_ZYNQ || ARCH_KEYSTONE || OMAP34XX || OMAP44XX || \
 		         OMAP54XX || AM33XX || AM43XX || ARCH_K3
 	default 0x4000 if ARCH_ROCKCHIP
-	default 0x822 if TARGET_SIFIVE_UNLEASHED
+	default 0x822 if TARGET_SIFIVE_UNLEASHED || TARGET_SIFIVE_UNMATCHED
 	help
 	  Address on the MMC to load U-Boot from, when the MMC is being used
 	  in raw mode. Units: MMC sectors (1 sector = 512 bytes).
configs/sifive_unmatched_defconfig new file +53 -0

53 lines not on this page · raw message

doc/board/sifive/hifive_unmatched_fu740.rst new file +536 -0

536 lines not on this page · raw message

drivers/reset/Kconfig +1 -1
index 019565f..8ddea85 100644
@@ -166,7 +166,7 @@ config RESET_IPQ419
 
 config RESET_SIFIVE
 	bool "Reset Driver for SiFive SoC's"
-	depends on DM_RESET && CLK_SIFIVE_FU540_PRCI && TARGET_SIFIVE_UNLEASHED
+	depends on DM_RESET && CLK_SIFIVE_FU540_PRCI && (TARGET_SIFIVE_UNLEASHED || TARGET_SIFIVE_UNMATCHED)
 	default y
 	help
 	  PRCI module within SiFive SoC's provides mechanism to reset
include/configs/sifive-unmatched.h new file +85 -0

85 lines not on this page · raw message

Signature · 1 line
2.7.4
#10 lore raw

PATCH v2 7/8 board: sifive: add HiFive Unmatched board support

Hi Green,

Quoted 4 lines · Green Wan

Add dts, defconfig and board support for HiFive Unmatched.

Quoted 9 lines
---
 arch/riscv/Kconfig                                 |    4 +
 arch/riscv/dts/fu740-hifive-unmatched-a00-ddr.dtsi | 1489 ++++++++++++++++++++
 arch/riscv/dts/hifive-unmatched-a00-u-boot.dtsi    |   40 +
 arch/riscv/dts/hifive-unmatched-a00.dts            |  253 ++++
 board/sifive/unmatched/Kconfig                     |   50 +
 board/sifive/unmatched/MAINTAINERS                 |    9 +
 board/sifive/unmatched/Makefile                    |    9 +
 board/sifive/unmatched/hifive-unmatched-fu740.c    |   24 +

This should be unmatched.c

Quoted 4 lines
 board/sifive/unmatched/spl.c                       |   85 ++
 common/spl/Kconfig                                 |    4 +-
 configs/sifive_unmatched_defconfig                 |   53 +
 doc/board/sifive/hifive_unmatched_fu740.rst        |  536 +++++++

unmatched.rst

Quoted 6 lines
 drivers/reset/Kconfig                              |    2 +-
 include/configs/sifive-unmatched.h                 |   85 ++
 14 files changed, 2640 insertions(+), 3 deletions(-)
 create mode 100644 arch/riscv/dts/fu740-hifive-unmatched-a00-ddr.dtsi
 create mode 100644 arch/riscv/dts/hifive-unmatched-a00-u-boot.dtsi
 create mode 100644 arch/riscv/dts/hifive-unmatched-a00.dts
Quoted 9 lines
 create mode 100644 board/sifive/unmatched/Kconfig
 create mode 100644 board/sifive/unmatched/MAINTAINERS
 create mode 100644 board/sifive/unmatched/Makefile
 create mode 100644 board/sifive/unmatched/hifive-unmatched-fu740.c
 create mode 100644 board/sifive/unmatched/spl.c
 create mode 100644 configs/sifive_unmatched_defconfig
 create mode 100644 doc/board/sifive/hifive_unmatched_fu740.rst
 create mode 100644 include/configs/sifive-unmatched.h

Otherwise, LGTM:

author
#11 lore raw

PATCH v2 7/8 board: sifive: add HiFive Unmatched board support

will fix it. Thanks.

- Green

Quoted 46 lines · Bin Meng

Hi Green,

Quoted 7 lines · Green Wan

Add dts, defconfig and board support for HiFive Unmatched.

---
 arch/riscv/Kconfig                                 |    4 +
 arch/riscv/dts/fu740-hifive-unmatched-a00-ddr.dtsi | 1489

++++++++++++++++++++

Quoted 6 lines
 arch/riscv/dts/hifive-unmatched-a00-u-boot.dtsi    |   40 +
 arch/riscv/dts/hifive-unmatched-a00.dts            |  253 ++++
 board/sifive/unmatched/Kconfig                     |   50 +
 board/sifive/unmatched/MAINTAINERS                 |    9 +
 board/sifive/unmatched/Makefile                    |    9 +
 board/sifive/unmatched/hifive-unmatched-fu740.c    |   24 +

This should be unmatched.c

Quoted 4 lines
 board/sifive/unmatched/spl.c                       |   85 ++
 common/spl/Kconfig                                 |    4 +-
 configs/sifive_unmatched_defconfig                 |   53 +
 doc/board/sifive/hifive_unmatched_fu740.rst        |  536 +++++++

unmatched.rst

Quoted 6 lines
 drivers/reset/Kconfig                              |    2 +-
 include/configs/sifive-unmatched.h                 |   85 ++
 14 files changed, 2640 insertions(+), 3 deletions(-)
 create mode 100644 arch/riscv/dts/fu740-hifive-unmatched-a00-ddr.dtsi
 create mode 100644 arch/riscv/dts/hifive-unmatched-a00-u-boot.dtsi
 create mode 100644 arch/riscv/dts/hifive-unmatched-a00.dts
Quoted 9 lines
 create mode 100644 board/sifive/unmatched/Kconfig
 create mode 100644 board/sifive/unmatched/MAINTAINERS
 create mode 100644 board/sifive/unmatched/Makefile
 create mode 100644 board/sifive/unmatched/hifive-unmatched-fu740.c
 create mode 100644 board/sifive/unmatched/spl.c
 create mode 100644 configs/sifive_unmatched_defconfig
 create mode 100644 doc/board/sifive/hifive_unmatched_fu740.rst
 create mode 100644 include/configs/sifive-unmatched.h

Otherwise, LGTM:

author
#12 lore raw

PATCH v2 8/8 drivers: net: macb: add fu740 support

In reply to Green Wan

From: David Abdurachmanov <[email protected]>

Add fu740 support to macb ethernet driver

---
 drivers/net/macb.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/macb.c +7 -1
index 57ea45e..df65d82 100644
@@ -592,7 +592,11 @@ static int macb_sifive_clk_init(struct udevice *dev, ulong rate)
 	 *     and output clock on GMII output signal GTX_CLK
 	 * 1 = MII mode. Use MII input signal TX_CLK in TX logic
 	 */
-	writel(rate != 125000000, gemgxl_regs);
+	if (device_is_compatible(dev, "sifive,fu540-c000-gem"))
+		writel(rate != 125000000, gemgxl_regs);
+	else if (device_is_compatible(dev, "sifive,fu740-c000-gem"))
+		writel(rate != 125125000, gemgxl_regs);
+
 	return 0;
 }
 
@@ -1507,6 +1511,8 @@ static const struct udevice_id macb_eth_ids[] = {
 	{ .compatible = "cdns,zynq-gem" },
 	{ .compatible = "sifive,fu540-c000-gem",
 	  .data = (ulong)&sifive_config },
+	{ .compatible = "sifive,fu740-c000-gem",
+	  .data = (ulong)&sifive_config },
 	{ .compatible = "microchip,mpfs-mss-gem",
 	  .data = (ulong)&microchip_config },
 	{ }
Signature · 1 line
2.7.4
#13 lore raw

PATCH v2 8/8 drivers: net: macb: add fu740 support

Quoted 17 lines · Green Wan

From: David Abdurachmanov <[email protected]>

Add fu740 support to macb ethernet driver

---
 drivers/net/macb.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/macb.c +0 -0
index 57ea45e..df65d82 100644

drivers/net/macb.c static int macb_sifive_clk_init(struct udevice *dev, ulong rate) · line 596

Quoted 6 lines
drivers/net/macb.c +2 -1
@@ -592,7 +592,11 @@ static int macb_sifive_clk_init(struct udevice *dev, ulong rate)
         *     and output clock on GMII output signal GTX_CLK
         * 1 = MII mode. Use MII input signal TX_CLK in TX logic
         */
-       writel(rate != 125000000, gemgxl_regs);
+       if (device_is_compatible(dev, "sifive,fu540-c000-gem"))
+               writel(rate != 125000000, gemgxl_regs);

Could you add a comment here why we need this? (i.e. about the HW quirk) Note that 125.125 is actually outside of specification for VSC8541XMV-02.

Quoted 18 lines
drivers/net/macb.c +5 -1
+       else if (device_is_compatible(dev, "sifive,fu740-c000-gem"))
+               writel(rate != 125125000, gemgxl_regs);
+
        return 0;
 }
 
@@ -1507,6 +1511,8 @@ static const struct udevice_id macb_eth_ids[] = {
        { .compatible = "cdns,zynq-gem" },
        { .compatible = "sifive,fu540-c000-gem",
          .data = (ulong)&sifive_config },
+       { .compatible = "sifive,fu740-c000-gem",
+         .data = (ulong)&sifive_config },
        { .compatible = "microchip,mpfs-mss-gem",
          .data = (ulong)&microchip_config },
        { }
--

2.7.4

author
#14 lore raw

PATCH v2 8/8 drivers: net: macb: add fu740 support

Quoted 51 lines · David Abdurachmanov

drivers/net/macb.c static int macb_sifive_clk_init(struct udevice

Quoted 17 lines · Green Wan

From: David Abdurachmanov <[email protected]>

Add fu740 support to macb ethernet driver

---
 drivers/net/macb.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/macb.c +0 -0
index 57ea45e..df65d82 100644
@@ -592,7 +592,11 @@ static int macb_sifive_clk_init(struct udevice

*dev, ulong rate)

drivers/net/macb.c static int macb_sifive_clk_init(struct udevice *dev, ulong rate) · line 596

Quoted 6 lines
drivers/net/macb.c +2 -1
         *     and output clock on GMII output signal GTX_CLK
         * 1 = MII mode. Use MII input signal TX_CLK in TX logic
         */
-       writel(rate != 125000000, gemgxl_regs);
+       if (device_is_compatible(dev, "sifive,fu540-c000-gem"))
+               writel(rate != 125000000, gemgxl_regs);

Could you add a comment here why we need this? (i.e. about the HW quirk) Note that 125.125 is actually outside of specification for VSC8541XMV-02.

Thanks, David. I'll add the comment for it.

Quoted 18 lines
drivers/net/macb.c +5 -1
+       else if (device_is_compatible(dev, "sifive,fu740-c000-gem"))
+               writel(rate != 125125000, gemgxl_regs);
+
        return 0;
 }
 
@@ -1507,6 +1511,8 @@ static const struct udevice_id macb_eth_ids[] = {
        { .compatible = "cdns,zynq-gem" },
        { .compatible = "sifive,fu540-c000-gem",
          .data = (ulong)&sifive_config },
+       { .compatible = "sifive,fu740-c000-gem",
+         .data = (ulong)&sifive_config },
        { .compatible = "microchip,mpfs-mss-gem",
          .data = (ulong)&microchip_config },
        { }
--

2.7.4