[v5,26/26] board: sopine: Enable SPI/SPI-FLASH

Message ID 20181231165927.13803-27-jagan@amarulasolutions.com
State New
Headers show
Series
  • [v5,01/26] clk: Add Allwinner A64 CLK driver
Related show

Commit Message

Jagan Teki Dec. 31, 2018, 4:59 p.m. UTC
Sopine has Winbond SPI flash, so enable the same to use
flash on Sopine board.

Cc: TL Lim <tllim@pine64.org>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 .../dts/sun50i-a64-sopine-baseboard-u-boot.dtsi  | 16 ++++++++++++++++
 configs/sopine_baseboard_defconfig               |  7 +++++++
 2 files changed, 23 insertions(+)
 create mode 100644 arch/arm/dts/sun50i-a64-sopine-baseboard-u-boot.dtsi

Comments

Maxime Ripard Jan. 7, 2019, 1:04 p.m. UTC | #1
On Mon, Dec 31, 2018 at 10:29:27PM +0530, Jagan Teki wrote:
> Sopine has Winbond SPI flash, so enable the same to use
> flash on Sopine board.
> 
> Cc: TL Lim <tllim@pine64.org>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>  .../dts/sun50i-a64-sopine-baseboard-u-boot.dtsi  | 16 ++++++++++++++++
>  configs/sopine_baseboard_defconfig               |  7 +++++++
>  2 files changed, 23 insertions(+)
>  create mode 100644 arch/arm/dts/sun50i-a64-sopine-baseboard-u-boot.dtsi
> 
> diff --git a/arch/arm/dts/sun50i-a64-sopine-baseboard-u-boot.dtsi b/arch/arm/dts/sun50i-a64-sopine-baseboard-u-boot.dtsi
> new file mode 100644
> index 0000000000..9661b95d15
> --- /dev/null
> +++ b/arch/arm/dts/sun50i-a64-sopine-baseboard-u-boot.dtsi
> @@ -0,0 +1,16 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2018 Jagan Teki <jagan@amarulasolutions.com>
> + */
> +
> +/ {
> +	aliases {
> +		spi0 = &spi0;
> +	};
> +};
> +
> +&spi0  {
> +	flash@0 {
> +		compatible = "spi-flash";
> +	};
> +};
> diff --git a/configs/sopine_baseboard_defconfig b/configs/sopine_baseboard_defconfig
> index 0a189fc03d..5e6dc33d4d 100644
> --- a/configs/sopine_baseboard_defconfig
> +++ b/configs/sopine_baseboard_defconfig
> @@ -12,9 +12,16 @@ CONFIG_SPL_SPI_SUNXI=y
>  CONFIG_NR_DRAM_BANKS=1
>  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
>  # CONFIG_CMD_FLASH is not set
> +CONFIG_CMD_SF=y
>  # CONFIG_SPL_DOS_PARTITION is not set
>  # CONFIG_SPL_EFI_PARTITION is not set
>  CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-sopine-baseboard"
> +CONFIG_SPI=y
> +CONFIG_DM_SPI=y
> +CONFIG_SUN6I_SPI=y
> +CONFIG_DM_SPI_FLASH=y
> +CONFIG_SPI_FLASH=y
> +CONFIG_SPI_FLASH_WINBOND=y

SPI, DM_SPI and SUN6I_SPI seem redundant to me, just like
SPI_FLASH_WINBOND, DM_SPI_FLASH, and SPI_FLASH.

We should do better to provide the needed Kconfig select/depends
on/defaults to have to enable only the SPI_FLASH_WINBOND. Everything
else can be derived from that.

Maxime

Patch

diff --git a/arch/arm/dts/sun50i-a64-sopine-baseboard-u-boot.dtsi b/arch/arm/dts/sun50i-a64-sopine-baseboard-u-boot.dtsi
new file mode 100644
index 0000000000..9661b95d15
--- /dev/null
+++ b/arch/arm/dts/sun50i-a64-sopine-baseboard-u-boot.dtsi
@@ -0,0 +1,16 @@ 
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Jagan Teki <jagan@amarulasolutions.com>
+ */
+
+/ {
+	aliases {
+		spi0 = &spi0;
+	};
+};
+
+&spi0  {
+	flash@0 {
+		compatible = "spi-flash";
+	};
+};
diff --git a/configs/sopine_baseboard_defconfig b/configs/sopine_baseboard_defconfig
index 0a189fc03d..5e6dc33d4d 100644
--- a/configs/sopine_baseboard_defconfig
+++ b/configs/sopine_baseboard_defconfig
@@ -12,9 +12,16 @@  CONFIG_SPL_SPI_SUNXI=y
 CONFIG_NR_DRAM_BANKS=1
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 # CONFIG_CMD_FLASH is not set
+CONFIG_CMD_SF=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-sopine-baseboard"
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_SUN6I_SPI=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_SUN8I_EMAC=y
 CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_EHCI_HCD=y