diff options
author | Mandy Lavi <mandy.lavi@freescale.com> | 2014-02-27 14:28:17 (GMT) |
---|---|---|
committer | Jose Rivera <German.Rivera@freescale.com> | 2014-03-07 17:34:38 (GMT) |
commit | 8e33ce9cf3fffa49287c34d0d5a7e15ccf880c8f (patch) | |
tree | 16f73cb3cfe7b3858e77e8edce63a1d0dd99cb83 /drivers/net/ethernet/freescale/fman/Peripherals/FM/fman.c | |
parent | 8b32a91deffcc4cded99b366449c8139eea39690 (diff) | |
download | linux-fsl-qoriq-8e33ce9cf3fffa49287c34d0d5a7e15ccf880c8f.tar.xz |
fmd: adjust allocation of fifo resources for fmanv3l
Change-Id: I249456d0f157547fab221286e1c18e59ce5345d3
Signed-off-by: Mandy Lavi <mandy.lavi@freescale.com>
Reviewed-on: http://git.am.freescale.net:8181/9257
Reviewed-by: Igal Liberman <Igal.Liberman@freescale.com>
Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
Tested-by: Jose Rivera <German.Rivera@freescale.com>
Reviewed-on: http://git.am.freescale.net:8181/9448
Diffstat (limited to 'drivers/net/ethernet/freescale/fman/Peripherals/FM/fman.c')
-rwxr-xr-x | drivers/net/ethernet/freescale/fman/Peripherals/FM/fman.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/fman.c b/drivers/net/ethernet/freescale/fman/Peripherals/FM/fman.c index 996841c..16a0854 100755 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/fman.c +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/fman.c @@ -317,6 +317,9 @@ void fman_set_liodn_per_port(struct fman_rg *fman_rg, uint8_t port_id, { uint32_t tmp; + if ((port_id > 63) || (port_id < 1)) + return; + /* set LIODN base for this port */ tmp = ioread32be(&fman_rg->dma_rg->fmdmplr[port_id / 2]); if (port_id % 2) { @@ -405,6 +408,9 @@ uint16_t fman_get_size_of_fifo(struct fman_bmi_regs *bmi_rg, uint8_t port_id) { uint32_t tmp_reg; + if ((port_id > 63) || (port_id < 1)) + return 0; + tmp_reg = ioread32be(&bmi_rg->fmbm_pfs[port_id - 1]); return (uint16_t)((tmp_reg & BMI_FIFO_SIZE_MASK) + 1); } @@ -423,6 +429,9 @@ uint16_t fman_get_size_of_extra_fifo(struct fman_bmi_regs *bmi_rg, { uint32_t tmp_reg; + if ((port_id > 63) || (port_id < 1)) + return 0; + tmp_reg = ioread32be(&bmi_rg->fmbm_pfs[port_id-1]); return (uint16_t)((tmp_reg & BMI_EXTRA_FIFO_SIZE_MASK) >> BMI_EXTRA_FIFO_SIZE_SHIFT); @@ -435,6 +444,9 @@ void fman_set_size_of_fifo(struct fman_bmi_regs *bmi_rg, { uint32_t tmp; + if ((port_id > 63) || (port_id < 1)) + return; + /* calculate reg */ tmp = (uint32_t)((sz_fifo / FMAN_BMI_FIFO_UNITS - 1) | ((extra_sz_fifo / FMAN_BMI_FIFO_UNITS) << @@ -446,6 +458,9 @@ uint8_t fman_get_num_of_tasks(struct fman_bmi_regs *bmi_rg, uint8_t port_id) { uint32_t tmp; + if ((port_id > 63) || (port_id < 1)) + return 0; + tmp = ioread32be(&bmi_rg->fmbm_pp[port_id - 1]); return (uint8_t)(((tmp & BMI_NUM_OF_TASKS_MASK) >> BMI_NUM_OF_TASKS_SHIFT) + 1); @@ -455,6 +470,9 @@ uint8_t fman_get_num_extra_tasks(struct fman_bmi_regs *bmi_rg, uint8_t port_id) { uint32_t tmp; + if ((port_id > 63) || (port_id < 1)) + return 0; + tmp = ioread32be(&bmi_rg->fmbm_pp[port_id - 1]); return (uint8_t)((tmp & BMI_NUM_OF_EXTRA_TASKS_MASK) >> BMI_EXTRA_NUM_OF_TASKS_SHIFT); @@ -467,6 +485,9 @@ void fman_set_num_of_tasks(struct fman_bmi_regs *bmi_rg, { uint32_t tmp; + if ((port_id > 63) || (port_id < 1)) + return; + /* calculate reg */ tmp = ioread32be(&bmi_rg->fmbm_pp[port_id - 1]) & ~(BMI_NUM_OF_TASKS_MASK | BMI_NUM_OF_EXTRA_TASKS_MASK); @@ -479,6 +500,9 @@ uint8_t fman_get_num_of_dmas(struct fman_bmi_regs *bmi_rg, uint8_t port_id) { uint32_t tmp; + if ((port_id > 63) || (port_id < 1)) + return 0; + tmp = ioread32be(&bmi_rg->fmbm_pp[port_id - 1]); return (uint8_t)(((tmp & BMI_NUM_OF_DMAS_MASK) >> BMI_NUM_OF_DMAS_SHIFT) + 1); @@ -488,6 +512,9 @@ uint8_t fman_get_num_extra_dmas(struct fman_bmi_regs *bmi_rg, uint8_t port_id) { uint32_t tmp; + if ((port_id > 63) || (port_id < 1)) + return 0; + tmp = ioread32be(&bmi_rg->fmbm_pp[port_id - 1]); return (uint8_t)((tmp & BMI_NUM_OF_EXTRA_DMAS_MASK) >> BMI_EXTRA_NUM_OF_DMAS_SHIFT); @@ -500,6 +527,10 @@ void fman_set_num_of_open_dmas(struct fman_bmi_regs *bmi_rg, uint8_t total_num_dmas) { uint32_t tmp = 0; + + if ((port_id > 63) || (port_id < 1)) + return; + /* calculate reg */ tmp = ioread32be(&bmi_rg->fmbm_pp[port_id - 1]) & ~(BMI_NUM_OF_DMAS_MASK | BMI_NUM_OF_EXTRA_DMAS_MASK); @@ -523,12 +554,15 @@ void fman_set_vsp_window(struct fman_bmi_regs *bmi_rg, uint8_t log2_num_of_profiles) { uint32_t tmp = 0; + if ((port_id > 63) || (port_id < 1)) + return; tmp = ioread32be(&bmi_rg->fmbm_spliodn[port_id-1]); tmp |= (uint32_t)((uint32_t)base_storage_profile & 0x3f) << 16; tmp |= (uint32_t)log2_num_of_profiles << 28; iowrite32be(tmp, &bmi_rg->fmbm_spliodn[port_id-1]); } + void fman_set_congestion_group_pfc_priority(uint32_t *cpg_rg, uint32_t congestion_group_id, uint8_t priority_bit_map) |