Commit 115a731e authored by David S. Miller's avatar David S. Miller

Merge branch 'dpaa_eth-next' of git://git.freescale.com/ppc/upstream/linux

Madalin Bucur says:

====================
QorIQ DPAA 1 updates

This patch set introduces a series of fixes and features to the DPAA 1
drivers. Besides activating hardware Rx checksum offloading, four traffic
classes are added for Tx traffic prioritisation.

changes from v1: added patch to enable context-A stashing
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 5425077d 7fe1e290
...@@ -39,7 +39,12 @@ ...@@ -39,7 +39,12 @@
#include "mac.h" #include "mac.h"
#include "dpaa_eth_trace.h" #include "dpaa_eth_trace.h"
#define DPAA_ETH_TXQ_NUM NR_CPUS /* Number of prioritised traffic classes */
#define DPAA_TC_NUM 4
/* Number of Tx queues per traffic class */
#define DPAA_TC_TXQ_NUM NR_CPUS
/* Total number of Tx queues */
#define DPAA_ETH_TXQ_NUM (DPAA_TC_NUM * DPAA_TC_TXQ_NUM)
#define DPAA_BPS_NUM 3 /* number of bpools per interface */ #define DPAA_BPS_NUM 3 /* number of bpools per interface */
...@@ -152,6 +157,7 @@ struct dpaa_priv { ...@@ -152,6 +157,7 @@ struct dpaa_priv {
u16 channel; u16 channel;
struct list_head dpaa_fq_list; struct list_head dpaa_fq_list;
u8 num_tc;
u32 msg_enable; /* net_device message level */ u32 msg_enable; /* net_device message level */
struct { struct {
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
#define DMA_OFFSET 0x000C2000 #define DMA_OFFSET 0x000C2000
#define FPM_OFFSET 0x000C3000 #define FPM_OFFSET 0x000C3000
#define IMEM_OFFSET 0x000C4000 #define IMEM_OFFSET 0x000C4000
#define HWP_OFFSET 0x000C7000
#define CGP_OFFSET 0x000DB000 #define CGP_OFFSET 0x000DB000
/* Exceptions bit map */ /* Exceptions bit map */
...@@ -218,6 +219,9 @@ ...@@ -218,6 +219,9 @@
#define QMI_GS_HALT_NOT_BUSY 0x00000002 #define QMI_GS_HALT_NOT_BUSY 0x00000002
/* HWP defines */
#define HWP_RPIMAC_PEN 0x00000001
/* IRAM defines */ /* IRAM defines */
#define IRAM_IADD_AIE 0x80000000 #define IRAM_IADD_AIE 0x80000000
#define IRAM_READY 0x80000000 #define IRAM_READY 0x80000000
...@@ -475,6 +479,12 @@ struct fman_dma_regs { ...@@ -475,6 +479,12 @@ struct fman_dma_regs {
u32 res00e0[0x400 - 56]; u32 res00e0[0x400 - 56];
}; };
struct fman_hwp_regs {
u32 res0000[0x844 / 4]; /* 0x000..0x843 */
u32 fmprrpimac; /* FM Parser Internal memory access control */
u32 res[(0x1000 - 0x848) / 4]; /* 0x848..0xFFF */
};
/* Structure that holds current FMan state. /* Structure that holds current FMan state.
* Used for saving run time information. * Used for saving run time information.
*/ */
...@@ -606,6 +616,7 @@ struct fman { ...@@ -606,6 +616,7 @@ struct fman {
struct fman_bmi_regs __iomem *bmi_regs; struct fman_bmi_regs __iomem *bmi_regs;
struct fman_qmi_regs __iomem *qmi_regs; struct fman_qmi_regs __iomem *qmi_regs;
struct fman_dma_regs __iomem *dma_regs; struct fman_dma_regs __iomem *dma_regs;
struct fman_hwp_regs __iomem *hwp_regs;
fman_exceptions_cb *exception_cb; fman_exceptions_cb *exception_cb;
fman_bus_error_cb *bus_error_cb; fman_bus_error_cb *bus_error_cb;
/* Spinlock for FMan use */ /* Spinlock for FMan use */
...@@ -999,6 +1010,12 @@ static void qmi_init(struct fman_qmi_regs __iomem *qmi_rg, ...@@ -999,6 +1010,12 @@ static void qmi_init(struct fman_qmi_regs __iomem *qmi_rg,
iowrite32be(tmp_reg, &qmi_rg->fmqm_ien); iowrite32be(tmp_reg, &qmi_rg->fmqm_ien);
} }
static void hwp_init(struct fman_hwp_regs __iomem *hwp_rg)
{
/* enable HW Parser */
iowrite32be(HWP_RPIMAC_PEN, &hwp_rg->fmprrpimac);
}
static int enable(struct fman *fman, struct fman_cfg *cfg) static int enable(struct fman *fman, struct fman_cfg *cfg)
{ {
u32 cfg_reg = 0; u32 cfg_reg = 0;
...@@ -1195,7 +1212,7 @@ static int fill_soc_specific_params(struct fman_state_struct *state) ...@@ -1195,7 +1212,7 @@ static int fill_soc_specific_params(struct fman_state_struct *state)
state->max_num_of_open_dmas = 32; state->max_num_of_open_dmas = 32;
state->fm_port_num_of_cg = 256; state->fm_port_num_of_cg = 256;
state->num_of_rx_ports = 6; state->num_of_rx_ports = 6;
state->total_fifo_size = 122 * 1024; state->total_fifo_size = 136 * 1024;
break; break;
case 2: case 2:
...@@ -1793,6 +1810,7 @@ static int fman_config(struct fman *fman) ...@@ -1793,6 +1810,7 @@ static int fman_config(struct fman *fman)
fman->bmi_regs = base_addr + BMI_OFFSET; fman->bmi_regs = base_addr + BMI_OFFSET;
fman->qmi_regs = base_addr + QMI_OFFSET; fman->qmi_regs = base_addr + QMI_OFFSET;
fman->dma_regs = base_addr + DMA_OFFSET; fman->dma_regs = base_addr + DMA_OFFSET;
fman->hwp_regs = base_addr + HWP_OFFSET;
fman->base_addr = base_addr; fman->base_addr = base_addr;
spin_lock_init(&fman->spinlock); spin_lock_init(&fman->spinlock);
...@@ -2062,6 +2080,9 @@ static int fman_init(struct fman *fman) ...@@ -2062,6 +2080,9 @@ static int fman_init(struct fman *fman)
/* Init QMI Registers */ /* Init QMI Registers */
qmi_init(fman->qmi_regs, fman->cfg); qmi_init(fman->qmi_regs, fman->cfg);
/* Init HW Parser */
hwp_init(fman->hwp_regs);
err = enable(fman, cfg); err = enable(fman, cfg);
if (err != 0) if (err != 0)
return err; return err;
......
...@@ -134,14 +134,14 @@ enum fman_exceptions { ...@@ -134,14 +134,14 @@ enum fman_exceptions {
struct fman_prs_result { struct fman_prs_result {
u8 lpid; /* Logical port id */ u8 lpid; /* Logical port id */
u8 shimr; /* Shim header result */ u8 shimr; /* Shim header result */
u16 l2r; /* Layer 2 result */ __be16 l2r; /* Layer 2 result */
u16 l3r; /* Layer 3 result */ __be16 l3r; /* Layer 3 result */
u8 l4r; /* Layer 4 result */ u8 l4r; /* Layer 4 result */
u8 cplan; /* Classification plan id */ u8 cplan; /* Classification plan id */
u16 nxthdr; /* Next Header */ __be16 nxthdr; /* Next Header */
u16 cksum; /* Running-sum */ __be16 cksum; /* Running-sum */
/* Flags&fragment-offset field of the last IP-header */ /* Flags&fragment-offset field of the last IP-header */
u16 flags_frag_off; __be16 flags_frag_off;
/* Routing type field of a IPV6 routing extension header */ /* Routing type field of a IPV6 routing extension header */
u8 route_type; u8 route_type;
/* Routing Extension Header Present; last bit is IP valid */ /* Routing Extension Header Present; last bit is IP valid */
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
#define BMI_PORT_REGS_OFFSET 0 #define BMI_PORT_REGS_OFFSET 0
#define QMI_PORT_REGS_OFFSET 0x400 #define QMI_PORT_REGS_OFFSET 0x400
#define HWP_PORT_REGS_OFFSET 0x800
/* Default values */ /* Default values */
#define DFLT_PORT_BUFFER_PREFIX_CONTEXT_DATA_ALIGN \ #define DFLT_PORT_BUFFER_PREFIX_CONTEXT_DATA_ALIGN \
...@@ -182,7 +183,7 @@ ...@@ -182,7 +183,7 @@
#define NIA_ENG_BMI 0x00500000 #define NIA_ENG_BMI 0x00500000
#define NIA_ENG_QMI_ENQ 0x00540000 #define NIA_ENG_QMI_ENQ 0x00540000
#define NIA_ENG_QMI_DEQ 0x00580000 #define NIA_ENG_QMI_DEQ 0x00580000
#define NIA_ENG_HWP 0x00440000
#define NIA_BMI_AC_ENQ_FRAME 0x00000002 #define NIA_BMI_AC_ENQ_FRAME 0x00000002
#define NIA_BMI_AC_TX_RELEASE 0x000002C0 #define NIA_BMI_AC_TX_RELEASE 0x000002C0
#define NIA_BMI_AC_RELEASE 0x000000C0 #define NIA_BMI_AC_RELEASE 0x000000C0
...@@ -317,6 +318,19 @@ struct fman_port_qmi_regs { ...@@ -317,6 +318,19 @@ struct fman_port_qmi_regs {
u32 fmqm_pndcc; /* PortID n Dequeue Confirm Counter */ u32 fmqm_pndcc; /* PortID n Dequeue Confirm Counter */
}; };
#define HWP_HXS_COUNT 16
#define HWP_HXS_PHE_REPORT 0x00000800
#define HWP_HXS_PCAC_PSTAT 0x00000100
#define HWP_HXS_PCAC_PSTOP 0x00000001
struct fman_port_hwp_regs {
struct {
u32 ssa; /* Soft Sequence Attachment */
u32 lcv; /* Line-up Enable Confirmation Mask */
} pmda[HWP_HXS_COUNT]; /* Parse Memory Direct Access Registers */
u32 reserved080[(0x3f8 - 0x080) / 4]; /* (0x080-0x3f7) */
u32 fmpr_pcac; /* Configuration Access Control */
};
/* QMI dequeue prefetch modes */ /* QMI dequeue prefetch modes */
enum fman_port_deq_prefetch { enum fman_port_deq_prefetch {
FMAN_PORT_DEQ_NO_PREFETCH, /* No prefetch mode */ FMAN_PORT_DEQ_NO_PREFETCH, /* No prefetch mode */
...@@ -436,6 +450,7 @@ struct fman_port { ...@@ -436,6 +450,7 @@ struct fman_port {
union fman_port_bmi_regs __iomem *bmi_regs; union fman_port_bmi_regs __iomem *bmi_regs;
struct fman_port_qmi_regs __iomem *qmi_regs; struct fman_port_qmi_regs __iomem *qmi_regs;
struct fman_port_hwp_regs __iomem *hwp_regs;
struct fman_sp_buffer_offsets buffer_offsets; struct fman_sp_buffer_offsets buffer_offsets;
...@@ -521,9 +536,12 @@ static int init_bmi_rx(struct fman_port *port) ...@@ -521,9 +536,12 @@ static int init_bmi_rx(struct fman_port *port)
/* NIA */ /* NIA */
tmp = (u32)cfg->rx_fd_bits << BMI_NEXT_ENG_FD_BITS_SHIFT; tmp = (u32)cfg->rx_fd_bits << BMI_NEXT_ENG_FD_BITS_SHIFT;
tmp |= NIA_ENG_BMI | NIA_BMI_AC_ENQ_FRAME; tmp |= NIA_ENG_HWP;
iowrite32be(tmp, &regs->fmbm_rfne); iowrite32be(tmp, &regs->fmbm_rfne);
/* Parser Next Engine NIA */
iowrite32be(NIA_ENG_BMI | NIA_BMI_AC_ENQ_FRAME, &regs->fmbm_rfpne);
/* Enqueue NIA */ /* Enqueue NIA */
iowrite32be(NIA_ENG_QMI_ENQ | NIA_ORDER_RESTOR, &regs->fmbm_rfene); iowrite32be(NIA_ENG_QMI_ENQ | NIA_ORDER_RESTOR, &regs->fmbm_rfene);
...@@ -665,6 +683,50 @@ static int init_qmi(struct fman_port *port) ...@@ -665,6 +683,50 @@ static int init_qmi(struct fman_port *port)
return 0; return 0;
} }
static void stop_port_hwp(struct fman_port *port)
{
struct fman_port_hwp_regs __iomem *regs = port->hwp_regs;
int cnt = 100;
iowrite32be(HWP_HXS_PCAC_PSTOP, &regs->fmpr_pcac);
while (cnt-- > 0 &&
(ioread32be(&regs->fmpr_pcac) & HWP_HXS_PCAC_PSTAT))
udelay(10);
if (!cnt)
pr_err("Timeout stopping HW Parser\n");
}
static void start_port_hwp(struct fman_port *port)
{
struct fman_port_hwp_regs __iomem *regs = port->hwp_regs;
int cnt = 100;
iowrite32be(0, &regs->fmpr_pcac);
while (cnt-- > 0 &&
!(ioread32be(&regs->fmpr_pcac) & HWP_HXS_PCAC_PSTAT))
udelay(10);
if (!cnt)
pr_err("Timeout starting HW Parser\n");
}
static void init_hwp(struct fman_port *port)
{
struct fman_port_hwp_regs __iomem *regs = port->hwp_regs;
int i;
stop_port_hwp(port);
for (i = 0; i < HWP_HXS_COUNT; i++) {
/* enable HXS error reporting into FD[STATUS] PHE */
iowrite32be(0x00000000, &regs->pmda[i].ssa);
iowrite32be(0xffffffff, &regs->pmda[i].lcv);
}
start_port_hwp(port);
}
static int init(struct fman_port *port) static int init(struct fman_port *port)
{ {
int err; int err;
...@@ -673,6 +735,8 @@ static int init(struct fman_port *port) ...@@ -673,6 +735,8 @@ static int init(struct fman_port *port)
switch (port->port_type) { switch (port->port_type) {
case FMAN_PORT_TYPE_RX: case FMAN_PORT_TYPE_RX:
err = init_bmi_rx(port); err = init_bmi_rx(port);
if (!err)
init_hwp(port);
break; break;
case FMAN_PORT_TYPE_TX: case FMAN_PORT_TYPE_TX:
err = init_bmi_tx(port); err = init_bmi_tx(port);
...@@ -686,7 +750,8 @@ static int init(struct fman_port *port) ...@@ -686,7 +750,8 @@ static int init(struct fman_port *port)
/* Init QMI registers */ /* Init QMI registers */
err = init_qmi(port); err = init_qmi(port);
return err; if (err)
return err;
return 0; return 0;
} }
...@@ -1247,7 +1312,7 @@ int fman_port_config(struct fman_port *port, struct fman_port_params *params) ...@@ -1247,7 +1312,7 @@ int fman_port_config(struct fman_port *port, struct fman_port_params *params)
/* Allocate the FM driver's parameters structure */ /* Allocate the FM driver's parameters structure */
port->cfg = kzalloc(sizeof(*port->cfg), GFP_KERNEL); port->cfg = kzalloc(sizeof(*port->cfg), GFP_KERNEL);
if (!port->cfg) if (!port->cfg)
goto err_params; return -EINVAL;
/* Initialize FM port parameters which will be kept by the driver */ /* Initialize FM port parameters which will be kept by the driver */
port->port_type = port->dts_params.type; port->port_type = port->dts_params.type;
...@@ -1276,6 +1341,7 @@ int fman_port_config(struct fman_port *port, struct fman_port_params *params) ...@@ -1276,6 +1341,7 @@ int fman_port_config(struct fman_port *port, struct fman_port_params *params)
/* set memory map pointers */ /* set memory map pointers */
port->bmi_regs = base_addr + BMI_PORT_REGS_OFFSET; port->bmi_regs = base_addr + BMI_PORT_REGS_OFFSET;
port->qmi_regs = base_addr + QMI_PORT_REGS_OFFSET; port->qmi_regs = base_addr + QMI_PORT_REGS_OFFSET;
port->hwp_regs = base_addr + HWP_PORT_REGS_OFFSET;
port->max_frame_length = DFLT_PORT_MAX_FRAME_LENGTH; port->max_frame_length = DFLT_PORT_MAX_FRAME_LENGTH;
/* resource distribution. */ /* resource distribution. */
...@@ -1327,8 +1393,6 @@ int fman_port_config(struct fman_port *port, struct fman_port_params *params) ...@@ -1327,8 +1393,6 @@ int fman_port_config(struct fman_port *port, struct fman_port_params *params)
err_port_cfg: err_port_cfg:
kfree(port->cfg); kfree(port->cfg);
err_params:
kfree(port);
return -EINVAL; return -EINVAL;
} }
EXPORT_SYMBOL(fman_port_config); EXPORT_SYMBOL(fman_port_config);
......
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