[POWERPC] Xilinx: hwicap: Use fixed device major.
Major 259 has been assigned by lanana. Use it. Also, publish /dev/icap[0-k] as the device entries, and register platform devices named 'icap' to be consistent. Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
This commit is contained in:
Родитель
4c58f8fe2e
Коммит
ac64673449
|
@ -36,7 +36,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the code behind /dev/xilinx_icap -- it allows a user-space
|
* This is the code behind /dev/icap* -- it allows a user-space
|
||||||
* application to use the Xilinx ICAP subsystem.
|
* application to use the Xilinx ICAP subsystem.
|
||||||
*
|
*
|
||||||
* The following operations are possible:
|
* The following operations are possible:
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
* user-space application code that uses this device. The simplest
|
* user-space application code that uses this device. The simplest
|
||||||
* way to use this interface is simply:
|
* way to use this interface is simply:
|
||||||
*
|
*
|
||||||
* cp foo.bit /dev/xilinx_icap
|
* cp foo.bit /dev/icap0
|
||||||
*
|
*
|
||||||
* Note that unless foo.bit is an appropriately constructed partial
|
* Note that unless foo.bit is an appropriately constructed partial
|
||||||
* bitstream, this has a high likelyhood of overwriting the design
|
* bitstream, this has a high likelyhood of overwriting the design
|
||||||
|
@ -105,18 +105,14 @@
|
||||||
#include "buffer_icap.h"
|
#include "buffer_icap.h"
|
||||||
#include "fifo_icap.h"
|
#include "fifo_icap.h"
|
||||||
|
|
||||||
#define DRIVER_NAME "xilinx_icap"
|
#define DRIVER_NAME "icap"
|
||||||
|
|
||||||
#define HWICAP_REGS (0x10000)
|
#define HWICAP_REGS (0x10000)
|
||||||
|
|
||||||
/* dynamically allocate device number */
|
#define XHWICAP_MAJOR 259
|
||||||
static int xhwicap_major;
|
#define XHWICAP_MINOR 0
|
||||||
static int xhwicap_minor;
|
|
||||||
#define HWICAP_DEVICES 1
|
#define HWICAP_DEVICES 1
|
||||||
|
|
||||||
module_param(xhwicap_major, int, S_IRUGO);
|
|
||||||
module_param(xhwicap_minor, int, S_IRUGO);
|
|
||||||
|
|
||||||
/* An array, which is set to true when the device is registered. */
|
/* An array, which is set to true when the device is registered. */
|
||||||
static bool probed_devices[HWICAP_DEVICES];
|
static bool probed_devices[HWICAP_DEVICES];
|
||||||
static struct mutex icap_sem;
|
static struct mutex icap_sem;
|
||||||
|
@ -605,7 +601,7 @@ static int __devinit hwicap_setup(struct device *dev, int id,
|
||||||
probed_devices[id] = 1;
|
probed_devices[id] = 1;
|
||||||
mutex_unlock(&icap_sem);
|
mutex_unlock(&icap_sem);
|
||||||
|
|
||||||
devt = MKDEV(xhwicap_major, xhwicap_minor + id);
|
devt = MKDEV(XHWICAP_MAJOR, XHWICAP_MINOR + id);
|
||||||
|
|
||||||
drvdata = kzalloc(sizeof(struct hwicap_drvdata), GFP_KERNEL);
|
drvdata = kzalloc(sizeof(struct hwicap_drvdata), GFP_KERNEL);
|
||||||
if (!drvdata) {
|
if (!drvdata) {
|
||||||
|
@ -710,7 +706,7 @@ static int __devexit hwicap_remove(struct device *dev)
|
||||||
dev_set_drvdata(dev, NULL);
|
dev_set_drvdata(dev, NULL);
|
||||||
|
|
||||||
mutex_lock(&icap_sem);
|
mutex_lock(&icap_sem);
|
||||||
probed_devices[MINOR(dev->devt)-xhwicap_minor] = 0;
|
probed_devices[MINOR(dev->devt)-XHWICAP_MINOR] = 0;
|
||||||
mutex_unlock(&icap_sem);
|
mutex_unlock(&icap_sem);
|
||||||
return 0; /* success */
|
return 0; /* success */
|
||||||
}
|
}
|
||||||
|
@ -850,23 +846,12 @@ static int __init hwicap_module_init(void)
|
||||||
icap_class = class_create(THIS_MODULE, "xilinx_config");
|
icap_class = class_create(THIS_MODULE, "xilinx_config");
|
||||||
mutex_init(&icap_sem);
|
mutex_init(&icap_sem);
|
||||||
|
|
||||||
if (xhwicap_major) {
|
devt = MKDEV(XHWICAP_MAJOR, XHWICAP_MINOR);
|
||||||
devt = MKDEV(xhwicap_major, xhwicap_minor);
|
retval = register_chrdev_region(devt,
|
||||||
retval = register_chrdev_region(
|
HWICAP_DEVICES,
|
||||||
devt,
|
DRIVER_NAME);
|
||||||
HWICAP_DEVICES,
|
if (retval < 0)
|
||||||
DRIVER_NAME);
|
return retval;
|
||||||
if (retval < 0)
|
|
||||||
return retval;
|
|
||||||
} else {
|
|
||||||
retval = alloc_chrdev_region(&devt,
|
|
||||||
xhwicap_minor,
|
|
||||||
HWICAP_DEVICES,
|
|
||||||
DRIVER_NAME);
|
|
||||||
if (retval < 0)
|
|
||||||
return retval;
|
|
||||||
xhwicap_major = MAJOR(devt);
|
|
||||||
}
|
|
||||||
|
|
||||||
retval = platform_driver_register(&hwicap_platform_driver);
|
retval = platform_driver_register(&hwicap_platform_driver);
|
||||||
|
|
||||||
|
@ -891,7 +876,7 @@ static int __init hwicap_module_init(void)
|
||||||
|
|
||||||
static void __exit hwicap_module_cleanup(void)
|
static void __exit hwicap_module_cleanup(void)
|
||||||
{
|
{
|
||||||
dev_t devt = MKDEV(xhwicap_major, xhwicap_minor);
|
dev_t devt = MKDEV(XHWICAP_MAJOR, XHWICAP_MINOR);
|
||||||
|
|
||||||
class_destroy(icap_class);
|
class_destroy(icap_class);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче