diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-11-11 01:25:04 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-12-04 04:38:42 -0500 |
commit | 868108784ccf0add6ac593bfbc2eb5a0804af48d (patch) | |
tree | 69a2a58dcce8d4639a9b8027e32a82deb6035ca6 | |
parent | 12d04eef927bf61328af2c7cbe756c96f98ac3bf (diff) |
[POWERPC] Add DMA ops support for of_platform_device to Cell
This patch adds a bus device notifier to the of_platform bus type on
cell to setup the DMA operations for of_platform_devices. We currently
use the PCI operations as Cell use a special version of them that
happens to be suitable for our needs.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/platforms/cell/setup.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c index d704bc19a646..b39753f16d48 100644 --- a/arch/powerpc/platforms/cell/setup.c +++ b/arch/powerpc/platforms/cell/setup.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/console.h> | 30 | #include <linux/console.h> |
31 | #include <linux/mutex.h> | 31 | #include <linux/mutex.h> |
32 | #include <linux/memory_hotplug.h> | 32 | #include <linux/memory_hotplug.h> |
33 | #include <linux/notifier.h> | ||
33 | 34 | ||
34 | #include <asm/mmu.h> | 35 | #include <asm/mmu.h> |
35 | #include <asm/processor.h> | 36 | #include <asm/processor.h> |
@@ -82,10 +83,41 @@ static void cell_progress(char *s, unsigned short hex) | |||
82 | printk("*** %04x : %s\n", hex, s ? s : ""); | 83 | printk("*** %04x : %s\n", hex, s ? s : ""); |
83 | } | 84 | } |
84 | 85 | ||
86 | static int cell_of_bus_notify(struct notifier_block *nb, unsigned long action, | ||
87 | void *data) | ||
88 | { | ||
89 | struct device *dev = data; | ||
90 | |||
91 | if (action != BUS_NOTIFY_ADD_DEVICE) | ||
92 | return 0; | ||
93 | |||
94 | /* For now, we just use the PCI DMA ops for everything, though | ||
95 | * we'll need something better when we have a real iommu | ||
96 | * implementation. | ||
97 | */ | ||
98 | dev->archdata.dma_ops = pci_dma_ops; | ||
99 | |||
100 | return 0; | ||
101 | } | ||
102 | |||
103 | static struct notifier_block cell_of_bus_notifier = { | ||
104 | .notifier_call = cell_of_bus_notify | ||
105 | }; | ||
106 | |||
107 | |||
85 | static int __init cell_publish_devices(void) | 108 | static int __init cell_publish_devices(void) |
86 | { | 109 | { |
87 | if (machine_is(cell)) | 110 | if (!machine_is(cell)) |
88 | of_platform_bus_probe(NULL, NULL, NULL); | 111 | return 0; |
112 | |||
113 | /* Register callbacks on OF platform device addition/removal | ||
114 | * to handle linking them to the right DMA operations | ||
115 | */ | ||
116 | bus_register_notifier(&of_platform_bus_type, &cell_of_bus_notifier); | ||
117 | |||
118 | /* Publish OF platform devices for southbridge IOs */ | ||
119 | of_platform_bus_probe(NULL, NULL, NULL); | ||
120 | |||
89 | return 0; | 121 | return 0; |
90 | } | 122 | } |
91 | device_initcall(cell_publish_devices); | 123 | device_initcall(cell_publish_devices); |
@@ -154,7 +186,6 @@ static void __init cell_setup_arch(void) | |||
154 | #ifdef CONFIG_SMP | 186 | #ifdef CONFIG_SMP |
155 | smp_init_cell(); | 187 | smp_init_cell(); |
156 | #endif | 188 | #endif |
157 | |||
158 | /* init to some ~sane value until calibrate_delay() runs */ | 189 | /* init to some ~sane value until calibrate_delay() runs */ |
159 | loops_per_jiffy = 50000000; | 190 | loops_per_jiffy = 50000000; |
160 | 191 | ||