[PATCH] arm: dts: ls1088a: Update qspi node properties

2021-10-01 Thread Kuldeep Singh
Remove "num-cs" property from device-tree as it is no longer used by
qspi driver anymore.

Also, specify status as "disabled" and enable qspi support in respective
board dts files. This will also help in aligning node properties with
other board properties.

Signed-off-by: Kuldeep Singh 
---
 arch/arm/dts/fsl-ls1088a.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/dts/fsl-ls1088a.dtsi b/arch/arm/dts/fsl-ls1088a.dtsi
index 64caa600ad..685ae27f80 100644
--- a/arch/arm/dts/fsl-ls1088a.dtsi
+++ b/arch/arm/dts/fsl-ls1088a.dtsi
@@ -105,7 +105,7 @@
reg = <0x0 0x20c 0x0 0x1>,
<0x0 0x2000 0x0 0x1000>;
reg-names = "QuadSPI", "QuadSPI-memory";
-   num-cs = <4>;
+   status = "disabled";
};
 
esdhc: esdhc@214 {
-- 
2.25.1



RE: [EXT] S25HS512 not functional with u-boot 2021.10.rc3

2021-09-28 Thread Kuldeep Singh
Hi Harkirat,

> -Original Message-
> From: U-Boot  On Behalf Of Harkirat Virk
> Sent: Wednesday, September 15, 2021 12:21 AM
> To: u-boot@lists.denx.de
> Subject: [EXT] S25HS512 not functional with u-boot 2021.10.rc3
> 
> Caution: EXT Email
> 
> I have a custom board using imx6ul and Spansion S25HS512T Flash. On the
> current version of u-boot (2021.10.rc3) and I am guessing even previous ones
> the Spansion flash is not functioning
> 
> => sf probe
> drivers/core/uclass.c:325-uclass_find_device_by_seq() 0
> drivers/core/uclass.c:333-uclass_find_device_by_seq()- 0 'spi@21e'
> drivers/core/uclass.c:336-uclass_find_device_by_seq()- found
> drivers/spi/spi-uclass.c:282-spi_find_chip_select() fsl_qspi spi@21e:
> spi_find_chip_select: plat=9ef2bf60, cs=0
> drivers/core/uclass.c:325-uclass_find_device_by_seq() 0
> drivers/core/uclass.c:333-uclass_find_device_by_seq()- 0 'spi@21e'
> drivers/core/uclass.c:336-uclass_find_device_by_seq()- found
> drivers/spi/spi-uclass.c:282-spi_find_chip_select() fsl_qspi spi@21e:
> spi_find_chip_select: plat=9ef2bf60, cs=0
> drivers/core/uclass.c:325-uclass_find_device_by_seq() 0
> drivers/core/uclass.c:333-uclass_find_device_by_seq()- 0
> 'iomuxc@20e'
> drivers/core/uclass.c:336-uclass_find_device_by_seq()- found
> drivers/pinctrl/pinctrl-uclass.c:300-pinctrl_select_state_simple()
> jedec_spi_nor s25hs512t@0: set_state_simple op missing
> drivers/spi/fsl_qspi.c:464-fsl_qspi_prepare_lut() fsl_qspi spi@21e:
> CMD[9f] lutval[0:1c00049f1:0 2:0 3:0]

Did you try enabling debug logs in spi-nor framework(spi-nor-core.c) and see 
what jedec id's were return after issuing the command?
And does it match with the one's present in spi-nor-ids.c?

> drivers/spi/spi-uclass.c:438-  spi_get_bus_and_cs() spi_get_bus_and_cs:
> Error path, created=0, device 's25hs512t@0'
> Failed to initialize SPI flash at 0:0 (error -524)
> 
> Result is the same with different modes and frequencies, bus and CS are
> correct
> 
> My DTSI is
> 
>  {
> pinctrl-names = "default";
> pinctrl-0 = <_qspi>;
> status = "okay";
> 
> flash0: s25hs512t@0 {
> #address-cells = <1>;
> #size-cells = <1>;
> compatible = "spansion,s25hs512t", "jedec,spi-nor";

Please use compatible as "jedec,spi-nor" as it is sufficient to detect the 
flash automatically.

> spi-max-frequency = <4000>;
> spi-rx-bus-width = <4>;
> spi-tx-bus-width = <4>;

Since flash cannot be probed, I would recommend using  bus-width as 
<1,1>.
Using <4,4> bus-width will require SPI_FLASH_SFDP to be enabled in defconfig.

Regards
Kuldeep

> reg = <0>;
> spi-mode = <0>;
> m25p,fast-read;
> status = "okay";
> /* some partition information*/
> };
> };
> 
> Defconfig has
> 
> CONFIG_SPI=y
> CONFIG_DM_SPI=y
> CONFIG_FSL_QSPI=y
> CONFIG_MTD=y
> CONFIG_DM_MTD=y
> CONFIG_DM_SPI_FLASH=y
> CONFIG_SF_DEFAULT_MODE=0
> CONFIG_SF_DEFAULT_SPEED=4000
> CONFIG_SPI_FLASH_SPANSION=y
> 
>  DM Tree
> 
> => dm tree
>  Class Index  Probed  DriverName
> ---
>  root  0  [ + ]   root_driver   root_driver
>  thermal   0  [   ]   imx_thermal   |-- imx_thermal
>  simple_bus0  [ + ]   simple_bus|-- soc
>  simple_bus1  [ + ]   simple_bus|   |-- aips-bus@200
>  simple_bus2  [ + ]   simple_bus|   |   |-- spba-bus@200
>  serial0  [ + ]   serial_mxc|   |   |   `-- serial@202
>  gpio  0  [   ]   gpio_mxc  |   |   |-- gpio@209c000
>  gpio  1  [   ]   gpio_mxc  |   |   |-- gpio@20a
>  gpio  2  [   ]   gpio_mxc  |   |   |-- gpio@20a4000
>  gpio  3  [   ]   gpio_mxc  |   |   |-- gpio@20a8000
>  gpio  4  [   ]   gpio_mxc  |   |   |-- gpio@20ac000
>  simple_bus3  [   ]   simple_bus|   |   |-- anatop@20c8000
>  simple_bus4  [   ]   simple_bus|   |   |-- snvs@20cc000
>  pinctrl   0  [ + ]   fsl_imx6q_iomuxc  |   |   `-- iomuxc@20e
>  pinconfig 0  [   ]   pinconfig |   |   |-- i2c1grp
>  pinconfig 1  [   ]   pinconfig |   |   |-- i2c2grp
>  pinconfig 2  [ + ]   pinconfig |   |   |-- qspigrp
>  pinconfig 3  [   ]   pinconfig |   |   |-- ledsgrp
>  pinconfig 4  [ + ]   pinconfig |   |   |-- uart1grp
>  pinconfig 5  [ + ]   pinconfig |   |   |-- usdhc2grp
>  pinconfig 6  [   ]   pinconfig |   |   `-- wdoggrp
>  simple_bus5  [ + ]   simple_bus|   `-- aips-bus@210
>  usb   0  [   ]   ehci_mx6  |   |-- usb@2184000
>  

[PATCH] configs: lx2162a: Enable CONFIG_SPI_FLASH_MT35XU for lx2162a-qds

2021-09-15 Thread Kuldeep Singh
LX2162A-QDS has micron mt35xu512aba flash which requires flag
CONFIG_SPI_FLASH_MT35XU on to probe flash successfully.

Signed-off-by: Kuldeep Singh 
---
 configs/lx2162aqds_tfa_SECURE_BOOT_defconfig   | 1 +
 configs/lx2162aqds_tfa_defconfig   | 1 +
 configs/lx2162aqds_tfa_verified_boot_defconfig | 1 +
 3 files changed, 3 insertions(+)

diff --git a/configs/lx2162aqds_tfa_SECURE_BOOT_defconfig 
b/configs/lx2162aqds_tfa_SECURE_BOOT_defconfig
index 7ade20205c..30ee188fa6 100644
--- a/configs/lx2162aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/lx2162aqds_tfa_SECURE_BOOT_defconfig
@@ -54,6 +54,7 @@ CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_EON=y
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MT35XU=y
 CONFIG_SPI_FLASH_SST=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
diff --git a/configs/lx2162aqds_tfa_defconfig b/configs/lx2162aqds_tfa_defconfig
index 2724f045ed..e0b6cbe4f0 100644
--- a/configs/lx2162aqds_tfa_defconfig
+++ b/configs/lx2162aqds_tfa_defconfig
@@ -62,6 +62,7 @@ CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_EON=y
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MT35XU=y
 CONFIG_SPI_FLASH_SST=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
diff --git a/configs/lx2162aqds_tfa_verified_boot_defconfig 
b/configs/lx2162aqds_tfa_verified_boot_defconfig
index fa2a02753f..d6f160979d 100644
--- a/configs/lx2162aqds_tfa_verified_boot_defconfig
+++ b/configs/lx2162aqds_tfa_verified_boot_defconfig
@@ -63,6 +63,7 @@ CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_EON=y
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MT35XU=y
 CONFIG_SPI_FLASH_SST=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
-- 
2.25.1



[PATCH] configs: ls1046aqds: Configure environment related configs

2021-08-20 Thread Kuldeep Singh
LS1046A-QDS board requires updation in few environment configs in TFA
defconfigs of the board.

Following are the changes:
- Update CONFIG_ENV_ADDR
- Update CONFIG_ENV_SECT_SIZE
- Enable CONFIG_SYS_RELOC_GD_ENV_ADDR

Signed-off-by: Kuldeep Singh 
---
 configs/ls1046aqds_tfa_defconfig | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/configs/ls1046aqds_tfa_defconfig b/configs/ls1046aqds_tfa_defconfig
index 8ae5159f42..1c228f370a 100644
--- a/configs/ls1046aqds_tfa_defconfig
+++ b/configs/ls1046aqds_tfa_defconfig
@@ -7,7 +7,7 @@ CONFIG_SYS_MEMTEST_START=0x8000
 CONFIG_SYS_MEMTEST_END=0x9fff
 CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x50
-CONFIG_ENV_SECT_SIZE=0x1
+CONFIG_ENV_SECT_SIZE=0x2
 CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1046a-qds-duart"
 CONFIG_FSL_USE_PCA9547_MUX=y
@@ -45,7 +45,8 @@ CONFIG_ENV_IS_IN_NAND=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_USE_ENV_SPI_BUS=y
 CONFIG_ENV_SPI_BUS=0
-CONFIG_ENV_ADDR=0x4050
+CONFIG_ENV_ADDR=0x6050
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
 CONFIG_FSL_CAAM=y
-- 
2.25.1



[PATCH] configs: ls1046aqds: Move CONFIG_SPI_FLASH_* definitions to defconfigs

2021-08-19 Thread Kuldeep Singh
LS1046A-QDS has CONFIG_SPI_FLASH_SST, CONFIG_SPI_FLASH_EON and
CONFIG_SPI_FLASH_STMICRO defines present in header. Move these entries
from header to defconfigs.

Signed-off-by: Kuldeep Singh 
---
 configs/ls1046aqds_SECURE_BOOT_defconfig | 3 +++
 configs/ls1046aqds_defconfig | 3 +++
 configs/ls1046aqds_lpuart_defconfig  | 3 +++
 configs/ls1046aqds_nand_defconfig| 3 +++
 configs/ls1046aqds_qspi_defconfig| 3 +++
 configs/ls1046aqds_sdcard_ifc_defconfig  | 3 +++
 configs/ls1046aqds_sdcard_qspi_defconfig | 3 +++
 configs/ls1046aqds_tfa_SECURE_BOOT_defconfig | 3 +++
 configs/ls1046aqds_tfa_defconfig | 3 +++
 include/configs/ls1046aqds.h | 7 ---
 10 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/configs/ls1046aqds_SECURE_BOOT_defconfig 
b/configs/ls1046aqds_SECURE_BOOT_defconfig
index 1e70e37fe5..5c22509bbf 100644
--- a/configs/ls1046aqds_SECURE_BOOT_defconfig
+++ b/configs/ls1046aqds_SECURE_BOOT_defconfig
@@ -47,6 +47,9 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_SF_DEFAULT_BUS=1
+CONFIG_SPI_FLASH_EON=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_SST=y
 CONFIG_PHYLIB=y
 CONFIG_PHYLIB_10G=y
 CONFIG_PHY_REALTEK=y
diff --git a/configs/ls1046aqds_defconfig b/configs/ls1046aqds_defconfig
index 7351e49056..eb5e56f75b 100644
--- a/configs/ls1046aqds_defconfig
+++ b/configs/ls1046aqds_defconfig
@@ -50,6 +50,9 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_SF_DEFAULT_BUS=1
+CONFIG_SPI_FLASH_EON=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_SST=y
 CONFIG_PHYLIB=y
 CONFIG_PHYLIB_10G=y
 CONFIG_PHY_REALTEK=y
diff --git a/configs/ls1046aqds_lpuart_defconfig 
b/configs/ls1046aqds_lpuart_defconfig
index c6f8a36347..90d799cc47 100644
--- a/configs/ls1046aqds_lpuart_defconfig
+++ b/configs/ls1046aqds_lpuart_defconfig
@@ -51,6 +51,9 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_SF_DEFAULT_BUS=1
+CONFIG_SPI_FLASH_EON=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_SST=y
 CONFIG_PHYLIB=y
 CONFIG_PHYLIB_10G=y
 CONFIG_PHY_REALTEK=y
diff --git a/configs/ls1046aqds_nand_defconfig 
b/configs/ls1046aqds_nand_defconfig
index c406d866bd..9b477e0981 100644
--- a/configs/ls1046aqds_nand_defconfig
+++ b/configs/ls1046aqds_nand_defconfig
@@ -58,6 +58,9 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_SF_DEFAULT_BUS=1
+CONFIG_SPI_FLASH_EON=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_SST=y
 CONFIG_PHYLIB=y
 CONFIG_PHYLIB_10G=y
 CONFIG_PHY_REALTEK=y
diff --git a/configs/ls1046aqds_qspi_defconfig 
b/configs/ls1046aqds_qspi_defconfig
index a088c82904..d81cac40a3 100644
--- a/configs/ls1046aqds_qspi_defconfig
+++ b/configs/ls1046aqds_qspi_defconfig
@@ -45,7 +45,10 @@ CONFIG_FSL_CAAM=y
 CONFIG_DM_I2C=y
 CONFIG_FSL_ESDHC=y
 # CONFIG_SPI_FLASH_BAR is not set
+CONFIG_SPI_FLASH_EON=y
 CONFIG_SPI_FLASH_SPANSION=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_SST=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
 CONFIG_PHYLIB_10G=y
diff --git a/configs/ls1046aqds_sdcard_ifc_defconfig 
b/configs/ls1046aqds_sdcard_ifc_defconfig
index 15f8d45a25..2cba6fd41d 100644
--- a/configs/ls1046aqds_sdcard_ifc_defconfig
+++ b/configs/ls1046aqds_sdcard_ifc_defconfig
@@ -68,6 +68,9 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_SF_DEFAULT_BUS=1
+CONFIG_SPI_FLASH_EON=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_SST=y
 CONFIG_PHYLIB=y
 CONFIG_PHYLIB_10G=y
 CONFIG_PHY_REALTEK=y
diff --git a/configs/ls1046aqds_sdcard_qspi_defconfig 
b/configs/ls1046aqds_sdcard_qspi_defconfig
index 3278cd2d2a..6d7e9612b7 100644
--- a/configs/ls1046aqds_sdcard_qspi_defconfig
+++ b/configs/ls1046aqds_sdcard_qspi_defconfig
@@ -60,7 +60,10 @@ CONFIG_FSL_CAAM=y
 CONFIG_DM_I2C=y
 CONFIG_FSL_ESDHC=y
 # CONFIG_SPI_FLASH_BAR is not set
+CONFIG_SPI_FLASH_EON=y
 CONFIG_SPI_FLASH_SPANSION=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_SST=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
 CONFIG_PHYLIB_10G=y
diff --git a/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig 
b/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig
index 42d67dc707..ee66439503 100644
--- a/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig
@@ -49,7 +49,10 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_SF_DEFAULT_BUS=1
+CONFIG_SPI_FLASH_EON=y
 CONFIG_SPI_FLASH_SPANSION=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_SST=y
 CONFIG_PHYLIB=y
 CONFIG_PHYLIB_10G=y
 CONFIG_PHY_REALTEK=y
diff --git a/configs/ls1046aqds_tfa_defconfig b/configs/ls1046aqds_tfa_defconfig
index 8ae5159f42..5c38c26f50 100644
--- a/configs/ls1046aqds_tfa_defconfig
+++ b/configs/ls1046aqds_tfa_defconfig
@@ -59,7 +59,10 @@ CONFIG_SYS_FLASH_CFI=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_SF_DEFAULT_BUS=1

[PATCH 6/6] board: T4240rdb: Extend cs4340_get_fw_addr() functionality

2021-08-09 Thread Kuldeep Singh
T4240RDB supports booting from 2 nor banks(default and altbank). The
corresponding defconfig can only have one entry defined and therefore,
extend cs4340_get_fw_addr() function to overwrite firmware address which
will be later used in cortina firmware.

Signed-off-by: Kuldeep Singh 
---
 board/freescale/t4rdb/t4240rdb.c | 19 +++
 board/freescale/t4rdb/t4rdb.h|  3 +++
 2 files changed, 22 insertions(+)

diff --git a/board/freescale/t4rdb/t4240rdb.c b/board/freescale/t4rdb/t4240rdb.c
index 6ab35ca918..20ce7523e5 100644
--- a/board/freescale/t4rdb/t4240rdb.c
+++ b/board/freescale/t4rdb/t4240rdb.c
@@ -151,3 +151,22 @@ void board_detail(void)
break;
}
 }
+
+ulong *cs4340_get_fw_addr(void)
+{
+   ulong cortina_fw_addr = CONFIG_CORTINA_FW_ADDR;
+
+#ifdef CONFIG_SYS_CORTINA_FW_IN_NOR
+   u8 sw;
+
+   sw = CPLD_READ(vbank);
+   sw = sw & CPLD_BANK_SEL_MASK;
+
+   if (sw == 0)
+   cortina_fw_addr = CORTINA_FW_ADDR_IFCNOR;
+   else if (sw == 4)
+   cortina_fw_addr = CORTINA_FW_ADDR_IFCNOR_ALTBANK;
+#endif
+
+   return (ulong *)cortina_fw_addr;
+}
diff --git a/board/freescale/t4rdb/t4rdb.h b/board/freescale/t4rdb/t4rdb.h
index 3f1fa7bbd2..06779f552f 100644
--- a/board/freescale/t4rdb/t4rdb.h
+++ b/board/freescale/t4rdb/t4rdb.h
@@ -11,6 +11,9 @@
 #define CONFIG_SYS_NUM_FM1_DTSEC   4
 #define CONFIG_SYS_NUM_FM2_DTSEC   4
 
+#define CORTINA_FW_ADDR_IFCNOR 0xefe0
+#define CORTINA_FW_ADDR_IFCNOR_ALTBANK 0xebf0
+
 void fdt_fixup_board_enet(void *blob);
 void pci_of_setup(void *blob, struct bd_info *bd);
 
-- 
2.25.1



[PATCH 5/6] board: t208x: Extend cs4340_get_fw_addr() functionality

2021-08-09 Thread Kuldeep Singh
T2080RDB supports booting from 2 nor banks(default and altbank). The
corresponding defconfig can only have one entry defined and therefore,
extend cs4340_get_fw_addr() function to overwrite firmware address which
will be later used in cortina firmware.

Signed-off-by: Kuldeep Singh 
---
 board/freescale/t208xrdb/t208xrdb.c | 20 
 board/freescale/t208xrdb/t208xrdb.h |  3 +++
 2 files changed, 23 insertions(+)

diff --git a/board/freescale/t208xrdb/t208xrdb.c 
b/board/freescale/t208xrdb/t208xrdb.c
index 1f0cdee0b8..2f61bfcb37 100644
--- a/board/freescale/t208xrdb/t208xrdb.c
+++ b/board/freescale/t208xrdb/t208xrdb.c
@@ -158,3 +158,23 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 
return 0;
 }
+
+ulong *cs4340_get_fw_addr(void)
+{
+   ulong cortina_fw_addr = CONFIG_CORTINA_FW_ADDR;
+
+#ifdef CONFIG_SYS_CORTINA_FW_IN_NOR
+   u8 reg;
+
+   reg = CPLD_READ(flash_csr);
+   if (!(reg & CPLD_BOOT_SEL)) {
+   reg = ((reg & CPLD_LBMAP_MASK) >> CPLD_LBMAP_SHIFT);
+   if (reg == 0)
+   cortina_fw_addr = CORTINA_FW_ADDR_IFCNOR;
+   else if (reg == 4)
+   cortina_fw_addr = CORTINA_FW_ADDR_IFCNOR_ALTBANK;
+   }
+#endif
+
+   return (ulong *)cortina_fw_addr;
+}
diff --git a/board/freescale/t208xrdb/t208xrdb.h 
b/board/freescale/t208xrdb/t208xrdb.h
index edbc860c9d..26998898e8 100644
--- a/board/freescale/t208xrdb/t208xrdb.h
+++ b/board/freescale/t208xrdb/t208xrdb.h
@@ -7,6 +7,9 @@
 #ifndef __CORENET_DS_H__
 #define __CORENET_DS_H__
 
+#define CORTINA_FW_ADDR_IFCNOR 0xefe0
+#define CORTINA_FW_ADDR_IFCNOR_ALTBANK 0xebe0
+
 void fdt_fixup_board_enet(void *blob);
 void pci_of_setup(void *blob, struct bd_info *bd);
 void fdt_fixup_board_fman_ethernet(void *blob);
-- 
2.25.1



[PATCH 4/6] board: ls2088ardb: Extend cs4340_get_fw_addr() functionality

2021-08-09 Thread Kuldeep Singh
LS2088A-RDB supports TFA boot source and has 2 nor banks(default and
altbank) and QSPI as boot source. The corresponding defconfig can only
have one entry defined and therefore, extend cs4340_get_fw_addr()
function to overwrite firmware address which will be later used in
cortina firmware.

Signed-off-by: Kuldeep Singh 
---
 board/freescale/ls2080ardb/ls2080ardb.c | 38 +
 1 file changed, 38 insertions(+)

diff --git a/board/freescale/ls2080ardb/ls2080ardb.c 
b/board/freescale/ls2080ardb/ls2080ardb.c
index 6504cf768f..e8722f20c1 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -33,6 +33,9 @@
 #endif
 #include "../common/vid.h"
 
+#define CORTINA_FW_ADDR_IFCNOR 0x58098
+#define CORTINA_FW_ADDR_IFCNOR_ALTBANK 0x58498
+#define CORTINA_FW_ADDR_QSPI   0x98
 #define PIN_MUX_SEL_SDHC   0x00
 #define PIN_MUX_SEL_DSPI   0x0a
 
@@ -235,6 +238,41 @@ int config_board_mux(int ctrl_type)
return 0;
 }
 
+ulong *cs4340_get_fw_addr(void)
+{
+#ifdef CONFIG_TFABOOT
+   struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
+   u32 svr = gur_in32(>svr);
+#endif
+   ulong cortina_fw_addr = CONFIG_CORTINA_FW_ADDR;
+
+#ifdef CONFIG_TFABOOT
+   /* LS2088A TFA boot */
+   if (SVR_SOC_VER(svr) == SVR_LS2088A) {
+   enum boot_src src = get_boot_src();
+   u8 sw;
+
+   switch (src) {
+   case BOOT_SOURCE_IFC_NOR:
+   sw = QIXIS_READ(brdcfg[0]);
+   sw = (sw & 0x0f);
+   if (sw == 0)
+   cortina_fw_addr = CORTINA_FW_ADDR_IFCNOR;
+   else if (sw == 4)
+   cortina_fw_addr = 
CORTINA_FW_ADDR_IFCNOR_ALTBANK;
+   break;
+   case BOOT_SOURCE_QSPI_NOR:
+   /* Only one bank in QSPI */
+   cortina_fw_addr = CORTINA_FW_ADDR_QSPI;
+   break;
+   default:
+   printf("WARNING: Boot source not found\n");
+   }
+   }
+#endif
+   return (ulong *)cortina_fw_addr;
+}
+
 int board_init(void)
 {
 #ifdef CONFIG_FSL_MC_ENET
-- 
2.25.1



[PATCH 3/6] net: cortina: Add support for tfa boot in cortina firmware

2021-08-09 Thread Kuldeep Singh
Add support for boards supporting TFA boot separately in cortina
firmware. Please note, a weak function is defined to retrieve firmware
address values as CONFIG_CORTINA_FW_ADDR is now defined in defconfig and
can only have one possible value defined. This weak function will help
in overwrting the values to get proper addresses as per boot source.

Signed-off-by: Kuldeep Singh 
---
 drivers/net/phy/cortina.c | 79 ++-
 1 file changed, 69 insertions(+), 10 deletions(-)

diff --git a/drivers/net/phy/cortina.c b/drivers/net/phy/cortina.c
index b381a431fd..2ac0295245 100644
--- a/drivers/net/phy/cortina.c
+++ b/drivers/net/phy/cortina.c
@@ -17,12 +17,11 @@
 #include 
 #include 
 #include 
-#ifdef CONFIG_SYS_CORTINA_FW_IN_NAND
 #include 
-#elif defined(CONFIG_SYS_CORTINA_FW_IN_SPIFLASH)
 #include 
-#elif defined(CONFIG_SYS_CORTINA_FW_IN_MMC)
 #include 
+#ifdef CONFIG_ARM64
+#include 
 #endif
 
 #ifndef CONFIG_PHYLIB_10G
@@ -124,6 +123,11 @@ struct cortina_reg_config cortina_reg_cfg[] = {
{VILLA_LINE_SDS_COMMON_STX0_TX_OUTPUT_CTRLB, 0xc01E},
 };
 
+__weak ulong *cs4340_get_fw_addr(void)
+{
+   return (ulong *)CONFIG_CORTINA_FW_ADDR;
+}
+
 void cs4340_upload_firmware(struct phy_device *phydev)
 {
char line_temp[0x50] = {0};
@@ -132,22 +136,76 @@ void cs4340_upload_firmware(struct phy_device *phydev)
int i, line_cnt = 0, column_cnt = 0;
struct cortina_reg_config fw_temp;
char *addr = NULL;
+   ulong cortina_fw_addr = (ulong)cs4340_get_fw_addr();
+
+#ifdef CONFIG_TFABOOT
+   enum boot_src src = get_boot_src();
+
+   if (src == BOOT_SOURCE_IFC_NOR) {
+   addr = (char *)cortina_fw_addr;
+   } else if (src == BOOT_SOURCE_IFC_NAND) {
+   int ret;
+   size_t fw_length = CONFIG_CORTINA_FW_LENGTH;
+
+   addr = malloc(CONFIG_CORTINA_FW_LENGTH);
+   ret = nand_read(get_nand_dev_by_index(0),
+  (loff_t)cortina_fw_addr, 
_length, (u_char *)addr);
+   if (ret == -EUCLEAN) {
+   printf("NAND read of Cortina firmware at 0x%lx failed 
%d\n",
+  cortina_fw_addr, ret);
+   }
+   } else if (src == BOOT_SOURCE_QSPI_NOR) {
+   int ret;
+   struct spi_flash *ucode_flash;
 
+   addr = malloc(CONFIG_CORTINA_FW_LENGTH);
+   ucode_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, 
CONFIG_ENV_SPI_CS,
+
CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
+   if (!ucode_flash) {
+   puts("SF: probe for Cortina ucode failed\n");
+   } else {
+   ret = spi_flash_read(ucode_flash, cortina_fw_addr,
+   
CONFIG_CORTINA_FW_LENGTH, addr);
+   if (ret)
+   puts("SF: read for Cortina ucode failed\n");
+   spi_flash_free(ucode_flash);
+   }
+   } else if (src == BOOT_SOURCE_SD_MMC) {
+   int dev = CONFIG_SYS_MMC_ENV_DEV;
+   u32 cnt = CONFIG_CORTINA_FW_LENGTH / 512;
+   u32 blk = cortina_fw_addr / 512;
+   struct mmc *mmc = find_mmc_device(CONFIG_SYS_MMC_ENV_DEV);
+
+   if (!mmc) {
+   puts("Failed to find MMC device for Cortina ucode\n");
+   } else {
+   addr = malloc(CONFIG_CORTINA_FW_LENGTH);
+   printf("MMC read: dev # %u, block # %u, count %u ...\n",
+ dev, blk, cnt);
+   mmc_init(mmc);
+#ifdef CONFIG_BLK
+   (void)blk_dread(mmc_get_blk_desc(mmc), blk, cnt, addr);
+#else
+   (void)mmc->block_dev.block_read(>block_dev, blk, 
cnt, addr);
+#endif
+   }
+   }
+#else /* CONFIG_TFABOOT */
 #if defined(CONFIG_SYS_CORTINA_FW_IN_NOR) || \
defined(CONFIG_SYS_CORTINA_FW_IN_REMOTE)
 
-   addr = (char *)CONFIG_CORTINA_FW_ADDR;
+   addr = (char *)cortina_fw_addr;
 #elif defined(CONFIG_SYS_CORTINA_FW_IN_NAND)
int ret;
size_t fw_length = CONFIG_CORTINA_FW_LENGTH;
 
addr = malloc(CONFIG_CORTINA_FW_LENGTH);
ret = nand_read(get_nand_dev_by_index(0),
-   (loff_t)CONFIG_CORTINA_FW_ADDR,
+   (loff_t)cortina_fw_addr,
_length, (u_char *)addr);
if (ret == -EUCLEAN) {
-   printf("NAND read of Cortina firmware at 0x%x failed %d\n",
-  CONFIG_CORTINA_FW_ADDR, ret);
+   printf("NAND read of Cortina firmware at 0x%lx failed %d\n",
+  cortina_fw_addr, ret);
}
 #elif defined(

[PATCH 2/6] configs: Migrate CORTINA_FW_ADDR and CORTINA_FW_LENGTH to Kconfig

2021-08-09 Thread Kuldeep Singh
Use moveconfig.py script to convert below defines to Kconfig and move
these entries to defconfigs.
CONFIG_CORTINA_FW_ADDR
CONFIG_CORTINA_FW_LENGTH

Signed-off-by: Kuldeep Singh 
---
 configs/T2080RDB_NAND_defconfig   |  1 +
 configs/T2080RDB_SDCARD_defconfig |  1 +
 configs/T2080RDB_SPIFLASH_defconfig   |  1 +
 configs/T2080RDB_defconfig|  1 +
 configs/T2080RDB_revD_NAND_defconfig  |  1 +
 configs/T2080RDB_revD_SDCARD_defconfig|  1 +
 configs/T2080RDB_revD_SPIFLASH_defconfig  |  1 +
 configs/T2080RDB_revD_defconfig   |  1 +
 configs/T4240RDB_SDCARD_defconfig |  1 +
 configs/T4240RDB_defconfig|  1 +
 configs/ls2080ardb_SECURE_BOOT_defconfig  |  1 +
 configs/ls2080ardb_defconfig  |  1 +
 configs/ls2080ardb_nand_defconfig |  1 +
 configs/ls2081ardb_defconfig  |  1 +
 configs/ls2088ardb_qspi_SECURE_BOOT_defconfig |  1 +
 configs/ls2088ardb_qspi_defconfig |  1 +
 drivers/net/phy/Kconfig   | 10 ++
 include/configs/T208xRDB.h|  6 --
 include/configs/T4240RDB.h|  2 --
 include/configs/ls2080ardb.h  | 10 --
 scripts/config_whitelist.txt  |  2 --
 21 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/configs/T2080RDB_NAND_defconfig b/configs/T2080RDB_NAND_defconfig
index 95a2c778fc..93d8d4ba56 100644
--- a/configs/T2080RDB_NAND_defconfig
+++ b/configs/T2080RDB_NAND_defconfig
@@ -69,6 +69,7 @@ CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
 CONFIG_PHY_CORTINA=y
 CONFIG_SYS_CORTINA_FW_IN_NAND=y
+CONFIG_CORTINA_FW_ADDR=0x20
 CONFIG_PHY_REALTEK=y
 CONFIG_DM_ETH=y
 CONFIG_DM_MDIO=y
diff --git a/configs/T2080RDB_SDCARD_defconfig 
b/configs/T2080RDB_SDCARD_defconfig
index 21d22df4eb..10598804a1 100644
--- a/configs/T2080RDB_SDCARD_defconfig
+++ b/configs/T2080RDB_SDCARD_defconfig
@@ -66,6 +66,7 @@ CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
 CONFIG_PHY_CORTINA=y
 CONFIG_SYS_CORTINA_FW_IN_MMC=y
+CONFIG_CORTINA_FW_ADDR=0x114000
 CONFIG_PHY_REALTEK=y
 CONFIG_DM_ETH=y
 CONFIG_DM_MDIO=y
diff --git a/configs/T2080RDB_SPIFLASH_defconfig 
b/configs/T2080RDB_SPIFLASH_defconfig
index 393b6db286..59963fdf37 100644
--- a/configs/T2080RDB_SPIFLASH_defconfig
+++ b/configs/T2080RDB_SPIFLASH_defconfig
@@ -68,6 +68,7 @@ CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
 CONFIG_PHY_CORTINA=y
 CONFIG_SYS_CORTINA_FW_IN_SPIFLASH=y
+CONFIG_CORTINA_FW_ADDR=0x12
 CONFIG_PHY_REALTEK=y
 CONFIG_DM_ETH=y
 CONFIG_DM_MDIO=y
diff --git a/configs/T2080RDB_defconfig b/configs/T2080RDB_defconfig
index 24e927c735..466e91743f 100644
--- a/configs/T2080RDB_defconfig
+++ b/configs/T2080RDB_defconfig
@@ -53,6 +53,7 @@ CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
 CONFIG_PHY_CORTINA=y
+CONFIG_CORTINA_FW_ADDR=0xEFE0
 CONFIG_PHY_REALTEK=y
 CONFIG_DM_ETH=y
 CONFIG_DM_MDIO=y
diff --git a/configs/T2080RDB_revD_NAND_defconfig 
b/configs/T2080RDB_revD_NAND_defconfig
index 250c2d5e96..f6eeade2a3 100644
--- a/configs/T2080RDB_revD_NAND_defconfig
+++ b/configs/T2080RDB_revD_NAND_defconfig
@@ -70,6 +70,7 @@ CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
 CONFIG_PHY_CORTINA=y
 CONFIG_SYS_CORTINA_FW_IN_NAND=y
+CONFIG_CORTINA_FW_ADDR=0x20
 CONFIG_PHY_REALTEK=y
 CONFIG_DM_ETH=y
 CONFIG_DM_MDIO=y
diff --git a/configs/T2080RDB_revD_SDCARD_defconfig 
b/configs/T2080RDB_revD_SDCARD_defconfig
index d5eea40797..0286610cb0 100644
--- a/configs/T2080RDB_revD_SDCARD_defconfig
+++ b/configs/T2080RDB_revD_SDCARD_defconfig
@@ -67,6 +67,7 @@ CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
 CONFIG_PHY_CORTINA=y
 CONFIG_SYS_CORTINA_FW_IN_MMC=y
+CONFIG_CORTINA_FW_ADDR=0x114000
 CONFIG_PHY_REALTEK=y
 CONFIG_DM_ETH=y
 CONFIG_DM_MDIO=y
diff --git a/configs/T2080RDB_revD_SPIFLASH_defconfig 
b/configs/T2080RDB_revD_SPIFLASH_defconfig
index 4d38f4b978..eb073ce4be 100644
--- a/configs/T2080RDB_revD_SPIFLASH_defconfig
+++ b/configs/T2080RDB_revD_SPIFLASH_defconfig
@@ -69,6 +69,7 @@ CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
 CONFIG_PHY_CORTINA=y
 CONFIG_SYS_CORTINA_FW_IN_SPIFLASH=y
+CONFIG_CORTINA_FW_ADDR=0x12
 CONFIG_PHY_REALTEK=y
 CONFIG_DM_ETH=y
 CONFIG_DM_MDIO=y
diff --git a/configs/T2080RDB_revD_defconfig b/configs/T2080RDB_revD_defconfig
index 2ecbabf99e..ab7096e520 100644
--- a/configs/T2080RDB_revD_defconfig
+++ b/configs/T2080RDB_revD_defconfig
@@ -54,6 +54,7 @@ CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
 CONFIG_PHY_CORTINA=y
+CONFIG_CORTINA_FW_ADDR=0xEFE0
 CONFIG_PHY_REALTEK=y
 CONFIG_DM_ETH=y
 CONFIG_DM_MDIO=y
diff --git a/configs/T4240RDB_SDCARD_defconfig 
b/configs/T4240RDB_SDCARD_defconfig
index 2230e674fc..c1ca2565e2 100644
--- a/configs/T4240RDB_SDCARD_defconfig
+++ b/configs/T4240RDB_SDCARD_defconfig
@@ -57,6 +57,7 @@ CONFIG_SPI_FLASH_SST=y
 CONFIG_PHYLIB=y
 CONFIG_PHYLIB_10G=y
 CONFIG_PHY_CORTINA=y
+CONFIG_CORTINA_FW_ADDR=0x77f000
 CONFIG_PHY_TERANETICS=y

[PATCH 1/6] env: Kconfig: Add default option for PHY_CORTINA

2021-08-09 Thread Kuldeep Singh
Add PHY_CORTINA as default option in SYS_MMC_ENV_DEV Kconfig entry as
PHY_CORTINA require SYS_MMC_ENV_DEV value similar to FMAN_ENET or QE.
This helps in resolving compilation failure.

Signed-off-by: Kuldeep Singh 
---
 env/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/env/Kconfig b/env/Kconfig
index 67ff172e3a..c0dff1fd81 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -616,7 +616,7 @@ config SYS_RELOC_GD_ENV_ADDR
 config SYS_MMC_ENV_DEV
int "mmc device number"
depends on ENV_IS_IN_MMC || ENV_IS_IN_FAT || SYS_LS_PPA_FW_IN_MMC || \
-   CMD_MVEBU_BUBT || FMAN_ENET || QE
+   CMD_MVEBU_BUBT || FMAN_ENET || QE || PHY_CORTINA
default 0
help
  MMC device number on the platform where the environment is stored.
-- 
2.25.1



[PATCH 0/6] Cortina Firmware fixes

2021-08-09 Thread Kuldeep Singh
Cortina firmware currently supports non-tfa boot support and therefore
incorrect firmware address value is obtained. This patchset is an
attempt to fix cortina firmware.

LS2088A-RDB, T2080RDB and T4240RDB are also updated to incorporate
multiple firmware address values by extending a weak function.

Kuldeep Singh (6):
  env: Kconfig: Add default option for PHY_CORTINA
  configs: Migrate CORTINA_FW_ADDR and CORTINA_FW_LENGTH to Kconfig
  net: cortina: Add support for tfa boot in cortina firmware
  board: ls2088ardb: Extend cs4340_get_fw_addr() functionality
  board: t208x: Extend cs4340_get_fw_addr() functionality
  board: T4240rdb: Extend cs4340_get_fw_addr() functionality

 board/freescale/ls2080ardb/ls2080ardb.c   | 38 +
 board/freescale/t208xrdb/t208xrdb.c   | 20 +
 board/freescale/t208xrdb/t208xrdb.h   |  3 +
 board/freescale/t4rdb/t4240rdb.c  | 19 +
 board/freescale/t4rdb/t4rdb.h |  3 +
 configs/T2080RDB_NAND_defconfig   |  1 +
 configs/T2080RDB_SDCARD_defconfig |  1 +
 configs/T2080RDB_SPIFLASH_defconfig   |  1 +
 configs/T2080RDB_defconfig|  1 +
 configs/T2080RDB_revD_NAND_defconfig  |  1 +
 configs/T2080RDB_revD_SDCARD_defconfig|  1 +
 configs/T2080RDB_revD_SPIFLASH_defconfig  |  1 +
 configs/T2080RDB_revD_defconfig   |  1 +
 configs/T4240RDB_SDCARD_defconfig |  1 +
 configs/T4240RDB_defconfig|  1 +
 configs/ls2080ardb_SECURE_BOOT_defconfig  |  1 +
 configs/ls2080ardb_defconfig  |  1 +
 configs/ls2080ardb_nand_defconfig |  1 +
 configs/ls2081ardb_defconfig  |  1 +
 configs/ls2088ardb_qspi_SECURE_BOOT_defconfig |  1 +
 configs/ls2088ardb_qspi_defconfig |  1 +
 drivers/net/phy/Kconfig   | 10 +++
 drivers/net/phy/cortina.c | 79 ---
 env/Kconfig   |  2 +-
 include/configs/T208xRDB.h|  6 --
 include/configs/T4240RDB.h|  2 -
 include/configs/ls2080ardb.h  | 10 ---
 scripts/config_whitelist.txt  |  2 -
 28 files changed, 179 insertions(+), 31 deletions(-)

-- 
2.25.1



[Patch v2 2/2] spi: nxp_fspi: Implement errata workaround for LS1028A

2021-08-03 Thread Kuldeep Singh
Errata ERR050568 description says that "Flash access by FlexSPI AHB
command may not work with platform frequency equal to 300 MHz" on
LS1028A.

By default, smaller length reads(equal to RX FIFO size) are done by IP
bus and larger length reads using AHB bus. For adding errata workaround,
use IP bus to read entire flash contents and disable AHB path when
platform frequency is 300Mhz.

Signed-off-by: Kuldeep Singh 
Reviewed-by: Jagan Teki 
---
v2:
- Rebase to top of tree
- Resolve buildman error as imx6ul report compilation failure by
  guarding changes under CONFIG_FSL_LAYERSCAPE flag.

 drivers/spi/nxp_fspi.c | 53 ++
 1 file changed, 48 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/nxp_fspi.c b/drivers/spi/nxp_fspi.c
index e1b3d2d77b..9030504bc7 100644
--- a/drivers/spi/nxp_fspi.c
+++ b/drivers/spi/nxp_fspi.c
@@ -41,6 +41,11 @@
 #include 
 #include 
 #include 
+#ifdef CONFIG_FSL_LAYERSCAPE
+#include 
+#include 
+#include 
+#endif
 #include 
 #include 
 #include 
@@ -315,7 +320,7 @@ struct nxp_fspi_devtype_data {
bool little_endian;
 };
 
-static const struct nxp_fspi_devtype_data lx2160a_data = {
+static struct nxp_fspi_devtype_data lx2160a_data = {
.rxfifo = SZ_512,   /* (64  * 64 bits)  */
.txfifo = SZ_1K,/* (128 * 64 bits)  */
.ahb_buf_size = SZ_2K,  /* (256 * 64 bits)  */
@@ -323,7 +328,7 @@ static const struct nxp_fspi_devtype_data lx2160a_data = {
.little_endian = true,  /* little-endian*/
 };
 
-static const struct nxp_fspi_devtype_data imx8mm_data = {
+static struct nxp_fspi_devtype_data imx8mm_data = {
.rxfifo = SZ_512,   /* (64  * 64 bits)  */
.txfifo = SZ_1K,/* (128 * 64 bits)  */
.ahb_buf_size = SZ_2K,  /* (256 * 64 bits)  */
@@ -338,7 +343,7 @@ struct nxp_fspi {
u32 memmap_phy;
u32 memmap_phy_size;
struct clk clk, clk_en;
-   const struct nxp_fspi_devtype_data *devtype_data;
+   struct nxp_fspi_devtype_data *devtype_data;
 };
 
 static inline int needs_ip_only(struct nxp_fspi *f)
@@ -529,8 +534,8 @@ static void nxp_fspi_prepare_lut(struct nxp_fspi *f,
for (i = 0; i < ARRAY_SIZE(lutval); i++)
fspi_writel(f, lutval[i], base + FSPI_LUT_REG(i));
 
-   dev_dbg(f->dev, "CMD[%x] lutval[0:%x \t 1:%x \t 2:%x \t 3:%x]\n",
-   op->cmd.opcode, lutval[0], lutval[1], lutval[2], lutval[3]);
+   dev_dbg(f->dev, "CMD[%x] lutval[0:%x \t 1:%x \t 2:%x \t 3:%x], size: 
0x%08x\n",
+   op->cmd.opcode, lutval[0], lutval[1], lutval[2], lutval[3], 
op->data.nbytes);
 
/* lock LUT */
fspi_writel(f, FSPI_LUTKEY_VALUE, f->iobase + FSPI_LUTKEY);
@@ -827,6 +832,33 @@ static int nxp_fspi_adjust_op_size(struct spi_slave *slave,
return 0;
 }
 
+#ifdef CONFIG_FSL_LAYERSCAPE
+static void erratum_err050568(struct nxp_fspi *f)
+{
+   struct sys_info sysinfo;
+   u32 svr = 0, freq = 0;
+
+   /* Check for LS1028A variants */
+   svr = SVR_SOC_VER(get_svr());
+   if (svr != SVR_LS1017A ||
+   svr != SVR_LS1018A ||
+   svr != SVR_LS1027A ||
+   svr != SVR_LS1028A) {
+   dev_dbg(f->dev, "Errata applicable only for LS1028A 
variants\n");
+   return;
+   }
+
+   /* Read PLL frequency */
+   get_sys_info();
+   freq = sysinfo.freq_systembus / 100; /* Convert to MHz */
+   dev_dbg(f->dev, "svr: %08x, Frequency: %dMhz\n", svr, freq);
+
+   /* Use IP bus only if PLL is 300MHz */
+   if (freq == 300)
+   f->devtype_data->quirks |= FSPI_QUIRK_USE_IP_ONLY;
+}
+#endif
+
 static int nxp_fspi_default_setup(struct nxp_fspi *f)
 {
void __iomem *base = f->iobase;
@@ -847,6 +879,17 @@ static int nxp_fspi_default_setup(struct nxp_fspi *f)
return ret;
 #endif
 
+#ifdef CONFIG_FSL_LAYERSCAPE
+   /*
+* ERR050568: Flash access by FlexSPI AHB command may not work with
+* platform frequency equal to 300 MHz on LS1028A.
+* LS1028A reuses LX2160A compatible entry. Make errata applicable for
+* Layerscape LS1028A platform family.
+*/
+   if (device_is_compatible(f->dev, "nxp,lx2160a-fspi"))
+   erratum_err050568(f);
+#endif
+
/* Reset the module */
/* w1c register, wait unit clear */
ret = fspi_readl_poll_tout(f, f->iobase + FSPI_MCR0,
-- 
2.25.1



[Patch v2 1/2] spi: nxp-fspi: Add support for IP read only

2021-08-03 Thread Kuldeep Singh
Add support for disabling AHB bus and read entire flash contents via IP
bus only. Please note, this enables IP bus read using a quirk which can
be enabled directly in device-type data or in existence of an errata
where AHB bus may need to be disabled.

Signed-off-by: Kuldeep Singh 
Acked-by: Jagan Teki 
---
v2:
- rebase to top of tree

 drivers/spi/nxp_fspi.c | 24 
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/nxp_fspi.c b/drivers/spi/nxp_fspi.c
index 6c5bad4c2c..e1b3d2d77b 100644
--- a/drivers/spi/nxp_fspi.c
+++ b/drivers/spi/nxp_fspi.c
@@ -304,6 +304,9 @@
 #define POLL_TOUT  5000
 #define NXP_FSPI_MAX_CHIPSELECT4
 
+/* Access flash memory using IP bus only */
+#define FSPI_QUIRK_USE_IP_ONLY BIT(0)
+
 struct nxp_fspi_devtype_data {
unsigned int rxfifo;
unsigned int txfifo;
@@ -338,6 +341,11 @@ struct nxp_fspi {
const struct nxp_fspi_devtype_data *devtype_data;
 };
 
+static inline int needs_ip_only(struct nxp_fspi *f)
+{
+   return f->devtype_data->quirks & FSPI_QUIRK_USE_IP_ONLY;
+}
+
 /*
  * R/W functions for big- or little-endian registers:
  * The FSPI controller's endianness is independent of
@@ -769,12 +777,14 @@ static int nxp_fspi_exec_op(struct spi_slave *slave,
 
nxp_fspi_prepare_lut(f, op);
/*
-* If we have large chunks of data, we read them through the AHB bus
-* by accessing the mapped memory. In all other cases we use
-* IP commands to access the flash.
+* If we have large chunks of data, we read them through the AHB bus by
+* accessing the mapped memory. In all other cases we use IP commands
+* to access the flash. Read via AHB bus may be corrupted due to
+* existence of an errata and therefore discard AHB read in such cases.
 */
if (op->data.nbytes > (f->devtype_data->rxfifo - 4) &&
-   op->data.dir == SPI_MEM_DATA_IN) {
+   op->data.dir == SPI_MEM_DATA_IN &&
+   !needs_ip_only(f)) {
nxp_fspi_read_ahb(f, op);
} else {
if (op->data.nbytes && op->data.dir == SPI_MEM_DATA_OUT)
@@ -808,6 +818,12 @@ static int nxp_fspi_adjust_op_size(struct spi_slave *slave,
op->data.nbytes = ALIGN_DOWN(op->data.nbytes, 8);
}
 
+   /* Limit data bytes to RX FIFO in case of IP read only */
+   if (needs_ip_only(f) &&
+   op->data.dir == SPI_MEM_DATA_IN &&
+   op->data.nbytes > f->devtype_data->rxfifo)
+   op->data.nbytes = f->devtype_data->rxfifo;
+
return 0;
 }
 
-- 
2.25.1



[PATCH] lx2160a: Enable CONFIG_SPI_FLASH_MT35XU for lx2160a-rdb/qds

2021-07-28 Thread Kuldeep Singh
LX2160A-RDB/QDS has micron mt35xu512aba flash which requires flag
CONFIG_SPI_FLASH_MT35XU on to probe flash successfully.

Signed-off-by: Kuldeep Singh 
---
 configs/lx2160aqds_tfa_SECURE_BOOT_defconfig | 1 +
 configs/lx2160aqds_tfa_defconfig | 1 +
 configs/lx2160ardb_tfa_SECURE_BOOT_defconfig | 1 +
 configs/lx2160ardb_tfa_defconfig | 1 +
 configs/lx2160ardb_tfa_stmm_defconfig| 1 +
 5 files changed, 5 insertions(+)

diff --git a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig 
b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
index ed4304c704..91fba19618 100644
--- a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
@@ -51,6 +51,7 @@ CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_EON=y
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MT35XU=y
 CONFIG_SPI_FLASH_SST=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
diff --git a/configs/lx2160aqds_tfa_defconfig b/configs/lx2160aqds_tfa_defconfig
index faa8da770b..d52063c7a8 100644
--- a/configs/lx2160aqds_tfa_defconfig
+++ b/configs/lx2160aqds_tfa_defconfig
@@ -58,6 +58,7 @@ CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_EON=y
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MT35XU=y
 CONFIG_SPI_FLASH_SST=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
diff --git a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig 
b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
index f8511cb193..94e103c5d1 100644
--- a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
@@ -47,6 +47,7 @@ CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MT35XU=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
diff --git a/configs/lx2160ardb_tfa_defconfig b/configs/lx2160ardb_tfa_defconfig
index 004eb7de74..d09bcde92e 100644
--- a/configs/lx2160ardb_tfa_defconfig
+++ b/configs/lx2160ardb_tfa_defconfig
@@ -56,6 +56,7 @@ CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MT35XU=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
diff --git a/configs/lx2160ardb_tfa_stmm_defconfig 
b/configs/lx2160ardb_tfa_stmm_defconfig
index 140f851ba2..93b1e49cf2 100644
--- a/configs/lx2160ardb_tfa_stmm_defconfig
+++ b/configs/lx2160ardb_tfa_stmm_defconfig
@@ -56,6 +56,7 @@ CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MT35XU=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
-- 
2.25.1



[PATCH] configs: ls1043aqds: Configure environment related configs

2021-07-07 Thread Kuldeep Singh
LS1043A-QDS board requires updation in few environment configs in TFA
and QSPI defconfigs.

Following are the changes:
- Define CONFIG_ENV_ADDR
- Unset CONFIG_SPI_FLASH_BAR
- Enable CONFIG_SYS_RELOC_GD_ENV_ADDR

Signed-off-by: Kuldeep Singh 
---
 configs/ls1043aqds_qspi_defconfig| 1 +
 configs/ls1043aqds_tfa_SECURE_BOOT_defconfig | 1 +
 configs/ls1043aqds_tfa_defconfig | 1 +
 3 files changed, 3 insertions(+)

diff --git a/configs/ls1043aqds_qspi_defconfig 
b/configs/ls1043aqds_qspi_defconfig
index 8a98ce9977..9e3f7bb900 100644
--- a/configs/ls1043aqds_qspi_defconfig
+++ b/configs/ls1043aqds_qspi_defconfig
@@ -36,6 +36,7 @@ 
CONFIG_MTDPARTS_DEFAULT="mtdparts=spi0.0:1m(uboot),5m(kernel),1m(dtb),9m(file_sy
 CONFIG_OF_CONTROL=y
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_ENV_ADDR=0x4030
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
diff --git a/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig 
b/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig
index 29e47cd55a..4e759d3a07 100644
--- a/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig
@@ -47,6 +47,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_SF_DEFAULT_BUS=1
+# CONFIG_SPI_FLASH_BAR is not set
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_PHYLIB=y
 CONFIG_PHYLIB_10G=y
diff --git a/configs/ls1043aqds_tfa_defconfig b/configs/ls1043aqds_tfa_defconfig
index 4d6a644a02..101d6a32e5 100644
--- a/configs/ls1043aqds_tfa_defconfig
+++ b/configs/ls1043aqds_tfa_defconfig
@@ -44,6 +44,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_USE_ENV_SPI_BUS=y
 CONFIG_ENV_SPI_BUS=0
 CONFIG_ENV_ADDR=0x6050
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
 CONFIG_FSL_CAAM=y
-- 
2.25.1



RE: [EXT] Re: [PATCH 2/2] spi: nxp_fspi: Implement errata workaround for LS1028A

2021-06-16 Thread Kuldeep Singh
Hi Stefano,

> -Original Message-
> From: Jagan Teki 
> Sent: Monday, April 19, 2021 12:17 PM
> To: Kuldeep Singh 
> Cc: U-Boot-Denx 
> Subject: [EXT] Re: [PATCH 2/2] spi: nxp_fspi: Implement errata workaround for
> LS1028A
> 
> Caution: EXT Email
> 
> On Mon, Mar 22, 2021 at 12:00 PM Kuldeep Singh 
> wrote:
> >
> > Errata ERR050568 description says that "Flash access by FlexSPI AHB
> > command may not work with platform frequency equal to 300 MHz" on
> > LS1028A.
> >
> > By default, smaller length reads(equal to RX FIFO size) are done by IP
> > bus and larger length reads using AHB bus. For adding errata
> > workaround, use IP bus to read entire flash contents and disable AHB
> > path when platform frequency is 300Mhz.
> >
> > Signed-off-by: Kuldeep Singh 
> > ---
> 
> Reviewed-by: Jagan Teki 

Jagan has reviewed and assigned this patch series[1] to you.
Could you please help in reviewing it.

Thanks
Kuldeep
[1] https://patchwork.ozlabs.org/project/uboot/list/?series=235180


[PATCH] configs: ls1088a: Enable CONFIG_SYS_RELOC_ENV_ADDR

2021-05-19 Thread Kuldeep Singh
Signed-off-by: Kuldeep Singh 
---
 configs/ls1088aqds_tfa_defconfig | 1 +
 configs/ls1088ardb_tfa_defconfig | 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/ls1088aqds_tfa_defconfig b/configs/ls1088aqds_tfa_defconfig
index 5229a351e1..ea308cafef 100644
--- a/configs/ls1088aqds_tfa_defconfig
+++ b/configs/ls1088aqds_tfa_defconfig
@@ -48,6 +48,7 @@ CONFIG_ENV_IS_IN_MMC=y
 CONFIG_ENV_IS_IN_NAND=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_ENV_ADDR=0x2050
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SCSI_AHCI=y
diff --git a/configs/ls1088ardb_tfa_defconfig b/configs/ls1088ardb_tfa_defconfig
index 007a80c2c6..e557858b8b 100644
--- a/configs/ls1088ardb_tfa_defconfig
+++ b/configs/ls1088ardb_tfa_defconfig
@@ -45,6 +45,7 @@ CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_ENV_ADDR=0x2050
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SCSI_AHCI=y
-- 
2.25.1



RE: [PATCH 2/2] spi: nxp_fspi: Implement errata workaround for LS1028A

2021-03-22 Thread Kuldeep Singh
+ Ye Li

> -Original Message-
> From: Kuldeep Singh 
> Sent: Monday, March 22, 2021 12:00 PM
> To: Jagan Teki ; u-boot@lists.denx.de
> Cc: Kuldeep Singh 
> Subject: [PATCH 2/2] spi: nxp_fspi: Implement errata workaround for LS1028A
> 
> Errata ERR050568 description says that "Flash access by FlexSPI AHB
> command may not work with platform frequency equal to 300 MHz" on
> LS1028A.
> 
> By default, smaller length reads(equal to RX FIFO size) are done by IP bus and
> larger length reads using AHB bus. For adding errata workaround, use IP bus
> to read entire flash contents and disable AHB path when platform frequency
> is 300Mhz.
> 
> Signed-off-by: Kuldeep Singh 

Hi Ye,
Please confirm and let me know if this patch breaks imx platforms.

Regards
Kuldeep
> ---
>  drivers/spi/nxp_fspi.c | 49 +-
>  1 file changed, 44 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/spi/nxp_fspi.c b/drivers/spi/nxp_fspi.c index
> e1b3d2d77b..7ba3a72223 100644
> --- a/drivers/spi/nxp_fspi.c
> +++ b/drivers/spi/nxp_fspi.c
> @@ -41,6 +41,11 @@
>  #include 
>  #include 
>  #include 
> +#ifdef CONFIG_FSL_LAYERSCAPE
> +#include 
> +#include 
> +#include 
> +#endif
>  #include 
>  #include 
>  #include 
> @@ -315,7 +320,7 @@ struct nxp_fspi_devtype_data {
>   bool little_endian;
>  };
> 
> -static const struct nxp_fspi_devtype_data lx2160a_data = {
> +static struct nxp_fspi_devtype_data lx2160a_data = {
>   .rxfifo = SZ_512,   /* (64  * 64 bits)  */
>   .txfifo = SZ_1K,/* (128 * 64 bits)  */
>   .ahb_buf_size = SZ_2K,  /* (256 * 64 bits)  */ @@ -323,7 +328,7 @@
> static const struct nxp_fspi_devtype_data lx2160a_data = {
>   .little_endian = true,  /* little-endian*/
>  };
> 
> -static const struct nxp_fspi_devtype_data imx8mm_data = {
> +static struct nxp_fspi_devtype_data imx8mm_data = {
>   .rxfifo = SZ_512,   /* (64  * 64 bits)  */
>   .txfifo = SZ_1K,/* (128 * 64 bits)  */
>   .ahb_buf_size = SZ_2K,  /* (256 * 64 bits)  */ @@ -338,7 +343,7 @@
> struct nxp_fspi {
>   u32 memmap_phy;
>   u32 memmap_phy_size;
>   struct clk clk, clk_en;
> - const struct nxp_fspi_devtype_data *devtype_data;
> + struct nxp_fspi_devtype_data *devtype_data;
>  };
> 
>  static inline int needs_ip_only(struct nxp_fspi *f) @@ -529,8 +534,8 @@
> static void nxp_fspi_prepare_lut(struct nxp_fspi *f,
>   for (i = 0; i < ARRAY_SIZE(lutval); i++)
>   fspi_writel(f, lutval[i], base + FSPI_LUT_REG(i));
> 
> - dev_dbg(f->dev, "CMD[%x] lutval[0:%x \t 1:%x \t 2:%x \t 3:%x]\n",
> - op->cmd.opcode, lutval[0], lutval[1], lutval[2], lutval[3]);
> + dev_dbg(f->dev, "CMD[%x] lutval[0:%x \t 1:%x \t 2:%x \t 3:%x], size:
> 0x%08x\n",
> + op->cmd.opcode, lutval[0], lutval[1], lutval[2], lutval[3],
> +op->data.nbytes);
> 
>   /* lock LUT */
>   fspi_writel(f, FSPI_LUTKEY_VALUE, f->iobase + FSPI_LUTKEY); @@ -
> 827,6 +832,31 @@ static int nxp_fspi_adjust_op_size(struct spi_slave *slave,
>   return 0;
>  }
> 
> +static void erratum_err050568(struct nxp_fspi *f) {
> + struct sys_info sysinfo;
> + u32 svr = 0, freq = 0;
> +
> + /* Check for LS1028A variants */
> + svr = SVR_SOC_VER(get_svr());
> + if (svr != SVR_LS1017A ||
> + svr != SVR_LS1018A ||
> + svr != SVR_LS1027A ||
> + svr != SVR_LS1028A) {
> + dev_dbg(f->dev, "Errata applicable only for LS1028A
> variants\n");
> + return;
> + }
> +
> + /* Read PLL frequency */
> + get_sys_info();
> + freq = sysinfo.freq_systembus / 100; /* Convert to MHz */
> + dev_dbg(f->dev, "svr: %08x, Frequency: %dMhz\n", svr, freq);
> +
> + /* Use IP bus only if PLL is 300MHz */
> + if (freq == 300)
> + f->devtype_data->quirks |= FSPI_QUIRK_USE_IP_ONLY; }
> +
>  static int nxp_fspi_default_setup(struct nxp_fspi *f)  {
>   void __iomem *base = f->iobase;
> @@ -847,6 +877,15 @@ static int nxp_fspi_default_setup(struct nxp_fspi *f)
>   return ret;
>  #endif
> 
> + /*
> +  * ERR050568: Flash access by FlexSPI AHB command may not work
> with
> +  * platform frequency equal to 300 MHz on LS1028A.
> +  * LS1028A reuses LX2160A compatible entry. Make errata applicable
> for
> +  * Layerscape LS1028A platform family.
> +  */
> + if (device_is_compatible(f->dev, "nxp,lx2160a-fspi"))
> + erratum_err050568(f);
> +
>   /* Reset the module */
>   /* w1c register, wait unit clear */
>   ret = fspi_readl_poll_tout(f, f->iobase + FSPI_MCR0,
> --
> 2.25.1



[PATCH 2/2] spi: nxp_fspi: Implement errata workaround for LS1028A

2021-03-22 Thread Kuldeep Singh
Errata ERR050568 description says that "Flash access by FlexSPI AHB
command may not work with platform frequency equal to 300 MHz" on
LS1028A.

By default, smaller length reads(equal to RX FIFO size) are done by IP
bus and larger length reads using AHB bus. For adding errata workaround,
use IP bus to read entire flash contents and disable AHB path when
platform frequency is 300Mhz.

Signed-off-by: Kuldeep Singh 
---
 drivers/spi/nxp_fspi.c | 49 +-
 1 file changed, 44 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/nxp_fspi.c b/drivers/spi/nxp_fspi.c
index e1b3d2d77b..7ba3a72223 100644
--- a/drivers/spi/nxp_fspi.c
+++ b/drivers/spi/nxp_fspi.c
@@ -41,6 +41,11 @@
 #include 
 #include 
 #include 
+#ifdef CONFIG_FSL_LAYERSCAPE
+#include 
+#include 
+#include 
+#endif
 #include 
 #include 
 #include 
@@ -315,7 +320,7 @@ struct nxp_fspi_devtype_data {
bool little_endian;
 };
 
-static const struct nxp_fspi_devtype_data lx2160a_data = {
+static struct nxp_fspi_devtype_data lx2160a_data = {
.rxfifo = SZ_512,   /* (64  * 64 bits)  */
.txfifo = SZ_1K,/* (128 * 64 bits)  */
.ahb_buf_size = SZ_2K,  /* (256 * 64 bits)  */
@@ -323,7 +328,7 @@ static const struct nxp_fspi_devtype_data lx2160a_data = {
.little_endian = true,  /* little-endian*/
 };
 
-static const struct nxp_fspi_devtype_data imx8mm_data = {
+static struct nxp_fspi_devtype_data imx8mm_data = {
.rxfifo = SZ_512,   /* (64  * 64 bits)  */
.txfifo = SZ_1K,/* (128 * 64 bits)  */
.ahb_buf_size = SZ_2K,  /* (256 * 64 bits)  */
@@ -338,7 +343,7 @@ struct nxp_fspi {
u32 memmap_phy;
u32 memmap_phy_size;
struct clk clk, clk_en;
-   const struct nxp_fspi_devtype_data *devtype_data;
+   struct nxp_fspi_devtype_data *devtype_data;
 };
 
 static inline int needs_ip_only(struct nxp_fspi *f)
@@ -529,8 +534,8 @@ static void nxp_fspi_prepare_lut(struct nxp_fspi *f,
for (i = 0; i < ARRAY_SIZE(lutval); i++)
fspi_writel(f, lutval[i], base + FSPI_LUT_REG(i));
 
-   dev_dbg(f->dev, "CMD[%x] lutval[0:%x \t 1:%x \t 2:%x \t 3:%x]\n",
-   op->cmd.opcode, lutval[0], lutval[1], lutval[2], lutval[3]);
+   dev_dbg(f->dev, "CMD[%x] lutval[0:%x \t 1:%x \t 2:%x \t 3:%x], size: 
0x%08x\n",
+   op->cmd.opcode, lutval[0], lutval[1], lutval[2], lutval[3], 
op->data.nbytes);
 
/* lock LUT */
fspi_writel(f, FSPI_LUTKEY_VALUE, f->iobase + FSPI_LUTKEY);
@@ -827,6 +832,31 @@ static int nxp_fspi_adjust_op_size(struct spi_slave *slave,
return 0;
 }
 
+static void erratum_err050568(struct nxp_fspi *f)
+{
+   struct sys_info sysinfo;
+   u32 svr = 0, freq = 0;
+
+   /* Check for LS1028A variants */
+   svr = SVR_SOC_VER(get_svr());
+   if (svr != SVR_LS1017A ||
+   svr != SVR_LS1018A ||
+   svr != SVR_LS1027A ||
+   svr != SVR_LS1028A) {
+   dev_dbg(f->dev, "Errata applicable only for LS1028A 
variants\n");
+   return;
+   }
+
+   /* Read PLL frequency */
+   get_sys_info();
+   freq = sysinfo.freq_systembus / 100; /* Convert to MHz */
+   dev_dbg(f->dev, "svr: %08x, Frequency: %dMhz\n", svr, freq);
+
+   /* Use IP bus only if PLL is 300MHz */
+   if (freq == 300)
+   f->devtype_data->quirks |= FSPI_QUIRK_USE_IP_ONLY;
+}
+
 static int nxp_fspi_default_setup(struct nxp_fspi *f)
 {
void __iomem *base = f->iobase;
@@ -847,6 +877,15 @@ static int nxp_fspi_default_setup(struct nxp_fspi *f)
return ret;
 #endif
 
+   /*
+* ERR050568: Flash access by FlexSPI AHB command may not work with
+* platform frequency equal to 300 MHz on LS1028A.
+* LS1028A reuses LX2160A compatible entry. Make errata applicable for
+* Layerscape LS1028A platform family.
+*/
+   if (device_is_compatible(f->dev, "nxp,lx2160a-fspi"))
+   erratum_err050568(f);
+
/* Reset the module */
/* w1c register, wait unit clear */
ret = fspi_readl_poll_tout(f, f->iobase + FSPI_MCR0,
-- 
2.25.1



[PATCH 1/2] spi: nxp-fspi: Add support for IP read only

2021-03-22 Thread Kuldeep Singh
Add support for disabling AHB bus and read entire flash contents via IP
bus only. Please note, this enables IP bus read using a quirk which can
be enabled directly in device-type data or in existence of an errata
where AHB bus may need to be disabled.

Signed-off-by: Kuldeep Singh 
---
 drivers/spi/nxp_fspi.c | 24 
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/nxp_fspi.c b/drivers/spi/nxp_fspi.c
index 6c5bad4c2c..e1b3d2d77b 100644
--- a/drivers/spi/nxp_fspi.c
+++ b/drivers/spi/nxp_fspi.c
@@ -304,6 +304,9 @@
 #define POLL_TOUT  5000
 #define NXP_FSPI_MAX_CHIPSELECT4
 
+/* Access flash memory using IP bus only */
+#define FSPI_QUIRK_USE_IP_ONLY BIT(0)
+
 struct nxp_fspi_devtype_data {
unsigned int rxfifo;
unsigned int txfifo;
@@ -338,6 +341,11 @@ struct nxp_fspi {
const struct nxp_fspi_devtype_data *devtype_data;
 };
 
+static inline int needs_ip_only(struct nxp_fspi *f)
+{
+   return f->devtype_data->quirks & FSPI_QUIRK_USE_IP_ONLY;
+}
+
 /*
  * R/W functions for big- or little-endian registers:
  * The FSPI controller's endianness is independent of
@@ -769,12 +777,14 @@ static int nxp_fspi_exec_op(struct spi_slave *slave,
 
nxp_fspi_prepare_lut(f, op);
/*
-* If we have large chunks of data, we read them through the AHB bus
-* by accessing the mapped memory. In all other cases we use
-* IP commands to access the flash.
+* If we have large chunks of data, we read them through the AHB bus by
+* accessing the mapped memory. In all other cases we use IP commands
+* to access the flash. Read via AHB bus may be corrupted due to
+* existence of an errata and therefore discard AHB read in such cases.
 */
if (op->data.nbytes > (f->devtype_data->rxfifo - 4) &&
-   op->data.dir == SPI_MEM_DATA_IN) {
+   op->data.dir == SPI_MEM_DATA_IN &&
+   !needs_ip_only(f)) {
nxp_fspi_read_ahb(f, op);
} else {
if (op->data.nbytes && op->data.dir == SPI_MEM_DATA_OUT)
@@ -808,6 +818,12 @@ static int nxp_fspi_adjust_op_size(struct spi_slave *slave,
op->data.nbytes = ALIGN_DOWN(op->data.nbytes, 8);
}
 
+   /* Limit data bytes to RX FIFO in case of IP read only */
+   if (needs_ip_only(f) &&
+   op->data.dir == SPI_MEM_DATA_IN &&
+   op->data.nbytes > f->devtype_data->rxfifo)
+   op->data.nbytes = f->devtype_data->rxfifo;
+
return 0;
 }
 
-- 
2.25.1



[PATCH 3/5] configs: ls1028a: Unset CONFIG_SPI_FLASH_SPANSION

2021-03-03 Thread Kuldeep Singh
There is no Spansion flash on LS1028A-RDB/QDS boards.
Unset CONFIG_SPI_FLASH_SPANSION option for both the boards.

Signed-off-by: Kuldeep Singh 
---
 configs/ls1028aqds_tfa_SECURE_BOOT_defconfig | 1 -
 configs/ls1028aqds_tfa_defconfig | 1 -
 configs/ls1028aqds_tfa_lpuart_defconfig  | 1 -
 configs/ls1028ardb_tfa_SECURE_BOOT_defconfig | 1 -
 configs/ls1028ardb_tfa_defconfig | 1 -
 5 files changed, 5 deletions(-)

diff --git a/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig 
b/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig
index a2bc6c6e6b3..47dfa3e847e 100644
--- a/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig
@@ -49,7 +49,6 @@ CONFIG_DM_MMC=y
 CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
-CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
diff --git a/configs/ls1028aqds_tfa_defconfig b/configs/ls1028aqds_tfa_defconfig
index 66e008b8ce3..21408bd7322 100644
--- a/configs/ls1028aqds_tfa_defconfig
+++ b/configs/ls1028aqds_tfa_defconfig
@@ -55,7 +55,6 @@ CONFIG_DM_MMC=y
 CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
-CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
diff --git a/configs/ls1028aqds_tfa_lpuart_defconfig 
b/configs/ls1028aqds_tfa_lpuart_defconfig
index cc82ed74b0e..d016202a242 100644
--- a/configs/ls1028aqds_tfa_lpuart_defconfig
+++ b/configs/ls1028aqds_tfa_lpuart_defconfig
@@ -55,7 +55,6 @@ CONFIG_DM_MMC=y
 CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
-CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
diff --git a/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig 
b/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig
index dd189188d22..794632a6c93 100644
--- a/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig
@@ -48,7 +48,6 @@ CONFIG_DM_MMC=y
 CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
-CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
diff --git a/configs/ls1028ardb_tfa_defconfig b/configs/ls1028ardb_tfa_defconfig
index 9f5116b3641..801552c6025 100644
--- a/configs/ls1028ardb_tfa_defconfig
+++ b/configs/ls1028ardb_tfa_defconfig
@@ -54,7 +54,6 @@ CONFIG_DM_MMC=y
 CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
-CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
-- 
2.25.1



[PATCH 4/5] configs: ls1028aqds: Move CONFIG_SPI_FLASH_* definitions to defconfig

2021-03-03 Thread Kuldeep Singh
LS1028A-QDS has CONFIG_SPI_FLASH_SST and CONFIG_SPI_FLASH_EON defines
present in header. Move these entries from header to defconfigs.

Signed-off-by: Kuldeep Singh 
---
 configs/ls1028aqds_tfa_SECURE_BOOT_defconfig | 2 ++
 configs/ls1028aqds_tfa_defconfig | 2 ++
 configs/ls1028aqds_tfa_lpuart_defconfig  | 2 ++
 include/configs/ls1028aqds.h | 6 --
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig 
b/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig
index 47dfa3e847e..17daef8d74f 100644
--- a/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig
@@ -49,7 +49,9 @@ CONFIG_DM_MMC=y
 CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH_EON=y
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_SST=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
diff --git a/configs/ls1028aqds_tfa_defconfig b/configs/ls1028aqds_tfa_defconfig
index 21408bd7322..1913f4f1358 100644
--- a/configs/ls1028aqds_tfa_defconfig
+++ b/configs/ls1028aqds_tfa_defconfig
@@ -55,7 +55,9 @@ CONFIG_DM_MMC=y
 CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH_EON=y
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_SST=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
diff --git a/configs/ls1028aqds_tfa_lpuart_defconfig 
b/configs/ls1028aqds_tfa_lpuart_defconfig
index d016202a242..60d515c9c66 100644
--- a/configs/ls1028aqds_tfa_lpuart_defconfig
+++ b/configs/ls1028aqds_tfa_lpuart_defconfig
@@ -55,7 +55,9 @@ CONFIG_DM_MMC=y
 CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH_EON=y
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_SST=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
diff --git a/include/configs/ls1028aqds.h b/include/configs/ls1028aqds.h
index 8ab943cc640..9ae37b96ceb 100644
--- a/include/configs/ls1028aqds.h
+++ b/include/configs/ls1028aqds.h
@@ -81,12 +81,6 @@
 #define CONFIG_SYS_SCSI_MAX_LUN1
 #define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \
CONFIG_SYS_SCSI_MAX_LUN)
-/* DSPI */
-#ifdef CONFIG_FSL_DSPI
-#define CONFIG_SPI_FLASH_SST
-#define CONFIG_SPI_FLASH_EON
-#endif
-
 #ifndef SPL_NO_ENV
 #undef CONFIG_EXTRA_ENV_SETTINGS
 #define CONFIG_EXTRA_ENV_SETTINGS \
-- 
2.25.1



[PATCH 5/5] configs: ls1028a: Correct CONFIG_ENV_SECT_SIZE

2021-03-03 Thread Kuldeep Singh
LS1028A-RDB/QDS has Micron "mt35xu02g" nor flash of size 256M with 128K
sector size. Correct CONFIG_ENV_SECT_SIZE value to 128K.

Signed-off-by: Kuldeep Singh 
---
 configs/ls1028aqds_tfa_defconfig| 2 +-
 configs/ls1028aqds_tfa_lpuart_defconfig | 2 +-
 configs/ls1028ardb_tfa_defconfig| 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configs/ls1028aqds_tfa_defconfig b/configs/ls1028aqds_tfa_defconfig
index 1913f4f1358..cc38bd89570 100644
--- a/configs/ls1028aqds_tfa_defconfig
+++ b/configs/ls1028aqds_tfa_defconfig
@@ -8,7 +8,7 @@ CONFIG_SYS_MEMTEST_START=0x8000
 CONFIG_SYS_MEMTEST_END=0x9fff
 CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x50
-CONFIG_ENV_SECT_SIZE=0x4
+CONFIG_ENV_SECT_SIZE=0x2
 CONFIG_DM_GPIO=y
 CONFIG_FSPI_AHB_EN_4BYTE=y
 CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y
diff --git a/configs/ls1028aqds_tfa_lpuart_defconfig 
b/configs/ls1028aqds_tfa_lpuart_defconfig
index 60d515c9c66..bc5f8f4f321 100644
--- a/configs/ls1028aqds_tfa_lpuart_defconfig
+++ b/configs/ls1028aqds_tfa_lpuart_defconfig
@@ -7,7 +7,7 @@ CONFIG_SYS_MEMTEST_START=0x8000
 CONFIG_SYS_MEMTEST_END=0x9fff
 CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x50
-CONFIG_ENV_SECT_SIZE=0x4
+CONFIG_ENV_SECT_SIZE=0x2
 CONFIG_DM_GPIO=y
 CONFIG_FSPI_AHB_EN_4BYTE=y
 CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y
diff --git a/configs/ls1028ardb_tfa_defconfig b/configs/ls1028ardb_tfa_defconfig
index 801552c6025..2ee57de839a 100644
--- a/configs/ls1028ardb_tfa_defconfig
+++ b/configs/ls1028ardb_tfa_defconfig
@@ -8,7 +8,7 @@ CONFIG_SYS_MEMTEST_START=0x8000
 CONFIG_SYS_MEMTEST_END=0x9fff
 CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x50
-CONFIG_ENV_SECT_SIZE=0x4
+CONFIG_ENV_SECT_SIZE=0x2
 CONFIG_DM_GPIO=y
 CONFIG_FSPI_AHB_EN_4BYTE=y
 CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y
-- 
2.25.1



[PATCH 2/5] configs: lx2160a: Remove unused Flexspi config options

2021-03-03 Thread Kuldeep Singh
It is now safe to remove Flexspi configs NXP_FSPI_FLASH_SIZE and
NXP_FSPI_FLASH_NUM options from headers as they are no longer used by
driver anymore.

Signed-off-by: Kuldeep Singh 
---
 include/configs/lx2160a_common.h | 6 --
 1 file changed, 6 deletions(-)

diff --git a/include/configs/lx2160a_common.h b/include/configs/lx2160a_common.h
index 466484c1997..9f2b8999cdb 100644
--- a/include/configs/lx2160a_common.h
+++ b/include/configs/lx2160a_common.h
@@ -154,12 +154,6 @@
 #endif
 #endif
 
-/* FlexSPI */
-#ifdef CONFIG_NXP_FSPI
-#define NXP_FSPI_FLASH_SIZESZ_64M
-#define NXP_FSPI_FLASH_NUM 1
-#endif
-
 /* GPIO */
 #ifdef CONFIG_DM_GPIO
 #ifndef CONFIG_MPC8XXX_GPIO
-- 
2.25.1



[PATCH 1/5] configs: lx2160a: Unset CONFIG_SPI_FLASH_SPANSION

2021-03-03 Thread Kuldeep Singh
There is no Spansion flash on LX2160A-RDB/QDS boards.
Unset CONFIG_SPI_FLASH_SPANSION option for both the boards.

Signed-off-by: Kuldeep Singh 
---
 configs/lx2160aqds_tfa_SECURE_BOOT_defconfig | 1 -
 configs/lx2160aqds_tfa_defconfig | 1 -
 configs/lx2160ardb_tfa_SECURE_BOOT_defconfig | 1 -
 configs/lx2160ardb_tfa_defconfig | 1 -
 configs/lx2160ardb_tfa_stmm_defconfig| 1 -
 5 files changed, 5 deletions(-)

diff --git a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig 
b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
index 7d6b74db18e..5a7ffe9c4a1 100644
--- a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
@@ -50,7 +50,6 @@ CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_EON=y
-CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_SST=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
diff --git a/configs/lx2160aqds_tfa_defconfig b/configs/lx2160aqds_tfa_defconfig
index 4390b0d928b..ed6f78b0993 100644
--- a/configs/lx2160aqds_tfa_defconfig
+++ b/configs/lx2160aqds_tfa_defconfig
@@ -57,7 +57,6 @@ CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_EON=y
-CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_SST=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
diff --git a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig 
b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
index f5da144e544..bb92fcb6c57 100644
--- a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
@@ -46,7 +46,6 @@ CONFIG_MMC_HS400_SUPPORT=y
 CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
-CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
diff --git a/configs/lx2160ardb_tfa_defconfig b/configs/lx2160ardb_tfa_defconfig
index c5a04101619..1d3b59c849c 100644
--- a/configs/lx2160ardb_tfa_defconfig
+++ b/configs/lx2160ardb_tfa_defconfig
@@ -55,7 +55,6 @@ CONFIG_MMC_HS400_SUPPORT=y
 CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
-CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
diff --git a/configs/lx2160ardb_tfa_stmm_defconfig 
b/configs/lx2160ardb_tfa_stmm_defconfig
index ca1d5cbad95..1b06124269d 100644
--- a/configs/lx2160ardb_tfa_stmm_defconfig
+++ b/configs/lx2160ardb_tfa_stmm_defconfig
@@ -55,7 +55,6 @@ CONFIG_MMC_HS400_SUPPORT=y
 CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
-CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
-- 
2.25.1



[PATCH 0/5] Flexspi cleanups for ls1028a and lx2160a

2021-03-03 Thread Kuldeep Singh
This patch series aim is to make fspi cleanups for ls1028a and lx2160a.
This includes defconfig and header cleanups.

Kuldeep Singh (5):
  configs: lx2160a: Unset CONFIG_SPI_FLASH_SPANSION
  configs: lx2160a: Remove unused Flexspi config options
  configs: ls1028a: Unset CONFIG_SPI_FLASH_SPANSION
  configs: ls1028aqds: Move CONFIG_SPI_FLASH_* definitions to defconfig
  configs: ls1028a: Correct CONFIG_ENV_SECT_SIZE

 configs/ls1028aqds_tfa_SECURE_BOOT_defconfig | 3 ++-
 configs/ls1028aqds_tfa_defconfig | 5 +++--
 configs/ls1028aqds_tfa_lpuart_defconfig  | 5 +++--
 configs/ls1028ardb_tfa_SECURE_BOOT_defconfig | 1 -
 configs/ls1028ardb_tfa_defconfig | 3 +--
 configs/lx2160aqds_tfa_SECURE_BOOT_defconfig | 1 -
 configs/lx2160aqds_tfa_defconfig | 1 -
 configs/lx2160ardb_tfa_SECURE_BOOT_defconfig | 1 -
 configs/lx2160ardb_tfa_defconfig | 1 -
 configs/lx2160ardb_tfa_stmm_defconfig| 1 -
 include/configs/ls1028aqds.h | 6 --
 include/configs/lx2160a_common.h | 6 --
 12 files changed, 9 insertions(+), 25 deletions(-)

-- 
2.25.1



RE: [PATCH] configs: ls1043aqds: Configure QSPI related configs

2020-10-23 Thread Kuldeep Singh
> -Original Message-
> From: Priyanka Jain 
> Sent: Friday, October 23, 2020 9:22 AM
> To: Kuldeep Singh ; Priyanka Jain (OSS)
> ; u-boot@lists.denx.de
> Subject: RE: [PATCH] configs: ls1043aqds: Configure QSPI related configs
> 
> >-Original Message-
> >From: U-Boot  On Behalf Of Kuldeep Singh
> >Sent: Thursday, July 23, 2020 11:02 AM
> >To: Priyanka Jain (OSS) ;
> >u-boot@lists.denx.de
> >Subject: RE: [PATCH] configs: ls1043aqds: Configure QSPI related
> >configs
> >
> >[...]
> >> Please confirm that all boot-sources will work fine with this change.
> >
> >Please hold both the patches for a moment. I will test other boot
> >sources and will let you know the results.
> 
> Any update?

This seems to be a generalized problem and needs to be fixed in u-boot env. I 
will work on it and provide the fix soon.


RE: [EXT] [PATCH 08/16] spi: nsp_fspi: Include device_compat.h

2020-10-05 Thread Kuldeep Singh


> -Original Message-
> From: Sean Anderson 
> Sent: Monday, October 5, 2020 7:10 AM
> To: u-boot@lists.denx.de
> Cc: Sean Anderson ; Jagan Teki
> ; Kuldeep Singh 
> Subject: [EXT] [PATCH 08/16] spi: nsp_fspi: Include device_compat.h

s/nsp_fspi/nxp_fspi

-Kuldeep


RE: [Patch v2] configs: ls1012a/ls1046a: Add CONFIG_ENV_OVERWRITE in defconfig

2020-09-23 Thread Kuldeep Singh
> -Original Message-
> From: Kuldeep Singh 
> Sent: Thursday, July 30, 2020 3:38 PM
> To: u-boot@lists.denx.de; Priyanka Jain 
> Cc: Kuldeep Singh 
> Subject: [Patch v2] configs: ls1012a/ls1046a: Add CONFIG_ENV_OVERWRITE
> in defconfig
> 
> CONFIG_ENV_OVERWRITE disables write protection on various environment
> variables like "ethaddr" and "serial".
> 
> Enable this config in LS1046A and LS1012A defconfigs. This resolves an error
> while setting multiple values of "ethaddr" variable.
> 
> Before the change:
> => setenv ethaddr 00:E0:0C:00:06:0
> => setenv ethaddr 00:E0:0C:00:06:1
> Error: Can't overwrite "ethaddr"
> Error inserting "ethaddr" variable, errno=1
> 
> After the change:
> => setenv ethaddr 00:E0:0C:00:06:0
> => setenv ethaddr 00:E0:0C:00:06:1
> 
> Signed-off-by: Kuldeep Singh 
> ---

Ping.


[PATCH 2/2] net: pfe_eth: Remove non-DM code check from pfe_spi_flash_init

2020-09-11 Thread Kuldeep Singh
CONFIG_DM_SPI_FLASH is only supported now with passing of driver
conversion deadline from non-DM to DM model. Hence, it's safe to remove
non-DM code check from pfe_spi_flash_init.

Also use CONFIG_ENV_SPI_MODE and CONFIG_ENV_SPI_MAX_HZ instead of
reading reading values from DT.

Signed-off-by: Kuldeep Singh 
---
 drivers/net/pfe_eth/pfe_firmware.c | 16 +---
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/net/pfe_eth/pfe_firmware.c 
b/drivers/net/pfe_eth/pfe_firmware.c
index 4ad09dd..d414c75 100644
--- a/drivers/net/pfe_eth/pfe_firmware.c
+++ b/drivers/net/pfe_eth/pfe_firmware.c
@@ -167,26 +167,20 @@ static int pfe_fit_check(void)
 int pfe_spi_flash_init(void)
 {
struct spi_flash *pfe_flash;
+   struct udevice *new;
int ret = 0;
void *addr = malloc(CONFIG_SYS_QE_FMAN_FW_LENGTH);
 
if (!addr)
return -ENOMEM;
 
-#ifdef CONFIG_DM_SPI_FLASH
-   struct udevice *new;
-
-   /* speed and mode will be read from DT */
ret = spi_flash_probe_bus_cs(CONFIG_ENV_SPI_BUS,
-CONFIG_ENV_SPI_CS, 0, 0, );
+CONFIG_ENV_SPI_CS,
+CONFIG_ENV_SPI_MAX_HZ,
+CONFIG_ENV_SPI_MODE,
+);
 
pfe_flash = dev_get_uclass_priv(new);
-#else
-   pfe_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS,
-   CONFIG_ENV_SPI_CS,
-   CONFIG_ENV_SPI_MAX_HZ,
-   CONFIG_ENV_SPI_MODE);
-#endif
if (!pfe_flash) {
printf("SF: probe for pfe failed\n");
free(addr);
-- 
2.7.4



[PATCH 1/2] net: pfe_eth: Fix resoure leak in pfe_spi_flash_init

2020-09-11 Thread Kuldeep Singh
Fix Coverity issue: RESOURCE_LEAK.
leaked_storage: Variable addr going out of scope leaks the storage it
points to.

Fixes: e0152dbed683 ("net: pfe_eth: Use spi_flash_read API to access
flash memory")
Signed-off-by: Kuldeep Singh 
---
 drivers/net/pfe_eth/pfe_firmware.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/pfe_eth/pfe_firmware.c 
b/drivers/net/pfe_eth/pfe_firmware.c
index 55e661c..4ad09dd 100644
--- a/drivers/net/pfe_eth/pfe_firmware.c
+++ b/drivers/net/pfe_eth/pfe_firmware.c
@@ -170,6 +170,9 @@ int pfe_spi_flash_init(void)
int ret = 0;
void *addr = malloc(CONFIG_SYS_QE_FMAN_FW_LENGTH);
 
+   if (!addr)
+   return -ENOMEM;
+
 #ifdef CONFIG_DM_SPI_FLASH
struct udevice *new;
 
@@ -186,6 +189,7 @@ int pfe_spi_flash_init(void)
 #endif
if (!pfe_flash) {
printf("SF: probe for pfe failed\n");
+   free(addr);
return -ENODEV;
}
 
-- 
2.7.4



RE: [EXT] [PATCH] armv8: lx2162aqds: Add support for LX2162AQDS platform

2020-08-26 Thread Kuldeep Singh
Hi Meenakshi,

[..]
> This patch add base support for LX2162 QDS board.
> LX2162 is LX2160 based SoC, it has same die as of LX2160
> with different packaging.
> Board support's 4GB ddr memory, i2c, micro-click module, microSD card,
> serial console, qspi nor flash, qsgmii, sgmii, 25g, 40g, 50g network

s/qspi/flexspi

> interface,one usb 3.0 and serdes interface to support three x1gen3
> pcie interface.

[...]
> diff --git a/arch/arm/dts/fsl-lx2162a-qds.dts b/arch/arm/dts/fsl-lx2162a-
> qds.dts
> new file mode 100644
> index 000..2a498af
> --- /dev/null
> +++ b/arch/arm/dts/fsl-lx2162a-qds.dts
> @@ -0,0 +1,107 @@
> + {
> +   bus-num = <0>;
> +   status = "okay";
> +   fspi-has-second-chip;
> +
> +   qflash0: mt35xu512g@0 {
> +   #address-cells = <1>;
> +   #size-cells = <1>;
> +   compatible = "spi-flash";
> +   spi-max-frequency = <2000>;
> +   reg = <0>;
> +   /* The following setting enables 1-1-8 (CMD-ADDR-DATA) mode */
> +   fspi-rx-bus-width = <8>; /* 8 FSPI Rx lines */
> +   fspi-tx-bus-width = <1>; /* 1 FSPI Tx line */
> +   };
> +
> +   /*
> +* MCR2[SAMEDEVICEEN] bit is enabled in FlexSPI controller for
> +* LX2160ARDB and LX2160AQDS board. Both these has same type of
> flash
> +* slave devices connected on both A0 and A1.
> +* No need to provide node info for second flash device.
> +*/
> +};

Please align fspi node properties with lx2160a-qds added in commit 4c1a52294f23 
("arm: dts: lx2160aqds: Add FSPI node properties").
This version has few unused options which are not required by new driver 
anymore and also the comment related to MCR2[SAVEDEVICEEN] is not valid now.

[..]
> diff --git a/configs/lx2162aqds_tfa_SECURE_BOOT_defconfig
> b/configs/lx2162aqds_tfa_SECURE_BOOT_defconfig
> new file mode 100644
> index 000..b2ae694
> --- /dev/null
> +++ b/configs/lx2162aqds_tfa_SECURE_BOOT_defconfig
> @@ -0,0 +1,83 @@
> +CONFIG_DM_SPI_FLASH=y
> +CONFIG_SPI_FLASH=y
> +CONFIG_SPI_FLASH_SPANSION=y

No Spansion flash on lx2160/lx2162 qds boards. Please unset this option.
Same goes with other defconfigs as well.

And CONFIG_ENV_OVERWRITE is not required to reprogram "ethaddr" values?

[..]
> diff --git a/include/configs/lx2162aqds.h b/include/configs/lx2162aqds.h
> new file mode 100644
> index 000..d364660
> --- /dev/null
> +++ b/include/configs/lx2162aqds.h
> @@ -0,0 +1,175 @@
> +/* DSPI */
> +#ifdef CONFIG_FSL_DSPI
> +#define CONFIG_SPI_FLASH_SST
> +#define CONFIG_SPI_FLASH_EON
> +#endif

Please move these SPI_FLASH options from header to defconfig similar to 
lx2160a-qds.

-Kuldeep


RE: [EXT] [PATCH v5 1/2] board: kontron: add sl28 support

2020-08-26 Thread Kuldeep Singh
> +/* environment */
> +/* allow to overwrite serial and ethaddr */ #define
> +CONFIG_ENV_OVERWRITE
[...]

Hi Michael,
CONFIG_ENV_OVERWRITE is now converted to Kconfig option and has been moved to 
defconfigs.
Adam Ford has a patch doing that and is available in latest master.

-Kuldeep


[Patch v2] configs: ls1012a/ls1046a: Add CONFIG_ENV_OVERWRITE in defconfig

2020-07-30 Thread Kuldeep Singh
CONFIG_ENV_OVERWRITE disables write protection on various environment
variables like "ethaddr" and "serial".

Enable this config in LS1046A and LS1012A defconfigs. This resolves an
error while setting multiple values of "ethaddr" variable.

Before the change:
=> setenv ethaddr 00:E0:0C:00:06:0
=> setenv ethaddr 00:E0:0C:00:06:1
Error: Can't overwrite "ethaddr"
Error inserting "ethaddr" variable, errno=1

After the change:
=> setenv ethaddr 00:E0:0C:00:06:0
=> setenv ethaddr 00:E0:0C:00:06:1

Signed-off-by: Kuldeep Singh 
---
v2: Move config from configs header to defconfigs after conversion to
Kconfig option.

 configs/ls1012a2g5rdb_qspi_defconfig| 1 +
 configs/ls1012a2g5rdb_tfa_defconfig | 1 +
 configs/ls1012afrdm_qspi_defconfig  | 1 +
 configs/ls1012afrdm_tfa_defconfig   | 1 +
 configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig  | 1 +
 configs/ls1012afrwy_qspi_defconfig  | 1 +
 configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig   | 1 +
 configs/ls1012afrwy_tfa_defconfig   | 1 +
 configs/ls1012aqds_qspi_defconfig   | 1 +
 configs/ls1012aqds_tfa_SECURE_BOOT_defconfig| 1 +
 configs/ls1012aqds_tfa_defconfig| 1 +
 configs/ls1012ardb_qspi_SECURE_BOOT_defconfig   | 1 +
 configs/ls1012ardb_qspi_defconfig   | 1 +
 configs/ls1012ardb_tfa_SECURE_BOOT_defconfig| 1 +
 configs/ls1012ardb_tfa_defconfig| 1 +
 configs/ls1046afrwy_tfa_SECURE_BOOT_defconfig   | 1 +
 configs/ls1046afrwy_tfa_defconfig   | 1 +
 configs/ls1046aqds_SECURE_BOOT_defconfig| 1 +
 configs/ls1046aqds_defconfig| 1 +
 configs/ls1046aqds_lpuart_defconfig | 1 +
 configs/ls1046aqds_nand_defconfig   | 1 +
 configs/ls1046aqds_qspi_defconfig   | 1 +
 configs/ls1046aqds_sdcard_ifc_defconfig | 1 +
 configs/ls1046aqds_sdcard_qspi_defconfig| 1 +
 configs/ls1046aqds_tfa_SECURE_BOOT_defconfig| 1 +
 configs/ls1046aqds_tfa_defconfig| 1 +
 configs/ls1046ardb_emmc_defconfig   | 1 +
 configs/ls1046ardb_qspi_SECURE_BOOT_defconfig   | 1 +
 configs/ls1046ardb_qspi_defconfig   | 1 +
 configs/ls1046ardb_qspi_spl_defconfig   | 1 +
 configs/ls1046ardb_sdcard_SECURE_BOOT_defconfig | 1 +
 configs/ls1046ardb_sdcard_defconfig | 1 +
 configs/ls1046ardb_tfa_SECURE_BOOT_defconfig| 1 +
 configs/ls1046ardb_tfa_defconfig| 1 +
 34 files changed, 34 insertions(+)

diff --git a/configs/ls1012a2g5rdb_qspi_defconfig 
b/configs/ls1012a2g5rdb_qspi_defconfig
index 65a0c2a..78d4a69 100644
--- a/configs/ls1012a2g5rdb_qspi_defconfig
+++ b/configs/ls1012a2g5rdb_qspi_defconfig
@@ -34,6 +34,7 @@ CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_CACHE=y
 CONFIG_OF_CONTROL=y
+CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
diff --git a/configs/ls1012a2g5rdb_tfa_defconfig 
b/configs/ls1012a2g5rdb_tfa_defconfig
index 5a029fa..501df4c 100644
--- a/configs/ls1012a2g5rdb_tfa_defconfig
+++ b/configs/ls1012a2g5rdb_tfa_defconfig
@@ -34,6 +34,7 @@ CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_CACHE=y
 CONFIG_OF_CONTROL=y
+CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
diff --git a/configs/ls1012afrdm_qspi_defconfig 
b/configs/ls1012afrdm_qspi_defconfig
index c78e45b..194a166 100644
--- a/configs/ls1012afrdm_qspi_defconfig
+++ b/configs/ls1012afrdm_qspi_defconfig
@@ -32,6 +32,7 @@ CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_CACHE=y
 CONFIG_OF_CONTROL=y
+CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
diff --git a/configs/ls1012afrdm_tfa_defconfig 
b/configs/ls1012afrdm_tfa_defconfig
index 751e3dd..989c3a6 100644
--- a/configs/ls1012afrdm_tfa_defconfig
+++ b/configs/ls1012afrdm_tfa_defconfig
@@ -32,6 +32,7 @@ CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_CACHE=y
 CONFIG_OF_CONTROL=y
+CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
diff --git a/configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig 
b/configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig
index 757b107..23a9a3a 100644
--- a/configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig
+++ b/configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig
@@ -32,6 +32,7 @@ CONFIG_CMD_PCI=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_CACHE=y
 CONFIG_OF_CONTROL=y
+CONFIG_ENV_OVERWRITE=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
diff --git a/configs/ls1012afrwy_qspi_defconfig 
b/configs/ls1012afrwy_qspi_defconfig
index fa0943b..1864cf2 100644
--- a/configs/ls1012afrwy_qspi_defconfig
+++ b/configs/ls1012afrwy_qspi_defconfig
@@ -34,6 +34,7 @@ CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 C

RE: [PATCH] configs: ls1043aqds: Configure QSPI related configs

2020-07-22 Thread Kuldeep Singh
[...]
> Please confirm that all boot-sources will work fine with this change.

Please hold both the patches for a moment. I will test other boot sources and 
will let you know the results.


[PATCH] configs: ls2088a: Restore CONFIG_ENV_ADDR to IFC-NOR

2020-07-22 Thread Kuldeep Singh
Restore CONFIG_ENV_ADDR value to fix boot hang with IFC-NOR as
default boot source.

Signed-off-by: Ashish Kumar 
Signed-off-by: Kuldeep Singh 
---
 configs/ls2088ardb_tfa_defconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/configs/ls2088ardb_tfa_defconfig b/configs/ls2088ardb_tfa_defconfig
index b64e3dc..e77ca62 100644
--- a/configs/ls2088ardb_tfa_defconfig
+++ b/configs/ls2088ardb_tfa_defconfig
@@ -39,8 +39,7 @@ CONFIG_DEFAULT_DEVICE_TREE="fsl-ls2088a-rdb-qspi"
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_ENV_ADDR=0x2050
-CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_ENV_ADDR=0x58050
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
-- 
2.7.4



RE: [PATCH] configs: ls1012a/ls1046a: Define CONFIG_ENV_OVERWRITE

2020-07-21 Thread Kuldeep Singh
> > Can you please check if this change can go into defconfig file,
> > instead of adding here?
> 
> This will require conversion of CONFIG_ENV_OVERWRITE to Kconfig option
> to add and entry in defconfig.

With little search, I found Adam Ford's patch[1] which convert 
CONFIG_ENV_OVERWRITE to Kconfig option.
I can make my changes on top of this patch. Please let me know your views.

-Kuldeep
[1] 
https://patchwork.ozlabs.org/project/uboot/patch/20200703114856.1225522-1-aford...@gmail.com/



RE: [PATCH] configs: ls1012a/ls1046a: Define CONFIG_ENV_OVERWRITE

2020-07-21 Thread Kuldeep Singh
> -Original Message-
> From: Priyanka Jain (OSS) 
> Sent: Tuesday, July 21, 2020 2:49 PM
> To: Kuldeep Singh ; u-boot@lists.denx.de
> Cc: Kuldeep Singh 
> Subject: RE: [PATCH] configs: ls1012a/ls1046a: Define
> CONFIG_ENV_OVERWRITE
> 
> >-Original Message-
> >From: U-Boot  On Behalf Of Kuldeep Singh
> >Sent: Tuesday, June 30, 2020 3:06 PM
> >To: u-boot@lists.denx.de
> >Cc: Priyanka Jain ; Kuldeep Singh
> >
> >Subject: [PATCH] configs: ls1012a/ls1046a: Define
> CONFIG_ENV_OVERWRITE
> >
> >CONFIG_ENV_OVERWRITE disable write protection on various
> environment
> >variables like "ethaddr" and "serial".
> >
> >Define the config in LS1046A and LS1012A common header as both of them
> >require this entry. Also, resolve an error while setting multiple
> >values of "ethaddr" variable.
> >
> >Before the change:
> >=> setenv ethaddr 00:E0:0C:00:06:0
> >=> setenv ethaddr 00:E0:0C:00:06:1
> >Error: Can't overwrite "ethaddr"
> >Error inserting "ethaddr" variable, errno=1
> >
> >After the change:
> >=> setenv ethaddr 00:E0:0C:00:06:0
> >=> setenv ethaddr 00:E0:0C:00:06:1
> >
> >Signed-off-by: Kuldeep Singh 
> >---
> > include/configs/ls1012a_common.h | 2 ++
> >include/configs/ls1046a_common.h | 2 ++
> > 2 files changed, 4 insertions(+)
> >
> >diff --git a/include/configs/ls1012a_common.h
> >b/include/configs/ls1012a_common.h
> >index 3bea9a9..b7ad303 100644
> >--- a/include/configs/ls1012a_common.h
> >+++ b/include/configs/ls1012a_common.h
> >@@ -15,6 +15,8 @@
> >
> > #define CONFIG_SKIP_LOWLEVEL_INIT
> >
> >+#define CONFIG_ENV_OVERWRITE
> >+
> > #ifdef CONFIG_TFABOOT
> > #define CONFIG_SYS_INIT_SP_ADDRCONFIG_SYS_TEXT_BASE
> > #else
> >diff --git a/include/configs/ls1046a_common.h
> >b/include/configs/ls1046a_common.h
> >index 8fe6937..2fdc2d3 100644
> >--- a/include/configs/ls1046a_common.h
> >+++ b/include/configs/ls1046a_common.h
> >@@ -42,6 +42,8 @@
> >
> > #define CONFIG_SKIP_LOWLEVEL_INIT
> >
> >+#define CONFIG_ENV_OVERWRITE
> >+
> > #define CONFIG_VERY_BIG_RAM
> > #define CONFIG_SYS_DDR_SDRAM_BASE   0x8000
> > #define CONFIG_SYS_FSL_DDR_SDRAM_BASE_PHY   0
> >--
> >2.7.4
> Can you please check if this change can go into defconfig file, instead of
> adding here?

This will require conversion of CONFIG_ENV_OVERWRITE to Kconfig option to add 
and entry in defconfig.

-Kuldeep


[PATCH] configs: ls1012a/ls1046a: Define CONFIG_ENV_OVERWRITE

2020-06-30 Thread Kuldeep Singh
CONFIG_ENV_OVERWRITE disable write protection on various environment
variables like "ethaddr" and "serial".

Define the config in LS1046A and LS1012A common header as both of them
require this entry. Also, resolve an error while setting multiple values
of "ethaddr" variable.

Before the change:
=> setenv ethaddr 00:E0:0C:00:06:0
=> setenv ethaddr 00:E0:0C:00:06:1
Error: Can't overwrite "ethaddr"
Error inserting "ethaddr" variable, errno=1

After the change:
=> setenv ethaddr 00:E0:0C:00:06:0
=> setenv ethaddr 00:E0:0C:00:06:1

Signed-off-by: Kuldeep Singh 
---
 include/configs/ls1012a_common.h | 2 ++
 include/configs/ls1046a_common.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/include/configs/ls1012a_common.h b/include/configs/ls1012a_common.h
index 3bea9a9..b7ad303 100644
--- a/include/configs/ls1012a_common.h
+++ b/include/configs/ls1012a_common.h
@@ -15,6 +15,8 @@
 
 #define CONFIG_SKIP_LOWLEVEL_INIT
 
+#define CONFIG_ENV_OVERWRITE
+
 #ifdef CONFIG_TFABOOT
 #define CONFIG_SYS_INIT_SP_ADDRCONFIG_SYS_TEXT_BASE
 #else
diff --git a/include/configs/ls1046a_common.h b/include/configs/ls1046a_common.h
index 8fe6937..2fdc2d3 100644
--- a/include/configs/ls1046a_common.h
+++ b/include/configs/ls1046a_common.h
@@ -42,6 +42,8 @@
 
 #define CONFIG_SKIP_LOWLEVEL_INIT
 
+#define CONFIG_ENV_OVERWRITE
+
 #define CONFIG_VERY_BIG_RAM
 #define CONFIG_SYS_DDR_SDRAM_BASE  0x8000
 #define CONFIG_SYS_FSL_DDR_SDRAM_BASE_PHY  0
-- 
2.7.4



[PATCH] configs: ls1012a: Increase CONFIG_SYS_MALLOC_LEN value

2020-06-25 Thread Kuldeep Singh
Previous attempt to increase CONFIG_SYS_MALLOC_LEN was done in commit
c084a8edf4e2 ("configs: ls1012a: Increase CONFIG_SYS_MALLOC_LEN size")
which increased malloc memory to ~1M.

PFE firmware alone requires 3M of dynamic memory allocation and
therefore, increase the config value to a larger value i.e 5M. This size
should be enough as of now to accommodate further memory requirements.

Signed-off-by: Kuldeep Singh 
---
Depends on
https://patchwork.ozlabs.org/project/uboot/patch/1590646373-8795-1-git-send-email-kuldeep.si...@nxp.com/

 include/configs/ls1012a_common.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/configs/ls1012a_common.h b/include/configs/ls1012a_common.h
index 06af8bf..95fa051 100644
--- a/include/configs/ls1012a_common.h
+++ b/include/configs/ls1012a_common.h
@@ -10,6 +10,7 @@
 
 #include 
 #include 
+#include 
 
 #define CONFIG_SYS_CLK_FREQ12500
 
@@ -34,7 +35,7 @@
 #define CONFIG_LAYERSCAPE_NS_ACCESS
 
 /* Size of malloc() pool */
-#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + 1024 * 1024)
+#define CONFIG_SYS_MALLOC_LEN  (5 * SZ_1M)
 
 /* PFE */
 #define CONFIG_SYS_FMAN_FW_ADDR0x400d
-- 
2.7.4



[PATCH] configs: ls1046aqds: Configure QSPI related configs

2020-06-23 Thread Kuldeep Singh
LS1046A-QDS has "s25fl128s" flash of size with 16M with 64K sector size.
The board requires few spi-flash related configs to be updated in TFA
and QSPI _defconfigs.

Following are the changes:
- Enable CONFIG_FSL_QSPI
- Unset CONFIG_SPI_FLASH_BAR
- Enable CONFIG_SYS_RELOC_GD_ENV_ADDR
- Restore CONFIG_ENV_ADDR to 0x6050

Signed-off-by: Kuldeep Singh 
---
 configs/ls1046aqds_tfa_SECURE_BOOT_defconfig | 2 ++
 configs/ls1046aqds_tfa_defconfig | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig 
b/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig
index 2b84a6b..2780a41 100644
--- a/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig
@@ -47,6 +47,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_SF_DEFAULT_BUS=1
+# CONFIG_SPI_FLASH_BAR is not set
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_PHYLIB=y
 CONFIG_PHYLIB_10G=y
@@ -63,6 +64,7 @@ CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_FSL_DSPI=y
+CONFIG_FSL_QSPI=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_XHCI_HCD=y
diff --git a/configs/ls1046aqds_tfa_defconfig b/configs/ls1046aqds_tfa_defconfig
index e412c05..9cb4592 100644
--- a/configs/ls1046aqds_tfa_defconfig
+++ b/configs/ls1046aqds_tfa_defconfig
@@ -42,7 +42,8 @@ CONFIG_ENV_IS_IN_NAND=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_USE_ENV_SPI_BUS=y
 CONFIG_ENV_SPI_BUS=0
-CONFIG_ENV_ADDR=0x4050
+CONFIG_ENV_ADDR=0x6050
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
 CONFIG_FSL_CAAM=y
-- 
2.7.4



RE: [EXT] Re: [RESEND][Patch v4] net: pfe_eth: Use spi_flash_read API to access flash memory

2020-06-21 Thread Kuldeep Singh


> -Original Message-
> From: Tom Rini 
> Sent: Friday, June 19, 2020 8:07 PM
> To: Priyanka Jain 
> Cc: Kuldeep Singh ; Joe Hershberger
> ; u-boot@lists.denx.de; Schrempf Frieder
> 
> Subject: Re: [EXT] Re: [RESEND][Patch v4] net: pfe_eth: Use spi_flash_read
> API to access flash memory
> 
> On Fri, Jun 19, 2020 at 02:13:37PM +, Priyanka Jain wrote:
> > >-----Original Message-
> > >From: Kuldeep Singh 
> > >Sent: Friday, June 19, 2020 3:40 PM
> > >To: Joe Hershberger ; u-boot@lists.denx.de;
> > >Priyanka Jain 
> > >Cc: Tom Rini ; Schrempf Frieder
> > >
> > >Subject: RE: [EXT] Re: [RESEND][Patch v4] net: pfe_eth: Use
> > >spi_flash_read API to access flash memory
> > >
> > >
> > >> -Original Message-
> > >> From: Schrempf Frieder 
> > >> Sent: Thursday, May 28, 2020 1:46 PM
> > >> To: Kuldeep Singh ; Joe Hershberger
> > >> ; u-boot@lists.denx.de
> > >> Cc: Priyanka Jain ; Tom Rini
> > >> 
> > >> Subject: [EXT] Re: [RESEND][Patch v4] net: pfe_eth: Use
> > >> spi_flash_read API to access flash memory
> > >>
> > >> Caution: EXT Email
> > >>
> > >> On 28.05.20 08:12, Kuldeep Singh wrote:
> > >> > Current PFE firmware access spi-nor memory directly. New spi-mem
> > >> > framework does not support direct memory access. So, let's use
> > >> > spi_flash_read API to access memory instead of directly using it.
> > >> >
> > >> > Signed-off-by: Kuldeep Singh 
> > >> > Reviewed-by: Frieder Schrempf 
> > >>
> > >> So this patch has been floating around for about half a year now
> > >> with almost no attention from the maintainers! Several pings have
> > >> been sent by the author without response.
> > >>
> > >> In fact this patch was blocking 91afd36f3802 ("spi: Transform the
> > >> FSL QuadSPI driver to use the SPI MEM API") that has finally been
> > >> merged, ignoring the fact that it will break ls1012a without this being
> applied too.
> > >>
> > >> I don't want to blame anyone, but I want to voice my disappointment
> > >> and raise attention that something is obviously wrong here.
> > >
> > >Hi Priyanka,
> > >
> > >Could you please help in reviewing this patch. The idea/motivation of
> > >these changes are taken from fm driver.
> > >The said changes in fm are already accepted in commit 382c53f94631
> ("net:
> > >fm: add TFABOOT support").
> > >You may take a look at code here[1], line: 380.
> > >
> > >Thanks
> > >Kuldeep
> > >[1]
> > >https://gitlab.denx.de/u-boot/u-boot/-/blob/master/drivers/net/fm/fm.
> > >c
> >
> > Reviewed-by: Priyanka Jain 
> >
> > Joe,
> >
> > Kindly help to pick this patch.
> 
> This is something that should go via the NXP trees, thanks!

Thanks Tom for mentioning. If this is so Priyanka, could you please pick this 
up in next PR.


RE: [EXT] Re: [RESEND][Patch v4] net: pfe_eth: Use spi_flash_read API to access flash memory

2020-06-19 Thread Kuldeep Singh

> -Original Message-
> From: Schrempf Frieder 
> Sent: Thursday, May 28, 2020 1:46 PM
> To: Kuldeep Singh ; Joe Hershberger
> ; u-boot@lists.denx.de
> Cc: Priyanka Jain ; Tom Rini 
> Subject: [EXT] Re: [RESEND][Patch v4] net: pfe_eth: Use spi_flash_read API to
> access flash memory
> 
> Caution: EXT Email
> 
> On 28.05.20 08:12, Kuldeep Singh wrote:
> > Current PFE firmware access spi-nor memory directly. New spi-mem
> > framework does not support direct memory access. So, let's use
> > spi_flash_read API to access memory instead of directly using it.
> >
> > Signed-off-by: Kuldeep Singh 
> > Reviewed-by: Frieder Schrempf 
> 
> So this patch has been floating around for about half a year now with almost
> no attention from the maintainers! Several pings have been sent by the
> author without response.
> 
> In fact this patch was blocking 91afd36f3802 ("spi: Transform the FSL
> QuadSPI driver to use the SPI MEM API") that has finally been merged,
> ignoring the fact that it will break ls1012a without this being applied too.
> 
> I don't want to blame anyone, but I want to voice my disappointment and
> raise attention that something is obviously wrong here.

Hi Priyanka,

Could you please help in reviewing this patch. The idea/motivation of these 
changes are taken from fm driver.
The said changes in fm are already accepted in commit 382c53f94631 ("net: fm: 
add TFABOOT support").
You may take a look at code here[1], line: 380.

Thanks
Kuldeep
[1] https://gitlab.denx.de/u-boot/u-boot/-/blob/master/drivers/net/fm/fm.c


[PATCH] configs: ls1043aqds: Configure QSPI related configs

2020-06-11 Thread Kuldeep Singh
LS1043A-QDS has "s25fl128s" flash of size 16M with 64K sector size.
The board requires few spi-flash related configs to be updated in TFA
and QSPI _defconfigs.

Following are the changes:
- Define/Update CONFIG_ENV_ADDR
- Unset CONFIG_SPI_FLASH_BAR
- Correct CONFIG_ENV_SECT_SIZE
- Enable CONFIG_SYS_RELOC_GD_ENV_ADDR

Signed-off-by: Kuldeep Singh 
---
 configs/ls1043aqds_qspi_defconfig| 1 +
 configs/ls1043aqds_tfa_SECURE_BOOT_defconfig | 1 +
 configs/ls1043aqds_tfa_defconfig | 3 ++-
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/configs/ls1043aqds_qspi_defconfig 
b/configs/ls1043aqds_qspi_defconfig
index a018b22..bb92b4c 100644
--- a/configs/ls1043aqds_qspi_defconfig
+++ b/configs/ls1043aqds_qspi_defconfig
@@ -35,6 +35,7 @@ 
CONFIG_MTDPARTS_DEFAULT="mtdparts=spi0.0:1m(uboot),5m(kernel),1m(dtb),9m(file_sy
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1043a-qds-duart"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_ENV_ADDR=0x4030
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
diff --git a/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig 
b/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig
index 3ee5d28..a9d7131 100644
--- a/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig
@@ -48,6 +48,7 @@ CONFIG_SYS_FLASH_CFI=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_SPI_FLASH=y
 CONFIG_SF_DEFAULT_BUS=1
+# CONFIG_SPI_FLASH_BAR is not set
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_PHYLIB=y
 CONFIG_PHYLIB_10G=y
diff --git a/configs/ls1043aqds_tfa_defconfig b/configs/ls1043aqds_tfa_defconfig
index 297788b..eb1f905 100644
--- a/configs/ls1043aqds_tfa_defconfig
+++ b/configs/ls1043aqds_tfa_defconfig
@@ -4,7 +4,7 @@ CONFIG_TFABOOT=y
 CONFIG_SYS_TEXT_BASE=0x8200
 CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x50
-CONFIG_ENV_SECT_SIZE=0x2
+CONFIG_ENV_SECT_SIZE=0x1
 CONFIG_DM_GPIO=y
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y
@@ -43,6 +43,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_USE_ENV_SPI_BUS=y
 CONFIG_ENV_SPI_BUS=0
 CONFIG_ENV_ADDR=0x6050
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
 CONFIG_FSL_CAAM=y
-- 
2.7.4



[RESEND][Patch v4] net: pfe_eth: Use spi_flash_read API to access flash memory

2020-05-28 Thread Kuldeep Singh
Current PFE firmware access spi-nor memory directly. New spi-mem
framework does not support direct memory access. So, let's use
spi_flash_read API to access memory instead of directly using it.

Signed-off-by: Kuldeep Singh 
Reviewed-by: Frieder Schrempf 
---
v4:
-Rebase to top
-Use complete firmware size
-Return -ENODEV if flash probe fails
v3:
-Replace ret with 0 if flash probe fails
v2:
-Add return error code
-Changes in displayed error log

 drivers/net/pfe_eth/pfe_firmware.c | 45 +-
 include/configs/ls1012a_common.h   |  5 -
 2 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/drivers/net/pfe_eth/pfe_firmware.c 
b/drivers/net/pfe_eth/pfe_firmware.c
index 0493cfe..55e661c 100644
--- a/drivers/net/pfe_eth/pfe_firmware.c
+++ b/drivers/net/pfe_eth/pfe_firmware.c
@@ -16,13 +16,14 @@
 #include 
 #include 
 #include 
+#include 
 #ifdef CONFIG_CHAIN_OF_TRUST
 #include 
 #endif
 
 #define PFE_FIRMWARE_FIT_CNF_NAME  "config@1"
 
-static const void *pfe_fit_addr = (void *)CONFIG_SYS_LS_PFE_FW_ADDR;
+static const void *pfe_fit_addr;
 
 /*
  * PFE elf firmware loader.
@@ -163,6 +164,44 @@ static int pfe_fit_check(void)
return ret;
 }
 
+int pfe_spi_flash_init(void)
+{
+   struct spi_flash *pfe_flash;
+   int ret = 0;
+   void *addr = malloc(CONFIG_SYS_QE_FMAN_FW_LENGTH);
+
+#ifdef CONFIG_DM_SPI_FLASH
+   struct udevice *new;
+
+   /* speed and mode will be read from DT */
+   ret = spi_flash_probe_bus_cs(CONFIG_ENV_SPI_BUS,
+CONFIG_ENV_SPI_CS, 0, 0, );
+
+   pfe_flash = dev_get_uclass_priv(new);
+#else
+   pfe_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS,
+   CONFIG_ENV_SPI_CS,
+   CONFIG_ENV_SPI_MAX_HZ,
+   CONFIG_ENV_SPI_MODE);
+#endif
+   if (!pfe_flash) {
+   printf("SF: probe for pfe failed\n");
+   return -ENODEV;
+   }
+
+   ret = spi_flash_read(pfe_flash,
+CONFIG_SYS_LS_PFE_FW_ADDR,
+CONFIG_SYS_QE_FMAN_FW_LENGTH,
+addr);
+   if (ret)
+   printf("SF: read for pfe failed\n");
+
+   pfe_fit_addr = addr;
+   spi_flash_free(pfe_flash);
+
+   return ret;
+}
+
 /*
  * PFE firmware initialization.
  * Loads different firmware files from FIT image.
@@ -187,6 +226,10 @@ int pfe_firmware_init(void)
int ret = 0;
int fw_count;
 
+   ret = pfe_spi_flash_init();
+   if (ret)
+   goto err;
+
ret = pfe_fit_check();
if (ret)
goto err;
diff --git a/include/configs/ls1012a_common.h b/include/configs/ls1012a_common.h
index 3bea9a9..06af8bf 100644
--- a/include/configs/ls1012a_common.h
+++ b/include/configs/ls1012a_common.h
@@ -36,8 +36,11 @@
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + 1024 * 1024)
 
-/*SPI device */
+/* PFE */
 #define CONFIG_SYS_FMAN_FW_ADDR0x400d
+#define CONFIG_SYS_QE_FMAN_FW_LENGTH   0x30
+
+/*SPI device */
 #define CONFIG_SYS_FSL_QSPI_BASE   0x4000
 
 /* SATA */
-- 
2.7.4



RE: [EXT] Re: [Patch v4] net: pfe_eth: Use spi_flash_read API to access flash memory

2020-05-28 Thread Kuldeep Singh


> -Original Message-
> From: Priyanka Jain (OSS) 
> Sent: Tuesday, May 12, 2020 12:11 PM
> To: Kuldeep Singh ; Joe Hershberger
> ; u-boot@lists.denx.de
> Cc: Thomas Hebb ; Patrick Delaunay
> ; Schrempf Frieder
> 
> Subject: RE: [EXT] Re: [Patch v4] net: pfe_eth: Use spi_flash_read API to
> access flash memory
> 
> 
> >-Original Message-----
> >From: U-Boot  On Behalf Of Kuldeep Singh
> >Sent: Tuesday, March 17, 2020 4:52 PM
> >To: Joe Hershberger ; u-boot@lists.denx.de
> >Cc: Thomas Hebb ; Patrick Delaunay
> >; Priyanka Jain ;
> >Schrempf Frieder 
> >Subject: RE: [EXT] Re: [Patch v4] net: pfe_eth: Use spi_flash_read API
> >to access flash memory
> >
> >Ping.
> >
> >> -Original Message-
> >> From: Kuldeep Singh
> >> Sent: Thursday, January 23, 2020 12:43 PM
> >> To: Joe Hershberger ; u-boot@lists.denx.de
> >> Cc: Thomas Hebb ; Patrick Delaunay
> >> ; Priyanka Jain ;
> >> Schrempf Frieder 
> >> Subject: RE: [EXT] Re: [Patch v4] net: pfe_eth: Use spi_flash_read
> >> API to access flash memory
> >>
> >> Hi Joe,
> >>
> >> > -Original Message-
> >> > From: Schrempf Frieder 
> >> > Sent: Monday, January 13, 2020 3:11 PM
> >> > To: Kuldeep Singh ; u-boot@lists.denx.de
> >> > Cc: Joe Hershberger ; Thomas Hebb
> >> > ; Patrick Delaunay
> ;
> >> > Priyanka Jain 
> >> > Subject: [EXT] Re: [Patch v4] net: pfe_eth: Use spi_flash_read API
> >> > to access flash memory
> >> >
> >> > Caution: EXT Email
> >> >
> >> > On 13.01.20 10:23, Kuldeep Singh wrote:
> >> > > Current PFE firmware access spi-nor memory directly. New spi-mem
> >> > > framework does not support direct memory access. So, let's use
> >> > > spi_flash_read API to access memory instead of directly using it.
> >> > >
> >> > > Signed-off-by: Kuldeep Singh 
> >> >
> >> > Reviewed-by: Frieder Schrempf 

This patch requires rebasing to top. Will respin this version.

Thanks
Kuldeep


[Patch v2] configs: ls1046a: Define ENV_ADDR value

2020-05-12 Thread Kuldeep Singh
CONFIG_ENV_ADDR helps in picking environment from flash before DDR init.
The macro value is already defined in ls1046ardb_tfa_defconfig, also
define the value as 0x4030 in qspi_defconfig.

ls1046aqds has one spansion flash "S25FL128S_64K" of size 16M with
sector size 64K. Correct ENV_ADDR and ENV_SECT_SIZE value for QSPI and
TFA defconfigs of the board.

Signed-off-by: Kuldeep Singh 
---
v2:
- Reword commit message as per Priyanka's comments.
- Rebase to top

 configs/ls1046aqds_qspi_defconfig | 1 +
 configs/ls1046aqds_tfa_defconfig  | 4 ++--
 configs/ls1046ardb_qspi_defconfig | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/configs/ls1046aqds_qspi_defconfig 
b/configs/ls1046aqds_qspi_defconfig
index c31c374..00b3568 100644
--- a/configs/ls1046aqds_qspi_defconfig
+++ b/configs/ls1046aqds_qspi_defconfig
@@ -34,6 +34,7 @@ 
CONFIG_MTDPARTS_DEFAULT="mtdparts=155.spi-0:2m(uboot),14m(free)"
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1046a-qds-duart"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_ENV_ADDR=0x4030
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
diff --git a/configs/ls1046aqds_tfa_defconfig b/configs/ls1046aqds_tfa_defconfig
index 07cdf8d..e412c05 100644
--- a/configs/ls1046aqds_tfa_defconfig
+++ b/configs/ls1046aqds_tfa_defconfig
@@ -4,7 +4,7 @@ CONFIG_TFABOOT=y
 CONFIG_SYS_TEXT_BASE=0x8200
 CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x50
-CONFIG_ENV_SECT_SIZE=0x2
+CONFIG_ENV_SECT_SIZE=0x1
 CONFIG_DM_GPIO=y
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y
@@ -42,7 +42,7 @@ CONFIG_ENV_IS_IN_NAND=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_USE_ENV_SPI_BUS=y
 CONFIG_ENV_SPI_BUS=0
-CONFIG_ENV_ADDR=0x6050
+CONFIG_ENV_ADDR=0x4050
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
 CONFIG_FSL_CAAM=y
diff --git a/configs/ls1046ardb_qspi_defconfig 
b/configs/ls1046ardb_qspi_defconfig
index 6c2b157..5197868 100644
--- a/configs/ls1046ardb_qspi_defconfig
+++ b/configs/ls1046ardb_qspi_defconfig
@@ -30,6 +30,7 @@ 
CONFIG_MTDPARTS_DEFAULT="mtdparts=155.spi-0:1m(rcw),15m(u-boot),48m(kernel.i
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1046a-rdb"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_ENV_ADDR=0x4030
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
-- 
2.7.4



RE: [PATCH] configs: ls1046a: Define ENV_ADDR value

2020-05-12 Thread Kuldeep Singh



> -Original Message-
> From: Priyanka Jain (OSS) 
> Sent: Tuesday, May 12, 2020 11:12 AM
> To: Kuldeep Singh ; u-boot@lists.denx.de
> Subject: RE: [PATCH] configs: ls1046a: Define ENV_ADDR value
> 
> >-Original Message-
> >From: U-Boot  On Behalf Of Kuldeep Singh
> >Sent: Tuesday, February 11, 2020 3:09 PM
> >To: u-boot@lists.denx.de
> >Subject: [PATCH] configs: ls1046a: Define ENV_ADDR value
> >
> >CONFIG_ENV_ADDR helps in picking environment from flash before DDR
> init.
> >Define value 0x4030 in QSPI defconfig for LS1046ARDB as value is
> >already defined in TFA.
> Do you mean the value same as already defined?

The macro is already defined in TFA defconfig, also define in qspi defconfig.

> If yes, can you please reword the description

ENV_ADDR value is QSPI_BASE + ENV_OFFSET.
In case of TFA boot(*_tfa_defconfig), ENV_ADDR is 0x4050 i.e 0x4000 + 
0x50
And in qspi (*qspi_defconfig), ENV_ADDR is 0x4030 i.e 0x4000 + 0x30.
This helps in picking env from flash before DDR.

> 
> Also why we need to defined in both TFA and u-boot ? Are both trying to
> read env?

Please see above for more clarification.

> >
> >Correct ENV_ADDR and ENV_SECT_SIZE value for LS1046AQDS as per
> >defconfig.
> Do you mean in defconfigs? If yes, please reword?

I have already mentioned that changes are done in defconfigs. Could you please 
mention what more info needs to be added/changed?

-Kuldeep


[PATCH 0/4] QSPI bugfixes of NXP layerscape platforms

2020-05-05 Thread Kuldeep Singh
This patch series is an attempt to fix qspi bugs on various NXP 
layerscape platforms like ls1012a, ls1046a, ls2088a.

Bug fixes involves crashes in flash environment.

Patch series depends on
https://patchwork.ozlabs.org/project/uboot/patch/1581413944-7958-3-git-send-email-kuldeep.si...@nxp.com/

Patch1: Increase malloc len for more space.
Patch2: Reduce ENV_SIZE to successfully store env in ls1012a.
Patch3: Enable RELOC_GD config to resolve environment booting crash.
Patch4: Unset ENV_ADDR value for ls1012a to resolve crash.

Ashish Kumar (1):
  configs: ls1012a: Reduce CONFIG_ENV_SIZE to 0x2000

Kuldeep Singh (3):
  configs: ls1012a: Increase CONFIG_SYS_MALLOC_LEN size
  configs: nxp: Enable CONFIG_SYS_RELOC_GD_ENV_ADDR
  configs: ls1012a: Unset ENV_ADDR value

 configs/ls1012a2g5rdb_qspi_defconfig   | 2 +-
 configs/ls1012a2g5rdb_tfa_defconfig| 2 +-
 configs/ls1012afrdm_qspi_defconfig | 2 +-
 configs/ls1012afrdm_tfa_defconfig  | 2 +-
 configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig | 2 +-
 configs/ls1012afrwy_qspi_defconfig | 3 ++-
 configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig  | 2 +-
 configs/ls1012afrwy_tfa_defconfig  | 4 ++--
 configs/ls1012aqds_qspi_defconfig  | 2 +-
 configs/ls1012aqds_tfa_SECURE_BOOT_defconfig   | 2 +-
 configs/ls1012aqds_tfa_defconfig   | 2 +-
 configs/ls1012ardb_qspi_SECURE_BOOT_defconfig  | 2 +-
 configs/ls1012ardb_qspi_defconfig  | 2 +-
 configs/ls1012ardb_tfa_SECURE_BOOT_defconfig   | 2 +-
 configs/ls1012ardb_tfa_defconfig   | 3 +--
 configs/ls1046afrwy_tfa_defconfig  | 1 +
 configs/ls1046ardb_tfa_defconfig   | 1 +
 configs/ls2088aqds_tfa_defconfig   | 1 +
 configs/ls2088ardb_tfa_defconfig   | 1 +
 include/configs/ls1012a_common.h   | 2 +-
 20 files changed, 22 insertions(+), 18 deletions(-)

-- 
2.7.4



[PATCH 2/4] configs: ls1012a: Reduce CONFIG_ENV_SIZE to 0x2000

2020-05-05 Thread Kuldeep Singh
From: Ashish Kumar 

All LS1012A board variants have same CONFIG_ENV_SECT_SIZE and
CONFIG_ENV_SIZE values. If both config values are same, flash
environment cannot be saved. Since, CONFIG_ENV_SECT_SIZE needs to be
same as that of flash sector size, this entry cannot be changed.
Reduce CONFIG_ENV_SIZE value to 0x2000. This also helps in making config
value aligned with other boards environemt size.

Signed-off-by: Kuldeep Singh 
Signed-off-by: Ashish Kumar 
---
 configs/ls1012a2g5rdb_qspi_defconfig   | 2 +-
 configs/ls1012a2g5rdb_tfa_defconfig| 2 +-
 configs/ls1012afrdm_qspi_defconfig | 2 +-
 configs/ls1012afrdm_tfa_defconfig  | 2 +-
 configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig | 2 +-
 configs/ls1012afrwy_qspi_defconfig | 2 +-
 configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig  | 2 +-
 configs/ls1012afrwy_tfa_defconfig  | 2 +-
 configs/ls1012aqds_qspi_defconfig  | 2 +-
 configs/ls1012aqds_tfa_SECURE_BOOT_defconfig   | 2 +-
 configs/ls1012aqds_tfa_defconfig   | 2 +-
 configs/ls1012ardb_qspi_SECURE_BOOT_defconfig  | 2 +-
 configs/ls1012ardb_qspi_defconfig  | 2 +-
 configs/ls1012ardb_tfa_SECURE_BOOT_defconfig   | 2 +-
 configs/ls1012ardb_tfa_defconfig   | 2 +-
 15 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/configs/ls1012a2g5rdb_qspi_defconfig 
b/configs/ls1012a2g5rdb_qspi_defconfig
index 9bf5b9c..c539243 100644
--- a/configs/ls1012a2g5rdb_qspi_defconfig
+++ b/configs/ls1012a2g5rdb_qspi_defconfig
@@ -1,7 +1,7 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS1012A2G5RDB=y
 CONFIG_SYS_TEXT_BASE=0x4010
-CONFIG_ENV_SIZE=0x4
+CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x30
 CONFIG_ENV_SECT_SIZE=0x4
 CONFIG_DM_GPIO=y
diff --git a/configs/ls1012a2g5rdb_tfa_defconfig 
b/configs/ls1012a2g5rdb_tfa_defconfig
index d9d4f82..ac34acd 100644
--- a/configs/ls1012a2g5rdb_tfa_defconfig
+++ b/configs/ls1012a2g5rdb_tfa_defconfig
@@ -2,7 +2,7 @@ CONFIG_ARM=y
 CONFIG_TARGET_LS1012A2G5RDB=y
 CONFIG_TFABOOT=y
 CONFIG_SYS_TEXT_BASE=0x8200
-CONFIG_ENV_SIZE=0x4
+CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x50
 CONFIG_ENV_SECT_SIZE=0x4
 CONFIG_DM_GPIO=y
diff --git a/configs/ls1012afrdm_qspi_defconfig 
b/configs/ls1012afrdm_qspi_defconfig
index 02a80b1..5a5b8d9 100644
--- a/configs/ls1012afrdm_qspi_defconfig
+++ b/configs/ls1012afrdm_qspi_defconfig
@@ -1,7 +1,7 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS1012AFRDM=y
 CONFIG_SYS_TEXT_BASE=0x4010
-CONFIG_ENV_SIZE=0x4
+CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x30
 CONFIG_ENV_SECT_SIZE=0x4
 CONFIG_DM_GPIO=y
diff --git a/configs/ls1012afrdm_tfa_defconfig 
b/configs/ls1012afrdm_tfa_defconfig
index ecc4c81..3531aaa 100644
--- a/configs/ls1012afrdm_tfa_defconfig
+++ b/configs/ls1012afrdm_tfa_defconfig
@@ -2,7 +2,7 @@ CONFIG_ARM=y
 CONFIG_TARGET_LS1012AFRDM=y
 CONFIG_TFABOOT=y
 CONFIG_SYS_TEXT_BASE=0x8200
-CONFIG_ENV_SIZE=0x4
+CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x50
 CONFIG_ENV_SECT_SIZE=0x4
 CONFIG_DM_GPIO=y
diff --git a/configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig 
b/configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig
index addb31c..a2e85b2 100644
--- a/configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig
+++ b/configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig
@@ -1,7 +1,7 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS1012AFRWY=y
 CONFIG_SYS_TEXT_BASE=0x4010
-CONFIG_ENV_SIZE=0x1
+CONFIG_ENV_SIZE=0x2000
 CONFIG_NXP_ESBC=y
 CONFIG_DM_GPIO=y
 CONFIG_FSL_LS_PPA=y
diff --git a/configs/ls1012afrwy_qspi_defconfig 
b/configs/ls1012afrwy_qspi_defconfig
index 2156f5e..50e261e 100644
--- a/configs/ls1012afrwy_qspi_defconfig
+++ b/configs/ls1012afrwy_qspi_defconfig
@@ -1,7 +1,7 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS1012AFRWY=y
 CONFIG_SYS_TEXT_BASE=0x4010
-CONFIG_ENV_SIZE=0x1
+CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x1D
 CONFIG_ENV_SECT_SIZE=0x1
 CONFIG_DM_GPIO=y
diff --git a/configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig 
b/configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig
index a4fdd0c..86d7689 100644
--- a/configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig
@@ -2,7 +2,7 @@ CONFIG_ARM=y
 CONFIG_TARGET_LS1012AFRWY=y
 CONFIG_TFABOOT=y
 CONFIG_SYS_TEXT_BASE=0x8200
-CONFIG_ENV_SIZE=0x1
+CONFIG_ENV_SIZE=0x2000
 CONFIG_NXP_ESBC=y
 CONFIG_DM_GPIO=y
 CONFIG_NR_DRAM_BANKS=2
diff --git a/configs/ls1012afrwy_tfa_defconfig 
b/configs/ls1012afrwy_tfa_defconfig
index 280dbd3..5ac2656 100644
--- a/configs/ls1012afrwy_tfa_defconfig
+++ b/configs/ls1012afrwy_tfa_defconfig
@@ -2,7 +2,7 @@ CONFIG_ARM=y
 CONFIG_TARGET_LS1012AFRWY=y
 CONFIG_TFABOOT=y
 CONFIG_SYS_TEXT_BASE=0x8200
-CONFIG_ENV_SIZE=0x1
+CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x1D
 CONFIG_ENV_SECT_SIZE=0x1
 CONFIG_DM_GPIO=y
diff --git a/configs/ls1012aqds_qspi_defconfig 
b/configs/ls1012aqds_qspi_defconfig
index 7826661..db7d6e1 100644
--- a/configs/ls1012aqds_qspi_defconfig
+++ b/configs/ls1012aqds_qspi_defconfig

[PATCH 3/4] configs: nxp: Enable CONFIG_SYS_RELOC_GD_ENV_ADDR

2020-05-05 Thread Kuldeep Singh
Commit 323d3af59fe4 ("configs: ls1012ardb: Enable
CONFIG_SYS_RELOC_GD_ENV_ADDR") enables the config only for LS1012ARDB.

Apart from LS1012A-RDB, other platforms such as LS1012A-FRWY, LS2088A
and LS1046A-RDB/FRWY also require this config to be enabled. This also
helps in resolving booting crash observed in flash environment.

Signed-off-by: Kuldeep Singh 
---
 configs/ls1012afrwy_qspi_defconfig | 1 +
 configs/ls1012afrwy_tfa_defconfig  | 1 +
 configs/ls1046afrwy_tfa_defconfig  | 1 +
 configs/ls1046ardb_tfa_defconfig   | 1 +
 configs/ls2088aqds_tfa_defconfig   | 1 +
 configs/ls2088ardb_tfa_defconfig   | 1 +
 6 files changed, 6 insertions(+)

diff --git a/configs/ls1012afrwy_qspi_defconfig 
b/configs/ls1012afrwy_qspi_defconfig
index 50e261e..9514450 100644
--- a/configs/ls1012afrwy_qspi_defconfig
+++ b/configs/ls1012afrwy_qspi_defconfig
@@ -32,6 +32,7 @@ CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1012a-frwy"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_ENV_ADDR=0x401D
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
diff --git a/configs/ls1012afrwy_tfa_defconfig 
b/configs/ls1012afrwy_tfa_defconfig
index 5ac2656..83c7410 100644
--- a/configs/ls1012afrwy_tfa_defconfig
+++ b/configs/ls1012afrwy_tfa_defconfig
@@ -32,6 +32,7 @@ CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1012a-frwy"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_ENV_ADDR=0x401D
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
diff --git a/configs/ls1046afrwy_tfa_defconfig 
b/configs/ls1046afrwy_tfa_defconfig
index 48dc7ac..68271c3 100644
--- a/configs/ls1046afrwy_tfa_defconfig
+++ b/configs/ls1046afrwy_tfa_defconfig
@@ -32,6 +32,7 @@ CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1046a-frwy"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_ENV_ADDR=0x4050
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
 CONFIG_FSL_CAAM=y
diff --git a/configs/ls1046ardb_tfa_defconfig b/configs/ls1046ardb_tfa_defconfig
index eab34cd..c20e524 100644
--- a/configs/ls1046ardb_tfa_defconfig
+++ b/configs/ls1046ardb_tfa_defconfig
@@ -33,6 +33,7 @@ CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1046a-rdb"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_ENV_ADDR=0x4050
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
 CONFIG_FSL_CAAM=y
diff --git a/configs/ls2088aqds_tfa_defconfig b/configs/ls2088aqds_tfa_defconfig
index 3116a99..7142f86 100644
--- a/configs/ls2088aqds_tfa_defconfig
+++ b/configs/ls2088aqds_tfa_defconfig
@@ -37,6 +37,7 @@ CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_ENV_ADDR=0x2050
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
diff --git a/configs/ls2088ardb_tfa_defconfig b/configs/ls2088ardb_tfa_defconfig
index 4f1c2d6..8e087b8 100644
--- a/configs/ls2088ardb_tfa_defconfig
+++ b/configs/ls2088ardb_tfa_defconfig
@@ -39,6 +39,7 @@ CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_ENV_ADDR=0x2050
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
-- 
2.7.4



[PATCH 4/4] configs: ls1012a: Unset ENV_ADDR value

2020-05-05 Thread Kuldeep Singh
LS1012A-FRWY and LS1012A-RDB crashes in flash environment when
CONFIG_ENV_ADDR value is set. Unset the config value in *_tfa_defconfig*
to resolve booting crash.

Following crash is observed:
Using SERDES1 Protocol: 13576 (0x3508)
"Synchronous Abort" handler, esr 0x9606
elr: 820452c0 lr : 82013f54 (reloc)
elr: b7b932c0 lr : b7b61f54
x0 :  x1 : 7604e004
x2 : 0001 x3 : 
...
Code: 5480 9100c000 17f7 f9402241 (3860c820)
Resetting CPU ...

Signed-off-by: Kuldeep Singh 
---
 configs/ls1012afrwy_tfa_defconfig | 1 -
 configs/ls1012ardb_tfa_defconfig  | 1 -
 2 files changed, 2 deletions(-)

diff --git a/configs/ls1012afrwy_tfa_defconfig 
b/configs/ls1012afrwy_tfa_defconfig
index 83c7410..8ecbf7c 100644
--- a/configs/ls1012afrwy_tfa_defconfig
+++ b/configs/ls1012afrwy_tfa_defconfig
@@ -31,7 +31,6 @@ CONFIG_CMD_CACHE=y
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1012a-frwy"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_ENV_ADDR=0x401D
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
diff --git a/configs/ls1012ardb_tfa_defconfig b/configs/ls1012ardb_tfa_defconfig
index 85d92cf..bf89730 100644
--- a/configs/ls1012ardb_tfa_defconfig
+++ b/configs/ls1012ardb_tfa_defconfig
@@ -33,7 +33,6 @@ CONFIG_CMD_CACHE=y
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1012a-rdb"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_ENV_ADDR=0x4050
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
-- 
2.7.4



[PATCH 1/4] configs: ls1012a: Increase CONFIG_SYS_MALLOC_LEN size

2020-05-05 Thread Kuldeep Singh
CONFIG_SYS_MALLOC_LEN is currently set to low value and leaves very less
space to do malloc in flash environmet. Increase the value to get more
memory and also make it align with other boards(ls1046a, ls1043a etc.)
config values.

Signed-off-by: Kuldeep Singh 
---
 include/configs/ls1012a_common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/ls1012a_common.h b/include/configs/ls1012a_common.h
index e9baa2a..c34faf2 100644
--- a/include/configs/ls1012a_common.h
+++ b/include/configs/ls1012a_common.h
@@ -34,7 +34,7 @@
 #define CONFIG_LAYERSCAPE_NS_ACCESS
 
 /* Size of malloc() pool */
-#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + 128 * 1024)
+#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + 1024 * 1024)
 
 /*SPI device */
 #if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_TFABOOT)
-- 
2.7.4



[PATCH 1/2] configs: ls1012a: Increase SYS_MALLOC_LEN size

2020-04-29 Thread Kuldeep Singh
CONFIG_SYS_MALLOC_LEN is currently set to low value and leaves very less
space for QSPI environmet. Increase the value and also make it align
with other boards(ls1046a, ls1043a etc.) value.

Signed-off-by: Kuldeep Singh 
---
 include/configs/ls1012a_common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/ls1012a_common.h b/include/configs/ls1012a_common.h
index e9baa2a..c34faf2 100644
--- a/include/configs/ls1012a_common.h
+++ b/include/configs/ls1012a_common.h
@@ -34,7 +34,7 @@
 #define CONFIG_LAYERSCAPE_NS_ACCESS
 
 /* Size of malloc() pool */
-#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + 128 * 1024)
+#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + 1024 * 1024)
 
 /*SPI device */
 #if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_TFABOOT)
-- 
2.7.4



[PATCH 2/2] configs: ls1012a: Update CONFIG_ENV_SIZE

2020-04-29 Thread Kuldeep Singh
From: Ashish Kumar 

ENV_SIZE value 0x4 is incorrect. Update to 0x2000 and make it align
with other boards environemt size for all variants of LS1012A.

Signed-off-by: Kuldeep Singh 
Signed-off-by: Ashish Kumar 
---
 configs/ls1012a2g5rdb_qspi_defconfig   | 2 +-
 configs/ls1012a2g5rdb_tfa_defconfig| 2 +-
 configs/ls1012afrdm_qspi_defconfig | 2 +-
 configs/ls1012afrdm_tfa_defconfig  | 2 +-
 configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig | 2 +-
 configs/ls1012afrwy_qspi_defconfig | 2 +-
 configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig  | 2 +-
 configs/ls1012afrwy_tfa_defconfig  | 2 +-
 configs/ls1012aqds_qspi_defconfig  | 2 +-
 configs/ls1012aqds_tfa_SECURE_BOOT_defconfig   | 2 +-
 configs/ls1012aqds_tfa_defconfig   | 2 +-
 configs/ls1012ardb_qspi_SECURE_BOOT_defconfig  | 2 +-
 configs/ls1012ardb_qspi_defconfig  | 2 +-
 configs/ls1012ardb_tfa_SECURE_BOOT_defconfig   | 2 +-
 configs/ls1012ardb_tfa_defconfig   | 2 +-
 15 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/configs/ls1012a2g5rdb_qspi_defconfig 
b/configs/ls1012a2g5rdb_qspi_defconfig
index 9bf5b9c..c539243 100644
--- a/configs/ls1012a2g5rdb_qspi_defconfig
+++ b/configs/ls1012a2g5rdb_qspi_defconfig
@@ -1,7 +1,7 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS1012A2G5RDB=y
 CONFIG_SYS_TEXT_BASE=0x4010
-CONFIG_ENV_SIZE=0x4
+CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x30
 CONFIG_ENV_SECT_SIZE=0x4
 CONFIG_DM_GPIO=y
diff --git a/configs/ls1012a2g5rdb_tfa_defconfig 
b/configs/ls1012a2g5rdb_tfa_defconfig
index d9d4f82..ac34acd 100644
--- a/configs/ls1012a2g5rdb_tfa_defconfig
+++ b/configs/ls1012a2g5rdb_tfa_defconfig
@@ -2,7 +2,7 @@ CONFIG_ARM=y
 CONFIG_TARGET_LS1012A2G5RDB=y
 CONFIG_TFABOOT=y
 CONFIG_SYS_TEXT_BASE=0x8200
-CONFIG_ENV_SIZE=0x4
+CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x50
 CONFIG_ENV_SECT_SIZE=0x4
 CONFIG_DM_GPIO=y
diff --git a/configs/ls1012afrdm_qspi_defconfig 
b/configs/ls1012afrdm_qspi_defconfig
index 02a80b1..5a5b8d9 100644
--- a/configs/ls1012afrdm_qspi_defconfig
+++ b/configs/ls1012afrdm_qspi_defconfig
@@ -1,7 +1,7 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS1012AFRDM=y
 CONFIG_SYS_TEXT_BASE=0x4010
-CONFIG_ENV_SIZE=0x4
+CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x30
 CONFIG_ENV_SECT_SIZE=0x4
 CONFIG_DM_GPIO=y
diff --git a/configs/ls1012afrdm_tfa_defconfig 
b/configs/ls1012afrdm_tfa_defconfig
index ecc4c81..3531aaa 100644
--- a/configs/ls1012afrdm_tfa_defconfig
+++ b/configs/ls1012afrdm_tfa_defconfig
@@ -2,7 +2,7 @@ CONFIG_ARM=y
 CONFIG_TARGET_LS1012AFRDM=y
 CONFIG_TFABOOT=y
 CONFIG_SYS_TEXT_BASE=0x8200
-CONFIG_ENV_SIZE=0x4
+CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x50
 CONFIG_ENV_SECT_SIZE=0x4
 CONFIG_DM_GPIO=y
diff --git a/configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig 
b/configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig
index addb31c..a2e85b2 100644
--- a/configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig
+++ b/configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig
@@ -1,7 +1,7 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS1012AFRWY=y
 CONFIG_SYS_TEXT_BASE=0x4010
-CONFIG_ENV_SIZE=0x1
+CONFIG_ENV_SIZE=0x2000
 CONFIG_NXP_ESBC=y
 CONFIG_DM_GPIO=y
 CONFIG_FSL_LS_PPA=y
diff --git a/configs/ls1012afrwy_qspi_defconfig 
b/configs/ls1012afrwy_qspi_defconfig
index 2156f5e..50e261e 100644
--- a/configs/ls1012afrwy_qspi_defconfig
+++ b/configs/ls1012afrwy_qspi_defconfig
@@ -1,7 +1,7 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS1012AFRWY=y
 CONFIG_SYS_TEXT_BASE=0x4010
-CONFIG_ENV_SIZE=0x1
+CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x1D
 CONFIG_ENV_SECT_SIZE=0x1
 CONFIG_DM_GPIO=y
diff --git a/configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig 
b/configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig
index a4fdd0c..86d7689 100644
--- a/configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig
@@ -2,7 +2,7 @@ CONFIG_ARM=y
 CONFIG_TARGET_LS1012AFRWY=y
 CONFIG_TFABOOT=y
 CONFIG_SYS_TEXT_BASE=0x8200
-CONFIG_ENV_SIZE=0x1
+CONFIG_ENV_SIZE=0x2000
 CONFIG_NXP_ESBC=y
 CONFIG_DM_GPIO=y
 CONFIG_NR_DRAM_BANKS=2
diff --git a/configs/ls1012afrwy_tfa_defconfig 
b/configs/ls1012afrwy_tfa_defconfig
index 280dbd3..5ac2656 100644
--- a/configs/ls1012afrwy_tfa_defconfig
+++ b/configs/ls1012afrwy_tfa_defconfig
@@ -2,7 +2,7 @@ CONFIG_ARM=y
 CONFIG_TARGET_LS1012AFRWY=y
 CONFIG_TFABOOT=y
 CONFIG_SYS_TEXT_BASE=0x8200
-CONFIG_ENV_SIZE=0x1
+CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x1D
 CONFIG_ENV_SECT_SIZE=0x1
 CONFIG_DM_GPIO=y
diff --git a/configs/ls1012aqds_qspi_defconfig 
b/configs/ls1012aqds_qspi_defconfig
index 7826661..db7d6e1 100644
--- a/configs/ls1012aqds_qspi_defconfig
+++ b/configs/ls1012aqds_qspi_defconfig
@@ -1,7 +1,7 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS1012AQDS=y
 CONFIG_SYS_TEXT_BASE=0x4010
-CONFIG_ENV_SIZE=0x4
+CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x30
 CONFIG_ENV_SECT_SIZE=0x4
 CONFIG_DM_GPIO=y
diff --git a/configs

[Patch v3] spi: nxp-fspi: Use new readl_poll_sleep_timeout API

2020-04-27 Thread Kuldeep Singh
Board gets reset when performing burst read/write operations. On the
other hand, no such behaviour is observed on small size operations.

In Linux, readl_poll_timeout API already adds delay of 1us which is
further skipped in U-boot. Hence, use new "readl_poll_sleep_timeout" API
which adds delay alongwith timeout functionality.

Signed-off-by: Kuldeep Singh 
---
v3:
-Reword commit message and use new API instead of adding delay.
-Depends on:
a) 
https://patchwork.ozlabs.org/project/uboot/patch/20200425110354.12381-2-ja...@amarulasolutions.com/
b) 
https://patchwork.ozlabs.org/project/uboot/patch/20200425110354.12381-3-ja...@amarulasolutions.com/

v2:
-Add comments above udelay(1) change.

 drivers/spi/nxp_fspi.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/nxp_fspi.c b/drivers/spi/nxp_fspi.c
index 0e6c7be..22a5c0e 100644
--- a/drivers/spi/nxp_fspi.c
+++ b/drivers/spi/nxp_fspi.c
@@ -421,7 +421,7 @@ static bool nxp_fspi_supports_op(struct spi_slave *slave,
return true;
 }
 
-/* Instead of busy looping invoke readl_poll_timeout functionality. */
+/* Instead of busy looping invoke readl_poll_sleep_timeout functionality. */
 static int fspi_readl_poll_tout(struct nxp_fspi *f, void __iomem *base,
u32 mask, u32 delay_us,
u32 timeout_us, bool c)
@@ -432,11 +432,11 @@ static int fspi_readl_poll_tout(struct nxp_fspi *f, void 
__iomem *base,
mask = (u32)cpu_to_be32(mask);
 
if (c)
-   return readl_poll_timeout(base, reg, (reg & mask),
- timeout_us);
+   return readl_poll_sleep_timeout(base, reg, (reg & mask),
+   delay_us, timeout_us);
else
-   return readl_poll_timeout(base, reg, !(reg & mask),
- timeout_us);
+   return readl_poll_sleep_timeout(base, reg, !(reg & mask),
+   delay_us, timeout_us);
 }
 
 /*
-- 
2.7.4



RE: [EXT] Re: [Patch v2] spi: nxp-fspi: Add 1us delay to make controller ready for next transaction

2020-04-26 Thread Kuldeep Singh
> > If you see implementation of " fspi_readl_poll_tout ", it further calls
> "readl_poll_timeout" which includes delay of 1us.
> > And also please see the difference of "readl_poll_timeout" api
> implementation in uboot and Linux.
> > This api adds delay in Linux but skips it in uboot.
> 
> Yes, it worked for myself also. so please use the new api which I have
> introduced on this series [2]

Thanks Jagan for the new API. I will respin this patch.

-Kuldeep


RE: [EXT] Re: [Patch v2] spi: nxp-fspi: Add 1us delay to make controller ready for next transaction

2020-04-21 Thread Kuldeep Singh


> -Original Message-
> From: Jagan Teki 
> Sent: Tuesday, April 21, 2020 1:45 PM
> To: Kuldeep Singh 
> Cc: U-Boot-Denx 
> Subject: [EXT] Re: [Patch v2] spi: nxp-fspi: Add 1us delay to make controller
> ready for next transaction
> 
> Caution: EXT Email
> 
> On Tue, Apr 21, 2020 at 11:57 AM Kuldeep Singh <mailto:kuldeep.si...@nxp.com>
> wrote:
> >
> > Board gets reset when performing burst read/write operations. On the
> > other hand, no such behaviour is observed on small size operations.
> >
> > In Linux, readl_poll_timeout API already add delay of 1us which is
> > skipped in U-boot. Since, NXP Flexspi U-boot driver is a ported
> > version of Linux driver and U-boot poll_timeout API lacks delay
> > functionality, add 1us delay so as to make controller ready for other
> transactions.
> 
> Can you link me, where  does Linux add this delay?

Please see[1] for Linux nxp flexspi driver code.
fspi_readl_poll_tout, line: 795

If you see implementation of " fspi_readl_poll_tout ", it further calls 
"readl_poll_timeout" which includes delay of 1us.
And also please see the difference of "readl_poll_timeout" api implementation 
in uboot and Linux.
This api adds delay in Linux but skips it in uboot.

Thanks
Kuldeep
[1] https://elixir.bootlin.com/linux/latest/source/drivers/spi/spi-nxp-fspi.c



[Patch v2] spi: nxp-fspi: Add 1us delay to make controller ready for next transaction

2020-04-21 Thread Kuldeep Singh
Board gets reset when performing burst read/write operations. On the
other hand, no such behaviour is observed on small size operations.

In Linux, readl_poll_timeout API already add delay of 1us which is
skipped in U-boot. Since, NXP Flexspi U-boot driver is a ported version
of Linux driver and U-boot poll_timeout API lacks delay functionality,
add 1us delay so as to make controller ready for other transactions.

Signed-off-by: Kuldeep Singh 
---
v1: Add comments above udelay(1) change.

 drivers/spi/nxp_fspi.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/spi/nxp_fspi.c b/drivers/spi/nxp_fspi.c
index 0e6c7be..1c6538c 100644
--- a/drivers/spi/nxp_fspi.c
+++ b/drivers/spi/nxp_fspi.c
@@ -757,6 +757,13 @@ static int nxp_fspi_exec_op(struct spi_slave *slave,
   FSPI_STS0_ARB_IDLE, 1, POLL_TOUT, true);
WARN_ON(err);
 
+   /*
+* Watchdog gets triggered for large read/write/erase since this
+* delay is not present in this API(readl_poll_timeout), add
+* this delay here.
+*/
+   udelay(1);
+
nxp_fspi_prepare_lut(f, op);
/*
 * If we have large chunks of data, we read them through the AHB bus
-- 
2.7.4



RE: [PATCH] configs: ls2088ardb: Correct DEFAULT_DEVICE_TREE value

2020-04-21 Thread Kuldeep Singh
[...]
> It does not impact the NOR boot case and fsl-ls2088a-rdb-qspi.dts provides
> additional nodes for qspi flash and i2c.
> Reviewed .

Priyanka, Since Wasim has reviewed the patch maybe we can proceed with his 
"reviewed-by" tag.

-Kuldeep


[PATCH] mtd: spi-nor-ids: Add Spansion s25fs512s flash entry

2020-04-03 Thread Kuldeep Singh
Spansion "s25fs512s" flash is incorrectly decoded as "s25fl512s" on
various platforms as former is not present. Add the entry.

Linux already has both the flashes present. A snippet below:
{ "s25fl512s",  INFO6(0x010220, 0x4d0080, 256 * 1024, 256...},
{ "s25fs512s",  INFO6(0x010220, 0x4d0081, 256 * 1024, 256...},

Signed-off-by: Kuldeep Singh 
---
 drivers/mtd/spi/spi-nor-ids.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/spi/spi-nor-ids.c b/drivers/mtd/spi/spi-nor-ids.c
index 973b6f8..42baa84 100644
--- a/drivers/mtd/spi/spi-nor-ids.c
+++ b/drivers/mtd/spi/spi-nor-ids.c
@@ -193,7 +193,8 @@ const struct flash_info spi_nor_ids[] = {
{ INFO("s25sl064p",  0x010216, 0x4d00,  64 * 1024, 128, 
SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
{ INFO("s25fl256s0", 0x010219, 0x4d00, 256 * 1024, 128, USE_CLSR) },
{ INFO("s25fl256s1", 0x010219, 0x4d01,  64 * 1024, 512, 
SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR) },
-   { INFO6("s25fl512s",  0x010220, 0x4d0081, 256 * 1024, 256, 
SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR) },
+   { INFO6("s25fl512s",  0x010220, 0x4d0080, 256 * 1024, 256, 
SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR) },
+   { INFO6("s25fs512s",  0x010220, 0x4d0081, 256 * 1024, 256, 
SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR) },
{ INFO("s25fl512s_256k",  0x010220, 0x4d00, 256 * 1024, 256, 
SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR) },
{ INFO("s25fl512s_64k",  0x010220, 0x4d01, 64 * 1024, 1024, 
SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR) },
{ INFO("s25fl512s_512k", 0x010220, 0x4f00, 256 * 1024, 256, 
SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR) },
-- 
2.7.4



RE: [Patch v5 1/7] spi: Transform the FSL QuadSPI driver to use the SPI MEM API

2020-03-22 Thread Kuldeep Singh



> -Original Message-
> From: Kuldeep Singh 
> Sent: Thursday, February 20, 2020 10:58 PM
> To: u-boot@lists.denx.de
> Cc: Frieder Schrempf ; Stefan Roese
> ; Priyanka Jain ; Jagan Teki
> ; Stefano Babic ; Fabio
> Estevam ; Vignesh Raghavendra ;
> Kuldeep Singh ; Ashish Kumar
> 
> Subject: [Patch v5 1/7] spi: Transform the FSL QuadSPI driver to use the SPI
> MEM API
> 
> To support the SPI MEM API, instead of modifying the existing U-Boot
> driver, this patch adds a port of the existing Linux driver.
> This also has the advantage that porting changes and fixes from Linux will
> be easier.
> Porting of driver left most of the functions unchanged while few of the
> changes are:
> -Remove lock(mutexes) and irq handler as u-boot is a single core execution.
> -Remove invalid masterid as it was required specially for multicore
> execution in LS2088ARDB which is not the case in u-boot.
> -Remove clock support as changing spi speed is not supported in uboot and
> nor in linux.
> 
> Currently tested on LS1088ARDB, LS1012ARDB, LS1046ARDB, LS1046AFRWY,
> LS1043AQDS, LS1021ATWR, LS2088ARDB, I.MX6ULL EVK.
> 
> Signed-off-by: Frieder Schrempf 
> Signed-off-by: Ashish Kumar 
> Signed-off-by: Kuldeep Singh 
> Reviewed-by: Stefan Roese 
> Tested-by: Stefan Roese 
> Acked-by: Vignesh Raghavendra 

Jagan,

If there are no further comments, could you please help in picking this up.

Thanks
Kuldeep



RE: [EXT] [PATCH] mtd: spi-nor-core: call WATCHDOG_RESET() in spi_nor_ready()

2020-03-19 Thread Kuldeep Singh
Hi Vignesh,

> -Original Message-
> From: U-Boot  On Behalf Of Rasmus
> Villemoes
> Sent: Tuesday, March 17, 2020 1:49 AM
> To: u-boot@lists.denx.de
> Cc: Jagan Teki ; Vignesh R
> ; Rasmus Villemoes 
> Subject: [EXT] [PATCH] mtd: spi-nor-core: call WATCHDOG_RESET() in
> spi_nor_ready()
> 
> Caution: EXT Email
> 
> I have a board for which doing "sf erase 0x10 0x8"
> consistently causes the external watchdog circuit to reset the board. Make
> sure to pet the watchdog during slow operations such as erasing or writing
> large areas of a spi nor flash.

I also stumbled with the same problem of board resetting but it was in order of 
MBs and not in KBs.
Board gets reset while performing burst erase/write(for 48M erase, resets at 
16M~) and read operation on 16M+.
I provided fix [1] in driver itself(add 1us delay) assuming it to be soc 
specific which solves problem for me and able to perform complete flash size 
operations.

Thanks 
Kuldeep

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



[PATCH] configs: ls2088ardb: Correct DEFAULT_DEVICE_TREE value

2020-03-19 Thread Kuldeep Singh
LS2088A-RDB has CONFIG_DEFAULT_DEVICE_TREE value correctly set as
"fsl-ls2088a-rdb-qspi" for QSPI secure/non-secure boot and TFA
non-secure boot mode.

Fix the value for TFA secure boot mode.

Signed-off-by: Kuldeep Singh 
---
 configs/ls2088ardb_tfa_SECURE_BOOT_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig 
b/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig
index c0d0a99..7039cf5 100644
--- a/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig
@@ -31,7 +31,7 @@ CONFIG_CMD_USB=y
 CONFIG_CMD_CACHE=y
 CONFIG_MP=y
 CONFIG_OF_CONTROL=y
-CONFIG_DEFAULT_DEVICE_TREE="fsl-ls2080a-rdb"
+CONFIG_DEFAULT_DEVICE_TREE="fsl-ls2088a-rdb-qspi"
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
-- 
2.7.4



RE: [RESEND Patch v2] configs: lx2160a: Enable FSPI support

2020-03-18 Thread Kuldeep Singh



> -Original Message-
> From: Kuldeep Singh
> Sent: Wednesday, March 18, 2020 5:15 PM
> To: Priyanka Jain (OSS) ; u-boot@lists.denx.de
> Subject: RE: [RESEND Patch v2] configs: lx2160a: Enable FSPI support
> 
> 
> 
> > -Original Message-
> > From: Priyanka Jain (OSS) 
> > Sent: Wednesday, March 18, 2020 4:22 PM
> > To: Kuldeep Singh ; u-boot@lists.denx.de
> > Cc: Kuldeep Singh 
> > Subject: RE: [RESEND Patch v2] configs: lx2160a: Enable FSPI support
> >
> > >-Original Message-
> > >From: U-Boot  On Behalf Of Kuldeep
> > Singh
> > >Sent: Saturday, March 14, 220 6:44 PM
> > >To: Priyanka Jain ; u-boot@lists.denx.de
> > >Cc: Kuldeep Singh 
> > >Subject: [RESEND Patch v2] configs: lx2160a: Enable FSPI support
> > >
> > >Enable FSPI controller support. So, flash environment can now be used.
> > >
> > >Signed-off-by: Kuldeep Singh 
> > >---
> > >v2:
> > >-Rebased to top.
> > >-Drop other patches from series as already accepted.
> > >-Add ENV_SECT_SIZE value as 0x2
> > >
> > > configs/lx2160aqds_tfa_SECURE_BOOT_defconfig | 1 +
> > > configs/lx2160aqds_tfa_defconfig | 3 +++
> > > configs/lx2160ardb_tfa_SECURE_BOOT_defconfig | 1 +
> > > configs/lx2160ardb_tfa_defconfig | 3 +++
> > > 4 files changed, 8 insertions(+)
> > >
> > >diff --git a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
> > >b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
> > >index 7c3b827..92fac5d 100644
> > >--- a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
> > >+++ b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
> > >@@ -65,6 +65,7 @@ CONFIG_DM_SERIAL=y
> > > CONFIG_SPI=y
> > > CONFIG_DM_SPI=y
> > > CONFIG_FSL_DSPI=y
> > >+CONFIG_NXP_FSPI=y
> > > CONFIG_USB=y
> > > CONFIG_DM_USB=y
> > > CONFIG_USB_XHCI_HCD=y
> > >diff --git a/configs/lx2160aqds_tfa_defconfig
> > >b/configs/lx2160aqds_tfa_defconfig
> > >index 449b3cb..e472c12 100644
> > >--- a/configs/lx2160aqds_tfa_defconfig
> > >+++ b/configs/lx2160aqds_tfa_defconfig
> > >@@ -4,6 +4,7 @@ CONFIG_TFABOOT=y
> > > CONFIG_SYS_TEXT_BASE=0x8200
> > > CONFIG_SYS_MALLOC_F_LEN=0x6000
> > > CONFIG_ENV_SIZE=0x2000
> > >+CONFIG_ENV_SECT_SIZE=0x2
> > > CONFIG_ENV_OFFSET=0x50
> > > CONFIG_DM_GPIO=y
> > > CONFIG_FSPI_AHB_EN_4BYTE=y
> > >@@ -32,6 +33,7 @@ CONFIG_OF_CONTROL=y
> CONFIG_OF_BOARD_FIXUP=y
> > >CONFIG_DEFAULT_DEVICE_TREE="fsl-lx2160a-qds"
> > > CONFIG_ENV_IS_IN_MMC=y
> > >+CONFIG_ENV_IS_IN_SPI_FLASH=y
> > > CONFIG_NET_RANDOM_ETHADDR=y
> > > CONFIG_DM=y
> > > CONFIG_SATA_CEVA=y
> > >@@ -65,6 +67,7 @@ CONFIG_DM_SCSI=y
> > > CONFIG_DM_SERIAL=y
> > > CONFIG_SPI=y
> > > CONFIG_DM_SPI=y
> > >+CONFIG_NXP_FSPI=y
> > > CONFIG_USB=y
> > > CONFIG_DM_USB=y
> > > CONFIG_USB_XHCI_HCD=y
> > >diff --git a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
> > >b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
> > >index d1fffb3..e754eb7 100644
> > >--- a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
> > >+++ b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
> > >@@ -60,6 +60,7 @@ CONFIG_DM_SCSI=y
> > > CONFIG_DM_SERIAL=y
> > > CONFIG_SPI=y
> > > CONFIG_DM_SPI=y
> > >+CONFIG_NXP_FSPI=y
> > > CONFIG_USB=y
> > > CONFIG_DM_USB=y
> > > CONFIG_USB_XHCI_HCD=y
> > >diff --git a/configs/lx2160ardb_tfa_defconfig
> > >b/configs/lx2160ardb_tfa_defconfig
> > >index 93f3e20..5d4580e 100644
> > >--- a/configs/lx2160ardb_tfa_defconfig
> > >+++ b/configs/lx2160ardb_tfa_defconfig
> > >@@ -4,6 +4,7 @@ CONFIG_TFABOOT=y
> > > CONFIG_SYS_TEXT_BASE=0x8200
> > > CONFIG_SYS_MALLOC_F_LEN=0x6000
> > > CONFIG_ENV_SIZE=0x2000
> > >+CONFIG_ENV_SECT_SIZE=0x2
> > > CONFIG_ENV_OFFSET=0x50
> > > CONFIG_DM_GPIO=y
> > > CONFIG_EMC2305=y
> > >@@ -33,6 +34,7 @@ CONFIG_OF_CONTROL=y
> CONFIG_OF_BOARD_FIXUP=y
> > >CONFIG_DEFAULT_DEVICE_TREE="fsl-lx2160a-rdb"
> > > CONFIG_ENV_IS_IN_MMC=y
> > >+CONFIG_ENV_IS_IN_SPI_FLASH=y
> > > CONFIG_NET_RANDOM_ETHADDR=y
> > > CONFIG_DM=y
> > > CONFIG_SATA_CEVA=y
> > >@@ -64,6 +66,7 @@ CONFIG_DM_SCSI=y
> > > CONFIG_DM_SERIAL=y
> > > CONFIG_SPI=y
> > > CONFIG_DM_SPI=y
> > >+CONFIG_NXP_FSPI=y
> > > CONFIG_USB=y
> > > CONFIG_DM_USB=y
> > > CONFIG_USB_XHCI_HCD=y
> > >--
> > >2.7.4
> > Reviewed-by: Priyanka Jain 
> >
> > Please confirm that all dependent patches are now available in main
> > master branch
> 
> Yes, all dependent patches are in master branch to make flexspi work on
> LX2160ARDB.

Please find bundle link for flexspi patches.
Link: https://patchwork.ozlabs.org/bundle/kuldeep/flexspi/
This bundle also include last 2 patches(octal bus-width) of series 
https://patchwork.ozlabs.org/project/uboot/list/?series=164377
Since 1st is not accepted by Jagan, single I/O mode will be set right now and 
with merger of 1st patch, octal I/O will be used.
So, there's no harm in going with these 2 patches.

Thanks
Kuldeep

> 
> Thanks
> Kuldeep
> 
> >
> > Regards
> > Priyanka


RE: [RESEND Patch v2] configs: lx2160a: Enable FSPI support

2020-03-18 Thread Kuldeep Singh



> -Original Message-
> From: Priyanka Jain (OSS) 
> Sent: Wednesday, March 18, 2020 4:22 PM
> To: Kuldeep Singh ; u-boot@lists.denx.de
> Cc: Kuldeep Singh 
> Subject: RE: [RESEND Patch v2] configs: lx2160a: Enable FSPI support
> 
> >-Original Message-
> >From: U-Boot  On Behalf Of Kuldeep
> Singh
> >Sent: Saturday, March 14, 220 6:44 PM
> >To: Priyanka Jain ; u-boot@lists.denx.de
> >Cc: Kuldeep Singh 
> >Subject: [RESEND Patch v2] configs: lx2160a: Enable FSPI support
> >
> >Enable FSPI controller support. So, flash environment can now be used.
> >
> >Signed-off-by: Kuldeep Singh 
> >---
> >v2:
> >-Rebased to top.
> >-Drop other patches from series as already accepted.
> >-Add ENV_SECT_SIZE value as 0x2
> >
> > configs/lx2160aqds_tfa_SECURE_BOOT_defconfig | 1 +
> > configs/lx2160aqds_tfa_defconfig | 3 +++
> > configs/lx2160ardb_tfa_SECURE_BOOT_defconfig | 1 +
> > configs/lx2160ardb_tfa_defconfig | 3 +++
> > 4 files changed, 8 insertions(+)
> >
> >diff --git a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
> >b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
> >index 7c3b827..92fac5d 100644
> >--- a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
> >+++ b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
> >@@ -65,6 +65,7 @@ CONFIG_DM_SERIAL=y
> > CONFIG_SPI=y
> > CONFIG_DM_SPI=y
> > CONFIG_FSL_DSPI=y
> >+CONFIG_NXP_FSPI=y
> > CONFIG_USB=y
> > CONFIG_DM_USB=y
> > CONFIG_USB_XHCI_HCD=y
> >diff --git a/configs/lx2160aqds_tfa_defconfig
> >b/configs/lx2160aqds_tfa_defconfig
> >index 449b3cb..e472c12 100644
> >--- a/configs/lx2160aqds_tfa_defconfig
> >+++ b/configs/lx2160aqds_tfa_defconfig
> >@@ -4,6 +4,7 @@ CONFIG_TFABOOT=y
> > CONFIG_SYS_TEXT_BASE=0x8200
> > CONFIG_SYS_MALLOC_F_LEN=0x6000
> > CONFIG_ENV_SIZE=0x2000
> >+CONFIG_ENV_SECT_SIZE=0x2
> > CONFIG_ENV_OFFSET=0x50
> > CONFIG_DM_GPIO=y
> > CONFIG_FSPI_AHB_EN_4BYTE=y
> >@@ -32,6 +33,7 @@ CONFIG_OF_CONTROL=y
> > CONFIG_OF_BOARD_FIXUP=y
> > CONFIG_DEFAULT_DEVICE_TREE="fsl-lx2160a-qds"
> > CONFIG_ENV_IS_IN_MMC=y
> >+CONFIG_ENV_IS_IN_SPI_FLASH=y
> > CONFIG_NET_RANDOM_ETHADDR=y
> > CONFIG_DM=y
> > CONFIG_SATA_CEVA=y
> >@@ -65,6 +67,7 @@ CONFIG_DM_SCSI=y
> > CONFIG_DM_SERIAL=y
> > CONFIG_SPI=y
> > CONFIG_DM_SPI=y
> >+CONFIG_NXP_FSPI=y
> > CONFIG_USB=y
> > CONFIG_DM_USB=y
> > CONFIG_USB_XHCI_HCD=y
> >diff --git a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
> >b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
> >index d1fffb3..e754eb7 100644
> >--- a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
> >+++ b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
> >@@ -60,6 +60,7 @@ CONFIG_DM_SCSI=y
> > CONFIG_DM_SERIAL=y
> > CONFIG_SPI=y
> > CONFIG_DM_SPI=y
> >+CONFIG_NXP_FSPI=y
> > CONFIG_USB=y
> > CONFIG_DM_USB=y
> > CONFIG_USB_XHCI_HCD=y
> >diff --git a/configs/lx2160ardb_tfa_defconfig
> >b/configs/lx2160ardb_tfa_defconfig
> >index 93f3e20..5d4580e 100644
> >--- a/configs/lx2160ardb_tfa_defconfig
> >+++ b/configs/lx2160ardb_tfa_defconfig
> >@@ -4,6 +4,7 @@ CONFIG_TFABOOT=y
> > CONFIG_SYS_TEXT_BASE=0x8200
> > CONFIG_SYS_MALLOC_F_LEN=0x6000
> > CONFIG_ENV_SIZE=0x2000
> >+CONFIG_ENV_SECT_SIZE=0x2
> > CONFIG_ENV_OFFSET=0x50
> > CONFIG_DM_GPIO=y
> > CONFIG_EMC2305=y
> >@@ -33,6 +34,7 @@ CONFIG_OF_CONTROL=y
> > CONFIG_OF_BOARD_FIXUP=y
> > CONFIG_DEFAULT_DEVICE_TREE="fsl-lx2160a-rdb"
> > CONFIG_ENV_IS_IN_MMC=y
> >+CONFIG_ENV_IS_IN_SPI_FLASH=y
> > CONFIG_NET_RANDOM_ETHADDR=y
> > CONFIG_DM=y
> > CONFIG_SATA_CEVA=y
> >@@ -64,6 +66,7 @@ CONFIG_DM_SCSI=y
> > CONFIG_DM_SERIAL=y
> > CONFIG_SPI=y
> > CONFIG_DM_SPI=y
> >+CONFIG_NXP_FSPI=y
> > CONFIG_USB=y
> > CONFIG_DM_USB=y
> > CONFIG_USB_XHCI_HCD=y
> >--
> >2.7.4
> Reviewed-by: Priyanka Jain 
> 
> Please confirm that all dependent patches are now available in main master
> branch

Yes, all dependent patches are in master branch to make flexspi work on 
LX2160ARDB.

Thanks
Kuldeep

> 
> Regards
> Priyanka


RE: [Patch v3 2/2] configs: ls2080ardb: Make BOOT command access flash memory as per spi-mem

2020-03-18 Thread Kuldeep Singh



> -Original Message-
> From: Priyanka Jain (OSS) 
> Sent: Wednesday, March 18, 2020 4:03 PM
> To: Kuldeep Singh ; u-boot@lists.denx.de
> Cc: Kuldeep Singh 
> Subject: RE: [Patch v3 2/2] configs: ls2080ardb: Make BOOT command
> access flash memory as per spi-mem
> 
> >-Original Message-
> >From: U-Boot  On Behalf Of Kuldeep
> Singh
> >Sent: Wednesday, March 18, 2020 11:57 AM
> >To: Priyanka Jain ; u-boot@lists.denx.de
> >Cc: Kuldeep Singh 
> >Subject: [Patch v3 2/2] configs: ls2080ardb: Make BOOT command access
> >flash memory as per spi-mem
> >
> >BOOT command currently access spi-nor flash memory directly. As per
> >spi- mem framework, flash memory access via absolute addresses is no
> >more possible.
> >Use flash APIs to access memory instead of directly using it.
> >
> >Signed-off-by: Kuldeep Singh 
> >---
> >v3:
> >-Rebase
> >
> >v2:
> >-Rebase to top
> >-Reword commit message
> >
> > include/configs/ls2080ardb.h | 14 ++
> > 1 file changed, 10 insertions(+), 4 deletions(-)
> >
> >diff --git a/include/configs/ls2080ardb.h
> >b/include/configs/ls2080ardb.h index
> >d36e928..b8e5dd3 100644
> >--- a/include/configs/ls2080ardb.h
> >+++ b/include/configs/ls2080ardb.h
> >@@ -508,10 +508,13 @@ unsigned long get_board_sys_clk(void);
> >
> > #ifdef CONFIG_TFABOOT
> > #define QSPI_NOR_BOOTCOMMAND
> > \
> >+"sf probe 0:0; "\
> >+"sf read 0x806c 0x6c 0x4; "
> > \
> > "env exists mcinitcmd && env exists secureboot "\
> >-"&& esbc_validate 0x206C; "
> > \
> >+"&& esbc_validate 0x806c; "
> > \
> >+"sf read 0x80d0 0xd0 0x10; "\
> > "env exists mcinitcmd && "  \
> >-"fsl_mc lazyapply dpl 0x20d0; " \
> >+"fsl_mc lazyapply dpl 0x80d0; " \
> > "run distro_bootcmd;run qspi_bootcmd; "
> > \
> > "env exists secureboot && esbc_halt;"
> >
> >@@ -538,10 +541,13 @@ unsigned long get_board_sys_clk(void);  #ifdef
> >CONFIG_QSPI_BOOT
> > /* Try to boot an on-QSPI kernel first, then do normal distro boot */
> >#define CONFIG_BOOTCOMMAND
> > \
> >+"sf probe 0:0; "\
> >+"sf read 0x806c 0x6c 0x4; "
> > \
> > "env exists mcinitcmd && env exists secureboot "\
> >-"&& esbc_validate 0x206C; "
> > \
> >+"&& esbc_validate 0x806C; "
> > \
> >+"sf read 0x80d0 0xd0 0x10; "\
> > "env exists mcinitcmd && "  \
> >-"fsl_mc lazyapply dpl 0x20d0; " \
> >+"fsl_mc lazyapply dpl 0x80d0; " \
> > "run distro_bootcmd;run qspi_bootcmd; "
> > \
> > "env exists secureboot && esbc_halt;"
> > #elif defined(CONFIG_SD_BOOT)
> >--
> >2.7.4
> Same comment as previous, please provide testing status for both secure
> and non-secure boot

These 2 patches are valid when new qspi driver is accepted.
i.e depends on https://patchwork.ozlabs.org/project/uboot/list/?series=159796

Moreover, I will give you status/logs for both secure and non-secure boot.

Thanks
Kuldeep
 

> Regards
> Priyanka



[Patch v3 2/2] configs: ls2080ardb: Make BOOT command access flash memory as per spi-mem

2020-03-18 Thread Kuldeep Singh
BOOT command currently access spi-nor flash memory directly. As per spi-mem
framework, flash memory access via absolute addresses is no more possible.
Use flash APIs to access memory instead of directly using it.

Signed-off-by: Kuldeep Singh 
---
v3:
-Rebase

v2:
-Rebase to top
-Reword commit message

 include/configs/ls2080ardb.h | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/include/configs/ls2080ardb.h b/include/configs/ls2080ardb.h
index d36e928..b8e5dd3 100644
--- a/include/configs/ls2080ardb.h
+++ b/include/configs/ls2080ardb.h
@@ -508,10 +508,13 @@ unsigned long get_board_sys_clk(void);
 
 #ifdef CONFIG_TFABOOT
 #define QSPI_NOR_BOOTCOMMAND   \
+   "sf probe 0:0; "\
+   "sf read 0x806c 0x6c 0x4; " \
"env exists mcinitcmd && env exists secureboot "\
-   "&& esbc_validate 0x206C; " \
+   "&& esbc_validate 0x806c; " \
+   "sf read 0x80d0 0xd0 0x10; "\
"env exists mcinitcmd && "  \
-   "fsl_mc lazyapply dpl 0x20d0; " \
+   "fsl_mc lazyapply dpl 0x80d0; " \
"run distro_bootcmd;run qspi_bootcmd; " \
"env exists secureboot && esbc_halt;"
 
@@ -538,10 +541,13 @@ unsigned long get_board_sys_clk(void);
 #ifdef CONFIG_QSPI_BOOT
 /* Try to boot an on-QSPI kernel first, then do normal distro boot */
 #define CONFIG_BOOTCOMMAND \
+   "sf probe 0:0; "\
+   "sf read 0x806c 0x6c 0x4; " \
"env exists mcinitcmd && env exists secureboot "\
-   "&& esbc_validate 0x206C; " \
+   "&& esbc_validate 0x806C; " \
+   "sf read 0x80d0 0xd0 0x10; "\
"env exists mcinitcmd && "  \
-   "fsl_mc lazyapply dpl 0x20d0; " \
+   "fsl_mc lazyapply dpl 0x80d0; " \
"run distro_bootcmd;run qspi_bootcmd; " \
"env exists secureboot && esbc_halt;"
 #elif defined(CONFIG_SD_BOOT)
-- 
2.7.4



[Patch v3 1/2] configs: ls2080ardb: Make MC_INIT access flash memory as per spi-mem

2020-03-18 Thread Kuldeep Singh
MC_INIT command currently access spi-nor flash memory directly. As per
spi-mem framework, flash memory access via absolute addresses is no more
possible. Use flash APIs to access memory instead of directly using it.

Signed-off-by: Kuldeep Singh 
---
v3:
-Use complete MC size, 1M works but MC has 3M assigned space.
-Rebase to top

v2:
-Rebase to top
-reword commit message

 include/configs/ls2080ardb.h | 28 ++--
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/include/configs/ls2080ardb.h b/include/configs/ls2080ardb.h
index c1819d2..d36e928 100644
--- a/include/configs/ls2080ardb.h
+++ b/include/configs/ls2080ardb.h
@@ -321,11 +321,15 @@ unsigned long get_board_sys_clk(void);
 #include 
 
 #ifdef CONFIG_TFABOOT
-#define QSPI_MC_INIT_CMD   \
-   "env exists secureboot && " \
-   "esbc_validate 0x2064 && "  \
-   "esbc_validate 0x2068;" \
-   "fsl_mc start mc 0x20a0 0x20e0 \0"
+#define QSPI_MC_INIT_CMD   \
+   "sf probe 0:0; "\
+   "sf read 0x8064 0x64 0x8; " \
+   "env exists secureboot && " \
+   "esbc_validate 0x8064 && "  \
+   "esbc_validate 0x8068; "\
+   "sf read 0x80a0 0xa0 0x30; "\
+   "sf read 0x80e0 0xe0 0x10; "\
+   "fsl_mc start mc 0x80a0 0x80e0 \0"
 #define SD_MC_INIT_CMD \
"mmcinfo;mmc read 0x80a0 0x5000 0x1200;" \
"mmc read 0x80e0 0x7000 0x800;" \
@@ -342,11 +346,15 @@ unsigned long get_board_sys_clk(void);
"fsl_mc start mc 0x580a0 0x580e0 \0"
 #else
 #ifdef CONFIG_QSPI_BOOT
-#define MC_INIT_CMD\
-   "mcinitcmd=env exists secureboot && "   \
-   "esbc_validate 0x2064 && "  \
-   "esbc_validate 0x2068;" \
-   "fsl_mc start mc 0x20a0 0x20e0 \0"
+#define MC_INIT_CMD\
+   "mcinitcmd=sf probe 0:0; "  \
+   "sf read 0x8064 0x64 0x8; " \
+   "env exists secureboot && " \
+   "esbc_validate 0x8064 && "  \
+   "esbc_validate 0x8068; "\
+   "sf read 0x80a0 0xa0 0x30; "\
+   "sf read 0x80e0 0xe0 0x10; "\
+   "fsl_mc start mc 0x80a0 0x80e0 \0"
 #elif defined(CONFIG_SD_BOOT)
 #define MC_INIT_CMD \
"mcinitcmd=mmcinfo;mmc read 0x8000 0x5000 0x800;" \
-- 
2.7.4



RE: [EXT] Re: [Patch v4] net: pfe_eth: Use spi_flash_read API to access flash memory

2020-03-17 Thread Kuldeep Singh
Ping.

> -Original Message-
> From: Kuldeep Singh
> Sent: Thursday, January 23, 2020 12:43 PM
> To: Joe Hershberger ; u-boot@lists.denx.de
> Cc: Thomas Hebb ; Patrick Delaunay
> ; Priyanka Jain ;
> Schrempf Frieder 
> Subject: RE: [EXT] Re: [Patch v4] net: pfe_eth: Use spi_flash_read API to
> access flash memory
> 
> Hi Joe,
> 
> > -Original Message-
> > From: Schrempf Frieder 
> > Sent: Monday, January 13, 2020 3:11 PM
> > To: Kuldeep Singh ; u-boot@lists.denx.de
> > Cc: Joe Hershberger ; Thomas Hebb
> > ; Patrick Delaunay ;
> > Priyanka Jain 
> > Subject: [EXT] Re: [Patch v4] net: pfe_eth: Use spi_flash_read API to
> > access flash memory
> >
> > Caution: EXT Email
> >
> > On 13.01.20 10:23, Kuldeep Singh wrote:
> > > Current PFE firmware access spi-nor memory directly. New spi-mem
> > > framework does not support direct memory access. So, let's use
> > > spi_flash_read API to access memory instead of directly using it.
> > >
> > > Signed-off-by: Kuldeep Singh 
> >
> > Reviewed-by: Frieder Schrempf 
> >
> 
> ping. this already has reviewed-by tag.
> Please let me know if there's any dependency on my side.
> 
> Thanks
> Kuldeep


[RESEND Patch v2] configs: lx2160a: Enable FSPI support

2020-03-14 Thread Kuldeep Singh
Enable FSPI controller support. So, flash environment can now be used.

Signed-off-by: Kuldeep Singh 
---
v2:
-Rebased to top.
-Drop other patches from series as already accepted.
-Add ENV_SECT_SIZE value as 0x2

 configs/lx2160aqds_tfa_SECURE_BOOT_defconfig | 1 +
 configs/lx2160aqds_tfa_defconfig | 3 +++
 configs/lx2160ardb_tfa_SECURE_BOOT_defconfig | 1 +
 configs/lx2160ardb_tfa_defconfig | 3 +++
 4 files changed, 8 insertions(+)

diff --git a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig 
b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
index 7c3b827..92fac5d 100644
--- a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
@@ -65,6 +65,7 @@ CONFIG_DM_SERIAL=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_FSL_DSPI=y
+CONFIG_NXP_FSPI=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_XHCI_HCD=y
diff --git a/configs/lx2160aqds_tfa_defconfig b/configs/lx2160aqds_tfa_defconfig
index 449b3cb..e472c12 100644
--- a/configs/lx2160aqds_tfa_defconfig
+++ b/configs/lx2160aqds_tfa_defconfig
@@ -4,6 +4,7 @@ CONFIG_TFABOOT=y
 CONFIG_SYS_TEXT_BASE=0x8200
 CONFIG_SYS_MALLOC_F_LEN=0x6000
 CONFIG_ENV_SIZE=0x2000
+CONFIG_ENV_SECT_SIZE=0x2
 CONFIG_ENV_OFFSET=0x50
 CONFIG_DM_GPIO=y
 CONFIG_FSPI_AHB_EN_4BYTE=y
@@ -32,6 +33,7 @@ CONFIG_OF_CONTROL=y
 CONFIG_OF_BOARD_FIXUP=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-lx2160a-qds"
 CONFIG_ENV_IS_IN_MMC=y
+CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
@@ -65,6 +67,7 @@ CONFIG_DM_SCSI=y
 CONFIG_DM_SERIAL=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
+CONFIG_NXP_FSPI=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_XHCI_HCD=y
diff --git a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig 
b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
index d1fffb3..e754eb7 100644
--- a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
@@ -60,6 +60,7 @@ CONFIG_DM_SCSI=y
 CONFIG_DM_SERIAL=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
+CONFIG_NXP_FSPI=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_XHCI_HCD=y
diff --git a/configs/lx2160ardb_tfa_defconfig b/configs/lx2160ardb_tfa_defconfig
index 93f3e20..5d4580e 100644
--- a/configs/lx2160ardb_tfa_defconfig
+++ b/configs/lx2160ardb_tfa_defconfig
@@ -4,6 +4,7 @@ CONFIG_TFABOOT=y
 CONFIG_SYS_TEXT_BASE=0x8200
 CONFIG_SYS_MALLOC_F_LEN=0x6000
 CONFIG_ENV_SIZE=0x2000
+CONFIG_ENV_SECT_SIZE=0x2
 CONFIG_ENV_OFFSET=0x50
 CONFIG_DM_GPIO=y
 CONFIG_EMC2305=y
@@ -33,6 +34,7 @@ CONFIG_OF_CONTROL=y
 CONFIG_OF_BOARD_FIXUP=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-lx2160a-rdb"
 CONFIG_ENV_IS_IN_MMC=y
+CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
@@ -64,6 +66,7 @@ CONFIG_DM_SCSI=y
 CONFIG_DM_SERIAL=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
+CONFIG_NXP_FSPI=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_XHCI_HCD=y
-- 
2.7.4



[Patch v3 3/3] arm: dts: lx2160a: Use flexspi in octal I/O mode

2020-03-14 Thread Kuldeep Singh
Configure RX and TX bus-width values to use flexspi in octal I/O mode.
If bus-widths are not specified, then single I/O mode is set by default.

Signed-off-by: Kuldeep Singh 
---
v3: Reword commit message.
v2: No change.

 arch/arm/dts/fsl-lx2160a-qds.dts | 2 ++
 arch/arm/dts/fsl-lx2160a-rdb.dts | 4 
 2 files changed, 6 insertions(+)

diff --git a/arch/arm/dts/fsl-lx2160a-qds.dts b/arch/arm/dts/fsl-lx2160a-qds.dts
index 33bedae..592fd59 100644
--- a/arch/arm/dts/fsl-lx2160a-qds.dts
+++ b/arch/arm/dts/fsl-lx2160a-qds.dts
@@ -58,6 +58,8 @@
compatible = "jedec,spi-nor";
spi-max-frequency = <5000>;
reg = <0>;
+   spi-rx-bus-width = <8>;
+   spi-tx-bus-width = <1>;
};
 };
 
diff --git a/arch/arm/dts/fsl-lx2160a-rdb.dts b/arch/arm/dts/fsl-lx2160a-rdb.dts
index e542c69..87617ca 100644
--- a/arch/arm/dts/fsl-lx2160a-rdb.dts
+++ b/arch/arm/dts/fsl-lx2160a-rdb.dts
@@ -39,6 +39,8 @@
compatible = "jedec,spi-nor";
spi-max-frequency = <5000>;
reg = <0>;
+   spi-rx-bus-width = <8>;
+   spi-tx-bus-width = <1>;
};
 
mt35xu512aba1: flash@1 {
@@ -47,6 +49,8 @@
compatible = "jedec,spi-nor";
spi-max-frequency = <5000>;
reg = <1>;
+   spi-rx-bus-width = <8>;
+   spi-tx-bus-width = <1>;
};
 };
 
-- 
2.7.4



[Patch v3 2/3] arm: dts: ls1028a: Use flexspi in octal I/O mode

2020-03-14 Thread Kuldeep Singh
Configure RX and TX bus-width values to use flexspi in octal I/O mode.
If bus-widths are not specified, then single I/O mode is set by default.

Signed-off-by: Kuldeep Singh 
---
v3: Reword commit message.
v2: No change.

 arch/arm/dts/fsl-ls1028a-qds.dts | 2 ++
 arch/arm/dts/fsl-ls1028a-rdb.dts | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/arch/arm/dts/fsl-ls1028a-qds.dts b/arch/arm/dts/fsl-ls1028a-qds.dts
index 3fd37be..029a8e3 100644
--- a/arch/arm/dts/fsl-ls1028a-qds.dts
+++ b/arch/arm/dts/fsl-ls1028a-qds.dts
@@ -49,6 +49,8 @@
compatible = "jedec,spi-nor";
spi-max-frequency = <5000>;
reg = <0>;
+   spi-rx-bus-width = <8>;
+   spi-tx-bus-width = <1>;
};
 };
 
diff --git a/arch/arm/dts/fsl-ls1028a-rdb.dts b/arch/arm/dts/fsl-ls1028a-rdb.dts
index a8f4085..85b4815 100644
--- a/arch/arm/dts/fsl-ls1028a-rdb.dts
+++ b/arch/arm/dts/fsl-ls1028a-rdb.dts
@@ -48,6 +48,8 @@
compatible = "jedec,spi-nor";
spi-max-frequency = <5000>;
reg = <0>;
+   spi-rx-bus-width = <8>;
+   spi-tx-bus-width = <1>;
};
 };
 
-- 
2.7.4



[Patch v3 0/3] Enable octal read support for mt35xu* flashes

2020-03-14 Thread Kuldeep Singh
Patch series enable octal read(1-1-8) support for LX2160ARDB/QDS and
LS1028ARDB/QDS which have mt35xu512aba and mt35xu02g flashes
respectively.

mt35xu512aba and mt35xu02g flashes support SINGLE and OCTAL I/O.
Previously, 1 bit mode was used in u-boot and now use octal mode for the
flashes.

Patch 1 enables octal read flag for flashes in framework.
Patch 2/3 adds RX,TX buswidth in flexspi dts entries to use octal mode
for LS1028ARDB/QDS, LX2160ARDB/QDS.

v3:
-Patch 3 has dependency on https://patchwork.ozlabs.org/patch/1247579/.
-Reword commit message for patch 2/3.

v2:
-Update dependencies of the patches
-Add lx2160aqds node buswidth in patch3.
-Patch3 has dependency on https://patchwork.ozlabs.org/patch/1236164/.

Kuldeep Singh (3):
  mtd: spi-nor-ids: Enable SPI_NOR_OCTAL_READ flag for mt35xu*
  arm: dts: ls1028a: Use flexspi in octal I/O mode
  arm: dts: lx2160a: Use flexspi in octal I/O mode

 arch/arm/dts/fsl-ls1028a-qds.dts | 2 ++
 arch/arm/dts/fsl-ls1028a-rdb.dts | 2 ++
 arch/arm/dts/fsl-lx2160a-qds.dts | 2 ++
 arch/arm/dts/fsl-lx2160a-rdb.dts | 4 
 drivers/mtd/spi/spi-nor-ids.c| 4 ++--
 5 files changed, 12 insertions(+), 2 deletions(-)

-- 
2.7.4



[Patch v3 1/3] mtd: spi-nor-ids: Enable SPI_NOR_OCTAL_READ flag for mt35xu*

2020-03-14 Thread Kuldeep Singh
Commit 658df8bd9464 ("mtd: spi-nor-core: Add octal mode support")
enables octal mode(1-1-8) support in spi-nor framework.

mt35xu512aba and mt35xu02g supports SINGLE and OCTAL I/O. Hence, enable
SPI_NOR_OCTAL_READ flag for these flashes.

Signed-off-by: Kuldeep Singh 
Reviewed-by: Vignesh Raghavendra 
---
v3: No change
v2: Reword commit message

 drivers/mtd/spi/spi-nor-ids.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi/spi-nor-ids.c b/drivers/mtd/spi/spi-nor-ids.c
index 973b6f8..334c074 100644
--- a/drivers/mtd/spi/spi-nor-ids.c
+++ b/drivers/mtd/spi/spi-nor-ids.c
@@ -182,8 +182,8 @@ const struct flash_info spi_nor_ids[] = {
{ INFO("n25q00",  0x20ba21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | 
SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
{ INFO("n25q00a", 0x20bb21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | 
SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
{ INFO("mt25qu02g",   0x20bb22, 0, 64 * 1024, 4096, SECT_4K | USE_FSR | 
SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
-   { INFO("mt35xu512aba", 0x2c5b1a, 0,  128 * 1024,  512, USE_FSR | 
SPI_NOR_4B_OPCODES) },
-   { INFO("mt35xu02g",  0x2c5b1c, 0, 128 * 1024,  2048, USE_FSR | 
SPI_NOR_4B_OPCODES) },
+   { INFO("mt35xu512aba", 0x2c5b1a, 0,  128 * 1024,  512, USE_FSR | 
SPI_NOR_OCTAL_READ | SPI_NOR_4B_OPCODES) },
+   { INFO("mt35xu02g",  0x2c5b1c, 0, 128 * 1024,  2048, USE_FSR | 
SPI_NOR_OCTAL_READ | SPI_NOR_4B_OPCODES) },
 #endif
 #ifdef CONFIG_SPI_FLASH_SPANSION   /* SPANSION */
/* Spansion/Cypress -- single (large) sector size only, at least
-- 
2.7.4



[PATCH] configs: lx2160a: Access flash memory as per spi-mem

2020-03-12 Thread Kuldeep Singh
MC_INIT and BOOT command currently access spi-nor flash memory directly.
As per spi-mem framework, flash memory access via absolute addresses is
no more possible. Use flash APIs to access memory instead of directly
using it.

Signed-off-by: Kuldeep Singh 
---
 include/configs/lx2160a_common.h | 23 +++
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/include/configs/lx2160a_common.h b/include/configs/lx2160a_common.h
index 373daeb..2a76ce5 100644
--- a/include/configs/lx2160a_common.h
+++ b/include/configs/lx2160a_common.h
@@ -187,11 +187,15 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_SYS_BOOTM_LEN   (64 << 20)  /* Increase max gunzip size */
 
 /* Initial environment variables */
-#define XSPI_MC_INIT_CMD   \
-   "env exists secureboot && " \
-   "esbc_validate 0x2064 && "  \
-   "esbc_validate 0x2068 ;"\
-   "fsl_mc start mc 0x20a0 0x20e0\0"
+#define XSPI_MC_INIT_CMD   \
+   "sf probe 0:0 && "  \
+   "sf read 0x8064 0x64 0x8 && "   \
+   "env exists secureboot && " \
+   "esbc_validate 0x8064 && "  \
+   "esbc_validate 0x8068; "\
+   "sf read 0x80a0 0xa0 0x30 && "  \
+   "sf read 0x80e0 0xe0 0x10; "\
+   "fsl_mc start mc 0x80a0 0x80e0\0"
 
 #define SD_MC_INIT_CMD \
"mmc read 0x80a0 0x5000 0x1200;"\
@@ -249,10 +253,13 @@ unsigned long get_board_ddr_clk(void);
"source ${scriptaddr}\0"
 
 #define XSPI_NOR_BOOTCOMMAND   \
-   "env exists mcinitcmd && env exists secureboot "\
-   "&& esbc_validate 0x206C; " \
+   "sf probe 0:0; "\
+   "sf read 0x806c 0x6c 0x4; " \
+   "env exists mcinitcmd && env exists secureboot" \
+   " && esbc_validate 0x806c; "\
+   "sf read 0x80d0 0xd0 0x10; "\
"env exists mcinitcmd && "  \
-   "fsl_mc lazyapply dpl 0x20d0; " \
+   "fsl_mc lazyapply dpl 0x80d0; " \
"run distro_bootcmd;run xspi_bootcmd; " \
"env exists secureboot && esbc_halt;"
 
-- 
2.7.4



RE: [Patch v5 1/7] spi: Transform the FSL QuadSPI driver to use the SPI MEM API

2020-03-03 Thread Kuldeep Singh
Hi Jagan,

> -Original Message-
> From: Kuldeep Singh 
> Sent: Thursday, February 20, 2020 10:58 PM
> To: u-boot@lists.denx.de
> Cc: Frieder Schrempf ; Stefan Roese
> ; Priyanka Jain ; Jagan Teki
> ; Stefano Babic ; Fabio
> Estevam ; Vignesh Raghavendra ;
> Kuldeep Singh ; Ashish Kumar
> 
> Subject: [Patch v5 1/7] spi: Transform the FSL QuadSPI driver to use the SPI
> MEM API
> 
> To support the SPI MEM API, instead of modifying the existing U-Boot
> driver, this patch adds a port of the existing Linux driver.
> This also has the advantage that porting changes and fixes from Linux will
> be easier.
> Porting of driver left most of the functions unchanged while few of the
> changes are:
> -Remove lock(mutexes) and irq handler as u-boot is a single core execution.
> -Remove invalid masterid as it was required specially for multicore
> execution in LS2088ARDB which is not the case in u-boot.
> -Remove clock support as changing spi speed is not supported in uboot and
> nor in linux.
> 
> Currently tested on LS1088ARDB, LS1012ARDB, LS1046ARDB, LS1046AFRWY,
> LS1043AQDS, LS1021ATWR, LS2088ARDB, I.MX6ULL EVK.
> 
> Signed-off-by: Frieder Schrempf 
> Signed-off-by: Ashish Kumar 
> Signed-off-by: Kuldeep Singh 
> Reviewed-by: Stefan Roese 
> Tested-by: Stefan Roese 
> Acked-by: Vignesh Raghavendra 
> ---
> v5: Remove compilation warning/error. No other change.
> v4: Add i.mx among tested boards
> v3: Use 1k size to make driver independent of flash size.
> v2: Merge removal of old driver and addition of new driver in single patch


A gentle ping.
Could you please let me know if there's any dependency on my side.

Thanks
Kuldeep


[Patch v2] arm: dts: lx2160aqds: Add FSPI node properties

2020-03-02 Thread Kuldeep Singh
lx2160a-qds has 2 micron "mt35xu512aba" flashes of size 64M each
connected on A0 and B1 i.e on CS0 and CS3. Since flashes are connected
on different buses, only one flash can be probed at a time.

Add fspi node properties aligned with LX2160A-RDB fspi properties.

Signed-off-by: Kuldeep Singh 
---
v2: Update flash nodes as per compatibles

 arch/arm/dts/fsl-lx2160a-qds.dts | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm/dts/fsl-lx2160a-qds.dts b/arch/arm/dts/fsl-lx2160a-qds.dts
index 34df0f5..33bedae 100644
--- a/arch/arm/dts/fsl-lx2160a-qds.dts
+++ b/arch/arm/dts/fsl-lx2160a-qds.dts
@@ -13,6 +13,9 @@
 / {
model = "NXP Layerscape LX2160AQDS Board";
compatible = "fsl,lx2160aqds", "fsl,lx2160a";
+   aliases {
+   spi0 = 
+   };
 };
 
  {
@@ -46,6 +49,18 @@
};
 };
 
+ {
+   status = "okay";
+
+   mt35xu512aba0: flash@0 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "jedec,spi-nor";
+   spi-max-frequency = <5000>;
+   reg = <0>;
+   };
+};
+
  {
status = "okay";
 };
-- 
2.7.4



[PATCH] spi: nxp-fspi: Add 1us delay to make controller ready for next transaction

2020-02-24 Thread Kuldeep Singh
Board gets reset when performing burst read/write operations. On the
other hand, no such behaviour is observed on small size operations.

In Linux, readl_poll_timeout API already add delay of 1us which is
skipped in U-boot. Since, NXP Flexspi U-boot driver is a ported version
of Linux driver and U-boot poll_timeout API lacks delay functionality,
add 1us delay so as to make controller ready for other transactions.

Signed-off-by: Kuldeep Singh 
---
 drivers/spi/nxp_fspi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spi/nxp_fspi.c b/drivers/spi/nxp_fspi.c
index 0e6c7be..9703642 100644
--- a/drivers/spi/nxp_fspi.c
+++ b/drivers/spi/nxp_fspi.c
@@ -756,6 +756,7 @@ static int nxp_fspi_exec_op(struct spi_slave *slave,
err = fspi_readl_poll_tout(f, f->iobase + FSPI_STS0,
   FSPI_STS0_ARB_IDLE, 1, POLL_TOUT, true);
WARN_ON(err);
+   udelay(1);
 
nxp_fspi_prepare_lut(f, op);
/*
-- 
2.7.4



[Patch v5 7/7] treewide: Update fsl qspi node dt properties as per spi-mem driver

2020-02-20 Thread Kuldeep Singh
According to new qspi driver, some properties like "bus-num, num-cs,
big-endian" are no longer used. Device endiannes can be determined from
device-type data in driver.

Now use board specific compatibles, generic node names and specific
labels to align with linux device-tree properties.

Also consolidate spi-max-frequency to 50Mhz treewide.

Signed-off-by: Kuldeep Singh 
---
v5: No change
v4: No change
v3: No change
v2: No change

 arch/arm/dts/fsl-ls1012a-2g5rdb.dts   | 5 ++---
 arch/arm/dts/fsl-ls1012a-frdm.dtsi| 5 ++---
 arch/arm/dts/fsl-ls1012a-qds.dtsi | 5 ++---
 arch/arm/dts/fsl-ls1012a-rdb.dtsi | 5 ++---
 arch/arm/dts/fsl-ls1012a.dtsi | 4 +---
 arch/arm/dts/fsl-ls1043a-qds.dtsi | 5 ++---
 arch/arm/dts/fsl-ls1043a.dtsi | 6 ++
 arch/arm/dts/fsl-ls1046a-frwy.dts | 5 ++---
 arch/arm/dts/fsl-ls1046a-qds.dtsi | 5 ++---
 arch/arm/dts/fsl-ls1046a-rdb.dts  | 5 ++---
 arch/arm/dts/fsl-ls1046a.dtsi | 4 +---
 arch/arm/dts/fsl-ls1088a-qds.dts  | 5 ++---
 arch/arm/dts/fsl-ls1088a-rdb.dts  | 5 ++---
 arch/arm/dts/fsl-ls1088a.dtsi | 2 +-
 arch/arm/dts/fsl-ls2080a-qds.dts  | 5 ++---
 arch/arm/dts/fsl-ls2080a.dtsi | 4 ++--
 arch/arm/dts/fsl-ls2088a-rdb-qspi.dts | 5 ++---
 arch/arm/dts/ls1021a-twr.dtsi | 5 ++---
 arch/arm/dts/ls1021a.dtsi | 6 ++
 19 files changed, 35 insertions(+), 56 deletions(-)

diff --git a/arch/arm/dts/fsl-ls1012a-2g5rdb.dts 
b/arch/arm/dts/fsl-ls1012a-2g5rdb.dts
index fecef88..6402cf5 100644
--- a/arch/arm/dts/fsl-ls1012a-2g5rdb.dts
+++ b/arch/arm/dts/fsl-ls1012a-2g5rdb.dts
@@ -21,14 +21,13 @@
 };
 
  {
-   bus-num = <0>;
status = "okay";
 
-   qflash0: s25fl128s@0 {
+   s25fs512s0: flash@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "jedec,spi-nor";
-   spi-max-frequency = <2000>;
+   spi-max-frequency = <5000>;
reg = <0>;
};
 };
diff --git a/arch/arm/dts/fsl-ls1012a-frdm.dtsi 
b/arch/arm/dts/fsl-ls1012a-frdm.dtsi
index a357793..88aa24a 100644
--- a/arch/arm/dts/fsl-ls1012a-frdm.dtsi
+++ b/arch/arm/dts/fsl-ls1012a-frdm.dtsi
@@ -15,14 +15,13 @@
 };
 
  {
-   bus-num = <0>;
status = "okay";
 
-   qflash0: s25fl128s@0 {
+   s25fs512s0: flash@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "jedec,spi-nor";
-   spi-max-frequency = <2000>;
+   spi-max-frequency = <5000>;
reg = <0>;
};
 };
diff --git a/arch/arm/dts/fsl-ls1012a-qds.dtsi 
b/arch/arm/dts/fsl-ls1012a-qds.dtsi
index a330597..910d2a5 100644
--- a/arch/arm/dts/fsl-ls1012a-qds.dtsi
+++ b/arch/arm/dts/fsl-ls1012a-qds.dtsi
@@ -43,14 +43,13 @@
 };
 
  {
-   bus-num = <0>;
status = "okay";
 
-   qflash0: s25fl128s@0 {
+   s25fs512s0: flash@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "jedec,spi-nor";
-   spi-max-frequency = <2000>;
+   spi-max-frequency = <5000>;
reg = <0>;
};
 };
diff --git a/arch/arm/dts/fsl-ls1012a-rdb.dtsi 
b/arch/arm/dts/fsl-ls1012a-rdb.dtsi
index 55155fd..3757051 100644
--- a/arch/arm/dts/fsl-ls1012a-rdb.dtsi
+++ b/arch/arm/dts/fsl-ls1012a-rdb.dtsi
@@ -19,14 +19,13 @@
 };
 
  {
-   bus-num = <0>;
status = "okay";
 
-   qflash0: s25fl128s@0 {
+   s25fs512s0: flash@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "jedec,spi-nor";
-   spi-max-frequency = <2000>;
+   spi-max-frequency = <5000>;
reg = <0>;
};
 };
diff --git a/arch/arm/dts/fsl-ls1012a.dtsi b/arch/arm/dts/fsl-ls1012a.dtsi
index 1125e57..2d70c82 100644
--- a/arch/arm/dts/fsl-ls1012a.dtsi
+++ b/arch/arm/dts/fsl-ls1012a.dtsi
@@ -107,14 +107,12 @@
};
 
qspi: quadspi@155 {
-   compatible = "fsl,vf610-qspi";
+   compatible = "fsl,ls1021a-qspi";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x0 0x155 0x0 0x1>,
<0x0 0x4000 0x0 0x400>;
reg-names = "QuadSPI", "QuadSPI-memory";
-   num-cs = <1>;
-   big-endian;
status = "disabled";
};
 
diff --git a/arch/arm/dts/fsl-ls1043a-qds.dtsi 
b/arch/arm/dts/fsl-ls1043a-qds.dtsi
index 7

[Patch v5 5/7] configs: ls1012a: Enable CONFIG_SPI_FLASH_SPANSION in defconfigs

2020-02-20 Thread Kuldeep Singh
Since CONFIG_FSL_QSPI is already enabled for LS1012A in defconfigs. Also
enable CONFIG_SPI_FLASH_SPANSION for LS1012A boards having spansion
flashes.

Signed-off-by: Ashish Kumar 
Signed-off-by: Kuldeep Singh 
---
v5: No change
v4: Reword commit message. Add "in defconfigs"
v3: Reword commit message.
v2: No change

 configs/ls1012a2g5rdb_qspi_defconfig  | 1 +
 configs/ls1012a2g5rdb_tfa_defconfig   | 1 +
 configs/ls1012afrdm_qspi_defconfig| 1 +
 configs/ls1012afrdm_tfa_defconfig | 1 +
 configs/ls1012aqds_qspi_defconfig | 1 +
 configs/ls1012aqds_tfa_SECURE_BOOT_defconfig  | 1 +
 configs/ls1012aqds_tfa_defconfig  | 1 +
 configs/ls1012ardb_qspi_SECURE_BOOT_defconfig | 1 +
 configs/ls1012ardb_qspi_defconfig | 1 +
 configs/ls1012ardb_tfa_SECURE_BOOT_defconfig  | 1 +
 configs/ls1012ardb_tfa_defconfig  | 1 +
 include/configs/ls1012a_common.h  | 1 -
 12 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/configs/ls1012a2g5rdb_qspi_defconfig 
b/configs/ls1012a2g5rdb_qspi_defconfig
index b1cf8ef..174084c 100644
--- a/configs/ls1012a2g5rdb_qspi_defconfig
+++ b/configs/ls1012a2g5rdb_qspi_defconfig
@@ -42,6 +42,7 @@ CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
 # CONFIG_SPI_FLASH_BAR is not set
+CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_FSL_PFE=y
 CONFIG_DM_ETH=y
diff --git a/configs/ls1012a2g5rdb_tfa_defconfig 
b/configs/ls1012a2g5rdb_tfa_defconfig
index a978580..3e954bd 100644
--- a/configs/ls1012a2g5rdb_tfa_defconfig
+++ b/configs/ls1012a2g5rdb_tfa_defconfig
@@ -42,6 +42,7 @@ CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
 # CONFIG_SPI_FLASH_BAR is not set
+CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_FSL_PFE=y
 CONFIG_DM_ETH=y
diff --git a/configs/ls1012afrdm_qspi_defconfig 
b/configs/ls1012afrdm_qspi_defconfig
index 11d0cee..fcb8367 100644
--- a/configs/ls1012afrdm_qspi_defconfig
+++ b/configs/ls1012afrdm_qspi_defconfig
@@ -38,6 +38,7 @@ CONFIG_DM_I2C=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
 # CONFIG_SPI_FLASH_BAR is not set
+CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_FSL_PFE=y
 CONFIG_DM_ETH=y
diff --git a/configs/ls1012afrdm_tfa_defconfig 
b/configs/ls1012afrdm_tfa_defconfig
index 2818bdf..08d08e9 100644
--- a/configs/ls1012afrdm_tfa_defconfig
+++ b/configs/ls1012afrdm_tfa_defconfig
@@ -38,6 +38,7 @@ CONFIG_DM_I2C=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
 # CONFIG_SPI_FLASH_BAR is not set
+CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_FSL_PFE=y
 CONFIG_DM_ETH=y
diff --git a/configs/ls1012aqds_qspi_defconfig 
b/configs/ls1012aqds_qspi_defconfig
index fd4fba5..081735b 100644
--- a/configs/ls1012aqds_qspi_defconfig
+++ b/configs/ls1012aqds_qspi_defconfig
@@ -58,6 +58,7 @@ CONFIG_SF_DEFAULT_BUS=1
 CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=1000
 # CONFIG_SPI_FLASH_BAR is not set
+CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_FSL_PFE=y
 CONFIG_DM_ETH=y
diff --git a/configs/ls1012aqds_tfa_SECURE_BOOT_defconfig 
b/configs/ls1012aqds_tfa_SECURE_BOOT_defconfig
index 23dea4c..df1e51a 100644
--- a/configs/ls1012aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1012aqds_tfa_SECURE_BOOT_defconfig
@@ -47,6 +47,7 @@ CONFIG_SF_DEFAULT_BUS=1
 CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=1000
 # CONFIG_SPI_FLASH_BAR is not set
+CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_FSL_PFE=y
 CONFIG_DM_ETH=y
diff --git a/configs/ls1012aqds_tfa_defconfig b/configs/ls1012aqds_tfa_defconfig
index 974cedc..9e942d1 100644
--- a/configs/ls1012aqds_tfa_defconfig
+++ b/configs/ls1012aqds_tfa_defconfig
@@ -58,6 +58,7 @@ CONFIG_SF_DEFAULT_BUS=1
 CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=1000
 # CONFIG_SPI_FLASH_BAR is not set
+CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_FSL_PFE=y
 CONFIG_DM_ETH=y
diff --git a/configs/ls1012ardb_qspi_SECURE_BOOT_defconfig 
b/configs/ls1012ardb_qspi_SECURE_BOOT_defconfig
index 5ad4e0d..2d661f8 100644
--- a/configs/ls1012ardb_qspi_SECURE_BOOT_defconfig
+++ b/configs/ls1012ardb_qspi_SECURE_BOOT_defconfig
@@ -42,6 +42,7 @@ CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
 # CONFIG_SPI_FLASH_BAR is not set
+CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_E1000=y
 CONFIG_PCI=y
diff --git a/configs/ls1012ardb_qspi_defconfig 
b/configs/ls1012ardb_qspi_defconfig
index 98057a9..2f74226 100644
--- a/configs/ls1012ardb_qspi_defconfig
+++ b/configs/ls1012ardb_qspi_defconfig
@@ -44,6 +44,7 @@ CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
 # CONFIG_SPI_FLASH_BAR is not set
+CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_FSL_PFE=y
 CONFIG_DM_ETH=y
diff --git a/configs/ls1012ardb_tfa_SECURE_BOOT_defconfig 

[Patch v5 2/7] treewide: Remove unused FSL QSPI config options for Layerscape platforms

2020-02-20 Thread Kuldeep Singh
Some of these options are not used by the driver anymore and some of
them are obsolete as the information is gathered from the dt.
Also consolidating defines in common headers.

Signed-off-by: Frieder Schrempf 
Signed-off-by: Ashish Kumar 
Signed-off-by: Kuldeep Singh 
---
v5: Keep only layerscape changes. Splitting into 2 patches.
v4: Remove buildman failure by removing #endif in LS2080AQDS
v3: No change
v2: No change

 arch/arm/include/asm/arch-fsl-layerscape/config.h |  1 -
 arch/arm/include/asm/arch-ls102xa/config.h|  1 -
 include/configs/ls1012a_common.h  | 16 +---
 include/configs/ls1012afrwy.h |  3 ---
 include/configs/ls1012ardb.h  |  3 ---
 include/configs/ls1021aiot.h  |  6 --
 include/configs/ls1021aqds.h  | 11 ---
 include/configs/ls1021atwr.h  | 10 --
 include/configs/ls1043aqds.h  |  2 --
 include/configs/ls1046afrwy.h |  9 -
 include/configs/ls1046aqds.h  | 11 ---
 include/configs/ls1046ardb.h  | 13 -
 include/configs/ls1088a_common.h  |  6 --
 include/configs/ls1088aqds.h  |  8 
 include/configs/ls1088ardb.h  | 18 --
 include/configs/ls2080aqds.h  |  5 -
 include/configs/ls2080ardb.h  |  6 +-
 17 files changed, 2 insertions(+), 127 deletions(-)

diff --git a/arch/arm/include/asm/arch-fsl-layerscape/config.h 
b/arch/arm/include/asm/arch-fsl-layerscape/config.h
index ddd9390..cf2abda 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/config.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/config.h
@@ -306,7 +306,6 @@
 #define CONFIG_SYS_FSL_ESDHC_BE
 #define CONFIG_SYS_FSL_WDOG_BE
 #define CONFIG_SYS_FSL_DSPI_BE
-#define CONFIG_SYS_FSL_QSPI_BE
 #define CONFIG_SYS_FSL_CCSR_GUR_BE
 #define CONFIG_SYS_FSL_PEX_LUT_BE
 
diff --git a/arch/arm/include/asm/arch-ls102xa/config.h 
b/arch/arm/include/asm/arch-ls102xa/config.h
index 9705378..3884948 100644
--- a/arch/arm/include/asm/arch-ls102xa/config.h
+++ b/arch/arm/include/asm/arch-ls102xa/config.h
@@ -94,7 +94,6 @@
 #define CONFIG_SYS_FSL_ESDHC_BE
 #define CONFIG_SYS_FSL_WDOG_BE
 #define CONFIG_SYS_FSL_DSPI_BE
-#define CONFIG_SYS_FSL_QSPI_BE
 #define CONFIG_SYS_FSL_DCU_BE
 #define CONFIG_SYS_FSL_SEC_MON_LE
 #define CONFIG_SYS_FSL_SFP_VER_3_2
diff --git a/include/configs/ls1012a_common.h b/include/configs/ls1012a_common.h
index e9baa2a..14d2483 100644
--- a/include/configs/ls1012a_common.h
+++ b/include/configs/ls1012a_common.h
@@ -37,23 +37,9 @@
 #define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + 128 * 1024)
 
 /*SPI device */
-#if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_TFABOOT)
 #define CONFIG_SYS_FMAN_FW_ADDR0x400d
+#define CONFIG_SYS_FSL_QSPI_BASE   0x4000
 #define CONFIG_SPI_FLASH_SPANSION
-#define CONFIG_FSL_SPI_INTERFACE
-#define CONFIG_SF_DATAFLASH
-
-#define QSPI0_AMBA_BASE0x4000
-#define CONFIG_SPI_FLASH_SPANSION
-
-#define FSL_QSPI_FLASH_SIZESZ_64M
-#define FSL_QSPI_FLASH_NUM 2
-
-/*
- * Environment
- */
-#define CONFIG_ENV_OVERWRITE
-#endif
 
 /* SATA */
 #define CONFIG_SCSI_AHCI_PLAT
diff --git a/include/configs/ls1012afrwy.h b/include/configs/ls1012afrwy.h
index dde4369..0442e34 100644
--- a/include/configs/ls1012afrwy.h
+++ b/include/configs/ls1012afrwy.h
@@ -33,9 +33,6 @@
func(USB, usb, 0)
 #endif
 
-#undef FSL_QSPI_FLASH_SIZE
-#define FSL_QSPI_FLASH_SIZESZ_16M
-
 /*  MMC  */
 #ifdef CONFIG_MMC
 #define CONFIG_SYS_FSL_MMC_HAS_CAPBLT_VS33
diff --git a/include/configs/ls1012ardb.h b/include/configs/ls1012ardb.h
index 0738b24..f335a64 100644
--- a/include/configs/ls1012ardb.h
+++ b/include/configs/ls1012ardb.h
@@ -17,9 +17,6 @@
 #define CONFIG_SYS_MEMTEST_START   0x8000
 #define CONFIG_SYS_MEMTEST_END 0x9fff
 
-
-/* ENV */
-#define CONFIG_SYS_FSL_QSPI_BASE   0x4000
 /*
  * I2C IO expander
  */
diff --git a/include/configs/ls1021aiot.h b/include/configs/ls1021aiot.h
index 1d218aa..4176c36 100644
--- a/include/configs/ls1021aiot.h
+++ b/include/configs/ls1021aiot.h
@@ -138,12 +138,6 @@
 /* SPI */
 #if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI)
 #define CONFIG_SPI_FLASH_SPANSION
-
-/* QSPI */
-#define QSPI0_AMBA_BASE0x4000
-#define FSL_QSPI_FLASH_SIZE(1 << 24)
-#define FSL_QSPI_FLASH_NUM 2
-#define CONFIG_SPI_FLASH_SPANSION
 #endif
 
 /* DM SPI */
diff --git a/include/configs/ls1021aqds.h b/include/configs/ls1021aqds.h
index 8bac2d2..e494355 100644
--- a/include/configs/ls1021aqds.h
+++ b/include/configs/ls1021aqds.h
@@ -363,20 +363,9 @@ unsigned long get_board_ddr_clk(void);
  * MMC
  */
 
-/* SPI */
-#if defined(CONFIG_QSPI_BOOT) || d

[Patch v5 1/7] spi: Transform the FSL QuadSPI driver to use the SPI MEM API

2020-02-20 Thread Kuldeep Singh
To support the SPI MEM API, instead of modifying the existing U-Boot
driver, this patch adds a port of the existing Linux driver.
This also has the advantage that porting changes and fixes from Linux will
be easier.
Porting of driver left most of the functions unchanged while few of the
changes are:
-Remove lock(mutexes) and irq handler as u-boot is a single core execution.
-Remove invalid masterid as it was required specially for multicore
execution in LS2088ARDB which is not the case in u-boot.
-Remove clock support as changing spi speed is not supported in uboot and
nor in linux.

Currently tested on LS1088ARDB, LS1012ARDB, LS1046ARDB, LS1046AFRWY,
LS1043AQDS, LS1021ATWR, LS2088ARDB, I.MX6ULL EVK.

Signed-off-by: Frieder Schrempf 
Signed-off-by: Ashish Kumar 
Signed-off-by: Kuldeep Singh 
Reviewed-by: Stefan Roese 
Tested-by: Stefan Roese 
Acked-by: Vignesh Raghavendra 
---
v5: Remove compilation warning/error. No other change.
v4: Add i.mx among tested boards
v3: Use 1k size to make driver independent of flash size.
v2: Merge removal of old driver and addition of new driver in single patch

 drivers/spi/fsl_qspi.c | 1577 +++-
 drivers/spi/fsl_qspi.h |  145 -
 2 files changed, 608 insertions(+), 1114 deletions(-)
 delete mode 100644 drivers/spi/fsl_qspi.h

diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c
index 8e2a09d..ee2c8b6 100644
--- a/drivers/spi/fsl_qspi.c
+++ b/drivers/spi/fsl_qspi.c
@@ -1,1142 +1,781 @@
 // SPDX-License-Identifier: GPL-2.0+
+
 /*
- * Copyright 2013-2015 Freescale Semiconductor, Inc.
+ * Freescale QuadSPI driver.
+ *
+ * Copyright (C) 2013 Freescale Semiconductor, Inc.
+ * Copyright (C) 2018 Bootlin
+ * Copyright (C) 2018 exceet electronics GmbH
+ * Copyright (C) 2018 Kontron Electronics GmbH
+ * Copyright 2019-2020 NXP
+ *
+ * This driver is a ported version of Linux Freescale QSPI driver taken from
+ * v5.5-rc1 tag having following information.
  *
- * Freescale Quad Serial Peripheral Interface (QSPI) driver
+ * Transition to SPI MEM interface:
+ * Authors:
+ * Boris Brezillon 
+ * Frieder Schrempf 
+ * Yogesh Gaur 
+ * Suresh Gupta 
+ *
+ * Based on the original fsl-quadspi.c spi-nor driver.
+ * Transition to spi-mem in spi-fsl-qspi.c
  */
 
 #include 
-#include 
-#include 
 #include 
-#include 
-#include 
 #include 
-#include 
-#include 
-#include 
-#include "fsl_qspi.h"
+#include 
+#include 
+#include 
+#include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define OFFSET_BITS_MASK   GENMASK(23, 0)
-
-#define FLASH_STATUS_WEL   0x02
-
-/* SEQID */
-#define SEQID_WREN 1
-#define SEQID_FAST_READ2
-#define SEQID_RDSR 3
-#define SEQID_SE   4
-#define SEQID_CHIP_ERASE   5
-#define SEQID_PP   6
-#define SEQID_RDID 7
-#define SEQID_BE_4K8
-#ifdef CONFIG_SPI_FLASH_BAR
-#define SEQID_BRRD 9
-#define SEQID_BRWR 10
-#define SEQID_RDEAR11
-#define SEQID_WREAR12
-#endif
-#define SEQID_WRAR 13
-#define SEQID_RDAR 14
-
-/* QSPI CMD */
-#define QSPI_CMD_PP0x02/* Page program (up to 256 bytes) */
-#define QSPI_CMD_RDSR  0x05/* Read status register */
-#define QSPI_CMD_WREN  0x06/* Write enable */
-#define QSPI_CMD_FAST_READ 0x0b/* Read data bytes (high frequency) */
-#define QSPI_CMD_BE_4K 0x20/* 4K erase */
-#define QSPI_CMD_CHIP_ERASE0xc7/* Erase whole flash chip */
-#define QSPI_CMD_SE0xd8/* Sector erase (usually 64KiB) */
-#define QSPI_CMD_RDID  0x9f/* Read JEDEC ID */
-
-/* Used for Micron, winbond and Macronix flashes */
-#defineQSPI_CMD_WREAR  0xc5/* EAR register write */
-#defineQSPI_CMD_RDEAR  0xc8/* EAR reigster read */
-
-/* Used for Spansion flashes only. */
-#defineQSPI_CMD_BRRD   0x16/* Bank register read */
-#defineQSPI_CMD_BRWR   0x17/* Bank register write */
-
-/* Used for Spansion S25FS-S family flash only. */
-#define QSPI_CMD_RDAR  0x65/* Read any device register */
-#define QSPI_CMD_WRAR  0x71/* Write any device register */
-
-/* 4-byte address QSPI CMD - used on Spansion and some Macronix flashes */
-#define QSPI_CMD_FAST_READ_4B  0x0c/* Read data bytes (high frequency) */
-#define QSPI_CMD_PP_4B 0x12/* Page program (up to 256 bytes) */
-#define QSPI_CMD_SE_4B 0xdc/* Sector erase (usually 64KiB) */
-
-/* fsl_qspi_platdata flags */
-#define QSPI_FLAG_REGMAP_ENDIAN_BIGBIT(0)
-
-/* default SCK frequency, unit: HZ */
-#define FSL_QSPI_DEFAULT_SCK_FREQ  5000
-
-/* QSPI max chipselect signals number */
-#define FSL_QSPI_MAX_CHIPSELECT_NUM 4
-
-/* Controller needs driver to swap endian */
+/*
+ * The driver only uses one single LUT entry, that is updated on
+ * each call of exec_op(

[Patch v5 6/7] configs: ls1046a: Move SPI_FLASH_SPANSION to defconfig

2020-02-20 Thread Kuldeep Singh
Enable CONFIG_SPI_FLASH_SPANSION in defconfigs of LS1046ARDB and
LS1046AQDS which have two spansion flases i.e s25fs512s each of size
64M.

Signed-off-by: Kuldeep Singh 
---
v5: No change
v4: No change
v3: No change
v2: No change

 configs/ls1046aqds_qspi_defconfig | 1 +
 configs/ls1046aqds_sdcard_qspi_defconfig  | 1 +
 configs/ls1046aqds_tfa_SECURE_BOOT_defconfig  | 1 +
 configs/ls1046aqds_tfa_defconfig  | 1 +
 configs/ls1046ardb_qspi_SECURE_BOOT_defconfig | 1 +
 configs/ls1046ardb_qspi_defconfig | 1 +
 configs/ls1046ardb_tfa_SECURE_BOOT_defconfig  | 1 +
 configs/ls1046ardb_tfa_defconfig  | 1 +
 include/configs/ls1046aqds.h  | 8 
 include/configs/ls1046ardb.h  | 7 ---
 10 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/configs/ls1046aqds_qspi_defconfig 
b/configs/ls1046aqds_qspi_defconfig
index d6253c7..22904a0 100644
--- a/configs/ls1046aqds_qspi_defconfig
+++ b/configs/ls1046aqds_qspi_defconfig
@@ -38,6 +38,7 @@ CONFIG_FSL_CAAM=y
 CONFIG_DM_MMC=y
 CONFIG_FSL_ESDHC=y
 # CONFIG_SPI_FLASH_BAR is not set
+CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
 CONFIG_E1000=y
diff --git a/configs/ls1046aqds_sdcard_qspi_defconfig 
b/configs/ls1046aqds_sdcard_qspi_defconfig
index 3571a6f..3d74bf0 100644
--- a/configs/ls1046aqds_sdcard_qspi_defconfig
+++ b/configs/ls1046aqds_sdcard_qspi_defconfig
@@ -54,6 +54,7 @@ CONFIG_FSL_CAAM=y
 CONFIG_DM_MMC=y
 CONFIG_FSL_ESDHC=y
 # CONFIG_SPI_FLASH_BAR is not set
+CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
 CONFIG_E1000=y
diff --git a/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig 
b/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig
index e173747..0edbac3 100644
--- a/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig
@@ -43,6 +43,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_SF_DEFAULT_BUS=1
+CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_PHYLIB=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
diff --git a/configs/ls1046aqds_tfa_defconfig b/configs/ls1046aqds_tfa_defconfig
index 824fc51..df85533 100644
--- a/configs/ls1046aqds_tfa_defconfig
+++ b/configs/ls1046aqds_tfa_defconfig
@@ -53,6 +53,7 @@ CONFIG_SYS_FLASH_CFI=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_SF_DEFAULT_BUS=1
 # CONFIG_SPI_FLASH_BAR is not set
+CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_PHYLIB=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
diff --git a/configs/ls1046ardb_qspi_SECURE_BOOT_defconfig 
b/configs/ls1046ardb_qspi_SECURE_BOOT_defconfig
index aff9bf8..d4e940c 100644
--- a/configs/ls1046ardb_qspi_SECURE_BOOT_defconfig
+++ b/configs/ls1046ardb_qspi_SECURE_BOOT_defconfig
@@ -34,6 +34,7 @@ CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_MTD_RAW_NAND=y
 # CONFIG_SPI_FLASH_BAR is not set
+CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
diff --git a/configs/ls1046ardb_qspi_defconfig 
b/configs/ls1046ardb_qspi_defconfig
index b482e73..d5e0f02 100644
--- a/configs/ls1046ardb_qspi_defconfig
+++ b/configs/ls1046ardb_qspi_defconfig
@@ -37,6 +37,7 @@ CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_MTD_RAW_NAND=y
 # CONFIG_SPI_FLASH_BAR is not set
+CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
diff --git a/configs/ls1046ardb_tfa_SECURE_BOOT_defconfig 
b/configs/ls1046ardb_tfa_SECURE_BOOT_defconfig
index 1dde0ae..441cee7 100644
--- a/configs/ls1046ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1046ardb_tfa_SECURE_BOOT_defconfig
@@ -34,6 +34,7 @@ CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_MTD_RAW_NAND=y
 # CONFIG_SPI_FLASH_BAR is not set
+CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
diff --git a/configs/ls1046ardb_tfa_defconfig b/configs/ls1046ardb_tfa_defconfig
index 280ca83..89f7b3f 100644
--- a/configs/ls1046ardb_tfa_defconfig
+++ b/configs/ls1046ardb_tfa_defconfig
@@ -39,6 +39,7 @@ CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_MTD_RAW_NAND=y
 # CONFIG_SPI_FLASH_BAR is not set
+CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
diff --git a/include/configs/ls1046aqds.h b/include/configs/ls1046aqds.h
index 437b6ac..8d74f32 100644
--- a/include/configs/ls1046aqds.h
+++ b/include/configs/ls1046aqds.h
@@ -41,14 +41,6 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_SPI_FLASH_EON   /* cs2 */
 #endif
 
-/* QSPI */
-#if defined(CONFIG_TFABOOT) || \
-   defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI)
-#ifdef CONFIG_FSL_QSPI
-#define CONFIG_SPI_FLASH_SPANSION
-#endif
-#endif
-
 #ifdef CONFIG_SYS_DPAA_FMAN
 #define CONFIG_PHY_VITESSE
 #define CONFIG_PHY_REALTEK
diff --git a/include/configs/ls1046ardb.h b/include/configs/ls1046ardb.h
index 61a4a40..6db48f7 100644
--- a/include/configs/ls1046ardb.h
+++ b/include

[Patch v5 4/7] configs: ls1043a: Move CONFIG_FSL_QSPI and SPI_FLASH_SPANSION to defconfig

2020-02-20 Thread Kuldeep Singh
Move CONFIG_FSL_QSPI to the board defconfigs and while at it also move
CONFIG_SPI_FLASH_SPANSION for LS1043AQDS.

Signed-off-by: Frieder Schrempf 
Signed-off-by: Kuldeep Singh 
---
v5: No change
v4: Move SPI_FLASH_SPANSION to defconfig
v3: no change
v2: No change

 configs/ls1043aqds_qspi_defconfig| 1 +
 configs/ls1043aqds_sdcard_qspi_defconfig | 1 +
 configs/ls1043aqds_tfa_SECURE_BOOT_defconfig | 2 ++
 configs/ls1043aqds_tfa_defconfig | 1 +
 include/configs/ls1043aqds.h | 8 
 5 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/configs/ls1043aqds_qspi_defconfig 
b/configs/ls1043aqds_qspi_defconfig
index 86b2eb5..859db47 100644
--- a/configs/ls1043aqds_qspi_defconfig
+++ b/configs/ls1043aqds_qspi_defconfig
@@ -40,6 +40,7 @@ CONFIG_DM_MMC=y
 CONFIG_FSL_ESDHC=y
 CONFIG_SPI_FLASH=y
 # CONFIG_SPI_FLASH_BAR is not set
+CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_PHYLIB=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
diff --git a/configs/ls1043aqds_sdcard_qspi_defconfig 
b/configs/ls1043aqds_sdcard_qspi_defconfig
index 0449469..be24948 100644
--- a/configs/ls1043aqds_sdcard_qspi_defconfig
+++ b/configs/ls1043aqds_sdcard_qspi_defconfig
@@ -54,6 +54,7 @@ CONFIG_DM_MMC=y
 CONFIG_FSL_ESDHC=y
 CONFIG_SPI_FLASH=y
 # CONFIG_SPI_FLASH_BAR is not set
+CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_PHYLIB=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
diff --git a/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig 
b/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig
index 0ece698..5075436 100644
--- a/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig
@@ -44,6 +44,7 @@ CONFIG_SYS_FLASH_CFI=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_SPI_FLASH=y
 CONFIG_SF_DEFAULT_BUS=1
+CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_PHYLIB=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
@@ -55,6 +56,7 @@ CONFIG_DM_SCSI=y
 CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
+CONFIG_FSL_QSPI=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_XHCI_HCD=y
diff --git a/configs/ls1043aqds_tfa_defconfig b/configs/ls1043aqds_tfa_defconfig
index 24db72a..1e529be 100644
--- a/configs/ls1043aqds_tfa_defconfig
+++ b/configs/ls1043aqds_tfa_defconfig
@@ -54,6 +54,7 @@ CONFIG_MTD_RAW_NAND=y
 CONFIG_SPI_FLASH=y
 CONFIG_SF_DEFAULT_BUS=1
 # CONFIG_SPI_FLASH_BAR is not set
+CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_PHYLIB=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
diff --git a/include/configs/ls1043aqds.h b/include/configs/ls1043aqds.h
index 063e724..fef5a2e 100644
--- a/include/configs/ls1043aqds.h
+++ b/include/configs/ls1043aqds.h
@@ -379,14 +379,6 @@ unsigned long get_board_ddr_clk(void);
 #define VDD_MV_MIN 819
 #define VDD_MV_MAX 1212
 
-/* QSPI device */
-#if defined(CONFIG_TFABOOT) || \
-   (defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI))
-#ifdef CONFIG_FSL_QSPI
-#define CONFIG_SPI_FLASH_SPANSION
-#endif
-#endif
-
 /*
  * Miscellaneous configurable options
  */
-- 
2.7.4



[Patch v5 3/7] treewide: Remove unused FSL QSPI config options for IMX platforms

2020-02-20 Thread Kuldeep Singh
Some of these options are not used by the driver anymore and some of them
are obsolete as the information is gathered from the dt.
So, remove the unused config options now.

Signed-off-by: Frieder Schrempf 
Signed-off-by: Ashish Kumar 
Signed-off-by: Kuldeep Singh 
---
v5: New patch. Only imx changes here from patch 2.

 include/configs/mx6sxsabreauto.h  |  6 --
 include/configs/mx6sxsabresd.h| 11 ---
 include/configs/mx6ul_14x14_evk.h |  6 --
 include/configs/mx6ullevk.h   |  6 --
 include/configs/mx7dsabresd.h |  8 
 include/configs/pcm052.h  |  7 ---
 include/configs/vf610twr.h|  8 
 7 files changed, 52 deletions(-)

diff --git a/include/configs/mx6sxsabreauto.h b/include/configs/mx6sxsabreauto.h
index 0bcf031..16a4511 100644
--- a/include/configs/mx6sxsabreauto.h
+++ b/include/configs/mx6sxsabreauto.h
@@ -145,12 +145,6 @@
 
 #define CONFIG_IMX_THERMAL
 
-#ifdef CONFIG_FSL_QSPI
-#define CONFIG_SYS_FSL_QSPI_AHB
-#define FSL_QSPI_FLASH_SIZESZ_32M
-#define FSL_QSPI_FLASH_NUM 2
-#endif
-
 #define CONFIG_SYS_FSL_USDHC_NUM   2
 #if defined(CONFIG_ENV_IS_IN_MMC)
 #define CONFIG_SYS_MMC_ENV_DEV 0  /*USDHC3*/
diff --git a/include/configs/mx6sxsabresd.h b/include/configs/mx6sxsabresd.h
index 55aace1..03816df 100644
--- a/include/configs/mx6sxsabresd.h
+++ b/include/configs/mx6sxsabresd.h
@@ -175,17 +175,6 @@
 
 #define CONFIG_IMX_THERMAL
 
-#ifdef CONFIG_FSL_QSPI
-#define CONFIG_SYS_FSL_QSPI_LE
-#define CONFIG_SYS_FSL_QSPI_AHB
-#ifdef CONFIG_MX6SX_SABRESD_REVA
-#define FSL_QSPI_FLASH_SIZESZ_16M
-#else
-#define FSL_QSPI_FLASH_SIZESZ_32M
-#endif
-#define FSL_QSPI_FLASH_NUM 2
-#endif
-
 #ifndef CONFIG_SPL_BUILD
 #ifdef CONFIG_VIDEO
 #define CONFIG_VIDEO_MXS
diff --git a/include/configs/mx6ul_14x14_evk.h 
b/include/configs/mx6ul_14x14_evk.h
index f347eeb..de6a279 100644
--- a/include/configs/mx6ul_14x14_evk.h
+++ b/include/configs/mx6ul_14x14_evk.h
@@ -157,12 +157,6 @@
 #define CONFIG_SYS_MMC_ENV_PART0   /* user area */
 #define CONFIG_MMCROOT "/dev/mmcblk1p2"  /* USDHC2 */
 
-#ifdef CONFIG_FSL_QSPI
-#define CONFIG_SYS_FSL_QSPI_AHB
-#define FSL_QSPI_FLASH_NUM 1
-#define FSL_QSPI_FLASH_SIZESZ_32M
-#endif
-
 /* USB Configs */
 #ifdef CONFIG_CMD_USB
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
diff --git a/include/configs/mx6ullevk.h b/include/configs/mx6ullevk.h
index 7cce911..425f391 100644
--- a/include/configs/mx6ullevk.h
+++ b/include/configs/mx6ullevk.h
@@ -160,10 +160,4 @@
 
 #define CONFIG_SOFT_SPI
 
-#ifdef CONFIG_FSL_QSPI
-#define CONFIG_SYS_FSL_QSPI_AHB
-#define FSL_QSPI_FLASH_NUM 1
-#define FSL_QSPI_FLASH_SIZESZ_32M
-#endif
-
 #endif
diff --git a/include/configs/mx7dsabresd.h b/include/configs/mx7dsabresd.h
index b1726b1..50a133d 100644
--- a/include/configs/mx7dsabresd.h
+++ b/include/configs/mx7dsabresd.h
@@ -154,12 +154,4 @@
 #define CONFIG_VIDEO_BMP_LOGO
 #endif
 
-#ifdef CONFIG_FSL_QSPI
-#define CONFIG_SYS_FSL_QSPI_AHB
-#define FSL_QSPI_FLASH_NUM 1
-#define FSL_QSPI_FLASH_SIZESZ_64M
-#define QSPI0_BASE_ADDRQSPI1_IPS_BASE_ADDR
-#define QSPI0_AMBA_BASEQSPI0_ARB_BASE_ADDR
-#endif
-
 #endif /* __CONFIG_H */
diff --git a/include/configs/pcm052.h b/include/configs/pcm052.h
index 72f8d08..d4d6ad2 100644
--- a/include/configs/pcm052.h
+++ b/include/configs/pcm052.h
@@ -26,13 +26,6 @@
 #define CONFIG_SYS_NAND_ONFI_DETECTION
 
 #define CONFIG_SYS_MAX_NAND_DEVICE 1
-/* QSPI Configs*/
-#ifdef CONFIG_FSL_QSPI
-#define FSL_QSPI_FLASH_SIZE(SZ_16M)
-#define FSL_QSPI_FLASH_NUM 2
-#define CONFIG_SYS_FSL_QSPI_LE
-#endif
-
 
 #define CONFIG_LOADADDR0x8200
 
diff --git a/include/configs/vf610twr.h b/include/configs/vf610twr.h
index 3ab3231..d52a5a7 100644
--- a/include/configs/vf610twr.h
+++ b/include/configs/vf610twr.h
@@ -43,14 +43,6 @@
 #define CONFIG_FEC_XCV_TYPERMII
 #define CONFIG_FEC_MXC_PHYADDR  0
 
-/* QSPI Configs*/
-
-#ifdef CONFIG_FSL_QSPI
-#define FSL_QSPI_FLASH_SIZE(1 << 24)
-#define FSL_QSPI_FLASH_NUM 2
-#define CONFIG_SYS_FSL_QSPI_LE
-#endif
-
 /* I2C Configs */
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_MXC
-- 
2.7.4



[Patch v5 0/7] Transition of fsl qspi driver to spi-mem framework

2020-02-20 Thread Kuldeep Singh
This entire patch series migrate freescale qspi driver to spi-mem
framework.

Patch 1 adds new qspi driver incorporating spi-mem framework and also
removal of old driver which was based on spi-nor. The driver is a ported
version of linux qspi driver. Initial port was done by Frieder. Now, no
more direct memory access to spi-nor memory is possible i.e accessing flash
memory using absolute address is not possible.

Patch 2 removes unused qspi config options for layerscape platforms.

Patch 3 removes unused qspi config options for imx platforms.

Patch 4 moves FSL_QSPI to defconfig instead of defining it in header files.

Patch 5 enables SPI_FLASH_SPANSION in ls1012a defconfig as FSL_QSPI is
already enabled.

Patch 6 enables SPI_FLASH_SPANSION in defconfigs of LS1046a boards instead
of defining in header files.

Patch 7 updates the device-tree properties treewide for layerscape boards
by aligning with linux device-tree properties.

v5:
-Remove compilation warning/error in patch1(qspi driver).
-Split patch 2 into 2 patches as changes will go via different tree.
-Remove imx dts change(previusly patch 4) as superseeded by Fabio's patch.

v4:
-Removal of buildman failure on LS2080AQDS
-Reword commit message of patch 5.

v3:
-Correction of copyright in qspi driver(Patch 1).
-Move SPI_FLASH_SPANSION from header to defconfig in same patch.

v2:
-Incorporate 1k size to make driver independent of flash size.
-Add support for imx platforms to set TDH bits correctly.
-Reword commit messages.

Patch[1] is required to resolve booting crash observed in LS1012ARDB. Crash
was related to pfe driver as it was accessing flash memory directly.
[1] https://patchwork.ozlabs.org/patch/1219462/

Kuldeep Singh (7):
  spi: Transform the FSL QuadSPI driver to use the SPI MEM API
  treewide: Remove unused FSL QSPI config options for Layerscape
platforms
  treewide: Remove unused FSL QSPI config options for IMX platforms
  configs: ls1043a: Move CONFIG_FSL_QSPI and SPI_FLASH_SPANSION to
defconfig
  configs: ls1012a: Enable CONFIG_SPI_FLASH_SPANSION in defconfigs
  configs: ls1046a: Move SPI_FLASH_SPANSION to defconfig
  treewide: Update fsl qspi node dt properties as per spi-mem driver

 arch/arm/dts/fsl-ls1012a-2g5rdb.dts   |5 +-
 arch/arm/dts/fsl-ls1012a-frdm.dtsi|5 +-
 arch/arm/dts/fsl-ls1012a-qds.dtsi |5 +-
 arch/arm/dts/fsl-ls1012a-rdb.dtsi |5 +-
 arch/arm/dts/fsl-ls1012a.dtsi |4 +-
 arch/arm/dts/fsl-ls1043a-qds.dtsi |5 +-
 arch/arm/dts/fsl-ls1043a.dtsi |6 +-
 arch/arm/dts/fsl-ls1046a-frwy.dts |5 +-
 arch/arm/dts/fsl-ls1046a-qds.dtsi |5 +-
 arch/arm/dts/fsl-ls1046a-rdb.dts  |5 +-
 arch/arm/dts/fsl-ls1046a.dtsi |4 +-
 arch/arm/dts/fsl-ls1088a-qds.dts  |5 +-
 arch/arm/dts/fsl-ls1088a-rdb.dts  |5 +-
 arch/arm/dts/fsl-ls1088a.dtsi |2 +-
 arch/arm/dts/fsl-ls2080a-qds.dts  |5 +-
 arch/arm/dts/fsl-ls2080a.dtsi |4 +-
 arch/arm/dts/fsl-ls2088a-rdb-qspi.dts |5 +-
 arch/arm/dts/ls1021a-twr.dtsi |5 +-
 arch/arm/dts/ls1021a.dtsi |6 +-
 arch/arm/include/asm/arch-fsl-layerscape/config.h |1 -
 arch/arm/include/asm/arch-ls102xa/config.h|1 -
 configs/ls1012a2g5rdb_qspi_defconfig  |1 +
 configs/ls1012a2g5rdb_tfa_defconfig   |1 +
 configs/ls1012afrdm_qspi_defconfig|1 +
 configs/ls1012afrdm_tfa_defconfig |1 +
 configs/ls1012aqds_qspi_defconfig |1 +
 configs/ls1012aqds_tfa_SECURE_BOOT_defconfig  |1 +
 configs/ls1012aqds_tfa_defconfig  |1 +
 configs/ls1012ardb_qspi_SECURE_BOOT_defconfig |1 +
 configs/ls1012ardb_qspi_defconfig |1 +
 configs/ls1012ardb_tfa_SECURE_BOOT_defconfig  |1 +
 configs/ls1012ardb_tfa_defconfig  |1 +
 configs/ls1043aqds_qspi_defconfig |1 +
 configs/ls1043aqds_sdcard_qspi_defconfig  |1 +
 configs/ls1043aqds_tfa_SECURE_BOOT_defconfig  |2 +
 configs/ls1043aqds_tfa_defconfig  |1 +
 configs/ls1046aqds_qspi_defconfig |1 +
 configs/ls1046aqds_sdcard_qspi_defconfig  |1 +
 configs/ls1046aqds_tfa_SECURE_BOOT_defconfig  |1 +
 configs/ls1046aqds_tfa_defconfig  |1 +
 configs/ls1046ardb_qspi_SECURE_BOOT_defconfig |1 +
 configs/ls1046ardb_qspi_defconfig |1 +
 configs/ls1046ardb_tfa_SECURE_BOOT_defconfig  |1 +
 configs/ls1046ardb_tfa_defconfig  |1 +
 drivers/spi/fsl_qspi.c| 1577 -
 drivers/spi/fsl_qspi.h|  145

RE: [EXT] Re: [Patch v4 0/7] Transition of fsl qspi driver to spi-mem framework

2020-02-20 Thread Kuldeep Singh
Hi,

> -Original Message-
> From: U-Boot  On Behalf Of Kuldeep Singh
> Sent: Tuesday, February 4, 2020 1:09 PM
> To: Jagan Teki ; U-Boot-Denx  b...@lists.denx.de>; Priyanka Jain ; Joe
> Hershberger 
> Cc: Stefan Roese 
> Subject: RE: [EXT] Re: [Patch v4 0/7] Transition of fsl qspi driver to spi-mem
> framework
> 
> Caution: EXT Email
> 
> ++Joe
> 
> Hi,
> 
> > -Original Message-
> > From: Jagan Teki 
> > Sent: Monday, January 27, 2020 3:44 PM
> > To: Schrempf Frieder ; Kuldeep Singh
> > 
> > Cc: U-Boot-Denx ; Priyanka Jain
> > ; Ashish Kumar ;
> Stefan
> > Roese ; Vignesh R 
> > Subject: Re: [EXT] Re: [Patch v4 0/7] Transition of fsl qspi driver to
> > spi-mem framework
> >
> > Caution: EXT Email
> >
> > On Mon, Jan 27, 2020 at 3:17 PM Schrempf Frieder
> >  wrote:
> > >
> > > Hi,
> > >
> > > On 27.01.20 10:20, Kuldeep Singh wrote:
> > > > Hi Jagan,
> > > >
> > > >> -Original Message-
> > > >> From: Jagan Teki 
> > > >> Sent: Monday, January 27, 2020 12:50 PM
> > > >> To: Kuldeep Singh 
> > > >> Cc: U-Boot-Denx ; Priyanka Jain
> > > >> ; Ashish Kumar ;
> > > >> Stefan Roese ; Schrempf Frieder
> > > >> ; Vignesh R 
> > > >> Subject: [EXT] Re: [Patch v4 0/7] Transition of fsl qspi driver
> > > >> to spi-mem framework
> > > >>
> > > >> Caution: EXT Email
> > > >>
> > > >> Hi Kuldeep,
> > > >>
> > > >> On Mon, Jan 13, 2020 at 12:57 PM Kuldeep Singh
> > > >> 
> > > >> wrote:
> > > >>>
> > > >>> This entire patch series migrate freescale qspi driver to
> > > >>> spi-mem framework.
> > > >>>
> > > >>> v4 version of series include removal of buildman failure on
> > > >>> LS2080AQDS build which was observed in cleanup patches. Also,
> > > >>> more clear commit message of patch 5.
> > > >>>
> > > >>> v3 version of series includes correction of copyright in qspi
> > > >>> driver and also move SPI_FLASH_SPANSION from header to
> > defconfigs
> > > >>> in same
> > > >> patch.
> > > >>>
> > > >>> v2 version of series includes changes in qspi driver to have 1k
> > > >>> size instead of complete flash size so as to make driver
> > > >>> independent of flash size. This also makes it align with linux
> > > >>> version of
> > driver.
> > > >>> Also added support for imx platforms to set TDH bits correctly.
> > > >>> There are other minor changes in commit messages.
> > > >>>
> > > >>> Dependency on patches[1][2]. These patches are required to
> > > >>> resolve booting crash observed in LS1012ARDB. One crash was
> > > >>> related to pfe driver as it was accessing flash memory directly
> > > >>> and other was based on
> > > >> environment.
> > > >>> [1]
> > > >>>
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
> > > >>> patc
> > > >>>
> > > >>
> >
> hwork.ozlabs.org%2Fpatch%2F1219462%2Fdata=02%7C01%7Ckulde
> > ep.s
> > > >> ingh
> > > >>> %40nxp.com%7C94b5e5528efc47df25ea08d7a2f94efd%7C686ea1d
> 3
> > bc2b4c6
> > > >> fa92cd9
> > > >>>
> > > >>
> >
> 9c5c301635%7C0%7C0%7C637157063972042137sdata=DZFAEmt0sA
> > 4c
> > > >> cCPmu%2F
> > > >>> cArl99B02G2KmiAUYou1RXXBI%3Dreserved=0
> > > >>> [2]
> > > >>>
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
> > > >>> patc
> > > >>>
> > > >>
> >
> hwork.ozlabs.org%2Fpatch%2F1208299%2Fdata=02%7C01%7Ckulde
> > ep.s
> > > >> ingh
> > > >>> %40nxp.com%7C94b5e5528efc47df25ea08d7a2f94efd%7C686ea1d
> 3
> > bc2b4c6
> > > >> fa92cd9
> > > >>>
> > > >>
> >
> 9c5c301635%7C0%7C0%7C637157063972042137sdata=3qr7QKERZg
> > k8
> > > >> V83QbYMM
> > > >>> Nb4xM4rUaqm2v3lZ5gzsGAQ%3Dreserved=0
> > > >>>

RE: [EXT] Re: [Patch v4 4/7] imx: imx6sx: Remove unused 'num-cs' property

2020-02-20 Thread Kuldeep Singh
Hi Fabio,

> -Original Message-
> From: Fabio Estevam 
> Sent: Wednesday, February 19, 2020 6:31 PM
> To: Priyanka Jain (OSS) 
> Cc: Kuldeep Singh ; u-boot@lists.denx.de;
> Stefano Babic ; s...@denx.de
> Subject: [EXT] Re: [Patch v4 4/7] imx: imx6sx: Remove unused 'num-cs'
> property
> 
> Caution: EXT Email
> 
> Hi Priyanka,
> 
> On Wed, Feb 19, 2020 at 7:13 AM Priyanka Jain (OSS)
>  wrote:
> 
> > Stefano/Fabio,
> >
> > Please review/ack this patch.
> 
> Last month I did a patch series to sync the imx6sx device tree files with
> upstream kernel, but thanks to your email I have just realized that I missed
> to send it to the list.
> 
> Just sent it to the list:
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.
> denx.de%2Fpipermail%2Fu-boot%2F2020-
> February%2F400727.htmldata=02%7C01%7Ckuldeep.singh%40nxp.c
> om%7C051c54e8e136406ca45d08d7b53bc31f%7C686ea1d3bc2b4c6fa92cd
> 99c5c301635%7C0%7C0%7C637177140593582319sdata=OhuEC000t
> b6rbd5LXYhM0jxfbaVbVC8%2BepA5cNx%2BdxI%3Dreserved=0
> 
> After my series gets applied this patch will no longer be needed.

Ok. I will drop this patch from series.

Thanks
Kuldeep

> 
> Regards,
> 
> Fabio Estevam


[PATCH] configs: ls1088a: Correct ENV_ADDR value

2020-02-11 Thread Kuldeep Singh
CONFIG_ENV_ADDR helps in picking environment from flash before DDR init.
QSPI region starts from 0x2000 offset.
Correct the config value i.e 0x8050 -> 0x2050.

Signed-off-by: Kuldeep Singh 
---
 configs/ls1088aqds_tfa_defconfig | 2 +-
 configs/ls1088ardb_tfa_defconfig | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configs/ls1088aqds_tfa_defconfig b/configs/ls1088aqds_tfa_defconfig
index 1144cba..dcc1d93 100644
--- a/configs/ls1088aqds_tfa_defconfig
+++ b/configs/ls1088aqds_tfa_defconfig
@@ -35,7 +35,7 @@ CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_ENV_IS_IN_NAND=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_ENV_ADDR=0x8050
+CONFIG_ENV_ADDR=0x2050
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SCSI_AHCI=y
diff --git a/configs/ls1088ardb_tfa_defconfig b/configs/ls1088ardb_tfa_defconfig
index a7908e9..a70477d 100644
--- a/configs/ls1088ardb_tfa_defconfig
+++ b/configs/ls1088ardb_tfa_defconfig
@@ -34,7 +34,7 @@ CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1088a-rdb"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_ENV_ADDR=0x8050
+CONFIG_ENV_ADDR=0x2050
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SCSI_AHCI=y
-- 
2.7.4



[PATCH] configs: ls2080a: Correct ENV_ADDR value

2020-02-11 Thread Kuldeep Singh
CONFIG_ENV_ADDR helps in picking environment from flash before DDR init.
QSPI region in LS2088ARDB and LS2088AQDS starts from 0x2000 offset.
Correct the config value i.e 0x8050 -> 0x2050.

Also, define config value as 0x2030 in qspi defconfig.

Signed-off-by: Kuldeep Singh 
---
 configs/ls2088aqds_tfa_defconfig  | 2 +-
 configs/ls2088ardb_qspi_defconfig | 1 +
 configs/ls2088ardb_tfa_defconfig  | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/configs/ls2088aqds_tfa_defconfig b/configs/ls2088aqds_tfa_defconfig
index 9f49736..4afc140 100644
--- a/configs/ls2088aqds_tfa_defconfig
+++ b/configs/ls2088aqds_tfa_defconfig
@@ -36,7 +36,7 @@ CONFIG_DEFAULT_DEVICE_TREE="fsl-ls2080a-qds"
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_ENV_ADDR=0x8050
+CONFIG_ENV_ADDR=0x2050
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
diff --git a/configs/ls2088ardb_qspi_defconfig 
b/configs/ls2088ardb_qspi_defconfig
index 1ad5f3b..fcae8a5 100644
--- a/configs/ls2088ardb_qspi_defconfig
+++ b/configs/ls2088ardb_qspi_defconfig
@@ -30,6 +30,7 @@ CONFIG_MP=y
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-ls2088a-rdb-qspi"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_ENV_ADDR=0x2030
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
diff --git a/configs/ls2088ardb_tfa_defconfig b/configs/ls2088ardb_tfa_defconfig
index ccbaaf7..783beba 100644
--- a/configs/ls2088ardb_tfa_defconfig
+++ b/configs/ls2088ardb_tfa_defconfig
@@ -37,7 +37,7 @@ CONFIG_DEFAULT_DEVICE_TREE="fsl-ls2088a-rdb-qspi"
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_ENV_ADDR=0x8050
+CONFIG_ENV_ADDR=0x2050
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
-- 
2.7.4



[PATCH] configs: ls1046a: Define ENV_ADDR value

2020-02-11 Thread Kuldeep Singh
CONFIG_ENV_ADDR helps in picking environment from flash before DDR init.
Define value 0x4030 in QSPI defconfig for LS1046ARDB as value is
already defined in TFA.

Correct ENV_ADDR and ENV_SECT_SIZE value for LS1046AQDS as per defconfig.

Signed-off-by: Kuldeep Singh 
---
 configs/ls1046aqds_qspi_defconfig | 3 ++-
 configs/ls1046aqds_tfa_defconfig  | 4 ++--
 configs/ls1046ardb_qspi_defconfig | 1 +
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/configs/ls1046aqds_qspi_defconfig 
b/configs/ls1046aqds_qspi_defconfig
index 22904a0..1f28ad5 100644
--- a/configs/ls1046aqds_qspi_defconfig
+++ b/configs/ls1046aqds_qspi_defconfig
@@ -2,7 +2,7 @@ CONFIG_ARM=y
 CONFIG_TARGET_LS1046AQDS=y
 CONFIG_SYS_TEXT_BASE=0x4010
 CONFIG_ENV_SIZE=0x2000
-CONFIG_ENV_SECT_SIZE=0x1
+CONFIG_ENV_SECT_SIZE=0x4
 CONFIG_ENV_OFFSET=0x30
 CONFIG_FSL_LS_PPA=y
 CONFIG_NR_DRAM_BANKS=2
@@ -31,6 +31,7 @@ 
CONFIG_MTDPARTS_DEFAULT="mtdparts=155.spi-0:2m(uboot),14m(free)"
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1046a-qds-duart"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_ENV_ADDR=0x4030
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
diff --git a/configs/ls1046aqds_tfa_defconfig b/configs/ls1046aqds_tfa_defconfig
index df85533..18e3993 100644
--- a/configs/ls1046aqds_tfa_defconfig
+++ b/configs/ls1046aqds_tfa_defconfig
@@ -3,7 +3,7 @@ CONFIG_TARGET_LS1046AQDS=y
 CONFIG_TFABOOT=y
 CONFIG_SYS_TEXT_BASE=0x8200
 CONFIG_ENV_SIZE=0x2000
-CONFIG_ENV_SECT_SIZE=0x2
+CONFIG_ENV_SECT_SIZE=0x4
 CONFIG_ENV_OFFSET=0x50
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y
@@ -39,7 +39,7 @@ CONFIG_ENV_IS_IN_NAND=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_USE_ENV_SPI_BUS=y
 CONFIG_ENV_SPI_BUS=0
-CONFIG_ENV_ADDR=0x6050
+CONFIG_ENV_ADDR=0x4050
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
 CONFIG_FSL_CAAM=y
diff --git a/configs/ls1046ardb_qspi_defconfig 
b/configs/ls1046ardb_qspi_defconfig
index d5e0f02..d836421 100644
--- a/configs/ls1046ardb_qspi_defconfig
+++ b/configs/ls1046ardb_qspi_defconfig
@@ -28,6 +28,7 @@ 
CONFIG_MTDPARTS_DEFAULT="mtdparts=155.spi-0:1m(rcw),15m(u-boot),48m(kernel.i
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1046a-rdb"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_ENV_ADDR=0x4030
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM=y
 CONFIG_SATA_CEVA=y
-- 
2.7.4



[Patch v2 1/3] mtd: spi-nor-ids: Enable SPI_NOR_OCTAL_READ flag for mt35xu*

2020-02-10 Thread Kuldeep Singh
Commit "658df8bd9464"(mtd: spi-nor-core: Add octal mode support) enables
octal mode(1-1-8) support in spi-nor framework.

mt35xu512aba and mt35xu02g supports SINGLE and OCTAL I/O.
Hence, enable SPI_NOR_OCTAL_READ flag for these flashes.

Signed-off-by: Kuldeep Singh 
---
v2: Reword commit message

 drivers/mtd/spi/spi-nor-ids.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi/spi-nor-ids.c b/drivers/mtd/spi/spi-nor-ids.c
index 973b6f8..334c074 100644
--- a/drivers/mtd/spi/spi-nor-ids.c
+++ b/drivers/mtd/spi/spi-nor-ids.c
@@ -182,8 +182,8 @@ const struct flash_info spi_nor_ids[] = {
{ INFO("n25q00",  0x20ba21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | 
SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
{ INFO("n25q00a", 0x20bb21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | 
SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
{ INFO("mt25qu02g",   0x20bb22, 0, 64 * 1024, 4096, SECT_4K | USE_FSR | 
SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
-   { INFO("mt35xu512aba", 0x2c5b1a, 0,  128 * 1024,  512, USE_FSR | 
SPI_NOR_4B_OPCODES) },
-   { INFO("mt35xu02g",  0x2c5b1c, 0, 128 * 1024,  2048, USE_FSR | 
SPI_NOR_4B_OPCODES) },
+   { INFO("mt35xu512aba", 0x2c5b1a, 0,  128 * 1024,  512, USE_FSR | 
SPI_NOR_OCTAL_READ | SPI_NOR_4B_OPCODES) },
+   { INFO("mt35xu02g",  0x2c5b1c, 0, 128 * 1024,  2048, USE_FSR | 
SPI_NOR_OCTAL_READ | SPI_NOR_4B_OPCODES) },
 #endif
 #ifdef CONFIG_SPI_FLASH_SPANSION   /* SPANSION */
/* Spansion/Cypress -- single (large) sector size only, at least
-- 
2.7.4



[Patch v2 3/3] arm: dts: lx2160a: Add RX, TX buswidth in qspi to use octal mode

2020-02-10 Thread Kuldeep Singh
Signed-off-by: Kuldeep Singh 
---
Depends on https://patchwork.ozlabs.org/patch/1236164/
v2:
-Add lx2160qds buswidth
-Update dependencies

 arch/arm/dts/fsl-lx2160a-qds.dts | 4 
 arch/arm/dts/fsl-lx2160a-rdb.dts | 4 
 2 files changed, 8 insertions(+)

diff --git a/arch/arm/dts/fsl-lx2160a-qds.dts b/arch/arm/dts/fsl-lx2160a-qds.dts
index cffefae..b29af20 100644
--- a/arch/arm/dts/fsl-lx2160a-qds.dts
+++ b/arch/arm/dts/fsl-lx2160a-qds.dts
@@ -36,6 +36,8 @@
compatible = "jedec,spi-nor";
spi-max-frequency = <5000>;
reg = <0>;
+   spi-rx-bus-width = <8>;
+   spi-tx-bus-width = <1>;
};
 
mt35xu512aba1: flash@1 {
@@ -44,6 +46,8 @@
compatible = "jedec,spi-nor";
spi-max-frequency = <5000>;
reg = <1>;
+   spi-rx-bus-width = <8>;
+   spi-tx-bus-width = <1>;
};
 };
 
diff --git a/arch/arm/dts/fsl-lx2160a-rdb.dts b/arch/arm/dts/fsl-lx2160a-rdb.dts
index e542c69..87617ca 100644
--- a/arch/arm/dts/fsl-lx2160a-rdb.dts
+++ b/arch/arm/dts/fsl-lx2160a-rdb.dts
@@ -39,6 +39,8 @@
compatible = "jedec,spi-nor";
spi-max-frequency = <5000>;
reg = <0>;
+   spi-rx-bus-width = <8>;
+   spi-tx-bus-width = <1>;
};
 
mt35xu512aba1: flash@1 {
@@ -47,6 +49,8 @@
compatible = "jedec,spi-nor";
spi-max-frequency = <5000>;
reg = <1>;
+   spi-rx-bus-width = <8>;
+   spi-tx-bus-width = <1>;
};
 };
 
-- 
2.7.4



[Patch v2 0/3] Enable octal read support for mt35xu* flashes

2020-02-10 Thread Kuldeep Singh
v2 version of series update dependencies of the patches and add lx2160aqds node
buswidth in patch3.
No dependency on patch1 and patch2.
Patch3 has dependency on https://patchwork.ozlabs.org/patch/1236164/.

Patch series enable octal read(1-1-8) support for LX2160ARDB and LS1028ARDB
which have mt35xu512aba and mt35xu02g flashes respectively.

mt35xu512aba and mt35xu02g flashes support SINGLE and OCTAL I/O.
Previously, 1 bit mode was used in u-boot and now use octal mode for the 
flashes.

Patch 1 enables octal read flag for flashes in framework.
Patch 2/3 adds RX,TX buswidth in qspi dts entries to use octal mode for
LS1028ARDB/QDS, LX2160ARDB/QDS.

Kuldeep Singh (3):
  mtd: spi-nor-ids: Enable SPI_NOR_OCTAL_READ flag for mt35xu*
  arm: dts: ls1028a: Add RX,TX buswidth in qspi to use octal mode
  arm: dts: lx2160a: Add RX,TX buswidth in qspi to use octal mode

 arch/arm/dts/fsl-ls1028a-qds.dts | 2 ++
 arch/arm/dts/fsl-ls1028a-rdb.dts | 2 ++
 arch/arm/dts/fsl-lx2160a-qds.dts | 4 
 arch/arm/dts/fsl-lx2160a-rdb.dts | 4 
 drivers/mtd/spi/spi-nor-ids.c| 4 ++--
 5 files changed, 14 insertions(+), 2 deletions(-)

-- 
2.7.4



[Patch v2 2/3] arm: dts: ls1028a: Add RX, TX buswidth in qspi to use octal mode

2020-02-10 Thread Kuldeep Singh
Signed-off-by: Kuldeep Singh 
---
v2: No change

 arch/arm/dts/fsl-ls1028a-qds.dts | 2 ++
 arch/arm/dts/fsl-ls1028a-rdb.dts | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/arch/arm/dts/fsl-ls1028a-qds.dts b/arch/arm/dts/fsl-ls1028a-qds.dts
index 3fd37be..029a8e3 100644
--- a/arch/arm/dts/fsl-ls1028a-qds.dts
+++ b/arch/arm/dts/fsl-ls1028a-qds.dts
@@ -49,6 +49,8 @@
compatible = "jedec,spi-nor";
spi-max-frequency = <5000>;
reg = <0>;
+   spi-rx-bus-width = <8>;
+   spi-tx-bus-width = <1>;
};
 };
 
diff --git a/arch/arm/dts/fsl-ls1028a-rdb.dts b/arch/arm/dts/fsl-ls1028a-rdb.dts
index a8f4085..85b4815 100644
--- a/arch/arm/dts/fsl-ls1028a-rdb.dts
+++ b/arch/arm/dts/fsl-ls1028a-rdb.dts
@@ -48,6 +48,8 @@
compatible = "jedec,spi-nor";
spi-max-frequency = <5000>;
reg = <0>;
+   spi-rx-bus-width = <8>;
+   spi-tx-bus-width = <1>;
};
 };
 
-- 
2.7.4



[PATCH] arm: dts: lx2160aqds: Enable FSPI node properties

2020-02-10 Thread Kuldeep Singh
Align flexspi node properties with linux device-tree properties.

Signed-off-by: Kuldeep Singh 
---
 arch/arm/dts/fsl-lx2160a-qds.dts | 24 
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/dts/fsl-lx2160a-qds.dts b/arch/arm/dts/fsl-lx2160a-qds.dts
index 34df0f5..cffefae 100644
--- a/arch/arm/dts/fsl-lx2160a-qds.dts
+++ b/arch/arm/dts/fsl-lx2160a-qds.dts
@@ -13,6 +13,10 @@
 / {
model = "NXP Layerscape LX2160AQDS Board";
compatible = "fsl,lx2160aqds", "fsl,lx2160a";
+
+   aliases {
+   spi0 = 
+   };
 };
 
  {
@@ -23,6 +27,26 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+
+   mt35xu512aba0: flash@0 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "jedec,spi-nor";
+   spi-max-frequency = <5000>;
+   reg = <0>;
+   };
+
+   mt35xu512aba1: flash@1 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "jedec,spi-nor";
+   spi-max-frequency = <5000>;
+   reg = <1>;
+   };
+};
+
  {
status = "okay";
u-boot,dm-pre-reloc;
-- 
2.7.4



[Patch v2 1/2] configs: ls2080ardb: Make MC_INIT access flash memory as per spi-mem

2020-02-09 Thread Kuldeep Singh
MC_INIT command currently access spi-nor flash memory directly. As per
spi-mem framework, flash memory access via absolute addresses is no more
possible. Use flash APIs to access memory instead of directly using it.

Signed-off-by: Kuldeep Singh 
---
v2:
-Rebase to top
-reword commit message

 include/configs/ls2080ardb.h | 28 ++--
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/include/configs/ls2080ardb.h b/include/configs/ls2080ardb.h
index a35bb0f..7a8168b 100644
--- a/include/configs/ls2080ardb.h
+++ b/include/configs/ls2080ardb.h
@@ -317,11 +317,15 @@ unsigned long get_board_sys_clk(void);
 #include 
 
 #ifdef CONFIG_TFABOOT
-#define QSPI_MC_INIT_CMD   \
-   "env exists secureboot && " \
-   "esbc_validate 0x2064 && "  \
-   "esbc_validate 0x2068;" \
-   "fsl_mc start mc 0x20a0 0x20e0 \0"
+#define QSPI_MC_INIT_CMD   \
+   "sf probe 0:0;sf read 0x80a0 0xa0 0x10;"\
+   " sf read 0x80e0 0xe0 0x10; "   \
+   "env exists secureboot && " \
+   "sf read 0x8064 0x64 0x4 && "   \
+   "esbc_validate 0x8064 && "  \
+   "sf read 0x8068 0x68 0x4 && "   \
+   "esbc_validate 0x8068; "\
+   "fsl_mc start mc 0x80a0 0x80e0 \0"
 #define SD_MC_INIT_CMD \
"mmcinfo;mmc read 0x80a0 0x5000 0x1200;" \
"mmc read 0x80e0 0x7000 0x800;" \
@@ -338,11 +342,15 @@ unsigned long get_board_sys_clk(void);
"fsl_mc start mc 0x580a0 0x580e0 \0"
 #else
 #ifdef CONFIG_QSPI_BOOT
-#define MC_INIT_CMD\
-   "mcinitcmd=env exists secureboot && "   \
-   "esbc_validate 0x2064 && "  \
-   "esbc_validate 0x2068;" \
-   "fsl_mc start mc 0x20a0 0x20e0 \0"
+#define MC_INIT_CMD\
+   "mcinitcmd=sf probe 0:0;sf read 0x80a0 0xa0 0x10; " \
+   " sf read 0x80e0 0xe0 0x10; "   \
+   "env exists secureboot && " \
+   "sf read 0x8064 0x64 0x4 && "   \
+   "sf read 0x8068 0x68 0x4 && "   \
+   "esbc_validate 0x8064 && "  \
+   "esbc_validate 0x8068;" \
+   "fsl_mc start mc 0x80a0 0x80e0 \0"
 #elif defined(CONFIG_SD_BOOT)
 #define MC_INIT_CMD \
"mcinitcmd=mmcinfo;mmc read 0x8000 0x5000 0x800;" \
-- 
2.7.4



[Patch v2 2/2] configs: ls2080ardb: Make BOOT command access flash memory as per spi-mem

2020-02-09 Thread Kuldeep Singh
BOOT command currently access spi-nor flash memory directly. As per spi-mem
framework, flash memory access via absolute addresses is no more possible.
Use flash APIs to access memory instead of directly using it.

Signed-off-by: Kuldeep Singh 
---
v2:
-Rebase to top
-Reword commit message

 include/configs/ls2080ardb.h | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/include/configs/ls2080ardb.h b/include/configs/ls2080ardb.h
index 7a8168b..eae753d 100644
--- a/include/configs/ls2080ardb.h
+++ b/include/configs/ls2080ardb.h
@@ -505,9 +505,11 @@ unsigned long get_board_sys_clk(void);
 #ifdef CONFIG_TFABOOT
 #define QSPI_NOR_BOOTCOMMAND   \
"env exists mcinitcmd && env exists secureboot "\
-   "&& esbc_validate 0x206C; " \
+   "&& sf read 0x806c 0x6c 0x4 "   \
+   "&& esbc_validate 0x806C; " \
"env exists mcinitcmd && "  \
-   "fsl_mc lazyapply dpl 0x20d0; " \
+   "sf read 0x80d0 0xd0 0x10; "\
+   "fsl_mc lazyapply dpl 0x80d0; " \
"run distro_bootcmd;run qspi_bootcmd; " \
"env exists secureboot && esbc_halt;"
 
@@ -535,9 +537,11 @@ unsigned long get_board_sys_clk(void);
 /* Try to boot an on-QSPI kernel first, then do normal distro boot */
 #define CONFIG_BOOTCOMMAND \
"env exists mcinitcmd && env exists secureboot "\
-   "&& esbc_validate 0x206C; " \
+   "&& sf read 0x806c 0x6c 0x4 "   \
+   "&& esbc_validate 0x806C; " \
"env exists mcinitcmd && "  \
-   "fsl_mc lazyapply dpl 0x20d0; " \
+   "sf read 0x80d0 0xd0 0x10 && "  \
+   "fsl_mc lazyapply dpl 0x80d0; " \
"run distro_bootcmd;run qspi_bootcmd; " \
"env exists secureboot && esbc_halt;"
 #elif defined(CONFIG_SD_BOOT)
-- 
2.7.4



  1   2   >