Add PRUSS UIO driver support
v9 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 | 264 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/uio_pruss.h | 29 +++++ 4 files changed, 311 insertions(+), 0 deletions(-) create mode 100644 drivers/uio/uio_pruss.c create mode 100644 include/linux/uio_pruss.h
PATCH v9 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 | 264 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/uio_pruss.h | 29 +++++ 4 files changed, 311 insertions(+), 0 deletions(-) create mode 100644 drivers/uio/uio_pruss.c create mode 100644 include/linux/uio_pruss.h
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 +264 -0
264 lines not on this page · raw message
include/linux/uio_pruss.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* include/linux/uio_pruss.h +* +* Platform data for uio_pruss driver +* +* Copyright (C) 2010-11 Texas Instruments Incorporated - http://www.ti.com/ +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef _UIO_PRUSS_H_ +#define _UIO_PRUSS_H_ + +/* Used to configure the PRUSS INTC base offset for UIO driver */ +struct uio_pruss_pdata { +u32 pintc_base; +}; + +#endif /* _LINUX_UIO_PRUSS_H_ */ + + +
Signature · 1 line
1.6.0.6
Re: [PATCH v9 1/1] PRUSS UIO driver support
Quoted 5 lines · On Thursday 03 March 2011 19:07:57 Pratheesh Gangadhar wrote:
drivers/uio/uio_pruss.c new file +5
-0+struct uio_pruss_dev { +struct uio_info *info; +struct clk *pruss_clk; +dma_addr_t sram_paddr; +dma_addr_t ddr_paddr;
drivers/uio/uio_pruss.c line 76
Quoted 10 lines
drivers/uio/uio_pruss.c new file +10
-0+void __iomem *prussio_vaddr; +void *sram_vaddr; +void *ddr_vaddr; +unsigned int hostirq_start; +unsigned int pintc_base; +}; + +struct pruss_priv { +struct uio_pruss_dev *pupdev; +};
I cannot see the point of struct pruss_priv, I think it would be better to just merge the two data structures into one. Everything else looks good to me now.
Arnd
RE: [PATCH v9 1/1] PRUSS UIO driver support
Hi,
Quoted 15 lines
-----Original Message-----
From: Arnd Bergmann [mailto:arnd at arndb.de]
Sent: Thursday, March 03, 2011 11:46 PMQuoted 11 lines · On Thursday 03 March 2011 19:07:57 Pratheesh Gangadhar wrote:
drivers/uio/uio_pruss.c new file +11
-0+struct uio_pruss_dev { +struct uio_info *info; +struct clk *pruss_clk; +dma_addr_t sram_paddr; +dma_addr_t ddr_paddr; +void __iomem *prussio_vaddr; +void *sram_vaddr; +void *ddr_vaddr; +unsigned int hostirq_start; +unsigned int pintc_base; +};
Quoted 8 lines
drivers/uio/uio_pruss.c line 76
Quoted 4 lines
drivers/uio/uio_pruss.c new file +4
-0+ +struct pruss_priv { +struct uio_pruss_dev *pupdev; +};I cannot see the point of struct
pruss_priv, I think it would be better to just merge the two data structures into one. Everything else looks good to me now.
pruss_priv is needed to get access to uio_pruss_dev from uio_info *info in UIO interrupt handler (pruss_handler) and shall be per interrupt entry.
+static irqreturn_t pruss_handler(int irq, struct uio_info *info) {
+ struct pruss_priv *priv = info->priv;
+ struct uio_pruss_dev *gdev = priv->pupdev;
Note that info is a pointer to array supporting 8 interrupts. This allows to redirect to driver structure via info->priv quickly.
Thanks,
Pratheesh
RE: [PATCH v9 1/1] PRUSS UIO driver support
In reply to Arnd BergmannHi,
Quoted 31 lines
-----Original Message-----
From: TK, Pratheesh Gangadhar
Sent: Friday, March 04, 2011 8:55 AMQuoted 9 lines
Quoted 9 lines
drivers/uio/uio_pruss.c new file +9
-0+struct uio_pruss_dev { +struct uio_info *info; +struct clk *pruss_clk; +dma_addr_t sram_paddr; +dma_addr_t ddr_paddr; +void __iomem *prussio_vaddr; +void *sram_vaddr; +void *ddr_vaddr; +unsigned int hostirq_start;Quoted 8 lines
drivers/uio/uio_pruss.c line 76
Quoted 6 lines
drivers/uio/uio_pruss.c new file +6
-0+unsigned int pintc_base; +}; + +struct pruss_priv { +struct uio_pruss_dev *pupdev; +};I cannot see the point of struct
pruss_priv, I think it would be betterto
Quoted 2 lines
just merge the two data structures into one. Everything else looks good to me now.
pruss_privis needed to get access touio_pruss_devfromuio_info*info in UIO interrupt handler (pruss_handler) and shall be per interrupt entry.drivers/uio/uio_pruss.c new file +3
-0+static irqreturn_t pruss_handler (int irq,struct uio_info *info) { +struct pruss_priv *priv = info->priv; +struct uio_pruss_dev *gdev = priv->pupdev;
Quoted 4 lines
Note that info is a pointer to array supporting 8 interrupts. This allows to
redirect to driver structure viainfo->privquickly.
I get your point, no need of additional structure here, can directly assign uio_pruss_dev pointer to info->priv. Will resubmit with this change.
Thanks,
Pratheesh
RE: [PATCH v9 1/1] PRUSS UIO driver support
In reply to TK, Pratheesh GangadharQuoted 32 lines · Pratheesh Gangadhar
Hi,
Quoted 15 lines
-----Original Message-----
From: Arnd Bergmann [mailto:arnd at arndb.de]
Sent: Thursday, March 03, 2011 11:46 PMQuoted 11 lines · On Thursday 03 March 2011 19:07:57 Pratheesh Gangadhar wrote:
drivers/uio/uio_pruss.c new file +11
-0+struct uio_pruss_dev { +struct uio_info *info; +struct clk *pruss_clk; +dma_addr_t sram_paddr; +dma_addr_t ddr_paddr; +void __iomem *prussio_vaddr; +void *sram_vaddr; +void *ddr_vaddr; +unsigned int hostirq_start; +unsigned int pintc_base; +};Quoted 8 lines
drivers/uio/uio_pruss.c line 76
Quoted 4 lines
drivers/uio/uio_pruss.c new file +4
-0+ +struct pruss_priv { +struct uio_pruss_dev *pupdev; +};I cannot see the point of struct
pruss_priv, I think it would be better to just merge the two data structures into one. Everything else looks good to me now.
pruss_privis needed to get access touio_pruss_devfromuio_info*info in UIO interrupt handler (pruss_handler) and shall be per interrupt entry.drivers/uio/uio_pruss.c new file +3
-0+static irqreturn_t pruss_handler (int irq,struct uio_info *info) { +struct pruss_priv *priv = info->priv; +struct uio_pruss_dev *gdev = priv->pupdev;
Quoted 2 lines
Note that info is a pointer to array supporting 8 interrupts. This allows to redirect to driver structure via
info->privquickly.
struct uio_pruss_dev *dev = container_of(info, struct uio_pruss_dev, info);
Perhaps ?
Thanks,
tglx
Re: [PATCH v9 1/1] PRUSS UIO driver support
Quoted 11 lines · Thomas Gleixner
Quoted 7 lines
drivers/uio/uio_pruss.c new file +3
-0+static irqreturn_t pruss_handler (int irq,struct uio_info *info) { +struct pruss_priv *priv = info->priv; +struct uio_pruss_dev *gdev = priv->pupdev;Note that info is a pointer to array supporting 8 interrupts. This allows to redirect to driver structure via
info->privquickly.struct
uio_pruss_dev*dev =container_of(info, struct uio_pruss_dev, info);Perhaps ?
That would require having the same number of uio_info structs as uio_pruss_dev instances. Right now, one platform device has one uio_pruss_dev instance, which has 8 uio_info instances, so the container_of() trick doesn't work.
Arnd
Re: [PATCH v9 1/1] PRUSS UIO driver support
Quoted 9 lines · Arnd Bergmann
Quoted 8 lines · Thomas Gleixner
Quoted 7 lines
drivers/uio/uio_pruss.c new file +3
-0+static irqreturn_t pruss_handler (int irq,struct uio_info *info) { +struct pruss_priv *priv = info->priv; +struct uio_pruss_dev *gdev = priv->pupdev;Note that info is a pointer to array supporting 8 interrupts. This allows to redirect to driver structure via
info->privquickly.
Quoted 7 lines
Quoted 3 lines
struct
uio_pruss_dev*dev =container_of(info, struct uio_pruss_dev, info);Perhaps ?
That would require having the same number of
uio_infostructs asuio_pruss_devinstances. Right now, one platform device has oneuio_pruss_devinstance, which has 8uio_infoinstances, so thecontainer_of()trick doesn't work.
Duh. Yes :)
tglx