layerscape: make uImage with zImage for 32-bit kernel
[openwrt/openwrt.git] / target / linux / layerscape / patches-4.4 / 7182-staging-fsl-mc-add-support-for-device-table-matching.patch
1 From bd83c4253992d263cb83108e26b4687058f11deb Mon Sep 17 00:00:00 2001
2 From: Stuart Yoder <stuart.yoder@nxp.com>
3 Date: Wed, 22 Jun 2016 16:40:45 -0500
4 Subject: [PATCH 182/226] staging: fsl-mc: add support for device table
5 matching
6
7 Move the definition of fsl_mc_device_id to its proper location in
8 mod_devicetable.h, and add fsl-mc bus support to devicetable-offsets.c
9 and file2alias.c to enable device table matching. With this patch udev
10 based module loading of fsl-mc drivers is supported.
11
12 Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
13 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
14 ---
15 drivers/staging/fsl-mc/include/mc.h | 13 -------------
16 include/linux/mod_devicetable.h | 16 ++++++++++++++++
17 scripts/mod/devicetable-offsets.c | 4 ++++
18 scripts/mod/file2alias.c | 12 ++++++++++++
19 4 files changed, 32 insertions(+), 13 deletions(-)
20
21 --- a/drivers/staging/fsl-mc/include/mc.h
22 +++ b/drivers/staging/fsl-mc/include/mc.h
23 @@ -51,19 +51,6 @@ struct fsl_mc_driver {
24 container_of(_drv, struct fsl_mc_driver, driver)
25
26 /**
27 - * struct fsl_mc_device_id - MC object device Id entry for driver matching
28 - * @vendor: vendor ID
29 - * @obj_type: MC object type
30 - *
31 - * Type of entries in the "device Id" table for MC object devices supported by
32 - * a MC object device driver. The last entry of the table has vendor set to 0x0
33 - */
34 -struct fsl_mc_device_id {
35 - u16 vendor;
36 - const char obj_type[16];
37 -};
38 -
39 -/**
40 * enum fsl_mc_pool_type - Types of allocatable MC bus resources
41 *
42 * Entries in these enum are used as indices in the array of resource
43 --- a/include/linux/mod_devicetable.h
44 +++ b/include/linux/mod_devicetable.h
45 @@ -657,4 +657,20 @@ struct ulpi_device_id {
46 kernel_ulong_t driver_data;
47 };
48
49 +/**
50 + * struct fsl_mc_device_id - MC object device identifier
51 + * @vendor: vendor ID
52 + * @obj_type: MC object type
53 + * @ver_major: MC object version major number
54 + * @ver_minor: MC object version minor number
55 + *
56 + * Type of entries in the "device Id" table for MC object devices supported by
57 + * a MC object device driver. The last entry of the table has vendor set to 0x0
58 + */
59 +struct fsl_mc_device_id {
60 + __u16 vendor;
61 + const char obj_type[16];
62 +};
63 +
64 +
65 #endif /* LINUX_MOD_DEVICETABLE_H */
66 --- a/scripts/mod/devicetable-offsets.c
67 +++ b/scripts/mod/devicetable-offsets.c
68 @@ -202,5 +202,9 @@ int main(void)
69 DEVID_FIELD(hda_device_id, rev_id);
70 DEVID_FIELD(hda_device_id, api_version);
71
72 + DEVID(fsl_mc_device_id);
73 + DEVID_FIELD(fsl_mc_device_id, vendor);
74 + DEVID_FIELD(fsl_mc_device_id, obj_type);
75 +
76 return 0;
77 }
78 --- a/scripts/mod/file2alias.c
79 +++ b/scripts/mod/file2alias.c
80 @@ -1271,6 +1271,18 @@ static int do_hda_entry(const char *file
81 }
82 ADD_TO_DEVTABLE("hdaudio", hda_device_id, do_hda_entry);
83
84 +/* Looks like: fsl-mc:vNdN */
85 +static int do_fsl_mc_entry(const char *filename, void *symval,
86 + char *alias)
87 +{
88 + DEF_FIELD(symval, fsl_mc_device_id, vendor);
89 + DEF_FIELD_ADDR(symval, fsl_mc_device_id, obj_type);
90 +
91 + sprintf(alias, "fsl-mc:v%08Xd%s", vendor, *obj_type);
92 + return 1;
93 +}
94 +ADD_TO_DEVTABLE("fslmc", fsl_mc_device_id, do_fsl_mc_entry);
95 +
96 /* Does namelen bytes of name exactly match the symbol? */
97 static bool sym_is(const char *name, unsigned namelen, const char *symbol)
98 {