diff options
-rw-r--r-- | drivers/rapidio/rio-driver.c | 18 | ||||
-rw-r--r-- | drivers/rapidio/rio-sysfs.c | 10 | ||||
-rw-r--r-- | include/linux/mod_devicetable.h | 19 | ||||
-rw-r--r-- | include/linux/rio.h | 16 | ||||
-rw-r--r-- | include/linux/rio_ids.h | 2 | ||||
-rw-r--r-- | scripts/mod/devicetable-offsets.c | 6 | ||||
-rw-r--r-- | scripts/mod/file2alias.c | 20 |
7 files changed, 74 insertions, 17 deletions
diff --git a/drivers/rapidio/rio-driver.c b/drivers/rapidio/rio-driver.c index a0c875563d76..3e9b6a78ad18 100644 --- a/drivers/rapidio/rio-driver.c +++ b/drivers/rapidio/rio-driver.c | |||
@@ -199,6 +199,23 @@ static int rio_match_bus(struct device *dev, struct device_driver *drv) | |||
199 | out:return 0; | 199 | out:return 0; |
200 | } | 200 | } |
201 | 201 | ||
202 | static int rio_uevent(struct device *dev, struct kobj_uevent_env *env) | ||
203 | { | ||
204 | struct rio_dev *rdev; | ||
205 | |||
206 | if (!dev) | ||
207 | return -ENODEV; | ||
208 | |||
209 | rdev = to_rio_dev(dev); | ||
210 | if (!rdev) | ||
211 | return -ENODEV; | ||
212 | |||
213 | if (add_uevent_var(env, "MODALIAS=rapidio:v%04Xd%04Xav%04Xad%04X", | ||
214 | rdev->vid, rdev->did, rdev->asm_vid, rdev->asm_did)) | ||
215 | return -ENOMEM; | ||
216 | return 0; | ||
217 | } | ||
218 | |||
202 | struct device rio_bus = { | 219 | struct device rio_bus = { |
203 | .init_name = "rapidio", | 220 | .init_name = "rapidio", |
204 | }; | 221 | }; |
@@ -210,6 +227,7 @@ struct bus_type rio_bus_type = { | |||
210 | .bus_attrs = rio_bus_attrs, | 227 | .bus_attrs = rio_bus_attrs, |
211 | .probe = rio_device_probe, | 228 | .probe = rio_device_probe, |
212 | .remove = rio_device_remove, | 229 | .remove = rio_device_remove, |
230 | .uevent = rio_uevent, | ||
213 | }; | 231 | }; |
214 | 232 | ||
215 | /** | 233 | /** |
diff --git a/drivers/rapidio/rio-sysfs.c b/drivers/rapidio/rio-sysfs.c index 0c4473e54f86..9331be646dc3 100644 --- a/drivers/rapidio/rio-sysfs.c +++ b/drivers/rapidio/rio-sysfs.c | |||
@@ -84,6 +84,15 @@ static ssize_t lnext_show(struct device *dev, | |||
84 | return str - buf; | 84 | return str - buf; |
85 | } | 85 | } |
86 | 86 | ||
87 | static ssize_t modalias_show(struct device *dev, | ||
88 | struct device_attribute *attr, char *buf) | ||
89 | { | ||
90 | struct rio_dev *rdev = to_rio_dev(dev); | ||
91 | |||
92 | return sprintf(buf, "rapidio:v%04Xd%04Xav%04Xad%04X\n", | ||
93 | rdev->vid, rdev->did, rdev->asm_vid, rdev->asm_did); | ||
94 | } | ||
95 | |||
87 | struct device_attribute rio_dev_attrs[] = { | 96 | struct device_attribute rio_dev_attrs[] = { |
88 | __ATTR_RO(did), | 97 | __ATTR_RO(did), |
89 | __ATTR_RO(vid), | 98 | __ATTR_RO(vid), |
@@ -93,6 +102,7 @@ struct device_attribute rio_dev_attrs[] = { | |||
93 | __ATTR_RO(asm_rev), | 102 | __ATTR_RO(asm_rev), |
94 | __ATTR_RO(lprev), | 103 | __ATTR_RO(lprev), |
95 | __ATTR_RO(destid), | 104 | __ATTR_RO(destid), |
105 | __ATTR_RO(modalias), | ||
96 | __ATTR_NULL, | 106 | __ATTR_NULL, |
97 | }; | 107 | }; |
98 | 108 | ||
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index b3bd7e737e8b..b62d4af6c667 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
@@ -579,4 +579,23 @@ struct mei_cl_device_id { | |||
579 | kernel_ulong_t driver_info; | 579 | kernel_ulong_t driver_info; |
580 | }; | 580 | }; |
581 | 581 | ||
582 | /* RapidIO */ | ||
583 | |||
584 | #define RIO_ANY_ID 0xffff | ||
585 | |||
586 | /** | ||
587 | * struct rio_device_id - RIO device identifier | ||
588 | * @did: RapidIO device ID | ||
589 | * @vid: RapidIO vendor ID | ||
590 | * @asm_did: RapidIO assembly device ID | ||
591 | * @asm_vid: RapidIO assembly vendor ID | ||
592 | * | ||
593 | * Identifies a RapidIO device based on both the device/vendor IDs and | ||
594 | * the assembly device/vendor IDs. | ||
595 | */ | ||
596 | struct rio_device_id { | ||
597 | __u16 did, vid; | ||
598 | __u16 asm_did, asm_vid; | ||
599 | }; | ||
600 | |||
582 | #endif /* LINUX_MOD_DEVICETABLE_H */ | 601 | #endif /* LINUX_MOD_DEVICETABLE_H */ |
diff --git a/include/linux/rio.h b/include/linux/rio.h index 8d3db1b7b998..e2faf7b8fe80 100644 --- a/include/linux/rio.h +++ b/include/linux/rio.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
21 | #include <linux/device.h> | 21 | #include <linux/device.h> |
22 | #include <linux/rio_regs.h> | 22 | #include <linux/rio_regs.h> |
23 | #include <linux/mod_devicetable.h> | ||
23 | #ifdef CONFIG_RAPIDIO_DMA_ENGINE | 24 | #ifdef CONFIG_RAPIDIO_DMA_ENGINE |
24 | #include <linux/dmaengine.h> | 25 | #include <linux/dmaengine.h> |
25 | #endif | 26 | #endif |
@@ -396,21 +397,6 @@ struct rio_driver { | |||
396 | 397 | ||
397 | #define to_rio_driver(drv) container_of(drv,struct rio_driver, driver) | 398 | #define to_rio_driver(drv) container_of(drv,struct rio_driver, driver) |
398 | 399 | ||
399 | /** | ||
400 | * struct rio_device_id - RIO device identifier | ||
401 | * @did: RIO device ID | ||
402 | * @vid: RIO vendor ID | ||
403 | * @asm_did: RIO assembly device ID | ||
404 | * @asm_vid: RIO assembly vendor ID | ||
405 | * | ||
406 | * Identifies a RIO device based on both the device/vendor IDs and | ||
407 | * the assembly device/vendor IDs. | ||
408 | */ | ||
409 | struct rio_device_id { | ||
410 | u16 did, vid; | ||
411 | u16 asm_did, asm_vid; | ||
412 | }; | ||
413 | |||
414 | union rio_pw_msg { | 400 | union rio_pw_msg { |
415 | struct { | 401 | struct { |
416 | u32 comptag; /* Component Tag CSR */ | 402 | u32 comptag; /* Component Tag CSR */ |
diff --git a/include/linux/rio_ids.h b/include/linux/rio_ids.h index b66d13d1bdc0..2543bc163d54 100644 --- a/include/linux/rio_ids.h +++ b/include/linux/rio_ids.h | |||
@@ -13,8 +13,6 @@ | |||
13 | #ifndef LINUX_RIO_IDS_H | 13 | #ifndef LINUX_RIO_IDS_H |
14 | #define LINUX_RIO_IDS_H | 14 | #define LINUX_RIO_IDS_H |
15 | 15 | ||
16 | #define RIO_ANY_ID 0xffff | ||
17 | |||
18 | #define RIO_VID_FREESCALE 0x0002 | 16 | #define RIO_VID_FREESCALE 0x0002 |
19 | #define RIO_DID_MPC8560 0x0003 | 17 | #define RIO_DID_MPC8560 0x0003 |
20 | 18 | ||
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c index e66d4d258e1a..bb5d115ca671 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c | |||
@@ -177,5 +177,11 @@ int main(void) | |||
177 | DEVID(mei_cl_device_id); | 177 | DEVID(mei_cl_device_id); |
178 | DEVID_FIELD(mei_cl_device_id, name); | 178 | DEVID_FIELD(mei_cl_device_id, name); |
179 | 179 | ||
180 | DEVID(rio_device_id); | ||
181 | DEVID_FIELD(rio_device_id, did); | ||
182 | DEVID_FIELD(rio_device_id, vid); | ||
183 | DEVID_FIELD(rio_device_id, asm_did); | ||
184 | DEVID_FIELD(rio_device_id, asm_vid); | ||
185 | |||
180 | return 0; | 186 | return 0; |
181 | } | 187 | } |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 45f9a3377dcd..d9e67b719f08 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -1145,6 +1145,26 @@ static int do_mei_entry(const char *filename, void *symval, | |||
1145 | } | 1145 | } |
1146 | ADD_TO_DEVTABLE("mei", mei_cl_device_id, do_mei_entry); | 1146 | ADD_TO_DEVTABLE("mei", mei_cl_device_id, do_mei_entry); |
1147 | 1147 | ||
1148 | /* Looks like: rapidio:vNdNavNadN */ | ||
1149 | static int do_rio_entry(const char *filename, | ||
1150 | void *symval, char *alias) | ||
1151 | { | ||
1152 | DEF_FIELD(symval, rio_device_id, did); | ||
1153 | DEF_FIELD(symval, rio_device_id, vid); | ||
1154 | DEF_FIELD(symval, rio_device_id, asm_did); | ||
1155 | DEF_FIELD(symval, rio_device_id, asm_vid); | ||
1156 | |||
1157 | strcpy(alias, "rapidio:"); | ||
1158 | ADD(alias, "v", vid != RIO_ANY_ID, vid); | ||
1159 | ADD(alias, "d", did != RIO_ANY_ID, did); | ||
1160 | ADD(alias, "av", asm_vid != RIO_ANY_ID, asm_vid); | ||
1161 | ADD(alias, "ad", asm_did != RIO_ANY_ID, asm_did); | ||
1162 | |||
1163 | add_wildcard(alias); | ||
1164 | return 1; | ||
1165 | } | ||
1166 | ADD_TO_DEVTABLE("rapidio", rio_device_id, do_rio_entry); | ||
1167 | |||
1148 | /* Does namelen bytes of name exactly match the symbol? */ | 1168 | /* Does namelen bytes of name exactly match the symbol? */ |
1149 | static bool sym_is(const char *name, unsigned namelen, const char *symbol) | 1169 | static bool sym_is(const char *name, unsigned namelen, const char *symbol) |
1150 | { | 1170 | { |