Message ID | 1351391173-32379-13-git-send-email-horms@verge.net.au (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Dear Simon Horman, On Sun, 28 Oct 2012 11:26:13 +0900, Simon Horman wrote: > -MACHINE_START(MACKEREL, "mackerel") > +static const char *mackerel_boards_compat_dt[] __initdata = { > + "renesas,mackerel", > + NULL, > +}; > + > +DT_MACHINE_START(MACKEREL_DT, "mackerel") > .map_io = sh7372_map_io, > .init_early = sh7372_add_early_devices, > .init_irq = sh7372_init_irq, > @@ -1659,4 +1664,5 @@ MACHINE_START(MACKEREL, "mackerel") > .init_machine = mackerel_init, > .init_late = sh7372_pm_init_late, > .timer = &shmobile_timer, > + .dt_compat = mackerel_boards_compat_dt, > MACHINE_END Not sure what is the status of mach-shmobile with regard to the device tree, but one of the idea of the device tree is to avoid having one .c file per board, and therefore one DT_MACHINE_START definition per board. There should be only only DT_MACHINE_START definition per SoC or SoC family, with the DT giving the detailed hardware description. Of course, during a transition period, not all your drivers may have DT bindings, and therefore some devices may need to be probed in the "old" way (manual registration of platform_device). In that case, your ->init_machine() hook can call initialization function on a per-board basis by testing if the machine is such or such board. See arch/arm/mach-kirkwood/board-dt.c for an example. The advantage is that with this solution, the board specific C files are progressively reducing in size as more and more devices get registered through the Device Tree, until the point where they become empty and can be removed. Best regards, Thomas
On Sun, Oct 28, 2012 at 10:37:11AM +0100, Thomas Petazzoni wrote: > Dear Simon Horman, > > On Sun, 28 Oct 2012 11:26:13 +0900, Simon Horman wrote: > > > -MACHINE_START(MACKEREL, "mackerel") > > +static const char *mackerel_boards_compat_dt[] __initdata = { > > + "renesas,mackerel", > > + NULL, > > +}; > > + > > +DT_MACHINE_START(MACKEREL_DT, "mackerel") > > .map_io = sh7372_map_io, > > .init_early = sh7372_add_early_devices, > > .init_irq = sh7372_init_irq, > > @@ -1659,4 +1664,5 @@ MACHINE_START(MACKEREL, "mackerel") > > .init_machine = mackerel_init, > > .init_late = sh7372_pm_init_late, > > .timer = &shmobile_timer, > > + .dt_compat = mackerel_boards_compat_dt, > > MACHINE_END > > Not sure what is the status of mach-shmobile with regard to the device > tree, but one of the idea of the device tree is to avoid having one .c > file per board, and therefore one DT_MACHINE_START definition per > board. There should be only only DT_MACHINE_START definition per SoC or > SoC family, with the DT giving the detailed hardware description. > > Of course, during a transition period, not all your drivers may have DT > bindings, and therefore some devices may need to be probed in the "old" > way (manual registration of platform_device). In that case, your > ->init_machine() hook can call initialization function on a per-board > basis by testing if the machine is such or such board. > > See arch/arm/mach-kirkwood/board-dt.c for an example. The advantage is > that with this solution, the board specific C files are progressively > reducing in size as more and more devices get registered through the > Device Tree, until the point where they become empty and can be removed. Hi Thomas, shmobile is very much in the transition phase and we are, patch by patch, working towards full(er) DT support for boards, SoCs and drivers. I am not sure that now is the right time to jump to a approach similar to that taken by mach-kirkwood/board-dt.c.
Simon, On Sun, 28 Oct 2012 19:44:38 +0900, Simon Horman wrote: > shmobile is very much in the transition phase and we are, patch by patch, > working towards full(er) DT support for boards, SoCs and drivers. I am not > sure that now is the right time to jump to a approach similar to that taken > by mach-kirkwood/board-dt.c. Ok, I understand that for transition needs, each SoC family may need a different method. My comment was more a general comment to make sure that the right final direction is being taken. For sure the intermediate steps may be different. Best regards, Thomas
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index c1ce813..0632239 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -75,7 +75,8 @@ dtb-$(CONFIG_ARCH_PRIMA2) += prima2-evb.dtb dtb-$(CONFIG_ARCH_U8500) += snowball.dtb dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \ r8a7740-armadillo800eva.dtb \ - sh73a0-kzm9g.dtb + sh73a0-kzm9g.dtb \ + sh7372-mackerel.dtb dtb-$(CONFIG_ARCH_SPEAR13XX) += spear1310-evb.dtb \ spear1340-evb.dtb dtb-$(CONFIG_ARCH_SPEAR3XX)+= spear300-evb.dtb \ diff --git a/arch/arm/boot/dts/sh7372-mackerel.dts b/arch/arm/boot/dts/sh7372-mackerel.dts new file mode 100644 index 0000000..286f0ca --- /dev/null +++ b/arch/arm/boot/dts/sh7372-mackerel.dts @@ -0,0 +1,22 @@ +/* + * Device Tree Source for the mackerel board + * + * Copyright (C) 2012 Renesas Solutions Corp. + * + * This file is licensed under the terms of the GNU General Public License + * version 2. This program is licensed "as is" without any warranty of any + * kind, whether express or implied. + */ + +/dts-v1/; +/include/ "skeleton.dtsi" + +/ { + model = "Mackerel (AP4 EVM 2nd)"; + compatible = "renesas,mackerel"; + + memory { + device_type = "memory"; + reg = <0x40000000 0x10000000>; + }; +}; diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig index 8ae100c..0750d9c 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig @@ -95,6 +95,7 @@ config MACH_MACKEREL select ARCH_REQUIRE_GPIOLIB select REGULATOR_FIXED_VOLTAGE if REGULATOR select SND_SOC_AK4642 if SND_SIMPLE_CARD + select USE_OF config MACH_KOTA2 bool "KOTA2 board" diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 0c27c81..39b8f2e 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -1651,7 +1651,12 @@ static void __init mackerel_init(void) pm_clk_add(&hdmi_lcdc_device.dev, "hdmi"); } -MACHINE_START(MACKEREL, "mackerel") +static const char *mackerel_boards_compat_dt[] __initdata = { + "renesas,mackerel", + NULL, +}; + +DT_MACHINE_START(MACKEREL_DT, "mackerel") .map_io = sh7372_map_io, .init_early = sh7372_add_early_devices, .init_irq = sh7372_init_irq, @@ -1659,4 +1664,5 @@ MACHINE_START(MACKEREL, "mackerel") .init_machine = mackerel_init, .init_late = sh7372_pm_init_late, .timer = &shmobile_timer, + .dt_compat = mackerel_boards_compat_dt, MACHINE_END