generic: mtd: backport SPI_NOR_HAS_LOCK
[openwrt/openwrt.git] / target / linux / layerscape / patches-4.4 / 7188-staging-fsl-mc-properly-set-hwirq-in-msi-set_desc.patch
1 From f5f9462cb947922817225b69240740e637de0149 Mon Sep 17 00:00:00 2001
2 From: Stuart Yoder <stuart.yoder@nxp.com>
3 Date: Wed, 22 Jun 2016 16:40:51 -0500
4 Subject: [PATCH 188/226] staging: fsl-mc: properly set hwirq in msi set_desc
5
6 For an MSI domain the hwirq is an arbitrary but unique
7 id to identify an interrupt. Previously the hwirq was set to
8 the MSI index of the interrupt, but that only works if there is
9 one DPRC. Additional DPRCs require an expanded namespace. Use
10 both the ICID (which is unique per DPRC) and the MSI index to
11 compose a hwirq value.
12
13 Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
14 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
15 ---
16 drivers/staging/fsl-mc/bus/mc-msi.c | 17 ++++++++++++++++-
17 1 file changed, 16 insertions(+), 1 deletion(-)
18
19 --- a/drivers/staging/fsl-mc/bus/mc-msi.c
20 +++ b/drivers/staging/fsl-mc/bus/mc-msi.c
21 @@ -20,11 +20,26 @@
22 #include "../include/mc-sys.h"
23 #include "dprc-cmd.h"
24
25 +/*
26 + * Generate a unique ID identifying the interrupt (only used within the MSI
27 + * irqdomain. Combine the icid with the interrupt index.
28 + */
29 +static irq_hw_number_t fsl_mc_domain_calc_hwirq(struct fsl_mc_device *dev,
30 + struct msi_desc *desc)
31 +{
32 + /*
33 + * Make the base hwirq value for ICID*10000 so it is readable
34 + * as a decimal value in /proc/interrupts.
35 + */
36 + return (irq_hw_number_t)(desc->fsl_mc.msi_index + (dev->icid * 10000));
37 +}
38 +
39 static void fsl_mc_msi_set_desc(msi_alloc_info_t *arg,
40 struct msi_desc *desc)
41 {
42 arg->desc = desc;
43 - arg->hwirq = (irq_hw_number_t)desc->fsl_mc.msi_index;
44 + arg->hwirq = fsl_mc_domain_calc_hwirq(to_fsl_mc_device(desc->dev),
45 + desc);
46 }
47
48 static void fsl_mc_msi_update_dom_ops(struct msi_domain_info *info)