From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/7] ARM: mackerel: support booting with or without DT
Date: Fri, 14 Dec 2012 16:45:30 +0000 [thread overview]
Message-ID: <1355503531-7276-7-git-send-email-g.liakhovetski@gmx.de> (raw)
In-Reply-To: <1355503531-7276-1-git-send-email-g.liakhovetski@gmx.de>
This patch adds dynamic switching to booting either with or without DT.
So far only a part of the board initialisation can be done via DT. Devices,
that still need platform data are kept that way. Devices, that can be
initialised from DT will not be supplied from the platform data, if a DT
image is detected.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
arch/arm/mach-shmobile/board-mackerel.c | 84 ++++++++++++++++++++++++-------
1 files changed, 66 insertions(+), 18 deletions(-)
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 39b8f2e..a6358c9 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -1326,7 +1326,6 @@ static struct platform_device mackerel_camera = {
static struct platform_device *mackerel_devices[] __initdata = {
&nor_flash_device,
- &smc911x_device,
&lcdc_device,
&usbhs0_device,
&usbhs1_device,
@@ -1335,17 +1334,21 @@ static struct platform_device *mackerel_devices[] __initdata = {
&fsi_ak4643_device,
&fsi_hdmi_device,
&nand_flash_device,
+ &ceu_device,
+ &mackerel_camera,
+ &hdmi_device,
+ &hdmi_lcdc_device,
+ &meram_device,
+};
+
+static struct platform_device *mackerel_devices_dt[] __initdata = {
+ &smc911x_device,
&sdhi0_device,
#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
&sdhi1_device,
#endif
&sdhi2_device,
&sh_mmcif_device,
- &ceu_device,
- &mackerel_camera,
- &hdmi_device,
- &hdmi_lcdc_device,
- &meram_device,
};
/* Keypad Initialization */
@@ -1404,6 +1407,24 @@ static struct i2c_board_info i2c1_devices[] = {
},
};
+static int mackerel_i2c_bus_notify(struct notifier_block *nb,
+ unsigned long action, void *data)
+{
+ struct device *dev = data;
+
+ if (action != BUS_NOTIFY_ADD_DEVICE ||
+ strcmp(dev_name(dev->parent), "fff20000.i2c"))
+ return NOTIFY_DONE;
+
+ i2c_new_device(to_i2c_adapter(dev), &i2c0_devices[1]);
+
+ return NOTIFY_OK;
+}
+
+static struct notifier_block mackerel_i2c_notifier = {
+ .notifier_call = mackerel_i2c_bus_notify,
+};
+
#define GPIO_PORT9CR IOMEM(0xE6051009)
#define GPIO_PORT10CR IOMEM(0xE605100A)
#define GPIO_PORT167CR IOMEM(0xE60520A7)
@@ -1420,22 +1441,26 @@ static void __init mackerel_init(void)
{ "A3SP", &usbhs0_device, },
{ "A3SP", &usbhs1_device, },
{ "A3SP", &nand_flash_device, },
+ { "A4R", &ceu_device, },
+ };
+ struct pm_domain_device domain_devices_dt[] = {
{ "A3SP", &sh_mmcif_device, },
{ "A3SP", &sdhi0_device, },
#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
{ "A3SP", &sdhi1_device, },
#endif
{ "A3SP", &sdhi2_device, },
- { "A4R", &ceu_device, },
};
u32 srcr4;
struct clk *clk;
- regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers,
- ARRAY_SIZE(fixed1v8_power_consumers), 1800000);
- regulator_register_always_on(1, "fixed-3.3V", fixed3v3_power_consumers,
- ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
- regulator_register_fixed(2, dummy_supplies, ARRAY_SIZE(dummy_supplies));
+ if (!of_have_populated_dt()) {
+ regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers,
+ ARRAY_SIZE(fixed1v8_power_consumers), 1800000);
+ regulator_register_always_on(1, "fixed-3.3V", fixed3v3_power_consumers,
+ ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
+ regulator_register_fixed(2, dummy_supplies, ARRAY_SIZE(dummy_supplies));
+ }
/* External clock source */
clk_set_rate(&sh7372_dv_clki_clk, 27000000);
@@ -1633,22 +1658,35 @@ static void __init mackerel_init(void)
udelay(50);
__raw_writel(srcr4 & ~(1 << 13), SRCR4);
- i2c_register_board_info(0, i2c0_devices,
- ARRAY_SIZE(i2c0_devices));
- i2c_register_board_info(1, i2c1_devices,
- ARRAY_SIZE(i2c1_devices));
+ if (!of_have_populated_dt()) {
+ i2c_register_board_info(0, i2c0_devices,
+ ARRAY_SIZE(i2c0_devices));
+ i2c_register_board_info(1, i2c1_devices,
+ ARRAY_SIZE(i2c1_devices));
+ } else {
+ bus_register_notifier(&i2c_bus_type,
+ &mackerel_i2c_notifier);
+ }
sh7372_add_standard_devices();
platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices));
+ if (!of_have_populated_dt())
+ platform_add_devices(mackerel_devices_dt,
+ ARRAY_SIZE(mackerel_devices_dt));
rmobile_add_devices_to_domains(domain_devices,
ARRAY_SIZE(domain_devices));
+ if (!of_have_populated_dt())
+ rmobile_add_devices_to_domains(domain_devices_dt,
+ ARRAY_SIZE(domain_devices_dt));
hdmi_init_pm_clock();
sh7372_pm_init();
pm_clk_add(&fsi_device.dev, "spu2");
pm_clk_add(&hdmi_lcdc_device.dev, "hdmi");
+
+ of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
}
static const char *mackerel_boards_compat_dt[] __initdata = {
@@ -1659,10 +1697,20 @@ static const char *mackerel_boards_compat_dt[] __initdata = {
DT_MACHINE_START(MACKEREL_DT, "mackerel")
.map_io = sh7372_map_io,
.init_early = sh7372_add_early_devices,
- .init_irq = sh7372_init_irq,
+ .init_irq = sh7372_init_irq_of,
+ .handle_irq = shmobile_handle_irq_intc,
+ .init_machine = mackerel_init,
+ .init_late = sh7372_pm_init_late,
+ .timer = &shmobile_timer,
+ .dt_compat = mackerel_boards_compat_dt,
+MACHINE_END
+
+MACHINE_START(MACKEREL, "mackerel")
+ .map_io = sh7372_map_io,
+ .init_early = sh7372_add_early_devices,
+ .init_irq = sh7372_init_irq_of,
.handle_irq = shmobile_handle_irq_intc,
.init_machine = mackerel_init,
.init_late = sh7372_pm_init_late,
.timer = &shmobile_timer,
- .dt_compat = mackerel_boards_compat_dt,
MACHINE_END
--
1.7.2.5
next prev parent reply other threads:[~2012-12-14 16:45 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-14 16:45 [PATCH 0/7] ARM: mackerel: extended DT support Guennadi Liakhovetski
2012-12-14 16:45 ` [PATCH 1/7] ARM: sh7372: add missing "#interrupt-cells" properties Guennadi Liakhovetski
2012-12-15 9:05 ` Simon Horman
2012-12-14 16:45 ` [PATCH 2/7] ARM: mackerel: include the correct .dtsi file Guennadi Liakhovetski
2012-12-15 8:37 ` Simon Horman
2012-12-14 16:45 ` [PATCH 3/7] ARM: sh7372: support mixed DT and board code interrupt controller init Guennadi Liakhovetski
2012-12-15 7:52 ` Simon Horman
2012-12-17 8:02 ` Guennadi Liakhovetski
2012-12-14 16:45 ` [PATCH 4/7] ARM: sh7372: add clock lookup entries for DT-based devices Guennadi Liakhovetski
2012-12-15 7:29 ` Grant Likely
2012-12-15 8:36 ` Simon Horman
2012-12-14 16:45 ` [PATCH 5/7] ARM: sh7372: allow boards supporting booting with or without DT Guennadi Liakhovetski
2012-12-15 8:05 ` Simon Horman
2012-12-17 8:07 ` Guennadi Liakhovetski
2012-12-14 16:45 ` Guennadi Liakhovetski [this message]
2012-12-15 8:29 ` [PATCH 6/7] ARM: mackerel: support " Simon Horman
2012-12-15 19:02 ` Guennadi Liakhovetski
2012-12-16 0:33 ` Simon Horman
2012-12-16 20:46 ` Grant Likely
2012-12-16 21:36 ` Guennadi Liakhovetski
2012-12-17 16:38 ` Grant Likely
2012-12-17 16:50 ` Guennadi Liakhovetski
2012-12-17 16:54 ` Grant Likely
2012-12-17 12:40 ` [PATCH v2 " Guennadi Liakhovetski
2012-12-17 17:00 ` Grant Likely
2012-12-14 16:45 ` [PATCH 7/7] ARM: mackerel: add more devices to DT Guennadi Liakhovetski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1355503531-7276-7-git-send-email-g.liakhovetski@gmx.de \
--to=g.liakhovetski@gmx.de \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).