summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2015-08-04 16:21:45 (GMT)
committerTom Rini <trini@konsulko.com>2015-08-04 16:21:45 (GMT)
commite22b1a54942d9003b10564325a34e3cf767556ce (patch)
treef244c37d0c1089b7e1858829e275be47f6f48ede /drivers
parent8889e984154f749047dc9ed3b4cd8b734dde66f2 (diff)
parente16b604ecf5701cc0ab4437bccfd65468035740b (diff)
downloadu-boot-e22b1a54942d9003b10564325a34e3cf767556ce.tar.xz
Merge branch 'master' of git://git.denx.de/u-boot-fsl-qoriq
Diffstat (limited to 'drivers')
-rw-r--r--drivers/crypto/fsl/jr.c25
-rw-r--r--drivers/crypto/fsl/jr.h2
-rw-r--r--drivers/crypto/fsl/sec.c20
-rw-r--r--drivers/ddr/fsl/main.c2
-rw-r--r--drivers/ddr/fsl/options.c10
-rw-r--r--drivers/net/fsl-mc/dpbp.c38
-rw-r--r--drivers/net/fsl-mc/dpio/dpio.c38
-rw-r--r--drivers/net/fsl-mc/dpmng.c7
-rw-r--r--drivers/net/fsl-mc/dpni.c126
-rw-r--r--drivers/net/fsl-mc/dprc.c70
-rw-r--r--drivers/net/fsl-mc/mc.c40
-rw-r--r--drivers/net/fsl-mc/mc_sys.c2
-rw-r--r--drivers/net/ldpaa_eth/ldpaa_eth.c69
-rw-r--r--drivers/pci/pci.c53
-rw-r--r--drivers/pci/pcie_layerscape.c137
-rw-r--r--drivers/qe/qe.c7
16 files changed, 489 insertions, 157 deletions
diff --git a/drivers/crypto/fsl/jr.c b/drivers/crypto/fsl/jr.c
index f99d594..17392c9 100644
--- a/drivers/crypto/fsl/jr.c
+++ b/drivers/crypto/fsl/jr.c
@@ -406,10 +406,19 @@ static void kick_trng(int ent_delay)
sec_out32(&rng->rtsdctl, val);
/* min. freq. count, equal to 1/4 of the entropy sample length */
sec_out32(&rng->rtfreqmin, ent_delay >> 2);
- /* max. freq. count, equal to 8 times the entropy sample length */
- sec_out32(&rng->rtfreqmax, ent_delay << 3);
+ /* disable maximum frequency count */
+ sec_out32(&rng->rtfreqmax, RTFRQMAX_DISABLE);
+ /* read the control register */
+ val = sec_in32(&rng->rtmctl);
+ /*
+ * select raw sampling in both entropy shifter
+ * and statistical checker
+ */
+ sec_setbits32(&val, RTMCTL_SAMP_MODE_RAW_ES_SC);
/* put RNG4 into run mode */
- sec_clrbits32(&rng->rtmctl, RTMCTL_PRGM);
+ sec_clrbits32(&val, RTMCTL_PRGM);
+ /* write back the control register */
+ sec_out32(&rng->rtmctl, val);
}
static int rng_init(void)
@@ -459,14 +468,16 @@ static int rng_init(void)
int sec_init(void)
{
- int ret = 0;
-
-#ifdef CONFIG_PHYS_64BIT
ccsr_sec_t *sec = (void *)CONFIG_SYS_FSL_SEC_ADDR;
uint32_t mcr = sec_in32(&sec->mcfgr);
+ int ret = 0;
- sec_out32(&sec->mcfgr, mcr | 1 << MCFGR_PS_SHIFT);
+ mcr = (mcr & ~MCFGR_AWCACHE_MASK) | (0x2 << MCFGR_AWCACHE_SHIFT);
+#ifdef CONFIG_PHYS_64BIT
+ mcr |= (1 << MCFGR_PS_SHIFT);
#endif
+ sec_out32(&sec->mcfgr, mcr);
+
ret = jr_init();
if (ret < 0) {
printf("SEC initialization failed\n");
diff --git a/drivers/crypto/fsl/jr.h b/drivers/crypto/fsl/jr.h
index cce2c58..1526060 100644
--- a/drivers/crypto/fsl/jr.h
+++ b/drivers/crypto/fsl/jr.h
@@ -21,6 +21,8 @@
#define MCFGR_SWRST ((uint32_t)(1)<<31) /* Software Reset */
#define MCFGR_DMA_RST ((uint32_t)(1)<<28) /* DMA Reset */
#define MCFGR_PS_SHIFT 16
+#define MCFGR_AWCACHE_SHIFT 8
+#define MCFGR_AWCACHE_MASK (0xf << MCFGR_AWCACHE_SHIFT)
#define JR_INTMASK 0x00000001
#define JRCR_RESET 0x01
#define JRINT_ERR_HALT_INPROGRESS 0x4
diff --git a/drivers/crypto/fsl/sec.c b/drivers/crypto/fsl/sec.c
index 443ee96..0940faf 100644
--- a/drivers/crypto/fsl/sec.c
+++ b/drivers/crypto/fsl/sec.c
@@ -60,27 +60,26 @@ void fdt_fixup_crypto_node(void *blob, int sec_rev)
return;
}
- val = cpu_to_fdt32(sec_rev_prop_list[sec_idx].num_channels);
- err = fdt_setprop(blob, crypto_node, "fsl,num-channels", &val, 4);
+ err = fdt_setprop_u32(blob, crypto_node, "fsl,num-channels",
+ sec_rev_prop_list[sec_idx].num_channels);
if (err < 0)
printf("WARNING: could not set crypto property: %s\n",
fdt_strerror(err));
- val = cpu_to_fdt32(sec_rev_prop_list[sec_idx].descriptor_types_mask);
- err = fdt_setprop(blob, crypto_node, "fsl,descriptor-types-mask",
- &val, 4);
+ err = fdt_setprop_u32(blob, crypto_node, "fsl,descriptor-types-mask",
+ sec_rev_prop_list[sec_idx].descriptor_types_mask);
if (err < 0)
printf("WARNING: could not set crypto property: %s\n",
fdt_strerror(err));
- val = cpu_to_fdt32(sec_rev_prop_list[sec_idx].exec_units_mask);
- err = fdt_setprop(blob, crypto_node, "fsl,exec-units-mask", &val, 4);
+ err = fdt_setprop_u32(blob, crypto_node, "fsl,exec-units-mask",
+ sec_rev_prop_list[sec_idx].exec_units_mask);
if (err < 0)
printf("WARNING: could not set crypto property: %s\n",
fdt_strerror(err));
- val = cpu_to_fdt32(sec_rev_prop_list[sec_idx].channel_fifo_len);
- err = fdt_setprop(blob, crypto_node, "fsl,channel-fifo-len", &val, 4);
+ err = fdt_setprop_u32(blob, crypto_node, "fsl,channel-fifo-len",
+ sec_rev_prop_list[sec_idx].channel_fifo_len);
if (err < 0)
printf("WARNING: could not set crypto property: %s\n",
fdt_strerror(err));
@@ -155,8 +154,7 @@ static void fdt_fixup_crypto_era(void *blob, u32 era)
return;
}
- err = fdt_setprop(blob, crypto_node, "fsl,sec-era", &era,
- sizeof(era));
+ err = fdt_setprop_u32(blob, crypto_node, "fsl,sec-era", era);
if (err < 0) {
printf("ERROR: could not set fsl,sec-era property: %s\n",
fdt_strerror(err));
diff --git a/drivers/ddr/fsl/main.c b/drivers/ddr/fsl/main.c
index 14ecf12..72ec1be 100644
--- a/drivers/ddr/fsl/main.c
+++ b/drivers/ddr/fsl/main.c
@@ -535,7 +535,7 @@ fsl_ddr_compute(fsl_ddr_info_t *pinfo, unsigned int start_step,
* which is currently STEP_ASSIGN_ADDRESSES.
*/
populate_memctl_options(
- timing_params[i].all_dimms_registered,
+ &timing_params[i],
&pinfo->memctl_opts[i],
pinfo->dimm_params[i], i);
/*
diff --git a/drivers/ddr/fsl/options.c b/drivers/ddr/fsl/options.c
index 3b30fa2..3c09c64 100644
--- a/drivers/ddr/fsl/options.c
+++ b/drivers/ddr/fsl/options.c
@@ -499,7 +499,7 @@ static inline unsigned int auto_bank_intlv(dimm_params_t *pdimm)
return 0;
}
-unsigned int populate_memctl_options(int all_dimms_registered,
+unsigned int populate_memctl_options(const common_timing_params_t *common_dimm,
memctl_options_t *popts,
dimm_params_t *pdimm,
unsigned int ctrl_num)
@@ -640,7 +640,7 @@ unsigned int populate_memctl_options(int all_dimms_registered,
popts->ba_intlv_ctl = 0;
/* Memory Organization Parameters */
- popts->registered_dimm_en = all_dimms_registered;
+ popts->registered_dimm_en = common_dimm->all_dimms_registered;
/* Operational Mode Paramters */
@@ -778,9 +778,11 @@ unsigned int populate_memctl_options(int all_dimms_registered,
* Set this to 0 for global auto precharge
* The value of 0x100 has been used for DDR1, DDR2, DDR3.
* It is not wrong. Any value should be OK. The performance depends on
- * applications. There is no one good value for all.
+ * applications. There is no one good value for all. One way to set
+ * is to use 1/4 of refint value.
*/
- popts->bstopre = 0x100;
+ popts->bstopre = picos_to_mclk(ctrl_num, common_dimm->refresh_rate_ps)
+ >> 2;
/*
* Window for four activates -- tFAW
diff --git a/drivers/net/fsl-mc/dpbp.c b/drivers/net/fsl-mc/dpbp.c
index 3853e58..1517a70 100644
--- a/drivers/net/fsl-mc/dpbp.c
+++ b/drivers/net/fsl-mc/dpbp.c
@@ -10,14 +10,18 @@
#include <fsl-mc/fsl_mc_cmd.h>
#include <fsl-mc/fsl_dpbp.h>
-int dpbp_open(struct fsl_mc_io *mc_io, int dpbp_id, uint16_t *token)
+int dpbp_open(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ int dpbp_id,
+ uint16_t *token)
{
struct mc_command cmd = { 0 };
int err;
/* prepare command */
cmd.header = mc_encode_cmd_header(DPBP_CMDID_OPEN,
- MC_CMD_PRI_LOW, 0);
+ cmd_flags,
+ 0);
DPBP_CMD_OPEN(cmd, dpbp_id);
/* send command to mc*/
@@ -31,55 +35,66 @@ int dpbp_open(struct fsl_mc_io *mc_io, int dpbp_id, uint16_t *token)
return err;
}
-int dpbp_close(struct fsl_mc_io *mc_io, uint16_t token)
+int dpbp_close(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ uint16_t token)
{
struct mc_command cmd = { 0 };
/* prepare command */
- cmd.header = mc_encode_cmd_header(DPBP_CMDID_CLOSE, MC_CMD_PRI_HIGH,
+ cmd.header = mc_encode_cmd_header(DPBP_CMDID_CLOSE, cmd_flags,
token);
/* send command to mc*/
return mc_send_command(mc_io, &cmd);
}
-int dpbp_enable(struct fsl_mc_io *mc_io, uint16_t token)
+int dpbp_enable(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ uint16_t token)
{
struct mc_command cmd = { 0 };
/* prepare command */
- cmd.header = mc_encode_cmd_header(DPBP_CMDID_ENABLE, MC_CMD_PRI_LOW,
+ cmd.header = mc_encode_cmd_header(DPBP_CMDID_ENABLE, cmd_flags,
token);
/* send command to mc*/
return mc_send_command(mc_io, &cmd);
}
-int dpbp_disable(struct fsl_mc_io *mc_io, uint16_t token)
+int dpbp_disable(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ uint16_t token)
{
struct mc_command cmd = { 0 };
/* prepare command */
cmd.header = mc_encode_cmd_header(DPBP_CMDID_DISABLE,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
/* send command to mc*/
return mc_send_command(mc_io, &cmd);
}
-int dpbp_reset(struct fsl_mc_io *mc_io, uint16_t token)
+int dpbp_reset(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ uint16_t token)
{
struct mc_command cmd = { 0 };
/* prepare command */
cmd.header = mc_encode_cmd_header(DPBP_CMDID_RESET,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
/* send command to mc*/
return mc_send_command(mc_io, &cmd);
}
int dpbp_get_attributes(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
struct dpbp_attr *attr)
{
@@ -88,7 +103,8 @@ int dpbp_get_attributes(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_ATTR,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
/* send command to mc*/
err = mc_send_command(mc_io, &cmd);
diff --git a/drivers/net/fsl-mc/dpio/dpio.c b/drivers/net/fsl-mc/dpio/dpio.c
index b07eff7..cd3fd50 100644
--- a/drivers/net/fsl-mc/dpio/dpio.c
+++ b/drivers/net/fsl-mc/dpio/dpio.c
@@ -8,14 +8,18 @@
#include <fsl-mc/fsl_mc_cmd.h>
#include <fsl-mc/fsl_dpio.h>
-int dpio_open(struct fsl_mc_io *mc_io, int dpio_id, uint16_t *token)
+int dpio_open(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ int dpio_id,
+ uint16_t *token)
{
struct mc_command cmd = { 0 };
int err;
/* prepare command */
cmd.header = mc_encode_cmd_header(DPIO_CMDID_OPEN,
- MC_CMD_PRI_LOW, 0);
+ cmd_flags,
+ 0);
DPIO_CMD_OPEN(cmd, dpio_id);
/* send command to mc*/
@@ -29,56 +33,68 @@ int dpio_open(struct fsl_mc_io *mc_io, int dpio_id, uint16_t *token)
return 0;
}
-int dpio_close(struct fsl_mc_io *mc_io, uint16_t token)
+int dpio_close(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ uint16_t token)
{
struct mc_command cmd = { 0 };
/* prepare command */
cmd.header = mc_encode_cmd_header(DPIO_CMDID_CLOSE,
- MC_CMD_PRI_HIGH, token);
+ cmd_flags,
+ token);
/* send command to mc*/
return mc_send_command(mc_io, &cmd);
}
-int dpio_enable(struct fsl_mc_io *mc_io, uint16_t token)
+int dpio_enable(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ uint16_t token)
{
struct mc_command cmd = { 0 };
/* prepare command */
cmd.header = mc_encode_cmd_header(DPIO_CMDID_ENABLE,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
/* send command to mc*/
return mc_send_command(mc_io, &cmd);
}
-int dpio_disable(struct fsl_mc_io *mc_io, uint16_t token)
+int dpio_disable(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ uint16_t token)
{
struct mc_command cmd = { 0 };
/* prepare command */
cmd.header = mc_encode_cmd_header(DPIO_CMDID_DISABLE,
- MC_CMD_PRI_LOW,
+ cmd_flags,
token);
/* send command to mc*/
return mc_send_command(mc_io, &cmd);
}
-int dpio_reset(struct fsl_mc_io *mc_io, uint16_t token)
+int dpio_reset(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ uint16_t token)
{
struct mc_command cmd = { 0 };
/* prepare command */
cmd.header = mc_encode_cmd_header(DPIO_CMDID_RESET,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
/* send command to mc*/
return mc_send_command(mc_io, &cmd);
}
int dpio_get_attributes(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
struct dpio_attr *attr)
{
@@ -87,7 +103,7 @@ int dpio_get_attributes(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPIO_CMDID_GET_ATTR,
- MC_CMD_PRI_LOW,
+ cmd_flags,
token);
/* send command to mc*/
diff --git a/drivers/net/fsl-mc/dpmng.c b/drivers/net/fsl-mc/dpmng.c
index 01ee112..d96e26b 100644
--- a/drivers/net/fsl-mc/dpmng.c
+++ b/drivers/net/fsl-mc/dpmng.c
@@ -7,14 +7,17 @@
#include <fsl-mc/fsl_dpmng.h>
#include "fsl_dpmng_cmd.h"
-int mc_get_version(struct fsl_mc_io *mc_io, struct mc_version *mc_ver_info)
+int mc_get_version(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ struct mc_version *mc_ver_info)
{
struct mc_command cmd = { 0 };
int err;
/* prepare command */
cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_VERSION,
- MC_CMD_PRI_LOW, 0);
+ cmd_flags,
+ 0);
/* send command to mc*/
err = mc_send_command(mc_io, &cmd);
diff --git a/drivers/net/fsl-mc/dpni.c b/drivers/net/fsl-mc/dpni.c
index 7bc2504..9111f35 100644
--- a/drivers/net/fsl-mc/dpni.c
+++ b/drivers/net/fsl-mc/dpni.c
@@ -8,14 +8,18 @@
#include <fsl-mc/fsl_mc_cmd.h>
#include <fsl-mc/fsl_dpni.h>
-int dpni_open(struct fsl_mc_io *mc_io, int dpni_id, uint16_t *token)
+int dpni_open(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ int dpni_id,
+ uint16_t *token)
{
struct mc_command cmd = { 0 };
int err;
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_OPEN,
- MC_CMD_PRI_LOW, 0);
+ cmd_flags,
+ 0);
DPNI_CMD_OPEN(cmd, dpni_id);
/* send command to mc*/
@@ -29,19 +33,23 @@ int dpni_open(struct fsl_mc_io *mc_io, int dpni_id, uint16_t *token)
return 0;
}
-int dpni_close(struct fsl_mc_io *mc_io, uint16_t token)
+int dpni_close(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ uint16_t token)
{
struct mc_command cmd = { 0 };
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_CLOSE,
- MC_CMD_PRI_HIGH, token);
+ cmd_flags,
+ token);
/* send command to mc*/
return mc_send_command(mc_io, &cmd);
}
int dpni_set_pools(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
const struct dpni_pools_cfg *cfg)
{
@@ -49,7 +57,7 @@ int dpni_set_pools(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_POOLS,
- MC_CMD_PRI_LOW,
+ cmd_flags,
token);
DPNI_CMD_SET_POOLS(cmd, cfg);
@@ -57,44 +65,53 @@ int dpni_set_pools(struct fsl_mc_io *mc_io,
return mc_send_command(mc_io, &cmd);
}
-int dpni_enable(struct fsl_mc_io *mc_io, uint16_t token)
+int dpni_enable(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ uint16_t token)
{
struct mc_command cmd = { 0 };
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_ENABLE,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
/* send command to mc*/
return mc_send_command(mc_io, &cmd);
}
-int dpni_disable(struct fsl_mc_io *mc_io, uint16_t token)
+int dpni_disable(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ uint16_t token)
{
struct mc_command cmd = { 0 };
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_DISABLE,
- MC_CMD_PRI_LOW,
+ cmd_flags,
token);
/* send command to mc*/
return mc_send_command(mc_io, &cmd);
}
-int dpni_reset(struct fsl_mc_io *mc_io, uint16_t token)
+int dpni_reset(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ uint16_t token)
{
struct mc_command cmd = { 0 };
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_RESET,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
/* send command to mc*/
return mc_send_command(mc_io, &cmd);
}
int dpni_get_attributes(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
struct dpni_attr *attr)
{
@@ -103,7 +120,7 @@ int dpni_get_attributes(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_ATTR,
- MC_CMD_PRI_LOW,
+ cmd_flags,
token);
/* send command to mc*/
@@ -118,6 +135,7 @@ int dpni_get_attributes(struct fsl_mc_io *mc_io,
}
int dpni_get_rx_buffer_layout(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
struct dpni_buffer_layout *layout)
{
@@ -126,7 +144,8 @@ int dpni_get_rx_buffer_layout(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_RX_BUFFER_LAYOUT,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
/* send command to mc*/
err = mc_send_command(mc_io, &cmd);
@@ -140,6 +159,7 @@ int dpni_get_rx_buffer_layout(struct fsl_mc_io *mc_io,
}
int dpni_set_rx_buffer_layout(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
const struct dpni_buffer_layout *layout)
{
@@ -147,7 +167,8 @@ int dpni_set_rx_buffer_layout(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_RX_BUFFER_LAYOUT,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
DPNI_CMD_SET_RX_BUFFER_LAYOUT(cmd, layout);
/* send command to mc*/
@@ -155,6 +176,7 @@ int dpni_set_rx_buffer_layout(struct fsl_mc_io *mc_io,
}
int dpni_get_tx_buffer_layout(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
struct dpni_buffer_layout *layout)
{
@@ -163,7 +185,8 @@ int dpni_get_tx_buffer_layout(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_TX_BUFFER_LAYOUT,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
/* send command to mc*/
err = mc_send_command(mc_io, &cmd);
@@ -177,6 +200,7 @@ int dpni_get_tx_buffer_layout(struct fsl_mc_io *mc_io,
}
int dpni_set_tx_buffer_layout(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
const struct dpni_buffer_layout *layout)
{
@@ -184,7 +208,8 @@ int dpni_set_tx_buffer_layout(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_TX_BUFFER_LAYOUT,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
DPNI_CMD_SET_TX_BUFFER_LAYOUT(cmd, layout);
/* send command to mc*/
@@ -192,6 +217,7 @@ int dpni_set_tx_buffer_layout(struct fsl_mc_io *mc_io,
}
int dpni_get_tx_conf_buffer_layout(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
struct dpni_buffer_layout *layout)
{
@@ -200,7 +226,8 @@ int dpni_get_tx_conf_buffer_layout(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_TX_CONF_BUFFER_LAYOUT,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
/* send command to mc*/
err = mc_send_command(mc_io, &cmd);
@@ -214,6 +241,7 @@ int dpni_get_tx_conf_buffer_layout(struct fsl_mc_io *mc_io,
}
int dpni_set_tx_conf_buffer_layout(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
const struct dpni_buffer_layout *layout)
{
@@ -221,21 +249,25 @@ int dpni_set_tx_conf_buffer_layout(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_TX_CONF_BUFFER_LAYOUT,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
DPNI_CMD_SET_TX_CONF_BUFFER_LAYOUT(cmd, layout);
/* send command to mc*/
return mc_send_command(mc_io, &cmd);
}
-int dpni_get_qdid(struct fsl_mc_io *mc_io, uint16_t token, uint16_t *qdid)
+int dpni_get_qdid(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ uint16_t token,
+ uint16_t *qdid)
{
struct mc_command cmd = { 0 };
int err;
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_QDID,
- MC_CMD_PRI_LOW,
+ cmd_flags,
token);
/* send command to mc*/
@@ -250,6 +282,7 @@ int dpni_get_qdid(struct fsl_mc_io *mc_io, uint16_t token, uint16_t *qdid)
}
int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
uint16_t *data_offset)
{
@@ -258,7 +291,8 @@ int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_TX_DATA_OFFSET,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
/* send command to mc*/
err = mc_send_command(mc_io, &cmd);
@@ -272,6 +306,7 @@ int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io,
}
int dpni_get_counter(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
enum dpni_counter counter,
uint64_t *value)
@@ -281,7 +316,8 @@ int dpni_get_counter(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_COUNTER,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
DPNI_CMD_GET_COUNTER(cmd, counter);
/* send command to mc*/
@@ -296,6 +332,7 @@ int dpni_get_counter(struct fsl_mc_io *mc_io,
}
int dpni_set_counter(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
enum dpni_counter counter,
uint64_t value)
@@ -304,7 +341,8 @@ int dpni_set_counter(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_COUNTER,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
DPNI_CMD_SET_COUNTER(cmd, counter, value);
/* send command to mc*/
@@ -312,14 +350,16 @@ int dpni_set_counter(struct fsl_mc_io *mc_io,
}
int dpni_set_link_cfg(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
- const struct dpni_link_cfg *cfg)
+ const struct dpni_link_cfg *cfg)
{
struct mc_command cmd = { 0 };
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_LINK_CFG,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
DPNI_CMD_SET_LINK_CFG(cmd, cfg);
/* send command to mc*/
@@ -327,6 +367,7 @@ int dpni_set_link_cfg(struct fsl_mc_io *mc_io,
}
int dpni_get_link_state(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
struct dpni_link_state *state)
{
@@ -335,7 +376,8 @@ int dpni_get_link_state(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_LINK_STATE,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
/* send command to mc*/
err = mc_send_command(mc_io, &cmd);
@@ -350,6 +392,7 @@ int dpni_get_link_state(struct fsl_mc_io *mc_io,
int dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
const uint8_t mac_addr[6])
{
@@ -357,7 +400,8 @@ int dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_PRIM_MAC,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
DPNI_CMD_SET_PRIMARY_MAC_ADDR(cmd, mac_addr);
/* send command to mc*/
@@ -365,6 +409,7 @@ int dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io,
}
int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
uint8_t mac_addr[6])
{
@@ -373,7 +418,8 @@ int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_PRIM_MAC,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
/* send command to mc*/
err = mc_send_command(mc_io, &cmd);
@@ -387,6 +433,7 @@ int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io,
}
int dpni_add_mac_addr(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
const uint8_t mac_addr[6])
{
@@ -394,7 +441,8 @@ int dpni_add_mac_addr(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_ADD_MAC_ADDR,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
DPNI_CMD_ADD_MAC_ADDR(cmd, mac_addr);
/* send command to mc*/
@@ -402,6 +450,7 @@ int dpni_add_mac_addr(struct fsl_mc_io *mc_io,
}
int dpni_remove_mac_addr(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
const uint8_t mac_addr[6])
{
@@ -409,7 +458,8 @@ int dpni_remove_mac_addr(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_REMOVE_MAC_ADDR,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
DPNI_CMD_REMOVE_MAC_ADDR(cmd, mac_addr);
/* send command to mc*/
@@ -417,6 +467,7 @@ int dpni_remove_mac_addr(struct fsl_mc_io *mc_io,
}
int dpni_set_tx_flow(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
uint16_t *flow_id,
const struct dpni_tx_flow_cfg *cfg)
@@ -426,7 +477,8 @@ int dpni_set_tx_flow(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_TX_FLOW,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
DPNI_CMD_SET_TX_FLOW(cmd, *flow_id, cfg);
/* send command to mc*/
@@ -441,6 +493,7 @@ int dpni_set_tx_flow(struct fsl_mc_io *mc_io,
}
int dpni_get_tx_flow(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
uint16_t flow_id,
struct dpni_tx_flow_attr *attr)
@@ -450,7 +503,8 @@ int dpni_get_tx_flow(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_TX_FLOW,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
DPNI_CMD_GET_TX_FLOW(cmd, flow_id);
/* send command to mc*/
@@ -465,6 +519,7 @@ int dpni_get_tx_flow(struct fsl_mc_io *mc_io,
}
int dpni_set_rx_flow(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
uint8_t tc_id,
uint16_t flow_id,
@@ -474,7 +529,8 @@ int dpni_set_rx_flow(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_RX_FLOW,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
DPNI_CMD_SET_RX_FLOW(cmd, tc_id, flow_id, cfg);
/* send command to mc*/
@@ -482,6 +538,7 @@ int dpni_set_rx_flow(struct fsl_mc_io *mc_io,
}
int dpni_get_rx_flow(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
uint8_t tc_id,
uint16_t flow_id,
@@ -491,7 +548,8 @@ int dpni_get_rx_flow(struct fsl_mc_io *mc_io,
int err;
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_RX_FLOW,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
DPNI_CMD_GET_RX_FLOW(cmd, tc_id, flow_id);
/* send command to mc*/
diff --git a/drivers/net/fsl-mc/dprc.c b/drivers/net/fsl-mc/dprc.c
index d481200..357aa48 100644
--- a/drivers/net/fsl-mc/dprc.c
+++ b/drivers/net/fsl-mc/dprc.c
@@ -11,14 +11,17 @@
#include <fsl-mc/fsl_mc_cmd.h>
#include <fsl-mc/fsl_dprc.h>
-int dprc_get_container_id(struct fsl_mc_io *mc_io, int *container_id)
+int dprc_get_container_id(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ int *container_id)
{
struct mc_command cmd = { 0 };
int err;
/* prepare command */
cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_CONT_ID,
- MC_CMD_PRI_LOW, 0);
+ cmd_flags,
+ 0);
/* send command to mc*/
err = mc_send_command(mc_io, &cmd);
@@ -31,13 +34,16 @@ int dprc_get_container_id(struct fsl_mc_io *mc_io, int *container_id)
return 0;
}
-int dprc_open(struct fsl_mc_io *mc_io, int container_id, uint16_t *token)
+int dprc_open(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ int container_id,
+ uint16_t *token)
{
struct mc_command cmd = { 0 };
int err;
/* prepare command */
- cmd.header = mc_encode_cmd_header(DPRC_CMDID_OPEN, MC_CMD_PRI_LOW,
+ cmd.header = mc_encode_cmd_header(DPRC_CMDID_OPEN, cmd_flags,
0);
DPRC_CMD_OPEN(cmd, container_id);
@@ -52,12 +58,14 @@ int dprc_open(struct fsl_mc_io *mc_io, int container_id, uint16_t *token)
return 0;
}
-int dprc_close(struct fsl_mc_io *mc_io, uint16_t token)
+int dprc_close(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ uint16_t token)
{
struct mc_command cmd = { 0 };
/* prepare command */
- cmd.header = mc_encode_cmd_header(DPRC_CMDID_CLOSE, MC_CMD_PRI_HIGH,
+ cmd.header = mc_encode_cmd_header(DPRC_CMDID_CLOSE, cmd_flags,
token);
/* send command to mc*/
@@ -65,6 +73,7 @@ int dprc_close(struct fsl_mc_io *mc_io, uint16_t token)
}
int dprc_reset_container(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
int child_container_id)
{
@@ -72,7 +81,8 @@ int dprc_reset_container(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPRC_CMDID_RESET_CONT,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
DPRC_CMD_RESET_CONTAINER(cmd, child_container_id);
/* send command to mc*/
@@ -80,6 +90,7 @@ int dprc_reset_container(struct fsl_mc_io *mc_io,
}
int dprc_get_attributes(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
struct dprc_attributes *attr)
{
@@ -88,7 +99,7 @@ int dprc_get_attributes(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_ATTR,
- MC_CMD_PRI_LOW,
+ cmd_flags,
token);
/* send command to mc*/
@@ -102,14 +113,18 @@ int dprc_get_attributes(struct fsl_mc_io *mc_io,
return 0;
}
-int dprc_get_obj_count(struct fsl_mc_io *mc_io, uint16_t token, int *obj_count)
+int dprc_get_obj_count(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ uint16_t token,
+ int *obj_count)
{
struct mc_command cmd = { 0 };
int err;
/* prepare command */
cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_COUNT,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
/* send command to mc*/
err = mc_send_command(mc_io, &cmd);
@@ -123,6 +138,7 @@ int dprc_get_obj_count(struct fsl_mc_io *mc_io, uint16_t token, int *obj_count)
}
int dprc_get_obj(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
int obj_index,
struct dprc_obj_desc *obj_desc)
@@ -132,7 +148,7 @@ int dprc_get_obj(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ,
- MC_CMD_PRI_LOW,
+ cmd_flags,
token);
DPRC_CMD_GET_OBJ(cmd, obj_index);
@@ -148,6 +164,7 @@ int dprc_get_obj(struct fsl_mc_io *mc_io,
}
int dprc_get_res_count(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
char *type,
int *res_count)
@@ -159,7 +176,8 @@ int dprc_get_res_count(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_RES_COUNT,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
DPRC_CMD_GET_RES_COUNT(cmd, type);
/* send command to mc*/
@@ -174,6 +192,7 @@ int dprc_get_res_count(struct fsl_mc_io *mc_io,
}
int dprc_get_res_ids(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
char *type,
struct dprc_res_ids_range_desc *range_desc)
@@ -183,7 +202,8 @@ int dprc_get_res_ids(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_RES_IDS,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
DPRC_CMD_GET_RES_IDS(cmd, range_desc, type);
/* send command to mc*/
@@ -198,6 +218,7 @@ int dprc_get_res_ids(struct fsl_mc_io *mc_io,
}
int dprc_get_obj_region(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
char *obj_type,
int obj_id,
@@ -209,7 +230,8 @@ int dprc_get_obj_region(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_REG,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);
DPRC_CMD_GET_OBJ_REGION(cmd, obj_type, obj_id, region_index);
/* send command to mc*/
@@ -224,23 +246,26 @@ int dprc_get_obj_region(struct fsl_mc_io *mc_io,
}
int dprc_connect(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
const struct dprc_endpoint *endpoint1,
- const struct dprc_endpoint *endpoint2)
+ const struct dprc_endpoint *endpoint2,
+ const struct dprc_connection_cfg *cfg)
{
struct mc_command cmd = { 0 };
/* prepare command */
cmd.header = mc_encode_cmd_header(DPRC_CMDID_CONNECT,
- MC_CMD_PRI_LOW,
+ cmd_flags,
token);
- DPRC_CMD_CONNECT(cmd, endpoint1, endpoint2);
+ DPRC_CMD_CONNECT(cmd, endpoint1, endpoint2, cfg);
/* send command to mc*/
return mc_send_command(mc_io, &cmd);
}
int dprc_disconnect(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
const struct dprc_endpoint *endpoint)
{
@@ -248,7 +273,7 @@ int dprc_disconnect(struct fsl_mc_io *mc_io,
/* prepare command */
cmd.header = mc_encode_cmd_header(DPRC_CMDID_DISCONNECT,
- MC_CMD_PRI_LOW,
+ cmd_flags,
token);
DPRC_CMD_DISCONNECT(cmd, endpoint);
@@ -257,17 +282,18 @@ int dprc_disconnect(struct fsl_mc_io *mc_io,
}
int dprc_get_connection(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
uint16_t token,
- const struct dprc_endpoint *endpoint1,
- struct dprc_endpoint *endpoint2,
- int *state)
+ const struct dprc_endpoint *endpoint1,
+ struct dprc_endpoint *endpoint2,
+ int *state)
{
struct mc_command cmd = { 0 };
int err;
/* prepare command */
cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_CONNECTION,
- MC_CMD_PRI_LOW,
+ cmd_flags,
token);
DPRC_CMD_GET_CONNECTION(cmd, endpoint1);
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index 62a68c2..ea987d7 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -547,7 +547,7 @@ int mc_init(void)
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);
- error = mc_get_version(dflt_mc_io, &mc_ver_info);
+ error = mc_get_version(dflt_mc_io, MC_CMD_NO_FLAGS, &mc_ver_info);
if (error != 0) {
printf("fsl-mc: ERROR: Firmware version check failed (error: %d)\n",
error);
@@ -634,19 +634,21 @@ int dpio_init(struct dprc_obj_desc obj_desc)
dflt_dpio->dpio_id = obj_desc.id;
- err = dpio_open(dflt_mc_io, obj_desc.id, &dflt_dpio_handle);
+ err = dpio_open(dflt_mc_io, MC_CMD_NO_FLAGS, obj_desc.id,
+ &dflt_dpio_handle);
if (err) {
printf("dpio_open() failed\n");
goto err_open;
}
- err = dpio_get_attributes(dflt_mc_io, dflt_dpio_handle, &attr);
+ err = dpio_get_attributes(dflt_mc_io, MC_CMD_NO_FLAGS,
+ dflt_dpio_handle, &attr);
if (err) {
printf("dpio_get_attributes() failed %d\n", err);
goto err_get_attr;
}
- err = dpio_enable(dflt_mc_io, dflt_dpio_handle);
+ err = dpio_enable(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio_handle);
if (err) {
printf("dpio_enable() failed %d\n", err);
goto err_get_enable;
@@ -671,9 +673,9 @@ int dpio_init(struct dprc_obj_desc obj_desc)
err_get_swp_init:
err_get_enable:
- dpio_disable(dflt_mc_io, dflt_dpio_handle);
+ dpio_disable(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio_handle);
err_get_attr:
- dpio_close(dflt_mc_io, dflt_dpio_handle);
+ dpio_close(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio_handle);
err_open:
free(dflt_dpio);
return err;
@@ -710,8 +712,9 @@ int dprc_init_container_obj(struct dprc_obj_desc obj_desc, uint16_t dprc_handle)
} else if (!strcmp(obj_desc.type, "dpni")) {
strcpy(dpni_endpoint.type, obj_desc.type);
dpni_endpoint.id = obj_desc.id;
- error = dprc_get_connection(dflt_mc_io, dprc_handle,
- &dpni_endpoint, &dpmac_endpoint, &state);
+ error = dprc_get_connection(dflt_mc_io, MC_CMD_NO_FLAGS,
+ dprc_handle, &dpni_endpoint,
+ &dpmac_endpoint, &state);
if (!strcmp(dpmac_endpoint.type, "dpmac"))
error = ldpaa_eth_init(obj_desc);
if (error < 0)
@@ -728,7 +731,7 @@ int dprc_scan_container_obj(uint16_t dprc_handle, char *obj_type, int i)
memset((void *)&obj_desc, 0x00, sizeof(struct dprc_obj_desc));
- error = dprc_get_obj(dflt_mc_io, dprc_handle,
+ error = dprc_get_obj(dflt_mc_io, MC_CMD_NO_FLAGS, dprc_handle,
i, &obj_desc);
if (error < 0) {
printf("dprc_get_obj(i=%d) failed: %d\n",
@@ -761,7 +764,8 @@ int fsl_mc_ldpaa_init(bd_t *bis)
if (error < 0)
goto error;
- error = dprc_get_container_id(dflt_mc_io, &container_id);
+ error = dprc_get_container_id(dflt_mc_io, MC_CMD_NO_FLAGS,
+ &container_id);
if (error < 0) {
printf("dprc_get_container_id() failed: %d\n", error);
goto error;
@@ -769,7 +773,8 @@ int fsl_mc_ldpaa_init(bd_t *bis)
debug("fsl-mc: Container id=0x%x\n", container_id);
- error = dprc_open(dflt_mc_io, container_id, &dflt_dprc_handle);
+ error = dprc_open(dflt_mc_io, MC_CMD_NO_FLAGS, container_id,
+ &dflt_dprc_handle);
if (error < 0) {
printf("dprc_open() failed: %d\n", error);
goto error;
@@ -777,7 +782,7 @@ int fsl_mc_ldpaa_init(bd_t *bis)
dprc_opened = true;
error = dprc_get_obj_count(dflt_mc_io,
- dflt_dprc_handle,
+ MC_CMD_NO_FLAGS, dflt_dprc_handle,
&num_child_objects);
if (error < 0) {
printf("dprc_get_obj_count() failed: %d\n", error);
@@ -804,7 +809,7 @@ int fsl_mc_ldpaa_init(bd_t *bis)
}
error:
if (dprc_opened)
- dprc_close(dflt_mc_io, dflt_dprc_handle);
+ dprc_close(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dprc_handle);
return error;
}
@@ -814,17 +819,20 @@ void fsl_mc_ldpaa_exit(bd_t *bis)
int err;
if (get_mc_boot_status() == 0) {
- err = dpio_disable(dflt_mc_io, dflt_dpio_handle);
+ err = dpio_disable(dflt_mc_io, MC_CMD_NO_FLAGS,
+ dflt_dpio_handle);
if (err < 0) {
printf("dpio_disable() failed: %d\n", err);
return;
}
- err = dpio_reset(dflt_mc_io, dflt_dpio_handle);
+ err = dpio_reset(dflt_mc_io, MC_CMD_NO_FLAGS,
+ dflt_dpio_handle);
if (err < 0) {
printf("dpio_reset() failed: %d\n", err);
return;
}
- err = dpio_close(dflt_mc_io, dflt_dpio_handle);
+ err = dpio_close(dflt_mc_io, MC_CMD_NO_FLAGS,
+ dflt_dpio_handle);
if (err < 0) {
printf("dpio_close() failed: %d\n", err);
return;
diff --git a/drivers/net/fsl-mc/mc_sys.c b/drivers/net/fsl-mc/mc_sys.c
index 3fc1f98..2136670 100644
--- a/drivers/net/fsl-mc/mc_sys.c
+++ b/drivers/net/fsl-mc/mc_sys.c
@@ -14,7 +14,7 @@
#include <asm/io.h>
#define MC_CMD_HDR_READ_CMDID(_hdr) \
- ((uint16_t)u64_dec((_hdr), MC_CMD_HDR_CMDID_O, MC_CMD_HDR_CMDID_S))
+ ((uint16_t)mc_dec((_hdr), MC_CMD_HDR_CMDID_O, MC_CMD_HDR_CMDID_S))
/**
* mc_send_command - Send MC command and wait for response
diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c b/drivers/net/ldpaa_eth/ldpaa_eth.c
index 50ca6e4..4de7586 100644
--- a/drivers/net/ldpaa_eth/ldpaa_eth.c
+++ b/drivers/net/ldpaa_eth/ldpaa_eth.c
@@ -240,8 +240,8 @@ static int ldpaa_eth_open(struct eth_device *net_dev, bd_t *bd)
if (err)
goto err_bind;
- err = dpni_get_primary_mac_addr(dflt_mc_io, priv->dpni_handle,
- mac_addr);
+ err = dpni_get_primary_mac_addr(dflt_mc_io, MC_CMD_NO_FLAGS,
+ priv->dpni_handle, mac_addr);
if (err) {
printf("dpni_get_primary_mac_addr() failed\n");
return err;
@@ -268,15 +268,15 @@ static int ldpaa_eth_open(struct eth_device *net_dev, bd_t *bd)
priv->phydev->duplex = DUPLEX_FULL;
#endif
- err = dpni_enable(dflt_mc_io, priv->dpni_handle);
+ err = dpni_enable(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle);
if (err < 0) {
printf("dpni_enable() failed\n");
return err;
}
/* TODO: support multiple Rx flows */
- err = dpni_get_rx_flow(dflt_mc_io, priv->dpni_handle, 0, 0,
- &rx_queue_attr);
+ err = dpni_get_rx_flow(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle,
+ 0, 0, &rx_queue_attr);
if (err) {
printf("dpni_get_rx_flow() failed\n");
goto err_rx_flow;
@@ -284,7 +284,8 @@ static int ldpaa_eth_open(struct eth_device *net_dev, bd_t *bd)
priv->rx_dflt_fqid = rx_queue_attr.fqid;
- err = dpni_get_qdid(dflt_mc_io, priv->dpni_handle, &priv->tx_qdid);
+ err = dpni_get_qdid(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle,
+ &priv->tx_qdid);
if (err) {
printf("dpni_get_qdid() failed\n");
goto err_qdid;
@@ -297,11 +298,11 @@ static int ldpaa_eth_open(struct eth_device *net_dev, bd_t *bd)
err_qdid:
err_rx_flow:
- dpni_disable(dflt_mc_io, priv->dpni_handle);
+ dpni_disable(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle);
err_bind:
ldpaa_dpbp_free();
err_dpbp_setup:
- dpni_close(dflt_mc_io, priv->dpni_handle);
+ dpni_close(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle);
err_dpni_setup:
return err;
}
@@ -315,7 +316,7 @@ static void ldpaa_eth_stop(struct eth_device *net_dev)
(net_dev->state == ETH_STATE_INIT))
return;
/* Stop Tx and Rx traffic */
- err = dpni_disable(dflt_mc_io, priv->dpni_handle);
+ err = dpni_disable(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle);
if (err < 0)
printf("dpni_disable() failed\n");
@@ -324,8 +325,8 @@ static void ldpaa_eth_stop(struct eth_device *net_dev)
#endif
ldpaa_dpbp_free();
- dpni_reset(dflt_mc_io, priv->dpni_handle);
- dpni_close(dflt_mc_io, priv->dpni_handle);
+ dpni_reset(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle);
+ dpni_close(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle);
}
static void ldpaa_dpbp_drain_cnt(int count)
@@ -419,20 +420,21 @@ static int ldpaa_dpbp_setup(void)
{
int err;
- err = dpbp_open(dflt_mc_io, dflt_dpbp->dpbp_attr.id,
+ err = dpbp_open(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpbp->dpbp_attr.id,
&dflt_dpbp->dpbp_handle);
if (err) {
printf("dpbp_open() failed\n");
goto err_open;
}
- err = dpbp_enable(dflt_mc_io, dflt_dpbp->dpbp_handle);
+ err = dpbp_enable(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpbp->dpbp_handle);
if (err) {
printf("dpbp_enable() failed\n");
goto err_enable;
}
- err = dpbp_get_attributes(dflt_mc_io, dflt_dpbp->dpbp_handle,
+ err = dpbp_get_attributes(dflt_mc_io, MC_CMD_NO_FLAGS,
+ dflt_dpbp->dpbp_handle,
&dflt_dpbp->dpbp_attr);
if (err) {
printf("dpbp_get_attributes() failed\n");
@@ -450,9 +452,9 @@ static int ldpaa_dpbp_setup(void)
err_seed:
err_get_attr:
- dpbp_disable(dflt_mc_io, dflt_dpbp->dpbp_handle);
+ dpbp_disable(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpbp->dpbp_handle);
err_enable:
- dpbp_close(dflt_mc_io, dflt_dpbp->dpbp_handle);
+ dpbp_close(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpbp->dpbp_handle);
err_open:
return err;
}
@@ -460,9 +462,9 @@ err_open:
static void ldpaa_dpbp_free(void)
{
ldpaa_dpbp_drain();
- dpbp_disable(dflt_mc_io, dflt_dpbp->dpbp_handle);
- dpbp_reset(dflt_mc_io, dflt_dpbp->dpbp_handle);
- dpbp_close(dflt_mc_io, dflt_dpbp->dpbp_handle);
+ dpbp_disable(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpbp->dpbp_handle);
+ dpbp_reset(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpbp->dpbp_handle);
+ dpbp_close(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpbp->dpbp_handle);
}
static int ldpaa_dpni_setup(struct ldpaa_eth_priv *priv)
@@ -470,14 +472,15 @@ static int ldpaa_dpni_setup(struct ldpaa_eth_priv *priv)
int err;
/* and get a handle for the DPNI this interface is associate with */
- err = dpni_open(dflt_mc_io, priv->dpni_id, &priv->dpni_handle);
+ err = dpni_open(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_id,
+ &priv->dpni_handle);
if (err) {
printf("dpni_open() failed\n");
goto err_open;
}
- err = dpni_get_attributes(dflt_mc_io, priv->dpni_handle,
- &priv->dpni_attrs);
+ err = dpni_get_attributes(dflt_mc_io, MC_CMD_NO_FLAGS,
+ priv->dpni_handle, &priv->dpni_attrs);
if (err) {
printf("dpni_get_attributes() failed (err=%d)\n", err);
goto err_get_attr;
@@ -491,8 +494,8 @@ static int ldpaa_dpni_setup(struct ldpaa_eth_priv *priv)
priv->buf_layout.pass_frame_status = true;
priv->buf_layout.private_data_size = LDPAA_ETH_SWA_SIZE;
/* ...rx, ... */
- err = dpni_set_rx_buffer_layout(dflt_mc_io, priv->dpni_handle,
- &priv->buf_layout);
+ err = dpni_set_rx_buffer_layout(dflt_mc_io, MC_CMD_NO_FLAGS,
+ priv->dpni_handle, &priv->buf_layout);
if (err) {
printf("dpni_set_rx_buffer_layout() failed");
goto err_buf_layout;
@@ -500,8 +503,8 @@ static int ldpaa_dpni_setup(struct ldpaa_eth_priv *priv)
/* ... tx, ... */
priv->buf_layout.options &= ~DPNI_BUF_LAYOUT_OPT_PARSER_RESULT;
- err = dpni_set_tx_buffer_layout(dflt_mc_io, priv->dpni_handle,
- &priv->buf_layout);
+ err = dpni_set_tx_buffer_layout(dflt_mc_io, MC_CMD_NO_FLAGS,
+ priv->dpni_handle, &priv->buf_layout);
if (err) {
printf("dpni_set_tx_buffer_layout() failed");
goto err_buf_layout;
@@ -509,7 +512,8 @@ static int ldpaa_dpni_setup(struct ldpaa_eth_priv *priv)
/* ... tx-confirm. */
priv->buf_layout.options &= ~DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE;
- err = dpni_set_tx_conf_buffer_layout(dflt_mc_io, priv->dpni_handle,
+ err = dpni_set_tx_conf_buffer_layout(dflt_mc_io, MC_CMD_NO_FLAGS,
+ priv->dpni_handle,
&priv->buf_layout);
if (err) {
printf("dpni_set_tx_conf_buffer_layout() failed");
@@ -519,8 +523,8 @@ static int ldpaa_dpni_setup(struct ldpaa_eth_priv *priv)
/* Now that we've set our tx buffer layout, retrieve the minimum
* required tx data offset.
*/
- err = dpni_get_tx_data_offset(dflt_mc_io, priv->dpni_handle,
- &priv->tx_data_offset);
+ err = dpni_get_tx_data_offset(dflt_mc_io, MC_CMD_NO_FLAGS,
+ priv->dpni_handle, &priv->tx_data_offset);
if (err) {
printf("dpni_get_tx_data_offset() failed\n");
goto err_data_offset;
@@ -538,7 +542,7 @@ static int ldpaa_dpni_setup(struct ldpaa_eth_priv *priv)
err_data_offset:
err_buf_layout:
err_get_attr:
- dpni_close(dflt_mc_io, priv->dpni_handle);
+ dpni_close(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle);
err_open:
return err;
}
@@ -552,7 +556,8 @@ static int ldpaa_dpni_bind(struct ldpaa_eth_priv *priv)
pools_params.num_dpbp = 1;
pools_params.pools[0].dpbp_id = (uint16_t)dflt_dpbp->dpbp_attr.id;
pools_params.pools[0].buffer_size = LDPAA_ETH_RX_BUFFER_SIZE;
- err = dpni_set_pools(dflt_mc_io, priv->dpni_handle, &pools_params);
+ err = dpni_set_pools(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle,
+ &pools_params);
if (err) {
printf("dpni_set_pools() failed\n");
return err;
@@ -564,7 +569,7 @@ static int ldpaa_dpni_bind(struct ldpaa_eth_priv *priv)
dflt_tx_flow.options = DPNI_TX_FLOW_OPT_ONLY_TX_ERROR;
dflt_tx_flow.conf_err_cfg.use_default_queue = 0;
dflt_tx_flow.conf_err_cfg.errors_only = 1;
- err = dpni_set_tx_flow(dflt_mc_io, priv->dpni_handle,
+ err = dpni_set_tx_flow(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle,
&priv->tx_flow_id, &dflt_tx_flow);
if (err) {
printf("dpni_set_tx_flow() failed\n");
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 157491c..df50b48 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -526,3 +526,56 @@ int pci_find_cap(struct pci_controller *hose, pci_dev_t dev, int pos, int cap)
}
return 0;
}
+
+/**
+ * pci_find_next_ext_capability - Find an extended capability
+ *
+ * Returns the address of the next matching extended capability structure
+ * within the device's PCI configuration space or 0 if the device does
+ * not support it. Some capabilities can occur several times, e.g., the
+ * vendor-specific capability, and this provides a way to find them all.
+ */
+int pci_find_next_ext_capability(struct pci_controller *hose, pci_dev_t dev,
+ int start, int cap)
+{
+ u32 header;
+ int ttl, pos = PCI_CFG_SPACE_SIZE;
+
+ /* minimum 8 bytes per capability */
+ ttl = (PCI_CFG_SPACE_EXP_SIZE - PCI_CFG_SPACE_SIZE) / 8;
+
+ if (start)
+ pos = start;
+
+ pci_hose_read_config_dword(hose, dev, pos, &header);
+ if (header == 0xffffffff || header == 0)
+ return 0;
+
+ while (ttl-- > 0) {
+ if (PCI_EXT_CAP_ID(header) == cap && pos != start)
+ return pos;
+
+ pos = PCI_EXT_CAP_NEXT(header);
+ if (pos < PCI_CFG_SPACE_SIZE)
+ break;
+
+ pci_hose_read_config_dword(hose, dev, pos, &header);
+ if (header == 0xffffffff || header == 0)
+ break;
+ }
+
+ return 0;
+}
+
+/**
+ * pci_hose_find_ext_capability - Find an extended capability
+ *
+ * Returns the address of the requested extended capability structure
+ * within the device's PCI configuration space or 0 if the device does
+ * not support it.
+ */
+int pci_hose_find_ext_capability(struct pci_controller *hose, pci_dev_t dev,
+ int cap)
+{
+ return pci_find_next_ext_capability(hose, dev, 0, cap);
+}
diff --git a/drivers/pci/pcie_layerscape.c b/drivers/pci/pcie_layerscape.c
index 3ef4975..95cfe8c 100644
--- a/drivers/pci/pcie_layerscape.c
+++ b/drivers/pci/pcie_layerscape.c
@@ -25,6 +25,10 @@
#define CONFIG_SYS_PCI_MEMORY_SIZE (2 * 1024 * 1024 * 1024UL) /* 2G */
#endif
+#ifndef CONFIG_SYS_PCI_EP_MEMORY_BASE
+#define CONFIG_SYS_PCI_EP_MEMORY_BASE CONFIG_SYS_LOAD_ADDR
+#endif
+
/* iATU registers */
#define PCIE_ATU_VIEWPORT 0x900
#define PCIE_ATU_REGION_INBOUND (0x1 << 31)
@@ -41,6 +45,7 @@
#define PCIE_ATU_CR2 0x908
#define PCIE_ATU_ENABLE (0x1 << 31)
#define PCIE_ATU_BAR_MODE_ENABLE (0x1 << 30)
+#define PCIE_ATU_BAR_NUM(bar) ((bar) << 8)
#define PCIE_ATU_LOWER_BASE 0x90C
#define PCIE_ATU_UPPER_BASE 0x910
#define PCIE_ATU_LIMIT 0x914
@@ -52,6 +57,7 @@
/* LUT registers */
#define PCIE_LUT_BASE 0x80000
+#define PCIE_LUT_LCTRL0 0x7F8
#define PCIE_LUT_DBG 0x7FC
#define PCIE_DBI_RO_WR_EN 0x8bc
@@ -65,6 +71,25 @@
#define PCIE_DBI_SIZE 0x100000 /* 1M */
+#define PCIE_LCTRL0_CFG2_ENABLE (1 << 31)
+#define PCIE_LCTRL0_VF(vf) ((vf) << 22)
+#define PCIE_LCTRL0_PF(pf) ((pf) << 16)
+#define PCIE_LCTRL0_VF_ACTIVE (1 << 21)
+#define PCIE_LCTRL0_VAL(pf, vf) (PCIE_LCTRL0_PF(pf) | \
+ PCIE_LCTRL0_VF(vf) | \
+ ((vf) == 0 ? 0 : PCIE_LCTRL0_VF_ACTIVE) | \
+ PCIE_LCTRL0_CFG2_ENABLE)
+
+#define PCIE_NO_SRIOV_BAR_BASE 0x1000
+
+#define PCIE_PF_NUM 2
+#define PCIE_VF_NUM 64
+
+#define PCIE_BAR0_SIZE (4 * 1024) /* 4K */
+#define PCIE_BAR1_SIZE (8 * 1024) /* 8K for MSIX */
+#define PCIE_BAR2_SIZE (4 * 1024) /* 4K */
+#define PCIE_BAR4_SIZE (1 * 1024 * 1024) /* 1M */
+
struct ls_pcie {
int idx;
void __iomem *dbi;
@@ -76,6 +101,7 @@ struct ls_pcie {
struct ls_pcie_info {
unsigned long regs;
int pci_num;
+ u64 phys_base;
u64 cfg0_phys;
u64 cfg0_size;
u64 cfg1_phys;
@@ -91,6 +117,7 @@ struct ls_pcie_info {
#define SET_LS_PCIE_INFO(x, num) \
{ \
x.regs = CONFIG_SYS_PCIE##num##_ADDR; \
+ x.phys_base = CONFIG_SYS_PCIE##num##_PHYS_ADDR; \
x.cfg0_phys = CONFIG_SYS_PCIE_CFG0_PHYS_OFF + \
CONFIG_SYS_PCIE##num##_PHYS_ADDR; \
x.cfg0_size = CONFIG_SYS_PCIE_CFG0_SIZE; \
@@ -197,6 +224,18 @@ static void ls_pcie_iatu_outbound_set(struct ls_pcie *pcie, int idx, int type,
writel(PCIE_ATU_ENABLE, pcie->dbi + PCIE_ATU_CR2);
}
+/* Use bar match mode and MEM type as default */
+static void ls_pcie_iatu_inbound_set(struct ls_pcie *pcie, int idx,
+ int bar, u64 phys)
+{
+ writel(PCIE_ATU_REGION_INBOUND | idx, pcie->dbi + PCIE_ATU_VIEWPORT);
+ writel((u32)phys, pcie->dbi + PCIE_ATU_LOWER_TARGET);
+ writel(phys >> 32, pcie->dbi + PCIE_ATU_UPPER_TARGET);
+ writel(PCIE_ATU_TYPE_MEM, pcie->dbi + PCIE_ATU_CR1);
+ writel(PCIE_ATU_ENABLE | PCIE_ATU_BAR_MODE_ENABLE |
+ PCIE_ATU_BAR_NUM(bar), pcie->dbi + PCIE_ATU_CR2);
+}
+
static void ls_pcie_setup_atu(struct ls_pcie *pcie, struct ls_pcie_info *info)
{
#ifdef DEBUG
@@ -350,6 +389,97 @@ static void ls_pcie_setup_ctrl(struct ls_pcie *pcie,
#endif
}
+static void ls_pcie_ep_setup_atu(struct ls_pcie *pcie,
+ struct ls_pcie_info *info)
+{
+ u64 phys = CONFIG_SYS_PCI_EP_MEMORY_BASE;
+
+ /* ATU 0 : INBOUND : map BAR0 */
+ ls_pcie_iatu_inbound_set(pcie, PCIE_ATU_REGION_INDEX0, 0, phys);
+ /* ATU 1 : INBOUND : map BAR1 */
+ phys += PCIE_BAR1_SIZE;
+ ls_pcie_iatu_inbound_set(pcie, PCIE_ATU_REGION_INDEX1, 1, phys);
+ /* ATU 2 : INBOUND : map BAR2 */
+ phys += PCIE_BAR2_SIZE;
+ ls_pcie_iatu_inbound_set(pcie, PCIE_ATU_REGION_INDEX2, 2, phys);
+ /* ATU 3 : INBOUND : map BAR4 */
+ phys = CONFIG_SYS_PCI_EP_MEMORY_BASE + PCIE_BAR4_SIZE;
+ ls_pcie_iatu_inbound_set(pcie, PCIE_ATU_REGION_INDEX3, 4, phys);
+
+ /* ATU 0 : OUTBOUND : map 4G MEM */
+ ls_pcie_iatu_outbound_set(pcie, PCIE_ATU_REGION_INDEX0,
+ PCIE_ATU_TYPE_MEM,
+ info->phys_base,
+ 0,
+ 4 * 1024 * 1024 * 1024ULL);
+}
+
+/* BAR0 and BAR1 are 32bit BAR2 and BAR4 are 64bit */
+static void ls_pcie_ep_setup_bar(void *bar_base, int bar, u32 size)
+{
+ if (size < 4 * 1024)
+ return;
+
+ switch (bar) {
+ case 0:
+ writel(size - 1, bar_base + PCI_BASE_ADDRESS_0);
+ break;
+ case 1:
+ writel(size - 1, bar_base + PCI_BASE_ADDRESS_1);
+ break;
+ case 2:
+ writel(size - 1, bar_base + PCI_BASE_ADDRESS_2);
+ writel(0, bar_base + PCI_BASE_ADDRESS_3);
+ break;
+ case 4:
+ writel(size - 1, bar_base + PCI_BASE_ADDRESS_4);
+ writel(0, bar_base + PCI_BASE_ADDRESS_5);
+ break;
+ default:
+ break;
+ }
+}
+
+static void ls_pcie_ep_setup_bars(void *bar_base)
+{
+ /* BAR0 - 32bit - 4K configuration */
+ ls_pcie_ep_setup_bar(bar_base, 0, PCIE_BAR0_SIZE);
+ /* BAR1 - 32bit - 8K MSIX*/
+ ls_pcie_ep_setup_bar(bar_base, 1, PCIE_BAR1_SIZE);
+ /* BAR2 - 64bit - 4K MEM desciptor */
+ ls_pcie_ep_setup_bar(bar_base, 2, PCIE_BAR2_SIZE);
+ /* BAR4 - 64bit - 1M MEM*/
+ ls_pcie_ep_setup_bar(bar_base, 4, PCIE_BAR4_SIZE);
+}
+
+static void ls_pcie_setup_ep(struct ls_pcie *pcie, struct ls_pcie_info *info)
+{
+ struct pci_controller *hose = &pcie->hose;
+ pci_dev_t dev = PCI_BDF(hose->first_busno, 0, 0);
+ int sriov;
+
+ sriov = pci_hose_find_ext_capability(hose, dev, PCI_EXT_CAP_ID_SRIOV);
+ if (sriov) {
+ int pf, vf;
+
+ for (pf = 0; pf < PCIE_PF_NUM; pf++) {
+ for (vf = 0; vf <= PCIE_VF_NUM; vf++) {
+ writel(PCIE_LCTRL0_VAL(pf, vf),
+ pcie->dbi + PCIE_LUT_BASE +
+ PCIE_LUT_LCTRL0);
+ ls_pcie_ep_setup_bars(pcie->dbi);
+ ls_pcie_ep_setup_atu(pcie, info);
+ }
+ }
+
+ /* Disable CFG2 */
+ writel(0, pcie->dbi + PCIE_LUT_BASE + PCIE_LUT_LCTRL0);
+ } else {
+ ls_pcie_ep_setup_bars(pcie->dbi + PCIE_NO_SRIOV_BAR_BASE);
+ ls_pcie_ep_setup_atu(pcie, info);
+ }
+}
+
int ls_pcie_init_ctrl(int busno, enum srds_prtcl dev, struct ls_pcie_info *info)
{
struct ls_pcie *pcie;
@@ -426,6 +556,11 @@ int ls_pcie_init_ctrl(int busno, enum srds_prtcl dev, struct ls_pcie_info *info)
printf("PCIe%u: %s ", info->pci_num,
ep_mode ? "Endpoint" : "Root Complex");
+ if (ep_mode)
+ ls_pcie_setup_ep(pcie, info);
+ else
+ ls_pcie_setup_ctrl(pcie, info);
+
linkup = ls_pcie_link_up(pcie);
if (!linkup) {
@@ -443,8 +578,6 @@ int ls_pcie_init_ctrl(int busno, enum srds_prtcl dev, struct ls_pcie_info *info)
if (ep_mode)
return busno;
- ls_pcie_setup_ctrl(pcie, info);
-
pci_register_hose(hose);
hose->last_busno = pci_hose_scan(hose);
diff --git a/drivers/qe/qe.c b/drivers/qe/qe.c
index 84e1433..08620b2 100644
--- a/drivers/qe/qe.c
+++ b/drivers/qe/qe.c
@@ -313,9 +313,10 @@ static void qe_upload_microcode(const void *base,
if (ucode->major || ucode->minor || ucode->revision)
printf("QE: uploading microcode '%s' version %u.%u.%u\n",
- ucode->id, ucode->major, ucode->minor, ucode->revision);
+ (char *)ucode->id, (u16)ucode->major, (u16)ucode->minor,
+ (u16)ucode->revision);
else
- printf("QE: uploading microcode '%s'\n", ucode->id);
+ printf("QE: uploading microcode '%s'\n", (char *)ucode->id);
/* Use auto-increment */
out_be32(&qe_immr->iram.iadd, be32_to_cpu(ucode->iram_offset) |
@@ -434,7 +435,7 @@ int qe_upload_firmware(const struct qe_firmware *firmware)
* saved microcode information and put in the new.
*/
memset(&qe_firmware_info, 0, sizeof(qe_firmware_info));
- strcpy(qe_firmware_info.id, (char *)firmware->id);
+ strncpy(qe_firmware_info.id, (char *)firmware->id, 62);
qe_firmware_info.extended_modes = firmware->extended_modes;
memcpy(qe_firmware_info.vtraps, firmware->vtraps,
sizeof(firmware->vtraps));