Enable OF drivers for non-PPC
Subsystems (3)
cover Enable OF drivers for non-PPC
From: Rob Herring <rob.herring-bsGFqQB8/[email protected]>
Grant,
Here is updated patch series incorporating your feedback.
I dropped the sja1000 and isp1760 drivers. They already have platform driver variants and need a more complicated merge that I wouldn't test.
I found another implicit include needing fixing in of_serial as well.
This is now compile tested on ARM and sparc. (BTW, allmodconfig was already pretty broken on sparc). ipmi was run on ARM as well.
Regards,
Rob
Rob Herring (3):
ipmi: convert OF driver to platform driver
of_serial: explicitly include of_irq.h
OF: make drivers depend on CONFIG_OF instead of CONFIG_PPC_OF
drivers/char/ipmi/ipmi_si_intf.c | 50 +++++++++++++++++++++---------------- drivers/mmc/host/Kconfig | 4 ++- drivers/mtd/Kconfig | 2 +- drivers/mtd/maps/Kconfig | 2 +- drivers/serial/Kconfig | 2 +- drivers/serial/of_serial.c | 1 + 6 files changed, 35 insertions(+), 26 deletions(-)
A message that is not in the archive (sent off-list or not yet received): 1290037824-24978-1-git-send-email-robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 1/3 ipmi: convert OF driver to platform driver
From: Rob Herring <rob.herring-bsGFqQB8/[email protected]>
of_bus is deprecated in favor of the plain platform bus. This patch converts the ipmi OF driver over to the platform bus.
--- drivers/char/ipmi/ipmi_si_intf.c | 36 +++++++++++++++++++++--------------- 1 files changed, 21 insertions(+), 15 deletions(-)
drivers/char/ipmi/ipmi_si_intf.c +21 -15
@@ -68,7 +68,6 @@#ifdef CONFIG_PPC_OF #include <linux/of_device.h> -#include <linux/of_platform.h> #include <linux/of_address.h> #include <linux/of_irq.h> #endif
@@ -311,7 +310,7 @@ static int pci_registered;static int pnp_registered;#endif #ifdef CONFIG_PPC_OF -static int of_registered; +static int plat_registered;#endif static unsigned int kipmid_max_busy_us[SI_MAX_PARMS ];
@@ -2533,13 +2532,13 @@ static struct pci_driver ipmi_pci_driver = {#ifdef CONFIG_PPC_OF -static int __devinit ipmi_of_probe (struct platform_device *dev, -const struct of_device_id *match) +static int __devinit ipmi_plat_probe (struct platform_device *dev) {struct smi_info *info;struct resource resource;const __be32 *regsize, *regspacing, *regshift;struct device_node *np = dev->dev.of_node; +const struct of_device_id *match;int ret;int proplen;
@@ -2569,6 +2568,13 @@ static int __devinit ipmi_of_probe(struct platform_device *dev,return -EINVAL ; } + match =of_match_device (dev->dev.driver->of_match_table, &dev->dev); +if (!match) { +dev_err (&dev->dev, +"No match for OF device\n" ); +return -ENOMEM ; + } + info =kzalloc (sizeof (*info),GFP_KERNEL );if (!info) {
@@ -2612,7 +2618,7 @@ static int __devinit ipmi_of_probe(struct platform_device *dev,return 0 ; } -static int __devexit ipmi_of_remove(struct platform_device *dev) +static int __devexit ipmi_plat_remove(struct platform_device *dev) {cleanup_one_si (dev_get_drvdata (&dev->dev));return 0 ;
@@ -2629,14 +2635,14 @@ static struct of_device_id ipmi_match[] = {}, }; -static struct of_platform_driver ipmi_of_platform_driver = { +static struct platform_driver ipmi_platform_driver = { .driver = { - .name ="ipmi" , + .name ="ipmi-pltfm" , .owner =THIS_MODULE , .of_match_table = ipmi_match, }, - .probe = ipmi_of_probe, - .remove =__devexit_p (ipmi_of_remove), + .probe = ipmi_plat_probe, + .remove =__devexit_p (ipmi_plat_remove), };#endif /* CONFIG_PPC_OF */
@@ -3376,8 +3382,8 @@ static __devinit int init_ipmi_si(void)#endif #ifdef CONFIG_PPC_OF -of_register_platform_driver (&ipmi_of_platform_driver); - of_registered =1 ; +platform_driver_register (&ipmi_platform_driver); + plat_registered =1 ;#endif /* We prefer devices with interrupts, but in the case of a machine
@@ -3436,8 +3442,8 @@ static __devinit int init_ipmi_si(void)#endif #ifdef CONFIG_PPC_OF -if (of_registered) -of_unregister_platform_driver (&ipmi_of_platform_driver); +if (plat_registered) +platform_driver_unregister (&ipmi_platform_driver);#endif driver_unregister (&ipmi_driver.driver); printk(KERN_WARNING PFX
@@ -3537,8 +3543,8 @@ static __exit void cleanup_ipmi_si(void)#endif #ifdef CONFIG_PPC_OF -if (of_registered) -of_unregister_platform_driver (&ipmi_of_platform_driver); +if (plat_registered) +platform_driver_unregister (&ipmi_platform_driver);#endif mutex_lock (&smi_infos_lock);
Signature · 1 line
1.7.1
A message that is not in the archive (sent off-list or not yet received): 1290037824-24978-2-git-send-email-robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 1/3] ipmi: convert OF driver to platform driver
Quoted 6 lines · Rob Herring
From: Rob Herring <rob.herring-bsGFqQB8/[email protected]>
of_busis deprecated in favor of the plain platform bus. This patch converts the ipmi OF driver over to the platform bus.Signed-off-by Rob Herring <rob.herring-bsGFqQB8/[email protected]>
Actually, what you need to do is merge the of_platform_driver with the existing platform_driver. Registering 2 platform_drivers for the same device doesn't make much sense.
g.
Quoted 123 lines
--- drivers/char/ipmi/ipmi_si_intf.c | 36 +++++++++++++++++++++--------------- 1 files changed, 21 insertions(+), 15 deletions(-)drivers/char/ipmi/ipmi_si_intf.c +21
-15@@ -68,7 +68,6 @@#ifdef CONFIG_PPC_OF #include <linux/of_device.h> -#include <linux/of_platform.h> #include <linux/of_address.h> #include <linux/of_irq.h> #endif @@ -311,7 +310,7 @@ static int pci_registered;static int pnp_registered;#endif #ifdef CONFIG_PPC_OF -static int of_registered; +static int plat_registered;#endif static unsigned int kipmid_max_busy_us[SI_MAX_PARMS ];@@ -2533,13 +2532,13 @@ static struct pci_driver ipmi_pci_driver = {#ifdef CONFIG_PPC_OF -static int __devinit ipmi_of_probe (struct platform_device *dev, -const struct of_device_id *match) +static int __devinit ipmi_plat_probe (struct platform_device *dev) {struct smi_info *info;struct resource resource;const __be32 *regsize, *regspacing, *regshift;struct device_node *np = dev->dev.of_node; +const struct of_device_id *match;int ret;int proplen;@@ -2569,6 +2568,13 @@ static int __devinit ipmi_of_probe(struct platform_device *dev,return -EINVAL ; } + match =of_match_device (dev->dev.driver->of_match_table, &dev->dev); +if (!match) { +dev_err (&dev->dev, +"No match for OF device\n" ); +return -ENOMEM ; + } + info =kzalloc (sizeof (*info),GFP_KERNEL );if (!info) {@@ -2612,7 +2618,7 @@ static int __devinit ipmi_of_probe(struct platform_device *dev,return 0 ; } -static int __devexit ipmi_of_remove(struct platform_device *dev) +static int __devexit ipmi_plat_remove(struct platform_device *dev) {cleanup_one_si (dev_get_drvdata (&dev->dev));return 0 ;@@ -2629,14 +2635,14 @@ static struct of_device_id ipmi_match[] = {}, }; -static struct of_platform_driver ipmi_of_platform_driver = { +static struct platform_driver ipmi_platform_driver = { .driver = { - .name ="ipmi" , + .name ="ipmi-pltfm" , .owner =THIS_MODULE , .of_match_table = ipmi_match, }, - .probe = ipmi_of_probe, - .remove =__devexit_p (ipmi_of_remove), + .probe = ipmi_plat_probe, + .remove =__devexit_p (ipmi_plat_remove), };#endif /* CONFIG_PPC_OF */ @@ -3376,8 +3382,8 @@ static __devinit int init_ipmi_si(void)#endif #ifdef CONFIG_PPC_OF -of_register_platform_driver (&ipmi_of_platform_driver); - of_registered =1 ; +platform_driver_register (&ipmi_platform_driver); + plat_registered =1 ;#endif /* We prefer devices with interrupts, but in the case of a machine @@ -3436,8 +3442,8 @@ static __devinit int init_ipmi_si(void)#endif #ifdef CONFIG_PPC_OF -if (of_registered) -of_unregister_platform_driver (&ipmi_of_platform_driver); +if (plat_registered) +platform_driver_unregister (&ipmi_platform_driver);#endif driver_unregister (&ipmi_driver.driver); printk(KERN_WARNING PFX@@ -3537,8 +3543,8 @@ static __exit void cleanup_ipmi_si(void)#endif #ifdef CONFIG_PPC_OF -if (of_registered) -of_unregister_platform_driver (&ipmi_of_platform_driver); +if (plat_registered) +platform_driver_unregister (&ipmi_platform_driver);#endif mutex_lock (&smi_infos_lock);Signature · 6 lines
1.7.1 _______________________________________________ devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/[email protected] https://lists.ozlabs.org/listinfo/devicetree-discuss
PATCH 2/3 of_serial: explicitly include of_irq.h
In reply to a message not in the archiveFrom: Rob Herring <rob.herring-bsGFqQB8/[email protected]>
On PPC, of_irq.h gets implicitly included, but on other platforms it does not.
--- drivers/serial/of_serial.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/serial/of_serial.c +1 -0
@@ -15,6 +15,7 @@#include <linux/serial_core.h> #include <linux/serial_8250.h> #include <linux/of_address.h> +#include <linux/of_irq.h> #include <linux/of_platform.h> #include <linux/nwpserial.h>
Signature · 1 line
1.7.1
A message that is not in the archive (sent off-list or not yet received): 1290037824-24978-3-git-send-email-robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Grant Likely
AppliedRe: [PATCH 2/3] of_serial: explicitly include of_irq.h
Quoted 6 lines · Rob Herring
From: Rob Herring <rob.herring-bsGFqQB8/[email protected]>
On PPC,
of_irq.hgets implicitly included, but on other platforms it does not.Signed-off-by Rob Herring <rob.herring-bsGFqQB8/[email protected]>
Applied, thanks.
g.
Quoted 23 lines
--- drivers/serial/of_serial.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)drivers/serial/of_serial.c +1
-0@@ -15,6 +15,7 @@#include <linux/serial_core.h> #include <linux/serial_8250.h> #include <linux/of_address.h> +#include <linux/of_irq.h> #include <linux/of_platform.h> #include <linux/nwpserial.h> Signature · 6 lines
1.7.1 _______________________________________________ devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/[email protected] https://lists.ozlabs.org/listinfo/devicetree-discuss
PATCH 3/3 OF: make drivers depend on CONFIG_OF instead of CONFIG_PPC_OF
In reply to a message not in the archiveFrom: Rob Herring <rob.herring-bsGFqQB8/[email protected]>
Some OF drivers could likely be used on non-powerpc OF based platforms, so fix the kconfig depends to be CONFIG_OF instead of CONFIG_PPC_OF.
Compile tested on ARM and sparc.
--- drivers/char/ipmi/ipmi_si_intf.c | 14 +++++++------- drivers/mmc/host/Kconfig | 4 +++- drivers/mtd/Kconfig | 2 +- drivers/mtd/maps/Kconfig | 2 +- drivers/serial/Kconfig | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-)
drivers/char/ipmi/ipmi_si_intf.c +7 -7
@@ -66,7 +66,7 @@#include <linux/ctype.h> #include <linux/pnp.h> -#ifdef CONFIG_PPC_OF +#ifdef CONFIG_OF #include <linux/of_device.h> #include <linux/of_address.h> #include <linux/of_irq.h>
@@ -309,7 +309,7 @@ static int pci_registered;#ifdef CONFIG_ACPI static int pnp_registered;#endif -#ifdef CONFIG_PPC_OF +#ifdef CONFIG_OF static int plat_registered;#endif
@@ -2531,7 +2531,7 @@ static struct pci_driver ipmi_pci_driver = {#endif /* CONFIG_PCI */ -#ifdef CONFIG_PPC_OF +#ifdef CONFIG_OF static int __devinit ipmi_plat_probe (struct platform_device *dev) {struct smi_info *info;
@@ -2644,7 +2644,7 @@ static struct platform_driver ipmi_platform_driver = { .probe = ipmi_plat_probe, .remove = __devexit_p(ipmi_plat_remove), }; -#endif /* CONFIG_PPC_OF */ +#endif /* CONFIG_OF */ static int wait_for_msg_done (struct smi_info *smi_info) {
@@ -3381,7 +3381,7 @@ static __devinit int init_ipmi_si(void)spmi_find_bmc ();#endif -#ifdef CONFIG_PPC_OF +#ifdef CONFIG_OF platform_driver_register (&ipmi_platform_driver); plat_registered =1 ;#endif
@@ -3441,7 +3441,7 @@ static __devinit int init_ipmi_si(void)pci_unregister_driver (&ipmi_pci_driver);#endif -#ifdef CONFIG_PPC_OF +#ifdef CONFIG_OF if (plat_registered)platform_driver_unregister (&ipmi_platform_driver);#endif
@@ -3542,7 +3542,7 @@ static __exit void cleanup_ipmi_si(void)pnp_unregister_driver (&ipmi_pnp_driver);#endif -#ifdef CONFIG_PPC_OF +#ifdef CONFIG_OF if (plat_registered)platform_driver_unregister (&ipmi_platform_driver);#endif
drivers/mmc/host/Kconfig +3 -1
@@ -83,7 +83,7 @@ config MMC_RICOH_MMC config MMC_SDHCI_OF tristate "SDHCI support on OpenFirmware platforms" - depends on MMC_SDHCI && PPC_OF + depends on MMC_SDHCI && OF help This selects the OF support for Secure Digital Host Controller Interfaces.
@@ -93,6 +93,7 @@ config MMC_SDHCI_OF config MMC_SDHCI_OF_ESDHC bool "SDHCI OF support for the Freescale eSDHC controller" depends on MMC_SDHCI_OF + depends on PPC_OF select MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER help This selects the Freescale eSDHC controller support.
@@ -102,6 +103,7 @@ config MMC_SDHCI_OF_ESDHC config MMC_SDHCI_OF_HLWD bool "SDHCI OF support for the Nintendo Wii SDHCI controllers" depends on MMC_SDHCI_OF + depends on PPC_OF select MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER help This selects the Secure Digital Host Controller Interface (SDHCI)
drivers/mtd/Kconfig +1 -1
@@ -159,7 +159,7 @@ config MTD_AFS_PARTS config MTD_OF_PARTS tristate "Flash partition map based on OF description" - depends on (MICROBLAZE || PPC_OF) && MTD_PARTITIONS + depends on OF && MTD_PARTITIONS help This provides a partition parsing function which derives the partition map from the children of the flash node,
drivers/mtd/maps/Kconfig +1 -1
@@ -72,7 +72,7 @@ config MTD_PHYSMAP_BANKWIDTH config MTD_PHYSMAP_OF tristate "Flash device in physical memory map based on OF description" - depends on (MICROBLAZE || PPC_OF) && (MTD_CFI || MTD_JEDECPROBE || MTD_ROM) + depends on OF && (MTD_CFI || MTD_JEDECPROBE || MTD_ROM) help This provides a 'mapping' driver which allows the NOR Flash and ROM driver code to communicate with chips which are mapped
drivers/serial/Kconfig +1 -1
@@ -1408,7 +1408,7 @@ config SERIAL_NETX_CONSOLE config SERIAL_OF_PLATFORM tristate "Serial port on Open Firmware platform bus" - depends on PPC_OF || MICROBLAZE + depends on OF depends on SERIAL_8250 || SERIAL_OF_PLATFORM_NWPSERIAL help If you have a PowerPC based system that has serial ports
Signature · 1 line
1.7.1
A message that is not in the archive (sent off-list or not yet received): 1290037824-24978-4-git-send-email-robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 3/3] OF: make drivers depend on CONFIG_OF instead of CONFIG_PPC_OF
Quoted 8 lines · Rob Herring
From: Rob Herring <rob.herring-bsGFqQB8/[email protected]>
Some OF drivers could likely be used on non-powerpc OF based platforms, so fix the kconfig depends to be
CONFIG_OFinstead ofCONFIG_PPC_OF.Compile tested on ARM and sparc.
Signed-off-by Rob Herring <rob.herring-bsGFqQB8/[email protected]>
Since I'm not picking up patch 1/3, this patch doesn't apply. I'll skip this one too.
g.
Quoted 150 lines
--- drivers/char/ipmi/ipmi_si_intf.c | 14 +++++++------- drivers/mmc/host/Kconfig | 4 +++- drivers/mtd/Kconfig | 2 +- drivers/mtd/maps/Kconfig | 2 +- drivers/serial/Kconfig | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-)drivers/char/ipmi/ipmi_si_intf.c +7
-7@@ -66,7 +66,7 @@#include <linux/ctype.h> #include <linux/pnp.h> -#ifdef CONFIG_PPC_OF +#ifdef CONFIG_OF #include <linux/of_device.h> #include <linux/of_address.h> #include <linux/of_irq.h> @@ -309,7 +309,7 @@ static int pci_registered;#ifdef CONFIG_ACPI static int pnp_registered;#endif -#ifdef CONFIG_PPC_OF +#ifdef CONFIG_OF static int plat_registered;#endif @@ -2531,7 +2531,7 @@ static struct pci_driver ipmi_pci_driver = {#endif /* CONFIG_PCI */ -#ifdef CONFIG_PPC_OF +#ifdef CONFIG_OF static int __devinit ipmi_plat_probe (struct platform_device *dev) {struct smi_info *info;@@ -2644,7 +2644,7 @@ static struct platform_driver ipmi_platform_driver = { .probe = ipmi_plat_probe, .remove = __devexit_p(ipmi_plat_remove), }; -#endif /* CONFIG_PPC_OF */ +#endif /* CONFIG_OF */ static int wait_for_msg_done (struct smi_info *smi_info) {@@ -3381,7 +3381,7 @@ static __devinit int init_ipmi_si(void)spmi_find_bmc ();#endif -#ifdef CONFIG_PPC_OF +#ifdef CONFIG_OF platform_driver_register (&ipmi_platform_driver); plat_registered =1 ;#endif @@ -3441,7 +3441,7 @@ static __devinit int init_ipmi_si(void)pci_unregister_driver (&ipmi_pci_driver);#endif -#ifdef CONFIG_PPC_OF +#ifdef CONFIG_OF if (plat_registered)platform_driver_unregister (&ipmi_platform_driver);#endif @@ -3542,7 +3542,7 @@ static __exit void cleanup_ipmi_si(void)pnp_unregister_driver (&ipmi_pnp_driver);#endif -#ifdef CONFIG_PPC_OF +#ifdef CONFIG_OF if (plat_registered)platform_driver_unregister (&ipmi_platform_driver);#endif drivers/mmc/host/Kconfig +3
-1@@ -83,7 +83,7 @@ config MMC_RICOH_MMC config MMC_SDHCI_OF tristate "SDHCI support on OpenFirmware platforms" - depends on MMC_SDHCI && PPC_OF + depends on MMC_SDHCI && OF help This selects the OF support for Secure Digital Host Controller Interfaces.@@ -93,6 +93,7 @@ config MMC_SDHCI_OF config MMC_SDHCI_OF_ESDHC bool "SDHCI OF support for the Freescale eSDHC controller" depends on MMC_SDHCI_OF + depends on PPC_OF select MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER help This selects the Freescale eSDHC controller support.@@ -102,6 +103,7 @@ config MMC_SDHCI_OF_ESDHC config MMC_SDHCI_OF_HLWD bool "SDHCI OF support for the Nintendo Wii SDHCI controllers" depends on MMC_SDHCI_OF + depends on PPC_OF select MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER help This selects the Secure Digital Host Controller Interface (SDHCI)drivers/mtd/Kconfig +1
-1@@ -159,7 +159,7 @@ config MTD_AFS_PARTS config MTD_OF_PARTS tristate "Flash partition map based on OF description" - depends on (MICROBLAZE || PPC_OF) && MTD_PARTITIONS + depends on OF && MTD_PARTITIONS help This provides a partition parsing function which derives the partition map from the children of the flash node,drivers/mtd/maps/Kconfig +1
-1@@ -72,7 +72,7 @@ config MTD_PHYSMAP_BANKWIDTH config MTD_PHYSMAP_OF tristate "Flash device in physical memory map based on OF description" - depends on (MICROBLAZE || PPC_OF) && (MTD_CFI || MTD_JEDECPROBE || MTD_ROM) + depends on OF && (MTD_CFI || MTD_JEDECPROBE || MTD_ROM) help This provides a 'mapping' driver which allows the NOR Flash and ROM driver code to communicate with chips which are mappeddrivers/serial/Kconfig +1
-1@@ -1408,7 +1408,7 @@ config SERIAL_NETX_CONSOLE config SERIAL_OF_PLATFORM tristate "Serial port on Open Firmware platform bus" - depends on PPC_OF || MICROBLAZE + depends on OF depends on SERIAL_8250 || SERIAL_OF_PLATFORM_NWPSERIAL help If you have a PowerPC based system that has serial portsSignature · 6 lines
1.7.1 _______________________________________________ devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/[email protected] https://lists.ozlabs.org/listinfo/devicetree-discuss
Grant,
Quoted 22 lines · Rob Herring
From: Rob Herring<rob.herring-bsGFqQB8/[email protected]>
Grant,
Here is updated patch series incorporating your feedback.
I dropped the sja1000 and isp1760 drivers. They already have platform driver variants and need a more complicated merge that I wouldn't test.
I found another implicit include needing fixing in
of_serialas well.This is now compile tested on ARM and sparc. (BTW, allmodconfig was already pretty broken on sparc). ipmi was run on ARM as well.
Regards,
RobRob Herring (3):
ipmi: convert OF driver to platform driver
of_serial: explicitly includeof_irq.h
OF: make drivers depend onCONFIG_OFinstead ofCONFIG_PPC_OF
Quoted 8 lines
drivers/char/ipmi/ipmi_si_intf.c | 50 +++++++++++++++++++++---------------- drivers/mmc/host/Kconfig | 4 ++- drivers/mtd/Kconfig | 2 +- drivers/mtd/maps/Kconfig | 2 +- drivers/serial/Kconfig | 2 +- drivers/serial/of_serial.c | 1 + 6 files changed, 35 insertions(+), 26 deletions(-)
Any comments on these?
Rob