Skip to contentSkip to conversation

Add PRUSS UIO driver support

PATCH Superseded Pratheesh Gangadhar 5 participants 10 messages Feb 24, 2011 – Feb 28, 2011

Subsystems (4)

v4 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

v4 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 OMAPL1-38 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

Pratheesh Gangadhar (2):
PRUSS UIO driver support
Defines DA850/AM18xx/OMAPL1-38 SOC resources used by PRUSS UIO driver

 arch/arm/mach-davinci/board-da850-evm.c    |    4 +
 arch/arm/mach-davinci/da850.c              |   35 +++++
 arch/arm/mach-davinci/devices-da8xx.c      |   73 ++++++++++
 arch/arm/mach-davinci/include/mach/da8xx.h |    3 +
 drivers/uio/Kconfig                        |   17 +++
 drivers/uio/Makefile                       |    1 +
 drivers/uio/uio_pruss.c                    |  216 ++++++++++++++++++++++++++++
 7 files changed, 349 insertions(+), 0 deletions(-)
 create mode 100644 drivers/uio/uio_pruss.c
#1 lore raw

PATCH v4 1/2 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 efficient in handling system events that have tight real time constraints. This driver is currently supported on Texas Instruments DA850, AM18xx and OMAPL1-38 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 |  216 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 234 insertions(+), 0 deletions(-)
 create mode 100644 drivers/uio/uio_pruss.c
drivers/uio/Kconfig +17 -0
index bb44079..6f3ea9b 100644
@@ -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
index 18fd818..d4dd9a5 100644
@@ -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 +216 -0

216 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#2 lore raw

PATCH v4 2/2 Defines DA850/AM18xx/OMAPL1-38 SOC resources used by PRUSS UIO driver

This patch defines PRUSS, ECAP clocks, memory and IRQ resources used by PRUSS UIO driver in DA850/AM18xx/OMAPL1-38 devices. UIO driver exports 64K I/O region of PRUSS, 128KB L3 RAM and 256KB DDR buffer to user space. PRUSS has 8 host event interrupt lines mapped to IRQ_DA8XX_EVTOUT0..7 of ARM9 INTC.These in conjunction with shared memory can be used to implement IPC between ARM9 and PRUSS.

---
 arch/arm/mach-davinci/board-da850-evm.c    |    4 ++
 arch/arm/mach-davinci/da850.c              |   35 +++++++++++++
 arch/arm/mach-davinci/devices-da8xx.c      |   73 ++++++++++++++++++++++++++++
 arch/arm/mach-davinci/include/mach/da8xx.h |    3 +
 4 files changed, 115 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +4 -0
index 11f986b..bd85aa3 100644
@@ -1077,6 +1077,10 @@ static __init void da850_evm_init(void)
 		pr_warning("da850_evm_init: i2c0 registration failed: %d\n",
 				ret);
 
+	ret = da8xx_register_pruss();
+	if (ret)
+		pr_warning("da850_evm_init: pruss registration failed: %d\n",
+				ret);
 
 	ret = da8xx_register_watchdog();
 	if (ret)
arch/arm/mach-davinci/da850.c +35 -0
index 3443d97..0096d4f 100644
@@ -238,6 +238,13 @@ static struct clk tptc2_clk = {
 	.flags		= ALWAYS_ENABLED,
 };
 
+static struct clk pruss_clk = {
+	.name		= "pruss",
+	.parent		= &pll0_sysclk2,
+	.lpsc		= DA8XX_LPSC0_DMAX,
+	.flags		= ALWAYS_ENABLED,
+};
+
 static struct clk uart0_clk = {
 	.name		= "uart0",
 	.parent		= &pll0_sysclk2,
@@ -359,6 +366,30 @@ static struct clk usb20_clk = {
 	.gpsc		= 1,
 };
 
+static struct clk ecap0_clk = {
+	.name		= "ecap0",
+	.parent		= &pll0_sysclk2,
+	.lpsc		= DA8XX_LPSC1_ECAP,
+	.flags		= DA850_CLK_ASYNC3,
+	.gpsc		= 1,
+};
+
+static struct clk ecap1_clk = {
+	.name		= "ecap1",
+	.parent		= &pll0_sysclk2,
+	.lpsc		= DA8XX_LPSC1_ECAP,
+	.flags		= DA850_CLK_ASYNC3,
+	.gpsc		= 1,
+};
+
+static struct clk ecap2_clk = {
+	.name		= "ecap2",
+	.parent		= &pll0_sysclk2,
+	.lpsc		= DA8XX_LPSC1_ECAP,
+	.flags		= DA850_CLK_ASYNC3,
+	.gpsc		= 1,
+};
+
 static struct clk_lookup da850_clks[] = {
 	CLK(NULL,		"ref",		&ref_clk),
 	CLK(NULL,		"pll0",		&pll0_clk),
@@ -386,6 +417,7 @@ static struct clk_lookup da850_clks[] = {
 	CLK(NULL,		"tptc1",	&tptc1_clk),
 	CLK(NULL,		"tpcc1",	&tpcc1_clk),
 	CLK(NULL,		"tptc2",	&tptc2_clk),
+	CLK(NULL,		"pruss",	&pruss_clk),
 	CLK(NULL,		"uart0",	&uart0_clk),
 	CLK(NULL,		"uart1",	&uart1_clk),
 	CLK(NULL,		"uart2",	&uart2_clk),
@@ -403,6 +435,9 @@ static struct clk_lookup da850_clks[] = {
 	CLK(NULL,		"aemif",	&aemif_clk),
 	CLK(NULL,		"usb11",	&usb11_clk),
 	CLK(NULL,		"usb20",	&usb20_clk),
+	CLK(NULL,		"ecap0",	&ecap0_clk),
+	CLK(NULL,		"ecap1",	&ecap1_clk),
+	CLK(NULL,		"ecap2",	&ecap2_clk),
 	CLK(NULL,		NULL,		NULL),
 };
 
arch/arm/mach-davinci/devices-da8xx.c +73 -0

76 lines not on this page · raw message

arch/arm/mach-davinci/include/mach/da8xx.h +3 -0
index cfcb223..3ed6ee0 100644
@@ -60,6 +60,7 @@ extern unsigned int da850_max_speed;
 #define DA8XX_PLL0_BASE		0x01c11000
 #define DA8XX_TIMER64P0_BASE	0x01c20000
 #define DA8XX_TIMER64P1_BASE	0x01c21000
+#define DA8XX_PRUSS_BASE	0x01c30000
 #define DA8XX_GPIO_BASE		0x01e26000
 #define DA8XX_PSC1_BASE		0x01e27000
 #define DA8XX_LCD_CNTRL_BASE	0x01e13000
@@ -68,6 +69,7 @@ extern unsigned int da850_max_speed;
 #define DA8XX_AEMIF_CS2_BASE	0x60000000
 #define DA8XX_AEMIF_CS3_BASE	0x62000000
 #define DA8XX_AEMIF_CTL_BASE	0x68000000
+#define DA8XX_L3RAM_BASE	0x80000000
 #define DA8XX_DDR2_CTL_BASE	0xb0000000
 #define DA8XX_ARM_RAM_BASE	0xffff0000
 
@@ -90,6 +92,7 @@ int da850_register_cpufreq(char *async_clk);
 int da8xx_register_cpuidle(void);
 void __iomem * __init da8xx_get_mem_ctlr(void);
 int da850_register_pm(struct platform_device *pdev);
+int da8xx_register_pruss(void);
 
 extern struct platform_device da8xx_serial_device;
 extern struct emac_platform_data da8xx_emac_pdata;
Signature · 1 line
1.6.0.6
Reviewed-by on v4 1/2
#9 lore raw

Re: [PATCH v4 1/2] PRUSS UIO driver support

In reply to Pratheesh Gangadhar

On Thu, 24 Feb 2011, Pratheesh Gangadhar wrote:

A few nits.

drivers/uio/uio_pruss.c line 84

Quoted 13 lines
drivers/uio/uio_pruss.c new file +13 -0
+static void pruss_cleanup(struct platform_device *dev, struct uio_info *info)
+{
+	struct uio_info *p = info;
+	int cnt;
+
+	for (cnt = 0; cnt < MAX_PRUSS_EVT; cnt++, p++) {
+		uio_unregister_device(p);
+		kfree(p->name);
+	}
+	iounmap(prussio_vaddr);
+	if (ddr_vaddr) 
+		dma_free_coherent(&dev->dev, info->mem[2].size,
+			info->mem[2].internal_addr, info->mem[2].addr);

That is easier to read with curly braces even if they are strictly not necessary

	if (ddr_vaddr) {
		dma_free_coherent(&dev->dev, info->mem[2].size,
			info->mem[2].internal_addr, info->mem[2].addr);
	}

drivers/uio/uio_pruss.c line 133

Quoted 6 lines
drivers/uio/uio_pruss.c new file +6 -0
+	kfree(info);
+	clk_put(pruss_clk);
+}
+	len = resource_size(regs_ddr);
+	ddr_vaddr =
+	dma_alloc_coherent(&dev->dev, len, &ddr_paddr, GFP_KERNEL | GFP_DMA);

That wants to be:

	ddr_vaddr = dma_alloc_coherent(&dev->dev, len, &ddr_paddr,
					GFP_KERNEL | GFP_DMA);

Otherwise this looks very clean and readable now and I can't spot any technical problems with it anymore.

Please fixup the nits and feel free to add

Thanks for following up on all this!

tglx

#3 lore raw

Re: [PATCH v4 2/2] Defines DA850/AM18xx/OMAPL1-38 SOC resources used by PRUSS UIO driver

In reply to Pratheesh Gangadhar
Quoted 2 lines · Pratheesh Gangadhar

This patch defines PRUSS, ECAP clocks, memory and IRQ resources used by PRUSS UIO driver in DA850/AM18xx/OMAPL1-38 devices. UIO

    It's OMAP-L138.
Quoted 7 lines

driver exports 64K I/O region of PRUSS, 128KB L3 RAM and 256KB DDR buffer to user space. PRUSS has 8 host event interrupt lines mapped to IRQ_DA8XX_EVTOUT0..7 of ARM9 INTC.These in conjunction with shared memory can be used to implement IPC between ARM9 and PRUSS.

[...]

arch/arm/mach-davinci/board-da850-evm.c static __init void da850_evm_init(void) · line 1083

Quoted 12 lines
arch/arm/mach-davinci/board-da850-evm.c +4 -0
index 11f986b..bd85aa3 100644
@@ -1077,6 +1077,10 @@ static __init void da850_evm_init(void)
  		pr_warning("da850_evm_init: i2c0 registration failed: %d\n",
  				ret);
 
+	ret = da8xx_register_pruss();
+	if (ret)
+		pr_warning("da850_evm_init: pruss registration failed: %d\n",
+				ret);

Use __func__ to print the function name.

arch/arm/mach-davinci/board-da850-evm.c static __init void da850_evm_init(void) · line 1086

Quoted 3 lines
arch/arm/mach-davinci/board-da850-evm.c +0 -0
  	ret = da8xx_register_watchdog();
  	if (ret)

As I said, please put this into serpate patch.

Quoted 5 lines
arch/arm/mach-davinci/da850.c +0 -0
index 3443d97..0096d4f 100644

arch/arm/mach-davinci/da850.c static struct clk tptc2_clk = { · line 247

Quoted 10 lines
arch/arm/mach-davinci/da850.c +7 -0
@@ -238,6 +238,13 @@ static struct clk tptc2_clk = {
  	.flags		= ALWAYS_ENABLED,
  };
 
+static struct clk pruss_clk = {
+	.name		= "pruss",
+	.parent		= &pll0_sysclk2,
+	.lpsc		= DA8XX_LPSC0_DMAX,
+	.flags		= ALWAYS_ENABLED,
+};
+

This conflicts with previously posted patch.

Quoted 21 lines
arch/arm/mach-davinci/da850.c +14 -0
  static struct clk uart0_clk = {
  	.name		= "uart0",
  	.parent		=&pll0_sysclk2,
@@ -359,6 +366,30 @@ static struct clk usb20_clk = {
  	.gpsc		= 1,
  };
 
+static struct clk ecap0_clk = {
+	.name		= "ecap0",
+	.parent		= &pll0_sysclk2,
+	.lpsc		= DA8XX_LPSC1_ECAP,
+	.flags		= DA850_CLK_ASYNC3,
+	.gpsc		= 1,
+};
+
+static struct clk ecap1_clk = {
+	.name		= "ecap1",
+	.parent		= &pll0_sysclk2,
+	.lpsc		= DA8XX_LPSC1_ECAP,
+	.flags		= DA850_CLK_ASYNC3,
+	.gpsc		= 1,

arch/arm/mach-davinci/da850.c static struct clk usb20_clk = { · line 392

Quoted 10 lines
arch/arm/mach-davinci/da850.c +10 -0
+};
+
+static struct clk ecap2_clk = {
+	.name		= "ecap2",
+	.parent		= &pll0_sysclk2,
+	.lpsc		= DA8XX_LPSC1_ECAP,
+	.flags		= DA850_CLK_ASYNC3,
+	.gpsc		= 1,
+};
+

This is worth separate patch too...

Quoted 12 lines
arch/arm/mach-davinci/devices-da8xx.c +4 -0
index beda8a4..4ea3d1f 100644
@@ -725,3 +725,76 @@ int __init da8xx_register_cpuidle(void)
 
  	return platform_device_register(&da8xx_cpuidle_device);
  }
+static struct resource pruss_resources[] = {
+	[0] = {
+		.start  = DA8XX_PRUSS_BASE,
+		.end    = DA8XX_PRUSS_BASE + SZ_64K - 1,

arch/arm/mach-davinci/devices-da8xx.c int __init da8xx_register_cpuidle(void) · line 741

Quoted 10 lines
arch/arm/mach-davinci/devices-da8xx.c +10 -0
+		.flags  = IORESOURCE_MEM,
+	},
+	[1] = {
+		.start  = DA8XX_L3RAM_BASE,
+		.end    = DA8XX_L3RAM_BASE + SZ_128K - 1,
+		.flags  = IORESOURCE_MEM,
+	},
+	[2] = {
+		.start  = 0,
+		.end    = SZ_256K - 1,

Huh? I don't see where it's filled...

Quoted 3 lines
arch/arm/mach-davinci/devices-da8xx.c +3 -0
+		.flags  = IORESOURCE_MEM,
+	},
+

[...]

Quoted 17 lines
arch/arm/mach-davinci/devices-da8xx.c +4 -0
+int __init da8xx_register_pruss()
+{
+	return platform_device_register(&pruss_device);
+}
arch/arm/mach-davinci/include/mach/da8xx.h +1 -0
index cfcb223..3ed6ee0 100644
@@ -60,6 +60,7 @@ extern unsigned int da850_max_speed;
  #define DA8XX_PLL0_BASE		0x01c11000
  #define DA8XX_TIMER64P0_BASE	0x01c20000
  #define DA8XX_TIMER64P1_BASE	0x01c21000
+#define DA8XX_PRUSS_BASE	0x01c30000
  #define DA8XX_GPIO_BASE		0x01e26000
  #define DA8XX_PSC1_BASE		0x01e27000
  #define DA8XX_LCD_CNTRL_BASE	0x01e13000

arch/arm/mach-davinci/include/mach/da8xx.h extern unsigned int da850_max_speed; · line 72

Quoted 4 lines
arch/arm/mach-davinci/include/mach/da8xx.h +1 -0
@@ -68,6 +69,7 @@ extern unsigned int da850_max_speed;
  #define DA8XX_AEMIF_CS2_BASE	0x60000000
  #define DA8XX_AEMIF_CS3_BASE	0x62000000
  #define DA8XX_AEMIF_CTL_BASE	0x68000000
+#define DA8XX_L3RAM_BASE	0x80000000

There were already patches defining macros for these base addresses...

WBR, Sergei

#4 lore raw

Re: [PATCH v4 2/2] Defines DA850/AM18xx/OMAPL1-38 SOC resources used by PRUSS UIO driver

Quoted 6 lines · Sergei Shtylyov
Quoted 2 lines · Pratheesh Gangadhar

This patch defines PRUSS, ECAP clocks, memory and IRQ resources used by PRUSS UIO driver in DA850/AM18xx/OMAPL1-38 devices. UIO

   It's OMAP-L138.
#5 lore raw

Re: [PATCH v4 2/2] Defines DA850/AM18xx/OMAPL1-38 SOC resources used by PRUSS UIO driver

Hello.

Quoted 9 lines · Hans J. Koch
Quoted 4 lines
Quoted 2 lines

This patch defines PRUSS, ECAP clocks, memory and IRQ resources used by PRUSS UIO driver in DA850/AM18xx/OMAPL1-38 devices. UIO

    It's OMAP-L138.

From the TI wiki: "The PRU subsystem is supported on OMAP-L1x8/C674m/AM18xx devices (where m is an even number)."

http://processors.wiki.ti.com/index.php/Programmable_Realtime_Unit_Subsystem

I meant there's a typo in "OMAPL1-38".

Quoted 2 lines

Thanks,
Hans

WBR, Sergei

#6 lore raw

RE: [PATCH v4 2/2] Defines DA850/AM18xx/OMAPL1-38 SOC resources used by PRUSS UIO driver

In reply to Sergei Shtylyov

Hi,

Quoted 10 lines

-----Original Message-----
From: Sergei Shtylyov [mailto:sshtylyov at mvista.com]
Sent: Friday, February 25, 2011 5:18 PM
To: TK, Pratheesh Gangadhar
Cc: davinci-linux-open-source at linux.davincidsp.com; hjk at hansjkoch.de; gregkh at suse.de; tglx at linutronix.de; arnd at arndb.de; Chatterjee, Amit; linux-kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH v4 2/2] Defines DA850/AM18xx/OMAPL1-38 SOC resources used by PRUSS UIO driver

Quoted 6 lines
Quoted 2 lines · Pratheesh Gangadhar

This patch defines PRUSS, ECAP clocks, memory and IRQ resources used by PRUSS UIO driver in DA850/AM18xx/OMAPL1-38 devices. UIO

    It's OMAP-L138.

Ok.

Quoted 27 lines
Quoted 8 lines

driver exports 64K I/O region of PRUSS, 128KB L3 RAM and 256KB DDR buffer to user space. PRUSS has 8 host event interrupt lines mapped to IRQ_DA8XX_EVTOUT0..7 of ARM9 INTC.These in conjunction with shared memory can be used to implement IPC between ARM9 and PRUSS.

[...]

arch/arm/mach-

Quoted 1 line
arch/arm/mach- renamed from arch/arm/mach-davinci/board-da850-evm.c +0 -0

davinci/board-da850-evm.c

arch/arm/mach-davinci/board-da850-evm.c static __init void da850_evm_init(void) · line 1083

Quoted 11 lines

index 11f986b..bd85aa3 100644

arch/arm/mach-davinci/board-da850-evm.c +4 -0
@@ -1077,6 +1077,10 @@ static __init void da850_evm_init(void)
  		pr_warning("da850_evm_init: i2c0 registration failed: %d\n",
  				ret);
 
+	ret = da8xx_register_pruss();
+	if (ret)
+		pr_warning("da850_evm_init: pruss registration failed: %d\n",
+				ret);

Use __func__ to print the function name.

Quoted 1 line
Quoted 5 lines
Quoted 2 lines
  	ret = da8xx_register_watchdog();
  	if (ret)

As I said, please put this into serpate patch.

Ok, will do.

Quoted 9 lines

arch/arm/mach-

Quoted 1 line
arch/arm/mach- renamed from arch/arm/mach-davinci/da850.c +0 -0

davinci/da850.c

Quoted 7 lines

index 3443d97..0096d4f 100644

arch/arm/mach-davinci/da850.c +0 -0
@@ -238,6 +238,13 @@ static struct clk tptc2_clk = {
  	.flags		= ALWAYS_ENABLED,
  };
 
Quoted 10 lines

arch/arm/mach-davinci/da850.c static struct clk tptc2_clk = { · line 247

Quoted 7 lines
arch/arm/mach-davinci/da850.c +7 -0
+static struct clk pruss_clk = {
+	.name		= "pruss",
+	.parent		= &pll0_sysclk2,
+	.lpsc		= DA8XX_LPSC0_DMAX,
+	.flags		= ALWAYS_ENABLED,
+};
+

This conflicts with previously posted patch.

Ok, shall I rename to align with previous patch from Mistral or drop this from my patchset ?

Quoted 25 lines
Quoted 25 lines
arch/arm/mach-davinci/da850.c +18 -0
  static struct clk uart0_clk = {
  	.name		= "uart0",
  	.parent		=&pll0_sysclk2,
@@ -359,6 +366,30 @@ static struct clk usb20_clk = {
  	.gpsc		= 1,
  };
 
+static struct clk ecap0_clk = {
+	.name		= "ecap0",
+	.parent		= &pll0_sysclk2,
+	.lpsc		= DA8XX_LPSC1_ECAP,
+	.flags		= DA850_CLK_ASYNC3,
+	.gpsc		= 1,
+};
+
+static struct clk ecap1_clk = {
+	.name		= "ecap1",
+	.parent		= &pll0_sysclk2,
+	.lpsc		= DA8XX_LPSC1_ECAP,
+	.flags		= DA850_CLK_ASYNC3,
+	.gpsc		= 1,
+};
+
+static struct clk ecap2_clk = {
+	.name		= "ecap2",
Quoted 9 lines

arch/arm/mach-davinci/da850.c static struct clk usb20_clk = { · line 376

Quoted 6 lines
arch/arm/mach-davinci/da850.c +6 -0
+	.parent		= &pll0_sysclk2,
+	.lpsc		= DA8XX_LPSC1_ECAP,
+	.flags		= DA850_CLK_ASYNC3,
+	.gpsc		= 1,
+};
+

This is worth separate patch too...

Ok.

Quoted 17 lines

arch/arm/mach-

Quoted 1 line
arch/arm/mach- renamed from arch/arm/mach-davinci/devices-da8xx.c +0 -0

davinci/devices-da8xx.c

Quoted 15 lines

index beda8a4..4ea3d1f 100644

arch/arm/mach-davinci/devices-da8xx.c +8 -0
@@ -725,3 +725,76 @@ int __init da8xx_register_cpuidle(void)
 
  	return platform_device_register(&da8xx_cpuidle_device);
  }
+static struct resource pruss_resources[] = {
+	[0] = {
+		.start  = DA8XX_PRUSS_BASE,
+		.end    = DA8XX_PRUSS_BASE + SZ_64K - 1,
+		.flags  = IORESOURCE_MEM,
+	},
+	[1] = {
+		.start  = DA8XX_L3RAM_BASE,
Quoted 9 lines

arch/arm/mach-davinci/devices-da8xx.c int __init da8xx_register_cpuidle(void) · line 741

Quoted 6 lines
arch/arm/mach-davinci/devices-da8xx.c +6 -0
+		.end    = DA8XX_L3RAM_BASE + SZ_128K - 1,
+		.flags  = IORESOURCE_MEM,
+	},
+	[2] = {
+		.start  = 0,
+		.end    = SZ_256K - 1,

Huh? I don't see where it's filled...

The current use is only to indicate memory block size to the PRUSS UIO driver when we allocate DDR memory using dma_alloc_coherent. sram_alloc is changed to use L3_RAM (128KB) instead of ARM RAM (8KB) in Mistral patch set - I need to follow the same convention for L3 RAM as well if I need to align with that patch. Is there a better way to do this?

Quoted 20 lines
Quoted 3 lines
arch/arm/mach-davinci/devices-da8xx.c +3 -0
+		.flags  = IORESOURCE_MEM,
+	},
+

[...]

arch/arm/mach-

Quoted 5 lines
arch/arm/mach-davinci/devices-da8xx.c +4 -0
+int __init da8xx_register_pruss()
+{
+	return platform_device_register(&pruss_device);
+}
arch/arm/mach- renamed from arch/arm/mach-davinci/include/mach/da8xx.h +0 -0

davinci/include/mach/da8xx.h

Quoted 10 lines

index cfcb223..3ed6ee0 100644

arch/arm/mach-davinci/include/mach/da8xx.h +1 -0
@@ -60,6 +60,7 @@ extern unsigned int da850_max_speed;
  #define DA8XX_PLL0_BASE		0x01c11000
  #define DA8XX_TIMER64P0_BASE	0x01c20000
  #define DA8XX_TIMER64P1_BASE	0x01c21000
+#define DA8XX_PRUSS_BASE	0x01c30000
  #define DA8XX_GPIO_BASE		0x01e26000
  #define DA8XX_PSC1_BASE		0x01e27000
Quoted 9 lines

arch/arm/mach-davinci/include/mach/da8xx.h extern unsigned int da850_max_speed; · line 72

Quoted 6 lines
arch/arm/mach-davinci/include/mach/da8xx.h +1 -0
  #define DA8XX_LCD_CNTRL_BASE	0x01e13000
@@ -68,6 +69,7 @@ extern unsigned int da850_max_speed;
  #define DA8XX_AEMIF_CS2_BASE	0x60000000
  #define DA8XX_AEMIF_CS3_BASE	0x62000000
  #define DA8XX_AEMIF_CTL_BASE	0x68000000
+#define DA8XX_L3RAM_BASE	0x80000000

There were already patches defining macros for these base addresses...

Ok - will align with this.

Thanks,
Pratheesh

#7 lore raw

RE: [PATCH v4 2/2] Defines DA850/AM18xx/OMAPL1-38 SOC resources used by PRUSS UIO driver

Hi Pratheesh,

Quoted 26 lines · Pratheesh Gangadhar
Quoted 17 lines

arch/arm/mach-

Quoted 1 line
arch/arm/mach- renamed from arch/arm/mach-davinci/devices-da8xx.c +0 -0

davinci/devices-da8xx.c

Quoted 15 lines

index beda8a4..4ea3d1f 100644

arch/arm/mach-davinci/devices-da8xx.c +8 -0
@@ -725,3 +725,76 @@ int __init da8xx_register_cpuidle(void)
 
  	return platform_device_register(&da8xx_cpuidle_device);
  }
+static struct resource pruss_resources[] = {
+	[0] = {
+		.start  = DA8XX_PRUSS_BASE,
+		.end    = DA8XX_PRUSS_BASE + SZ_64K - 1,
+		.flags  = IORESOURCE_MEM,
+	},
+	[1] = {
+		.start  = DA8XX_L3RAM_BASE,
Quoted 9 lines

arch/arm/mach-davinci/devices-da8xx.c int __init da8xx_register_cpuidle(void) · line 741

Quoted 6 lines
arch/arm/mach-davinci/devices-da8xx.c +6 -0
+		.end    = DA8XX_L3RAM_BASE + SZ_128K - 1,
+		.flags  = IORESOURCE_MEM,
+	},
+	[2] = {
+		.start  = 0,
+		.end    = SZ_256K - 1,

Huh? I don't see where it's filled...

Quoted 2 lines

The current use is only to indicate memory block size to the PRUSS UIO driver when we allocate DDR memory using dma_alloc_coherent.

If the user/platform needs to specify the amount of memory that will be allocated by the driver, it can be done though platform data or (better) using module params.

Quoted 3 lines

sram_alloc is changed to use L3_RAM (128KB) instead of ARM RAM (8KB) in Mistral patch set - I need to follow the same convention for L3 RAM as well if I need to align with that patch. Is there a better way to do this?

Yes, with that patch sram_alloc() will allocate from L3 RAM. You can make calls to sram_alloc() in your driver. Again the size to be allocated can be platform data or module params.

Thanks,
Sekhar

#8 lore raw

Re: [PATCH v4 2/2] Defines DA850/AM18xx/OMAPL1-38 SOC resources used by PRUSS UIO driver

In reply to TK, Pratheesh Gangadhar

Hello.

Quoted 13 lines · Pratheesh Gangadhar
Quoted 4 lines
Quoted 2 lines

This patch defines PRUSS, ECAP clocks, memory and IRQ resources used by PRUSS UIO driver in DA850/AM18xx/OMAPL1-38 devices. UIO

     It's OMAP-L138.

Ok.

Quoted 7 lines
Quoted 7 lines

driver exports 64K I/O region of PRUSS, 128KB L3 RAM and 256KB DDR buffer to user space. PRUSS has 8 host event interrupt lines mapped to IRQ_DA8XX_EVTOUT0..7 of ARM9 INTC.These in conjunction with shared memory can be used to implement IPC between ARM9 and PRUSS.

[...]

Quoted 26 lines
Quoted 17 lines

arch/arm/mach-

Quoted 1 line
arch/arm/mach- renamed from arch/arm/mach-davinci/devices-da8xx.c +0 -0

davinci/devices-da8xx.c

Quoted 15 lines

index beda8a4..4ea3d1f 100644

arch/arm/mach-davinci/devices-da8xx.c +8 -0
@@ -725,3 +725,76 @@ int __init da8xx_register_cpuidle(void)
 
   	return platform_device_register(&da8xx_cpuidle_device);
   }
+static struct resource pruss_resources[] = {
+	[0] = {
+		.start  = DA8XX_PRUSS_BASE,
+		.end    = DA8XX_PRUSS_BASE + SZ_64K - 1,
+		.flags  = IORESOURCE_MEM,
+	},
+	[1] = {
+		.start  = DA8XX_L3RAM_BASE,
Quoted 8 lines

arch/arm/mach-davinci/devices-da8xx.c int __init da8xx_register_cpuidle(void) · line 741

Quoted 6 lines
arch/arm/mach-davinci/devices-da8xx.c +6 -0
+		.end    = DA8XX_L3RAM_BASE + SZ_128K - 1,
+		.flags  = IORESOURCE_MEM,
+	},
+	[2] = {
+		.start  = 0,
+		.end    = SZ_256K - 1,

Huh? I don't see where it's filled...

Quoted 1 line

The current use is only to indicate memory block size to the PRUSS UIO driver when we allocate DDR memory using dma_alloc_coherent.

Why not pass this size via the platform data? There shouldn't be "dummy"
resources.

Quoted 2 lines

sram_alloc is changed to use L3_RAM (128KB) instead of ARM RAM (8KB) in Mistral patch set - I need to follow the same convention for L3 RAM as well if I need to align with that patch. Is there a better

way to do this?

Didn't understand about L3 RAM.
Also, please wrap your text at 80 columns.

WBR, Sergei