Commit 1730a17d authored by Prabhakar Kushwaha's avatar Prabhakar Kushwaha Committed by York Sun

driver: net: fsl-mc: Create DPAA2 object at run-time

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: default avatarPrabhakar Kushwaha <prabhakar@freescale.com>
Reviewed-by: default avatarYork Sun <yorksun@freescale.com>
parent fb4a87a7
......@@ -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;
......
......@@ -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;
......
This diff is collapsed.
......@@ -601,7 +601,7 @@ static int ldpaa_eth_netdev_init(struct eth_device *net_dev)
return 0;
}
int ldpaa_eth_init(struct dprc_obj_desc obj_desc)
int ldpaa_eth_init(int id)
{
struct eth_device *net_dev = NULL;
struct ldpaa_eth_priv *priv = NULL;
......@@ -626,7 +626,7 @@ int ldpaa_eth_init(struct dprc_obj_desc obj_desc)
net_dev->priv = (void *)priv;
priv->net_dev = (struct eth_device *)net_dev;
priv->dpni_id = obj_desc.id;
priv->dpni_id = id;
err = ldpaa_eth_netdev_init(net_dev);
if (err)
......
......@@ -29,6 +29,9 @@
((void __iomem *)((uintptr_t)SOC_MC_PORTALS_BASE_ADDR + \
(_portal_id) * SOC_MC_PORTAL_STRIDE))
#define MC_PORTAL_OFFSET_TO_PORTAL_ID(_portal_offset) \
((_portal_offset) / SOC_MC_PORTAL_STRIDE)
struct mc_ccsr_registers {
u32 reg_gcr1;
u32 reserved1;
......@@ -57,5 +60,5 @@ int get_aiop_apply_status(void);
u64 mc_get_dram_addr(void);
unsigned long mc_get_dram_block_size(void);
int fsl_mc_ldpaa_init(bd_t *bis);
void fsl_mc_ldpaa_exit(bd_t *bis);
int fsl_mc_ldpaa_exit(bd_t *bd);
#endif
......@@ -18,13 +18,14 @@
#include <fsl-mc/fsl_mc_cmd.h>
#include <fsl-mc/fsl_dprc.h>
#include <fsl-mc/fsl_dpbp.h>
#include <fsl-mc/fsl_dpni.h>
extern struct fsl_mc_io *dflt_mc_io;
/**
* struct dpbp_node - DPBP strucuture
* @uint16_t handle: DPBP object handle
* @int dpbp_id: DPBP id
* @struct dpbp_attr: DPBP attribute
*/
struct fsl_dpbp_obj {
uint16_t dpbp_handle;
......@@ -40,11 +41,29 @@ extern struct fsl_dpbp_obj *dflt_dpbp;
*/
struct fsl_dpio_obj {
int dpio_id;
uint16_t dpio_handle;
struct qbman_swp *sw_portal; /** SW portal object */
};
extern struct fsl_dpio_obj *dflt_dpio;
/**
* struct dpni_node - DPNI strucuture
* @int dpni_id: DPNI id
* @uint16_t handle: DPNI object handle
* @struct dpni_attr: DPNI attributes
* @struct dpni_buffer_layout: DPNI buffer layout
*/
struct fsl_dpni_obj {
int dpni_id;
uint16_t dpni_handle;
struct dpni_attr dpni_attrs;
struct dpni_buffer_layout buf_layout;
};
extern struct fsl_dpni_obj *dflt_dpni;
int mc_init(u64 mc_fw_addr, u64 mc_dpc_addr);
int ldpaa_eth_init(struct dprc_obj_desc obj_desc);
int ldpaa_eth_init(int dpmac_id);
int mc_apply_dpl(u64 mc_dpl_addr);
#endif /* _FSL_MC_PRIVATE_H_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment