Skip to contentSkip to conversation

mmc: openpiton: add piton_mmc driver

PATCH Superseded Tianrui Wei 2 participants 3 messages Jun 30, 2021 1 message not in the archive

Subsystems (2)

v9 of 11 Superseded Latest is v11 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v9 1/2 board: riscv: add openpiton-riscv64 SoC support

This patch adds openpiton-riscv64 SOC support. In particular, this board supports a standard bootflow through zsbl->u-boot SPL-> opensbi->u-boot proper->Linux. There are separate defconfigs for building u-boot SPL and u-boot proper

---
 arch/riscv/Kconfig                          |   4 +
 arch/riscv/dts/Makefile                     |   1 +
 arch/riscv/dts/openpiton-riscv64.dts        | 153 ++++++++
 board/openpiton/riscv64/Kconfig             |  40 +++
 board/openpiton/riscv64/MAINTAINERS         |   8 +
 board/openpiton/riscv64/Makefile            |   5 +
 board/openpiton/riscv64/openpiton-riscv64.c |  33 ++
 configs/openpiton_riscv64_defconfig         |  76 ++++
 configs/openpiton_riscv64_spl_defconfig     |  87 +++++
 doc/board/index.rst                         |   1 +
 doc/board/openpiton/index.rst               |   9 +
 doc/board/openpiton/riscv64.rst             | 376 ++++++++++++++++++++
 include/configs/openpiton-riscv64.h         |  61 ++++
 13 files changed, 854 insertions(+)
 create mode 100644 arch/riscv/dts/openpiton-riscv64.dts
 create mode 100644 board/openpiton/riscv64/Kconfig
 create mode 100644 board/openpiton/riscv64/MAINTAINERS
 create mode 100644 board/openpiton/riscv64/Makefile
 create mode 100644 board/openpiton/riscv64/openpiton-riscv64.c
 create mode 100644 configs/openpiton_riscv64_defconfig
 create mode 100644 configs/openpiton_riscv64_spl_defconfig
 create mode 100644 doc/board/openpiton/index.rst
 create mode 100644 doc/board/openpiton/riscv64.rst
 create mode 100644 include/configs/openpiton-riscv64.h
arch/riscv/Kconfig +4 -0
index b3d7fd84ce..4b0c3dffa6 100644
@@ -26,6 +26,9 @@ config TARGET_SIFIVE_UNMATCHED
 config TARGET_SIPEED_MAIX
 	bool "Support Sipeed Maix Board"
 
+config TARGET_OPENPITON_RISCV64
+	bool "Support RISC-V cores on OpenPiton SoC"
+
 endchoice
 
 config SYS_ICACHE_OFF
@@ -60,6 +63,7 @@ source "board/emulation/qemu-riscv/Kconfig"
 source "board/microchip/mpfs_icicle/Kconfig"
 source "board/sifive/unleashed/Kconfig"
 source "board/sifive/unmatched/Kconfig"
+source "board/openpiton/riscv64/Kconfig"
 source "board/sipeed/maix/Kconfig"
 
 # platform-specific options below
arch/riscv/dts/Makefile +1 -0
index 7778874831..b6e9166767 100644
@@ -3,6 +3,7 @@
 dtb-$(CONFIG_TARGET_AX25_AE350) += ae350_32.dtb ae350_64.dtb
 dtb-$(CONFIG_TARGET_MICROCHIP_ICICLE) += microchip-mpfs-icicle-kit.dtb
 dtb-$(CONFIG_TARGET_QEMU_VIRT) += qemu-virt.dtb
+dtb-$(CONFIG_TARGET_OPENPITON_RISCV64) += openpiton-riscv64.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
arch/riscv/dts/openpiton-riscv64.dts new file +153 -0

153 lines not on this page · raw message

board/openpiton/riscv64/Kconfig new file +40 -0
new file mode 100644
index 0000000000..193c890046
@@ -0,0 +1,40 @@
+if TARGET_OPENPITON_RISCV64
+
+config SYS_BOARD
+	default "riscv64"
+
+config SYS_VENDOR
+	default "openpiton"
+
+config SYS_CPU
+	default "generic"
+
+config SYS_CONFIG_NAME
+	default "openpiton-riscv64"
+
+config SYS_TEXT_BASE
+	default 0x81000000 if SPL
+	default 0x80000000 if !RISCV_SMODE
+	default 0x81000000 if RISCV_SMODE
+
+config SPL_TEXT_BASE
+	default 0x82000000
+
+config SPL_OPENSBI_LOAD_ADDR
+	default 0x80000000
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+	def_bool y
+	select ARCH_EARLY_INIT_R
+	select SUPPORT_SPL
+	imply CPU_RISCV
+	imply RISCV_TIMER
+	imply SPL_SIFIVE_CLINT
+	imply CMD_CPU
+	imply SPL_CPU_SUPPORT
+	imply SPL_SMP
+	imply SPL_MMC
+	imply SMP
+	imply SPL_RISCV_MMODE
+
+endif
board/openpiton/riscv64/MAINTAINERS new file +8 -0
new file mode 100644
index 0000000000..f91c000c83
@@ -0,0 +1,8 @@
+Openpiton BOARD
+M:	Tianrui Wei<[email protected]>
+S:	Maintained
+F:	board/openpiton/riscv64/
+F:	include/configs/openpiton-riscv64.h
+F:	configs/openpiton_riscv64_defconfig
+F:	configs/openpiton_riscv64_spl_defconfig
+F:  drivers/mmc/piton_mmc.c
board/openpiton/riscv64/Makefile new file +5 -0
new file mode 100644
index 0000000000..3bffa75a9a
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2021 Tianrui Wei
+# Tianrui Wei <[email protected]>
+obj-y += openpiton-riscv64.o
board/openpiton/riscv64/openpiton-riscv64.c new file +33 -0
new file mode 100644
index 0000000000..f2282d1548
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2019 SiFive, Inc
+ * Copyright (c) 2021 Tianrui Wei
+ *
+ *
+ * Authors:
+ *   Pragnesh Patel <[email protected]>
+ *   Tianrui Wei <[email protected]>
+ */
+#include <common.h>
+#include <init.h>
+#include <configs/openpiton-riscv64.h>
+#include <dm.h>
+#include <spl.h>
+
+#ifdef CONFIG_SPL
+void board_boot_order(u32 *spl_boot_list)
+{
+	u8 i;
+	u32 boot_devices[] = {
+		BOOT_DEVICE_MMC1,
+	};
+
+	for (i = 0; i < ARRAY_SIZE(boot_devices); i++)
+		spl_boot_list[i] = boot_devices[i];
+}
+#endif
+
+int board_init(void)
+{
+		return 0;
+}
configs/openpiton_riscv64_defconfig new file +76 -0

76 lines not on this page · raw message

configs/openpiton_riscv64_spl_defconfig new file +87 -0

87 lines not on this page · raw message

doc/board/index.rst +1 -0
index 747511f7dd..6fc0442eda 100644
@@ -19,6 +19,7 @@ Board-specific doc
    intel/index
    kontron/index
    microchip/index
+   openpiton/index
    rockchip/index
    sifive/index
    sipeed/index
doc/board/openpiton/index.rst new file +9 -0
new file mode 100644
index 0000000000..c469102c4b
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+OpenPiton
+=========
+
+.. toctree::
+   :maxdepth: 2
+
+   riscv64
doc/board/openpiton/riscv64.rst new file +376 -0

376 lines not on this page · raw message

include/configs/openpiton-riscv64.h new file +61 -0

61 lines not on this page · raw message

Signature · 1 line
2.32.0
Reviewed-by on v9 1/2
#2 lore raw

Re: [PATCH v9 1/2] board: riscv: add openpiton-riscv64 SoC support

Quoted 24 lines · Tianrui Wei

This patch adds openpiton-riscv64 SOC support. In particular, this board supports a standard bootflow through zsbl->u-boot SPL-> opensbi->u-boot proper->Linux. There are separate defconfigs for building u-boot SPL and u-boot proper

---
 arch/riscv/Kconfig                          |   4 +
 arch/riscv/dts/Makefile                     |   1 +
 arch/riscv/dts/openpiton-riscv64.dts        | 153 ++++++++
 board/openpiton/riscv64/Kconfig             |  40 +++
 board/openpiton/riscv64/MAINTAINERS         |   8 +
 board/openpiton/riscv64/Makefile            |   5 +
 board/openpiton/riscv64/openpiton-riscv64.c |  33 ++
 configs/openpiton_riscv64_defconfig         |  76 ++++
 configs/openpiton_riscv64_spl_defconfig     |  87 +++++
 doc/board/index.rst                         |   1 +
 doc/board/openpiton/index.rst               |   9 +
 doc/board/openpiton/riscv64.rst             | 376 ++++++++++++++++++++
 include/configs/openpiton-riscv64.h         |  61 ++++
 13 files changed, 854 insertions(+)
 create mode 100644 arch/riscv/dts/openpiton-riscv64.dts
 create mode 100644 board/openpiton/riscv64/Kconfig
Quoted 8 lines
 create mode 100644 board/openpiton/riscv64/MAINTAINERS
 create mode 100644 board/openpiton/riscv64/Makefile
 create mode 100644 board/openpiton/riscv64/openpiton-riscv64.c
 create mode 100644 configs/openpiton_riscv64_defconfig
 create mode 100644 configs/openpiton_riscv64_spl_defconfig
 create mode 100644 doc/board/openpiton/index.rst
 create mode 100644 doc/board/openpiton/riscv64.rst
 create mode 100644 include/configs/openpiton-riscv64.h
#3 lore raw

PATCH v9 2/2 mmc: openpiton: add piton_mmc driver

In reply to a message not in the archive

This commit adds support to piton_mmc driver for OpenPiton-riscv64 This driver has many things set as preconfigured because the hardware automatically configures most of the settings during startup.

---
 drivers/mmc/Kconfig     |   9 +++
 drivers/mmc/Makefile    |   1 +
 drivers/mmc/piton_mmc.c | 161 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 171 insertions(+)
 create mode 100644 drivers/mmc/piton_mmc.c
drivers/mmc/Kconfig +9 -0
index 0909f502a1..d0176175e8 100644
@@ -727,6 +727,15 @@ config MMC_SUNXI_HAS_MODE_SWITCH
 	bool
 	depends on MMC_SUNXI
 
+config MMC_PITON
+	bool "MMC support for OpenPiton SoC"
+	depends on DM_MMC && BLK
+	help
+	  This selects support for the SD host controller on OpenPiton SoC.
+	  Note that this SD controller directly exposes the contents of the
+	  SD card as memory mapped, so there is no manual configuration
+	  required
+
 config GENERIC_ATMEL_MCI
 	bool "Atmel Multimedia Card Interface support"
 	depends on DM_MMC && BLK && ARCH_AT91
drivers/mmc/Makefile +1 -0
index 89d6af3db3..d96ac90719 100644
@@ -72,6 +72,7 @@ obj-$(CONFIG_MMC_SDHCI_XENON)		+= xenon_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_ZYNQ)		+= zynq_sdhci.o
 
 obj-$(CONFIG_MMC_SUNXI)			+= sunxi_mmc.o
+obj-$(CONFIG_MMC_PITON)			+= piton_mmc.o
 obj-$(CONFIG_MMC_UNIPHIER)		+= tmio-common.o uniphier-sd.o
 obj-$(CONFIG_RENESAS_SDHI)		+= tmio-common.o renesas-sdhi.o
 obj-$(CONFIG_MMC_BCM2835)		+= bcm2835_sdhost.o
drivers/mmc/piton_mmc.c new file +161 -0

161 lines not on this page · raw message

Signature · 1 line
2.32.0