aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuman Anna2019-07-01 14:33:55 -0500
committerSuman Anna2019-07-01 14:33:55 -0500
commit80e8ce38b7ad087765b21cecbd39ffd1dd820905 (patch)
tree08f57b866e297eb80957baa23a573ff47afe7e27
parent7681b35943a16ee1097bdcf644957842111f95bc (diff)
parent3671c56b7309f45f9a8a668af1616bf1980b9aea (diff)
downloadremoteproc-80e8ce38b7ad087765b21cecbd39ffd1dd820905.tar.gz
remoteproc-80e8ce38b7ad087765b21cecbd39ffd1dd820905.tar.xz
remoteproc-80e8ce38b7ad087765b21cecbd39ffd1dd820905.zip
Merge branch 'topic/4.19/pruss' of git://git.ti.com/rpmsg/remoteproc into rproc-linux-4.19.y
Merge in the PRUSS topic branch into the base remoteproc feature branch that pulls in a fix for properly clearing and configuring the PRUSS INTC event-to-channel and channel-to-host interrupt mapping. * 'topic/4.19/pruss' of git://git.ti.com/rpmsg/remoteproc: irqchip/irq-pruss-intc: Fix incorrect macro replacement irqchip/irq-pruss-intc: Fix erroneous channel/host mapping logic irqchip/irq-pruss-intc: Use macros for operations on CMR and HMR TEMP: irqchip/irq-pruss-intc: Allow setting irq affinity for PRU events irqchip/irq-pruss-intc: Reset chained handlers during cleanup Signed-off-by: Suman Anna <s-anna@ti.com>
-rw-r--r--drivers/irqchip/irq-pruss-intc.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/drivers/irqchip/irq-pruss-intc.c b/drivers/irqchip/irq-pruss-intc.c
index b3c63ea3d3b5..b99ccaa6a06b 100644
--- a/drivers/irqchip/irq-pruss-intc.c
+++ b/drivers/irqchip/irq-pruss-intc.c
@@ -52,6 +52,16 @@
52#define PRU_INTC_HINLR(x) (0x1100 + (x) * 4) 52#define PRU_INTC_HINLR(x) (0x1100 + (x) * 4)
53#define PRU_INTC_HIER 0x1500 53#define PRU_INTC_HIER 0x1500
54 54
55/* CMR register bit-field macros */
56#define CMR_EVT_MAP_MASK 0xf
57#define CMR_EVT_MAP_BITS 8
58#define CMR_EVT_PER_REG 4
59
60/* HMR register bit-field macros */
61#define HMR_CH_MAP_MASK 0xf
62#define HMR_CH_MAP_BITS 8
63#define HMR_CH_PER_REG 4
64
55/* HIPIR register bit-fields */ 65/* HIPIR register bit-fields */
56#define INTC_HIPIR_NONE_HINT 0x80000000 66#define INTC_HIPIR_NONE_HINT 0x80000000
57 67
@@ -189,9 +199,11 @@ int pruss_intc_configure(struct pruss *pruss,
189 199
190 intc->config_map.sysev_to_ch[i] = ch; 200 intc->config_map.sysev_to_ch[i] = ch;
191 201
192 idx = i / 4; 202 idx = i / CMR_EVT_PER_REG;
193 val = pruss_intc_read_reg(intc, PRU_INTC_CMR(idx)); 203 val = pruss_intc_read_reg(intc, PRU_INTC_CMR(idx));
194 val |= ch << ((i & 3) * 8); 204 val &= ~(CMR_EVT_MAP_MASK <<
205 ((i % CMR_EVT_PER_REG) * CMR_EVT_MAP_BITS));
206 val |= ch << ((i % CMR_EVT_PER_REG) * CMR_EVT_MAP_BITS);
195 pruss_intc_write_reg(intc, PRU_INTC_CMR(idx), val); 207 pruss_intc_write_reg(intc, PRU_INTC_CMR(idx), val);
196 sysevt_mask |= BIT_ULL(i); 208 sysevt_mask |= BIT_ULL(i);
197 ch_mask |= BIT(ch); 209 ch_mask |= BIT(ch);
@@ -228,10 +240,12 @@ int pruss_intc_configure(struct pruss *pruss,
228 240
229 intc->config_map.ch_to_host[i] = host; 241 intc->config_map.ch_to_host[i] = host;
230 242
231 idx = i / 4; 243 idx = i / HMR_CH_PER_REG;
232 244
233 val = pruss_intc_read_reg(intc, PRU_INTC_HMR(idx)); 245 val = pruss_intc_read_reg(intc, PRU_INTC_HMR(idx));
234 val |= host << ((i & 3) * 8); 246 val &= ~(HMR_CH_MAP_MASK <<
247 ((i % HMR_CH_PER_REG) * HMR_CH_MAP_BITS));
248 val |= host << ((i % HMR_CH_PER_REG) * HMR_CH_MAP_BITS);
235 pruss_intc_write_reg(intc, PRU_INTC_HMR(idx), val); 249 pruss_intc_write_reg(intc, PRU_INTC_HMR(idx), val);
236 250
237 ch_mask |= BIT(i); 251 ch_mask |= BIT(i);
@@ -427,14 +441,15 @@ static int pruss_intc_irq_set_affinity(struct irq_data *data,
427 } 441 }
428 442
429 /* find programmed channel */ 443 /* find programmed channel */
430 ch = pruss_intc_read_reg(intc, PRU_INTC_CMR(data->hwirq / 4)); 444 ch = pruss_intc_read_reg(intc,
431 ch >>= (data->hwirq % 4) * 8; 445 PRU_INTC_CMR(data->hwirq / CMR_EVT_PER_REG));
432 ch &= 0xf; 446 ch >>= (data->hwirq % CMR_EVT_PER_REG) * CMR_EVT_MAP_BITS;
447 ch &= CMR_EVT_MAP_MASK;
433 448
434 /* find programmed host interrupt */ 449 /* find programmed host interrupt */
435 host = pruss_intc_read_reg(intc, PRU_INTC_HMR(ch / 4)); 450 host = pruss_intc_read_reg(intc, PRU_INTC_HMR(ch / HMR_CH_PER_REG));
436 host >>= (ch % 4) * 8; 451 host >>= (ch % HMR_CH_PER_REG) * HMR_CH_MAP_BITS;
437 host &= 0xf; 452 host &= HMR_CH_MAP_MASK;
438 453
439 /* check programmed configuration for sanity */ 454 /* check programmed configuration for sanity */
440 if (ch != sch || host != shost) { 455 if (ch != sch || host != shost) {