powerpc: Restore dma ops for powermac cardbus drivers
Subsystems (2)
PATCH 1/1 powerpc: Restore dma ops for powermac cardbus drivers
Commit 4ae0ff606e848fa4957ebf8f97e5db5fdeec27be broke dma setup for cardbus devices such as sata_sil, rt2500 and ath5k. This patch restores the default dma ops for cardbus devices. Tested with sata_sil on a powerbook G4.
bz#537176
---
The inline patch is whitespace damaged by this mailer. The attachment should be ok, and passes checkpatch.pl
arch/powerpc/platforms/powermac/setup.c 2009-11-29 21:47:15.000000000 -0600 renamed from arch/powerpc/platforms/powermac/setup.c.orig 2009-06-09 22:05:27.000000000 -0500 +38 -0
@@ -514,6 +514,44 @@ static void __init pmac_init_early(void) #endif } +#ifdef CONFIG_CARDBUS +static int pmac_cardbus_notify(struct notifier_block *nb, unsigned long action, + void *data) +{ + struct device *dev = data; + struct device *parent; + struct pci_dev *pdev = to_pci_dev(dev); + + /* We are only interested in device addition */ + if (action != BUS_NOTIFY_ADD_DEVICE) + return 0; + + parent = pdev->dev.parent; + + if (!parent->archdata.of_node) + return 0; + + if (!of_device_is_compatible(parent->archdata.of_node, + "cardbus-bridge")) + return 0; + + /* We use the direct ops for cardbus */ + dev->archdata.dma_ops = &dma_direct_ops; + + return 0; +} + +static struct notifier_block cardbus_notifier = { + .notifier_call = pmac_cardbus_notify, +}; + +static int __init pmac_cardbus_init(void) +{ + return bus_register_notifier(&pci_bus_type, &cardbus_notifier); +} +machine_device_initcall(powermac, pmac_cardbus_init); +#endif + static int __init pmac_declare_of_platform_devices(void) { struct device_node *np;
[PATCH] powerpc: Restore dma ops for powermac cardbus drivers
Commit 4ae0ff606e848fa4957ebf8f97e5db5fdeec27be broke dma setup for cardbus devices such as sata_sil, rt2500 and ath5k. This patch restores the default dma ops for cardbus devices. Tested with sata_sil on a powerbook G4.
bz#537176
arch/powerpc/platforms/powermac/setup.c renamed from arch/powerpc/platforms/powermac/setup.c.orig +38 -0
@@ -514,6 +514,44 @@ static void __init pmac_init_early(void)#endif } +#ifdef CONFIG_CARDBUS +static int pmac_cardbus_notify (struct notifier_block *nb,unsigned long action, +void *data) +{ +struct device *dev = data; +struct device *parent; +struct pci_dev *pdev =to_pci_dev (dev); + +/* We are only interested in device addition */ +if (action !=BUS_NOTIFY_ADD_DEVICE ) +return 0 ; + + parent = pdev->dev.parent; + +if (!parent->archdata.of_node) +return 0 ; + +if (!of_device_is_compatible (parent->archdata.of_node, +"cardbus-bridge" )) +return 0 ; + +/* We use the direct ops for cardbus */ + dev->archdata.dma_ops = &dma_direct_ops; + +return 0 ; +} + +static struct notifier_block cardbus_notifier = { + .notifier_call = pmac_cardbus_notify, +}; + +static int __init pmac_cardbus_init (void ) +{ +return bus_register_notifier (&pci_bus_type, &cardbus_notifier); +} +machine_device_initcall (powermac, pmac_cardbus_init); +#endif +static int __init pmac_declare_of_platform_devices (void ) {struct device_node *np;
Quoted 7 lines · roger blofeld
Commit
4ae0ff606e848fa4957ebf8f97e5db5fdeec27bebroke dma setup for cardbus devices such assata_sil, rt2500 and ath5k. This patch restores the default dma ops for cardbus devices. Tested withsata_silon a powerbook G4.bz#537176
Signed-off-by Roger Blofeld <[email protected]>
Hi !
That's an interesting way to do it :-)
However, I suppose a better approach would be to fix cardbus to call the proper fixup code in the arch, ie, dma isn't the only thing that's going to be broken without that (at least maybe on pmac that is, but machines with an iommu will suffer etc...)
I will try to have a look as soon as I'm done with porting the pmac IDE driver to libata.
Cheers,
Ben.
Quoted 56 lines
---
The inline patch is whitespace damaged by this mailer. The attachment should be ok, and passes checkpatch.pldiff -up linux-2.6.30.ppc/arch/powerpc/platforms/powermac/setup.c.orig
linux-2.6.30.ppc/arch/powerpc/platforms/powermac/setup.carch/powerpc/platforms/powermac/setup.c 2009-11-29 21:47:15.000000000 -0600 renamed from arch/powerpc/platforms/powermac/setup.c.orig 2009-06-09 22:05:27.000000000 -0500 +38
-0@@ -514,6 +514,44 @@ static void __init pmac_init_early(void) #endif } +#ifdef CONFIG_CARDBUS +static int pmac_cardbus_notify(struct notifier_block *nb, unsigned long action, + void *data) +{ + struct device *dev = data; + struct device *parent; + struct pci_dev *pdev = to_pci_dev(dev); + + /* We are only interested in device addition */ + if (action != BUS_NOTIFY_ADD_DEVICE) + return 0; + + parent = pdev->dev.parent; + + if (!parent->archdata.of_node) + return 0; + + if (!of_device_is_compatible(parent->archdata.of_node, + "cardbus-bridge")) + return 0; + + /* We use the direct ops for cardbus */ + dev->archdata.dma_ops = &dma_direct_ops; + + return 0; +} + +static struct notifier_block cardbus_notifier = { + .notifier_call = pmac_cardbus_notify, +}; + +static int __init pmac_cardbus_init(void) +{ + return bus_register_notifier(&pci_bus_type, &cardbus_notifier); +} +machine_device_initcall(powermac, pmac_cardbus_init); +#endif + static int __init pmac_declare_of_platform_devices(void) { struct device_node *np;
Quoted 24 lines
To: roger blofeld <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Sent: Sun, November 29, 2009 11:49:27 PM
Subject: Re: [PATCH] powerpc: Restore dma ops for powermac cardbus driversQuoted 7 lines · roger blofeld
Commit
4ae0ff606e848fa4957ebf8f97e5db5fdeec27bebroke dma setup for cardbus devices such assata_sil, rt2500 and ath5k. This patch restores the default dma ops for cardbus devices. Tested withsata_silon a powerbook G4.bz#537176
Signed-off-by Roger BlofeldHi !
That's an interesting way to do it :-)
However, I suppose a better approach would be to fix cardbus to call the proper fixup code in the arch, ie, dma isn't the only thing that's going to be broken without that (at least maybe on pmac that is, but machines with an iommu will suffer etc...)
Quoted 6 lines
I will try to have a look as soon as I'm done with porting the pmac IDE driver to libata.
Cheers,
Ben.
Thanks. That would be great. I just copied this mostly from what pasemi did for their cardbus. -roger
Quoted 62 lines
Quoted 2 lines
---
The inline patch is whitespace damaged by this mailer. The attachment shouldbe ok,
Quoted 4 lines
and passes checkpatch.pl
diff -up linux-2.6.30.ppc/arch/powerpc/platforms/powermac/setup.c.orig
linux-2.6.30.ppc/arch/powerpc/platforms/powermac/setup.cQuoted 1 line
--- linux-2.6.30.ppc/arch/powerpc/platforms/powermac/setup.c.orig
2009-06-09 22:05:27.000000000 -0500Quoted 1 line
+++
linux-2.6.30.ppc/arch/powerpc/platforms/powermac/setup.c2009-11-2921:47:15.000000000 -0600
arch/powerpc/platforms/powermac/setup.c 2009-11-29 21:47:15.000000000 -0600 static void __init pmac_init_early(void) · line 518
Quoted 6 lines
arch/powerpc/platforms/powermac/setup.c 2009-11-29 21:47:15.000000000 -0600 renamed from arch/powerpc/platforms/powermac/setup.c.orig 2009-06-09 22:05:27.000000000 -0500 +2
-0@@ -514,6 +514,44 @@ static void __init pmac_init_early(void) #endif } +#ifdef CONFIG_CARDBUS +static int pmac_cardbus_notify(struct notifier_block *nb, unsigned longaction,
Quoted 32 lines
arch/powerpc/platforms/powermac/setup.c 2009-11-29 21:47:15.000000000 -0600 renamed from arch/powerpc/platforms/powermac/setup.c.orig 2009-06-09 22:05:27.000000000 -0500 +29
-0+ void *data) +{ + struct device *dev = data; + struct device *parent; + struct pci_dev *pdev = to_pci_dev(dev); + + /* We are only interested in device addition */ + if (action != BUS_NOTIFY_ADD_DEVICE) + return 0; + + parent = pdev->dev.parent; + + if (!parent->archdata.of_node) + return 0; + + if (!of_device_is_compatible(parent->archdata.of_node, + "cardbus-bridge")) + return 0; + + /* We use the direct ops for cardbus */ + dev->archdata.dma_ops = &dma_direct_ops; + + return 0; +} + +static struct notifier_block cardbus_notifier = { + .notifier_call = pmac_cardbus_notify, +}; +arch/powerpc/platforms/powermac/setup.c 2009-11-29 21:47:15.000000000 -0600 static void __init pmac_init_early(void) · line 557
Quoted 10 lines
arch/powerpc/platforms/powermac/setup.c 2009-11-29 21:47:15.000000000 -0600 renamed from arch/powerpc/platforms/powermac/setup.c.orig 2009-06-09 22:05:27.000000000 -0500 +7
-0+static int __init pmac_cardbus_init(void) +{ + return bus_register_notifier(&pci_bus_type, &cardbus_notifier); +} +machine_device_initcall(powermac, pmac_cardbus_init); +#endif + static int __init pmac_declare_of_platform_devices(void) { struct device_node *np;From: Benjamin Herrenschmidt <[email protected]>