Re: [U-Boot] [RFC PATCH 1/8] arm: actions: Add common framework for Actions Semi SoCs

2019-01-03 Thread André Przywara
On 03/01/2019 13:26, Amit Singh Tomar wrote:
> This adds common arch owl support that drives both s700
> and s900, 64-bits SoCs from Actions Semiconductor.

Nice cleanup.

> 
> Signed-off-by: Amit Singh Tomar 
> ---
>  arch/arm/Kconfig   |  2 --
>  arch/arm/mach-owl/Kconfig  | 31 +++
>  arch/arm/mach-owl/Makefile |  2 +-
>  arch/arm/mach-owl/soc.c| 56 
> ++
>  configs/bubblegum_96_defconfig |  3 +--
>  include/configs/bubblegum_96.h | 42 ---
>  include/configs/owl-common.h   | 42 +++
>  include/configs/s700.h | 15 +++
>  include/configs/s900.h | 18 ++
>  9 files changed, 147 insertions(+), 64 deletions(-)
>  create mode 100644 arch/arm/mach-owl/soc.c
>  delete mode 100644 include/configs/bubblegum_96.h
>  create mode 100644 include/configs/owl-common.h
>  create mode 100644 include/configs/s700.h
>  create mode 100644 include/configs/s900.h
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index b5952ad..b478096 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -760,7 +760,6 @@ config ARCH_MX5
>  
>  config ARCH_OWL
>   bool "Actions Semi OWL SoCs"
> - select ARM64
>   select DM
>   select DM_SERIAL
>   select OF_CONTROL
> @@ -1555,7 +1554,6 @@ source "board/spear/spear600/Kconfig"
>  source "board/spear/x600/Kconfig"
>  source "board/st/stv0991/Kconfig"
>  source "board/tcl/sl50/Kconfig"
> -source "board/ucRobotics/bubblegum_96/Kconfig"
>  source "board/birdland/bav335x/Kconfig"
>  source "board/toradex/colibri_pxa270/Kconfig"
>  source "board/vscom/baltos/Kconfig"
> diff --git a/arch/arm/mach-owl/Kconfig b/arch/arm/mach-owl/Kconfig
> index 199e772..3143782 100644
> --- a/arch/arm/mach-owl/Kconfig
> +++ b/arch/arm/mach-owl/Kconfig
> @@ -1,27 +1,24 @@
>  if ARCH_OWL
>  
> -config SYS_SOC
> - default "owl"
> -
>  choice
> -prompt "Actions Semi OWL SoCs board select"
> +prompt "SemiActions SoC Variant"

Even after refactoring the company is still called Actions Semi ;-)

>  optional
>  
> -config TARGET_BUBBLEGUM_96
> - bool "96Boards Bubblegum-96"
> - help
> -   Support for 96Boards Bubblegum-96. This board complies with
> -   96Board Consumer Edition Specification. Features:
> -   - Actions Semi S900 SoC (4xCortex A53, Power VR G6230 GPU)
> -   - 2GiB RAM
> -   - 8GiB eMMC, uSD slot
> -   - WiFi, Bluetooth and GPS module
> -   - 2x Host, 1x Device USB port
> -   - HDMI
> -   - 20-pin low speed and 40-pin high speed expanders, 6 LED, 3 buttons
> +config MACH_S700
> +bool "SemiActions S700"
> +select ARM64

It's probably a bit premature to introduce S700 here already. Just move
that to a later patch.

> +
> +config MACH_S900
> +bool "SemiActions S900"
> +select ARM64
>  
>  endchoice
>  
> -source "board/ucRobotics/bubblegum_96/Kconfig"
> +config SYS_CONFIG_NAME
> +default "s900" if MACH_S900
> +default "s700" if MACH_S700

Same here.

> +
> +config SYS_SOC
> +default "owl"
>  
>  endif
> diff --git a/arch/arm/mach-owl/Makefile b/arch/arm/mach-owl/Makefile
> index 1b43dc2..2a76ee0 100644
> --- a/arch/arm/mach-owl/Makefile
> +++ b/arch/arm/mach-owl/Makefile
> @@ -1,3 +1,3 @@
>  # SPDX-License-Identifier:   GPL-2.0+
>  
> -obj-y += sysmap-s900.o

That breaks Bubblegum compilation. Just keep it in for now and remove it
in the next patch.

> +obj-y += soc.o
> diff --git a/arch/arm/mach-owl/soc.c b/arch/arm/mach-owl/soc.c
> new file mode 100644
> index 000..a4c202d
> --- /dev/null
> +++ b/arch/arm/mach-owl/soc.c
> @@ -0,0 +1,56 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Bubblegum-96 Boards Support

That line should be changed to reflect the new generic nature of that file.

> + *
> + * Copyright (C) 2018 Manivannan Sadhasivam 
> 
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +/*
> + * dram_init - sets uboots idea of sdram size
> + */
> +int dram_init(void)
> +{
> + gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
> + return 0;
> +}
> +
> +/* This is called after dram_init() so use get_ram_size result */
> +int dram_init_banksize(void)
> +{
> + gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
> + gd->bd->bi_dram[0].size = gd->ram_size;
> +
> + return 0;
> +}
> +
> +static void show_psci_version(void)
> +{
> + struct arm_smccc_res res;
> +
> + arm_smccc_smc(ARM_PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0, 0, 0, 0, 0, );
> +
> + printf("PSCI:  v%ld.%ld\n",
> +PSCI_VERSION_MAJOR(res.a0),
> + PSCI_VERSION_MINOR(res.a0));

looks like a whitespace issue

> +}
> +
> +int board_init(void)
> +{
> + show_psci_version();
> +
> + return 0;
> +}
> +
> +void reset_cpu(ulong addr)
> +{
> + psci_system_reset();
> +}
> diff --git 

[U-Boot] [RFC PATCH 1/8] arm: actions: Add common framework for Actions Semi SoCs

2019-01-03 Thread Amit Singh Tomar
This adds common arch owl support that drives both s700
and s900, 64-bits SoCs from Actions Semiconductor.

Signed-off-by: Amit Singh Tomar 
---
 arch/arm/Kconfig   |  2 --
 arch/arm/mach-owl/Kconfig  | 31 +++
 arch/arm/mach-owl/Makefile |  2 +-
 arch/arm/mach-owl/soc.c| 56 ++
 configs/bubblegum_96_defconfig |  3 +--
 include/configs/bubblegum_96.h | 42 ---
 include/configs/owl-common.h   | 42 +++
 include/configs/s700.h | 15 +++
 include/configs/s900.h | 18 ++
 9 files changed, 147 insertions(+), 64 deletions(-)
 create mode 100644 arch/arm/mach-owl/soc.c
 delete mode 100644 include/configs/bubblegum_96.h
 create mode 100644 include/configs/owl-common.h
 create mode 100644 include/configs/s700.h
 create mode 100644 include/configs/s900.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index b5952ad..b478096 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -760,7 +760,6 @@ config ARCH_MX5
 
 config ARCH_OWL
bool "Actions Semi OWL SoCs"
-   select ARM64
select DM
select DM_SERIAL
select OF_CONTROL
@@ -1555,7 +1554,6 @@ source "board/spear/spear600/Kconfig"
 source "board/spear/x600/Kconfig"
 source "board/st/stv0991/Kconfig"
 source "board/tcl/sl50/Kconfig"
-source "board/ucRobotics/bubblegum_96/Kconfig"
 source "board/birdland/bav335x/Kconfig"
 source "board/toradex/colibri_pxa270/Kconfig"
 source "board/vscom/baltos/Kconfig"
diff --git a/arch/arm/mach-owl/Kconfig b/arch/arm/mach-owl/Kconfig
index 199e772..3143782 100644
--- a/arch/arm/mach-owl/Kconfig
+++ b/arch/arm/mach-owl/Kconfig
@@ -1,27 +1,24 @@
 if ARCH_OWL
 
-config SYS_SOC
-   default "owl"
-
 choice
-prompt "Actions Semi OWL SoCs board select"
+prompt "SemiActions SoC Variant"
 optional
 
-config TARGET_BUBBLEGUM_96
-   bool "96Boards Bubblegum-96"
-   help
- Support for 96Boards Bubblegum-96. This board complies with
- 96Board Consumer Edition Specification. Features:
- - Actions Semi S900 SoC (4xCortex A53, Power VR G6230 GPU)
- - 2GiB RAM
- - 8GiB eMMC, uSD slot
- - WiFi, Bluetooth and GPS module
- - 2x Host, 1x Device USB port
- - HDMI
- - 20-pin low speed and 40-pin high speed expanders, 6 LED, 3 buttons
+config MACH_S700
+bool "SemiActions S700"
+select ARM64
+
+config MACH_S900
+bool "SemiActions S900"
+select ARM64
 
 endchoice
 
-source "board/ucRobotics/bubblegum_96/Kconfig"
+config SYS_CONFIG_NAME
+default "s900" if MACH_S900
+default "s700" if MACH_S700
+
+config SYS_SOC
+default "owl"
 
 endif
diff --git a/arch/arm/mach-owl/Makefile b/arch/arm/mach-owl/Makefile
index 1b43dc2..2a76ee0 100644
--- a/arch/arm/mach-owl/Makefile
+++ b/arch/arm/mach-owl/Makefile
@@ -1,3 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0+
 
-obj-y += sysmap-s900.o
+obj-y += soc.o
diff --git a/arch/arm/mach-owl/soc.c b/arch/arm/mach-owl/soc.c
new file mode 100644
index 000..a4c202d
--- /dev/null
+++ b/arch/arm/mach-owl/soc.c
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Bubblegum-96 Boards Support
+ *
+ * Copyright (C) 2018 Manivannan Sadhasivam 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * dram_init - sets uboots idea of sdram size
+ */
+int dram_init(void)
+{
+   gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+   return 0;
+}
+
+/* This is called after dram_init() so use get_ram_size result */
+int dram_init_banksize(void)
+{
+   gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
+   gd->bd->bi_dram[0].size = gd->ram_size;
+
+   return 0;
+}
+
+static void show_psci_version(void)
+{
+   struct arm_smccc_res res;
+
+   arm_smccc_smc(ARM_PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0, 0, 0, 0, 0, );
+
+   printf("PSCI:  v%ld.%ld\n",
+  PSCI_VERSION_MAJOR(res.a0),
+   PSCI_VERSION_MINOR(res.a0));
+}
+
+int board_init(void)
+{
+   show_psci_version();
+
+   return 0;
+}
+
+void reset_cpu(ulong addr)
+{
+   psci_system_reset();
+}
diff --git a/configs/bubblegum_96_defconfig b/configs/bubblegum_96_defconfig
index 4b00a17..6c31b1c 100644
--- a/configs/bubblegum_96_defconfig
+++ b/configs/bubblegum_96_defconfig
@@ -2,7 +2,7 @@ CONFIG_ARM=y
 CONFIG_ARM_SMCCC=y
 CONFIG_ARCH_OWL=y
 CONFIG_SYS_TEXT_BASE=0x1100
-CONFIG_TARGET_BUBBLEGUM_96=y
+CONFIG_MACH_S900=y
 CONFIG_IDENT_STRING="\nBubblegum-96"
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_NR_DRAM_BANKS=1
@@ -19,5 +19,4 @@ CONFIG_CMD_TIMER=y
 CONFIG_DEFAULT_DEVICE_TREE="bubblegum_96"
 CONFIG_CLK=y
 CONFIG_CLK_OWL=y
-CONFIG_CLK_S900=y
 CONFIG_OWL_SERIAL=y
diff --git a/include/configs/bubblegum_96.h b/include/configs/bubblegum_96.h
deleted file mode 100644
index e1dc37b..000
--- a/include/configs/bubblegum_96.h