Re: [U-Boot] [PATCH v5 1/7] ls2080: Exit dpaa only right before exiting U-Boot

2016-10-18 Thread york sun
On 10/17/2016 04:45 AM, Alexander Graf wrote:
>
>
> On 10/17/2016 10:56 AM, Prabhakar Kushwaha wrote:
>>> -Original Message-
>>> From: Alexander Graf [mailto:ag...@suse.de]
>>> Sent: Monday, October 17, 2016 12:28 PM
>>> To: Prabhakar Kushwaha ; u-
>>> b...@lists.denx.de
>>> Cc: york sun 
>>> Subject: Re: [PATCH v5 1/7] ls2080: Exit dpaa only right before exiting 
>>> U-Boot
>>>
>>> Hi Prabhakara,
>>>
>>> On 17.10.16 05:42, Prabhakar Kushwaha wrote:
 Hi Alex,

> -Original Message-
> From: Alexander Graf [mailto:ag...@suse.de]
> Sent: Saturday, October 15, 2016 3:33 PM
> To: u-boot@lists.denx.de
> Cc: york sun ; Prabhakar Kushwaha
> 
> Subject: [PATCH v5 1/7] ls2080: Exit dpaa only right before exiting U-Boot
>
> On ls2080 we have a separate network fabric component which we need to
> shut down before we enter Linux (or any other OS). Along with that also
> comes configuration of the fabric using a description file.
>
> Today we always stop and configure the fabric in the boot script and
> (again) exit it on device tree generation. This works ok for the normal
> booti case, but with bootefi the payload we're running may still want to
> access the network.
>
> So let's add a new fsl_mc command that defers configuration and stopping
> the hardware to when we actually exit U-Boot, so that we can still use
> the fabric from an EFI payload.
>
> For existing boot scripts, nothing should change with this patch.
>
> Signed-off-by: Alexander Graf 
>
 Can we get one small modification in this patch to include env variable.
 So if a user **always** want " lazyapply", this info can be stored in env
>>> variable. This env variable will be used after reset without explicit u-boot
>>> command.
>>>
>>> I'm not sure I understand your suggestion. We use "lazyapply" because
>>> EFI payloads need to be able to use the fabric for network I/O which is
>>> impossible after a normal apply.
>>>
>>> Because we don't know in bootcmd whether we will end up in the old bootm
>>> path or in the fallback distro path (which again potentially means
>>> efi_loader), we have to play safe (lazyapply) by default.
>>>
>> If I understand correctly, this patch defines a variable mc_lazy_dpl_addr.  
>> It is set via " fsl_mc lazyapply DPL" u-boot command.
>> If this variable set
>>- Apply DPL file during bootm (no user intervention)
>> Else
>>   - Assume user to apply dpl manually by " fsl_mc apply DPL" before running 
>> bootm.
>>
>> One modification can be done to store value mc_lazy_dpl_addr in env so that 
>> " fsl_mc lazyapply DPL " will not be required to run after every reset.
>
> Ah, I see what you're getting at. I like the idea, but I'm not sure this
> is what users would expect. So imagine you do
>
># fsl_mc lazyapply ...
># 
># # saveenv
>
> then suddenly you have the lazyapply in your environment. In *most*
> parts of U-Boot environment variables are not used for state transfer
> (one function sets it, another one reads it). So having it here would be
> pretty unnatural and potentially confusing to users.
>
> I'd leave the decision up to York though, it's his command :). Changing
> it to be env based instead is trivial.
>
Prabhakar,

I believe you are trying to address another related issue for applying 
DPL. Please submit a patch on top of Alex's. You can wait a little bit 
after his set is settled.

York

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 1/7] ls2080: Exit dpaa only right before exiting U-Boot

2016-10-17 Thread Prabhakar Kushwaha

> -Original Message-
> From: Alexander Graf [mailto:ag...@suse.de]
> Sent: Monday, October 17, 2016 12:28 PM
> To: Prabhakar Kushwaha ; u-
> b...@lists.denx.de
> Cc: york sun 
> Subject: Re: [PATCH v5 1/7] ls2080: Exit dpaa only right before exiting U-Boot
> 
> Hi Prabhakara,
> 
> On 17.10.16 05:42, Prabhakar Kushwaha wrote:
> > Hi Alex,
> >
> >> -Original Message-
> >> From: Alexander Graf [mailto:ag...@suse.de]
> >> Sent: Saturday, October 15, 2016 3:33 PM
> >> To: u-boot@lists.denx.de
> >> Cc: york sun ; Prabhakar Kushwaha
> >> 
> >> Subject: [PATCH v5 1/7] ls2080: Exit dpaa only right before exiting U-Boot
> >>
> >> On ls2080 we have a separate network fabric component which we need to
> >> shut down before we enter Linux (or any other OS). Along with that also
> >> comes configuration of the fabric using a description file.
> >>
> >> Today we always stop and configure the fabric in the boot script and
> >> (again) exit it on device tree generation. This works ok for the normal
> >> booti case, but with bootefi the payload we're running may still want to
> >> access the network.
> >>
> >> So let's add a new fsl_mc command that defers configuration and stopping
> >> the hardware to when we actually exit U-Boot, so that we can still use
> >> the fabric from an EFI payload.
> >>
> >> For existing boot scripts, nothing should change with this patch.
> >>
> >> Signed-off-by: Alexander Graf 
> >>
> >
> > Can we get one small modification in this patch to include env variable.
> > So if a user **always** want " lazyapply", this info can be stored in env
> variable. This env variable will be used after reset without explicit u-boot
> command.
> 
> I'm not sure I understand your suggestion. We use "lazyapply" because
> EFI payloads need to be able to use the fabric for network I/O which is
> impossible after a normal apply.
> 
> Because we don't know in bootcmd whether we will end up in the old bootm
> path or in the fallback distro path (which again potentially means
> efi_loader), we have to play safe (lazyapply) by default.
> 
If I understand correctly, this patch defines a variable mc_lazy_dpl_addr.  It 
is set via " fsl_mc lazyapply DPL" u-boot command. 
If this variable set
  - Apply DPL file during bootm (no user intervention)
Else
 - Assume user to apply dpl manually by " fsl_mc apply DPL" before running 
bootm.

One modification can be done to store value mc_lazy_dpl_addr in env so that " 
fsl_mc lazyapply DPL " will not be required to run after every reset.

--prabhakar

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 1/7] ls2080: Exit dpaa only right before exiting U-Boot

2016-10-17 Thread Alexander Graf



On 10/17/2016 10:56 AM, Prabhakar Kushwaha wrote:

-Original Message-
From: Alexander Graf [mailto:ag...@suse.de]
Sent: Monday, October 17, 2016 12:28 PM
To: Prabhakar Kushwaha ; u-
b...@lists.denx.de
Cc: york sun 
Subject: Re: [PATCH v5 1/7] ls2080: Exit dpaa only right before exiting U-Boot

Hi Prabhakara,

On 17.10.16 05:42, Prabhakar Kushwaha wrote:

Hi Alex,


-Original Message-
From: Alexander Graf [mailto:ag...@suse.de]
Sent: Saturday, October 15, 2016 3:33 PM
To: u-boot@lists.denx.de
Cc: york sun ; Prabhakar Kushwaha

Subject: [PATCH v5 1/7] ls2080: Exit dpaa only right before exiting U-Boot

On ls2080 we have a separate network fabric component which we need to
shut down before we enter Linux (or any other OS). Along with that also
comes configuration of the fabric using a description file.

Today we always stop and configure the fabric in the boot script and
(again) exit it on device tree generation. This works ok for the normal
booti case, but with bootefi the payload we're running may still want to
access the network.

So let's add a new fsl_mc command that defers configuration and stopping
the hardware to when we actually exit U-Boot, so that we can still use
the fabric from an EFI payload.

For existing boot scripts, nothing should change with this patch.

Signed-off-by: Alexander Graf 


Can we get one small modification in this patch to include env variable.
So if a user **always** want " lazyapply", this info can be stored in env

variable. This env variable will be used after reset without explicit u-boot
command.

I'm not sure I understand your suggestion. We use "lazyapply" because
EFI payloads need to be able to use the fabric for network I/O which is
impossible after a normal apply.

Because we don't know in bootcmd whether we will end up in the old bootm
path or in the fallback distro path (which again potentially means
efi_loader), we have to play safe (lazyapply) by default.


If I understand correctly, this patch defines a variable mc_lazy_dpl_addr.  It is set via 
" fsl_mc lazyapply DPL" u-boot command.
If this variable set
   - Apply DPL file during bootm (no user intervention)
Else
  - Assume user to apply dpl manually by " fsl_mc apply DPL" before running 
bootm.

One modification can be done to store value mc_lazy_dpl_addr in env so that " fsl_mc 
lazyapply DPL " will not be required to run after every reset.


Ah, I see what you're getting at. I like the idea, but I'm not sure this 
is what users would expect. So imagine you do


  # fsl_mc lazyapply ...
  # 
  # then suddenly you have the lazyapply in your environment. In *most* 
parts of U-Boot environment variables are not used for state transfer 
(one function sets it, another one reads it). So having it here would be 
pretty unnatural and potentially confusing to users.


I'd leave the decision up to York though, it's his command :). Changing 
it to be env based instead is trivial.



Alex

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 1/7] ls2080: Exit dpaa only right before exiting U-Boot

2016-10-17 Thread Alexander Graf
Hi Prabhakara,

On 17.10.16 05:42, Prabhakar Kushwaha wrote:
> Hi Alex,
> 
>> -Original Message-
>> From: Alexander Graf [mailto:ag...@suse.de]
>> Sent: Saturday, October 15, 2016 3:33 PM
>> To: u-boot@lists.denx.de
>> Cc: york sun ; Prabhakar Kushwaha
>> 
>> Subject: [PATCH v5 1/7] ls2080: Exit dpaa only right before exiting U-Boot
>>
>> On ls2080 we have a separate network fabric component which we need to
>> shut down before we enter Linux (or any other OS). Along with that also
>> comes configuration of the fabric using a description file.
>>
>> Today we always stop and configure the fabric in the boot script and
>> (again) exit it on device tree generation. This works ok for the normal
>> booti case, but with bootefi the payload we're running may still want to
>> access the network.
>>
>> So let's add a new fsl_mc command that defers configuration and stopping
>> the hardware to when we actually exit U-Boot, so that we can still use
>> the fabric from an EFI payload.
>>
>> For existing boot scripts, nothing should change with this patch.
>>
>> Signed-off-by: Alexander Graf 
>>
> 
> Can we get one small modification in this patch to include env variable.
> So if a user **always** want " lazyapply", this info can be stored in env 
> variable. This env variable will be used after reset without explicit u-boot 
> command.

I'm not sure I understand your suggestion. We use "lazyapply" because
EFI payloads need to be able to use the fabric for network I/O which is
impossible after a normal apply.

Because we don't know in bootcmd whether we will end up in the old bootm
path or in the fallback distro path (which again potentially means
efi_loader), we have to play safe (lazyapply) by default.


Alex
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 1/7] ls2080: Exit dpaa only right before exiting U-Boot

2016-10-16 Thread Prabhakar Kushwaha
Hi Alex,

> -Original Message-
> From: Alexander Graf [mailto:ag...@suse.de]
> Sent: Saturday, October 15, 2016 3:33 PM
> To: u-boot@lists.denx.de
> Cc: york sun ; Prabhakar Kushwaha
> 
> Subject: [PATCH v5 1/7] ls2080: Exit dpaa only right before exiting U-Boot
> 
> On ls2080 we have a separate network fabric component which we need to
> shut down before we enter Linux (or any other OS). Along with that also
> comes configuration of the fabric using a description file.
> 
> Today we always stop and configure the fabric in the boot script and
> (again) exit it on device tree generation. This works ok for the normal
> booti case, but with bootefi the payload we're running may still want to
> access the network.
> 
> So let's add a new fsl_mc command that defers configuration and stopping
> the hardware to when we actually exit U-Boot, so that we can still use
> the fabric from an EFI payload.
> 
> For existing boot scripts, nothing should change with this patch.
> 
> Signed-off-by: Alexander Graf 
> 

Can we get one small modification in this patch to include env variable.
So if a user **always** want " lazyapply", this info can be stored in env 
variable. This env variable will be used after reset without explicit u-boot 
command.

--prabhakara

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 1/7] ls2080: Exit dpaa only right before exiting U-Boot

2016-10-15 Thread york sun
On 10/15/2016 03:03 AM, Alexander Graf wrote:
> On ls2080 we have a separate network fabric component which we need to
> shut down before we enter Linux (or any other OS). Along with that also
> comes configuration of the fabric using a description file.
>
> Today we always stop and configure the fabric in the boot script and
> (again) exit it on device tree generation. This works ok for the normal
> booti case, but with bootefi the payload we're running may still want to
> access the network.
>
> So let's add a new fsl_mc command that defers configuration and stopping
> the hardware to when we actually exit U-Boot, so that we can still use
> the fabric from an EFI payload.
>
> For existing boot scripts, nothing should change with this patch.
>
> Signed-off-by: Alexander Graf 
>
> ---
>
> v3 -> v4:
>
>   - Move code into generic quiesce weak function
>   - Exit device for real when going to Linux
>   - Only apply DPL if we have something to apply
> ---
>  arch/arm/include/asm/u-boot-arm.h   |  1 +
>  arch/arm/lib/bootm.c|  7 +++
>  board/freescale/ls2080a/ls2080a.c   |  6 +-
>  board/freescale/ls2080aqds/ls2080aqds.c | 11 +--
>  board/freescale/ls2080ardb/ls2080ardb.c | 11 +--
>  drivers/net/fsl-mc/mc.c | 24 ++--
>  lib/efi_loader/efi_boottime.c   |  2 ++
>  7 files changed, 47 insertions(+), 15 deletions(-)

Reviewed-by: York Sun 

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v5 1/7] ls2080: Exit dpaa only right before exiting U-Boot

2016-10-15 Thread Alexander Graf
On ls2080 we have a separate network fabric component which we need to
shut down before we enter Linux (or any other OS). Along with that also
comes configuration of the fabric using a description file.

Today we always stop and configure the fabric in the boot script and
(again) exit it on device tree generation. This works ok for the normal
booti case, but with bootefi the payload we're running may still want to
access the network.

So let's add a new fsl_mc command that defers configuration and stopping
the hardware to when we actually exit U-Boot, so that we can still use
the fabric from an EFI payload.

For existing boot scripts, nothing should change with this patch.

Signed-off-by: Alexander Graf 

---

v3 -> v4:

  - Move code into generic quiesce weak function
  - Exit device for real when going to Linux
  - Only apply DPL if we have something to apply
---
 arch/arm/include/asm/u-boot-arm.h   |  1 +
 arch/arm/lib/bootm.c|  7 +++
 board/freescale/ls2080a/ls2080a.c   |  6 +-
 board/freescale/ls2080aqds/ls2080aqds.c | 11 +--
 board/freescale/ls2080ardb/ls2080ardb.c | 11 +--
 drivers/net/fsl-mc/mc.c | 24 ++--
 lib/efi_loader/efi_boottime.c   |  2 ++
 7 files changed, 47 insertions(+), 15 deletions(-)

diff --git a/arch/arm/include/asm/u-boot-arm.h 
b/arch/arm/include/asm/u-boot-arm.h
index 414042d..023daf5 100644
--- a/arch/arm/include/asm/u-boot-arm.h
+++ b/arch/arm/include/asm/u-boot-arm.h
@@ -37,6 +37,7 @@ int   arch_early_init_r(void);
 /* board/.../... */
 intboard_init(void);
 void   dram_init_banksize (void);
+voidboard_quiesce_devices(void);
 
 /* cpu/.../interrupt.c */
 intarch_interrupt_init (void);
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 53c3141..dedcd1e 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -64,6 +64,10 @@ void arch_lmb_reserve(struct lmb *lmb)
gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size - sp);
 }
 
+__weak void board_quiesce_devices(void)
+{
+}
+
 /**
  * announce_and_cleanup() - Print message and prepare for kernel boot
  *
@@ -84,6 +88,9 @@ static void announce_and_cleanup(int fake)
 #ifdef CONFIG_USB_DEVICE
udc_disconnect();
 #endif
+
+   board_quiesce_devices();
+
cleanup_before_linux();
 }
 
diff --git a/board/freescale/ls2080a/ls2080a.c 
b/board/freescale/ls2080a/ls2080a.c
index d0a88d4..4f9b9c8 100644
--- a/board/freescale/ls2080a/ls2080a.c
+++ b/board/freescale/ls2080a/ls2080a.c
@@ -102,6 +102,11 @@ void fdt_fixup_board_enet(void *fdt)
else
fdt_status_fail(fdt, offset);
 }
+
+void board_quiesce_devices(void)
+{
+   fsl_mc_ldpaa_exit(gd->bd);
+}
 #endif
 
 #ifdef CONFIG_OF_BOARD_SETUP
@@ -122,7 +127,6 @@ int ft_board_setup(void *blob, bd_t *bd)
 
 #ifdef CONFIG_FSL_MC_ENET
fdt_fixup_board_enet(blob);
-   fsl_mc_ldpaa_exit(bd);
 #endif
 
return 0;
diff --git a/board/freescale/ls2080aqds/ls2080aqds.c 
b/board/freescale/ls2080aqds/ls2080aqds.c
index d07ca18..73a61fd 100644
--- a/board/freescale/ls2080aqds/ls2080aqds.c
+++ b/board/freescale/ls2080aqds/ls2080aqds.c
@@ -292,14 +292,16 @@ void fdt_fixup_board_enet(void *fdt)
else
fdt_status_fail(fdt, offset);
 }
+
+void board_quiesce_devices(void)
+{
+   fsl_mc_ldpaa_exit(gd->bd);
+}
 #endif
 
 #ifdef CONFIG_OF_BOARD_SETUP
 int ft_board_setup(void *blob, bd_t *bd)
 {
-#ifdef CONFIG_FSL_MC_ENET
-   int err;
-#endif
u64 base[CONFIG_NR_DRAM_BANKS];
u64 size[CONFIG_NR_DRAM_BANKS];
 
@@ -317,9 +319,6 @@ int ft_board_setup(void *blob, bd_t *bd)
 
 #ifdef CONFIG_FSL_MC_ENET
fdt_fixup_board_enet(blob);
-   err = fsl_mc_ldpaa_exit(bd);
-   if (err)
-   return err;
 #endif
 
return 0;
diff --git a/board/freescale/ls2080ardb/ls2080ardb.c 
b/board/freescale/ls2080ardb/ls2080ardb.c
index 83d9e7e..fab44b9 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -256,14 +256,16 @@ void fdt_fixup_board_enet(void *fdt)
else
fdt_status_fail(fdt, offset);
 }
+
+void board_quiesce_devices(void)
+{
+   fsl_mc_ldpaa_exit(gd->bd);
+}
 #endif
 
 #ifdef CONFIG_OF_BOARD_SETUP
 int ft_board_setup(void *blob, bd_t *bd)
 {
-#ifdef CONFIG_FSL_MC_ENET
-   int err;
-#endif
u64 base[CONFIG_NR_DRAM_BANKS];
u64 size[CONFIG_NR_DRAM_BANKS];
 
@@ -281,9 +283,6 @@ int ft_board_setup(void *blob, bd_t *bd)
 
 #ifdef CONFIG_FSL_MC_ENET
fdt_fixup_board_enet(blob);
-   err = fsl_mc_ldpaa_exit(bd);
-   if (err)
-   return err;
 #endif
 
return 0;
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index 1811b0f..46b8a6b 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -40,6 +40,7 @@ int child_dprc_id;
 struct fsl_dpbp_obj *dflt_dpbp = NULL;
 struct fsl_dpio_obj *dflt_dpio =