* [PATCH 1/3] Xilinx: hwicap: Refactor status handling code.
[not found] <1205775392-32222-1-git-send-email-stephen.neuendorffer@xilinx.com>
@ 2008-03-17 17:36 ` Stephen Neuendorffer
2008-03-17 20:23 ` Grant Likely
[not found] ` <1205775392-32222-2-git-send-email-stephen.neuendorffer@xilinx.com>
1 sibling, 1 reply; 6+ messages in thread
From: Stephen Neuendorffer @ 2008-03-17 17:36 UTC (permalink / raw)
To: grant.likely, git-dev, linuxppc-dev, linux-kernel
Both the buffer-based and fifo-based icap cores have a status
register. Previously, this was only used internally to check whether
transactions have completed. However, the status can be useful to the
main driver as well. This patch exposes these status functions to the
main driver along with some masks for the differnet bits.
Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
---
drivers/char/xilinx_hwicap/buffer_icap.c | 22 ++++---------------
drivers/char/xilinx_hwicap/buffer_icap.h | 5 ++-
drivers/char/xilinx_hwicap/fifo_icap.c | 31 ++++++++++++++++++++-------
drivers/char/xilinx_hwicap/fifo_icap.h | 1 +
drivers/char/xilinx_hwicap/xilinx_hwicap.c | 2 +
drivers/char/xilinx_hwicap/xilinx_hwicap.h | 24 +++++++++++++++++++++
6 files changed, 58 insertions(+), 27 deletions(-)
diff --git a/drivers/char/xilinx_hwicap/buffer_icap.c b/drivers/char/xilinx_hwicap/buffer_icap.c
index f577dae..aa7f796 100644
--- a/drivers/char/xilinx_hwicap/buffer_icap.c
+++ b/drivers/char/xilinx_hwicap/buffer_icap.c
@@ -74,7 +74,7 @@
/**
* buffer_icap_get_status - Get the contents of the status register.
- * @base_address: is the base address of the device
+ * @drvdata: a pointer to the drvdata.
*
* The status register contains the ICAP status and the done bit.
*
@@ -88,9 +88,9 @@
* D1 - Always 1
* D0 - Done bit
**/
-static inline u32 buffer_icap_get_status(void __iomem *base_address)
+u32 buffer_icap_get_status(struct hwicap_drvdata *drvdata)
{
- return in_be32(base_address + XHI_STATUS_REG_OFFSET);
+ return in_be32(drvdata->base_address + XHI_STATUS_REG_OFFSET);
}
/**
@@ -117,20 +117,8 @@ static inline u32 buffer_icap_get_bram(void __iomem *base_address,
**/
static inline bool buffer_icap_busy(void __iomem *base_address)
{
- return (buffer_icap_get_status(base_address) & 1) == XHI_NOT_FINISHED;
-}
-
-/**
- * buffer_icap_busy - Return true if the icap device is not busy
- * @base_address: is the base address of the device
- *
- * The queries the low order bit of the status register, which
- * indicates whether the current configuration or readback operation
- * has completed.
- **/
-static inline bool buffer_icap_done(void __iomem *base_address)
-{
- return (buffer_icap_get_status(base_address) & 1) == XHI_FINISHED;
+ u32 status = in_be32(base_address + XHI_STATUS_REG_OFFSET);
+ return (status & 1) == XHI_NOT_FINISHED;
}
/**
diff --git a/drivers/char/xilinx_hwicap/buffer_icap.h b/drivers/char/xilinx_hwicap/buffer_icap.h
index 0318495..c5b1840 100644
--- a/drivers/char/xilinx_hwicap/buffer_icap.h
+++ b/drivers/char/xilinx_hwicap/buffer_icap.h
@@ -44,8 +44,6 @@
#include <asm/io.h>
#include "xilinx_hwicap.h"
-void buffer_icap_reset(struct hwicap_drvdata *drvdata);
-
/* Loads a partial bitstream from system memory. */
int buffer_icap_set_configuration(struct hwicap_drvdata *drvdata, u32 *data,
u32 Size);
@@ -54,4 +52,7 @@ int buffer_icap_set_configuration(struct hwicap_drvdata *drvdata, u32 *data,
int buffer_icap_get_configuration(struct hwicap_drvdata *drvdata, u32 *data,
u32 Size);
+u32 buffer_icap_get_status(struct hwicap_drvdata *drvdata);
+void buffer_icap_reset(struct hwicap_drvdata *drvdata);
+
#endif
diff --git a/drivers/char/xilinx_hwicap/fifo_icap.c b/drivers/char/xilinx_hwicap/fifo_icap.c
index 6f45dbd..776b505 100644
--- a/drivers/char/xilinx_hwicap/fifo_icap.c
+++ b/drivers/char/xilinx_hwicap/fifo_icap.c
@@ -78,13 +78,6 @@
#define XHI_CR_READ_MASK 0x00000002 /* Read from ICAP to FIFO */
#define XHI_CR_WRITE_MASK 0x00000001 /* Write from FIFO to ICAP */
-/* Status Register (SR) */
-#define XHI_SR_CFGERR_N_MASK 0x00000100 /* Config Error Mask */
-#define XHI_SR_DALIGN_MASK 0x00000080 /* Data Alignment Mask */
-#define XHI_SR_RIP_MASK 0x00000040 /* Read back Mask */
-#define XHI_SR_IN_ABORT_N_MASK 0x00000020 /* Select Map Abort Mask */
-#define XHI_SR_DONE_MASK 0x00000001 /* Done bit Mask */
-
#define XHI_WFO_MAX_VACANCY 1024 /* Max Write FIFO Vacancy, in words */
#define XHI_RFO_MAX_OCCUPANCY 256 /* Max Read FIFO Occupancy, in words */
@@ -152,13 +145,35 @@ static inline void fifo_icap_start_readback(struct hwicap_drvdata *drvdata)
}
/**
+ * fifo_icap_get_status - Get the contents of the status register.
+ * @drvdata: a pointer to the drvdata.
+ *
+ * The status register contains the ICAP status and the done bit.
+ *
+ * D8 - cfgerr
+ * D7 - dalign
+ * D6 - rip
+ * D5 - in_abort_l
+ * D4 - Always 1
+ * D3 - Always 1
+ * D2 - Always 1
+ * D1 - Always 1
+ * D0 - Done bit
+ **/
+u32 fifo_icap_get_status(struct hwicap_drvdata *drvdata)
+{
+ u32 status = in_be32(drvdata->base_address + XHI_SR_OFFSET);
+ dev_dbg(drvdata->dev, "Getting status = %x\n", status);
+ return status;
+}
+
+/**
* fifo_icap_busy - Return true if the ICAP is still processing a transaction.
* @drvdata: a pointer to the drvdata.
**/
static inline u32 fifo_icap_busy(struct hwicap_drvdata *drvdata)
{
u32 status = in_be32(drvdata->base_address + XHI_SR_OFFSET);
- dev_dbg(drvdata->dev, "Getting status = %x\n", status);
return (status & XHI_SR_DONE_MASK) ? 0 : 1;
}
diff --git a/drivers/char/xilinx_hwicap/fifo_icap.h b/drivers/char/xilinx_hwicap/fifo_icap.h
index 4d3068d..ffabd3b 100644
--- a/drivers/char/xilinx_hwicap/fifo_icap.h
+++ b/drivers/char/xilinx_hwicap/fifo_icap.h
@@ -56,6 +56,7 @@ int fifo_icap_set_configuration(
u32 *FrameBuffer,
u32 NumWords);
+u32 fifo_icap_get_status(struct hwicap_drvdata *drvdata);
void fifo_icap_reset(struct hwicap_drvdata *drvdata);
void fifo_icap_flush_fifo(struct hwicap_drvdata *drvdata);
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index 2284fa2..304727d 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -664,12 +664,14 @@ static int __devinit hwicap_setup(struct device *dev, int id,
static struct hwicap_driver_config buffer_icap_config = {
.get_configuration = buffer_icap_get_configuration,
.set_configuration = buffer_icap_set_configuration,
+ .get_status = buffer_icap_get_status,
.reset = buffer_icap_reset,
};
static struct hwicap_driver_config fifo_icap_config = {
.get_configuration = fifo_icap_get_configuration,
.set_configuration = fifo_icap_set_configuration,
+ .get_status = fifo_icap_get_status,
.reset = fifo_icap_reset,
};
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.h b/drivers/char/xilinx_hwicap/xilinx_hwicap.h
index 405fee7..1f9c8b0 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.h
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.h
@@ -65,10 +65,27 @@ struct hwicap_drvdata {
};
struct hwicap_driver_config {
+ /* Read configuration data given by size into the data buffer.
+ Return 0 if successful. */
int (*get_configuration)(struct hwicap_drvdata *drvdata, u32 *data,
u32 size);
+ /* Write configuration data given by size from the data buffer.
+ Return 0 if successful. */
int (*set_configuration)(struct hwicap_drvdata *drvdata, u32 *data,
u32 size);
+ /* Get the status register, bit pattern given by:
+ * D8 - 0 = configuration error
+ * D7 - 1 = alignment found
+ * D6 - 1 = readback in progress
+ * D5 - 0 = abort in progress
+ * D4 - Always 1
+ * D3 - Always 1
+ * D2 - Always 1
+ * D1 - Always 1
+ * D0 - 1 = operation completed
+ */
+ u32 (*get_status)(struct hwicap_drvdata *drvdata);
+ /* Reset the hw */
void (*reset)(struct hwicap_drvdata *drvdata);
};
@@ -163,6 +180,13 @@ struct config_registers {
/* Constant to use for CRC check when CRC has been disabled */
#define XHI_DISABLED_AUTO_CRC 0x0000DEFCUL
+/* Meanings of the bits returned by get_status */
+#define XHI_SR_CFGERR_N_MASK 0x00000100 /* Config Error Mask */
+#define XHI_SR_DALIGN_MASK 0x00000080 /* Data Alignment Mask */
+#define XHI_SR_RIP_MASK 0x00000040 /* Read back Mask */
+#define XHI_SR_IN_ABORT_N_MASK 0x00000020 /* Select Map Abort Mask */
+#define XHI_SR_DONE_MASK 0x00000001 /* Done bit Mask */
+
/**
* hwicap_type_1_read - Generates a Type 1 read packet header.
* @reg: is the address of the register to be read back.
--
1.5.3.4-dirty
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] Xilinx: hwicap: Verify sync before reading idcode.
[not found] ` <1205775392-32222-2-git-send-email-stephen.neuendorffer@xilinx.com>
@ 2008-03-17 17:36 ` Stephen Neuendorffer
2008-03-17 20:18 ` Grant Likely
[not found] ` <1205775392-32222-3-git-send-email-stephen.neuendorffer@xilinx.com>
1 sibling, 1 reply; 6+ messages in thread
From: Stephen Neuendorffer @ 2008-03-17 17:36 UTC (permalink / raw)
To: grant.likely, git-dev, linuxppc-dev, linux-kernel
It appears that in some cases, the sync word might not be recognized
by the hardware correctly. If this happens, then attempting to read
from the port results in an unrecoverable error because of the design
of the FPGA core. This patch updates the code to check the status of
the device before reading the IDCODE, in order to avoid entering this
unrecoverable state. This patch also adds additional NOOP commands
into the sychronization sequence, which appears to be necessary to
avoid the condition on some hardware.
Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
---
drivers/char/xilinx_hwicap/xilinx_hwicap.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index 304727d..5b8d646 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -250,8 +250,26 @@ static int hwicap_get_configuration_register(struct hwicap_drvdata *drvdata,
* Create the data to be written to the ICAP.
*/
buffer[index++] = XHI_DUMMY_PACKET;
+ buffer[index++] = XHI_NOOP_PACKET;
buffer[index++] = XHI_SYNC_PACKET;
buffer[index++] = XHI_NOOP_PACKET;
+ buffer[index++] = XHI_NOOP_PACKET;
+
+ /*
+ * Write the data to the FIFO and initiate the transfer of data present
+ * in the FIFO to the ICAP device.
+ */
+ status = drvdata->config->set_configuration(drvdata,
+ &buffer[0], index);
+ if (status)
+ return status;
+
+ /* If the syncword was not found, then we need to start over. */
+ status = drvdata->config->get_status(drvdata);
+ if ((status & XHI_SR_DALIGN_MASK) != XHI_SR_DALIGN_MASK)
+ return -EIO;
+
+ index = 0;
buffer[index++] = hwicap_type_1_read(reg) | 1;
buffer[index++] = XHI_NOOP_PACKET;
buffer[index++] = XHI_NOOP_PACKET;
--
1.5.3.4-dirty
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] Xilinx: hwicap: Use fixed device major.
[not found] ` <1205775392-32222-3-git-send-email-stephen.neuendorffer@xilinx.com>
@ 2008-03-17 17:36 ` Stephen Neuendorffer
2008-03-17 20:20 ` Grant Likely
0 siblings, 1 reply; 6+ messages in thread
From: Stephen Neuendorffer @ 2008-03-17 17:36 UTC (permalink / raw)
To: grant.likely, git-dev, linuxppc-dev, linux-kernel
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>
---
drivers/char/xilinx_hwicap/xilinx_hwicap.c | 43 +++++++++-------------------
1 files changed, 14 insertions(+), 29 deletions(-)
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index 5b8d646..016f905 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -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.
*
* The following operations are possible:
@@ -67,7 +67,7 @@
* user-space application code that uses this device. The simplest
* 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
* bitstream, this has a high likelyhood of overwriting the design
@@ -105,18 +105,14 @@
#include "buffer_icap.h"
#include "fifo_icap.h"
-#define DRIVER_NAME "xilinx_icap"
+#define DRIVER_NAME "icap"
#define HWICAP_REGS (0x10000)
-/* dynamically allocate device number */
-static int xhwicap_major;
-static int xhwicap_minor;
+#define XHWICAP_MAJOR 259
+#define XHWICAP_MINOR 0
#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. */
static bool probed_devices[HWICAP_DEVICES];
static struct mutex icap_sem;
@@ -605,7 +601,7 @@ static int __devinit hwicap_setup(struct device *dev, int id,
probed_devices[id] = 1;
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);
if (!drvdata) {
@@ -710,7 +706,7 @@ static int __devexit hwicap_remove(struct device *dev)
dev_set_drvdata(dev, NULL);
mutex_lock(&icap_sem);
- probed_devices[MINOR(dev->devt)-xhwicap_minor] = 0;
+ probed_devices[MINOR(dev->devt)-XHWICAP_MINOR] = 0;
mutex_unlock(&icap_sem);
return 0; /* success */
}
@@ -850,23 +846,12 @@ static int __init hwicap_module_init(void)
icap_class = class_create(THIS_MODULE, "xilinx_config");
mutex_init(&icap_sem);
- if (xhwicap_major) {
- devt = MKDEV(xhwicap_major, xhwicap_minor);
- retval = register_chrdev_region(
- devt,
- HWICAP_DEVICES,
- DRIVER_NAME);
- 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);
- }
+ devt = MKDEV(XHWICAP_MAJOR, XHWICAP_MINOR);
+ retval = register_chrdev_region(devt,
+ HWICAP_DEVICES,
+ DRIVER_NAME);
+ if (retval < 0)
+ return retval;
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)
{
- dev_t devt = MKDEV(xhwicap_major, xhwicap_minor);
+ dev_t devt = MKDEV(XHWICAP_MAJOR, XHWICAP_MINOR);
class_destroy(icap_class);
--
1.5.3.4-dirty
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] Xilinx: hwicap: Verify sync before reading idcode.
2008-03-17 17:36 ` [PATCH 2/3] Xilinx: hwicap: Verify sync before reading idcode Stephen Neuendorffer
@ 2008-03-17 20:18 ` Grant Likely
0 siblings, 0 replies; 6+ messages in thread
From: Grant Likely @ 2008-03-17 20:18 UTC (permalink / raw)
To: Stephen Neuendorffer; +Cc: linuxppc-dev, git-dev, linux-kernel
On Mon, Mar 17, 2008 at 11:36 AM, Stephen Neuendorffer
<stephen.neuendorffer@xilinx.com> wrote:
> It appears that in some cases, the sync word might not be recognized
> by the hardware correctly. If this happens, then attempting to read
> from the port results in an unrecoverable error because of the design
> of the FPGA core. This patch updates the code to check the status of
> the device before reading the IDCODE, in order to avoid entering this
> unrecoverable state. This patch also adds additional NOOP commands
> into the sychronization sequence, which appears to be necessary to
> avoid the condition on some hardware.
>
> Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
> ---
> drivers/char/xilinx_hwicap/xilinx_hwicap.c | 18 ++++++++++++++++++
> 1 files changed, 18 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> index 304727d..5b8d646 100644
> --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> @@ -250,8 +250,26 @@ static int hwicap_get_configuration_register(struct hwicap_drvdata *drvdata,
> * Create the data to be written to the ICAP.
> */
> buffer[index++] = XHI_DUMMY_PACKET;
> + buffer[index++] = XHI_NOOP_PACKET;
> buffer[index++] = XHI_SYNC_PACKET;
> buffer[index++] = XHI_NOOP_PACKET;
> + buffer[index++] = XHI_NOOP_PACKET;
> +
> + /*
> + * Write the data to the FIFO and initiate the transfer of data present
> + * in the FIFO to the ICAP device.
> + */
> + status = drvdata->config->set_configuration(drvdata,
> + &buffer[0], index);
> + if (status)
> + return status;
> +
> + /* If the syncword was not found, then we need to start over. */
> + status = drvdata->config->get_status(drvdata);
> + if ((status & XHI_SR_DALIGN_MASK) != XHI_SR_DALIGN_MASK)
> + return -EIO;
> +
> + index = 0;
> buffer[index++] = hwicap_type_1_read(reg) | 1;
> buffer[index++] = XHI_NOOP_PACKET;
> buffer[index++] = XHI_NOOP_PACKET;
> --
> 1.5.3.4-dirty
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] Xilinx: hwicap: Use fixed device major.
2008-03-17 17:36 ` [PATCH 3/3] Xilinx: hwicap: Use fixed device major Stephen Neuendorffer
@ 2008-03-17 20:20 ` Grant Likely
0 siblings, 0 replies; 6+ messages in thread
From: Grant Likely @ 2008-03-17 20:20 UTC (permalink / raw)
To: Stephen Neuendorffer; +Cc: linuxppc-dev, git-dev, linux-kernel
On Mon, Mar 17, 2008 at 11:36 AM, Stephen Neuendorffer
<stephen.neuendorffer@xilinx.com> wrote:
> 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>
Looks good to me
Acked-by: Grant Likely <grant.likely@secretlab.ca>
> ---
> drivers/char/xilinx_hwicap/xilinx_hwicap.c | 43 +++++++++-------------------
> 1 files changed, 14 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> index 5b8d646..016f905 100644
> --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> @@ -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.
> *
> * The following operations are possible:
> @@ -67,7 +67,7 @@
> * user-space application code that uses this device. The simplest
> * 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
> * bitstream, this has a high likelyhood of overwriting the design
> @@ -105,18 +105,14 @@
> #include "buffer_icap.h"
> #include "fifo_icap.h"
>
> -#define DRIVER_NAME "xilinx_icap"
> +#define DRIVER_NAME "icap"
>
> #define HWICAP_REGS (0x10000)
>
> -/* dynamically allocate device number */
> -static int xhwicap_major;
> -static int xhwicap_minor;
> +#define XHWICAP_MAJOR 259
> +#define XHWICAP_MINOR 0
> #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. */
> static bool probed_devices[HWICAP_DEVICES];
> static struct mutex icap_sem;
> @@ -605,7 +601,7 @@ static int __devinit hwicap_setup(struct device *dev, int id,
> probed_devices[id] = 1;
> 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);
> if (!drvdata) {
> @@ -710,7 +706,7 @@ static int __devexit hwicap_remove(struct device *dev)
> dev_set_drvdata(dev, NULL);
>
> mutex_lock(&icap_sem);
> - probed_devices[MINOR(dev->devt)-xhwicap_minor] = 0;
> + probed_devices[MINOR(dev->devt)-XHWICAP_MINOR] = 0;
> mutex_unlock(&icap_sem);
> return 0; /* success */
> }
> @@ -850,23 +846,12 @@ static int __init hwicap_module_init(void)
> icap_class = class_create(THIS_MODULE, "xilinx_config");
> mutex_init(&icap_sem);
>
> - if (xhwicap_major) {
> - devt = MKDEV(xhwicap_major, xhwicap_minor);
> - retval = register_chrdev_region(
> - devt,
> - HWICAP_DEVICES,
> - DRIVER_NAME);
> - 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);
> - }
> + devt = MKDEV(XHWICAP_MAJOR, XHWICAP_MINOR);
> + retval = register_chrdev_region(devt,
> + HWICAP_DEVICES,
> + DRIVER_NAME);
> + if (retval < 0)
> + return retval;
>
> 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)
> {
> - dev_t devt = MKDEV(xhwicap_major, xhwicap_minor);
> + dev_t devt = MKDEV(XHWICAP_MAJOR, XHWICAP_MINOR);
>
> class_destroy(icap_class);
>
> --
> 1.5.3.4-dirty
>
>
>
>
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] Xilinx: hwicap: Refactor status handling code.
2008-03-17 17:36 ` [PATCH 1/3] Xilinx: hwicap: Refactor status handling code Stephen Neuendorffer
@ 2008-03-17 20:23 ` Grant Likely
0 siblings, 0 replies; 6+ messages in thread
From: Grant Likely @ 2008-03-17 20:23 UTC (permalink / raw)
To: Stephen Neuendorffer; +Cc: linuxppc-dev, git-dev, linux-kernel
On Mon, Mar 17, 2008 at 11:36 AM, Stephen Neuendorffer
<stephen.neuendorffer@xilinx.com> wrote:
> Both the buffer-based and fifo-based icap cores have a status
> register. Previously, this was only used internally to check whether
> transactions have completed. However, the status can be useful to the
> main driver as well. This patch exposes these status functions to the
> main driver along with some masks for the differnet bits.
>
> Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-03-17 20:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1205775392-32222-1-git-send-email-stephen.neuendorffer@xilinx.com>
2008-03-17 17:36 ` [PATCH 1/3] Xilinx: hwicap: Refactor status handling code Stephen Neuendorffer
2008-03-17 20:23 ` Grant Likely
[not found] ` <1205775392-32222-2-git-send-email-stephen.neuendorffer@xilinx.com>
2008-03-17 17:36 ` [PATCH 2/3] Xilinx: hwicap: Verify sync before reading idcode Stephen Neuendorffer
2008-03-17 20:18 ` Grant Likely
[not found] ` <1205775392-32222-3-git-send-email-stephen.neuendorffer@xilinx.com>
2008-03-17 17:36 ` [PATCH 3/3] Xilinx: hwicap: Use fixed device major Stephen Neuendorffer
2008-03-17 20:20 ` Grant Likely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).