| .. | .. |
|---|
| 19 | 19 | #define FIREWALL_DDR_BASE 0xfe030000 |
|---|
| 20 | 20 | #define FW_DDR_MST5_REG 0x54 |
|---|
| 21 | 21 | #define FW_DDR_MST13_REG 0x74 |
|---|
| 22 | +#define FW_DDR_MST19_REG 0x8c |
|---|
| 22 | 23 | #define FW_DDR_MST21_REG 0x94 |
|---|
| 23 | 24 | #define FW_DDR_MST26_REG 0xa8 |
|---|
| 24 | 25 | #define FW_DDR_MST27_REG 0xac |
|---|
| 25 | 26 | #define FIREWALL_SYSMEM_BASE 0xfe038000 |
|---|
| 26 | 27 | #define FW_SYSM_MST5_REG 0x54 |
|---|
| 27 | 28 | #define FW_SYSM_MST13_REG 0x74 |
|---|
| 29 | +#define FW_SYSM_MST19_REG 0x8c |
|---|
| 28 | 30 | #define FW_SYSM_MST21_REG 0x94 |
|---|
| 29 | 31 | #define FW_SYSM_MST26_REG 0xa8 |
|---|
| 30 | 32 | #define FW_SYSM_MST27_REG 0xac |
|---|
| 33 | +#define PMU1_SGRF_BASE 0xfd582000 |
|---|
| 34 | +#define PMU1_SGRF_SOC_CON0 0x0 |
|---|
| 35 | +#define PMU1_SGRF_SOC_CON6 0x18 |
|---|
| 36 | +#define PMU1_SGRF_SOC_CON7 0x1c |
|---|
| 37 | +#define PMU1_SGRF_SOC_CON8 0x20 |
|---|
| 38 | +#define PMU1_SGRF_SOC_CON9 0x24 |
|---|
| 39 | +#define PMU1_SGRF_SOC_CON10 0x28 |
|---|
| 40 | +#define PMU1_SGRF_SOC_CON13 0x34 |
|---|
| 31 | 41 | #define SYS_GRF_BASE 0xfd58c000 |
|---|
| 32 | 42 | #define SYS_GRF_SOC_CON6 0x0318 |
|---|
| 33 | 43 | #define USBGRF_BASE 0xfd5ac000 |
|---|
| 34 | 44 | #define USB_GRF_USB3OTG0_CON1 0x001c |
|---|
| 35 | 45 | #define BUS_SGRF_BASE 0xfd586000 |
|---|
| 46 | +#define BUS_SGRF_SOC_CON2 0x08 |
|---|
| 36 | 47 | #define BUS_SGRF_FIREWALL_CON18 0x288 |
|---|
| 37 | 48 | #define PMU_BASE 0xfd8d0000 |
|---|
| 38 | 49 | #define PMU_PWR_GATE_SFTCON1 0x8150 |
|---|
| .. | .. |
|---|
| 66 | 77 | #define EMMC_IOC_GPIO2D_DS_H 0x5c |
|---|
| 67 | 78 | |
|---|
| 68 | 79 | #define CRU_BASE 0xfd7c0000 |
|---|
| 80 | +#define CRU_GPLL_CON1 0x01c4 |
|---|
| 69 | 81 | #define CRU_SOFTRST_CON77 0x0b34 |
|---|
| 82 | +#define CRU_GLB_RST_CON 0x0c10 |
|---|
| 70 | 83 | |
|---|
| 71 | 84 | #define PMU1CRU_BASE 0xfd7f0000 |
|---|
| 85 | +#define PMU1CRU_SOFTRST_CON00 0x0a00 |
|---|
| 72 | 86 | #define PMU1CRU_SOFTRST_CON03 0x0a0c |
|---|
| 73 | 87 | #define PMU1CRU_SOFTRST_CON04 0x0a10 |
|---|
| 74 | 88 | |
|---|
| 75 | 89 | #define HDMIRX_NODE_FDT_PATH "/hdmirx-controller@fdee0000" |
|---|
| 76 | 90 | #define RK3588_PHY_CONFIG 0xfdee00c0 |
|---|
| 91 | + |
|---|
| 92 | +#define VOP_M0_PRIORITY_REG 0xfdf82008 |
|---|
| 93 | +#define VOP_M1_PRIORITY_REG 0xfdf82208 |
|---|
| 94 | +#define QOS_PRIORITY_LEVEL(h, l) ((((h) & 7) << 8) | ((l) & 7)) |
|---|
| 77 | 95 | |
|---|
| 78 | 96 | #ifdef CONFIG_ARM64 |
|---|
| 79 | 97 | #include <asm/armv8/mmu.h> |
|---|
| .. | .. |
|---|
| 865 | 883 | secure_reg &= 0xffff0000; |
|---|
| 866 | 884 | writel(secure_reg, FIREWALL_SYSMEM_BASE + FW_SYSM_MST27_REG); |
|---|
| 867 | 885 | |
|---|
| 868 | | - /* Select clk_tx source as default for i2s2/i2s3 */ |
|---|
| 869 | | - writel(0x03400340, SYS_GRF_BASE + SYS_GRF_SOC_CON6); |
|---|
| 886 | + /* |
|---|
| 887 | + * Select clk_tx source as default for i2s2/i2s3 |
|---|
| 888 | + * Set I2Sx_MCLK as input default |
|---|
| 889 | + * |
|---|
| 890 | + * It's safe to set mclk as input default to avoid high freq glitch |
|---|
| 891 | + * which may make devices work unexpected. And then enabled by |
|---|
| 892 | + * kernel stage or any state where user use it. |
|---|
| 893 | + */ |
|---|
| 894 | + writel(0x03c703c7, SYS_GRF_BASE + SYS_GRF_SOC_CON6); |
|---|
| 870 | 895 | |
|---|
| 871 | 896 | if (readl(BUS_IOC_BASE + BUS_IOC_GPIO2D_IOMUX_SEL_L) == 0x2222) { |
|---|
| 872 | 897 | /* Set the fspi m0 io ds level to 55ohm */ |
|---|
| .. | .. |
|---|
| 922 | 947 | writel(0xffff1111, BUS_IOC_BASE + BUS_IOC_GPIO2D_IOMUX_SEL_L); |
|---|
| 923 | 948 | writel(0xffff1111, BUS_IOC_BASE + BUS_IOC_GPIO2D_IOMUX_SEL_H); |
|---|
| 924 | 949 | #endif |
|---|
| 925 | | - |
|---|
| 950 | + /* |
|---|
| 951 | + * set VOP M0 and VOP M1 to priority 0x303,then |
|---|
| 952 | + * Peri > VOP/MCU > ISP/VICAP > other |
|---|
| 953 | + * Note: VOP priority can only be modified during the u-boot stage, |
|---|
| 954 | + * as VOP default power down, and power up after trust. |
|---|
| 955 | + */ |
|---|
| 956 | + writel(QOS_PRIORITY_LEVEL(3, 3), VOP_M0_PRIORITY_REG); |
|---|
| 957 | + writel(QOS_PRIORITY_LEVEL(3, 3), VOP_M1_PRIORITY_REG); |
|---|
| 926 | 958 | #endif |
|---|
| 927 | 959 | |
|---|
| 928 | 960 | /* Select usb otg0 phy status to 0 that make rockusb can work at high-speed */ |
|---|
| .. | .. |
|---|
| 1245 | 1277 | #ifdef CONFIG_SPL_BUILD |
|---|
| 1246 | 1278 | int spl_fit_standalone_release(char *id, uintptr_t entry_point) |
|---|
| 1247 | 1279 | { |
|---|
| 1248 | | - /* gpll enable */ |
|---|
| 1249 | | - writel(0x00f00042, 0xfd7c01c4); |
|---|
| 1280 | + u32 val; |
|---|
| 1281 | + |
|---|
| 1282 | + /* pmu m0 configuration: */ |
|---|
| 1283 | + /* set gpll */ |
|---|
| 1284 | + writel(0x00f00042, CRU_BASE + CRU_GPLL_CON1); |
|---|
| 1285 | + /* set pmu mcu to access ddr memory */ |
|---|
| 1286 | + val = readl(FIREWALL_DDR_BASE + FW_DDR_MST19_REG); |
|---|
| 1287 | + writel(val & 0x0000ffff, FIREWALL_DDR_BASE + FW_DDR_MST19_REG); |
|---|
| 1288 | + /* set pmu mcu to access system memory */ |
|---|
| 1289 | + val = readl(FIREWALL_SYSMEM_BASE + FW_SYSM_MST19_REG); |
|---|
| 1290 | + writel(val & 0x000000ff, FIREWALL_SYSMEM_BASE + FW_SYSM_MST19_REG); |
|---|
| 1291 | + /* set pmu mcu to secure */ |
|---|
| 1292 | + writel(0x00080000, PMU1_SGRF_BASE + PMU1_SGRF_SOC_CON0); |
|---|
| 1250 | 1293 | /* set start addr, pmu_mcu_code_addr_start */ |
|---|
| 1251 | | - writel(0xFFFF0000 | (entry_point >> 16), 0xFD582024); |
|---|
| 1252 | | - /* pmu_mcu_sram_addr_start */ |
|---|
| 1253 | | - writel(0xFFFF2000, 0xFD582028); |
|---|
| 1254 | | - /* pmu_mcu_tcm_addr_start */ |
|---|
| 1255 | | - writel(0xFFFF2000, 0xFD582034); |
|---|
| 1256 | | - /* set mcu secure */ |
|---|
| 1257 | | - writel(0x00080000, 0xFD582000); |
|---|
| 1294 | + writel(0xFFFF0000 | (entry_point >> 16), PMU1_SGRF_BASE + PMU1_SGRF_SOC_CON9); |
|---|
| 1295 | + /* set pmu_mcu_sram_addr_start */ |
|---|
| 1296 | + writel(0xFFFF2000, PMU1_SGRF_BASE + PMU1_SGRF_SOC_CON10); |
|---|
| 1297 | + /* set pmu_mcu_tcm_addr_start */ |
|---|
| 1298 | + writel(0xFFFF2000, PMU1_SGRF_BASE + PMU1_SGRF_SOC_CON13); |
|---|
| 1258 | 1299 | /* set cache cache_peripheral_addr */ |
|---|
| 1259 | | - writel(0xffff0000, 0xFD582018); |
|---|
| 1260 | | - writel(0xffffee00, 0xFD58201c); |
|---|
| 1261 | | - writel(0x00ff00ff, 0xFD582020); /* 0xf0000000 ~ 0xfee00000 */ |
|---|
| 1262 | | - /* mcupmu access DDR secure control, each bit for a region. */ |
|---|
| 1263 | | - writel(0x0000ffff, 0xFE03008C); |
|---|
| 1264 | | - /* mcupmu access DDR secure control, each bit for a region. */ |
|---|
| 1265 | | - writel(0x000000ff, 0xFE03808C); |
|---|
| 1266 | | - /* PMU WDT reset system enable */ |
|---|
| 1267 | | - writel(0x02000200, 0xFD586008); |
|---|
| 1268 | | - /* WDT trigger global reset. */ |
|---|
| 1269 | | - writel(0x08400840, 0xFD7C0C10); |
|---|
| 1270 | | - /* Spl helps to load the mcu image, but not need to release |
|---|
| 1271 | | - * mcu for rk3588. |
|---|
| 1272 | | - */ |
|---|
| 1300 | + /* 0xf0000000 ~ 0xfee00000 */ |
|---|
| 1301 | + writel(0xffff0000, PMU1_SGRF_BASE + PMU1_SGRF_SOC_CON6); |
|---|
| 1302 | + writel(0xffffee00, PMU1_SGRF_BASE + PMU1_SGRF_SOC_CON7); |
|---|
| 1303 | + writel(0x00ff00ff, PMU1_SGRF_BASE + PMU1_SGRF_SOC_CON8); |
|---|
| 1304 | + /* enable PMU WDT reset system */ |
|---|
| 1305 | + writel(0x02000200, BUS_SGRF_BASE + BUS_SGRF_SOC_CON2); |
|---|
| 1306 | + /* select WDT trigger global reset. */ |
|---|
| 1307 | + writel(0x08400840, CRU_BASE + CRU_GLB_RST_CON); |
|---|
| 1308 | + /* release pmu mcu */ |
|---|
| 1309 | + /* writel(0x20000000, PMU1CRU_BASE + PMU1CRU_SOFTRST_CON00); */ |
|---|
| 1273 | 1310 | |
|---|
| 1274 | 1311 | return 0; |
|---|
| 1275 | 1312 | } |
|---|