aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Herring <rob.herring@calxeda.com>2012-08-21 06:31:06 -0400
committerMarek Szyprowski <m.szyprowski@samsung.com>2012-10-02 02:58:07 -0400
commit1dc737c44a11c66f23ebeb09796f52f4b60d59c7 (patch)
tree35d2020f28bdd4c406eaf2e6909c648ce12a66e5
parent48aa820f1e3824e46dde6251db98e5961abf605d (diff)
ARM: highbank: add coherent DMA setup
Some highbank DMA masters can support coherent (ACP) or non-coherent DMA. This sets up dma_map_ops for masters which are configured for coherent DMA. Signed-off-by: Rob Herring <rob.herring@calxeda.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
-rw-r--r--Documentation/devicetree/bindings/ata/ahci-platform.txt3
-rw-r--r--Documentation/devicetree/bindings/dma/arm-pl330.txt3
-rw-r--r--Documentation/devicetree/bindings/net/calxeda-xgmac.txt3
-rw-r--r--arch/arm/boot/dts/highbank.dts1
-rw-r--r--arch/arm/mach-highbank/highbank.c52
5 files changed, 62 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/ata/ahci-platform.txt b/Documentation/devicetree/bindings/ata/ahci-platform.txt
index 8bb8a76d42e8..6c1ad01d27e8 100644
--- a/Documentation/devicetree/bindings/ata/ahci-platform.txt
+++ b/Documentation/devicetree/bindings/ata/ahci-platform.txt
@@ -8,6 +8,9 @@ Required properties:
8- interrupts : <interrupt mapping for SATA IRQ> 8- interrupts : <interrupt mapping for SATA IRQ>
9- reg : <registers mapping> 9- reg : <registers mapping>
10 10
11Optional properties:
12- dma-coherent : Present if dma operations are coherent
13
11Example: 14Example:
12 sata@ffe08000 { 15 sata@ffe08000 {
13 compatible = "calxeda,hb-ahci"; 16 compatible = "calxeda,hb-ahci";
diff --git a/Documentation/devicetree/bindings/dma/arm-pl330.txt b/Documentation/devicetree/bindings/dma/arm-pl330.txt
index a4cd273b2a67..36e27d54260b 100644
--- a/Documentation/devicetree/bindings/dma/arm-pl330.txt
+++ b/Documentation/devicetree/bindings/dma/arm-pl330.txt
@@ -9,6 +9,9 @@ Required properties:
9 region. 9 region.
10 - interrupts: interrupt number to the cpu. 10 - interrupts: interrupt number to the cpu.
11 11
12Optional properties:
13- dma-coherent : Present if dma operations are coherent
14
12Example: 15Example:
13 16
14 pdma0: pdma@12680000 { 17 pdma0: pdma@12680000 {
diff --git a/Documentation/devicetree/bindings/net/calxeda-xgmac.txt b/Documentation/devicetree/bindings/net/calxeda-xgmac.txt
index 411727a3f82d..c8ae996bd8f2 100644
--- a/Documentation/devicetree/bindings/net/calxeda-xgmac.txt
+++ b/Documentation/devicetree/bindings/net/calxeda-xgmac.txt
@@ -6,6 +6,9 @@ Required properties:
6- interrupts : Should contain 3 xgmac interrupts. The 1st is main interrupt. 6- interrupts : Should contain 3 xgmac interrupts. The 1st is main interrupt.
7 The 2nd is pwr mgt interrupt. The 3rd is low power state interrupt. 7 The 2nd is pwr mgt interrupt. The 3rd is low power state interrupt.
8 8
9Optional properties:
10- dma-coherent : Present if dma operations are coherent
11
9Example: 12Example:
10 13
11ethernet@fff50000 { 14ethernet@fff50000 {
diff --git a/arch/arm/boot/dts/highbank.dts b/arch/arm/boot/dts/highbank.dts
index 9fecf1ae777b..7414577c177f 100644
--- a/arch/arm/boot/dts/highbank.dts
+++ b/arch/arm/boot/dts/highbank.dts
@@ -121,6 +121,7 @@
121 compatible = "calxeda,hb-ahci"; 121 compatible = "calxeda,hb-ahci";
122 reg = <0xffe08000 0x10000>; 122 reg = <0xffe08000 0x10000>;
123 interrupts = <0 83 4>; 123 interrupts = <0 83 4>;
124 dma-coherent;
124 }; 125 };
125 126
126 sdhci@ffe0e000 { 127 sdhci@ffe0e000 {
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index d75b0a78d88a..93617d61f4b1 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -15,6 +15,7 @@
15 */ 15 */
16#include <linux/clk.h> 16#include <linux/clk.h>
17#include <linux/clkdev.h> 17#include <linux/clkdev.h>
18#include <linux/dma-mapping.h>
18#include <linux/io.h> 19#include <linux/io.h>
19#include <linux/irq.h> 20#include <linux/irq.h>
20#include <linux/irqdomain.h> 21#include <linux/irqdomain.h>
@@ -23,6 +24,7 @@
23#include <linux/of_platform.h> 24#include <linux/of_platform.h>
24#include <linux/of_address.h> 25#include <linux/of_address.h>
25#include <linux/smp.h> 26#include <linux/smp.h>
27#include <linux/amba/bus.h>
26 28
27#include <asm/cacheflush.h> 29#include <asm/cacheflush.h>
28#include <asm/smp_plat.h> 30#include <asm/smp_plat.h>
@@ -149,10 +151,60 @@ static void highbank_power_off(void)
149 cpu_do_idle(); 151 cpu_do_idle();
150} 152}
151 153
154static int highbank_platform_notifier(struct notifier_block *nb,
155 unsigned long event, void *__dev)
156{
157 struct resource *res;
158 int reg = -1;
159 struct device *dev = __dev;
160
161 if (event != BUS_NOTIFY_ADD_DEVICE)
162 return NOTIFY_DONE;
163
164 if (of_device_is_compatible(dev->of_node, "calxeda,hb-ahci"))
165 reg = 0xc;
166 else if (of_device_is_compatible(dev->of_node, "calxeda,hb-sdhci"))
167 reg = 0x18;
168 else if (of_device_is_compatible(dev->of_node, "arm,pl330"))
169 reg = 0x20;
170 else if (of_device_is_compatible(dev->of_node, "calxeda,hb-xgmac")) {
171 res = platform_get_resource(to_platform_device(dev),
172 IORESOURCE_MEM, 0);
173 if (res) {
174 if (res->start == 0xfff50000)
175 reg = 0;
176 else if (res->start == 0xfff51000)
177 reg = 4;
178 }
179 }
180
181 if (reg < 0)
182 return NOTIFY_DONE;
183
184 if (of_property_read_bool(dev->of_node, "dma-coherent")) {
185 writel(0xff31, sregs_base + reg);
186 set_dma_ops(dev, &arm_coherent_dma_ops);
187 } else
188 writel(0, sregs_base + reg);
189
190 return NOTIFY_OK;
191}
192
193static struct notifier_block highbank_amba_nb = {
194 .notifier_call = highbank_platform_notifier,
195};
196
197static struct notifier_block highbank_platform_nb = {
198 .notifier_call = highbank_platform_notifier,
199};
200
152static void __init highbank_init(void) 201static void __init highbank_init(void)
153{ 202{
154 pm_power_off = highbank_power_off; 203 pm_power_off = highbank_power_off;
155 204
205 bus_register_notifier(&platform_bus_type, &highbank_platform_nb);
206 bus_register_notifier(&amba_bustype, &highbank_amba_nb);
207
156 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 208 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
157} 209}
158 210