[PATCH u-boot v2019.04-aspeed-openbmc v2 2/2] board: qualcomm: dc-scm-v1: add initial version of Qualcomm DC-SCM V1 board
Joel Stanley
joel at jms.id.au
Fri Jul 8 15:47:21 AEST 2022
On Thu, 7 Jul 2022 at 22:32, Jae Hyun Yoo <quic_jaehyoo at quicinc.com> wrote:
>
> Add initial version of Qualcomm DC-SCM V1 board. It has BMC_OK GPIO
> initialization code as an initial commit.
>
> Signed-off-by: Jae Hyun Yoo <quic_jaehyoo at quicinc.com>
> ---
> Changes in v2:
> * Changed GPIO handling using GPIO driver. (Joel)
> * Moved board specific code to the manufacturer folder. (Joel)
>
> arch/arm/mach-aspeed/ast2600/Kconfig | 8 ++++++
> board/qualcomm/dc-scm-v1/Kconfig | 15 ++++++++++
> board/qualcomm/dc-scm-v1/Makefile | 1 +
> board/qualcomm/dc-scm-v1/dc-scm-v1.c | 42 ++++++++++++++++++++++++++++
> 4 files changed, 66 insertions(+)
> create mode 100644 board/qualcomm/dc-scm-v1/Kconfig
> create mode 100644 board/qualcomm/dc-scm-v1/Makefile
> create mode 100644 board/qualcomm/dc-scm-v1/dc-scm-v1.c
>
> diff --git a/arch/arm/mach-aspeed/ast2600/Kconfig b/arch/arm/mach-aspeed/ast2600/Kconfig
> index 46cc1ad1dbd9..713bdf37d83f 100644
> --- a/arch/arm/mach-aspeed/ast2600/Kconfig
> +++ b/arch/arm/mach-aspeed/ast2600/Kconfig
> @@ -46,6 +46,13 @@ config TARGET_AST2600_INTEL
> AST2600-INTEL is an Intel Eagle Stream CRB with
> AST2600 as the BMC.
>
> +config TARGET_QUALCOMM_DC_SCM_V1
> + bool "QUALCOMM-DC-SCM-V1"
> + depends on ASPEED_AST2600
> + help
> + QUALCOMM-DC-SCM-V1 is a Qualcomm DC-SCM V1 board which is
> + equipped with AST2600.
> +
> endchoice
>
> source "board/aspeed/evb_ast2600/Kconfig"
> @@ -53,5 +60,6 @@ source "board/aspeed/fpga_ast2600/Kconfig"
> source "board/aspeed/slt_ast2600/Kconfig"
> source "board/aspeed/ast2600_ibm/Kconfig"
> source "board/aspeed/ast2600_intel/Kconfig"
> +source "board/qualcomm/dc-scm-v1/Kconfig"
>
> endif
> diff --git a/board/qualcomm/dc-scm-v1/Kconfig b/board/qualcomm/dc-scm-v1/Kconfig
> new file mode 100644
> index 000000000000..57e311a20729
> --- /dev/null
> +++ b/board/qualcomm/dc-scm-v1/Kconfig
> @@ -0,0 +1,15 @@
> +if TARGET_QUALCOMM_DC_SCM_V1
> +
> +config SYS_BOARD
> + default "dc-scm-v1"
> +
> +config SYS_VENDOR
> + default "qualcomm"
> +
> +config SYS_SOC
> + default "ast2600"
> +
> +config SYS_CONFIG_NAME
> + default "evb_ast2600a1_spl"
> +
> +endif
> diff --git a/board/qualcomm/dc-scm-v1/Makefile b/board/qualcomm/dc-scm-v1/Makefile
> new file mode 100644
> index 000000000000..cb2aae7f9298
> --- /dev/null
> +++ b/board/qualcomm/dc-scm-v1/Makefile
> @@ -0,0 +1 @@
> +obj-y += dc-scm-v1.o
> diff --git a/board/qualcomm/dc-scm-v1/dc-scm-v1.c b/board/qualcomm/dc-scm-v1/dc-scm-v1.c
> new file mode 100644
> index 000000000000..4b81eac46bdf
> --- /dev/null
> +++ b/board/qualcomm/dc-scm-v1/dc-scm-v1.c
> @@ -0,0 +1,42 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
> + */
> +
> +#include <common.h>
> +#include <asm/gpio.h>
> +
> +#define BMC_OK_GPIO "gpio at 1e780000171"
Wow, is that how the u-boot driver works? That's eye watering!
> +
> +static void gpio_init(void)
> +{
> + struct gpio_desc desc;
> + int ret;
> +
> + ret = dm_gpio_lookup_name(BMC_OK_GPIO, &desc);
> + if (ret)
> + return;
> + ret = dm_gpio_request(&desc, "bmc_ok");
> + if (ret)
> + return;
> + ret = dm_gpio_set_dir_flags(&desc, GPIOD_IS_OUT);
> + if (ret)
> + goto free_exit;
> +
> + dm_gpio_set_value(&desc, 0);
Given you just want to set the value, you could use a gpio hog. Sorry
for not mentioning it before, it only just occurred to me:
+&gpio0 {
+ u-boot,dm-pre-reloc;
+
+ bmc_okay {
+ u-boot,dm-pre-reloc;
+ gpio-hog;
+ output-high;
+ gpios = <ASPEED_GPIO(V, 3) GPIO_ACTIVE_LOW>;
+ };
+};
Then you don't need any code.
> +
> +free_exit:
> + dm_gpio_free(desc.dev, &desc);
> +}
> +
> +int board_early_init_f(void)
> +{
> + return 0;
> +}
> +
> +int board_late_init(void)
> +{
> + gpio_init();
> +
> + return 0;
> +}
> --
> 2.25.1
>
More information about the openbmc
mailing list