* [PATCH v2 1/3] powerpc/pci: Default to dma_direct_ops for pci dma_ops
@ 2009-03-19 13:40 Kumar Gala
2009-03-19 13:40 ` [PATCH v2 2/3] powerpc: setup default archdata for {of_}platform via bus_register_notifier Kumar Gala
2009-03-20 7:37 ` [PATCH v2 1/3] powerpc/pci: Default to dma_direct_ops for pci dma_ops Benjamin Krill
0 siblings, 2 replies; 6+ messages in thread
From: Kumar Gala @ 2009-03-19 13:40 UTC (permalink / raw)
Cc: linuxppc-dev, Becky Bruce
This will allow us to remove the ppc32 specific checks in get_dma_ops()
that defaults to dma_direct_ops if the archdata is NULL. We really
should always have archdata set to something going forward.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
arch/powerpc/kernel/pci-common.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 2603f20..9c69e7e 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -50,7 +50,7 @@ resource_size_t isa_mem_base;
unsigned int ppc_pci_flags = 0;
-static struct dma_mapping_ops *pci_dma_ops;
+static struct dma_mapping_ops *pci_dma_ops = &dma_direct_ops;
void set_pci_dma_ops(struct dma_mapping_ops *dma_ops)
{
--
1.5.6.6
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/3] powerpc: setup default archdata for {of_}platform via bus_register_notifier
2009-03-19 13:40 [PATCH v2 1/3] powerpc/pci: Default to dma_direct_ops for pci dma_ops Kumar Gala
@ 2009-03-19 13:40 ` Kumar Gala
2009-03-19 13:40 ` [PATCH v2 3/3] powerpc: expect all devices calling dma ops to have archdata set Kumar Gala
2009-03-20 7:37 ` [PATCH v2 2/3] powerpc: setup default archdata for {of_}platform via bus_register_notifier Benjamin Krill
2009-03-20 7:37 ` [PATCH v2 1/3] powerpc/pci: Default to dma_direct_ops for pci dma_ops Benjamin Krill
1 sibling, 2 replies; 6+ messages in thread
From: Kumar Gala @ 2009-03-19 13:40 UTC (permalink / raw)
Cc: linuxppc-dev, Becky Bruce
Since a number of powerpc chips are SoCs we end up having dma-able
devices that are registered as platform or of_platform devices. We need
to hook the archdata to setup proper dma_ops for these devices.
Rather than having to add a bus_notify to each platform we add a default
one at the highest priority (called first) to set the default dma_ops for
of_platform and platform devices to dma_direct_ops. This allows platform
code to override the ops by providing their own notifier call back.
In the future to enable >4G DMA support on ppc32 we can hook swiotlb ops.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
* Use bus notifiers instead of platform_notify
arch/powerpc/kernel/setup-common.c | 36 +++++++++++++++++++++++++++++
arch/powerpc/platforms/cell/qpace_setup.c | 13 ----------
2 files changed, 36 insertions(+), 13 deletions(-)
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 705fc4b..9774f9f 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -35,6 +35,8 @@
#include <linux/debugfs.h>
#include <linux/percpu.h>
#include <linux/lmb.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
#include <asm/io.h>
#include <asm/prom.h>
#include <asm/processor.h>
@@ -669,3 +671,37 @@ static int powerpc_debugfs_init(void)
}
arch_initcall(powerpc_debugfs_init);
#endif
+
+static int ppc_dflt_bus_notify(struct notifier_block *nb,
+ unsigned long action, void *data)
+{
+ struct device *dev = data;
+
+ /* We are only intereted in device addition */
+ if (action != BUS_NOTIFY_ADD_DEVICE)
+ return 0;
+
+ set_dma_ops(dev, &dma_direct_ops);
+
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block ppc_dflt_plat_bus_notifier = {
+ .notifier_call = ppc_dflt_bus_notify,
+ .priority = INT_MAX,
+};
+
+static struct notifier_block ppc_dflt_of_bus_notifier = {
+ .notifier_call = ppc_dflt_bus_notify,
+ .priority = INT_MAX,
+};
+
+static int __init setup_bus_notifier(void)
+{
+ bus_register_notifier(&platform_bus_type, &ppc_dflt_plat_bus_notifier);
+ bus_register_notifier(&of_platform_bus_type, &ppc_dflt_of_bus_notifier);
+
+ return 0;
+}
+
+arch_initcall(setup_bus_notifier);
diff --git a/arch/powerpc/platforms/cell/qpace_setup.c b/arch/powerpc/platforms/cell/qpace_setup.c
index c75b662..c5ce02e 100644
--- a/arch/powerpc/platforms/cell/qpace_setup.c
+++ b/arch/powerpc/platforms/cell/qpace_setup.c
@@ -81,16 +81,6 @@ static int __init qpace_publish_devices(void)
}
machine_subsys_initcall(qpace, qpace_publish_devices);
-extern int qpace_notify(struct device *dev)
-{
- /* set dma_ops for of_platform bus */
- if (dev->bus && dev->bus->name
- && !strcmp(dev->bus->name, "of_platform"))
- set_dma_ops(dev, &dma_direct_ops);
-
- return 0;
-}
-
static void __init qpace_setup_arch(void)
{
#ifdef CONFIG_SPU_BASE
@@ -115,9 +105,6 @@ static void __init qpace_setup_arch(void)
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
#endif
-
- /* set notifier function */
- platform_notify = &qpace_notify;
}
static int __init qpace_probe(void)
--
1.5.6.6
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] powerpc: expect all devices calling dma ops to have archdata set
2009-03-19 13:40 ` [PATCH v2 2/3] powerpc: setup default archdata for {of_}platform via bus_register_notifier Kumar Gala
@ 2009-03-19 13:40 ` Kumar Gala
2009-03-20 7:38 ` Benjamin Krill
2009-03-20 7:37 ` [PATCH v2 2/3] powerpc: setup default archdata for {of_}platform via bus_register_notifier Benjamin Krill
1 sibling, 1 reply; 6+ messages in thread
From: Kumar Gala @ 2009-03-19 13:40 UTC (permalink / raw)
Cc: linuxppc-dev, Becky Bruce
Now that we set archdata for of_platform and platform devices via
platform_notify() we no longer need to special case having a NULL device
pointer or NULL archdata. It should be a driver error if this condition
shows up and the driver should be fixed.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
arch/powerpc/include/asm/dma-mapping.h | 12 +-----------
1 files changed, 1 insertions(+), 11 deletions(-)
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index 86cef7d..c69f2b5 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -109,18 +109,8 @@ static inline struct dma_mapping_ops *get_dma_ops(struct device *dev)
* only ISA DMA device we support is the floppy and we have a hack
* in the floppy driver directly to get a device for us.
*/
-
- if (unlikely(dev == NULL) || dev->archdata.dma_ops == NULL) {
-#ifdef CONFIG_PPC64
+ if (unlikely(dev == NULL))
return NULL;
-#else
- /* Use default on 32-bit if dma_ops is not set up */
- /* TODO: Long term, we should fix drivers so that dev and
- * archdata dma_ops are set up for all buses.
- */
- return &dma_direct_ops;
-#endif
- }
return dev->archdata.dma_ops;
}
--
1.5.6.6
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/3] powerpc/pci: Default to dma_direct_ops for pci dma_ops
2009-03-19 13:40 [PATCH v2 1/3] powerpc/pci: Default to dma_direct_ops for pci dma_ops Kumar Gala
2009-03-19 13:40 ` [PATCH v2 2/3] powerpc: setup default archdata for {of_}platform via bus_register_notifier Kumar Gala
@ 2009-03-20 7:37 ` Benjamin Krill
1 sibling, 0 replies; 6+ messages in thread
From: Benjamin Krill @ 2009-03-20 7:37 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev, Becky Bruce
* Kumar Gala | 2009-03-19 08:40:50 [-0500]:
>This will allow us to remove the ppc32 specific checks in get_dma_ops()
>that defaults to dma_direct_ops if the archdata is NULL. We really
>should always have archdata set to something going forward.
>
>Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Benjamin Krill <ben@codiert.org>
Tested on QPACE node card.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/3] powerpc: setup default archdata for {of_}platform via bus_register_notifier
2009-03-19 13:40 ` [PATCH v2 2/3] powerpc: setup default archdata for {of_}platform via bus_register_notifier Kumar Gala
2009-03-19 13:40 ` [PATCH v2 3/3] powerpc: expect all devices calling dma ops to have archdata set Kumar Gala
@ 2009-03-20 7:37 ` Benjamin Krill
1 sibling, 0 replies; 6+ messages in thread
From: Benjamin Krill @ 2009-03-20 7:37 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev, Becky Bruce
* Kumar Gala | 2009-03-19 08:40:51 [-0500]:
>Since a number of powerpc chips are SoCs we end up having dma-able
>devices that are registered as platform or of_platform devices. We need
>to hook the archdata to setup proper dma_ops for these devices.
>
>Rather than having to add a bus_notify to each platform we add a default
>one at the highest priority (called first) to set the default dma_ops for
>of_platform and platform devices to dma_direct_ops. This allows platform
>code to override the ops by providing their own notifier call back.
>
>In the future to enable >4G DMA support on ppc32 we can hook swiotlb ops.
>
>Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Benjamin Krill <ben@codiert.org>
Tested on QPACE node card.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 3/3] powerpc: expect all devices calling dma ops to have archdata set
2009-03-19 13:40 ` [PATCH v2 3/3] powerpc: expect all devices calling dma ops to have archdata set Kumar Gala
@ 2009-03-20 7:38 ` Benjamin Krill
0 siblings, 0 replies; 6+ messages in thread
From: Benjamin Krill @ 2009-03-20 7:38 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev, Becky Bruce
* Kumar Gala | 2009-03-19 08:40:52 [-0500]:
>Now that we set archdata for of_platform and platform devices via
>platform_notify() we no longer need to special case having a NULL device
>pointer or NULL archdata. It should be a driver error if this condition
>shows up and the driver should be fixed.
>
>Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Benjamin Krill <ben@codiert.org>
Tested on QPACE node card.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-03-20 7:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-19 13:40 [PATCH v2 1/3] powerpc/pci: Default to dma_direct_ops for pci dma_ops Kumar Gala
2009-03-19 13:40 ` [PATCH v2 2/3] powerpc: setup default archdata for {of_}platform via bus_register_notifier Kumar Gala
2009-03-19 13:40 ` [PATCH v2 3/3] powerpc: expect all devices calling dma ops to have archdata set Kumar Gala
2009-03-20 7:38 ` Benjamin Krill
2009-03-20 7:37 ` [PATCH v2 2/3] powerpc: setup default archdata for {of_}platform via bus_register_notifier Benjamin Krill
2009-03-20 7:37 ` [PATCH v2 1/3] powerpc/pci: Default to dma_direct_ops for pci dma_ops Benjamin Krill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).