mirror of
https://github.com/revyos/th1520-vendor-uboot.git
synced 2026-07-20 15:08:09 +02:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac3b305def | ||
|
|
57fa274f6d | ||
|
|
c1a95ddefe | ||
|
|
93ff49d9f5 | ||
|
|
6278bac553 | ||
|
|
b5ee6e549a |
33
.github/workflows/build.yml
vendored
33
.github/workflows/build.yml
vendored
@@ -111,48 +111,17 @@ 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@v4
|
||||
with:
|
||||
name: thead-u-uboot-${{ matrix.name }}
|
||||
path: output/*.bin
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user