diff options
-rw-r--r-- | arch/powerpc/sysdev/fsl_rio.c | 25 | ||||
-rw-r--r-- | drivers/rapidio/rio.c | 26 | ||||
-rw-r--r-- | include/linux/rio.h | 1 |
3 files changed, 27 insertions, 25 deletions
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c index 576b8066089e..8d26533ba98e 100644 --- a/arch/powerpc/sysdev/fsl_rio.c +++ b/arch/powerpc/sysdev/fsl_rio.c | |||
@@ -1288,28 +1288,6 @@ err_out: | |||
1288 | return rc; | 1288 | return rc; |
1289 | } | 1289 | } |
1290 | 1290 | ||
1291 | static char *cmdline = NULL; | ||
1292 | |||
1293 | static int fsl_rio_get_hdid(int index) | ||
1294 | { | ||
1295 | /* XXX Need to parse multiple entries in some format */ | ||
1296 | if (!cmdline) | ||
1297 | return -1; | ||
1298 | |||
1299 | return simple_strtol(cmdline, NULL, 0); | ||
1300 | } | ||
1301 | |||
1302 | static int fsl_rio_get_cmdline(char *s) | ||
1303 | { | ||
1304 | if (!s) | ||
1305 | return 0; | ||
1306 | |||
1307 | cmdline = s; | ||
1308 | return 1; | ||
1309 | } | ||
1310 | |||
1311 | __setup("riohdid=", fsl_rio_get_cmdline); | ||
1312 | |||
1313 | static inline void fsl_rio_info(struct device *dev, u32 ccsr) | 1291 | static inline void fsl_rio_info(struct device *dev, u32 ccsr) |
1314 | { | 1292 | { |
1315 | const char *str; | 1293 | const char *str; |
@@ -1439,7 +1417,6 @@ int fsl_rio_setup(struct platform_device *dev) | |||
1439 | rc = -ENOMEM; | 1417 | rc = -ENOMEM; |
1440 | goto err_port; | 1418 | goto err_port; |
1441 | } | 1419 | } |
1442 | port->id = 0; | ||
1443 | port->index = 0; | 1420 | port->index = 0; |
1444 | 1421 | ||
1445 | priv = kzalloc(sizeof(struct rio_priv), GFP_KERNEL); | 1422 | priv = kzalloc(sizeof(struct rio_priv), GFP_KERNEL); |
@@ -1470,8 +1447,6 @@ int fsl_rio_setup(struct platform_device *dev) | |||
1470 | priv->dev = &dev->dev; | 1447 | priv->dev = &dev->dev; |
1471 | 1448 | ||
1472 | port->ops = ops; | 1449 | port->ops = ops; |
1473 | port->host_deviceid = fsl_rio_get_hdid(port->id); | ||
1474 | |||
1475 | port->priv = priv; | 1450 | port->priv = priv; |
1476 | port->phys_efptr = 0x100; | 1451 | port->phys_efptr = 0x100; |
1477 | rio_register_mport(port); | 1452 | rio_register_mport(port); |
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c index f861b728f80e..9a7b2168d1d5 100644 --- a/drivers/rapidio/rio.c +++ b/drivers/rapidio/rio.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include "rio.h" | 32 | #include "rio.h" |
33 | 33 | ||
34 | static LIST_HEAD(rio_mports); | 34 | static LIST_HEAD(rio_mports); |
35 | static unsigned char next_portid; | ||
35 | 36 | ||
36 | /** | 37 | /** |
37 | * rio_local_get_device_id - Get the base/extended device id for a port | 38 | * rio_local_get_device_id - Get the base/extended device id for a port |
@@ -1164,8 +1165,33 @@ int __devinit rio_init_mports(void) | |||
1164 | 1165 | ||
1165 | device_initcall_sync(rio_init_mports); | 1166 | device_initcall_sync(rio_init_mports); |
1166 | 1167 | ||
1168 | static int hdids[RIO_MAX_MPORTS + 1]; | ||
1169 | |||
1170 | static int rio_get_hdid(int index) | ||
1171 | { | ||
1172 | if (!hdids[0] || hdids[0] <= index || index >= RIO_MAX_MPORTS) | ||
1173 | return -1; | ||
1174 | |||
1175 | return hdids[index + 1]; | ||
1176 | } | ||
1177 | |||
1178 | static int rio_hdid_setup(char *str) | ||
1179 | { | ||
1180 | (void)get_options(str, ARRAY_SIZE(hdids), hdids); | ||
1181 | return 1; | ||
1182 | } | ||
1183 | |||
1184 | __setup("riohdid=", rio_hdid_setup); | ||
1185 | |||
1167 | void rio_register_mport(struct rio_mport *port) | 1186 | void rio_register_mport(struct rio_mport *port) |
1168 | { | 1187 | { |
1188 | if (next_portid >= RIO_MAX_MPORTS) { | ||
1189 | pr_err("RIO: reached specified max number of mports\n"); | ||
1190 | return; | ||
1191 | } | ||
1192 | |||
1193 | port->id = next_portid++; | ||
1194 | port->host_deviceid = rio_get_hdid(port->id); | ||
1169 | list_add_tail(&port->node, &rio_mports); | 1195 | list_add_tail(&port->node, &rio_mports); |
1170 | } | 1196 | } |
1171 | 1197 | ||
diff --git a/include/linux/rio.h b/include/linux/rio.h index b6bcb1632749..4e37a7cfa726 100644 --- a/include/linux/rio.h +++ b/include/linux/rio.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #define RIO_NO_HOPCOUNT -1 | 24 | #define RIO_NO_HOPCOUNT -1 |
25 | #define RIO_INVALID_DESTID 0xffff | 25 | #define RIO_INVALID_DESTID 0xffff |
26 | 26 | ||
27 | #define RIO_MAX_MPORTS 8 | ||
27 | #define RIO_MAX_MPORT_RESOURCES 16 | 28 | #define RIO_MAX_MPORT_RESOURCES 16 |
28 | #define RIO_MAX_DEV_RESOURCES 16 | 29 | #define RIO_MAX_DEV_RESOURCES 16 |
29 | 30 | ||