Skip to contentSkip to conversation

arm: vexpress: hook platform_data to clcd_pl11x by amba bus_notify

PATCH New Barry Song 3 participants 6 messages Dec 15, 2012 – Dec 17, 2012

Subsystems (3)
lore
Share & tools
lore

Barry Song

author
#0 lore raw

PATCH 1/1 arm: vexpress: hook platform_data to clcd_pl11x by amba bus_notify

From: Barry Song <[email protected]>

when using dtb to boot v2p-ca9, clcd probe will fail due to missed the platform_data:
clcd-pl11x: probe of 10020000.clcd failed with error -22 this patch hooks the platform_data to clcd and make lcd of v2p-ca9 can work while booting vexpress by DTB.
Tested on qemu by "qemu-system-arm -M vexpress-a9 -m 512M -kernel zImage -dtb ./vexpress-v2p-ca9.dtb"

---
 arch/arm/mach-vexpress/ct-ca9x4.c                 |   30 +++++++++++++++++++++
 arch/arm/mach-vexpress/include/mach/motherboard.h |    1 +
 arch/arm/mach-vexpress/v2m.c                      |   10 +++++++
 3 files changed, 41 insertions(+), 0 deletions(-)
arch/arm/mach-vexpress/ct-ca9x4.c +30 -0
index 4f471fa..92b03e7 100644
@@ -111,6 +111,35 @@ static struct amba_device *ct_ca9x4_amba_devs[] __initdata = {
 	&gpio_device,
 };
 
+static int ct_ca9x4_of_amba_notify(struct notifier_block *nb, unsigned long action,
+		void *data)
+{
+	struct device *dev = data;
+
+	/* We are only intereted in device addition */
+	if (action != BUS_NOTIFY_ADD_DEVICE)
+		return 0;
+
+	if (!of_find_compatible_node(NULL, NULL, "arm,vexpress,v2p-ca9"))
+		return 0;
+
+	if (of_device_is_compatible(dev->of_node, "arm,pl111"))
+		dev->platform_data = &ct_ca9x4_clcd_data;
+
+	return 0;
+}
+
+static struct notifier_block ct_ca9x4_amba_nb = {
+	.notifier_call = ct_ca9x4_of_amba_notify,
+};
+
+static void ct_ca9x4_register_bus_nb(void)
+{
+	/* Register callbacks on OF amba device addition/removal
+	 * to handle linking them to the right platform_data
+	 */
+	bus_register_notifier(&amba_bustype, &ct_ca9x4_amba_nb);
+}
 
 static struct v2m_osc ct_osc1 = {
 	.osc = 1,
@@ -211,6 +240,7 @@ struct ct_desc ct_ca9x4_desc __initdata = {
 	.map_io		= ct_ca9x4_map_io,
 	.init_irq	= ct_ca9x4_init_irq,
 	.init_tile	= ct_ca9x4_init,
+	.bus_notifer	= ct_ca9x4_register_bus_nb,
 #ifdef CONFIG_SMP
 	.init_cpu_map	= ct_ca9x4_init_cpu_map,
 	.smp_enable	= ct_ca9x4_smp_enable,
arch/arm/mach-vexpress/include/mach/motherboard.h +1 -0
index 1e388c7..f88982b 100644
@@ -141,6 +141,7 @@ struct ct_desc {
 	void			(*init_early)(void);
 	void			(*init_irq)(void);
 	void			(*init_tile)(void);
+	void			(*bus_notifer)(void);
 #ifdef CONFIG_SMP
 	void			(*init_cpu_map)(void);
 	void			(*smp_enable)(unsigned int);
arch/arm/mach-vexpress/v2m.c +10 -0
index 560e0df..e9147f8 100644
@@ -431,6 +431,8 @@ static void __init v2m_clk_init(void)
 	clk = v2m_osc_register("mb:osc1", &v2m_mb_osc1);
 	for (i = 0; i < ARRAY_SIZE(v2m_osc1_periphs); i++)
 		WARN_ON(clk_register_clkdev(clk, NULL, v2m_osc1_periphs[i]));
+	if (of_find_compatible_node(NULL, NULL, "arm,vexpress,v2p-ca9"))
+		WARN_ON(clk_register_clkdev(clk, NULL, "10020000.clcd"));
 
 	clk = clk_register_fixed_rate(NULL, "mb:osc2", NULL,
 			CLK_IS_ROOT, 24000000);
@@ -651,7 +653,15 @@ static struct of_dev_auxdata v2m_dt_auxdata_lookup[] __initdata = {
 
 static void __init v2m_dt_init(void)
 {
+	int i;
+
 	l2x0_of_init(0x00400000, 0xfe0fffff);
+
+	/* some devices need to hook platform_data */
+	for (i = 0; i < ARRAY_SIZE(ct_descs); i++)
+		if (ct_descs[i]->bus_notifer)
+			ct_descs[i]->bus_notifer();
+
 	of_platform_populate(NULL, of_default_bus_match_table,
 			v2m_dt_auxdata_lookup, NULL);
 	pm_power_off = v2m_power_off;
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 arm: vexpress: hook platform_data to clcd_pl11x by amba bus_notify

Quoted 11 lines · Barry Song

From: Barry Song <[email protected]>

when using dtb to boot v2p-ca9, clcd probe will fail due to missed the platform_data:
clcd-pl11x: probe of 10020000.clcd failed with error -22 this patch hooks the platform_data to clcd and make lcd of v2p-ca9 can work while booting vexpress by DTB.
Tested on qemu by "qemu-system-arm -M vexpress-a9 -m 512M -kernel zImage -dtb ./vexpress-v2p-ca9.dtb"

Thanks for your work, however there are some problems with your code, especially if you look at the changes being merged right now for 3.8 kernel... The clocking implementation is completely changed (actually you should not need any extra CLCD information now), and as the auxdata for devices population is removed, you could use it instead of the - slightly strange to my taste - notifier-based solution.

Now having said all that, I'm hoping to get comprehensive solution for DT-based VE display devices ready in time for 3.9, which will sort out the issue once for all.

Pawe?

author
#2 lore raw

PATCH 1/1 arm: vexpress: hook platform_data to clcd_pl11x by amba bus_notify

2012/12/17 Pawel Moll <[email protected]>

Quoted 12 lines · Barry Song
Quoted 10 lines

From: Barry Song <[email protected]>

when using dtb to boot v2p-ca9, clcd probe will fail due to missed the platform_data:
clcd-pl11x: probe of 10020000.clcd failed with error -22 this patch hooks the platform_data to clcd and make lcd of v2p-ca9 can work while booting vexpress by DTB.
Tested on qemu by "qemu-system-arm -M vexpress-a9 -m 512M -kernel zImage -dtb ./vexpress-v2p-ca9.dtb"

Quoted 9 lines
Quoted 1 line

Thanks for your work, however there are some problems with your code, especially if you look at the changes being merged right now for 3.8 kernel... The clocking implementation is completely changed (actually you should not need any extra CLCD information now), and as the auxdata for devices population is removed, you could use it instead of the - slightly strange to my taste - notifier-based solution.

i see, i just tried to boot up your clcd on qemu using 3.7 release
and didn't take a look at your changes for 3.8.

Quoted 3 lines

Now having said all that, I'm hoping to get comprehensive solution for DT-based VE display devices ready in time for 3.9, which will sort out the issue once for all.

well, look forward to see that. but as i said, i will use 3.7 for these monthes, booting your board by dt and hope to back port yours to my 3.7 later.

Quoted 2 lines

Pawe?

-barry

#3 lore raw

PATCH 1/1 arm: vexpress: hook platform_data to clcd_pl11x by amba bus_notify

Quoted 7 lines · Barry Song
Quoted 3 lines

Now having said all that, I'm hoping to get comprehensive solution for DT-based VE display devices ready in time for 3.9, which will sort out the issue once for all.

well, look forward to see that. but as i said, i will use 3.7 for these monthes, booting your board by dt and hope to back port yours to my 3.7 later.

Sure thing, if this works for you. You may also want to have a look at the Linaro VE releases, as they have working (if slightly baroque ;-) DT solution for CLCD as well.

Thanks!

Pawe?

#4 lore raw

PATCH 1/1 arm: vexpress: hook platform_data to clcd_pl11x by amba bus_notify

In reply to Pawel Moll
Quoted 20 lines · Pawel Moll
Quoted 11 lines · Barry Song

From: Barry Song <[email protected]>

when using dtb to boot v2p-ca9, clcd probe will fail due to missed the platform_data:
clcd-pl11x: probe of 10020000.clcd failed with error -22 this patch hooks the platform_data to clcd and make lcd of v2p-ca9 can work while booting vexpress by DTB.
Tested on qemu by "qemu-system-arm -M vexpress-a9 -m 512M -kernel zImage -dtb ./vexpress-v2p-ca9.dtb"

Thanks for your work, however there are some problems with your code, especially if you look at the changes being merged right now for 3.8 kernel... The clocking implementation is completely changed (actually you should not need any extra CLCD information now), and as the auxdata for devices population is removed, you could use it instead of the - slightly strange to my taste - notifier-based solution.

Quoted 3 lines

Now having said all that, I'm hoping to get comprehensive solution for DT-based VE display devices ready in time for 3.9, which will sort out the issue once for all.

It has? Why haven't I been copied on the CLCD driver patches then?

#5 lore raw

PATCH 1/1 arm: vexpress: hook platform_data to clcd_pl11x by amba bus_notify

Quoted 5 lines · Russell King - ARM Linux
Quoted 3 lines

Now having said all that, I'm hoping to get comprehensive solution for DT-based VE display devices ready in time for 3.9, which will sort out the issue once for all.

It has? Why haven't I been copied on the CLCD driver patches then?

By "ready in time for 3.9" I meant 2-3 months timeframe. Nothing more than the Ryan Harkin's patch was sent to anyone.

Pawe?