1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. 4 */ 5 6 #include <common.h> 7 #include <asm/gpio.h> 8 9 #define BMC_OK_GPIO "gpio@1e780000171" 10 11 static void gpio_init(void) 12 { 13 struct gpio_desc desc; 14 int ret; 15 16 ret = dm_gpio_lookup_name(BMC_OK_GPIO, &desc); 17 if (ret) 18 return; 19 ret = dm_gpio_request(&desc, "bmc_ok"); 20 if (ret) 21 return; 22 ret = dm_gpio_set_dir_flags(&desc, GPIOD_IS_OUT); 23 if (ret) 24 goto free_exit; 25 26 dm_gpio_set_value(&desc, 0); 27 28 free_exit: 29 dm_gpio_free(desc.dev, &desc); 30 } 31 32 int board_early_init_f(void) 33 { 34 return 0; 35 } 36 37 int board_late_init(void) 38 { 39 gpio_init(); 40 41 return 0; 42 } 43