From f90d7f9882001029b5238c75b8c3f56ee605ed72 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Fri, 24 Mar 2023 14:25:29 +0100 Subject: ARM: dts: rk356x: Add DMC controller node There's currently no DMC controller node in the upstream dtsi file. Add one until it's there. Signed-off-by: Sascha Hauer --- arch/arm/dts/rk356x.dtsi | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'arch/arm/dts') diff --git a/arch/arm/dts/rk356x.dtsi b/arch/arm/dts/rk356x.dtsi index 6a9cd14d2d..4de2404b50 100644 --- a/arch/arm/dts/rk356x.dtsi +++ b/arch/arm/dts/rk356x.dtsi @@ -6,4 +6,9 @@ barebox,bootsource-mmc1 = &sdmmc0; barebox,bootsource-mmc2 = &sdmmc1; }; + + dmc: memory-controller { + compatible = "rockchip,rk3568-dmc"; + rockchip,pmu = <&pmugrf>; + }; }; -- cgit v1.2.3 From 7bf493b1a646e1ee2e88cc7d41b462a6714eafee Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Thu, 30 Mar 2023 18:11:01 +0200 Subject: arm: rockchip: add support for CM3 on IO board Working: - RKBIN DDR training (rk3566_ddr_1056MHz_v1.13.bin) - RKBIN TF-A (v1.34) from RKBIN - Environment storage - DHCP, ping and link detection Signed-off-by: Rouven Czerwinski Link: https://lore.barebox.org/20230330161101.58529-1-r.czerwinski@pengutronix.de Signed-off-by: Sascha Hauer --- Documentation/boards/rockchip.rst | 1 + arch/arm/boards/Makefile | 1 + arch/arm/boards/radxa-cm3/.gitignore | 1 + arch/arm/boards/radxa-cm3/Makefile | 3 ++ arch/arm/boards/radxa-cm3/board.c | 56 ++++++++++++++++++++++++++++++++++++ arch/arm/boards/radxa-cm3/lowlevel.c | 32 +++++++++++++++++++++ arch/arm/dts/Makefile | 1 + arch/arm/dts/rk3566-cm3-io.dts | 50 ++++++++++++++++++++++++++++++++ arch/arm/mach-rockchip/Kconfig | 6 ++++ images/Makefile.rockchip | 7 +++++ 10 files changed, 158 insertions(+) create mode 100644 arch/arm/boards/radxa-cm3/.gitignore create mode 100644 arch/arm/boards/radxa-cm3/Makefile create mode 100644 arch/arm/boards/radxa-cm3/board.c create mode 100644 arch/arm/boards/radxa-cm3/lowlevel.c create mode 100644 arch/arm/dts/rk3566-cm3-io.dts (limited to 'arch/arm/dts') diff --git a/Documentation/boards/rockchip.rst b/Documentation/boards/rockchip.rst index 0e8738bbf1..583b4f1720 100644 --- a/Documentation/boards/rockchip.rst +++ b/Documentation/boards/rockchip.rst @@ -60,6 +60,7 @@ Supported Boards - Rockchip RK3568 Bananapi R2 Pro - Pine64 Quartz64 Model A - Radxa ROCK3 Model A +- Radxa CM3 (RK3566) IO Board The steps described in the following target the RK3568 and the RK3568 EVB but generally apply to both SoCs and all boards. diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile index 37b1650e63..b204c257f6 100644 --- a/arch/arm/boards/Makefile +++ b/arch/arm/boards/Makefile @@ -190,3 +190,4 @@ obj-$(CONFIG_MACH_RK3568_BPI_R2PRO) += rockchip-rk3568-bpi-r2pro/ obj-$(CONFIG_MACH_PINE64_QUARTZ64) += pine64-quartz64/ obj-$(CONFIG_MACH_RADXA_ROCK3) += radxa-rock3/ obj-$(CONFIG_MACH_VARISCITE_DT8MCUSTOMBOARD_IMX8MP) += variscite-dt8mcustomboard-imx8mp/ +obj-$(CONFIG_MACH_RADXA_CM3) += radxa-cm3/ diff --git a/arch/arm/boards/radxa-cm3/.gitignore b/arch/arm/boards/radxa-cm3/.gitignore new file mode 100644 index 0000000000..f458f794b5 --- /dev/null +++ b/arch/arm/boards/radxa-cm3/.gitignore @@ -0,0 +1 @@ +sdram-init.bin diff --git a/arch/arm/boards/radxa-cm3/Makefile b/arch/arm/boards/radxa-cm3/Makefile new file mode 100644 index 0000000000..b37b6c870b --- /dev/null +++ b/arch/arm/boards/radxa-cm3/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only +obj-y += board.o +lwl-y += lowlevel.o diff --git a/arch/arm/boards/radxa-cm3/board.c b/arch/arm/boards/radxa-cm3/board.c new file mode 100644 index 0000000000..14b6784179 --- /dev/null +++ b/arch/arm/boards/radxa-cm3/board.c @@ -0,0 +1,56 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include +#include +#include +#include +#include + +struct cm3_model { + const char *name; + const char *shortname; +}; + +static int cm3_probe(struct device *dev) +{ + enum bootsource bootsource = bootsource_get(); + int instance = bootsource_get_instance(); + const struct cm3_model *model; + + model = device_get_match_data(dev); + + barebox_set_model(model->name); + barebox_set_hostname(model->shortname); + + if (bootsource == BOOTSOURCE_MMC && instance == 1) + of_device_enable_path("/chosen/environment-sd"); + else + of_device_enable_path("/chosen/environment-emmc"); + + rk3568_bbu_mmc_register("emmc", BBU_HANDLER_FLAG_DEFAULT, + "/dev/mmc0"); + rk3568_bbu_mmc_register("sd", 0, "/dev/mmc1"); + + return 0; +} + +static const struct cm3_model cm3_io = { + .name = "Radxa CM3 on IO Board", + .shortname = "cm3-io", +}; + +static const struct of_device_id cm3_of_match[] = { + { + .compatible = "radxa,cm3-io", + .data = &cm3_io, + }, + { /* sentinel */ }, +}; + +static struct driver cm3_io_board_driver = { + .name = "board-cm3-io", + .probe = cm3_probe, + .of_compatible = cm3_of_match, +}; +coredevice_platform_driver(cm3_io_board_driver); + +BAREBOX_DEEP_PROBE_ENABLE(cm3_of_match); diff --git a/arch/arm/boards/radxa-cm3/lowlevel.c b/arch/arm/boards/radxa-cm3/lowlevel.c new file mode 100644 index 0000000000..e1b453f21f --- /dev/null +++ b/arch/arm/boards/radxa-cm3/lowlevel.c @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include +#include +#include +#include +#include + +extern char __dtb_rk3566_cm3_io_start[]; + +ENTRY_FUNCTION(start_radxa_cm3_io, r0, r1, r2) +{ + /* + * Enable vccio4 1.8V and vccio6 1.8V + * Needed for GMAC to work. + * FIXME: This is done by the io-domain driver as well, but there + * currently is no mechanism to make sure the driver gets probed + * before its consumers. Remove this setup once this issue is + * resolved. + */ + writel(RK_SETBITS(0x50), 0xfdc20140); + + putc_ll('>'); + + if (current_el() == 3) + relocate_to_adr_full(RK3568_BAREBOX_LOAD_ADDRESS); + else + relocate_to_current_adr(); + + setup_c(); + + rk3568_barebox_entry(__dtb_rk3566_cm3_io_start); +} diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 0a7cceb461..220e1617e3 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -109,6 +109,7 @@ lwl-$(CONFIG_MACH_PROTONIC_STM32MP1) += \ stm32mp151-prtt1s.dtb.o lwl-$(CONFIG_MACH_RADXA_ROCK) += rk3188-radxarock.dtb.o lwl-$(CONFIG_MACH_RADXA_ROCK3) += rk3568-rock-3a.dtb.o +lwl-$(CONFIG_MACH_RADXA_CM3) += rk3566-cm3-io.dtb.o lwl-$(CONFIG_MACH_PHYTEC_SOM_RK3288) += rk3288-phycore-som.dtb.o lwl-$(CONFIG_MACH_REALQ7) += imx6q-dmo-edmqmx6.dtb.o lwl-$(CONFIG_MACH_RK3568_EVB) += rk3568-evb1-v10.dtb.o diff --git a/arch/arm/dts/rk3566-cm3-io.dts b/arch/arm/dts/rk3566-cm3-io.dts new file mode 100644 index 0000000000..39cef5e797 --- /dev/null +++ b/arch/arm/dts/rk3566-cm3-io.dts @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include +#include "rk356x.dtsi" + +/ { + chosen: chosen { + environment-sd { + compatible = "barebox,environment"; + device-path = &environment_sd; + status = "disabled"; + }; + + environment-emmc { + compatible = "barebox,environment"; + device-path = &environment_emmc; + status = "disabled"; + }; + }; +}; + +&sdhci { + no-sd; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <2>; + #size-cells = <2>; + + environment_emmc: partition@408000 { + label = "barebox-environment"; + reg = <0x0 0x408000 0x0 0x8000>; + }; + }; +}; + +&sdmmc0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <2>; + #size-cells = <2>; + + environment_sd: partition@408000 { + label = "barebox-environment"; + reg = <0x0 0x408000 0x0 0x8000>; + }; + }; +}; diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig index 4ac75ab947..c087783b18 100644 --- a/arch/arm/mach-rockchip/Kconfig +++ b/arch/arm/mach-rockchip/Kconfig @@ -86,6 +86,12 @@ config MACH_RADXA_ROCK3 help Say Y here if you are using a Radxa ROCK3 +config MACH_RADXA_CM3 + select ARCH_RK3568 + bool "Radxa CM3" + help + Say Y here if you are using a Radxa CM3 + comment "select board features:" config ARCH_ROCKCHIP_ATF diff --git a/images/Makefile.rockchip b/images/Makefile.rockchip index 33c76caf79..490e1ddb4d 100644 --- a/images/Makefile.rockchip +++ b/images/Makefile.rockchip @@ -23,6 +23,9 @@ image-$(CONFIG_MACH_PINE64_QUARTZ64) += barebox-quartz64a.img pblb-$(CONFIG_MACH_RADXA_ROCK3) += start_rock3a image-$(CONFIG_MACH_RADXA_ROCK3) += barebox-rock3a.img +pblb-$(CONFIG_MACH_RADXA_CM3) += start_radxa-cm3-io.img +image-$(CONFIG_MACH_RADXA_CM3) += barebox-radxa-cm3-io.img + quiet_cmd_rkimg_image = RK-IMG $@ cmd_rkimg_image = $(objtree)/scripts/rkimage -o $@ $(word 2,$^) $(word 1,$^) @@ -41,3 +44,7 @@ $(obj)/barebox-quartz64a.img: $(obj)/start_quartz64a.pblb \ $(obj)/barebox-rock3a.img: $(obj)/start_rock3a.pblb \ $(board)/radxa-rock3/sdram-init.bin $(call if_changed,rkimg_image) + +$(obj)/barebox-radxa-cm3-io.img: $(obj)/start_radxa_cm3_io.pblb \ + $(board)/radxa-cm3/sdram-init.bin + $(call if_changed,rkimg_image) -- cgit v1.2.3