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

2020-06-22 Thread Priyanka Jain



>-Original Message-
>From: Kuldeep Singh 
>Sent: Monday, June 22, 2020 11:00 AM
>To: Priyanka Jain 
>Cc: Joe Hershberger ; u-boot@lists.denx.de;
>Schrempf Frieder ; Tom Rini
>
>Subject: RE: [EXT] Re: [RESEND][Patch v4] net: pfe_eth: Use spi_flash_read API
>to access flash memory
>
>
>> -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.
I will take care of this.

Thanks
Priyanka


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 Tom Rini
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!

-- 
Tom


signature.asc
Description: PGP signature


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

2020-06-19 Thread Priyanka Jain
>-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.

Regards
Priyanka


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


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

2020-05-28 Thread Schrempf Frieder
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.

> ---
> 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_ADDR 0x400d
> +#define CONFIG_SYS_QE_FMAN_FW_LENGTH 0x30
> +
> +/*SPI device */
>   #define CONFIG_SYS_FSL_QSPI_BASE0x4000
>   
>   /* SATA */
> 

[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


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

2020-05-12 Thread Priyanka Jain (OSS)

>-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 
>> >
>>
>> ping. this already has reviewed-by tag.
>> Please let me know if there's any dependency on my side.
>>
>> Thanks
>> Kuldeep

Joe,

Can you please pick this patch or provide Acked-by so that I can apply this in.
 
Thanks
Priyanka


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


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

2020-01-22 Thread Kuldeep Singh
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

> > ---
> > v4:
> > -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 e4563f1..27ae8ae 100644
> > --- a/drivers/net/pfe_eth/pfe_firmware.c
> > +++ b/drivers/net/pfe_eth/pfe_firmware.c
> > @@ -12,13 +12,14 @@
> >
> >   #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.
> > @@ -159,6 +160,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.
> > @@ -183,6 +222,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 2579e2f..cbc5bff 100644
> > --- a/include/configs/ls1012a_common.h
> > +++ b/include/configs/ls1012a_common.h
> > @@ -36,9 +36,12 @@
> >   /* Size of malloc() pool */
> >   #define CONFIG_SYS_MALLOC_LEN   (CONFIG_ENV_SIZE + 128 *
> 1024)
> >
> > +/* PFE */
> > +#define CONFIG_SYS_FMAN_FW_ADDR  0x400d
> > +#define CONFIG_SYS_QE_FMAN_FW_LENGTH 0x1
> > +
> >   /*SPI device */
> >   #if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_TFABOOT)
> > -#define CONFIG_SYS_FMAN_FW_ADDR  0x400d
> >   #define CONFIG_SPI_FLASH_SPANSION
> >   #define CONFIG_FSL_SPI_INTERFACE
> >   #define CONFIG_SF_DATAFLASH
> >


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

2020-01-13 Thread Schrempf Frieder
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 

> ---
> v4:
> -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 e4563f1..27ae8ae 100644
> --- a/drivers/net/pfe_eth/pfe_firmware.c
> +++ b/drivers/net/pfe_eth/pfe_firmware.c
> @@ -12,13 +12,14 @@
>   
>   #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.
> @@ -159,6 +160,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.
> @@ -183,6 +222,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 2579e2f..cbc5bff 100644
> --- a/include/configs/ls1012a_common.h
> +++ b/include/configs/ls1012a_common.h
> @@ -36,9 +36,12 @@
>   /* Size of malloc() pool */
>   #define CONFIG_SYS_MALLOC_LEN   (CONFIG_ENV_SIZE + 128 * 1024)
>   
> +/* PFE */
> +#define CONFIG_SYS_FMAN_FW_ADDR  0x400d
> +#define CONFIG_SYS_QE_FMAN_FW_LENGTH 0x1
> +
>   /*SPI device */
>   #if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_TFABOOT)
> -#define CONFIG_SYS_FMAN_FW_ADDR  0x400d
>   #define CONFIG_SPI_FLASH_SPANSION
>   #define CONFIG_FSL_SPI_INTERFACE
>   #define CONFIG_SF_DATAFLASH
> 

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

2020-01-13 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 
---
v4:
-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 e4563f1..27ae8ae 100644
--- a/drivers/net/pfe_eth/pfe_firmware.c
+++ b/drivers/net/pfe_eth/pfe_firmware.c
@@ -12,13 +12,14 @@
 
 #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.
@@ -159,6 +160,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.
@@ -183,6 +222,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 2579e2f..cbc5bff 100644
--- a/include/configs/ls1012a_common.h
+++ b/include/configs/ls1012a_common.h
@@ -36,9 +36,12 @@
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + 128 * 1024)
 
+/* PFE */
+#define CONFIG_SYS_FMAN_FW_ADDR0x400d
+#define CONFIG_SYS_QE_FMAN_FW_LENGTH   0x1
+
 /*SPI device */
 #if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_TFABOOT)
-#define CONFIG_SYS_FMAN_FW_ADDR0x400d
 #define CONFIG_SPI_FLASH_SPANSION
 #define CONFIG_FSL_SPI_INTERFACE
 #define CONFIG_SF_DATAFLASH
-- 
2.7.4