2012-10-05 17:04:16

by Matt Porter

[permalink] [raw]
Subject: [PATCH v4 0/7] uio_pruss cleanup and platform support

Changes since v3:
- Reordered series to avoid dependency breakage
- Squashed iotable/ioremap patches to one and removed
deprecated description comment about the SRAM
consolidation series
- Separated gen_pool_add_virt status assignment and
conditional
- Cleaned up board-da850-evm.c include ordering
- Changed the pdata l3ram_pool->sram_pool
- Separated DA850 SoC and board file changes
- Fixed pruss clk_lookup entry to have a dev_id value
- Moved pruss mem base definition in order with others
- Use DMA_BIT_MASK for our dma_mask
- Added testing information to commit descriptions

Changes since v2:
- Dropped AM33xx/OMAP support from series.
- Changed the DA850 L3 RAM gen_pool support to be based
on a previous Davinci SRAM series from Subhasish Ghosh
and Ben Gardiner.

Changes since v1:
- Replaced uio_pruss private SRAM API use with genalloc
- Added DA850 platform device and clock support
- Added DA850 L3 RAM gen_pool support
- Split out DT binding

This series enables uio_pruss on DA850 and removes use of the
private SRAM API by the driver. The driver previously was not
enabled by any platform and the private SRAM API was accessing
an invalid SRAM bank.

It is regression tested on AM180x EVM with suspend/resume due
to the new use of the shared SRAM for both PM and PRUSS. The
uio_pruss driver is tested on the same platform using the
PRU_memAccessPRUDataRam and PRU_memAccessL3andDDR examples from
the PRU userspace tools available from http://www.ti.com/tool/sprc940

Ben Gardiner (1):
ARM: davinci: sram: switch from iotable to ioremapped regions

Matt Porter (5):
uio: uio_pruss: replace private SRAM API with genalloc
ARM: davinci: add platform hook to fetch the SRAM pool
ARM: davinci: add DA850 PRUSS support
ARM: davinci: clean up DA850 EVM include ordering
ARM: davinci: register pruss_uio device on DA850 EVM

Subhasish Ghosh (1):
ARM: davinci: da850: changed SRAM allocator to shared ram.

arch/arm/mach-davinci/board-da850-evm.c | 40 +++++++++++------
arch/arm/mach-davinci/da850.c | 17 +++----
arch/arm/mach-davinci/devices-da8xx.c | 65 +++++++++++++++++++++++++++
arch/arm/mach-davinci/dm355.c | 6 ---
arch/arm/mach-davinci/dm365.c | 6 ---
arch/arm/mach-davinci/dm644x.c | 6 ---
arch/arm/mach-davinci/dm646x.c | 6 ---
arch/arm/mach-davinci/include/mach/common.h | 2 -
arch/arm/mach-davinci/include/mach/da8xx.h | 3 ++
arch/arm/mach-davinci/include/mach/sram.h | 3 ++
arch/arm/mach-davinci/sram.c | 23 ++++++++--
drivers/uio/Kconfig | 1 +
drivers/uio/uio_pruss.c | 24 +++++++---
include/linux/platform_data/uio_pruss.h | 3 +-
14 files changed, 146 insertions(+), 59 deletions(-)

--
1.7.9.5


2012-10-05 17:04:19

by Matt Porter

[permalink] [raw]
Subject: [PATCH v4 1/7] uio: uio_pruss: replace private SRAM API with genalloc

Remove the use of the private DaVinci SRAM API in favor
of genalloc. The pool to be used is provided by platform
data.

Signed-off-by: Matt Porter <[email protected]>
---
drivers/uio/Kconfig | 1 +
drivers/uio/uio_pruss.c | 24 +++++++++++++++++-------
include/linux/platform_data/uio_pruss.h | 3 ++-
3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
index 6f3ea9b..c48b938 100644
--- a/drivers/uio/Kconfig
+++ b/drivers/uio/Kconfig
@@ -97,6 +97,7 @@ config UIO_NETX
config UIO_PRUSS
tristate "Texas Instruments PRUSS driver"
depends on ARCH_DAVINCI_DA850
+ select GENERIC_ALLOCATOR
help
PRUSS driver for OMAPL138/DA850/AM18XX devices
PRUSS driver requires user space components, examples and user space
diff --git a/drivers/uio/uio_pruss.c b/drivers/uio/uio_pruss.c
index 33a7a27..f8738de 100644
--- a/drivers/uio/uio_pruss.c
+++ b/drivers/uio/uio_pruss.c
@@ -25,7 +25,7 @@
#include <linux/clk.h>
#include <linux/dma-mapping.h>
#include <linux/slab.h>
-#include <mach/sram.h>
+#include <linux/genalloc.h>

#define DRV_NAME "pruss_uio"
#define DRV_VERSION "1.0"
@@ -65,10 +65,11 @@ struct uio_pruss_dev {
dma_addr_t sram_paddr;
dma_addr_t ddr_paddr;
void __iomem *prussio_vaddr;
- void *sram_vaddr;
+ unsigned long sram_vaddr;
void *ddr_vaddr;
unsigned int hostirq_start;
unsigned int pintc_base;
+ struct gen_pool *sram_pool;
};

static irqreturn_t pruss_handler(int irq, struct uio_info *info)
@@ -106,7 +107,9 @@ static void pruss_cleanup(struct platform_device *dev,
gdev->ddr_paddr);
}
if (gdev->sram_vaddr)
- sram_free(gdev->sram_vaddr, sram_pool_sz);
+ gen_pool_free(gdev->sram_pool,
+ gdev->sram_vaddr,
+ sram_pool_sz);
kfree(gdev->info);
clk_put(gdev->pruss_clk);
kfree(gdev);
@@ -152,10 +155,17 @@ static int __devinit pruss_probe(struct platform_device *dev)
goto out_free;
}

- gdev->sram_vaddr = sram_alloc(sram_pool_sz, &(gdev->sram_paddr));
- if (!gdev->sram_vaddr) {
- dev_err(&dev->dev, "Could not allocate SRAM pool\n");
- goto out_free;
+ if (pdata->sram_pool) {
+ gdev->sram_pool = pdata->sram_pool;
+ gdev->sram_vaddr =
+ gen_pool_alloc(gdev->sram_pool, sram_pool_sz);
+ if (!gdev->sram_vaddr) {
+ dev_err(&dev->dev, "Could not allocate SRAM pool\n");
+ goto out_free;
+ }
+ gdev->sram_paddr =
+ gen_pool_virt_to_phys(gdev->sram_pool,
+ gdev->sram_vaddr);
}

gdev->ddr_vaddr = dma_alloc_coherent(&dev->dev, extram_pool_sz,
diff --git a/include/linux/platform_data/uio_pruss.h b/include/linux/platform_data/uio_pruss.h
index f39140a..3d47d21 100644
--- a/include/linux/platform_data/uio_pruss.h
+++ b/include/linux/platform_data/uio_pruss.h
@@ -20,6 +20,7 @@

/* To configure the PRUSS INTC base offset for UIO driver */
struct uio_pruss_pdata {
- u32 pintc_base;
+ u32 pintc_base;
+ struct gen_pool *sram_pool;
};
#endif /* _UIO_PRUSS_H_ */
--
1.7.9.5

2012-10-05 17:04:24

by Matt Porter

[permalink] [raw]
Subject: [PATCH v4 2/7] ARM: davinci: sram: switch from iotable to ioremapped regions

From: Ben Gardiner <[email protected]>

The current davinci init sets up SRAM in iotables. There has been
an observed failure to boot a da850 with 128K specified in the
iotable.

Make the davinci sram allocator do an ioremap of the region
specified by the entries in davinci_soc_info before registering
with gen_pool_add_virt(). Remove all iotable SRAM mappings and
SRAM_VIRT.

Regression tested suspend/resume on AM180x EVM.

Signed-off-by: Ben Gardiner <[email protected]>
Signed-off-by: Matt Porter <[email protected]>
---
arch/arm/mach-davinci/da850.c | 6 ------
arch/arm/mach-davinci/dm355.c | 6 ------
arch/arm/mach-davinci/dm365.c | 6 ------
arch/arm/mach-davinci/dm644x.c | 6 ------
arch/arm/mach-davinci/dm646x.c | 6 ------
arch/arm/mach-davinci/include/mach/common.h | 2 --
arch/arm/mach-davinci/sram.c | 18 +++++++++++++++---
7 files changed, 15 insertions(+), 35 deletions(-)

diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 6676dee..b4b324f 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -713,12 +713,6 @@ static struct map_desc da850_io_desc[] = {
.length = DA8XX_CP_INTC_SIZE,
.type = MT_DEVICE
},
- {
- .virtual = SRAM_VIRT,
- .pfn = __phys_to_pfn(DA8XX_ARM_RAM_BASE),
- .length = SZ_8K,
- .type = MT_DEVICE
- },
};

static u32 da850_psc_bases[] = { DA8XX_PSC0_BASE, DA8XX_PSC1_BASE };
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index a255434..b49c3b7 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -758,12 +758,6 @@ static struct map_desc dm355_io_desc[] = {
.length = IO_SIZE,
.type = MT_DEVICE
},
- {
- .virtual = SRAM_VIRT,
- .pfn = __phys_to_pfn(0x00010000),
- .length = SZ_32K,
- .type = MT_MEMORY_NONCACHED,
- },
};

/* Contents of JTAG ID register used to identify exact cpu type */
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index b680c83..6c39805 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -985,12 +985,6 @@ static struct map_desc dm365_io_desc[] = {
.length = IO_SIZE,
.type = MT_DEVICE
},
- {
- .virtual = SRAM_VIRT,
- .pfn = __phys_to_pfn(0x00010000),
- .length = SZ_32K,
- .type = MT_MEMORY_NONCACHED,
- },
};

static struct resource dm365_ks_resources[] = {
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 0755d46..f8aaa7d 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -795,12 +795,6 @@ static struct map_desc dm644x_io_desc[] = {
.length = IO_SIZE,
.type = MT_DEVICE
},
- {
- .virtual = SRAM_VIRT,
- .pfn = __phys_to_pfn(0x00008000),
- .length = SZ_16K,
- .type = MT_MEMORY_NONCACHED,
- },
};

/* Contents of JTAG ID register used to identify exact cpu type */
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index 97c0f8e..ac7b431 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -756,12 +756,6 @@ static struct map_desc dm646x_io_desc[] = {
.length = IO_SIZE,
.type = MT_DEVICE
},
- {
- .virtual = SRAM_VIRT,
- .pfn = __phys_to_pfn(0x00010000),
- .length = SZ_32K,
- .type = MT_MEMORY_NONCACHED,
- },
};

/* Contents of JTAG ID register used to identify exact cpu type */
diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h
index bdc4aa8..046c723 100644
--- a/arch/arm/mach-davinci/include/mach/common.h
+++ b/arch/arm/mach-davinci/include/mach/common.h
@@ -104,8 +104,6 @@ int davinci_pm_init(void);
static inline int davinci_pm_init(void) { return 0; }
#endif

-/* standard place to map on-chip SRAMs; they *may* support DMA */
-#define SRAM_VIRT 0xfffe0000
#define SRAM_SIZE SZ_128K

#endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */
diff --git a/arch/arm/mach-davinci/sram.c b/arch/arm/mach-davinci/sram.c
index db0f778..fa56374 100644
--- a/arch/arm/mach-davinci/sram.c
+++ b/arch/arm/mach-davinci/sram.c
@@ -10,6 +10,7 @@
*/
#include <linux/module.h>
#include <linux/init.h>
+#include <linux/io.h>
#include <linux/genalloc.h>

#include <mach/common.h>
@@ -32,7 +33,7 @@ void *sram_alloc(size_t len, dma_addr_t *dma)
return NULL;

if (dma)
- *dma = dma_base + (vaddr - SRAM_VIRT);
+ *dma = gen_pool_virt_to_phys(sram_pool, vaddr);
return (void *)vaddr;

}
@@ -53,8 +54,10 @@ EXPORT_SYMBOL(sram_free);
*/
static int __init sram_init(void)
{
+ phys_addr_t phys = davinci_soc_info.sram_dma;
unsigned len = davinci_soc_info.sram_len;
int status = 0;
+ void *addr;

if (len) {
len = min_t(unsigned, len, SRAM_SIZE);
@@ -62,8 +65,17 @@ static int __init sram_init(void)
if (!sram_pool)
status = -ENOMEM;
}
- if (sram_pool)
- status = gen_pool_add(sram_pool, SRAM_VIRT, len, -1);
+
+ if (sram_pool) {
+ addr = ioremap(phys, len);
+ if (!addr)
+ return -ENOMEM;
+ status = gen_pool_add_virt(sram_pool, (unsigned)addr,
+ phys, len, -1);
+ if (status < 0)
+ iounmap(addr);
+ }
+
WARN_ON(status < 0);
return status;
}
--
1.7.9.5

2012-10-05 17:04:35

by Matt Porter

[permalink] [raw]
Subject: [PATCH v4 6/7] ARM: davinci: clean up DA850 EVM include ordering

Reorder includes so they are grouped by linux/mach/asm

Signed-off-by: Matt Porter <[email protected]>
---
arch/arm/mach-davinci/board-da850-evm.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 1295e61..7359375 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -11,39 +11,39 @@
* is licensed "as is" without any warranty of any kind, whether express
* or implied.
*/
-#include <linux/kernel.h>
-#include <linux/init.h>
#include <linux/console.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/gpio_keys.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
#include <linux/i2c.h>
#include <linux/i2c/at24.h>
#include <linux/i2c/pca953x.h>
#include <linux/input.h>
+#include <linux/input/tps6507x-ts.h>
#include <linux/mfd/tps6507x.h>
-#include <linux/gpio.h>
-#include <linux/gpio_keys.h>
-#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/physmap.h>
+#include <linux/platform_device.h>
+#include <linux/platform_data/mtd-davinci.h>
+#include <linux/platform_data/mtd-davinci-aemif.h>
+#include <linux/platform_data/spi-davinci.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/tps6507x.h>
-#include <linux/input/tps6507x-ts.h>
#include <linux/spi/spi.h>
#include <linux/spi/flash.h>
-#include <linux/delay.h>
#include <linux/wl12xx.h>

-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/system_info.h>
-
#include <mach/cp_intc.h>
#include <mach/da8xx.h>
-#include <linux/platform_data/mtd-davinci.h>
#include <mach/mux.h>
-#include <linux/platform_data/mtd-davinci-aemif.h>
-#include <linux/platform_data/spi-davinci.h>
+
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/system_info.h>

#define DA850_EVM_PHY_ID "davinci_mdio-0:00"
#define DA850_LCD_PWR_PIN GPIO_TO_PIN(2, 8)
--
1.7.9.5

2012-10-05 17:04:32

by Matt Porter

[permalink] [raw]
Subject: [PATCH v4 4/7] ARM: davinci: add platform hook to fetch the SRAM pool

Adds sram_get_gen_pool() which allows platform code to get
the machine's SRAM gen_pool. The gen_pool may be passed in
platform data for driver genalloc use.

Signed-off-by: Matt Porter <[email protected]>
---
arch/arm/mach-davinci/include/mach/sram.h | 3 +++
arch/arm/mach-davinci/sram.c | 5 +++++
2 files changed, 8 insertions(+)

diff --git a/arch/arm/mach-davinci/include/mach/sram.h b/arch/arm/mach-davinci/include/mach/sram.h
index 111f7cc..4e5db56 100644
--- a/arch/arm/mach-davinci/include/mach/sram.h
+++ b/arch/arm/mach-davinci/include/mach/sram.h
@@ -24,4 +24,7 @@
extern void *sram_alloc(size_t len, dma_addr_t *dma);
extern void sram_free(void *addr, size_t len);

+/* Get the struct gen_pool * for use in platform data */
+extern struct gen_pool *sram_get_gen_pool(void);
+
#endif /* __MACH_SRAM_H */
diff --git a/arch/arm/mach-davinci/sram.c b/arch/arm/mach-davinci/sram.c
index fa56374..c5f7ee5 100644
--- a/arch/arm/mach-davinci/sram.c
+++ b/arch/arm/mach-davinci/sram.c
@@ -18,6 +18,11 @@

static struct gen_pool *sram_pool;

+struct gen_pool *sram_get_gen_pool(void)
+{
+ return sram_pool;
+}
+
void *sram_alloc(size_t len, dma_addr_t *dma)
{
unsigned long vaddr;
--
1.7.9.5

2012-10-05 17:04:29

by Matt Porter

[permalink] [raw]
Subject: [PATCH v4 5/7] ARM: davinci: add DA850 PRUSS support

Adds PRUSS clock support and registration helper for the
pruss_uio device.

Signed-off-by: Matt Porter <[email protected]>
---
arch/arm/mach-davinci/da850.c | 7 +++
arch/arm/mach-davinci/devices-da8xx.c | 65 ++++++++++++++++++++++++++++
arch/arm/mach-davinci/include/mach/da8xx.h | 2 +
3 files changed, 74 insertions(+)

diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index d8d69de..ebd7d6a 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -212,6 +212,12 @@ static struct clk tptc2_clk = {
.flags = ALWAYS_ENABLED,
};

+static struct clk pruss_clk = {
+ .name = "pruss",
+ .parent = &pll0_sysclk2,
+ .lpsc = DA8XX_LPSC0_PRUSS,
+};
+
static struct clk uart0_clk = {
.name = "uart0",
.parent = &pll0_sysclk2,
@@ -378,6 +384,7 @@ static struct clk_lookup da850_clks[] = {
CLK(NULL, "tptc1", &tptc1_clk),
CLK(NULL, "tpcc1", &tpcc1_clk),
CLK(NULL, "tptc2", &tptc2_clk),
+ CLK("pruss_uio", "pruss", &pruss_clk),
CLK(NULL, "uart0", &uart0_clk),
CLK(NULL, "uart1", &uart1_clk),
CLK(NULL, "uart2", &uart2_clk),
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index bd2f72b..995ad08 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -32,6 +32,7 @@
#define DA8XX_WDOG_BASE 0x01c21000 /* DA8XX_TIMER64P1_BASE */
#define DA8XX_I2C0_BASE 0x01c22000
#define DA8XX_RTC_BASE 0x01c23000
+#define DA8XX_PRUSS_MEM_BASE 0x01c30000
#define DA8XX_MMCSD0_BASE 0x01c40000
#define DA8XX_SPI0_BASE 0x01c41000
#define DA830_SPI1_BASE 0x01e12000
@@ -518,6 +519,70 @@ void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata)
}
}

+static struct resource da8xx_pruss_resources[] = {
+ {
+ .start = DA8XX_PRUSS_MEM_BASE,
+ .end = DA8XX_PRUSS_MEM_BASE + 0xFFFF,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = IRQ_DA8XX_EVTOUT0,
+ .end = IRQ_DA8XX_EVTOUT0,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = IRQ_DA8XX_EVTOUT1,
+ .end = IRQ_DA8XX_EVTOUT1,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = IRQ_DA8XX_EVTOUT2,
+ .end = IRQ_DA8XX_EVTOUT2,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = IRQ_DA8XX_EVTOUT3,
+ .end = IRQ_DA8XX_EVTOUT3,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = IRQ_DA8XX_EVTOUT4,
+ .end = IRQ_DA8XX_EVTOUT4,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = IRQ_DA8XX_EVTOUT5,
+ .end = IRQ_DA8XX_EVTOUT5,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = IRQ_DA8XX_EVTOUT6,
+ .end = IRQ_DA8XX_EVTOUT6,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = IRQ_DA8XX_EVTOUT7,
+ .end = IRQ_DA8XX_EVTOUT7,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device da8xx_pruss_uio_dev = {
+ .name = "pruss_uio",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(da8xx_pruss_resources),
+ .resource = da8xx_pruss_resources,
+ .dev = {
+ .coherent_dma_mask = DMA_BIT_MASK(32),
+ }
+};
+
+int __init da8xx_register_pruss_uio(struct uio_pruss_pdata *config)
+{
+ da8xx_pruss_uio_dev.dev.platform_data = config;
+ return platform_device_register(&da8xx_pruss_uio_dev);
+}
+
static const struct display_panel disp_panel = {
QVGA,
16,
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index 20553cf..138e618 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -25,6 +25,7 @@
#include <linux/platform_data/mmc-davinci.h>
#include <linux/platform_data/usb-davinci.h>
#include <linux/platform_data/spi-davinci.h>
+#include <linux/platform_data/uio_pruss.h>

extern void __iomem *da8xx_syscfg0_base;
extern void __iomem *da8xx_syscfg1_base;
@@ -83,6 +84,7 @@ int da8xx_register_watchdog(void);
int da8xx_register_usb20(unsigned mA, unsigned potpgt);
int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata);
int da8xx_register_emac(void);
+int da8xx_register_pruss_uio(struct uio_pruss_pdata *config);
int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata);
int da8xx_register_mmcsd0(struct davinci_mmc_config *config);
int da850_register_mmcsd1(struct davinci_mmc_config *config);
--
1.7.9.5

2012-10-05 17:05:09

by Matt Porter

[permalink] [raw]
Subject: [PATCH v4 7/7] ARM: davinci: register pruss_uio device on DA850 EVM

Configures the required pdata and registers the pruss_uio
platform device on the DA850 EVM.

Tested on AM180x-EVM using the PRU_memAccessPRUDataRam and
PRU_memAccessL3andDDR examples from the PRU userspace tools
available from http://www.ti.com/tool/sprc940

Signed-off-by: Matt Porter <[email protected]>
---
arch/arm/mach-davinci/board-da850-evm.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 7359375..6f9478b 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -31,6 +31,7 @@
#include <linux/platform_data/mtd-davinci.h>
#include <linux/platform_data/mtd-davinci-aemif.h>
#include <linux/platform_data/spi-davinci.h>
+#include <linux/platform_data/uio_pruss.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/tps6507x.h>
#include <linux/spi/spi.h>
@@ -40,6 +41,7 @@
#include <mach/cp_intc.h>
#include <mach/da8xx.h>
#include <mach/mux.h>
+#include <mach/sram.h>

#include <asm/mach-types.h>
#include <asm/mach/arch.h>
@@ -1253,6 +1255,10 @@ static __init int da850_wl12xx_init(void)

#endif /* CONFIG_DA850_WL12XX */

+struct uio_pruss_pdata da8xx_pruss_uio_pdata = {
+ .pintc_base = 0x4000,
+};
+
#define DA850EVM_SATA_REFCLKPN_RATE (100 * 1000 * 1000)

static __init void da850_evm_init(void)
@@ -1339,6 +1345,12 @@ static __init void da850_evm_init(void)
pr_warning("da850_evm_init: lcdcntl mux setup failed: %d\n",
ret);

+ da8xx_pruss_uio_pdata.sram_pool = sram_get_gen_pool();
+ ret = da8xx_register_pruss_uio(&da8xx_pruss_uio_pdata);
+ if (ret)
+ pr_warning("pruss_uio initialization failed: %d\n",
+ ret);
+
/* Handle board specific muxing for LCD here */
ret = davinci_cfg_reg_list(da850_evm_lcdc_pins);
if (ret)
--
1.7.9.5

2012-10-05 17:05:33

by Matt Porter

[permalink] [raw]
Subject: [PATCH v4 3/7] ARM: davinci: da850: changed SRAM allocator to shared ram.

From: Subhasish Ghosh <[email protected]>

This patch modifies the sram allocator to allocate memory
from the DA8XX shared RAM.

Regression tested suspend/resume on AM180x EVM.

Signed-off-by: Subhasish Ghosh <[email protected]>
[rebased onto consolidated SRAM patches]
Signed-off-by: Ben Gardiner <[email protected]>
[rebased to mainline as consolidated SRAM patches were dropped]
Signed-off-by: Matt Porter <[email protected]>
---
arch/arm/mach-davinci/da850.c | 4 ++--
arch/arm/mach-davinci/include/mach/da8xx.h | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index b4b324f..d8d69de 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -1081,8 +1081,8 @@ static struct davinci_soc_info davinci_soc_info_da850 = {
.gpio_irq = IRQ_DA8XX_GPIO0,
.serial_dev = &da8xx_serial_device,
.emac_pdata = &da8xx_emac_pdata,
- .sram_dma = DA8XX_ARM_RAM_BASE,
- .sram_len = SZ_8K,
+ .sram_dma = DA8XX_SHARED_RAM_BASE,
+ .sram_len = SZ_128K,
};

void __init da850_init(void)
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index c9ee723..20553cf 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -68,6 +68,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_SHARED_RAM_BASE 0x80000000
#define DA8XX_ARM_RAM_BASE 0xffff0000

void __init da830_init(void);
--
1.7.9.5

2012-10-08 10:53:41

by Sekhar Nori

[permalink] [raw]
Subject: Re: [PATCH v4 7/7] ARM: davinci: register pruss_uio device on DA850 EVM

On 10/5/2012 10:34 PM, Matt Porter wrote:
> Configures the required pdata and registers the pruss_uio
> platform device on the DA850 EVM.
>
> Tested on AM180x-EVM using the PRU_memAccessPRUDataRam and
> PRU_memAccessL3andDDR examples from the PRU userspace tools
> available from http://www.ti.com/tool/sprc940
>
> Signed-off-by: Matt Porter <[email protected]>
> ---
> arch/arm/mach-davinci/board-da850-evm.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> index 7359375..6f9478b 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -31,6 +31,7 @@
> #include <linux/platform_data/mtd-davinci.h>
> #include <linux/platform_data/mtd-davinci-aemif.h>
> #include <linux/platform_data/spi-davinci.h>
> +#include <linux/platform_data/uio_pruss.h>
> #include <linux/regulator/machine.h>
> #include <linux/regulator/tps6507x.h>
> #include <linux/spi/spi.h>
> @@ -40,6 +41,7 @@
> #include <mach/cp_intc.h>
> #include <mach/da8xx.h>
> #include <mach/mux.h>
> +#include <mach/sram.h>
>
> #include <asm/mach-types.h>
> #include <asm/mach/arch.h>
> @@ -1253,6 +1255,10 @@ static __init int da850_wl12xx_init(void)
>
> #endif /* CONFIG_DA850_WL12XX */
>
> +struct uio_pruss_pdata da8xx_pruss_uio_pdata = {
> + .pintc_base = 0x4000,
> +};
> +
> #define DA850EVM_SATA_REFCLKPN_RATE (100 * 1000 * 1000)
>
> static __init void da850_evm_init(void)
> @@ -1339,6 +1345,12 @@ static __init void da850_evm_init(void)
> pr_warning("da850_evm_init: lcdcntl mux setup failed: %d\n",
> ret);
>
> + da8xx_pruss_uio_pdata.sram_pool = sram_get_gen_pool();
> + ret = da8xx_register_pruss_uio(&da8xx_pruss_uio_pdata);
> + if (ret)
> + pr_warning("pruss_uio initialization failed: %d\n",
> + ret);

I failed to mention this last time around, but is there any reason
platform data will change from board to board? Looks like the pintc_base
is SoC specific and that all platforms would use SRAM when using the
pruss driver. Looks like you can make da8xx_register_pruss_uio() take no
parameters at all.

Thanks,
Sekhar

2012-10-08 10:57:54

by Sekhar Nori

[permalink] [raw]
Subject: Re: [PATCH v4 0/7] uio_pruss cleanup and platform support

On 10/5/2012 10:34 PM, Matt Porter wrote:

> This series enables uio_pruss on DA850 and removes use of the
> private SRAM API by the driver. The driver previously was not
> enabled by any platform and the private SRAM API was accessing
> an invalid SRAM bank.
>
> It is regression tested on AM180x EVM with suspend/resume due
> to the new use of the shared SRAM for both PM and PRUSS. The
> uio_pruss driver is tested on the same platform using the
> PRU_memAccessPRUDataRam and PRU_memAccessL3andDDR examples from
> the PRU userspace tools available from http://www.ti.com/tool/sprc940

I applied patches 2/7, 3/7 and 6/7 of this series for v3.8. I have some
comments on the board patch. Rest of the patches depend on acceptance of
1/7 so I will take them only after that is accepted.

Thanks,
Sekhar

2012-10-08 11:04:55

by Sekhar Nori

[permalink] [raw]
Subject: Re: [PATCH v4 6/7] ARM: davinci: clean up DA850 EVM include ordering

On 10/5/2012 10:34 PM, Matt Porter wrote:
> Reorder includes so they are grouped by linux/mach/asm
>
> Signed-off-by: Matt Porter <[email protected]>

Thanks for the clean-up. While committing, I changed the subject to:

"ARM: davinci: da850 evm: clean up include ordering"

which is the convention I prefer.

Thanks,
Sekhar

2012-10-08 11:58:01

by Matt Porter

[permalink] [raw]
Subject: Re: [PATCH v4 7/7] ARM: davinci: register pruss_uio device on DA850 EVM

On Mon, Oct 08, 2012 at 04:23:05PM +0530, Sekhar Nori wrote:
> On 10/5/2012 10:34 PM, Matt Porter wrote:
> > Configures the required pdata and registers the pruss_uio
> > platform device on the DA850 EVM.
> >
> > Tested on AM180x-EVM using the PRU_memAccessPRUDataRam and
> > PRU_memAccessL3andDDR examples from the PRU userspace tools
> > available from http://www.ti.com/tool/sprc940
> >
> > Signed-off-by: Matt Porter <[email protected]>
> > ---
> > arch/arm/mach-davinci/board-da850-evm.c | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> > index 7359375..6f9478b 100644
> > --- a/arch/arm/mach-davinci/board-da850-evm.c
> > +++ b/arch/arm/mach-davinci/board-da850-evm.c
> > @@ -31,6 +31,7 @@
> > #include <linux/platform_data/mtd-davinci.h>
> > #include <linux/platform_data/mtd-davinci-aemif.h>
> > #include <linux/platform_data/spi-davinci.h>
> > +#include <linux/platform_data/uio_pruss.h>
> > #include <linux/regulator/machine.h>
> > #include <linux/regulator/tps6507x.h>
> > #include <linux/spi/spi.h>
> > @@ -40,6 +41,7 @@
> > #include <mach/cp_intc.h>
> > #include <mach/da8xx.h>
> > #include <mach/mux.h>
> > +#include <mach/sram.h>
> >
> > #include <asm/mach-types.h>
> > #include <asm/mach/arch.h>
> > @@ -1253,6 +1255,10 @@ static __init int da850_wl12xx_init(void)
> >
> > #endif /* CONFIG_DA850_WL12XX */
> >
> > +struct uio_pruss_pdata da8xx_pruss_uio_pdata = {
> > + .pintc_base = 0x4000,
> > +};
> > +
> > #define DA850EVM_SATA_REFCLKPN_RATE (100 * 1000 * 1000)
> >
> > static __init void da850_evm_init(void)
> > @@ -1339,6 +1345,12 @@ static __init void da850_evm_init(void)
> > pr_warning("da850_evm_init: lcdcntl mux setup failed: %d\n",
> > ret);
> >
> > + da8xx_pruss_uio_pdata.sram_pool = sram_get_gen_pool();
> > + ret = da8xx_register_pruss_uio(&da8xx_pruss_uio_pdata);
> > + if (ret)
> > + pr_warning("pruss_uio initialization failed: %d\n",
> > + ret);
>
> I failed to mention this last time around, but is there any reason
> platform data will change from board to board? Looks like the pintc_base
> is SoC specific and that all platforms would use SRAM when using the
> pruss driver. Looks like you can make da8xx_register_pruss_uio() take no
> parameters at all.

No reason, just oversight here. I'll update these two patches so this is
done at the SoC level.

-Matt

2012-10-08 12:03:03

by Matt Porter

[permalink] [raw]
Subject: Re: [PATCH v4 0/7] uio_pruss cleanup and platform support

On Mon, Oct 08, 2012 at 04:27:20PM +0530, Sekhar Nori wrote:
> On 10/5/2012 10:34 PM, Matt Porter wrote:
>
> > This series enables uio_pruss on DA850 and removes use of the
> > private SRAM API by the driver. The driver previously was not
> > enabled by any platform and the private SRAM API was accessing
> > an invalid SRAM bank.
> >
> > It is regression tested on AM180x EVM with suspend/resume due
> > to the new use of the shared SRAM for both PM and PRUSS. The
> > uio_pruss driver is tested on the same platform using the
> > PRU_memAccessPRUDataRam and PRU_memAccessL3andDDR examples from
> > the PRU userspace tools available from http://www.ti.com/tool/sprc940
>
> I applied patches 2/7, 3/7 and 6/7 of this series for v3.8. I have some
> comments on the board patch. Rest of the patches depend on acceptance of
> 1/7 so I will take them only after that is accepted.

Ok, thanks...and I'll post a v5 of 5/7 and 7/7 and those should be ready
when 1/7 is accepted.

-Matt

2012-10-08 13:52:27

by Matt Porter

[permalink] [raw]
Subject: [PATCH v5 5/7] ARM: davinci: da8xx: add DA850 PRUSS support

Adds PRUSS clock support and registration helper for the
uio_pruss device.

Signed-off-by: Matt Porter <[email protected]>
---
arch/arm/mach-davinci/da850.c | 7 +++
arch/arm/mach-davinci/devices-da8xx.c | 71 ++++++++++++++++++++++++++++
arch/arm/mach-davinci/include/mach/da8xx.h | 2 +
3 files changed, 80 insertions(+)

diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index d8d69de..ebd7d6a 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -212,6 +212,12 @@ static struct clk tptc2_clk = {
.flags = ALWAYS_ENABLED,
};

+static struct clk pruss_clk = {
+ .name = "pruss",
+ .parent = &pll0_sysclk2,
+ .lpsc = DA8XX_LPSC0_PRUSS,
+};
+
static struct clk uart0_clk = {
.name = "uart0",
.parent = &pll0_sysclk2,
@@ -378,6 +384,7 @@ static struct clk_lookup da850_clks[] = {
CLK(NULL, "tptc1", &tptc1_clk),
CLK(NULL, "tpcc1", &tpcc1_clk),
CLK(NULL, "tptc2", &tptc2_clk),
+ CLK("pruss_uio", "pruss", &pruss_clk),
CLK(NULL, "uart0", &uart0_clk),
CLK(NULL, "uart1", &uart1_clk),
CLK(NULL, "uart2", &uart2_clk),
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index bd2f72b..36d09d7 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -22,6 +22,7 @@
#include <mach/time.h>
#include <mach/da8xx.h>
#include <mach/cpuidle.h>
+#include <mach/sram.h>

#include "clock.h"
#include "asp.h"
@@ -32,6 +33,7 @@
#define DA8XX_WDOG_BASE 0x01c21000 /* DA8XX_TIMER64P1_BASE */
#define DA8XX_I2C0_BASE 0x01c22000
#define DA8XX_RTC_BASE 0x01c23000
+#define DA8XX_PRUSS_MEM_BASE 0x01c30000
#define DA8XX_MMCSD0_BASE 0x01c40000
#define DA8XX_SPI0_BASE 0x01c41000
#define DA830_SPI1_BASE 0x01e12000
@@ -518,6 +520,75 @@ void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata)
}
}

+static struct resource da8xx_pruss_resources[] = {
+ {
+ .start = DA8XX_PRUSS_MEM_BASE,
+ .end = DA8XX_PRUSS_MEM_BASE + 0xFFFF,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = IRQ_DA8XX_EVTOUT0,
+ .end = IRQ_DA8XX_EVTOUT0,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = IRQ_DA8XX_EVTOUT1,
+ .end = IRQ_DA8XX_EVTOUT1,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = IRQ_DA8XX_EVTOUT2,
+ .end = IRQ_DA8XX_EVTOUT2,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = IRQ_DA8XX_EVTOUT3,
+ .end = IRQ_DA8XX_EVTOUT3,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = IRQ_DA8XX_EVTOUT4,
+ .end = IRQ_DA8XX_EVTOUT4,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = IRQ_DA8XX_EVTOUT5,
+ .end = IRQ_DA8XX_EVTOUT5,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = IRQ_DA8XX_EVTOUT6,
+ .end = IRQ_DA8XX_EVTOUT6,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = IRQ_DA8XX_EVTOUT7,
+ .end = IRQ_DA8XX_EVTOUT7,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct uio_pruss_pdata da8xx_uio_pruss_pdata = {
+ .pintc_base = 0x4000,
+};
+
+static struct platform_device da8xx_uio_pruss_dev = {
+ .name = "pruss_uio",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(da8xx_pruss_resources),
+ .resource = da8xx_pruss_resources,
+ .dev = {
+ .coherent_dma_mask = DMA_BIT_MASK(32),
+ .platform_data = &da8xx_uio_pruss_pdata,
+ }
+};
+
+int __init da8xx_register_uio_pruss(void)
+{
+ da8xx_uio_pruss_pdata.sram_pool = sram_get_gen_pool();
+ return platform_device_register(&da8xx_uio_pruss_dev);
+}
+
static const struct display_panel disp_panel = {
QVGA,
16,
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index 20553cf..9262821 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -25,6 +25,7 @@
#include <linux/platform_data/mmc-davinci.h>
#include <linux/platform_data/usb-davinci.h>
#include <linux/platform_data/spi-davinci.h>
+#include <linux/platform_data/uio_pruss.h>

extern void __iomem *da8xx_syscfg0_base;
extern void __iomem *da8xx_syscfg1_base;
@@ -83,6 +84,7 @@ int da8xx_register_watchdog(void);
int da8xx_register_usb20(unsigned mA, unsigned potpgt);
int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata);
int da8xx_register_emac(void);
+int da8xx_register_uio_pruss(void);
int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata);
int da8xx_register_mmcsd0(struct davinci_mmc_config *config);
int da850_register_mmcsd1(struct davinci_mmc_config *config);
--
1.7.9.5

2012-10-08 13:54:03

by Matt Porter

[permalink] [raw]
Subject: [PATCH v5 7/7] ARM: davinci: da850 evm: register uio_pruss device

Registers the uio_pruss platform device on the DA850 EVM.

Tested on AM180x-EVM using the PRU_memAccessPRUDataRam and
PRU_memAccessL3andDDR examples from the PRU userspace tools
available from http://www.ti.com/tool/sprc940

Signed-off-by: Matt Porter <[email protected]>
---
arch/arm/mach-davinci/board-da850-evm.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 7359375..9e7f954 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -31,6 +31,7 @@
#include <linux/platform_data/mtd-davinci.h>
#include <linux/platform_data/mtd-davinci-aemif.h>
#include <linux/platform_data/spi-davinci.h>
+#include <linux/platform_data/uio_pruss.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/tps6507x.h>
#include <linux/spi/spi.h>
@@ -1339,6 +1340,11 @@ static __init void da850_evm_init(void)
pr_warning("da850_evm_init: lcdcntl mux setup failed: %d\n",
ret);

+ ret = da8xx_register_uio_pruss();
+ if (ret)
+ pr_warning("da850_evm_init: pruss initialization failed: %d\n",
+ ret);
+
/* Handle board specific muxing for LCD here */
ret = davinci_cfg_reg_list(da850_evm_lcdc_pins);
if (ret)
--
1.7.9.5

2012-10-18 14:52:20

by Matt Porter

[permalink] [raw]
Subject: Re: [PATCH v4 1/7] uio: uio_pruss: replace private SRAM API with genalloc

On Fri, Oct 05, 2012 at 01:04:40PM -0400, Matt Porter wrote:
> Remove the use of the private DaVinci SRAM API in favor
> of genalloc. The pool to be used is provided by platform
> data.
>
> Signed-off-by: Matt Porter <[email protected]>

Hans,

Any additional concerns on this patch? Sekhar is holding off on applying
parts 4,5,7 for davinci until this is accepted.

Thanks,
Matt

> ---
> drivers/uio/Kconfig | 1 +
> drivers/uio/uio_pruss.c | 24 +++++++++++++++++-------
> include/linux/platform_data/uio_pruss.h | 3 ++-
> 3 files changed, 20 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
> index 6f3ea9b..c48b938 100644
> --- a/drivers/uio/Kconfig
> +++ b/drivers/uio/Kconfig
> @@ -97,6 +97,7 @@ config UIO_NETX
> config UIO_PRUSS
> tristate "Texas Instruments PRUSS driver"
> depends on ARCH_DAVINCI_DA850
> + select GENERIC_ALLOCATOR
> help
> PRUSS driver for OMAPL138/DA850/AM18XX devices
> PRUSS driver requires user space components, examples and user space
> diff --git a/drivers/uio/uio_pruss.c b/drivers/uio/uio_pruss.c
> index 33a7a27..f8738de 100644
> --- a/drivers/uio/uio_pruss.c
> +++ b/drivers/uio/uio_pruss.c
> @@ -25,7 +25,7 @@
> #include <linux/clk.h>
> #include <linux/dma-mapping.h>
> #include <linux/slab.h>
> -#include <mach/sram.h>
> +#include <linux/genalloc.h>
>
> #define DRV_NAME "pruss_uio"
> #define DRV_VERSION "1.0"
> @@ -65,10 +65,11 @@ struct uio_pruss_dev {
> dma_addr_t sram_paddr;
> dma_addr_t ddr_paddr;
> void __iomem *prussio_vaddr;
> - void *sram_vaddr;
> + unsigned long sram_vaddr;
> void *ddr_vaddr;
> unsigned int hostirq_start;
> unsigned int pintc_base;
> + struct gen_pool *sram_pool;
> };
>
> static irqreturn_t pruss_handler(int irq, struct uio_info *info)
> @@ -106,7 +107,9 @@ static void pruss_cleanup(struct platform_device *dev,
> gdev->ddr_paddr);
> }
> if (gdev->sram_vaddr)
> - sram_free(gdev->sram_vaddr, sram_pool_sz);
> + gen_pool_free(gdev->sram_pool,
> + gdev->sram_vaddr,
> + sram_pool_sz);
> kfree(gdev->info);
> clk_put(gdev->pruss_clk);
> kfree(gdev);
> @@ -152,10 +155,17 @@ static int __devinit pruss_probe(struct platform_device *dev)
> goto out_free;
> }
>
> - gdev->sram_vaddr = sram_alloc(sram_pool_sz, &(gdev->sram_paddr));
> - if (!gdev->sram_vaddr) {
> - dev_err(&dev->dev, "Could not allocate SRAM pool\n");
> - goto out_free;
> + if (pdata->sram_pool) {
> + gdev->sram_pool = pdata->sram_pool;
> + gdev->sram_vaddr =
> + gen_pool_alloc(gdev->sram_pool, sram_pool_sz);
> + if (!gdev->sram_vaddr) {
> + dev_err(&dev->dev, "Could not allocate SRAM pool\n");
> + goto out_free;
> + }
> + gdev->sram_paddr =
> + gen_pool_virt_to_phys(gdev->sram_pool,
> + gdev->sram_vaddr);
> }
>
> gdev->ddr_vaddr = dma_alloc_coherent(&dev->dev, extram_pool_sz,
> diff --git a/include/linux/platform_data/uio_pruss.h b/include/linux/platform_data/uio_pruss.h
> index f39140a..3d47d21 100644
> --- a/include/linux/platform_data/uio_pruss.h
> +++ b/include/linux/platform_data/uio_pruss.h
> @@ -20,6 +20,7 @@
>
> /* To configure the PRUSS INTC base offset for UIO driver */
> struct uio_pruss_pdata {
> - u32 pintc_base;
> + u32 pintc_base;
> + struct gen_pool *sram_pool;
> };
> #endif /* _UIO_PRUSS_H_ */
> --
> 1.7.9.5
>

2012-10-21 23:15:18

by Hans J. Koch

[permalink] [raw]
Subject: Re: [PATCH v4 1/7] uio: uio_pruss: replace private SRAM API with genalloc

On Thu, Oct 18, 2012 at 10:53:38AM -0400, Matt Porter wrote:
> On Fri, Oct 05, 2012 at 01:04:40PM -0400, Matt Porter wrote:
> > Remove the use of the private DaVinci SRAM API in favor
> > of genalloc. The pool to be used is provided by platform
> > data.
> >
> > Signed-off-by: Matt Porter <[email protected]>
>
> Hans,
>
> Any additional concerns on this patch?

Not from my side. I was waiting for your discussion to calm down.

> Sekhar is holding off on applying
> parts 4,5,7 for davinci until this is accepted.

You can add my

Signed-off-by: "Hans J. Koch" <[email protected]>

Thanks,
Hans

>
> Thanks,
> Matt
>
> > ---
> > drivers/uio/Kconfig | 1 +
> > drivers/uio/uio_pruss.c | 24 +++++++++++++++++-------
> > include/linux/platform_data/uio_pruss.h | 3 ++-
> > 3 files changed, 20 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
> > index 6f3ea9b..c48b938 100644
> > --- a/drivers/uio/Kconfig
> > +++ b/drivers/uio/Kconfig
> > @@ -97,6 +97,7 @@ config UIO_NETX
> > config UIO_PRUSS
> > tristate "Texas Instruments PRUSS driver"
> > depends on ARCH_DAVINCI_DA850
> > + select GENERIC_ALLOCATOR
> > help
> > PRUSS driver for OMAPL138/DA850/AM18XX devices
> > PRUSS driver requires user space components, examples and user space
> > diff --git a/drivers/uio/uio_pruss.c b/drivers/uio/uio_pruss.c
> > index 33a7a27..f8738de 100644
> > --- a/drivers/uio/uio_pruss.c
> > +++ b/drivers/uio/uio_pruss.c
> > @@ -25,7 +25,7 @@
> > #include <linux/clk.h>
> > #include <linux/dma-mapping.h>
> > #include <linux/slab.h>
> > -#include <mach/sram.h>
> > +#include <linux/genalloc.h>
> >
> > #define DRV_NAME "pruss_uio"
> > #define DRV_VERSION "1.0"
> > @@ -65,10 +65,11 @@ struct uio_pruss_dev {
> > dma_addr_t sram_paddr;
> > dma_addr_t ddr_paddr;
> > void __iomem *prussio_vaddr;
> > - void *sram_vaddr;
> > + unsigned long sram_vaddr;
> > void *ddr_vaddr;
> > unsigned int hostirq_start;
> > unsigned int pintc_base;
> > + struct gen_pool *sram_pool;
> > };
> >
> > static irqreturn_t pruss_handler(int irq, struct uio_info *info)
> > @@ -106,7 +107,9 @@ static void pruss_cleanup(struct platform_device *dev,
> > gdev->ddr_paddr);
> > }
> > if (gdev->sram_vaddr)
> > - sram_free(gdev->sram_vaddr, sram_pool_sz);
> > + gen_pool_free(gdev->sram_pool,
> > + gdev->sram_vaddr,
> > + sram_pool_sz);
> > kfree(gdev->info);
> > clk_put(gdev->pruss_clk);
> > kfree(gdev);
> > @@ -152,10 +155,17 @@ static int __devinit pruss_probe(struct platform_device *dev)
> > goto out_free;
> > }
> >
> > - gdev->sram_vaddr = sram_alloc(sram_pool_sz, &(gdev->sram_paddr));
> > - if (!gdev->sram_vaddr) {
> > - dev_err(&dev->dev, "Could not allocate SRAM pool\n");
> > - goto out_free;
> > + if (pdata->sram_pool) {
> > + gdev->sram_pool = pdata->sram_pool;
> > + gdev->sram_vaddr =
> > + gen_pool_alloc(gdev->sram_pool, sram_pool_sz);
> > + if (!gdev->sram_vaddr) {
> > + dev_err(&dev->dev, "Could not allocate SRAM pool\n");
> > + goto out_free;
> > + }
> > + gdev->sram_paddr =
> > + gen_pool_virt_to_phys(gdev->sram_pool,
> > + gdev->sram_vaddr);
> > }
> >
> > gdev->ddr_vaddr = dma_alloc_coherent(&dev->dev, extram_pool_sz,
> > diff --git a/include/linux/platform_data/uio_pruss.h b/include/linux/platform_data/uio_pruss.h
> > index f39140a..3d47d21 100644
> > --- a/include/linux/platform_data/uio_pruss.h
> > +++ b/include/linux/platform_data/uio_pruss.h
> > @@ -20,6 +20,7 @@
> >
> > /* To configure the PRUSS INTC base offset for UIO driver */
> > struct uio_pruss_pdata {
> > - u32 pintc_base;
> > + u32 pintc_base;
> > + struct gen_pool *sram_pool;
> > };
> > #endif /* _UIO_PRUSS_H_ */
> > --
> > 1.7.9.5
> >
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

2012-10-24 16:54:36

by Matt Porter

[permalink] [raw]
Subject: Re: [PATCH v4 0/7] uio_pruss cleanup and platform support

On Mon, Oct 08, 2012 at 04:27:20PM +0530, Sekhar Nori wrote:
> On 10/5/2012 10:34 PM, Matt Porter wrote:
>
> > This series enables uio_pruss on DA850 and removes use of the
> > private SRAM API by the driver. The driver previously was not
> > enabled by any platform and the private SRAM API was accessing
> > an invalid SRAM bank.
> >
> > It is regression tested on AM180x EVM with suspend/resume due
> > to the new use of the shared SRAM for both PM and PRUSS. The
> > uio_pruss driver is tested on the same platform using the
> > PRU_memAccessPRUDataRam and PRU_memAccessL3andDDR examples from
> > the PRU userspace tools available from http://www.ti.com/tool/sprc940
>
> I applied patches 2/7, 3/7 and 6/7 of this series for v3.8. I have some
> comments on the board patch. Rest of the patches depend on acceptance of
> 1/7 so I will take them only after that is accepted.

Ok, Hans has accepted 1/7, will you take the entire series through the
Davinci tree?

-Matt

2012-10-25 11:21:24

by Sekhar Nori

[permalink] [raw]
Subject: Re: [PATCH v5 7/7] ARM: davinci: da850 evm: register uio_pruss device

On 10/8/2012 7:24 PM, Matt Porter wrote:
> Registers the uio_pruss platform device on the DA850 EVM.
>
> Tested on AM180x-EVM using the PRU_memAccessPRUDataRam and
> PRU_memAccessL3andDDR examples from the PRU userspace tools
> available from http://www.ti.com/tool/sprc940
>
> Signed-off-by: Matt Porter <[email protected]>
> ---
> arch/arm/mach-davinci/board-da850-evm.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> index 7359375..9e7f954 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -31,6 +31,7 @@
> #include <linux/platform_data/mtd-davinci.h>
> #include <linux/platform_data/mtd-davinci-aemif.h>
> #include <linux/platform_data/spi-davinci.h>
> +#include <linux/platform_data/uio_pruss.h>
> #include <linux/regulator/machine.h>
> #include <linux/regulator/tps6507x.h>
> #include <linux/spi/spi.h>
> @@ -1339,6 +1340,11 @@ static __init void da850_evm_init(void)
> pr_warning("da850_evm_init: lcdcntl mux setup failed: %d\n",
> ret);
>
> + ret = da8xx_register_uio_pruss();
> + if (ret)
> + pr_warning("da850_evm_init: pruss initialization failed: %d\n",

So this gave a checkpatch warning asking you to use pr_warn() instead. I
fixed this locally.

Thanks,
Sekhar

2012-10-25 11:38:48

by Sekhar Nori

[permalink] [raw]
Subject: Re: [PATCH v4 0/7] uio_pruss cleanup and platform support

On Wed, Oct 24, 2012 at 10:24 PM, Matt Porter <[email protected]> wrote:
> On Mon, Oct 08, 2012 at 04:27:20PM +0530, Sekhar Nori wrote:
>> On 10/5/2012 10:34 PM, Matt Porter wrote:
>>
>> > This series enables uio_pruss on DA850 and removes use of the
>> > private SRAM API by the driver. The driver previously was not
>> > enabled by any platform and the private SRAM API was accessing
>> > an invalid SRAM bank.
>> >
>> > It is regression tested on AM180x EVM with suspend/resume due
>> > to the new use of the shared SRAM for both PM and PRUSS. The
>> > uio_pruss driver is tested on the same platform using the
>> > PRU_memAccessPRUDataRam and PRU_memAccessL3andDDR examples from
>> > the PRU userspace tools available from http://www.ti.com/tool/sprc940
>>
>> I applied patches 2/7, 3/7 and 6/7 of this series for v3.8. I have some
>> comments on the board patch. Rest of the patches depend on acceptance of
>> 1/7 so I will take them only after that is accepted.
>
> Ok, Hans has accepted 1/7, will you take the entire series through the
> Davinci tree?

Yes.

Thanks,
Sekhar