Skip to content

Commit 8ceb820

Browse files
committed
Merge tag 'soc-fsl-next-v5.1-4' of git://git.kernel.org/pub/scm/linux/kernel/git/leo/linux into arm/drivers
NXP/FSL SoC driver updates for v5.1 take4 DPIO driver - Add support for cache stashing and enable it in dpaa2-eth driver GUTS driver - Make fsl_guts_get_svr() API internal in favor of more generic soc_device_match() * tag 'soc-fsl-next-v5.1-4' of git://git.kernel.org/pub/scm/linux/kernel/git/leo/linux: dpaa2-eth: configure the cache stashing amount on a queue soc: fsl: dpio: configure cache stashing destination soc: fsl: dpio: enable frame data cache stashing per software portal soc: fsl: guts: make fsl_guts_get_svr() static Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2 parents 3473b71 + f8b9958 commit 8ceb820

File tree

9 files changed

+88
-7
lines changed

9 files changed

+88
-7
lines changed

drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2303,9 +2303,14 @@ static int setup_rx_flow(struct dpaa2_eth_priv *priv,
23032303
queue.destination.type = DPNI_DEST_DPCON;
23042304
queue.destination.priority = 1;
23052305
queue.user_context = (u64)(uintptr_t)fq;
2306+
queue.flc.stash_control = 1;
2307+
queue.flc.value &= 0xFFFFFFFFFFFFFFC0;
2308+
/* 01 01 00 - data, annotation, flow context */
2309+
queue.flc.value |= 0x14;
23062310
err = dpni_set_queue(priv->mc_io, 0, priv->mc_token,
23072311
DPNI_QUEUE_RX, 0, fq->flowid,
2308-
DPNI_QUEUE_OPT_USER_CTX | DPNI_QUEUE_OPT_DEST,
2312+
DPNI_QUEUE_OPT_USER_CTX | DPNI_QUEUE_OPT_DEST |
2313+
DPNI_QUEUE_OPT_FLC,
23092314
&queue);
23102315
if (err) {
23112316
dev_err(dev, "dpni_set_queue(RX) failed\n");

drivers/soc/fsl/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ config FSL_GUTS
2222
config FSL_MC_DPIO
2323
tristate "QorIQ DPAA2 DPIO driver"
2424
depends on FSL_MC_BUS
25+
select SOC_BUS
2526
help
2627
Driver for the DPAA2 DPIO object. A DPIO provides queue and
2728
buffer management facilities for software to interact with

drivers/soc/fsl/dpio/dpio-cmd.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#define DPIO_CMDID_DISABLE DPIO_CMD(0x003)
2727
#define DPIO_CMDID_GET_ATTR DPIO_CMD(0x004)
2828
#define DPIO_CMDID_RESET DPIO_CMD(0x005)
29+
#define DPIO_CMDID_SET_STASHING_DEST DPIO_CMD(0x120)
2930

3031
struct dpio_cmd_open {
3132
__le32 dpio_id;
@@ -47,4 +48,8 @@ struct dpio_rsp_get_attr {
4748
__le32 qbman_version;
4849
};
4950

51+
struct dpio_stashing_dest {
52+
u8 sdest;
53+
};
54+
5055
#endif /* _FSL_DPIO_CMD_H */

drivers/soc/fsl/dpio/dpio-driver.c

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/dma-mapping.h>
1515
#include <linux/delay.h>
1616
#include <linux/io.h>
17+
#include <linux/sys_soc.h>
1718

1819
#include <linux/fsl/mc.h>
1920
#include <soc/fsl/dpaa2-io.h>
@@ -32,6 +33,46 @@ struct dpio_priv {
3233

3334
static cpumask_var_t cpus_unused_mask;
3435

36+
static const struct soc_device_attribute ls1088a_soc[] = {
37+
{.family = "QorIQ LS1088A"},
38+
{ /* sentinel */ }
39+
};
40+
41+
static const struct soc_device_attribute ls2080a_soc[] = {
42+
{.family = "QorIQ LS2080A"},
43+
{ /* sentinel */ }
44+
};
45+
46+
static const struct soc_device_attribute ls2088a_soc[] = {
47+
{.family = "QorIQ LS2088A"},
48+
{ /* sentinel */ }
49+
};
50+
51+
static const struct soc_device_attribute lx2160a_soc[] = {
52+
{.family = "QorIQ LX2160A"},
53+
{ /* sentinel */ }
54+
};
55+
56+
static int dpaa2_dpio_get_cluster_sdest(struct fsl_mc_device *dpio_dev, int cpu)
57+
{
58+
int cluster_base, cluster_size;
59+
60+
if (soc_device_match(ls1088a_soc)) {
61+
cluster_base = 2;
62+
cluster_size = 4;
63+
} else if (soc_device_match(ls2080a_soc) ||
64+
soc_device_match(ls2088a_soc) ||
65+
soc_device_match(lx2160a_soc)) {
66+
cluster_base = 0;
67+
cluster_size = 2;
68+
} else {
69+
dev_err(&dpio_dev->dev, "unknown SoC version\n");
70+
return -1;
71+
}
72+
73+
return cluster_base + cpu / cluster_size;
74+
}
75+
3576
static irqreturn_t dpio_irq_handler(int irq_num, void *arg)
3677
{
3778
struct device *dev = (struct device *)arg;
@@ -89,6 +130,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev)
89130
int err = -ENOMEM;
90131
struct device *dev = &dpio_dev->dev;
91132
int possible_next_cpu;
133+
int sdest;
92134

93135
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
94136
if (!priv)
@@ -145,6 +187,16 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev)
145187
desc.cpu = possible_next_cpu;
146188
cpumask_clear_cpu(possible_next_cpu, cpus_unused_mask);
147189

190+
sdest = dpaa2_dpio_get_cluster_sdest(dpio_dev, desc.cpu);
191+
if (sdest >= 0) {
192+
err = dpio_set_stashing_destination(dpio_dev->mc_io, 0,
193+
dpio_dev->mc_handle,
194+
sdest);
195+
if (err)
196+
dev_err(dev, "dpio_set_stashing_destination failed for cpu%d\n",
197+
desc.cpu);
198+
}
199+
148200
/*
149201
* Set the CENA regs to be the cache inhibited area of the portal to
150202
* avoid coherency issues if a user migrates to another core.

drivers/soc/fsl/dpio/dpio.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,22 @@ int dpio_get_attributes(struct fsl_mc_io *mc_io,
166166
return 0;
167167
}
168168

169+
int dpio_set_stashing_destination(struct fsl_mc_io *mc_io,
170+
u32 cmd_flags,
171+
u16 token,
172+
u8 sdest)
173+
{
174+
struct fsl_mc_command cmd = { 0 };
175+
struct dpio_stashing_dest *dpio_cmd;
176+
177+
cmd.header = mc_encode_cmd_header(DPIO_CMDID_SET_STASHING_DEST,
178+
cmd_flags, token);
179+
dpio_cmd = (struct dpio_stashing_dest *)cmd.params;
180+
dpio_cmd->sdest = sdest;
181+
182+
return mc_send_command(mc_io, &cmd);
183+
}
184+
169185
/**
170186
* dpio_get_api_version - Get Data Path I/O API version
171187
* @mc_io: Pointer to MC portal's DPIO object

drivers/soc/fsl/dpio/dpio.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ int dpio_get_attributes(struct fsl_mc_io *mc_io,
7575
u16 token,
7676
struct dpio_attr *attr);
7777

78+
int dpio_set_stashing_destination(struct fsl_mc_io *mc_io,
79+
u32 cmd_flags,
80+
u16 token,
81+
u8 dest);
82+
7883
int dpio_get_api_version(struct fsl_mc_io *mc_io,
7984
u32 cmd_flags,
8085
u16 *major_ver,

drivers/soc/fsl/dpio/qbman-portal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ struct qbman_swp *qbman_swp_init(const struct qbman_swp_desc *d)
169169
3, /* RPM: Valid bit mode, RCR in array mode */
170170
2, /* DCM: Discrete consumption ack mode */
171171
3, /* EPM: Valid bit mode, EQCR in array mode */
172-
0, /* mem stashing drop enable == FALSE */
172+
1, /* mem stashing drop enable == TRUE */
173173
1, /* mem stashing priority == TRUE */
174-
0, /* mem stashing enable == FALSE */
174+
1, /* mem stashing enable == TRUE */
175175
1, /* dequeue stashing priority == TRUE */
176176
0, /* dequeue stashing enable == FALSE */
177177
0); /* EQCR_CI stashing priority == FALSE */

drivers/soc/fsl/guts.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static const struct fsl_soc_die_attr *fsl_soc_die_match(
115115
return NULL;
116116
}
117117

118-
u32 fsl_guts_get_svr(void)
118+
static u32 fsl_guts_get_svr(void)
119119
{
120120
u32 svr = 0;
121121

@@ -129,7 +129,6 @@ u32 fsl_guts_get_svr(void)
129129

130130
return svr;
131131
}
132-
EXPORT_SYMBOL(fsl_guts_get_svr);
133132

134133
static int fsl_guts_probe(struct platform_device *pdev)
135134
{

include/linux/fsl/guts.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@ struct ccsr_guts {
135135
u32 srds2cr1; /* 0x.0f44 - SerDes2 Control Register 0 */
136136
} __attribute__ ((packed));
137137

138-
u32 fsl_guts_get_svr(void);
139-
140138
/* Alternate function signal multiplex control */
141139
#define MPC85xx_PMUXCR_QE(x) (0x8000 >> (x))
142140

0 commit comments

Comments
 (0)