layerscape: add ls1088ardb device support
[openwrt/staging/lynxis/omap.git] / target / linux / layerscape / patches-4.4 / 7174-staging-fsl-mc-add-dprc-version-check.patch
1 From 653898b483e5448084b15214a8c20959b418dbe7 Mon Sep 17 00:00:00 2001
2 From: Itai Katz <itai.katz@nxp.com>
3 Date: Mon, 11 Apr 2016 11:56:05 -0500
4 Subject: [PATCH 174/226] staging: fsl-mc: add dprc version check
5
6 The dprc driver supports dprc version 5.0 and above.
7 This patch adds the code to check the version.
8
9 Signed-off-by: Itai Katz <itai.katz@nxp.com>
10 (Stuart: resolved merge conflicts, split dpseci quirk into separate patch)
11 Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
12 Acked-by: German Rivera <german.rivera@nxp.com>
13 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
14 ---
15 drivers/staging/fsl-mc/bus/dprc-cmd.h | 6 +++---
16 drivers/staging/fsl-mc/bus/dprc-driver.c | 19 +++++++++++++++++++
17 drivers/staging/fsl-mc/bus/mc-bus.c | 1 +
18 drivers/staging/fsl-mc/include/mc-private.h | 2 ++
19 4 files changed, 25 insertions(+), 3 deletions(-)
20
21 --- a/drivers/staging/fsl-mc/bus/dprc-cmd.h
22 +++ b/drivers/staging/fsl-mc/bus/dprc-cmd.h
23 @@ -40,9 +40,9 @@
24 #ifndef _FSL_DPRC_CMD_H
25 #define _FSL_DPRC_CMD_H
26
27 -/* DPRC Version */
28 -#define DPRC_VER_MAJOR 5
29 -#define DPRC_VER_MINOR 1
30 +/* Minimal supported DPRC Version */
31 +#define DPRC_MIN_VER_MAJOR 5
32 +#define DPRC_MIN_VER_MINOR 0
33
34 /* Command IDs */
35 #define DPRC_CMDID_CLOSE 0x800
36 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c
37 +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c
38 @@ -693,6 +693,25 @@ static int dprc_probe(struct fsl_mc_devi
39 goto error_cleanup_msi_domain;
40 }
41
42 + error = dprc_get_attributes(mc_dev->mc_io, 0, mc_dev->mc_handle,
43 + &mc_bus->dprc_attr);
44 + if (error < 0) {
45 + dev_err(&mc_dev->dev, "dprc_get_attributes() failed: %d\n",
46 + error);
47 + goto error_cleanup_open;
48 + }
49 +
50 + if (mc_bus->dprc_attr.version.major < DPRC_MIN_VER_MAJOR ||
51 + (mc_bus->dprc_attr.version.major == DPRC_MIN_VER_MAJOR &&
52 + mc_bus->dprc_attr.version.minor < DPRC_MIN_VER_MINOR)) {
53 + dev_err(&mc_dev->dev,
54 + "ERROR: DPRC version %d.%d not supported\n",
55 + mc_bus->dprc_attr.version.major,
56 + mc_bus->dprc_attr.version.minor);
57 + error = -ENOTSUPP;
58 + goto error_cleanup_open;
59 + }
60 +
61 mutex_init(&mc_bus->scan_mutex);
62
63 /*
64 --- a/drivers/staging/fsl-mc/bus/mc-bus.c
65 +++ b/drivers/staging/fsl-mc/bus/mc-bus.c
66 @@ -745,6 +745,7 @@ static int fsl_mc_bus_probe(struct platf
67 goto error_cleanup_mc_io;
68 }
69
70 + memset(&obj_desc, 0, sizeof(struct dprc_obj_desc));
71 error = get_dprc_version(mc_io, container_id,
72 &obj_desc.ver_major, &obj_desc.ver_minor);
73 if (error < 0)
74 --- a/drivers/staging/fsl-mc/include/mc-private.h
75 +++ b/drivers/staging/fsl-mc/include/mc-private.h
76 @@ -94,12 +94,14 @@ struct fsl_mc_resource_pool {
77 * from the physical DPRC.
78 * @irq_resources: Pointer to array of IRQ objects for the IRQ pool
79 * @scan_mutex: Serializes bus scanning
80 + * @dprc_attr: DPRC attributes
81 */
82 struct fsl_mc_bus {
83 struct fsl_mc_device mc_dev;
84 struct fsl_mc_resource_pool resource_pools[FSL_MC_NUM_POOL_TYPES];
85 struct fsl_mc_device_irq *irq_resources;
86 struct mutex scan_mutex; /* serializes bus scanning */
87 + struct dprc_attributes dprc_attr;
88 };
89
90 #define to_fsl_mc_bus(_mc_dev) \