diff options
author | Haaland Chen <haaland@milkv.io> | 2023-11-29 17:18:19 +0800 |
---|---|---|
committer | Han Gao/Revy/Rabenda <rabenda.cn@gmail.com> | 2023-12-03 11:32:41 +0800 |
commit | 253adbc8e9fa0264e03aa3854c4291be5156b411 (patch) | |
tree | 88aff8c977eac81f4244c1de7a83b52145f5de1c | |
parent | 985e884b0b938ec9da6173f569ce5fb6c7f1e2fb (diff) |
board: light-c910: add function light_c910_set_gpio_output_high
Signed-off-by: Haaland Chen <haaland@milkv.io>
-rw-r--r-- | board/thead/light-c910/board.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/board/thead/light-c910/board.c b/board/thead/light-c910/board.c index b02b0e95..6ebbbb59 100644 --- a/board/thead/light-c910/board.c +++ b/board/thead/light-c910/board.c @@ -9,6 +9,7 @@ #include <dwc3-uboot.h> #include <usb.h> #include <cpu_func.h> +#include <asm/gpio.h> #ifdef CONFIG_USB_DWC3 static struct dwc3_device dwc3_device_data = { @@ -111,3 +112,32 @@ int do_bootslave(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) return 0; } #endif + +static void light_c910_set_gpio_output_high(void) +{ + ofnode node; + struct gpio_desc select_gpio; + + printf("%s: trying to set gpio output high\n", __func__); + + node = ofnode_path("/config"); + if (!ofnode_valid(node)) { + printf("%s: no /config node?\n", __func__); + return; + } + + if (gpio_request_by_name_nodev(node, "select-gpio", 0, + &select_gpio, GPIOD_IS_OUT)) { + printf("%s: could not find a /config/select-gpio\n", __func__); + return; + } + + dm_gpio_set_value(&select_gpio, 1); +} + +int misc_init_r(void) +{ + light_c910_set_gpio_output_high(); + + return 0; +}
\ No newline at end of file |