Clean up legacy platform data handling for omaps for v3.13
Subsystems (3)
Tony Lindgren
maintainercover Clean up legacy platform data handling for omaps for v3.13
Hi all,
Here are few patches to make it easier for us to maintain legacy platform data support while moving to device tree based booting. It seems that we still have quite a few places where we still need platform data for omap3 to keep things from breaking.
As the remaining drivers get converted to use device tree, we can then just remove the support from the pdata-quirks.c.
Regards,
Tony
---
Tony Lindgren (4):
ARM: OMAP2+: Always build in board-generic
ARM: OMAP2+: Add quirk support for legacy platform data init
ARM: OMAP2+: Use pdata quirk support for board-generic.c
ARM: OMAP2+: Use pdata quirks for wl12xx legacy init
arch/arm/mach-omap2/Kconfig | 10 +-- arch/arm/mach-omap2/Makefile | 2 - arch/arm/mach-omap2/board-generic.c | 33 ---------- arch/arm/mach-omap2/common.h | 2 + arch/arm/mach-omap2/devices.c | 38 ------------ arch/arm/mach-omap2/pdata-quirks.c | 111 +++++++++++++++++++++++++++++++++++ 6 files changed, 118 insertions(+), 78 deletions(-) create mode 100644 arch/arm/mach-omap2/pdata-quirks.c
Signature · 1 line
Signature
Tony Lindgren
maintainerPATCH 1/4 ARM: OMAP2+: Always build in board-generic
We are moving to device tree based booting, so board-generic should always be built.
--- arch/arm/mach-omap2/Kconfig | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
arch/arm/mach-omap2/Kconfig +3 -7
@@ -94,6 +94,7 @@ config ARCH_OMAP2PLUS select GENERIC_CLOCKEVENTS select GENERIC_IRQ_CHIP select HAVE_CLK + select MACH_OMAP_GENERIC select OMAP_DM_TIMER select PINCTRL select PROC_DEVICETREE if PROC_FS
@@ -187,16 +188,11 @@ config OMAP_PACKAGE_CUS config OMAP_PACKAGE_CBP bool -comment "OMAP Board Type" +comment "OMAP Legacy Platform Data Board Type" depends on ARCH_OMAP2PLUS config MACH_OMAP_GENERIC - bool "Generic OMAP2+ board" - depends on ARCH_OMAP2PLUS - default y - help - Support for generic TI OMAP2+ boards using Flattened Device Tree. - More information at Documentation/devicetree + bool config MACH_OMAP2_TUSB6010 bool
Tony Lindgren
maintainerPATCH 2/4 ARM: OMAP2+: Add quirk support for legacy platform data init
In reply to Tony LindgrenWe want to drop the board-*.c files but keep things working. Let's make it a bit easier to support legacy platform data init with quirks. This also keeps board-generic.c clean from board specific hacks.
For now, the quirks table is empty, that is populated in the later patches.
--- arch/arm/mach-omap2/Makefile | 2 +- arch/arm/mach-omap2/board-generic.c | 1 + arch/arm/mach-omap2/common.h | 2 ++ arch/arm/mach-omap2/pdata-quirks.c | 39 +++++++++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-omap2/pdata-quirks.c
arch/arm/mach-omap2/Makefile +1 -1
@@ -233,7 +233,7 @@ obj-y += drm.o endif # Specific board support -obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o +obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o pdata-quirks.o obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o
arch/arm/mach-omap2/board-generic.c +1 -0
@@ -56,6 +56,7 @@ static void __init omap_generic_init(void)omap_sdrc_init (NULL ,NULL );of_platform_populate (NULL , omap_dt_match_table,NULL ,NULL ); +pdata_quirks_init ();/* * HACK: call display setup code for selected boards to enable omapdss.
arch/arm/mach-omap2/common.h +2 -0
@@ -288,6 +288,8 @@ static inline void omap4_cpu_resume(void)#endif +void pdata_quirks_init (void ); +struct omap_sdrc_params ;extern void omap_sdrc_init (struct omap_sdrc_params *sdrc_cs0,struct omap_sdrc_params *sdrc_cs1);
arch/arm/mach-omap2/pdata-quirks.c new file +39 -0
@@ -0,0 +1,39 @@ +/* +* Legacy platform_data quirks +* +* Copyright (C) 2013 Texas Instruments +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#include <linux/clk.h> +#include <linux/init.h> +#include <linux/kernel.h> + +#include "common.h" +#include "common-board-devices.h" +#include "dss-common.h" + +struct pdata_init { +const char *compatible; +void (*fn)(void ); +}; + +static struct pdata_init pdata_quirks[]__initdata = { + {/* sentinel */ }, +}; + +void __init pdata_quirks_init (void ) +{ +struct pdata_init *quirks = pdata_quirks; + +while (quirks->compatible) { +if (of_machine_is_compatible (quirks->compatible)) { +if (quirks->fn) + quirks->fn (); +break ; + } + quirks++; + } +}
Tony Lindgren
maintainerPATCH 3/4 ARM: OMAP2+: Use pdata quirk support for board-generic.c
In reply to Tony LindgrenLet's use platform data quirk support for board-generic.c. This removes all board specific hacks out of board-generic.c.
--- arch/arm/mach-omap2/board-generic.c | 32 --------------------------- arch/arm/mach-omap2/pdata-quirks.c | 41 +++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 32 deletions(-)
arch/arm/mach-omap2/board-generic.c +0 -32
@@ -15,13 +15,10 @@#include <linux/of_irq.h> #include <linux/of_platform.h> #include <linux/irqdomain.h> -#include <linux/clk.h> #include <asm/mach/arch.h> #include "common.h" -#include "common-board-devices.h" -#include "dss-common.h" #if !(defined(CONFIG_ARCH_OMAP2 ) || defined(CONFIG_ARCH_OMAP3 ))#define intc_of_init NULL
@@ -36,41 +33,12 @@ static struct of_device_id omap_dt_match_table[] __initdata = { { } }; -/* -* Create alias for USB host PHY clock. -* Remove this when clock phandle can be provided via DT -*/ -static void __init legacy_init_ehci_clk (char *clkname) -{ -int ret; - - ret =clk_add_alias ("main_clk" ,NULL , clkname,NULL ); -if (ret) { -pr_err ("%s:Failed to add main_clk alias to %s :%d\n" , - __func__, clkname, ret); - } -} -static void __init omap_generic_init (void ) {omap_sdrc_init (NULL ,NULL );of_platform_populate (NULL , omap_dt_match_table,NULL ,NULL );pdata_quirks_init (); - -/* -* HACK: call display setup code for selected boards to enable omapdss. -* This will be removed when omapdss supports DT. -*/ -if (of_machine_is_compatible ("ti,omap4-panda" )) { -omap4_panda_display_init_of (); -legacy_init_ehci_clk ("auxclk3_ck" ); - - } -else if (of_machine_is_compatible ("ti,omap4-sdp" )) -omap_4430sdp_display_init_of (); -else if (of_machine_is_compatible ("ti,omap5-uevm" )) -legacy_init_ehci_clk ("auxclk1_ck" ); }#ifdef CONFIG_SOC_OMAP2420
arch/arm/mach-omap2/pdata-quirks.c +41 -0
48 lines not on this page · raw message
Tony Lindgren
maintainerPATCH 4/4 ARM: OMAP2+: Use pdata quirks for wl12xx legacy init
In reply to Tony LindgrenLet's use the platform data quirk support for wl12xx and move the board specific code out of devices.c.
--- arch/arm/mach-omap2/devices.c | 38 ------------------------------------ arch/arm/mach-omap2/pdata-quirks.c | 31 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 38 deletions(-)
arch/arm/mach-omap2/devices.c +0 -38
@@ -19,7 +19,6 @@#include <linux/of.h> #include <linux/pinctrl/machine.h> #include <linux/platform_data/omap4-keypad.h> -#include <linux/wl12xx.h> #include <linux/platform_data/mailbox-omap.h> #include <asm/mach-types.h>
@@ -475,40 +474,6 @@ static void omap_init_vout(void)static inline void omap_init_vout (void ) {}#endif -#if IS_ENABLED (CONFIG_WL12XX ) - -static struct wl12xx_platform_data wl12xx__initdata ; - -void __init omap_init_wl12xx_of (void ) -{ -int ret; - -if (!of_have_populated_dt ()) -return ; - -if (of_machine_is_compatible ("ti,omap4-sdp" )) { - wl12xx.board_ref_clock =WL12XX_REFCLOCK_26 ; - wl12xx.board_tcxo_clock =WL12XX_TCXOCLOCK_26 ; - wl12xx.irq =gpio_to_irq (53 ); - }else if (of_machine_is_compatible ("ti,omap4-panda" )) { - wl12xx.board_ref_clock =WL12XX_REFCLOCK_38 ; - wl12xx.irq =gpio_to_irq (53 ); - }else { -return ; - } - - ret =wl12xx_set_platform_data (&wl12xx); -if (ret) { -pr_err ("error setting wl12xx data: %d\n" , ret); -return ; - } -} -#else -static inline void omap_init_wl12xx_of (void ) -{ -} -#endif -/*-------------------------------------------------------------------------*/ static int __init omap2_init_devices (void )
@@ -531,9 +496,6 @@ static int __init omap2_init_devices(void)omap_init_sham ();omap_init_aes ();omap_init_rng (); - }else { -/* These can be removed when bindings are done */ -omap_init_wl12xx_of (); }omap_init_sti ();omap_init_vout ();
arch/arm/mach-omap2/pdata-quirks.c +31 -0
@@ -8,8 +8,10 @@* published by the Free Software Foundation. */ #include <linux/clk.h> +#include <linux/gpio.h> #include <linux/init.h> #include <linux/kernel.h> +#include <linux/wl12xx.h> #include "common.h" #include "common-board-devices.h"
@@ -34,16 +36,45 @@ static void __init __used legacy_init_ehci_clk(char *clkname) __func__, clkname, ret); } +#if IS_ENABLED (CONFIG_WL12XX ) + +static struct wl12xx_platform_data wl12xx__initdata ; + +static void __init __used legacy_init_wl12xx (unsigned ref_clock, +unsigned tcxo_clock, +int gpio) +{ +int res; + + wl12xx.board_ref_clock = ref_clock; + wl12xx.board_tcxo_clock = tcxo_clock; + wl12xx.irq =gpio_to_irq (gpio); + + res =wl12xx_set_platform_data (&wl12xx); +if (res) { +pr_err ("error setting wl12xx data: %d\n" , res); +return ; + } +} +#else +static inline void omap_init_wl12xx_of (void ) +{ +} +#endif +#ifdef CONFIG_ARCH_OMAP4 static void __init omap4_sdp_legacy_init (void ) {omap_4430sdp_display_init_of (); +legacy_init_wl12xx (WL12XX_REFCLOCK_26 , +WL12XX_TCXOCLOCK_26 ,53 ); }static void __init omap4_panda_legacy_init (void ) {omap4_panda_display_init_of ();legacy_init_ehci_clk ("auxclk3_ck" ); +legacy_init_wl12xx (WL12XX_REFCLOCK_38 ,0 ,53 ); }#endif
Tony Lindgren
maintainerPATCH 4/4 ARM: OMAP2+: Use pdata quirks for wl12xx legacy init
Quoted 18 lines · Tony Lindgren
arch/arm/mach-omap2/pdata-quirks.c +16
-0+#if IS_ENABLED (CONFIG_WL12XX ) + +static struct wl12xx_platform_data wl12xx__initdata ; + +static void __init __used legacy_init_wl12xx (unsigned ref_clock, +unsigned tcxo_clock, +int gpio) +{ +int res; + + wl12xx.board_ref_clock = ref_clock; + wl12xx.board_tcxo_clock = tcxo_clock; + wl12xx.irq =gpio_to_irq (gpio); + + res =wl12xx_set_platform_data (&wl12xx); +if (res) {
arch/arm/mach-omap2/pdata-quirks.c static void __init __used legacy_init_ehci_clk(char *clkname) · line 64
Quoted 10 lines
arch/arm/mach-omap2/pdata-quirks.c +10
-0+pr_err ("error setting wl12xx data: %d\n" , res); + return; + } +} +#else +static inline void omap_init_wl12xx_of (void ) +{ +} +#endif +
This should be legacy_init_wl12xx(unsigned ref_clock, unsigned tcxo_clock, int gpio) instead of just omap_init_wl12xx_of(void).
I've updated the patch and pushed this series to
omap-for-v3.13/quirk.
Regards,
Tony