[U-Boot,10/10] board: sopine: Enable SPI/SPI-FLASH

Message ID 20190209131500.29954-11-jagan@amarulasolutions.com
State Changes Requested
Delegated to: Jagannadha Sutradharudu Teki
Headers show
Series
  • spi: Add Allwinner A31 SPI driver
Related show

Commit Message

Jagan Teki Feb. 9, 2019, 1:15 p.m.
Sopine has Winbond SPI flash, so enable the same to use
flash on Sopine board.

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

Comments

Andre Przywara Feb. 13, 2019, 1:21 a.m. | #1
On 09/02/2019 13:15, Jagan Teki wrote:
> Sopine has Winbond SPI flash, so enable the same to use
> flash on Sopine board.
> 
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>  arch/arm/dts/sun50i-a64-sopine-baseboard-u-boot.dtsi | 12 ++++++++++++
>  configs/sopine_baseboard_defconfig                   |  4 ++++
>  2 files changed, 16 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..02b1ae046e
> --- /dev/null
> +++ b/arch/arm/dts/sun50i-a64-sopine-baseboard-u-boot.dtsi
> @@ -0,0 +1,12 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2018 Jagan Teki <jagan@amarulasolutions.com>
> + */
> +
> +#include "sunxi-u-boot.dtsi"
> +
> +/ {
> +	aliases {
> +		spi0 = &spi0;
> +	};
> +};
> diff --git a/configs/sopine_baseboard_defconfig b/configs/sopine_baseboard_defconfig
> index 9d7e3a2b6c..a94e3c21fd 100644
> --- a/configs/sopine_baseboard_defconfig
> +++ b/configs/sopine_baseboard_defconfig
> @@ -10,11 +10,15 @@ CONFIG_MMC0_CD_PIN=""
>  CONFIG_MMC_SUNXI_SLOT_EXTRA=2
>  CONFIG_SPL_SPI_SUNXI=y
>  CONFIG_NR_DRAM_BANKS=1
> +CONFIG_CMD_SF=y
>  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
>  # CONFIG_CMD_FLASH is not set
>  # CONFIG_SPL_DOS_PARTITION is not set
>  # CONFIG_SPL_EFI_PARTITION is not set
>  CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-sopine-baseboard"
> +CONFIG_DM_SPI=y
> +CONFIG_DM_SPI_FLASH=y
> +CONFIG_SPI_FLASH_WINBOND=y

That isn't enough, you need CONFIG_SPI=y as well, otherwise the build fails.
I'd suggest to move DM_SPI=y and DM_SPI_FLASH=y to arch/arm/Kconfig (as
mentioned in the previous mail) and keep CONFIG_SPI=y here, to enable
SPI support for a particular board. Then keep ..._WINBOND here to set
the flash chip. For which you need CONFIG_SPI_FLASH, I believe. Which
sounds somewhat weird.

Cheers,
Andre.

>  CONFIG_SUN8I_EMAC=y
>  CONFIG_USB_EHCI_HCD=y
>  CONFIG_USB_OHCI_HCD=y
>
Jagan Teki Feb. 13, 2019, 10:27 a.m. | #2
On Wed, Feb 13, 2019 at 6:53 AM André Przywara <andre.przywara@arm.com> wrote:
>
> On 09/02/2019 13:15, Jagan Teki wrote:
> > Sopine has Winbond SPI flash, so enable the same to use
> > flash on Sopine board.
> >
> > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> > ---
> >  arch/arm/dts/sun50i-a64-sopine-baseboard-u-boot.dtsi | 12 ++++++++++++
> >  configs/sopine_baseboard_defconfig                   |  4 ++++
> >  2 files changed, 16 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..02b1ae046e
> > --- /dev/null
> > +++ b/arch/arm/dts/sun50i-a64-sopine-baseboard-u-boot.dtsi
> > @@ -0,0 +1,12 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Copyright (C) 2018 Jagan Teki <jagan@amarulasolutions.com>
> > + */
> > +
> > +#include "sunxi-u-boot.dtsi"
> > +
> > +/ {
> > +     aliases {
> > +             spi0 = &spi0;
> > +     };
> > +};
> > diff --git a/configs/sopine_baseboard_defconfig b/configs/sopine_baseboard_defconfig
> > index 9d7e3a2b6c..a94e3c21fd 100644
> > --- a/configs/sopine_baseboard_defconfig
> > +++ b/configs/sopine_baseboard_defconfig
> > @@ -10,11 +10,15 @@ CONFIG_MMC0_CD_PIN=""
> >  CONFIG_MMC_SUNXI_SLOT_EXTRA=2
> >  CONFIG_SPL_SPI_SUNXI=y
> >  CONFIG_NR_DRAM_BANKS=1
> > +CONFIG_CMD_SF=y
> >  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
> >  # CONFIG_CMD_FLASH is not set
> >  # CONFIG_SPL_DOS_PARTITION is not set
> >  # CONFIG_SPL_EFI_PARTITION is not set
> >  CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-sopine-baseboard"
> > +CONFIG_DM_SPI=y
> > +CONFIG_DM_SPI_FLASH=y
> > +CONFIG_SPI_FLASH_WINBOND=y
>
> That isn't enough, you need CONFIG_SPI=y as well, otherwise the build fails.
> I'd suggest to move DM_SPI=y and DM_SPI_FLASH=y to arch/arm/Kconfig (as
> mentioned in the previous mail) and keep CONFIG_SPI=y here, to enable
> SPI support for a particular board. Then keep ..._WINBOND here to set
> the flash chip. For which you need CONFIG_SPI_FLASH, I believe. Which
> sounds somewhat weird.

Did the similar work already[1], plan to use these on top of these set.

[1] https://patchwork.ozlabs.org/patch/1039175/

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..02b1ae046e
--- /dev/null
+++ b/arch/arm/dts/sun50i-a64-sopine-baseboard-u-boot.dtsi
@@ -0,0 +1,12 @@ 
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Jagan Teki <jagan@amarulasolutions.com>
+ */
+
+#include "sunxi-u-boot.dtsi"
+
+/ {
+	aliases {
+		spi0 = &spi0;
+	};
+};
diff --git a/configs/sopine_baseboard_defconfig b/configs/sopine_baseboard_defconfig
index 9d7e3a2b6c..a94e3c21fd 100644
--- a/configs/sopine_baseboard_defconfig
+++ b/configs/sopine_baseboard_defconfig
@@ -10,11 +10,15 @@  CONFIG_MMC0_CD_PIN=""
 CONFIG_MMC_SUNXI_SLOT_EXTRA=2
 CONFIG_SPL_SPI_SUNXI=y
 CONFIG_NR_DRAM_BANKS=1
+CONFIG_CMD_SF=y
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-sopine-baseboard"
+CONFIG_DM_SPI=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_SUN8I_EMAC=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_OHCI_HCD=y