aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2019-03-01 09:03:50 -0500
committerArnd Bergmann <arnd@arndb.de>2019-03-01 09:05:54 -0500
commit8ceb820b69fe6ff58234ff604146a9e88e6c1974 (patch)
tree1e26db2f69aa5ee69971df12fbf5e8a24322870f
parent3473b71e21609c9dfb74d0a5a13d6321d3049c05 (diff)
parentf8b995853444aba9c16c1ccdccdd397527fde96d (diff)
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>
-rw-r--r--drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c7
-rw-r--r--drivers/soc/fsl/Kconfig1
-rw-r--r--drivers/soc/fsl/dpio/dpio-cmd.h5
-rw-r--r--drivers/soc/fsl/dpio/dpio-driver.c52
-rw-r--r--drivers/soc/fsl/dpio/dpio.c16
-rw-r--r--drivers/soc/fsl/dpio/dpio.h5
-rw-r--r--drivers/soc/fsl/dpio/qbman-portal.c4
-rw-r--r--drivers/soc/fsl/guts.c3
-rw-r--r--include/linux/fsl/guts.h2
9 files changed, 88 insertions, 7 deletions
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index c500ea77aaa0..3c03fca83b70 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -2303,9 +2303,14 @@ static int setup_rx_flow(struct dpaa2_eth_priv *priv,
2303 queue.destination.type = DPNI_DEST_DPCON; 2303 queue.destination.type = DPNI_DEST_DPCON;
2304 queue.destination.priority = 1; 2304 queue.destination.priority = 1;
2305 queue.user_context = (u64)(uintptr_t)fq; 2305 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;
2306 err = dpni_set_queue(priv->mc_io, 0, priv->mc_token, 2310 err = dpni_set_queue(priv->mc_io, 0, priv->mc_token,
2307 DPNI_QUEUE_RX, 0, fq->flowid, 2311 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,
2309 &queue); 2314 &queue);
2310 if (err) { 2315 if (err) {
2311 dev_err(dev, "dpni_set_queue(RX) failed\n"); 2316 dev_err(dev, "dpni_set_queue(RX) failed\n");
diff --git a/drivers/soc/fsl/Kconfig b/drivers/soc/fsl/Kconfig
index 8f80e8bbf29e..61f8e1433d0a 100644
--- a/drivers/soc/fsl/Kconfig
+++ b/drivers/soc/fsl/Kconfig
@@ -22,6 +22,7 @@ config FSL_GUTS
22config FSL_MC_DPIO 22config FSL_MC_DPIO
23 tristate "QorIQ DPAA2 DPIO driver" 23 tristate "QorIQ DPAA2 DPIO driver"
24 depends on FSL_MC_BUS 24 depends on FSL_MC_BUS
25 select SOC_BUS
25 help 26 help
26 Driver for the DPAA2 DPIO object. A DPIO provides queue and 27 Driver for the DPAA2 DPIO object. A DPIO provides queue and
27 buffer management facilities for software to interact with 28 buffer management facilities for software to interact with
diff --git a/drivers/soc/fsl/dpio/dpio-cmd.h b/drivers/soc/fsl/dpio/dpio-cmd.h
index 5814d2f395a4..e13fd3ac1939 100644
--- a/drivers/soc/fsl/dpio/dpio-cmd.h
+++ b/drivers/soc/fsl/dpio/dpio-cmd.h
@@ -26,6 +26,7 @@
26#define DPIO_CMDID_DISABLE DPIO_CMD(0x003) 26#define DPIO_CMDID_DISABLE DPIO_CMD(0x003)
27#define DPIO_CMDID_GET_ATTR DPIO_CMD(0x004) 27#define DPIO_CMDID_GET_ATTR DPIO_CMD(0x004)
28#define DPIO_CMDID_RESET DPIO_CMD(0x005) 28#define DPIO_CMDID_RESET DPIO_CMD(0x005)
29#define DPIO_CMDID_SET_STASHING_DEST DPIO_CMD(0x120)
29 30
30struct dpio_cmd_open { 31struct dpio_cmd_open {
31 __le32 dpio_id; 32 __le32 dpio_id;
@@ -47,4 +48,8 @@ struct dpio_rsp_get_attr {
47 __le32 qbman_version; 48 __le32 qbman_version;
48}; 49};
49 50
51struct dpio_stashing_dest {
52 u8 sdest;
53};
54
50#endif /* _FSL_DPIO_CMD_H */ 55#endif /* _FSL_DPIO_CMD_H */
diff --git a/drivers/soc/fsl/dpio/dpio-driver.c b/drivers/soc/fsl/dpio/dpio-driver.c
index a28799b62d53..c0cdc8946031 100644
--- a/drivers/soc/fsl/dpio/dpio-driver.c
+++ b/drivers/soc/fsl/dpio/dpio-driver.c
@@ -14,6 +14,7 @@
14#include <linux/dma-mapping.h> 14#include <linux/dma-mapping.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/sys_soc.h>
17 18
18#include <linux/fsl/mc.h> 19#include <linux/fsl/mc.h>
19#include <soc/fsl/dpaa2-io.h> 20#include <soc/fsl/dpaa2-io.h>
@@ -32,6 +33,46 @@ struct dpio_priv {
32 33
33static cpumask_var_t cpus_unused_mask; 34static cpumask_var_t cpus_unused_mask;
34 35
36static const struct soc_device_attribute ls1088a_soc[] = {
37 {.family = "QorIQ LS1088A"},
38 { /* sentinel */ }
39};
40
41static const struct soc_device_attribute ls2080a_soc[] = {
42 {.family = "QorIQ LS2080A"},
43 { /* sentinel */ }
44};
45
46static const struct soc_device_attribute ls2088a_soc[] = {
47 {.family = "QorIQ LS2088A"},
48 { /* sentinel */ }
49};
50
51static const struct soc_device_attribute lx2160a_soc[] = {
52 {.family = "QorIQ LX2160A"},
53 { /* sentinel */ }
54};
55
56static 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
35static irqreturn_t dpio_irq_handler(int irq_num, void *arg) 76static irqreturn_t dpio_irq_handler(int irq_num, void *arg)
36{ 77{
37 struct device *dev = (struct device *)arg; 78 struct device *dev = (struct device *)arg;
@@ -89,6 +130,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev)
89 int err = -ENOMEM; 130 int err = -ENOMEM;
90 struct device *dev = &dpio_dev->dev; 131 struct device *dev = &dpio_dev->dev;
91 int possible_next_cpu; 132 int possible_next_cpu;
133 int sdest;
92 134
93 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 135 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
94 if (!priv) 136 if (!priv)
@@ -145,6 +187,16 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev)
145 desc.cpu = possible_next_cpu; 187 desc.cpu = possible_next_cpu;
146 cpumask_clear_cpu(possible_next_cpu, cpus_unused_mask); 188 cpumask_clear_cpu(possible_next_cpu, cpus_unused_mask);
147 189
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
148 /* 200 /*
149 * Set the CENA regs to be the cache inhibited area of the portal to 201 * Set the CENA regs to be the cache inhibited area of the portal to
150 * avoid coherency issues if a user migrates to another core. 202 * avoid coherency issues if a user migrates to another core.
diff --git a/drivers/soc/fsl/dpio/dpio.c b/drivers/soc/fsl/dpio/dpio.c
index 521bc6946317..af74c597a675 100644
--- a/drivers/soc/fsl/dpio/dpio.c
+++ b/drivers/soc/fsl/dpio/dpio.c
@@ -166,6 +166,22 @@ int dpio_get_attributes(struct fsl_mc_io *mc_io,
166 return 0; 166 return 0;
167} 167}
168 168
169int 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
169/** 185/**
170 * dpio_get_api_version - Get Data Path I/O API version 186 * dpio_get_api_version - Get Data Path I/O API version
171 * @mc_io: Pointer to MC portal's DPIO object 187 * @mc_io: Pointer to MC portal's DPIO object
diff --git a/drivers/soc/fsl/dpio/dpio.h b/drivers/soc/fsl/dpio/dpio.h
index b2ac4ba4fb8e..da06f7258098 100644
--- a/drivers/soc/fsl/dpio/dpio.h
+++ b/drivers/soc/fsl/dpio/dpio.h
@@ -75,6 +75,11 @@ int dpio_get_attributes(struct fsl_mc_io *mc_io,
75 u16 token, 75 u16 token,
76 struct dpio_attr *attr); 76 struct dpio_attr *attr);
77 77
78int dpio_set_stashing_destination(struct fsl_mc_io *mc_io,
79 u32 cmd_flags,
80 u16 token,
81 u8 dest);
82
78int dpio_get_api_version(struct fsl_mc_io *mc_io, 83int dpio_get_api_version(struct fsl_mc_io *mc_io,
79 u32 cmd_flags, 84 u32 cmd_flags,
80 u16 *major_ver, 85 u16 *major_ver,
diff --git a/drivers/soc/fsl/dpio/qbman-portal.c b/drivers/soc/fsl/dpio/qbman-portal.c
index 5a73397ae79e..d02013556a1b 100644
--- a/drivers/soc/fsl/dpio/qbman-portal.c
+++ b/drivers/soc/fsl/dpio/qbman-portal.c
@@ -169,9 +169,9 @@ struct qbman_swp *qbman_swp_init(const struct qbman_swp_desc *d)
169 3, /* RPM: Valid bit mode, RCR in array mode */ 169 3, /* RPM: Valid bit mode, RCR in array mode */
170 2, /* DCM: Discrete consumption ack mode */ 170 2, /* DCM: Discrete consumption ack mode */
171 3, /* EPM: Valid bit mode, EQCR in array mode */ 171 3, /* EPM: Valid bit mode, EQCR in array mode */
172 0, /* mem stashing drop enable == FALSE */ 172 1, /* mem stashing drop enable == TRUE */
173 1, /* mem stashing priority == TRUE */ 173 1, /* mem stashing priority == TRUE */
174 0, /* mem stashing enable == FALSE */ 174 1, /* mem stashing enable == TRUE */
175 1, /* dequeue stashing priority == TRUE */ 175 1, /* dequeue stashing priority == TRUE */
176 0, /* dequeue stashing enable == FALSE */ 176 0, /* dequeue stashing enable == FALSE */
177 0); /* EQCR_CI stashing priority == FALSE */ 177 0); /* EQCR_CI stashing priority == FALSE */
diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c
index 4f9655087bd7..63f6df86f9e5 100644
--- a/drivers/soc/fsl/guts.c
+++ b/drivers/soc/fsl/guts.c
@@ -115,7 +115,7 @@ static const struct fsl_soc_die_attr *fsl_soc_die_match(
115 return NULL; 115 return NULL;
116} 116}
117 117
118u32 fsl_guts_get_svr(void) 118static u32 fsl_guts_get_svr(void)
119{ 119{
120 u32 svr = 0; 120 u32 svr = 0;
121 121
@@ -129,7 +129,6 @@ u32 fsl_guts_get_svr(void)
129 129
130 return svr; 130 return svr;
131} 131}
132EXPORT_SYMBOL(fsl_guts_get_svr);
133 132
134static int fsl_guts_probe(struct platform_device *pdev) 133static int fsl_guts_probe(struct platform_device *pdev)
135{ 134{
diff --git a/include/linux/fsl/guts.h b/include/linux/fsl/guts.h
index 941b11811f85..1fc0edd71c52 100644
--- a/include/linux/fsl/guts.h
+++ b/include/linux/fsl/guts.h
@@ -135,8 +135,6 @@ struct ccsr_guts {
135 u32 srds2cr1; /* 0x.0f44 - SerDes2 Control Register 0 */ 135 u32 srds2cr1; /* 0x.0f44 - SerDes2 Control Register 0 */
136} __attribute__ ((packed)); 136} __attribute__ ((packed));
137 137
138u32 fsl_guts_get_svr(void);
139
140/* Alternate function signal multiplex control */ 138/* Alternate function signal multiplex control */
141#define MPC85xx_PMUXCR_QE(x) (0x8000 >> (x)) 139#define MPC85xx_PMUXCR_QE(x) (0x8000 >> (x))
142 140