Xilinx: hwicap driver
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): 1201805233-15112-1-git-send-email-stephen.neuendorffer@xilinx.com
PATCH 1/1 Xilinx: hwicap driver
This includes code for new fifo-based xps_hwicap in addition to the older opb_hwicap, which has a significantly different interface. The common code between the two drivers is largely shared.
Significant differences exists between this driver and what is supported in the EDK drivers. In particular, most of the architecture-specific code for reconfiguring individual FPGA resources has been removed. This functionality is likely better provided in a user-space support library. In addition, read and write access is supported. In addition, although the xps_hwicap cores support interrupt-driver mode, this driver only supports polled operation, in order to make the code simpler, and since the interrupt processing overhead is likely to slow down the throughput under Linux.
Fixed to add spinlocks, and a few style issues.
--- drivers/char/Kconfig | 7 + drivers/char/Makefile | 1 + drivers/char/xilinx_hwicap/Makefile | 7 + drivers/char/xilinx_hwicap/buffer_icap.c | 380 ++++++++++++ drivers/char/xilinx_hwicap/buffer_icap.h | 57 ++ drivers/char/xilinx_hwicap/fifo_icap.c | 381 ++++++++++++ drivers/char/xilinx_hwicap/fifo_icap.h | 62 ++ drivers/char/xilinx_hwicap/xilinx_hwicap.c | 912 ++++++++++++++++++++++++++++ drivers/char/xilinx_hwicap/xilinx_hwicap.h | 193 ++++++ 9 files changed, 2000 insertions(+), 0 deletions(-) create mode 100644 drivers/char/xilinx_hwicap/Makefile create mode 100644 drivers/char/xilinx_hwicap/buffer_icap.c create mode 100644 drivers/char/xilinx_hwicap/buffer_icap.h create mode 100644 drivers/char/xilinx_hwicap/fifo_icap.c create mode 100644 drivers/char/xilinx_hwicap/fifo_icap.h create mode 100644 drivers/char/xilinx_hwicap/xilinx_hwicap.c create mode 100644 drivers/char/xilinx_hwicap/xilinx_hwicap.h
drivers/char/Kconfig +7 -0
@@ -831,6 +831,13 @@ config DTLK To compile this driver as a module, choose M here: the module will be called dtlk. +config XILINX_HWICAP + tristate "Xilinx HWICAP Support" + depends on XILINX_VIRTEX + help + This option enables support for Xilinx Internal Configuration + Access Port (ICAP) driver. + config R3964 tristate "Siemens R3964 line discipline" ---help---
drivers/char/Makefile +1 -0
@@ -76,6 +76,7 @@ obj-$(CONFIG_EFI_RTC) += efirtc.o obj-$(CONFIG_SGI_DS1286) += ds1286.o obj-$(CONFIG_SGI_IP27_RTC) += ip27-rtc.o obj-$(CONFIG_DS1302) += ds1302.o +obj-$(CONFIG_XILINX_HWICAP) += xilinx_hwicap/ ifeq ($(CONFIG_GENERIC_NVRAM),y) obj-$(CONFIG_NVRAM) += generic_nvram.o else
drivers/char/xilinx_hwicap/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# Makefile for the Xilinx OPB hwicap driver +# + +obj-$(CONFIG_XILINX_HWICAP) += xilinx_hwicap_m.o + +xilinx_hwicap_m-y := xilinx_hwicap.o fifo_icap.o buffer_icap.o
drivers/char/xilinx_hwicap/buffer_icap.c new file +380 -0
380 lines not on this page · raw message
drivers/char/xilinx_hwicap/buffer_icap.h new file +57 -0
57 lines not on this page · raw message
drivers/char/xilinx_hwicap/fifo_icap.c new file +381 -0
381 lines not on this page · raw message
drivers/char/xilinx_hwicap/fifo_icap.h new file +62 -0
62 lines not on this page · raw message
drivers/char/xilinx_hwicap/xilinx_hwicap.c new file +912 -0
912 lines not on this page · raw message
drivers/char/xilinx_hwicap/xilinx_hwicap.h new file +193 -0
193 lines not on this page · raw message
Signature · 1 line
1.5.3.4-dirty
Quoted 14 lines · Stephen Neuendorffer
This includes code for new fifo-based
xps_hwicapin addition to the olderopb_hwicap, which has a significantly different interface. The common code between the two drivers is largely shared.Significant differences exists between this driver and what is supported in the EDK drivers. In particular, most of the architecture-specific code for reconfiguring individual FPGA resources has been removed. This functionality is likely better provided in a user-space support library. In addition, read and write access is supported. In addition, although the
xps_hwicapcores support interrupt-driver mode, this driver only supports polled operation, in order to make the code simpler, and since the interrupt processing overhead is likely to slow down the throughput under Linux.
Quoted 3 lines
Signed-off-by Stephen Neuendorffer <[email protected]>Fixed to add spinlocks, and a few style issues.
You're probably better off using a semaphore, or more specifically a MUTEX, to protect the whole fop instead of a spin lock and the flags. The semantics are simpler if do it with a mutex and the function can sleep while holding it.
Cheers,
g.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Nevermind... I posted this too fast and screwed up the spinlocks.
-----Original Message-----
From: Stephen Neuendorffer [mailto:[email protected]]
Sent: Thu 1/31/2008 5:02 PM
To: [email protected]; [email protected]; [email protected]
Cc: Stephen Neuendorffer
Subject: [PATCH] [POWERPC] Xilinx: hwicap driver
This includes code for new fifo-based xps_hwicap in addition to the older opb_hwicap, which has a significantly different interface. The common code between the two drivers is largely shared.
Significant differences exists between this driver and what is supported in the EDK drivers. In particular, most of the architecture-specific code for reconfiguring individual FPGA resources has been removed. This functionality is likely better provided in a user-space support library. In addition, read and write access is supported. In addition, although the xps_hwicap cores support interrupt-driver mode, this driver only supports polled operation, in order to make the code simpler, and since the interrupt processing overhead is likely to slow down the throughput under Linux.
Fixed to add spinlocks, and a few style issues.
--- drivers/char/Kconfig | 7 + drivers/char/Makefile | 1 + drivers/char/xilinx_hwicap/Makefile | 7 + drivers/char/xilinx_hwicap/buffer_icap.c | 380 ++++++++++++ drivers/char/xilinx_hwicap/buffer_icap.h | 57 ++ drivers/char/xilinx_hwicap/fifo_icap.c | 381 ++++++++++++ drivers/char/xilinx_hwicap/fifo_icap.h | 62 ++ drivers/char/xilinx_hwicap/xilinx_hwicap.c | 912 ++++++++++++++++++++++++++++ drivers/char/xilinx_hwicap/xilinx_hwicap.h | 193 ++++++ 9 files changed, 2000 insertions(+), 0 deletions(-) create mode 100644 drivers/char/xilinx_hwicap/Makefile create mode 100644 drivers/char/xilinx_hwicap/buffer_icap.c create mode 100644 drivers/char/xilinx_hwicap/buffer_icap.h create mode 100644 drivers/char/xilinx_hwicap/fifo_icap.c create mode 100644 drivers/char/xilinx_hwicap/fifo_icap.h create mode 100644 drivers/char/xilinx_hwicap/xilinx_hwicap.c create mode 100644 drivers/char/xilinx_hwicap/xilinx_hwicap.h
drivers/char/Kconfig +7 -0
@@ -831,6 +831,13 @@ config DTLK To compile this driver as a module, choose M here: the module will be called dtlk. +config XILINX_HWICAP + tristate "Xilinx HWICAP Support" + depends on XILINX_VIRTEX + help + This option enables support for Xilinx Internal Configuration + Access Port (ICAP) driver. + config R3964 tristate "Siemens R3964 line discipline" ---help---
drivers/char/Makefile +1 -0
@@ -76,6 +76,7 @@ obj-$(CONFIG_EFI_RTC) += efirtc.o obj-$(CONFIG_SGI_DS1286) += ds1286.o obj-$(CONFIG_SGI_IP27_RTC) += ip27-rtc.o obj-$(CONFIG_DS1302) += ds1302.o +obj-$(CONFIG_XILINX_HWICAP) += xilinx_hwicap/ ifeq ($(CONFIG_GENERIC_NVRAM),y) obj-$(CONFIG_NVRAM) += generic_nvram.o else
drivers/char/xilinx_hwicap/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# Makefile for the Xilinx OPB hwicap driver +# + +obj-$(CONFIG_XILINX_HWICAP) += xilinx_hwicap_m.o + +xilinx_hwicap_m-y := xilinx_hwicap.o fifo_icap.o buffer_icap.o
drivers/char/xilinx_hwicap/buffer_icap.c new file +380 -0
380 lines not on this page · raw message
drivers/char/xilinx_hwicap/buffer_icap.h new file +57 -0
57 lines not on this page · raw message
drivers/char/xilinx_hwicap/fifo_icap.c new file +381 -0
381 lines not on this page · raw message
drivers/char/xilinx_hwicap/fifo_icap.h new file +62 -0
62 lines not on this page · raw message
drivers/char/xilinx_hwicap/xilinx_hwicap.c new file +912 -0
912 lines not on this page · raw message
drivers/char/xilinx_hwicap/xilinx_hwicap.h new file +193 -0
193 lines not on this page · raw message
Signature · 1 line
1.5.3.4-dirty
Quoted 4 lines · Stephen Neuendorffer
drivers/char/xilinx_hwicap/xilinx_hwicap.c new file +3
-0+static ssize_t +hwicap_read (struct file *file,char *buf,size_t count,loff_t *ppos) +{
drivers/char/xilinx_hwicap/xilinx_hwicap.c line 360
Quoted 10 lines
drivers/char/xilinx_hwicap/xilinx_hwicap.c new file +10
-0+struct hwicap_drvdata *drvdata = file->private_data; +ssize_t bytes_to_read =0 ; +u32 *kbuf; +u32 words; +u32 bytes_remaining; +int status; + +spin_lock (&hwicap_spinlock); +if (drvdata->is_accessing) +return -EBUSY ;
Need to unlock before returning (several places in this patch).
Thanks,
I realized that on the way home.. That's what I get for trying to finish something quickly before leaving.. :)
Steve
Quoted 5 lines
-----Original Message-----
From: Nathan Lynch [mailto:[email protected]]
Sent: Thursday, January 31, 2008 9:56 PM
To: Stephen Neuendorffer
Cc: [email protected]; [email protected];
Quoted 6 lines
Subject: Re: [PATCH] [POWERPC] Xilinx: hwicap driver =20
Review
Quoted 3 lines · Stephen Neuendorffer
(quoted diff) +2
-0+static ssize_t +hwicap_read(struct file *file, char *buf, size_t count, loff_t
*ppos)
Quoted 14 lines
drivers/char/xilinx_hwicap/xilinx_hwicap.c line 360
Quoted 11 lines
drivers/char/xilinx_hwicap/xilinx_hwicap.c new file +11
-0+{ + struct hwicap_drvdata *drvdata =3D file->private_data; + ssize_t bytes_to_read =3D 0; +u32 *kbuf; +u32 words; +u32 bytes_remaining; +int status; + +spin_lock (&hwicap_spinlock); +if (drvdata->is_accessing) +return -EBUSY ;=20
Need to unlock before returning (several places in this patch). =20
PATCH 1/1 Xilinx: hwicap driver
In reply to a message not in the archiveThis includes code for new fifo-based xps_hwicap in addition to the older opb_hwicap, which has a significantly different interface. The common code between the two drivers is largely shared.
Significant differences exists between this driver and what is supported in the EDK drivers. In particular, most of the architecture-specific code for reconfiguring individual FPGA resources has been removed. This functionality is likely better provided in a user-space support library. In addition, read and write access is supported. In addition, although the xps_hwicap cores support interrupt-driver mode, this driver only supports polled operation, in order to make the code simpler, and since the interrupt processing overhead is likely to slow down the throughput under Linux.
Fixed to add mutexes, and a few style issues.
--- drivers/char/Kconfig | 7 + drivers/char/Makefile | 1 + drivers/char/xilinx_hwicap/Makefile | 7 + drivers/char/xilinx_hwicap/buffer_icap.c | 380 ++++++++++++ drivers/char/xilinx_hwicap/buffer_icap.h | 57 ++ drivers/char/xilinx_hwicap/fifo_icap.c | 381 ++++++++++++ drivers/char/xilinx_hwicap/fifo_icap.h | 62 ++ drivers/char/xilinx_hwicap/xilinx_hwicap.c | 900 ++++++++++++++++++++++++++++ drivers/char/xilinx_hwicap/xilinx_hwicap.h | 193 ++++++ 9 files changed, 1988 insertions(+), 0 deletions(-) create mode 100644 drivers/char/xilinx_hwicap/Makefile create mode 100644 drivers/char/xilinx_hwicap/buffer_icap.c create mode 100644 drivers/char/xilinx_hwicap/buffer_icap.h create mode 100644 drivers/char/xilinx_hwicap/fifo_icap.c create mode 100644 drivers/char/xilinx_hwicap/fifo_icap.h create mode 100644 drivers/char/xilinx_hwicap/xilinx_hwicap.c create mode 100644 drivers/char/xilinx_hwicap/xilinx_hwicap.h
drivers/char/Kconfig +7 -0
@@ -831,6 +831,13 @@ config DTLK To compile this driver as a module, choose M here: the module will be called dtlk. +config XILINX_HWICAP + tristate "Xilinx HWICAP Support" + depends on XILINX_VIRTEX + help + This option enables support for Xilinx Internal Configuration + Access Port (ICAP) driver. + config R3964 tristate "Siemens R3964 line discipline" ---help---
drivers/char/Makefile +1 -0
@@ -76,6 +76,7 @@ obj-$(CONFIG_EFI_RTC) += efirtc.o obj-$(CONFIG_SGI_DS1286) += ds1286.o obj-$(CONFIG_SGI_IP27_RTC) += ip27-rtc.o obj-$(CONFIG_DS1302) += ds1302.o +obj-$(CONFIG_XILINX_HWICAP) += xilinx_hwicap/ ifeq ($(CONFIG_GENERIC_NVRAM),y) obj-$(CONFIG_NVRAM) += generic_nvram.o else
drivers/char/xilinx_hwicap/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# Makefile for the Xilinx OPB hwicap driver +# + +obj-$(CONFIG_XILINX_HWICAP) += xilinx_hwicap_m.o + +xilinx_hwicap_m-y := xilinx_hwicap.o fifo_icap.o buffer_icap.o
drivers/char/xilinx_hwicap/buffer_icap.c new file +380 -0
380 lines not on this page · raw message
drivers/char/xilinx_hwicap/buffer_icap.h new file +57 -0
57 lines not on this page · raw message
drivers/char/xilinx_hwicap/fifo_icap.c new file +381 -0
381 lines not on this page · raw message
drivers/char/xilinx_hwicap/fifo_icap.h new file +62 -0
62 lines not on this page · raw message
drivers/char/xilinx_hwicap/xilinx_hwicap.c new file +900 -0
900 lines not on this page · raw message
drivers/char/xilinx_hwicap/xilinx_hwicap.h new file +193 -0
193 lines not on this page · raw message
Signature · 1 line
1.5.3.4-dirty
Quoted 6 lines · Stephen Neuendorffer
drivers/char/xilinx_hwicap/xilinx_hwicap.c new file +1
-0+static int hwicap_open (struct inode *inode,struct file *file)
drivers/char/xilinx_hwicap/xilinx_hwicap.c line 525
Quoted 10 lines
drivers/char/xilinx_hwicap/xilinx_hwicap.c new file +10
-0+{ +struct hwicap_drvdata *drvdata; +int status; + + drvdata = container_of(inode->i_cdev, struct hwicap_drvdata, cdev); + +if (down_interruptible (&drvdata->sem)) +return -ERESTARTSYS ; + + drvdata->is_open =1 ;
It doesn't look like this flag is used anywhere anymore.
drivers/char/xilinx_hwicap/xilinx_hwicap.c line 530
Quoted 5 lines
drivers/char/xilinx_hwicap/xilinx_hwicap.c new file +5
-0+ + status =hwicap_initialize_hwicap (drvdata); +if (status) { +dev_err (drvdata->dev,"Failed to open file" ); +return status;
returning without up()
Quoted 11 lines
drivers/char/xilinx_hwicap/xilinx_hwicap.c new file +11
-0+ } + + file->private_data = drvdata; + drvdata->write_buffer_in_use =0 ; + drvdata->read_buffer_in_use =0 ; + +up (&drvdata->sem); + +return 0 ; +} +
Signature · 2 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd.