17 Commits

Author SHA1 Message Date
Han Gao
a13e24ed9e ci: remove xuantie toolchain
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2026-05-04 07:26:43 +08:00
Han Gao
7c400aca79 ci: bump action
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2026-05-04 07:07:17 +08:00
Han Gao
1a0c68d152 ahead: add aon config
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2026-05-04 06:40:27 +08:00
Yao Zi
0028a957e3 configs: light-c910: Setup kernel decompression buffer
Image decompression requires a temporary buffer to store decompressed
image. Setup it for C910 boards.

Signed-off-by: Yao Zi <ziyao@disroot.org>
2025-11-24 19:50:27 +08:00
Yao Zi
c971a1448d cmd/boot: Try decompressing kernel through GZIP
This makes it possible to boot GZIP-compressed Linux kernel with
sysboot.

Signed-off-by: Yao Zi <ziyao@disroot.org>
2025-11-24 19:49:23 +08:00
nekorouter
ac3b305def configs/light_lpi4a_cluster_16g_defconfig: fix typo
16gb -> 16g

Signed-off-by: nekorouter <nekorouter@outlook.com>
2025-09-03 19:07:53 +08:00
nekorouter
57fa274f6d ci: remove build mainline binarys command
since the only difference from "default build" and "mainline build" is the devicetree name,
and the devicetree name in default build has been updated, this is not needed.

Signed-off-by: nekorouter <nekorouter@outlook.com>
2025-08-13 16:32:47 +08:00
nekorouter
c1a95ddefe configs: update devicetree names
update devicetree filename to mainline-like format.

Signed-off-by: nekorouter <nekorouter@outlook.com>
2025-08-13 16:32:47 +08:00
SkyRain
93ff49d9f5 enable fan in uboot for meles 2025-03-17 05:54:24 +08:00
SkyRain
6278bac553 enable PWM fan in uboot for LPi4A 2025-03-17 05:54:24 +08:00
Han Gao
b5ee6e549a ci: update to actions/upload-artifact@v4
Signed-off-by: Han Gao <rabenda.cn@gmail.com>
2025-02-05 13:32:07 +08:00
Han Gao
3d877f3648 Revert "Linux_SDK_V2.0.2"
This reverts commit 8942b2dce6.
2025-01-10 17:54:03 +08:00
LevitatingBusinessMan (Rein Fernhout)
68565d2855 use 0 instead of NULL in function returning int 2024-12-23 15:41:01 +08:00
LevitatingBusinessMan (Rein Fernhout)
72c738e9ce use cmd_tbl_t type 2024-12-23 15:41:01 +08:00
Lindsay Zhou
a46c283102 fix: implicit conversion and implicit function declaration errors on gcc14 2024-12-23 15:41:01 +08:00
Han Gao
71bb3b069e fix: set initrd_high for initrd size too big
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
Signed-off-by: Han Gao <rabenda.cn@gmail.com>
2024-12-23 15:40:00 +08:00
devops_admin
8942b2dce6 Linux_SDK_V2.0.2
Signed-off-by: devops_admin <devops_admin@alibabacloud.com>
2024-12-23 15:40:00 +08:00
19 changed files with 495 additions and 90 deletions

View File

@@ -1,4 +1,4 @@
name: thead-u-boot-build
name: th1520-vendor-uboot-build
on:
push:
@@ -8,12 +8,8 @@ on:
- '*'
pull_request:
workflow_dispatch:
schedule:
- cron: "0 2 * * *"
env:
xuantie_toolchain: https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1705395627867
toolchain_file_name: Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.8.1-20240115.tar.gz
mainline_toolchain: https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.04.12
mainline_toolchain_file_name: riscv64-glibc-ubuntu-22.04-gcc-nightly-2024.04.12-nightly.tar.gz
wget_alias: 'wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t 0'
@@ -22,11 +18,6 @@ env:
jobs:
build:
strategy:
fail-fast: false
matrix:
name: [thead-gcc, gcc-13]
runs-on: ubuntu-22.04
steps:
@@ -38,20 +29,14 @@ jobs:
dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf device-tree-compiler
- name: Checkout uboot
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: uboot compile
run: |
mkdir output
if [[ ${{ matrix.name }} = "thead-gcc" ]]; then
${wget_alias} ${xuantie_toolchain}/${toolchain_file_name}
tar -xvf ${toolchain_file_name} -C /opt
export PATH="/opt/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.8.1/bin:$PATH"
else
${wget_alias} ${mainline_toolchain}/${mainline_toolchain_file_name}
tar -xvf ${mainline_toolchain_file_name} -C /opt
export PATH="/opt/riscv/bin:$PATH"
fi
${wget_alias} ${mainline_toolchain}/${mainline_toolchain_file_name}
tar -xvf ${mainline_toolchain_file_name} -C /opt
export PATH="/opt/riscv/bin:$PATH"
${CROSS_COMPILE}gcc -v
pushd $PWD
@@ -111,56 +96,25 @@ jobs:
make -j$(nproc)
find . -name "u-boot-with-spl.bin" | xargs -I{} cp -av {} ${GITHUB_WORKSPACE}/output/u-boot-with-spl-meles-4g.bin
# mainline support
make clean
make light_lpi4a_defconfig
sed -i 's#thead/light-lpi4a.dtb#thead/th1520-lichee-pi-4a.dtb#' .config
make -j$(nproc)
find . -name "u-boot-with-spl.bin" | xargs -I{} cp -av {} ${GITHUB_WORKSPACE}/output/u-boot-with-spl-lpi4a-main.bin
make clean
make light_lpi4a_16g_defconfig
sed -i 's#thead/light-lpi4a-16gb.dtb#thead/th1520-lichee-pi-4a-16g.dtb#' .config
make -j$(nproc)
find . -name "u-boot-with-spl.bin" | xargs -I{} cp -av {} ${GITHUB_WORKSPACE}/output/u-boot-with-spl-lpi4a-16g-main.bin
make clean
make light_lpi4a_cluster_defconfig
sed -i 's#thead/light-lpi4a-cluster.dtb#thead/th1520-lichee-cluster-4a.dtb#' .config
make -j$(nproc)
find . -name "u-boot-with-spl.bin" | xargs -I{} cp -av {} ${GITHUB_WORKSPACE}/output/u-boot-with-spl-lc4a-main.bin
make clean
make light_lpi4a_cluster_16g_defconfig
sed -i 's#thead/light-lpi4a-cluster-16gb.dtb#thead/th1520-lichee-cluster-4a-16g.dtb#' .config
make -j$(nproc)
find . -name "u-boot-with-spl.bin" | xargs -I{} cp -av {} ${GITHUB_WORKSPACE}/output/u-boot-with-spl-lc4a-16g-main.bin
# 8g emmc support
sed -i 's/name=swap,size=4096MiB,type=swap/name=swap,size=2MiB,type=swap/' include/configs/light-c910.h
make clean
make light_lpi4a_defconfig
make -j$(nproc)
find . -name "u-boot-with-spl.bin" | xargs -I{} cp -av {} ${GITHUB_WORKSPACE}/output/u-boot-with-spl-lpi4a_8gemmc.bin
make clean
make light_lpi4a_defconfig
sed -i 's#thead/light-lpi4a.dtb#thead/th1520-lichee-pi-4a.dtb#' .config
make -j$(nproc)
find . -name "u-boot-with-spl.bin" | xargs -I{} cp -av {} ${GITHUB_WORKSPACE}/output/u-boot-with-spl-lpi4a-main_8gemmc.bin
popd
tree ${GITHUB_WORKSPACE}/output
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v7
with:
name: thead-u-uboot-${{ matrix.name }}
name: th1520-uboot
path: output/*.bin
retention-days: 30
- name: 'Create release by tag'
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.name == 'thead-gcc' }}
uses: softprops/action-gh-release@v3
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
files: output/*.bin
token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,4 +1,7 @@
/dts-v1/;
#include <dt-bindings/pmic/light_pmic.h>
/ {
model = "T-HEAD c910 light";
compatible = "thead,c910_light";
@@ -479,6 +482,367 @@
lcd-en-gpios = <&pcal6408ahk_a 2 0>; /* active high */
lcd-bias-en-gpios = <&pcal6408ahk_a 4 0>;/* active high */
};
aon {
compatible = "thead,light-aon";
status = "okay";
wakeup-by-gpio-on;
wakeup-by-rtc-on;
pd: light-aon-pd {
compatible = "thead,light-aon-pd";
#power-domain-cells = <1>;
};
light-regu-reg {
compatible = "thead,light-dialog-pmic";
status = "okay";
soc_dvdd18_aon_reg: soc_dvdd18_aon {
regulator-name = "soc_dvdd18_aon";
regulator-boot-on;
regulator-always-on;
};
soc_avdd33_usb3_reg: soc_avdd33_usb3 {
regulator-name = "soc_avdd33_usb3";
regulator-boot-on;
regulator-always-on;
};
soc_dvdd08_aon_reg: soc_dvdd08_aon {
regulator-name = "soc_dvdd08_aon";
regulator-boot-on;
regulator-always-on;
};
soc_apcpu_dvdd_dvddm_reg: soc_apcpu_dvdd_dvddm {
regulator-name = "soc_apcpu_dvdd_dvddm";
regulator-min-microvolt = <300000>;
regulator-max-microvolt = <1570000>;
regulator-boot-on;
regulator-always-on;
};
soc_dvdd08_ddr_reg: soc_dvdd08_ddr {
regulator-name = "soc_dvdd08_ddr";
regulator-boot-on;
regulator-always-on;
};
soc_vdd_ddr_1v8_reg: soc_vdd_ddr_1v8 {
regulator-name = "soc_vdd_ddr_1v8";
regulator-boot-on;
regulator-always-on;
};
soc_vdd_ddr_1v1_reg: soc_vdd_ddr_1v1 {
regulator-name = "soc_vdd_ddr_1v1";
regulator-boot-on;
regulator-always-on;
};
soc_vdd_ddr_0v6_reg: soc_vdd_ddr_0v6 {
regulator-name = "soc_vdd_ddr_0v6";
regulator-boot-on;
regulator-always-on;
};
soc_dvdd18_ap_reg: soc_dvdd18_ap {
regulator-name = "soc_dvdd18_ap";
regulator-boot-on;
regulator-always-on;
};
soc_dvdd08_ap_reg: soc_dvdd08_ap {
regulator-name = "soc_dvdd08_ap";
regulator-boot-on;
regulator-always-on;
};
soc_avdd08_mipi_hdmi_reg: soc_avdd08_mipi_hdmi {
regulator-name = "soc_avdd08_mipi_hdmi";
regulator-boot-on;
regulator-always-on;
};
soc_avdd18_mipi_hdmi_reg: soc_avdd18_mipi_hdmi {
regulator-name = "soc_avdd18_mipi_hdmi";
regulator-boot-on;
regulator-always-on;
};
soc_dvdd33_emmc_reg: soc_dvdd33_emmc {
regulator-name = "soc_dvdd33_emmc";
regulator-boot-on;
regulator-always-on;
};
soc_dvdd18_emmc_reg: soc_dvdd18_emmc {
regulator-name = "soc_vdd18_emmc";
regulator-boot-on;
regulator-always-on;
};
soc_dovdd18_scan_reg: soc_dovdd18_scan {
regulator-name = "soc_dovdd18_scan";
regulator-min-microvolt = <900000>;
regulator-max-microvolt = <3600000>;
};
soc_vext_2v8_reg: soc_vext_2v8 {
regulator-name = "soc_vext_2v8";
regulator-boot-on;
regulator-always-on;
status = "disabled";
};
soc_dvdd12_scan_reg: soc_dvdd12_scan {
regulator-name = "soc_dvdd12_scan";
regulator-min-microvolt = <900000>;
regulator-max-microvolt = <3600000>;
};
soc_avdd28_scan_en_reg: soc_avdd28_scan_en {
regulator-name = "soc_avdd28_scan_en";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
};
soc_avdd28_rgb_reg: soc_avdd28_rgb {
regulator-name = "soc_avdd28_rgb";
regulator-min-microvolt = <2200000>;
regulator-max-microvolt = <3475000>;
regulator-boot-on;
regulator-always-on;
status = "disabled";
};
soc_dovdd18_rgb_reg: soc_dovdd18_rgb {
regulator-name = "soc_dovdd18_rgb";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <3600000>;
regulator-boot-on;
regulator-always-on;
status = "disabled";
};
soc_dvdd12_rgb_reg: soc_dvdd12_rgb {
regulator-name = "soc_dvdd12_rgb";
regulator-min-microvolt = <400000>;
regulator-max-microvolt = <1675000>;
regulator-boot-on;
regulator-always-on;
status = "disabled";
};
soc_avdd25_ir_reg: soc_avdd25_ir {
regulator-name = "soc_avdd25_ir";
regulator-min-microvolt = <2200000>;
regulator-max-microvolt = <3475000>;
regulator-boot-on;
regulator-always-on;
status = "disabled";
};
soc_dovdd18_ir_reg: soc_dovdd18_ir {
regulator-name = "soc_dovdd18_ir";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <3600000>;
regulator-boot-on;
regulator-always-on;
status = "disabled";
};
soc_dvdd12_ir_reg: soc_dvdd12_ir {
regulator-name = "soc_dvdd12_ir";
regulator-min-microvolt = <400000>;
regulator-max-microvolt = <1675000>;
regulator-boot-on;
regulator-always-on;
status = "disabled";
};
};
aon_pmic_config {
compatible = "thead,light-pmic-conf";
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
iic-config = <0 0 2>;
pmic_dev_0: pmic-dev@0 {
pmic-name = "dialog,da9063,v1";
pmic-addr = <0x5a 0x5b>;
pmic_wdt_on;
status = "okay";
};
pmic_dev_1: pmic-dev@1 {
pmic-name = "dialog,da9121,v1";
pmic-addr = <0x68>;
status = "okay";
};
regu_config_0 {
reg_info = <&soc_dvdd18_aon_reg>;
status = "okay";
regu_id@0 {
pmic_dev = <&pmic_dev_0 DA9063_ID_LDO3>;
};
};
regu_config_1 {
reg_info = <&soc_avdd33_usb3_reg>;
status = "okay";
regu_id@0 {
pmic_dev = <&pmic_dev_0 DA9063_ID_LDO9>;
};
};
regu_config_2 {
reg_info = <&soc_dvdd08_aon_reg>;
status = "okay";
regu_id@0 {
pmic_dev = <&pmic_dev_0 DA9063_ID_LDO2>;
};
};
regu_config_3 {
reg_info = <&soc_apcpu_dvdd_dvddm_reg>;
status = "okay";
regu_id@0 {
pmic_dev = <&pmic_dev_0 DA9063_ID_BCORE1>;
auto_on_info = <0 0 800000>;
};
regu_id@1 {
pmic_dev = <&pmic_dev_0 DA9063_ID_BCORE2>;
auto_on_info = <1 0 800000>;
};
regu_id@2 {
pmic_dev = <&pmic_dev_0 DA9063_ID_BUCKIO>;
auto_on_info = <2 0 800000>;
};
coupling_info@0 {
negative-min;
info = <0 2 5 30>;
};
coupling_info@1 {
negative-min;
info = <1 2 5 30>;
};
};
regu_config_4 {
reg_info = <&soc_dvdd08_ddr_reg>;
status = "okay";
regu_id@0 {
pmic_dev = <&pmic_dev_0 DA9063_ID_BUCKPERI>;
};
};
regu_config_5 {
reg_info = <&soc_vdd_ddr_1v8_reg>;
status = "okay";
regu_id@0 {
pmic_dev = <&pmic_dev_0 DA9063_ID_LDO4>;
};
};
regu_config_6 {
reg_info = <&soc_vdd_ddr_1v1_reg>;
status = "okay";
regu_id@0 {
pmic_dev = <&pmic_dev_0 DA9063_ID_BUCKMEM>;
};
};
regu_config_7 {
reg_info = <&soc_vdd_ddr_0v6_reg>;
status = "okay";
regu_id@0 {
pmic_dev = <&pmic_dev_0 DA9063_ID_BUCKPRO>;
};
};
regu_config_8 {
reg_info = <&soc_dvdd18_ap_reg>;
status = "okay";
regu_id@0 {
pmic_dev = <&pmic_dev_0 DA9063_ID_LDO11>;
};
};
regu_config_9 {
reg_info = <&soc_avdd08_mipi_hdmi_reg>;
status = "okay";
regu_id@0 {
pmic_dev = <&pmic_dev_0 DA9063_ID_LDO1>;
};
};
regu_config_10 {
reg_info = <&soc_avdd18_mipi_hdmi_reg>;
status = "okay";
regu_id@0 {
pmic_dev = <&pmic_dev_0 DA9063_ID_LDO5>;
};
};
regu_config_11 {
reg_info = <&soc_dvdd33_emmc_reg>;
status = "okay";
regu_id@0 {
pmic_dev = <&pmic_dev_0 DA9063_ID_LDO10>;
};
};
regu_config_12 {
reg_info = <&soc_dovdd18_scan_reg>;
status = "okay";
regu_id@0 {
pmic_dev = <&pmic_dev_0 DA9063_ID_LDO6>;
auto_on_info = <3 1 1800000>;
auto_off_info = <1 1>;
};
};
regu_config_13 {
reg_info = <&soc_dvdd12_scan_reg>;
status = "okay";
regu_id@0 {
pmic_dev = <&pmic_dev_0 DA9063_ID_LDO8>;
auto_on_info = <4 1 1200000>;
auto_off_info = <2 1>;
};
};
regu_config_14 {
reg_info = <&soc_avdd28_scan_en_reg>;
status = "okay";
regu_id@0 {
pmic_dev = <&pmic_dev_0 DA9063_ID_LDO7>;
auto_on_info = <5 1 2800000>;
auto_off_info = <0 1>;
};
};
regu_config_15 {
reg_info = <&soc_dvdd08_ap_reg>;
status = "okay";
regu_id@0 {
pmic_dev = <&pmic_dev_1 DA9121_ID_BUCK1>;
parent_pmic_dev = <&pmic_dev_0 2 0>;
};
};
regu_config_16 {
reg_info = <&soc_dvdd18_emmc_reg>;
status = "okay";
regu_id@0 {
pmic_dev = <&pmic_dev_0 DA9063_ID_GPIO7>;
parent_pmic_dev = <&pmic_dev_0 7 0>;
};
};
};
};
};
chosen {

View File

@@ -9,7 +9,8 @@
#size-cells = <2>;
config {
select-gpio = <&gpio1_porta 16 0>;
select-gpio = <&gpio1_porta 16 0>; // Enable the blue LED on Milk-V Meles
fan-gpio = <&gpio2_porta 4 0>; // Enable the fan on Milk-V Meles, see schematic for details
};
memory@0 {

View File

@@ -110,7 +110,7 @@ void next_stage(void)
bool has_reset_sample(ulong dtb_addr)
{
int node_offset;
node_offset = fdt_path_offset(dtb_addr, "/soc/reset-sample");
node_offset = fdt_path_offset((void *)dtb_addr, "/soc/reset-sample");
if (node_offset < 0) {
printf("## fdt has no reset_sample\n");
return false;
@@ -160,8 +160,8 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)
announce_and_cleanup(fake);
_load_start = kernel;
_dtb_addr = images->ft_addr;
_load_start = (ulong)kernel;
_dtb_addr = (ulong)(images->ft_addr);
_dyn_info_addr = (ulong)&opensbi_info;
if (!has_reset_sample(_dtb_addr)) {
opensbi_info.magic = FW_DYNAMIC_INFO_MAGIC_VALUE;

View File

@@ -244,7 +244,7 @@ int do_bootslave(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
}
#endif
static void light_c910_set_gpio_output_high(void)
static void light_c910_set_gpio_output_high(const char* gpio_name)
{
ofnode node;
struct gpio_desc select_gpio;
@@ -257,9 +257,9 @@ static void light_c910_set_gpio_output_high(void)
return;
}
if (gpio_request_by_name_nodev(node, "select-gpio", 0,
if (gpio_request_by_name_nodev(node, gpio_name, 0,
&select_gpio, GPIOD_IS_OUT)) {
printf("%s: could not find a /config/select-gpio\n", __func__);
printf("%s: could not find a /config/%s\n", __func__, gpio_name);
return;
}
@@ -268,7 +268,12 @@ static void light_c910_set_gpio_output_high(void)
int misc_init_r(void)
{
light_c910_set_gpio_output_high();
// Enable blue LED
light_c910_set_gpio_output_high("select-gpio");
// Enable fan on some boards(currently only on Meles)
// For LPi4A, the fan is controlled by PWM, see lpi4a_fan_pwm_config() in light.c
light_c910_set_gpio_output_high("fan-gpio");
return 0;
}

View File

@@ -2402,13 +2402,59 @@ static void light_iopin_init(void)
}
#endif
#define PWM_BASE ((void *)0xffec01c000)
#define PWM_CHAN_REG(chan, off) (PWM_BASE + (chan) * 0x20 + (off))
#define PWM_PER_OFFSET 0x08 // Offset for Periodic Control Register
#define PWM_FP_OFFSET 0x0C // Offset for First Phase Control Register
#define PWM_CTRL_OFFSET 0x00 // Offset for Control Register
// See T-HEAD TH1520 Peripheral Interface User Manual
// https://dl.sipeed.com/shareURL/LICHEE/licheepi4a/09_Doc
static void light_pwm_config(void)
{
/* pwm0 */
writel(0x4b0, (void *)0xFFEC01C008);
writel(0x258, (void *)0xFFEC01C00c);
writel(0x328, (void *)0xFFEC01C000);
/*
* Enable MIPI Display backlight on PWM0.
* Period=1200 clock cycles, Duty Cycle=50%
*/
// Set PWM Period to 1200 clock cycles
writel(0x4b0, PWM_CHAN_REG(0, PWM_PER_OFFSET));
// Set PWM First Phase to 600 clock cycles
writel(0x258, PWM_CHAN_REG(0, PWM_FP_OFFSET));
// Configure PWM Control Register:
// [9] INACTOUT = 1 (inactive output set to high)
// [8] FPOUT = 1 (first phase output set to high)
// [7:6] EVTRIG = 00 (event-triggered mode disabled)
// [5:4] MODE = 10 (continuous mode)
// [3] INTEN = 1 (interrupt enabled)
// [2] CFG_UPDATE = 0 (do not wait for configuration update)
// [1] SOFT_RST = 0 (software reset disabled)
// [0] START = 0 (PWM start coding enable, rising edge effective)
// Final address: 0xffec01c000 + 0x00 (channel 0) + 0x00 (control register offset) = 0xffec01c000
writel(0b1100101000, PWM_CHAN_REG(0, PWM_CTRL_OFFSET));
}
static void lpi4a_fan_pwm_config(void)
{
/*
* Enable fan on PWM1(GPIO10) for Lichee Pi 4A.
* See LPi4A Schematic:
* https://dl.sipeed.com/shareURL/LICHEE/licheepi4a/02_Schematic
*/
// Set PWM Period to 1200 clock cycles
writel(0x4b0, PWM_CHAN_REG(1, PWM_PER_OFFSET));
// Set PWM First Phase to 600 clock cycles
writel(0x258, PWM_CHAN_REG(1, PWM_FP_OFFSET));
// Configure PWM Control Register:
// [9] INACTOUT = 1 (inactive output set to high)
// [8] FPOUT = 1 (first phase output set to high)
// [7:6] EVTRIG = 00 (event-triggered mode disabled)
// [5:4] MODE = 10 (continuous mode)
// [3] INTEN = 0 (interrupt disabled)
// [2] CFG_UPDATE = 0 (do not wait for configuration update)
// [1] SOFT_RST = 0 (software reset disabled)
// [0] START = 0 (PWM start coding enable, rising edge effective)
// Final address: 0xffec01c000 + 0x20 (channel 1) + 0x00 (control register offset) = 0xffec01c020
writel(0b1100100000, PWM_CHAN_REG(1, PWM_CTRL_OFFSET));
}
int board_init(void)
@@ -2425,6 +2471,9 @@ int board_init(void)
light_pwm_config();
#ifdef CONFIG_TARGET_LIGHT_FM_C910_LPI4A
lpi4a_fan_pwm_config();
#endif
return 0;
}

View File

@@ -3,6 +3,7 @@
#include "../include/common_lib.h"
#include "../include/ddr_common_func.h"
#include "../include/ddr_retention.h"
#include "../include/pinmux.h"
DDR_SYSREG_REG_SW_REG_S ddr_sysreg;
@@ -48,7 +49,7 @@ int get_ddr_rank_number() {
#ifdef CONFIG_DDR_MSG
DDR_DEBUG("unsupported ddr rank type!!!\n");
#endif
return NULL;
return 0;
#endif
}

View File

@@ -1,6 +1,7 @@
#include "../include/common_lib.h"
#include "../include/ddr_common_func.h"
#include "../include/ddr_retention.h"
#include "../include/pinmux.h"
/*
/// data structure to store register address, value pairs

View File

@@ -338,37 +338,37 @@ int boundary_verify(unsigned long boundary) {
phys_addr_t verify_addr4 = (phys_addr_t)boundary + CONFIG_SYS_SDRAM_BASE;
// verify data accessing result firstly
writel(MAGIC_DATA2, verify_addr);
writel(MAGIC_DATA2, (void *)verify_addr);
invalidate_dcache_range(verify_addr, verify_addr + CONFIG_SYS_CACHELINE_SIZE);
if (readl(verify_addr) != MAGIC_DATA2) {
if (readl((void *)verify_addr) != MAGIC_DATA2) {
printf("ddr rw test failed\n");
return -1;
}
writel(MAGIC_DATA, verify_addr); // writing at beginning
writel(MAGIC_DATA, (void *)verify_addr); // writing at beginning
invalidate_dcache_range(verify_addr, verify_addr + CONFIG_SYS_CACHELINE_SIZE);
if (readl(verify_addr) != MAGIC_DATA) {
if (readl((void *)verify_addr) != MAGIC_DATA) {
printf("ddr rw test failed\n");
return -1;
}
writel(MAGIC_DATA2, verify_addr2); // writing at one-quarter addr
writel(MAGIC_DATA3, verify_addr3); // writing at half addr
writel(MAGIC_DATA2, (void *)verify_addr2); // writing at one-quarter addr
writel(MAGIC_DATA3, (void *)verify_addr3); // writing at half addr
invalidate_dcache_range(verify_addr, verify_addr + CONFIG_SYS_CACHELINE_SIZE);
invalidate_dcache_range(verify_addr2, verify_addr2 + CONFIG_SYS_CACHELINE_SIZE);
invalidate_dcache_range(verify_addr3, verify_addr3 + CONFIG_SYS_CACHELINE_SIZE);
if (boundary == (unsigned long)MAXIMAL_DDR_DENSITY_MB * UNIT_MB) { // boundary by design
if ((readl(verify_addr) == MAGIC_DATA) &&
(readl(verify_addr2) == MAGIC_DATA2) &&
(readl(verify_addr3) == MAGIC_DATA3))
if ((readl((void *)verify_addr) == MAGIC_DATA) &&
(readl((void *)verify_addr2) == MAGIC_DATA2) &&
(readl((void *)verify_addr3) == MAGIC_DATA3))
return 0;
}
else {
writel(MAGIC_DATA4, verify_addr4); // writing out of boundary
writel(MAGIC_DATA4, (void *)verify_addr4); // writing out of boundary
invalidate_dcache_range(verify_addr4, verify_addr4 + CONFIG_SYS_CACHELINE_SIZE);
if ((readl(verify_addr) == MAGIC_DATA4) && // overwrite by verify_addr4
(readl(verify_addr2) == MAGIC_DATA2) &&
(readl(verify_addr3) == MAGIC_DATA3) &&
(readl(verify_addr4) == MAGIC_DATA4))
if ((readl((void *)verify_addr) == MAGIC_DATA4) && // overwrite by verify_addr4
(readl((void *)verify_addr2) == MAGIC_DATA2) &&
(readl((void *)verify_addr3) == MAGIC_DATA3) &&
(readl((void *)verify_addr4) == MAGIC_DATA4))
return 0;
}

View File

@@ -24,6 +24,10 @@ static int booti_start(cmd_tbl_t *cmdtp, int flag, int argc,
ulong ld;
ulong relocated_addr;
ulong image_size;
char *tmp;
ulong dest_end;
ulong decomp_dst;
ulong comp_len;
ret = do_bootm_states(cmdtp, flag, argc, argv, BOOTM_STATE_START,
images, 1);
@@ -38,6 +42,29 @@ static int booti_start(cmd_tbl_t *cmdtp, int flag, int argc,
debug("* kernel: cmdline image address = 0x%08lx\n", ld);
}
tmp = map_sysmem(ld, 0);
decomp_dst = env_get_ulong("kernel_comp_addr_r", 16, 0);
comp_len = env_get_ulong("kernel_comp_size", 16, 0);
if (!decomp_dst || !comp_len) {
puts("kernel_comp_addr_r or kernel_comp_size aren't defined!\n");
return -EINVAL;
}
ret = image_decomp(IH_COMP_GZIP, 0, ld, IH_TYPE_KERNEL,
(void *)decomp_dst, (void *)ld, comp_len,
comp_len * 10, &dest_end);
if (!ret) {
printf("Kernel image compression size = 0x%08lx, address = 0x%08lx\n",
comp_len, decomp_dst);
memmove((void *)ld, (void *)decomp_dst, dest_end);
} else {
printf("failed to decompress kernel image: %d\n", ret);
}
ret = booti_setup(ld, &relocated_addr, &image_size, false);
if (ret != 0)
return 1;

View File

@@ -335,7 +335,7 @@ static int label_localboot(struct pxe_label *label)
* Loads fdt overlays specified in 'fdtoverlays'.
*/
#ifdef CONFIG_OF_LIBFDT_OVERLAY
static void label_boot_fdtoverlay(struct cmd_tbl *cmdtp, struct pxe_label *label)
static void label_boot_fdtoverlay(cmd_tbl_t *cmdtp, struct pxe_label *label)
{
char *fdtoverlay = label->fdtoverlays;
struct fdt_header *working_fdt;

View File

@@ -13,7 +13,7 @@ CONFIG_DDR_BOARD_CONFIG=y
CONFIG_ARCH_RV64I=y
CONFIG_DISTRO_DEFAULTS=y
CONFIG_BUILD_TARGET="u-boot-with-spl.bin"
CONFIG_DEFAULT_FDT_FILE="thead/light-beagle.dtb"
CONFIG_DEFAULT_FDT_FILE="thead/th1520-beaglev-ahead.dtb"
CONFIG_BOARD_LATE_INIT=y
CONFIG_DISPLAY_CPUINFO=y
CONFIG_DISPLAY_BOARDINFO=y

View File

@@ -88,7 +88,7 @@ CONFIG_USB_FUNCTION_MASS_STORAGE=y
# CONFIG_SPL_USE_TINY_PRINTF is not set
# CONFIG_EFI_LOADER is not set
# CONFIG_LIGHT_SEC_BOOT is not set
CONFIG_DEFAULT_FDT_FILE="thead/light-lpi4a-16gb.dtb"
CONFIG_DEFAULT_FDT_FILE="thead/th1520-lichee-pi-4a-16g.dtb"
CONFIG_BOARD_LATE_INIT=y
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_DM_VIDEO=y

View File

@@ -88,7 +88,7 @@ CONFIG_USB_FUNCTION_MASS_STORAGE=y
# CONFIG_SPL_USE_TINY_PRINTF is not set
# CONFIG_EFI_LOADER is not set
# CONFIG_LIGHT_SEC_BOOT is not set
CONFIG_DEFAULT_FDT_FILE="thead/light-lpi4a-cluster-16gb.dtb"
CONFIG_DEFAULT_FDT_FILE="thead/th1520-lpi4a-cluster-16g.dtb"
CONFIG_BOARD_LATE_INIT=y
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_DM_VIDEO=y

View File

@@ -87,7 +87,7 @@ CONFIG_USB_FUNCTION_MASS_STORAGE=y
# CONFIG_SPL_USE_TINY_PRINTF is not set
# CONFIG_EFI_LOADER is not set
# CONFIG_LIGHT_SEC_BOOT is not set
CONFIG_DEFAULT_FDT_FILE="thead/light-lpi4a-cluster.dtb"
CONFIG_DEFAULT_FDT_FILE="thead/th1520-lpi4a-cluster.dtb"
CONFIG_BOARD_LATE_INIT=y
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_DM_VIDEO=y

View File

@@ -88,7 +88,7 @@ CONFIG_USB_FUNCTION_MASS_STORAGE=y
# CONFIG_SPL_USE_TINY_PRINTF is not set
# CONFIG_EFI_LOADER is not set
# CONFIG_LIGHT_SEC_BOOT is not set
CONFIG_DEFAULT_FDT_FILE="thead/light-lpi4a-console-16g.dtb"
CONFIG_DEFAULT_FDT_FILE="thead/th1520-lpi4a-console-16g.dtb"
CONFIG_BOARD_LATE_INIT=y
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_DM_VIDEO=y

View File

@@ -87,7 +87,7 @@ CONFIG_USB_FUNCTION_MASS_STORAGE=y
# CONFIG_SPL_USE_TINY_PRINTF is not set
# CONFIG_EFI_LOADER is not set
# CONFIG_LIGHT_SEC_BOOT is not set
CONFIG_DEFAULT_FDT_FILE="thead/light-lpi4a-console.dtb"
CONFIG_DEFAULT_FDT_FILE="thead/th1520-lpi4a-console.dtb"
CONFIG_BOARD_LATE_INIT=y
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_DM_VIDEO=y

View File

@@ -90,7 +90,7 @@ CONFIG_USB_FUNCTION_MASS_STORAGE=y
# CONFIG_SPL_USE_TINY_PRINTF is not set
# CONFIG_EFI_LOADER is not set
# CONFIG_LIGHT_SEC_BOOT is not set
CONFIG_DEFAULT_FDT_FILE="thead/light-lpi4a.dtb"
CONFIG_DEFAULT_FDT_FILE="thead/th1520-lichee-pi-4a.dtb"
CONFIG_BOARD_LATE_INIT=y
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_DM_VIDEO=y

View File

@@ -145,6 +145,7 @@
"dtb_addr=0x03800000\0" \
"fdt_addr_r=0x03800000\0" \
"fdtoverlay_addr_r=0x03700000\0" \
"initrd_high=0x1a000000\0" \
"kernel_addr_r=0x00200000\0" \
"ramdisk_addr_r=0x06000000\0" \
"boot_conf_addr_r=0xc0000000\0" \
@@ -165,6 +166,8 @@
"emmc_dev=0\0" \
"sdcard_dev=1\0" \
"mmc_select=if test -e ${boottype} ${default_mmcdev}:${mmcbootpart} ${boot_conf_file}; then mmcdev=1; else mmcdev=0; fi;\0" \
"kernel_comp_addr_r=0x20000000\0" \
"kernel_comp_size=0x08000000\0" \
"boot_conf_file=/extlinux/extlinux.conf\0" \
"uuid_rootfsA=80a5a8e9-c744-491a-93c1-4f4194fd690a\0" \
"uuid_swap=5ebcaaf0-e098-43b9-beef-1f8deedd135e\0" \