Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
201 changes: 201 additions & 0 deletions arch/arm/dts/rk3588-rock-5t-industrial.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
* Copyright (c) 2024 Rockchip Electronics Co., Ltd.
* Copyright (c) 2024 Radxa Computer (Shenzhen) Co., Ltd.
*
*/

/dts-v1/;
#include "rk3588.dtsi"
#include "rk3588-u-boot.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/phy/phy-snps-pcie3.h>

/ {
model = "Radxa ROCK 5T Industrial";
compatible = "radxa,rock-5t-industrial", "rockchip,rk3588";

vcc12v_dcin: vcc12v-dcin {
u-boot,dm-pre-reloc;
compatible = "regulator-fixed";
regulator-name = "vcc12v_dcin";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <12000000>;
regulator-max-microvolt = <12000000>;
};

vcc5v0_sys: vcc5v0-sys {
u-boot,dm-pre-reloc;
compatible = "regulator-fixed";
regulator-name = "vcc5v0_sys";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
vin-supply = <&vcc12v_dcin>;
};

led_sys: led-sys {
u-boot,dm-pre-reloc;
compatible = "regulator-fixed";
regulator-name = "led_sys";
enable-active-high;
gpio = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>;
regulator-boot-on;
regulator-always-on;
vin-supply = <&vcc5v0_sys>;
};

adc-keys {
compatible = "adc-keys";
io-channels = <&saradc 1>;
io-channel-names = "buttons";
keyup-threshold-microvolt = <1800000>;
u-boot,dm-pre-reloc;
status = "okay";

volumeup-key {
u-boot,dm-pre-reloc;
linux,code = <KEY_VOLUMEUP>;
label = "volume up";
press-threshold-microvolt = <1750>;
};
};

vcc3v3_pcie30: vcc3v3-pcie30 {
u-boot,dm-pre-reloc;
compatible = "regulator-fixed";
regulator-name = "vcc3v3_pcie30";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
enable-active-high;
gpio = <&gpio1 RK_PA4 GPIO_ACTIVE_HIGH>;
regulator-boot-on;
regulator-always-on;
vin-supply = <&vcc5v0_sys>;
};

vcc5v0_host: vcc5v0-host-regulator {
u-boot,dm-pre-reloc;
compatible = "regulator-fixed";
regulator-name = "vcc5v0_host";
regulator-boot-on;
regulator-always-on;
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
enable-active-high;
gpio = <&gpio1 RK_PA1 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&vcc5v0_host_en>;
vin-supply = <&vcc5v0_sys>;
};
};

&pcie3x4 {
u-boot,dm-pre-reloc;
reset-gpios = <&gpio4 RK_PB6 GPIO_ACTIVE_HIGH>;
num-lanes = <2>;
vpcie3v3-supply = <&vcc3v3_pcie30>;
status = "okay";
};

&pcie3x2 {
u-boot,dm-pre-reloc;
reset-gpios = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>;
vpcie3v3-supply = <&vcc3v3_pcie30>;
status = "okay";
};

&pcie30phy {
u-boot,dm-pre-reloc;
rockchip,pcie30-phymode = <PHY_MODE_PCIE_NANBNB>;
status = "okay";
};


/*******************
* grf models
********************/
&usb2phy2_grf {
u-boot,dm-pre-reloc;
status = "okay";
};

&usb2phy3_grf {
u-boot,dm-pre-reloc;
status = "okay";
};

/*******************
* phy
********************/
&u2phy2 {
u-boot,dm-pre-reloc;
status = "okay";
};

&u2phy2_host {
u-boot,dm-pre-reloc;
phy-supply = <&vcc5v0_host>;
status = "okay";
};

&u2phy3 {
u-boot,dm-pre-reloc;
status = "okay";
};

&u2phy3_host {
u-boot,dm-pre-reloc;
phy-supply = <&vcc5v0_host>;
status = "okay";
};

&combphy2_psu {
u-boot,dm-pre-reloc;
status = "okay";
};

/*******************
* controlers
********************/
&usb_host0_ehci {
u-boot,dm-pre-reloc;
status = "okay";
};

&usb_host0_ohci {
u-boot,dm-pre-reloc;
status = "okay";
};

&usb_host1_ehci {
u-boot,dm-pre-reloc;
status = "okay";
};

&usb_host1_ohci {
u-boot,dm-pre-reloc;
status = "okay";
};

&usbhost3_0 {
u-boot,dm-pre-reloc;
status = "okay";
};

&usbhost_dwc3_0 {
u-boot,dm-pre-reloc;
status = "okay";
};

&pinctrl {
usb {
u-boot,dm-pre-reloc;
vcc5v0_host_en: vcc5v0_host_en {
u-boot,dm-pre-reloc;
rockchip,pins = <1 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
};
34 changes: 25 additions & 9 deletions board/rockchip/evb_rk3588/evb_rk3588.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@

#define SARADC_ADDR "saradc@fec10000"
#define HW_ID_CHANNEL 5
#define BOM_ID_CHANNEL 2

#define countof(x) (sizeof(x) / sizeof(x[0]))

struct variant_def {
char *compatible;
unsigned int hw_id_lower_bound;
unsigned int hw_id_upper_bound;
unsigned int bom_id_lower_bound;
unsigned int bom_id_upper_bound;
char *fdtfile;
};

Expand Down Expand Up @@ -100,33 +103,46 @@ int board_usb_cleanup(int index, enum usb_init_type init)

#ifdef CONFIG_ID_EEPROM
static struct variant_def variants[] = {
{"rockchip,rk3588", 300, 380, "rockchip/rk3588s-radxa-e54c.dtb"},
{"rockchip,rk3588", 980, 1060, "rockchip/rk3588-rock-5t.dtb"},
{"rockchip,rk3588", 1650, 1730, "rockchip/rk3588s-radxa-e52c.dtb"},
{"rockchip,rk3588", 2360, 2440, "rockchip/rk3588s-rock-5c.dtb"},
{"rockchip,rk3588", 3370, 3450, "rockchip/rk3588s-rock-5d.dtb"},
{"rockchip,rk3588", 4050, 4130, "rockchip/rk3588-rock-5b-plus.dtb"},
{"rockchip,rk3588", 300, 380, 0, -1, "rockchip/rk3588s-radxa-e54c.dtb"},
{"rockchip,rk3588", 980, 1060, 0, 40, "rockchip/rk3588-rock-5t.dtb"},
{"rockchip,rk3588", 980, 1060, 640, 720, "rockchip/rk3588-rock-5t-industrial.dtb"},
{"rockchip,rk3588", 1650, 1730, 0, -1, "rockchip/rk3588s-radxa-e52c.dtb"},
{"rockchip,rk3588", 2360, 2440, 0, -1, "rockchip/rk3588s-rock-5c.dtb"},
{"rockchip,rk3588", 3370, 3450, 0, -1, "rockchip/rk3588s-rock-5d.dtb"},
{"rockchip,rk3588", 4050, 4130, 0, -1, "rockchip/rk3588-rock-5b-plus.dtb"},
};

static void set_fdtfile(void)
{
int i, ret;
unsigned int hw_id;
unsigned int hw_id, bom_id;
struct variant_def *v;

ret = adc_channel_single_shot(SARADC_ADDR, HW_ID_CHANNEL, &hw_id);
if (ret) {
pr_err("%s: adc_channel_single_shot fail for HW_ID: %i!\n", __func__, ret);
return;
}

ret = adc_channel_single_shot(SARADC_ADDR, BOM_ID_CHANNEL, &bom_id);
if (ret) {
pr_err("%s: adc_channel_single_shot fail for BOM_ID: %i!\n", __func__, ret);
return;
}

for(i = 0; i < countof(variants); i++) {
v = &variants[i];
if (of_machine_is_compatible(v->compatible) &&
hw_id >= v->hw_id_lower_bound &&
hw_id <= v->hw_id_upper_bound) {
printf("Override default fdtfile to %s\n", v->fdtfile);
hw_id <= v->hw_id_upper_bound &&
bom_id >= v->bom_id_lower_bound &&
bom_id <= v->bom_id_upper_bound) {
printf("Found matching variant %s for hw_id 0x%x and bom_id 0x%x setting fdtfile to %s\n", v->compatible, hw_id, bom_id, v->fdtfile);
env_set("fdtfile", v->fdtfile);
break;
} else {
printf("Checking variant: %s, hw_id 0x%x not in range [0x%x, 0x%x], bom_id 0x%x not in range [0x%x, 0x%x]\n",
v->compatible, hw_id, v->hw_id_lower_bound, v->hw_id_upper_bound, bom_id, v->bom_id_lower_bound, v->bom_id_upper_bound);
}
}
}
Expand Down
Loading