diff mbox series

[u-boot,v2019.04-aspeed-openbmc,v2,2/2] board: qualcomm: dc-scm-v1: add initial version of Qualcomm DC-SCM V1 board

Message ID 20220707223058.2722999-3-quic_jaehyoo@quicinc.com
State New
Headers show
Series Add Qualcomm DC-SCM V1 board support | expand

Commit Message

Jae Hyun Yoo July 7, 2022, 10:30 p.m. UTC
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@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

Comments

Joel Stanley July 8, 2022, 5:47 a.m. UTC | #1
On Thu, 7 Jul 2022 at 22:32, Jae Hyun Yoo <quic_jaehyoo@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@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@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
>
Jae Hyun Yoo July 8, 2022, 5:58 a.m. UTC | #2
On 7/7/2022 10:47 PM, Joel Stanley wrote:
> On Thu, 7 Jul 2022 at 22:32, Jae Hyun Yoo <quic_jaehyoo@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@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@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.

Yes, this part can be changed like you suggested but this board specific
code needs to be added since other implementations are also in the queue
such as other gpio handling code, default fan speed setting, FRU
parsing, MAC address setting and NC-SI fdt overriding so I want to add
this set as is as an initial commit.

Thanks,
Jae

>> +
>> +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
>>
Joel Stanley July 8, 2022, 6:11 a.m. UTC | #3
On Fri, 8 Jul 2022 at 05:59, Jae Hyun Yoo <quic_jaehyoo@quicinc.com> wrote:
>
> On 7/7/2022 10:47 PM, Joel Stanley wrote:
> > On Thu, 7 Jul 2022 at 22:32, Jae Hyun Yoo <quic_jaehyoo@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@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@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.
>
> Yes, this part can be changed like you suggested but this board specific
> code needs to be added since other implementations are also in the queue
> such as other gpio handling code, default fan speed setting, FRU
> parsing, MAC address setting and NC-SI fdt overriding so I want to add
> this set as is as an initial commit.

Okay. I'll merge this series and we can see how it evolves from there.

We should consider doing future development on the upstream list, and
backporting from there.

>
> Thanks,
> Jae
>
> >> +
> >> +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
> >>
Jae Hyun Yoo July 8, 2022, 6:19 a.m. UTC | #4
On 7/7/2022 11:11 PM, Joel Stanley wrote:
[...]

>> Yes, this part can be changed like you suggested but this board specific
>> code needs to be added since other implementations are also in the queue
>> such as other gpio handling code, default fan speed setting, FRU
>> parsing, MAC address setting and NC-SI fdt overriding so I want to add
>> this set as is as an initial commit.
> 
> Okay. I'll merge this series and we can see how it evolves from there.
> 
> We should consider doing future development on the upstream list, and
> backporting from there.

Thanks, Joel!

I'll consider doing the new u-boot upstreaming flow like what we are
doing for linux.

-Jae
diff mbox series

Patch

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@1e780000171"
+
+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);
+
+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;
+}