Skip to content

Commit

Permalink
Merge branch 'for-next/rockchip' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
saschahauer committed Apr 25, 2024
2 parents caa37a5 + 69bfc54 commit 6db8485
Show file tree
Hide file tree
Showing 28 changed files with 1,162 additions and 367 deletions.
1 change: 1 addition & 0 deletions arch/arm/boards/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,4 @@ obj-$(CONFIG_MACH_RADXA_ROCK5) += radxa-rock5/
obj-$(CONFIG_MACH_VARISCITE_DT8MCUSTOMBOARD_IMX8MP) += variscite-dt8mcustomboard-imx8mp/
obj-$(CONFIG_MACH_RADXA_CM3) += radxa-cm3/
obj-$(CONFIG_MACH_TQMA93XX) += tqma93xx/
obj-$(CONFIG_MACH_WOLFVISION_PF5) += wolfvision-pf5/
6 changes: 3 additions & 3 deletions arch/arm/boards/radxa-cm3/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ static int cm3_probe(struct device *dev)
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");
rockchip_bbu_mmc_register("emmc", BBU_HANDLER_FLAG_DEFAULT,
"/dev/mmc0");
rockchip_bbu_mmc_register("sd", 0, "/dev/mmc1");

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/boards/radxa-rock3/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ static int rock3_probe(struct device *dev)
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");
rockchip_bbu_mmc_register("emmc", BBU_HANDLER_FLAG_DEFAULT, "/dev/mmc0");
rockchip_bbu_mmc_register("sd", 0, "/dev/mmc1");

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/boards/radxa-rock5/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ static int rock5_probe(struct device *dev)
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");
rockchip_bbu_mmc_register("emmc", BBU_HANDLER_FLAG_DEFAULT, "/dev/mmc0");
rockchip_bbu_mmc_register("sd", 0, "/dev/mmc1");

return 0;
}
Expand Down
5 changes: 2 additions & 3 deletions arch/arm/boards/rockchip-rk3568-bpi-r2pro/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ static int rk3568_bpi_r2pro_probe(struct device *dev)
else
of_device_enable_path("/chosen/environment-emmc");

rk3568_bbu_mmc_register("sd", 0, "/dev/mmc0");
rk3568_bbu_mmc_register("emmc", BBU_HANDLER_FLAG_DEFAULT,
"/dev/mmc1");
rockchip_bbu_mmc_register("sd", 0, "/dev/mmc0");
rockchip_bbu_mmc_register("emmc", BBU_HANDLER_FLAG_DEFAULT, "/dev/mmc1");

return 0;
}
Expand Down
5 changes: 2 additions & 3 deletions arch/arm/boards/rockchip-rk3568-evb/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ static int rk3568_evb_probe(struct device *dev)
else
of_device_enable_path("/chosen/environment-emmc");

rk3568_bbu_mmc_register("sd", 0, "/dev/mmc0");
rk3568_bbu_mmc_register("emmc", BBU_HANDLER_FLAG_DEFAULT,
"/dev/mmc1");
rockchip_bbu_mmc_register("sd", 0, "/dev/mmc0");
rockchip_bbu_mmc_register("emmc", BBU_HANDLER_FLAG_DEFAULT, "/dev/mmc1");

return 0;
}
Expand Down
1 change: 1 addition & 0 deletions arch/arm/boards/wolfvision-pf5/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sdram-init.bin
3 changes: 3 additions & 0 deletions arch/arm/boards/wolfvision-pf5/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-y += board.o
lwl-y += lowlevel.o
88 changes: 88 additions & 0 deletions arch/arm/boards/wolfvision-pf5/board.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Board code for the WolfVision PF5 mainboard.
*
* Copyright (C) 2024 WolfVision GmbH.
*/
#include <common.h>
#include <deep-probe.h>
#include <globalvar.h>
#include <init.h>

#include <boards/wolfvision/common.h>
#include <mach/rockchip/bbu.h>

#define PF5_IO_EXPANDER_FILENAME "rk3568-wolfvision-pf5-io-expander.dtbo"
#define PF5_IO_EXPANDER_DATA __dtbo_rk3568_wolfvision_pf5_io_expander_start

enum {
PF5_HWID_CHANNEL_MAINBOARD = 1,
PF5_HWID_CHANNEL_MODULE = 2,
};

extern char PF5_IO_EXPANDER_DATA[];

static const struct wv_rk3568_extension pf5_extensions[] = {
{
.adc_chan = PF5_HWID_CHANNEL_MAINBOARD,
.name = "mainboard",
.overlays = {
[0] = { .name = "PF5 DC V1.0 A", },
[4] = { .name = "PF5 DC V1.1 A", },
},
},
{
.adc_chan = PF5_HWID_CHANNEL_MODULE,
.name = "module",
.overlays = {
[0] = { .name = "PF5 IO Expander V1.0 A",
.filename = PF5_IO_EXPANDER_FILENAME,
.data = PF5_IO_EXPANDER_DATA,
},
[16] = { .name = "no", },
},
},
};

static int pf5_probe(struct device *dev)
{
char *pf5_overlays = NULL;
int ret;

barebox_set_model("WolfVision PF5");
barebox_set_hostname("PF5");

ret = wolfvision_register_ethaddr();
if (ret)
pr_warning("failed to register MAC addresses\n");

rk3568_bbu_mmc_register("emmc", BBU_HANDLER_FLAG_DEFAULT, "/dev/mmc0");

ret = wolfvision_rk3568_detect_hw(
pf5_extensions, ARRAY_SIZE(pf5_extensions), &pf5_overlays);
if (ret)
pr_warning("failed to detect HW\n");

if (pf5_overlays)
globalvar_set("of.overlay.filepattern", pf5_overlays);

free(pf5_overlays);

return 0;
}

static const struct of_device_id pf5_of_match[] = {
{
.compatible = "wolfvision,rk3568-pf5",
},
{ /* sentinel */ },
};

static struct driver_d pf5_board_driver = {
.name = "board-wolfvision-pf5",
.probe = pf5_probe,
.of_compatible = pf5_of_match,
};
coredevice_platform_driver(pf5_board_driver);

BAREBOX_DEEP_PROBE_ENABLE(pf5_of_match);
36 changes: 36 additions & 0 deletions arch/arm/boards/wolfvision-pf5/lowlevel.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <common.h>
#include <linux/sizes.h>
#include <asm/barebox-arm-head.h>
#include <asm/barebox-arm.h>
#include <mach/rockchip/hardware.h>
#include <mach/rockchip/atf.h>
#include <debug_ll.h>
#include <mach/rockchip/rockchip.h>

extern char __dtb_rk3568_wolfvision_pf5_start[];

ENTRY_FUNCTION(start_rk3568_wolfvision_pf5, r0, r1, r2)
{
/*
* Enable vccio4 1.8V and vccio5 1.8V
* 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(0x30), 0xfdc20140);

/*
* Image execution starts at 0x0, but this is used for ATF and
* OP-TEE later, so move away from here.
*/
if (current_el() == 3)
relocate_to_adr_full(RK3568_BAREBOX_LOAD_ADDRESS);
else
relocate_to_current_adr();

setup_c();

rk3568_barebox_entry(__dtb_rk3568_wolfvision_pf5_start);
}
3 changes: 3 additions & 0 deletions arch/arm/dts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ lwl-$(CONFIG_MACH_WARP7) += imx7s-warp.dtb.o
lwl-$(CONFIG_MACH_VF610_TWR) += vf610-twr.dtb.o
lwl-$(CONFIG_MACH_WEBASTO_CCBV2) += imx6ul-webasto-ccbv2.dtb.o
lwl-$(CONFIG_MACH_WEBASTO_CCBV2) += imx6ul-webasto-marvel.dtb.o
lwl-$(CONFIG_MACH_WOLFVISION_PF5) += rk3568-wolfvision-pf5.dtb.o
lwl-$(CONFIG_MACH_ZII_RDU1) += \
imx51-zii-rdu1.dtb.o \
imx51-zii-scu2-mezz.dtb.o \
Expand Down Expand Up @@ -230,4 +231,6 @@ lwl-$(CONFIG_MACH_VARISCITE_DT8MCUSTOMBOARD_IMX8MP) += imx8mp-var-dart-dt8mcusto
lwl-$(CONFIG_MACH_TQMA93XX) += imx93-tqma9352-mba93xxca.dtb.o \
imx93-tqma9352-mba93xxla.dtb.o

obj-$(CONFIG_MACH_WOLFVISION_PF5) += rk3568-wolfvision-pf5-io-expander.dtbo.o

clean-files := *.dtb *.dtb.S .*.dtc .*.pre .*.dts *.dtb.z
137 changes: 137 additions & 0 deletions arch/arm/dts/rk3568-wolfvision-pf5-io-expander-upstream.dtso
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
// SPDX-License-Identifier: (GPL-2.0-or-later OR MIT)
/*
* Device tree overlay for the WolfVision PF5 IO Expander board.
*
* Copyright (C) 2024 WolfVision GmbH.
*/

/dts-v1/;
/plugin/;

#include <dt-bindings/clock/rk3568-cru.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/pinctrl/rockchip.h>

&{/} {
gmac0_clkin: external-gmac0-clock {
compatible = "fixed-clock";
clock-frequency = <50000000>;
clock-output-names = "gmac0_clkin";
#clock-cells = <0>;
};

usb_host_vbus: usb-host-vbus-regulator {
compatible = "regulator-fixed";
enable-active-high;
gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&usb_host_vbus_en>;
regulator-name = "usb_host_vbus";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
vin-supply = <&vcc5v_in>;
};

vcc1v8_eth: vcc1v8-eth-regulator {
compatible = "regulator-fixed";
enable-active-high;
gpio = <&gpio0 RK_PC1 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&vcc1v8_eth_en>;
regulator-always-on;
regulator-boot-on;
regulator-name = "1v8_eth";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
vin-supply = <&vcc3v3_sys>;
};

vcc3v3_eth: vcc3v3-eth-regulator {
compatible = "regulator-fixed";
enable-active-low;
gpio = <&gpio0 RK_PC0 GPIO_ACTIVE_LOW>;
pinctrl-names = "default";
pinctrl-0 = <&vcc3v3_eth_enn>;
regulator-always-on;
regulator-boot-on;
regulator-name = "3v3_eth";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
vin-supply = <&vcc3v3_sys>;
};
};

&gmac0 {
assigned-clocks = <&cru SCLK_GMAC0_RX_TX>,
<&cru SCLK_GMAC0>;
assigned-clock-parents = <&cru SCLK_GMAC0_RMII_SPEED>,
<&gmac0_clkin>;
clock_in_out = "input";
phy-handle = <&dp83826>;
phy-mode = "rmii";
phy-supply = <&vcc3v3_eth>;
pinctrl-names = "default";
pinctrl-0 = <&gmac0_miim
&gmac0_clkinout
&gmac0_rx_er
&gmac0_rx_bus2
&gmac0_tx_bus2>;
status = "okay";
};

&mdio0 {
#address-cells = <1>;
#size-cells = <0>;

dp83826: ethernet-phy@0 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <0x0>;
interrupt-parent = <&gpio0>;
interrupts = <RK_PD3 IRQ_TYPE_EDGE_FALLING>;
pinctrl-names = "default";
pinctrl-0 = <&eth_wake_intn &eth_phy_rstn>;
reset-assert-us = <1000>;
reset-deassert-us = <2000>;
reset-gpios = <&gpio0 RK_PD4 GPIO_ACTIVE_LOW>;
wakeup-source;
};
};

&pinctrl {
ethernet {
eth_wake_intn: eth-wake-intn-pinctrl {
rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
};

eth_phy_rstn: eth-phy-rstn-pinctrl {
rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
};

vcc1v8_eth_en: vcc1v8-eth-en-pinctrl {
rockchip,pins = <0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
};

vcc3v3_eth_enn: vcc3v3-eth-enn-pinctrl {
rockchip,pins = <0 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>;
};
};

usb {
usb_host_vbus_en: usb-host-vbus-en-pinctrl {
rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
};

&usb_host1_xhci {
maximum-speed = "high-speed";
phys = <&usb2phy0_host>;
phy-names = "usb2-phy";
status = "okay";
};

&usb2phy0_host {
phy-supply = <&usb_host_vbus>;
status = "okay";
};
11 changes: 11 additions & 0 deletions arch/arm/dts/rk3568-wolfvision-pf5-io-expander.dtso
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: (GPL-2.0-or-later OR MIT)
/*
* Device tree overlay for the WolfVision PF5 IO Expander board.
*
* Copyright (C) 2024 WolfVision GmbH.
*/

/dts-v1/;
/plugin/;

#include "rk3568-wolfvision-pf5-io-expander-upstream.dtso"
Loading

0 comments on commit 6db8485

Please sign in to comment.