Re: [U-Boot] [PATCH 08/10][v4] driver: net: fsl-mc: Create DPAA2 object at run-time

2015-11-30 Thread York Sun


On 11/03/2015 10:55 PM, Prabhakar Kushwaha wrote:
> Freescale's DPAA2 ethernet driver depends upon the static DPL for the
> DPRC, DPNI, DPBP, DPIO objects.
> 
> Instead of static objects, Create DPNI, DPBP, DPIO objects at run-time.
> 
> Signed-off-by: Prabhakar Kushwaha 
> ---
>  Changes for v2: Use Child container for object creation
>  Changes for v3: 
>   - Avoid linux boot if MC up and DPL is not deployed
>   - Boot Linux is MC is not booted
>  Changes for v4: Sending as it is
> 
>  board/freescale/ls2085aqds/ls2085aqds.c |   5 +-
>  board/freescale/ls2085ardb/ls2085ardb.c |   5 +-
>  drivers/net/fsl-mc/mc.c | 467 
> +---
>  drivers/net/ldpaa_eth/ldpaa_eth.c   |   4 +-
>  include/fsl-mc/fsl_mc.h |   5 +-
>  include/fsl-mc/fsl_mc_private.h |  23 +-
>  6 files changed, 468 insertions(+), 41 deletions(-)

Applied to fsl-qoriq master. Thanks.

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


[U-Boot] [PATCH 08/10][v4] driver: net: fsl-mc: Create DPAA2 object at run-time

2015-11-03 Thread Prabhakar Kushwaha
Freescale's DPAA2 ethernet driver depends upon the static DPL for the
DPRC, DPNI, DPBP, DPIO objects.

Instead of static objects, Create DPNI, DPBP, DPIO objects at run-time.

Signed-off-by: Prabhakar Kushwaha 
---
 Changes for v2: Use Child container for object creation
 Changes for v3: 
- Avoid linux boot if MC up and DPL is not deployed
- Boot Linux is MC is not booted
 Changes for v4: Sending as it is

 board/freescale/ls2085aqds/ls2085aqds.c |   5 +-
 board/freescale/ls2085ardb/ls2085ardb.c |   5 +-
 drivers/net/fsl-mc/mc.c | 467 +---
 drivers/net/ldpaa_eth/ldpaa_eth.c   |   4 +-
 include/fsl-mc/fsl_mc.h |   5 +-
 include/fsl-mc/fsl_mc_private.h |  23 +-
 6 files changed, 468 insertions(+), 41 deletions(-)

diff --git a/board/freescale/ls2085aqds/ls2085aqds.c 
b/board/freescale/ls2085aqds/ls2085aqds.c
index b02d6e8..36b059f 100644
--- a/board/freescale/ls2085aqds/ls2085aqds.c
+++ b/board/freescale/ls2085aqds/ls2085aqds.c
@@ -294,6 +294,7 @@ 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];
 
@@ -309,7 +310,9 @@ int ft_board_setup(void *blob, bd_t *bd)
 
 #ifdef CONFIG_FSL_MC_ENET
fdt_fixup_board_enet(blob);
-   fsl_mc_ldpaa_exit(bd);
+   err = fsl_mc_ldpaa_exit(bd);
+   if (err)
+   return err;
 #endif
 
return 0;
diff --git a/board/freescale/ls2085ardb/ls2085ardb.c 
b/board/freescale/ls2085ardb/ls2085ardb.c
index 18953b8..761d7c8 100644
--- a/board/freescale/ls2085ardb/ls2085ardb.c
+++ b/board/freescale/ls2085ardb/ls2085ardb.c
@@ -260,6 +260,7 @@ 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];
 
@@ -275,7 +276,9 @@ int ft_board_setup(void *blob, bd_t *bd)
 
 #ifdef CONFIG_FSL_MC_ENET
fdt_fixup_board_enet(blob);
-   fsl_mc_ldpaa_exit(bd);
+   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 d2ca5c6..d80be1c 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -31,11 +31,14 @@ static int mc_dpl_applied = -1;
 #ifdef CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET
 static int mc_aiop_applied = -1;
 #endif
-struct fsl_mc_io *dflt_mc_io = NULL;
+struct fsl_mc_io *root_mc_io = NULL;
+struct fsl_mc_io *dflt_mc_io = NULL; /* child container */
+uint16_t root_dprc_handle = 0;
 uint16_t dflt_dprc_handle = 0;
+int child_dprc_id;
 struct fsl_dpbp_obj *dflt_dpbp = NULL;
 struct fsl_dpio_obj *dflt_dpio = NULL;
-uint16_t dflt_dpio_handle = 0;
+struct fsl_dpni_obj *dflt_dpni = NULL;
 
 #ifdef DEBUG
 void dump_ram_words(const char *title, void *addr)
@@ -521,17 +524,17 @@ int mc_init(u64 mc_fw_addr, u64 mc_dpc_addr)
 * Initialize the global default MC portal
 * And check that the MC firmware is responding portal commands:
 */
-   dflt_mc_io = (struct fsl_mc_io *)malloc(sizeof(struct fsl_mc_io));
-   if (!dflt_mc_io) {
+   root_mc_io = (struct fsl_mc_io *)malloc(sizeof(struct fsl_mc_io));
+   if (!root_mc_io) {
printf(" No memory: malloc() failed\n");
return -ENOMEM;
}
 
-   dflt_mc_io->mmio_regs = SOC_MC_PORTAL_ADDR(portal_id);
+   root_mc_io->mmio_regs = SOC_MC_PORTAL_ADDR(portal_id);
debug("Checking access to MC portal of root DPRC container (portal_id 
%d, portal physical addr %p)\n",
- portal_id, dflt_mc_io->mmio_regs);
+ portal_id, root_mc_io->mmio_regs);
 
-   error = mc_get_version(dflt_mc_io, MC_CMD_NO_FLAGS, _ver_info);
+   error = mc_get_version(root_mc_io, MC_CMD_NO_FLAGS, _ver_info);
if (error != 0) {
printf("fsl-mc: ERROR: Firmware version check failed (error: 
%d)\n",
   error);
@@ -654,36 +657,51 @@ unsigned long mc_get_dram_block_size(void)
return dram_block_size;
 }
 
-int dpio_init(struct dprc_obj_desc obj_desc)
+int fsl_mc_ldpaa_init(bd_t *bis)
+{
+   return 0;
+}
+
+static int dpio_init(void)
 {
struct qbman_swp_desc p_des;
struct dpio_attr attr;
+   struct dpio_cfg dpio_cfg;
int err = 0;
 
dflt_dpio = (struct fsl_dpio_obj *)malloc(sizeof(struct fsl_dpio_obj));
if (!dflt_dpio) {
-   printf(" No memory: malloc() failed\n");
-   return -ENOMEM;
+   printf("No memory: malloc() failed\n");
+   err = -ENOMEM;
+   goto err_malloc;
}
 
-   dflt_dpio->dpio_id = obj_desc.id;
+   dpio_cfg.channel_mode = DPIO_LOCAL_CHANNEL;
+   dpio_cfg.num_priorities = 8;
 
-   err = dpio_open(dflt_mc_io,