Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

soc: fsl: dpio: configure cache stashing destination

Depending on the SoC version and the CPU id, configure the cache
stashing destination for a specific dpio.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Li Yang <leoyang.li@nxp.com>

authored by

Ioana Ciornei and committed by
Li Yang
51da14e9 390bf02d

+79
+1
drivers/soc/fsl/Kconfig
··· 22 22 config FSL_MC_DPIO 23 23 tristate "QorIQ DPAA2 DPIO driver" 24 24 depends on FSL_MC_BUS 25 + select SOC_BUS 25 26 help 26 27 Driver for the DPAA2 DPIO object. A DPIO provides queue and 27 28 buffer management facilities for software to interact with
+5
drivers/soc/fsl/dpio/dpio-cmd.h
··· 26 26 #define DPIO_CMDID_DISABLE DPIO_CMD(0x003) 27 27 #define DPIO_CMDID_GET_ATTR DPIO_CMD(0x004) 28 28 #define DPIO_CMDID_RESET DPIO_CMD(0x005) 29 + #define DPIO_CMDID_SET_STASHING_DEST DPIO_CMD(0x120) 29 30 30 31 struct dpio_cmd_open { 31 32 __le32 dpio_id; ··· 46 45 __le64 qbman_portal_ci_addr; 47 46 /* cmd word 3 */ 48 47 __le32 qbman_version; 48 + }; 49 + 50 + struct dpio_stashing_dest { 51 + u8 sdest; 49 52 }; 50 53 51 54 #endif /* _FSL_DPIO_CMD_H */
+52
drivers/soc/fsl/dpio/dpio-driver.c
··· 14 14 #include <linux/dma-mapping.h> 15 15 #include <linux/delay.h> 16 16 #include <linux/io.h> 17 + #include <linux/sys_soc.h> 17 18 18 19 #include <linux/fsl/mc.h> 19 20 #include <soc/fsl/dpaa2-io.h> ··· 32 31 }; 33 32 34 33 static cpumask_var_t cpus_unused_mask; 34 + 35 + static const struct soc_device_attribute ls1088a_soc[] = { 36 + {.family = "QorIQ LS1088A"}, 37 + { /* sentinel */ } 38 + }; 39 + 40 + static const struct soc_device_attribute ls2080a_soc[] = { 41 + {.family = "QorIQ LS2080A"}, 42 + { /* sentinel */ } 43 + }; 44 + 45 + static const struct soc_device_attribute ls2088a_soc[] = { 46 + {.family = "QorIQ LS2088A"}, 47 + { /* sentinel */ } 48 + }; 49 + 50 + static const struct soc_device_attribute lx2160a_soc[] = { 51 + {.family = "QorIQ LX2160A"}, 52 + { /* sentinel */ } 53 + }; 54 + 55 + static int dpaa2_dpio_get_cluster_sdest(struct fsl_mc_device *dpio_dev, int cpu) 56 + { 57 + int cluster_base, cluster_size; 58 + 59 + if (soc_device_match(ls1088a_soc)) { 60 + cluster_base = 2; 61 + cluster_size = 4; 62 + } else if (soc_device_match(ls2080a_soc) || 63 + soc_device_match(ls2088a_soc) || 64 + soc_device_match(lx2160a_soc)) { 65 + cluster_base = 0; 66 + cluster_size = 2; 67 + } else { 68 + dev_err(&dpio_dev->dev, "unknown SoC version\n"); 69 + return -1; 70 + } 71 + 72 + return cluster_base + cpu / cluster_size; 73 + } 35 74 36 75 static irqreturn_t dpio_irq_handler(int irq_num, void *arg) 37 76 { ··· 130 89 int err = -ENOMEM; 131 90 struct device *dev = &dpio_dev->dev; 132 91 int possible_next_cpu; 92 + int sdest; 133 93 134 94 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 135 95 if (!priv) ··· 186 144 } 187 145 desc.cpu = possible_next_cpu; 188 146 cpumask_clear_cpu(possible_next_cpu, cpus_unused_mask); 147 + 148 + sdest = dpaa2_dpio_get_cluster_sdest(dpio_dev, desc.cpu); 149 + if (sdest >= 0) { 150 + err = dpio_set_stashing_destination(dpio_dev->mc_io, 0, 151 + dpio_dev->mc_handle, 152 + sdest); 153 + if (err) 154 + dev_err(dev, "dpio_set_stashing_destination failed for cpu%d\n", 155 + desc.cpu); 156 + } 189 157 190 158 /* 191 159 * Set the CENA regs to be the cache inhibited area of the portal to
+16
drivers/soc/fsl/dpio/dpio.c
··· 166 166 return 0; 167 167 } 168 168 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 + 169 185 /** 170 186 * dpio_get_api_version - Get Data Path I/O API version 171 187 * @mc_io: Pointer to MC portal's DPIO object
+5
drivers/soc/fsl/dpio/dpio.h
··· 75 75 u16 token, 76 76 struct dpio_attr *attr); 77 77 78 + int dpio_set_stashing_destination(struct fsl_mc_io *mc_io, 79 + u32 cmd_flags, 80 + u16 token, 81 + u8 dest); 82 + 78 83 int dpio_get_api_version(struct fsl_mc_io *mc_io, 79 84 u32 cmd_flags, 80 85 u16 *major_ver,