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

2016-06-20 Thread Alexander Graf


On 07.06.16 03:28, Prabhakar Kushwaha wrote:
> Hi Alex,
> 
>> -Original Message-
>> From: Alexander Graf [mailto:ag...@suse.de]
>> Sent: Friday, May 27, 2016 7:58 PM
>> To: Prabhakar Kushwaha <prabhakar.kushw...@nxp.com>; u-
>> b...@lists.denx.de
>> Cc: york sun <york@nxp.com>
>> Subject: Re: [U-Boot] [PATCH 1/5] ls2080: Exit dpaa only right before exiting
>> U-Boot
>>
>> On 05/18/2016 02:29 PM, Prabhakar Kushwaha wrote:
>>>> -Original Message-
>>>> From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of
>>>> Alexander Graf
>>>> Sent: Friday, May 13, 2016 5:52 PM
>>>> To: u-boot@lists.denx.de
>>>> Subject: [U-Boot] [PATCH 1/5] 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 <ag...@suse.de>
>>> With this patch.
>>>
>>> If I does not apply MC,  I am getting following crash:-
>>>
>>> Starting kernel ...
>>>
>>> "Synchronous Abort" handler, esr 0x9644
>>
>> So should we consider it a bug fix or regression then? :)
>>
>>
> 
> Are you planning to fix it?
> 
> If not let me know I will try to  work on it. 

Sorry, wrong fix. Please try this one instead.

Alex


diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 95037c1..c5e6bbd 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -91,7 +91,7 @@ static void announce_and_cleanup(int fake)
 #endif

 #ifdef CONFIG_FSL_MC_ENET
-   if (!fsl_mc_ldpaa_exit(NULL))
+   if (mc_lazy_dpl_addr && !fsl_mc_ldpaa_exit(NULL))
mc_apply_dpl(0);
 #endif

diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index d0f5e02..4d2d8a7 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -40,7 +40,7 @@ int child_dprc_id;
 struct fsl_dpbp_obj *dflt_dpbp = NULL;
 struct fsl_dpio_obj *dflt_dpio = NULL;
 struct fsl_dpni_obj *dflt_dpni = NULL;
-static u64 mc_lazy_dpl_addr;
+u64 mc_lazy_dpl_addr;

 #ifdef DEBUG
 void dump_ram_words(const char *title, void *addr)
diff --git a/include/fsl-mc/fsl_mc.h b/include/fsl-mc/fsl_mc.h
index ffe6da5..16d7af8 100644
--- a/include/fsl-mc/fsl_mc.h
+++ b/include/fsl-mc/fsl_mc.h
@@ -61,4 +61,6 @@ u64 mc_get_dram_addr(void);
 unsigned long mc_get_dram_block_size(void);
 int fsl_mc_ldpaa_init(bd_t *bis);
 int fsl_mc_ldpaa_exit(bd_t *bd);
+
+extern u64 mc_lazy_dpl_addr;
 #endif
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 8d3943f..bda2a84 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -529,7 +529,7 @@ static efi_status_t EFIAPI
efi_exit_boot_services(void *image_handle,
EFI_ENTRY("%p, %ld", image_handle, map_key);

 #ifdef CONFIG_FSL_MC_ENET
-   if (!fsl_mc_ldpaa_exit(NULL))
+   if (mc_lazy_dpl_addr && !fsl_mc_ldpaa_exit(NULL))
mc_apply_dpl(0);
 #endif
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2016-06-19 Thread Alexander Graf


On 07.06.16 03:28, Prabhakar Kushwaha wrote:
> Hi Alex,
> 
>> -Original Message-
>> From: Alexander Graf [mailto:ag...@suse.de]
>> Sent: Friday, May 27, 2016 7:58 PM
>> To: Prabhakar Kushwaha <prabhakar.kushw...@nxp.com>; u-
>> b...@lists.denx.de
>> Cc: york sun <york@nxp.com>
>> Subject: Re: [U-Boot] [PATCH 1/5] ls2080: Exit dpaa only right before exiting
>> U-Boot
>>
>> On 05/18/2016 02:29 PM, Prabhakar Kushwaha wrote:
>>>> -Original Message-
>>>> From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of
>>>> Alexander Graf
>>>> Sent: Friday, May 13, 2016 5:52 PM
>>>> To: u-boot@lists.denx.de
>>>> Subject: [U-Boot] [PATCH 1/5] 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 <ag...@suse.de>
>>> With this patch.
>>>
>>> If I does not apply MC,  I am getting following crash:-
>>>
>>> Starting kernel ...
>>>
>>> "Synchronous Abort" handler, esr 0x9644
>>
>> So should we consider it a bug fix or regression then? :)
>>
>>
> 
> Are you planning to fix it?
> 
> If not let me know I will try to  work on it. 

The checks that determine whether we really want to exit ldpaa only work
if the argument to the function is non-NULL.

Can you please check if the patch below fixes it for you?


Alex

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 95037c1..233c94f 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -91,7 +91,7 @@ static void announce_and_cleanup(int fake)
 #endif

 #ifdef CONFIG_FSL_MC_ENET
-   if (!fsl_mc_ldpaa_exit(NULL))
+   if (!fsl_mc_ldpaa_exit(gd->bd))
mc_apply_dpl(0);
 #endif

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 8d3943f..c1209b0 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -529,7 +529,7 @@ static efi_status_t EFIAPI
efi_exit_boot_services(void *image_handle,
EFI_ENTRY("%p, %ld", image_handle, map_key);

 #ifdef CONFIG_FSL_MC_ENET
-   if (!fsl_mc_ldpaa_exit(NULL))
+   if (!fsl_mc_ldpaa_exit(gd->bd))
mc_apply_dpl(0);
 #endif
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2016-06-06 Thread Prabhakar Kushwaha
Hi Alex,

> -Original Message-
> From: Alexander Graf [mailto:ag...@suse.de]
> Sent: Friday, May 27, 2016 7:58 PM
> To: Prabhakar Kushwaha <prabhakar.kushw...@nxp.com>; u-
> b...@lists.denx.de
> Cc: york sun <york....@nxp.com>
> Subject: Re: [U-Boot] [PATCH 1/5] ls2080: Exit dpaa only right before exiting
> U-Boot
> 
> On 05/18/2016 02:29 PM, Prabhakar Kushwaha wrote:
> >> -Original Message-
> >> From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of
> >> Alexander Graf
> >> Sent: Friday, May 13, 2016 5:52 PM
> >> To: u-boot@lists.denx.de
> >> Subject: [U-Boot] [PATCH 1/5] 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 <ag...@suse.de>
> > With this patch.
> >
> > If I does not apply MC,  I am getting following crash:-
> >
> > Starting kernel ...
> >
> > "Synchronous Abort" handler, esr 0x9644
> 
> So should we consider it a bug fix or regression then? :)
> 
> 

Are you planning to fix it?

If not let me know I will try to  work on it. 

--prabhakar

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


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

2016-05-27 Thread Alexander Graf

On 05/18/2016 02:29 PM, Prabhakar Kushwaha wrote:

-Original Message-
From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of
Alexander Graf
Sent: Friday, May 13, 2016 5:52 PM
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/5] 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 <ag...@suse.de>

With this patch.

If I does not apply MC,  I am getting following crash:-

Starting kernel ...

"Synchronous Abort" handler, esr 0x9644


So should we consider it a bug fix or regression then? :)


Alex

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


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

2016-05-18 Thread Prabhakar Kushwaha

> -Original Message-
> From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of
> Alexander Graf
> Sent: Friday, May 13, 2016 5:52 PM
> To: u-boot@lists.denx.de
> Subject: [U-Boot] [PATCH 1/5] 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 <ag...@suse.de>

With this patch.

If I does not apply MC,  I am getting following crash:-

Starting kernel ...

"Synchronous Abort" handler, esr 0x9644
ELR: fff4666c
LR:  fff46cc4
x0 : d51ec00010004000 x1 : ffcf9fc0
x2 : 0001 x3 : d51ec00010004000
x4 : d51ec000 x5 : 
x6 :  x7 : 9fffccc7
x8 : 9fffd080 x9 : 000c
x10: 0003 x11: ffcf9cd8
x12: fff6cc40 x13: ffcf90e0
x14: 0001 x15: 99a3
x16: ffd0ad40 x17: ffd0b630
x18: ffcfbd78 x19: 
x20: fffba000 x21: fffba520
x22: fffba528 x23: 
x24:  x25: ffd03878
x26: fff8fb40 x27: 
x28: a0e0 x29: ffcf9f70

Resetting CPU ...

### ERROR ### Please RESET the board ###



If I apply this patch.  MC timeout happens

Starting kernel ...

Error: Timeout waiting for MC response
dpbp_open() failed: -110
dpbp_exit() failed: -110
[0.00] Booting Linux on physical CPU 0x0
[0.00] Initializing cgroup subsys cpu


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


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

2016-05-13 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 
---
 arch/arm/lib/bootm.c| 11 +++
 board/freescale/ls2080a/ls2080a.c   |  1 -
 board/freescale/ls2080aqds/ls2080aqds.c |  4 
 board/freescale/ls2080ardb/ls2080ardb.c |  4 
 drivers/net/fsl-mc/mc.c | 22 --
 lib/efi_loader/efi_boottime.c   | 10 ++
 6 files changed, 41 insertions(+), 11 deletions(-)

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 0838d89..95037c1 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -30,6 +30,11 @@
 #include 
 #endif
 
+#ifdef CONFIG_FSL_MC_ENET
+#include 
+#include 
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 static struct tag *params;
@@ -84,6 +89,12 @@ static void announce_and_cleanup(int fake)
 #ifdef CONFIG_USB_DEVICE
udc_disconnect();
 #endif
+
+#ifdef CONFIG_FSL_MC_ENET
+   if (!fsl_mc_ldpaa_exit(NULL))
+   mc_apply_dpl(0);
+#endif
+
cleanup_before_linux();
 }
 
diff --git a/board/freescale/ls2080a/ls2080a.c 
b/board/freescale/ls2080a/ls2080a.c
index 00337d7..ca2bcfc 100644
--- a/board/freescale/ls2080a/ls2080a.c
+++ b/board/freescale/ls2080a/ls2080a.c
@@ -127,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 b3bd40a..a8620f7 100644
--- a/board/freescale/ls2080aqds/ls2080aqds.c
+++ b/board/freescale/ls2080aqds/ls2080aqds.c
@@ -282,7 +282,6 @@ void fdt_fixup_board_enet(void *fdt)
 #ifdef CONFIG_OF_BOARD_SETUP
 int ft_board_setup(void *blob, bd_t *bd)
 {
-   int err;
u64 base[CONFIG_NR_DRAM_BANKS];
u64 size[CONFIG_NR_DRAM_BANKS];
 
@@ -298,9 +297,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 fb39af6..0cc67c1 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -261,7 +261,6 @@ void fdt_fixup_board_enet(void *fdt)
 #ifdef CONFIG_OF_BOARD_SETUP
 int ft_board_setup(void *blob, bd_t *bd)
 {
-   int err;
u64 base[CONFIG_NR_DRAM_BANKS];
u64 size[CONFIG_NR_DRAM_BANKS];
 
@@ -277,9 +276,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..d0f5e02 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 = NULL;
 struct fsl_dpni_obj *dflt_dpni = NULL;
+static u64 mc_lazy_dpl_addr;
 
 #ifdef DEBUG
 void dump_ram_words(const char *title, void *addr)
@@ -572,6 +573,12 @@ int mc_apply_dpl(u64 mc_dpl_addr)
u64 mc_ram_addr = mc_get_dram_addr();
size_t mc_ram_size = mc_get_dram_block_size();
 
+   if (!mc_dpl_addr)
+   mc_dpl_addr = mc_lazy_dpl_addr;
+
+   if (!mc_dpl_addr)
+   return -1;
+
error = load_mc_dpl(mc_ram_addr, mc_ram_size, mc_dpl_addr);
if (error != 0)
return error;
@@ -1259,6 +1266,7 @@ static int do_fsl_mc(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[])
}
break;
 
+   case 'l':
case 'a': {
u64 mc_dpl_addr;
 
@@ -1279,8 +1287,17 @@ static int do_fsl_mc(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[])
return -ENODEV;
}
 
-   if (!fsl_mc_ldpaa_exit(NULL))
-   err = mc_apply_dpl(mc_dpl_addr);
+   if (argv[1][0] == 'l') {
+   /*
+* We will do the actual dpaa exit and dpl apply
+* later from