Add PRUSS UIO driver support
v8 cover Add PRUSS UIO driver support
This patch series add support for PRUSS (Programmable Real-time Unit Sub System) UIO driver in Texas Instruments DA850, AM18xx and OMAP-L138 processors. PRUSS is programmable RISC core which can be used to implement Soft IPs (eg:- DMA, CAN, UART,SmartCard) and Industrial communications data link layers (eg:- PROFIBUS). UIO driver exposes PRUSS resources like memory and interrupts to user space application.PRUSS UIO application API can be used to control PRUs in PRUSS, setup PRU INTC, load firmware to PRUs and implement IPC between Host processor and PRUs. More information on PRUSS and UIO linux user space API available in the links below
http://processors.wiki.ti.com/index.php/Programmable_Realtime_Unit_Subsystem
http://processors.wiki.ti.com/index.php/PRU_Linux_Application_Loader
http://processors.wiki.ti.com/index.php/PRU_Linux_Application_Loader_API_Guide
Platform/board specific portion of this patch depends on Mistral patches below
[PATCH 1/1] davinci: changed SRAM allocator to shared ram :
https://patchwork.kernel.org/patch/549351/ [PATCH 1/1] da830: macro rename DA8XX_LPSC0_DMAX to DA8XX_LPSC0_PRUSS : https://patchwork.kernel.org/patch/549331/ [PATCH v2 01/13] mfd: pruss mfd driver : https://patchwork.kernel.org/patch/549531/ [PATCH v2 02/13] da850: pruss platform specific additions : https://patchwork.kernel.org/patch/549521/
I will submit a seperate patch set on top of these patches to support PRUSS UIO driver.
Pratheesh Gangadhar (1):
PRUSS UIO driver support
drivers/uio/Kconfig | 17 ++++ drivers/uio/Makefile | 1 + drivers/uio/uio_pruss.c | 226 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 244 insertions(+), 0 deletions(-) create mode 100644 drivers/uio/uio_pruss.c
PATCH v8 1/1 PRUSS UIO driver support
This patch implements PRUSS (Programmable Real-time Unit Sub System) UIO driver which exports SOC resources associated with PRUSS like I/O, memories and IRQs to user space. PRUSS is dual 32-bit RISC processors which is efficient in performing embedded tasks that require manipulation of packed memory mapped data structures and handling system events that have tight real time constraints. This driver is currently supported on Texas Instruments DA850, AM18xx and OMAP-L138 devices.
For example, PRUSS runs firmware for real-time critical industrial communication data link layer and communicates with application stack running in user space via shared memory and IRQs.
--- drivers/uio/Kconfig | 17 ++++ drivers/uio/Makefile | 1 + drivers/uio/uio_pruss.c | 226 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 244 insertions(+), 0 deletions(-) create mode 100644 drivers/uio/uio_pruss.c
drivers/uio/Kconfig +17 -0
@@ -94,4 +94,21 @@ config UIO_NETX To compile this driver as a module, choose M here; the module will be called uio_netx. +config UIO_PRUSS + tristate "Texas Instruments PRUSS driver" + depends on ARCH_DAVINCI_DA850 + help + PRUSS driver for OMAPL138/DA850/AM18XX devices + PRUSS driver requires user space components, examples and user space + driver is available from below SVN repo - you may use anonymous login + + https://gforge.ti.com/gf/project/pru_sw/ + + More info on API is available at below wiki + + http://processors.wiki.ti.com/index.php/PRU_Linux_Application_Loader + + To compile this driver as a module, choose M here: the module + will be called uio_pruss. + endif
drivers/uio/Makefile +1 -0
@@ -6,3 +6,4 @@ obj-$(CONFIG_UIO_AEC) += uio_aec.o obj-$(CONFIG_UIO_SERCOS3) += uio_sercos3.o obj-$(CONFIG_UIO_PCI_GENERIC) += uio_pci_generic.o obj-$(CONFIG_UIO_NETX) += uio_netx.o +obj-$(CONFIG_UIO_PRUSS) += uio_pruss.o
drivers/uio/uio_pruss.c new file +226 -0
226 lines not on this page · raw message
Signature · 1 line
1.6.0.6
Re: [PATCH v8 1/1] PRUSS UIO driver support
drivers/uio/uio_pruss.c line 65
Quoted 6 lines · Pratheesh Gangadhar
drivers/uio/uio_pruss.c new file +6
-0+ +static struct clk *pruss_clk; +static struct uio_info *info; +static dma_addr_t sram_paddr, ddr_paddr; +static void *prussio_vaddr, *sram_vaddr, *ddr_vaddr; +
To my initial comment about these being single-instance variables, you said you'd change that, which has not happened yet.
Also, I now noticed that the types are wrong, you are missing __iomem annotations for MMIO ranges. Please make sure that the code builds fine with sparse and "make C=1", which will tell you about these problems.
Arnd
Re: [PATCH v8 1/1] PRUSS UIO driver support
In reply to Pratheesh GangadharQuoted 12 lines · Pratheesh Gangadhar
This patch implements PRUSS (Programmable Real-time Unit Sub System) UIO driver which exports SOC resources associated with PRUSS like I/O, memories and IRQs to user space. PRUSS is dual 32-bit RISC processors which is efficient in performing embedded tasks that require manipulation of packed memory mapped data structures and handling system events that have tight real time constraints. This driver is currently supported on Texas Instruments DA850, AM18xx and OMAP-L138 devices.
For example, PRUSS runs firmware for real-time critical industrial communication data link layer and communicates with application stack running in user space via shared memory and IRQs.
Quoted 2 lines
Signed-off-by Pratheesh Gangadhar <[email protected]>Reviewed-by Thomas Gleixner <[email protected]>
No further objections.
Thanks for your patience,
tglx
Re: [PATCH v8 1/1] PRUSS UIO driver support
In reply to Pratheesh GangadharQuoted 12 lines · Pratheesh Gangadhar
This patch implements PRUSS (Programmable Real-time Unit Sub System) UIO driver which exports SOC resources associated with PRUSS like I/O, memories and IRQs to user space. PRUSS is dual 32-bit RISC processors which is efficient in performing embedded tasks that require manipulation of packed memory mapped data structures and handling system events that have tight real time constraints. This driver is currently supported on Texas Instruments DA850, AM18xx and OMAP-L138 devices.
For example, PRUSS runs firmware for real-time critical industrial communication data link layer and communicates with application stack running in user space via shared memory and IRQs.
Quoted 8 lines
Signed-off-by Pratheesh Gangadhar <[email protected]>Reviewed-by Thomas Gleixner <[email protected]>--- drivers/uio/Kconfig | 17 ++++ drivers/uio/Makefile | 1 + drivers/uio/uio_pruss.c | 226 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 244 insertions(+), 0 deletions(-) create mode 100644 drivers/uio/uio_pruss.c
That looks good now, I don't see any further issues. But you should address Arnd's comment about that __iomem stuff. It's a bit nit-picking, but he's right, ioremap() returns void __iomem *, and uio_mem.internal_addr also has that type.
drivers/uio/uio_pruss.c line 64
Quoted 3 lines
drivers/uio/uio_pruss.c new file +3
-0+static struct uio_info *info; +static dma_addr_t sram_paddr, ddr_paddr; +static void *prussio_vaddr, *sram_vaddr, *ddr_vaddr;
So the correct thing would be
static void __iomem *prussio_vaddr;
static void *sram_vaddr, *ddr_vaddr;
Thanks,
Hans
Re: [PATCH v8 1/1] PRUSS UIO driver support
Quoted 8 lines · On Wednesday 02 March 2011 21:09:56 Hans J. Koch wrote:
drivers/uio/uio_pruss.c line 64
Quoted 3 lines
drivers/uio/uio_pruss.c new file +3
-0+static struct uio_info *info; +static dma_addr_t sram_paddr, ddr_paddr; +static void *prussio_vaddr, *sram_vaddr, *ddr_vaddr;So the correct thing would be
static void
__iomem*prussio_vaddr;
static void*sram_vaddr,*ddr_vaddr;
I also commented that it should not be a global variable at all, but a dynamic data structure referenced from the device.
Not important, but Pratheesh said he'd change it. If it stays a global variable, I'd at least expect an explanation why the static variable is considered better in this case.
Arnd
Re: [PATCH v8 1/1] PRUSS UIO driver support
Quoted 10 lines · Arnd Bergmann
Quoted 8 lines · On Wednesday 02 March 2011 21:09:56 Hans J. Koch wrote:
drivers/uio/uio_pruss.c line 64
Quoted 3 lines
drivers/uio/uio_pruss.c new file +3
-0+static struct uio_info *info; +static dma_addr_t sram_paddr, ddr_paddr; +static void *prussio_vaddr, *sram_vaddr, *ddr_vaddr;So the correct thing would be
static void
__iomem*prussio_vaddr;
static void*sram_vaddr,*ddr_vaddr;
Quoted 6 lines
I also commented that it should not be a global variable at all, but a dynamic data structure referenced from the device.
Not important, but Pratheesh said he'd change it. If it stays a global variable, I'd at least expect an explanation why the static variable is considered better in this case.
I did not pick at that, because there is no indicator that we'll see more than one PRUSS unit per SoC in the forseeable future.
Thanks,
tglx
RE: [PATCH v8 1/1] PRUSS UIO driver support
In reply to Arnd BergmannHi,
Quoted 4 lines
-----Original Message-----
From: Arnd Bergmann [mailto:arnd at arndb.de]
Sent: Wednesday, March 02, 2011 6:52 PM
On Wednesday 02 March 2011, Pratheesh Gangadhar wrote:
Quoted 11 lines
drivers/uio/uio_pruss.c line 65
Quoted 6 lines
drivers/uio/uio_pruss.c new file +6
-0+ +static struct clk *pruss_clk; +static struct uio_info *info; +static dma_addr_t sram_paddr, ddr_paddr; +static void *prussio_vaddr, *sram_vaddr, *ddr_vaddr; +To my initial comment about these being single-instance variables, you said you'd change that, which has not happened yet.
I will do this in next version. Also realized that in next SoC, PRU INTC base offset is different, so plan to add a platform_data variable to make this portable.
+#define PINTC_HIDISR 0x4038
+#define PINTC_HIPIR 0x4900
+#define PINTC_HIER 0x5500
These hard coding also need to go to make it fully portable. +int intr_bit = (irq - IRQ_DA8XX_EVTOUT0 + 2); +p->irq = IRQ_DA8XX_EVTOUT0 + cnt;
Quoted 5 lines
Also, I now noticed that the types are wrong, you are missing
__iomemannotations for MMIO ranges. Please make sure that the code builds fine with sparse and "make C=1", which will tell you about these problems.
Thanks, this also helped to identify 2 unused lines in the code.
+ p->mem[1].internal_addr = sram_vaddr;
+ p->mem[2].internal_addr = ddr_vaddr;
Pratheesh
RE: [PATCH v8 1/1] PRUSS UIO driver support
In reply to Thomas GleixnerHi,
Quoted 18 lines
-----Original Message-----
From: Thomas Gleixner [mailto:tglx at linutronix.de]
Sent: Thursday, March 03, 2011 2:27 AMQuoted 13 lines · Arnd Bergmann
Quoted 8 lines · On Wednesday 02 March 2011 21:09:56 Hans J. Koch wrote:
drivers/uio/uio_pruss.c line 64
Quoted 3 lines
drivers/uio/uio_pruss.c new file +3
-0+static struct uio_info *info; +static dma_addr_t sram_paddr, ddr_paddr; +static void *prussio_vaddr, *sram_vaddr, *ddr_vaddr;So the correct thing would be
static void
__iomem*prussio_vaddr;
static void*sram_vaddr,*ddr_vaddr;I also commented that it should not be a global variable at all, but a dynamic data structure referenced from the device.
Quoted 7 lines
Quoted 3 lines
Not important, but Pratheesh said he'd change it. If it stays a global variable, I'd at least expect an explanation why the static variable is considered better in this case.
I did not pick at that, because there is no indicator that we'll see more than one PRUSS unit per SoC in the forseeable future.
It's a possibility - May be in 2-3 years time.
Thanks,
Pratheesh