]> rtime.felk.cvut.cz Git - can-eth-gw-linux.git/commitdiff
Merge tag 'davinci-for-v3.8/dt' of git://gitorious.org/linux-davinci/linux-davinci...
authorOlof Johansson <olof@lixom.net>
Tue, 20 Nov 2012 06:24:44 +0000 (22:24 -0800)
committerOlof Johansson <olof@lixom.net>
Tue, 20 Nov 2012 06:25:01 +0000 (22:25 -0800)
From Sekhar Nori:

These changes add DT boot support to DaVinci DA850
SoC.

* tag 'davinci-for-v3.8/dt' of git://gitorious.org/linux-davinci/linux-davinci:
  ARM: davinci: da850: generate dtbs for da850 boards
  ARM: davinci: add support for am1808 based EnBW CMC board
  ARM: davinci: da850 evm: add DT data
  ARM: davinci: da850: add SoC DT data
  ARM: davinci: da850: add DT boot support
  ARM: davinci: da8xx: add DA850 PRUSS support
  ARM: davinci: add platform hook to fetch the SRAM pool
  ARM: davinci: da850: changed SRAM allocator to shared ram.
  ARM: davinci: sram: switch from iotable to ioremapped regions
  uio: uio_pruss: replace private SRAM API with genalloc
  ARM: davinci: serial: provide API to initialze UART clocks
  ARM: davinci: convert platform code to use clk_prepare/clk_unprepare

Signed-off-by: Olof Johansson <olof@lixom.net>
30 files changed:
Documentation/devicetree/bindings/arm/davinci.txt [new file with mode: 0644]
arch/arm/Kconfig
arch/arm/boot/dts/da850-enbw-cmc.dts [new file with mode: 0644]
arch/arm/boot/dts/da850-evm.dts [new file with mode: 0644]
arch/arm/boot/dts/da850.dtsi [new file with mode: 0644]
arch/arm/mach-davinci/Kconfig
arch/arm/mach-davinci/Makefile
arch/arm/mach-davinci/Makefile.boot
arch/arm/mach-davinci/board-dm355-evm.c
arch/arm/mach-davinci/board-dm355-leopard.c
arch/arm/mach-davinci/board-dm365-evm.c
arch/arm/mach-davinci/board-dm644x-evm.c
arch/arm/mach-davinci/board-neuros-osd2.c
arch/arm/mach-davinci/da850.c
arch/arm/mach-davinci/da8xx-dt.c [new file with mode: 0644]
arch/arm/mach-davinci/devices-da8xx.c
arch/arm/mach-davinci/dm355.c
arch/arm/mach-davinci/dm365.c
arch/arm/mach-davinci/dm644x.c
arch/arm/mach-davinci/dm646x.c
arch/arm/mach-davinci/include/mach/common.h
arch/arm/mach-davinci/include/mach/da8xx.h
arch/arm/mach-davinci/include/mach/serial.h
arch/arm/mach-davinci/include/mach/sram.h
arch/arm/mach-davinci/serial.c
arch/arm/mach-davinci/sram.c
arch/arm/mach-davinci/time.c
drivers/uio/Kconfig
drivers/uio/uio_pruss.c
include/linux/platform_data/uio_pruss.h

diff --git a/Documentation/devicetree/bindings/arm/davinci.txt b/Documentation/devicetree/bindings/arm/davinci.txt
new file mode 100644 (file)
index 0000000..cfaeda4
--- /dev/null
@@ -0,0 +1,17 @@
+Texas Instruments DaVinci Platforms Device Tree Bindings
+--------------------------------------------------------
+
+DA850/OMAP-L138/AM18x Evaluation Module (EVM) board
+Required root node properties:
+    - compatible = "ti,da850-evm", "ti,da850";
+
+EnBW AM1808 based CMC board
+Required root node properties:
+    - compatible = "enbw,cmc", "ti,da850;
+
+Generic DaVinci Boards
+----------------------
+
+DA850/OMAP-L138/AM18x generic board
+Required root node properties:
+    - compatible = "ti,da850";
index 23252783e93f37bbdd78bb7bf3fa92a10b027ccd..dbbe74c10b1ce2ea9e082c570bca360d3ea0286a 100644 (file)
@@ -911,6 +911,7 @@ config ARCH_DAVINCI
        select GENERIC_IRQ_CHIP
        select HAVE_IDE
        select NEED_MACH_GPIO_H
+       select USE_OF
        select ZONE_DMA
        help
          Support for TI's DaVinci platform.
diff --git a/arch/arm/boot/dts/da850-enbw-cmc.dts b/arch/arm/boot/dts/da850-enbw-cmc.dts
new file mode 100644 (file)
index 0000000..422fdb3
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Device Tree for AM1808 EnBW CMC board
+ *
+ * Copyright 2012 DENX Software Engineering GmbH
+ * Heiko Schocher <hs@denx.de>
+ *
+ * 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;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+/dts-v1/;
+/include/ "da850.dtsi"
+
+/ {
+       compatible = "enbw,cmc", "ti,da850";
+       model = "EnBW CMC";
+
+       soc {
+               serial0: serial@1c42000 {
+                       status = "okay";
+               };
+               serial1: serial@1d0c000 {
+                       status = "okay";
+               };
+               serial2: serial@1d0d000 {
+                       status = "okay";
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
new file mode 100644 (file)
index 0000000..37dc5a3
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Device Tree for DA850 EVM board
+ *
+ * Copyright (C) 2012 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.
+ */
+/dts-v1/;
+/include/ "da850.dtsi"
+
+/ {
+       compatible = "ti,da850-evm", "ti,da850";
+       model = "DA850/AM1808/OMAP-L138 EVM";
+
+       soc {
+               serial0: serial@1c42000 {
+                       status = "okay";
+               };
+               serial1: serial@1d0c000 {
+                       status = "okay";
+               };
+               serial2: serial@1d0d000 {
+                       status = "okay";
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
new file mode 100644 (file)
index 0000000..640ab75
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2012 DENX Software Engineering GmbH
+ * Heiko Schocher <hs@denx.de>
+ *
+ * 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;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+/include/ "skeleton.dtsi"
+
+/ {
+       arm {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+               intc: interrupt-controller {
+                       compatible = "ti,cp-intc";
+                       interrupt-controller;
+                       #interrupt-cells = <1>;
+                       ti,intc-size = <100>;
+                       reg = <0xfffee000 0x2000>;
+               };
+       };
+       soc {
+               compatible = "simple-bus";
+               model = "da850";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0x0 0x01c00000 0x400000>;
+
+               serial0: serial@1c42000 {
+                       compatible = "ns16550a";
+                       reg = <0x42000 0x100>;
+                       clock-frequency = <150000000>;
+                       reg-shift = <2>;
+                       interrupts = <25>;
+                       interrupt-parent = <&intc>;
+                       status = "disabled";
+               };
+               serial1: serial@1d0c000 {
+                       compatible = "ns16550a";
+                       reg = <0x10c000 0x100>;
+                       clock-frequency = <150000000>;
+                       reg-shift = <2>;
+                       interrupts = <53>;
+                       interrupt-parent = <&intc>;
+                       status = "disabled";
+               };
+               serial2: serial@1d0d000 {
+                       compatible = "ns16550a";
+                       reg = <0x10d000 0x100>;
+                       clock-frequency = <150000000>;
+                       reg-shift = <2>;
+                       interrupts = <61>;
+                       interrupt-parent = <&intc>;
+                       status = "disabled";
+               };
+       };
+};
index f8eecb9594132b73375cc9fbe578159755005405..0153950f606806e77eca03b622c2961438221129 100644 (file)
@@ -58,6 +58,14 @@ config ARCH_DAVINCI_TNETV107X
 
 comment "DaVinci Board Type"
 
+config MACH_DA8XX_DT
+       bool "Support DA8XX platforms using device tree"
+       default y
+       depends on ARCH_DAVINCI_DA8XX
+       help
+         Say y here to include support for TI DaVinci DA850 based using
+         Flattened Device Tree. More information at Documentation/devicetree
+
 config MACH_DAVINCI_EVM
        bool "TI DM644x EVM"
        default ARCH_DAVINCI_DM644x
index 2227effcb0e98bdea4968b95617e06cf3c0b5f39..fb5c1aa98a63ed1d4c0ec1fb9ccff1be6172948e 100644 (file)
@@ -22,6 +22,7 @@ obj-$(CONFIG_AINTC)                   += irq.o
 obj-$(CONFIG_CP_INTC)                  += cp_intc.o
 
 # Board specific
+obj-$(CONFIG_MACH_DA8XX_DT)            += da8xx-dt.o
 obj-$(CONFIG_MACH_DAVINCI_EVM)         += board-dm644x-evm.o
 obj-$(CONFIG_MACH_SFFSDR)              += board-sffsdr.o
 obj-$(CONFIG_MACH_NEUROS_OSD2)         += board-neuros-osd2.o
index 04a6c4e67b146dee4aeaab855b55a63f554e3674..5c5a95a9d7d2b17c716ebc06e96ea31c529046c8 100644 (file)
@@ -11,3 +11,5 @@ else
 params_phys-y  := 0x80000100
 initrd_phys-y  := 0x80800000
 endif
+
+dtb-$(CONFIG_MACH_DA8XX_DT)    += da850-enbw-cmc.dtb da850-evm.dtb
index 88ebea89abdf9cbbd9233527057397d297436b7b..cdf8d0746e799df1e31aab36d96ac8f3a116cbb2 100644 (file)
@@ -324,7 +324,7 @@ static __init void dm355_evm_init(void)
        if (IS_ERR(aemif))
                WARN("%s: unable to get AEMIF clock\n", __func__);
        else
-               clk_enable(aemif);
+               clk_prepare_enable(aemif);
 
        platform_add_devices(davinci_evm_devices,
                             ARRAY_SIZE(davinci_evm_devices));
index 2f88103c64595c1f68a3ad9f7ca026e0b8644741..d41954507fc26794433d2fa248e14254b1b2f73c 100644 (file)
@@ -246,7 +246,7 @@ static __init void dm355_leopard_init(void)
        if (IS_ERR(aemif))
                WARN("%s: unable to get AEMIF clock\n", __func__);
        else
-               clk_enable(aemif);
+               clk_prepare_enable(aemif);
 
        platform_add_devices(davinci_leopard_devices,
                             ARRAY_SIZE(davinci_leopard_devices));
index 1b4a8adcfdc9f1f86f87079c8ab8b009e0bc105a..5d49c75388ca9782f6a8192469d6c6a0b93c6cdc 100644 (file)
@@ -478,7 +478,7 @@ static void __init evm_init_cpld(void)
        aemif_clk = clk_get(NULL, "aemif");
        if (IS_ERR(aemif_clk))
                return;
-       clk_enable(aemif_clk);
+       clk_prepare_enable(aemif_clk);
 
        if (request_mem_region(DM365_ASYNC_EMIF_DATA_CE1_BASE, SECTION_SIZE,
                        "cpld") == NULL)
@@ -489,7 +489,7 @@ static void __init evm_init_cpld(void)
                                SECTION_SIZE);
 fail:
                pr_err("ERROR: can't map CPLD\n");
-               clk_disable(aemif_clk);
+               clk_disable_unprepare(aemif_clk);
                return;
        }
 
index f22572cee49d89ade236851a04fdf2ba94fed2e6..a84dfcbc11544e6b6c9f4b56b3c5d1fcf76108d2 100644 (file)
@@ -776,7 +776,7 @@ static __init void davinci_evm_init(void)
        struct davinci_soc_info *soc_info = &davinci_soc_info;
 
        aemif_clk = clk_get(NULL, "aemif");
-       clk_enable(aemif_clk);
+       clk_prepare_enable(aemif_clk);
 
        if (HAS_ATA) {
                if (HAS_NAND || HAS_NOR)
index 144bf31d68ddd16a6fec1e3260f462d8ef1140f9..3e3e3afebf886d179f2e9fef5cf00013af54f5ba 100644 (file)
@@ -188,7 +188,7 @@ static __init void davinci_ntosd2_init(void)
        struct davinci_soc_info *soc_info = &davinci_soc_info;
 
        aemif_clk = clk_get(NULL, "aemif");
-       clk_enable(aemif_clk);
+       clk_prepare_enable(aemif_clk);
 
        if (HAS_ATA) {
                if (HAS_NAND)
index b90c172d55413dc6e301ba15afff70f721d3c704..68c5fe01857cad4bfb97191b43a0e7f67ade4f78 100644 (file)
@@ -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,
@@ -385,6 +391,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),
@@ -781,12 +788,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 };
@@ -1239,8 +1240,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/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
new file mode 100644 (file)
index 0000000..37c27af
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * Modified from mach-omap/omap2/board-generic.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/io.h>
+#include <linux/of_irq.h>
+#include <linux/of_platform.h>
+#include <linux/irqdomain.h>
+
+#include <asm/mach/arch.h>
+
+#include <mach/common.h>
+#include <mach/cp_intc.h>
+#include <mach/da8xx.h>
+
+#define DA8XX_NUM_UARTS        3
+
+void __init da8xx_uart_clk_enable(void)
+{
+       int i;
+       for (i = 0; i < DA8XX_NUM_UARTS; i++)
+               davinci_serial_setup_clk(i, NULL);
+}
+
+static struct of_device_id da8xx_irq_match[] __initdata = {
+       { .compatible = "ti,cp-intc", .data = cp_intc_of_init, },
+       { }
+};
+
+static void __init da8xx_init_irq(void)
+{
+       of_irq_init(da8xx_irq_match);
+}
+
+#ifdef CONFIG_ARCH_DAVINCI_DA850
+
+static void __init da850_init_machine(void)
+{
+       of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+
+       da8xx_uart_clk_enable();
+}
+
+static const char *da850_boards_compat[] __initdata = {
+       "enbw,cmc",
+       "ti,da850-evm",
+       "ti,da850",
+       NULL,
+};
+
+DT_MACHINE_START(DA850_DT, "Generic DA850/OMAP-L138/AM18x")
+       .map_io         = da850_init,
+       .init_irq       = da8xx_init_irq,
+       .timer          = &davinci_timer,
+       .init_machine   = da850_init_machine,
+       .dt_compat      = da850_boards_compat,
+       .init_late      = davinci_init_late,
+       .restart        = da8xx_restart,
+MACHINE_END
+
+#endif
index bd2f72b414bce03c87b4921e2962ff709cf815e4..46c9a0c09ae5d83e6895edde655e9581656e93bf 100644 (file)
@@ -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,
@@ -900,7 +971,7 @@ static int da850_sata_init(struct device *dev, void __iomem *addr)
        if (IS_ERR(da850_sata_clk))
                return PTR_ERR(da850_sata_clk);
 
-       ret = clk_enable(da850_sata_clk);
+       ret = clk_prepare_enable(da850_sata_clk);
        if (ret)
                goto err0;
 
@@ -931,7 +1002,7 @@ static int da850_sata_init(struct device *dev, void __iomem *addr)
        return 0;
 
 err1:
-       clk_disable(da850_sata_clk);
+       clk_disable_unprepare(da850_sata_clk);
 err0:
        clk_put(da850_sata_clk);
        return ret;
@@ -939,7 +1010,7 @@ err0:
 
 static void da850_sata_exit(struct device *dev)
 {
-       clk_disable(da850_sata_clk);
+       clk_disable_unprepare(da850_sata_clk);
        clk_put(da850_sata_clk);
 }
 
index a255434908dbcfebb1a1b8a3a946860db7e9f4bf..b49c3b77d55e5ac3e9884762a2fcdab28c03453b 100644 (file)
@@ -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 */
index b680c832e0ba87758f1f29aeb502109ce2699268..6c3980540be0525a9e3d7a5c699ed2221d378a35 100644 (file)
@@ -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[] = {
index cd0c8b1e1ecfad4a868b9aae3f6180a1b1794ed1..9ab1f105cf00a849302758e4c7d075aee41197f0 100644 (file)
@@ -786,12 +786,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 */
index 97c0f8e555bd454edb83c4612bf31153816fa9e0..ac7b431c4c8eb93bd21feee28cc9fe8dd251d1ea 100644 (file)
@@ -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 */
index bdc4aa8e672ac98349d10c9059e063b1294e40dc..046c7238a3d6e504807a56f59a498a4507d861d8 100644 (file)
@@ -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 */
index aaccdc4528fcce2f3110d2d4385dc1c5239ceebb..700d311c6854f0abc3054d4a732fbf8fc522a418 100644 (file)
@@ -26,6 +26,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>
 
 #include <media/davinci/vpif_types.h>
 
@@ -72,6 +73,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);
@@ -86,6 +88,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);
index 46b3cd11c3c2ec582e2972202f1c6277494fe9ea..2d9d921e8b01be034549d9d1ea3df3c7f713d79a 100644 (file)
@@ -43,6 +43,7 @@ struct davinci_uart_config {
 };
 
 extern int davinci_serial_init(struct davinci_uart_config *);
+extern int davinci_serial_setup_clk(unsigned instance, unsigned int *rate);
 #endif
 
 #endif /* __ASM_ARCH_SERIAL_H */
index 111f7cc71e07b0a36ff0ccba4df066216c8747b6..4e5db56218b86a28017ef38898ed7a54e5f53acc 100644 (file)
@@ -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 */
index 1875740fe27cb030cdc71db2772adfbd5cc2e788..f2625814c3c9b3160d5b163efbbd9cb799ced23e 100644 (file)
@@ -70,11 +70,33 @@ static void __init davinci_serial_reset(struct plat_serial8250_port *p)
                                 UART_DM646X_SCR_TX_WATERMARK);
 }
 
-int __init davinci_serial_init(struct davinci_uart_config *info)
+/* Enable UART clock and obtain its rate */
+int __init davinci_serial_setup_clk(unsigned instance, unsigned int *rate)
 {
-       int i;
        char name[16];
-       struct clk *uart_clk;
+       struct clk *clk;
+       struct davinci_soc_info *soc_info = &davinci_soc_info;
+       struct device *dev = &soc_info->serial_dev->dev;
+
+       sprintf(name, "uart%d", instance);
+       clk = clk_get(dev, name);
+       if (IS_ERR(clk)) {
+               pr_err("%s:%d: failed to get UART%d clock\n",
+                                       __func__, __LINE__, instance);
+               return PTR_ERR(clk);
+       }
+
+       clk_prepare_enable(clk);
+
+       if (rate)
+               *rate = clk_get_rate(clk);
+
+       return 0;
+}
+
+int __init davinci_serial_init(struct davinci_uart_config *info)
+{
+       int i, ret;
        struct davinci_soc_info *soc_info = &davinci_soc_info;
        struct device *dev = &soc_info->serial_dev->dev;
        struct plat_serial8250_port *p = dev->platform_data;
@@ -87,16 +109,9 @@ int __init davinci_serial_init(struct davinci_uart_config *info)
                if (!(info->enabled_uarts & (1 << i)))
                        continue;
 
-               sprintf(name, "uart%d", i);
-               uart_clk = clk_get(dev, name);
-               if (IS_ERR(uart_clk)) {
-                       printk(KERN_ERR "%s:%d: failed to get UART%d clock\n",
-                                       __func__, __LINE__, i);
+               ret = davinci_serial_setup_clk(i, &p->uartclk);
+               if (ret)
                        continue;
-               }
-
-               clk_enable(uart_clk);
-               p->uartclk = clk_get_rate(uart_clk);
 
                if (!p->membase && p->mapbase) {
                        p->membase = ioremap(p->mapbase, SZ_4K);
index db0f7787faf17d2d64ca650c1af6d9ecf2d7e628..c5f7ee5cc80ab3b6b6c2226798b233a8f59f1d0c 100644 (file)
@@ -10,6 +10,7 @@
  */
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/genalloc.h>
 
 #include <mach/common.h>
 
 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;
@@ -32,7 +38,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 +59,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 +70,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;
 }
index 75da315b658724fabe134cb40fef3015b2df9697..9847938785caa5c5fdcfa134ad454ec8696bef53 100644 (file)
@@ -379,7 +379,7 @@ static void __init davinci_timer_init(void)
 
        timer_clk = clk_get(NULL, "timer0");
        BUG_ON(IS_ERR(timer_clk));
-       clk_enable(timer_clk);
+       clk_prepare_enable(timer_clk);
 
        /* init timer hw */
        timer_init();
@@ -429,7 +429,7 @@ void davinci_watchdog_reset(struct platform_device *pdev)
        wd_clk = clk_get(&pdev->dev, NULL);
        if (WARN_ON(IS_ERR(wd_clk)))
                return;
-       clk_enable(wd_clk);
+       clk_prepare_enable(wd_clk);
 
        /* disable, internal clock source */
        __raw_writel(0, base + TCR);
index 6f3ea9bbc818b3fc235ace278187341417dad32a..c48b93813fc16fcbca66db779d4d576043596ea4 100644 (file)
@@ -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
index 33a7a273b4537bd31d2898a572da62f4462b4fd7..f8738de342befce9a8853bc4e5937f2d62f66aac 100644 (file)
@@ -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,
index f39140aabc6f07ecc803fcb0ea0f95b5eb27b301..3d47d219827f371852f8dbfb9a4ed7d38356a1d0 100644 (file)
@@ -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_ */