Skip to contentSkip to conversation

video: ARM CLCD: runtime check for Versatile

PATCH New Linus Walleij 3 participants 4 messages Feb 2, 2016 – Feb 3, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video: ARM CLCD: runtime check for Versatile

The current compile-time check for inversed IENB/CNTL does not work in multiplatform boots: as soon as versatile is included in the build, the IENB/CNTL is switched and breaks graphics. Convert this to a runtime switch.

Cc stable at vger.kernel.org
Cc Rob Herring <[email protected]>
Cc Russell King <[email protected]>
Fixes a29da136de34 ("ARM: versatile: convert to multi-platform")
---
 drivers/video/fbdev/amba-clcd.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/video/fbdev/amba-clcd.c +8 -7
index 9362424c2340..f9ef06d0cd48 100644
@@ -440,13 +440,14 @@ static int clcdfb_register(struct clcd_fb *fb)
 		fb->off_ienb = CLCD_PL111_IENB;
 		fb->off_cntl = CLCD_PL111_CNTL;
 	} else {
-#ifdef CONFIG_ARCH_VERSATILE
-		fb->off_ienb = CLCD_PL111_IENB;
-		fb->off_cntl = CLCD_PL111_CNTL;
-#else
-		fb->off_ienb = CLCD_PL110_IENB;
-		fb->off_cntl = CLCD_PL110_CNTL;
-#endif
+		if (of_machine_is_compatible("arm,versatile-ab") ||
+		    of_machine_is_compatible("arm,versatile-pb")) {
+			fb->off_ienb = CLCD_PL111_IENB;
+			fb->off_cntl = CLCD_PL111_CNTL;
+		} else {
+			fb->off_ienb = CLCD_PL110_IENB;
+			fb->off_cntl = CLCD_PL110_CNTL;
+		}
 	}
 
 	fb->clk = clk_get(&fb->dev->dev, NULL);
Signature · 1 line
2.4.3
#1 lore raw

PATCH 1/1 video: ARM CLCD: runtime check for Versatile

Quoted 8 lines · On Tuesday 02 February 2016 21:47:39 Linus Walleij wrote:
        } else {
drivers/video/fbdev/amba-clcd.c +0 -6
-#ifdef CONFIG_ARCH_VERSATILE
-               fb->off_ienb = CLCD_PL111_IENB;
-               fb->off_cntl = CLCD_PL111_CNTL;
-#else
-               fb->off_ienb = CLCD_PL110_IENB;
-               fb->off_cntl = CLCD_PL110_CNTL;

drivers/video/fbdev/amba-clcd.c static int clcdfb_register(struct clcd_fb *fb) · line 451

Quoted 10 lines
drivers/video/fbdev/amba-clcd.c +8 -1
-#endif
+               if (of_machine_is_compatible("arm,versatile-ab") ||
+                   of_machine_is_compatible("arm,versatile-pb")) {
+                       fb->off_ienb = CLCD_PL111_IENB;
+                       fb->off_cntl = CLCD_PL111_CNTL;
+               } else {
+                       fb->off_ienb = CLCD_PL110_IENB;
+                       fb->off_cntl = CLCD_PL110_CNTL;
+               }
        }

Could that be done based on the AMBA device ID instead?

Arnd

#2 lore raw

PATCH 1/1 video: ARM CLCD: runtime check for Versatile

Quoted 13 lines · Arnd Bergmann
Quoted 12 lines · On Tuesday 02 February 2016 21:47:39 Linus Walleij wrote:
        } else {
drivers/video/fbdev/amba-clcd.c +4 -7
-#ifdef CONFIG_ARCH_VERSATILE
-               fb->off_ienb = CLCD_PL111_IENB;
-               fb->off_cntl = CLCD_PL111_CNTL;
-#else
-               fb->off_ienb = CLCD_PL110_IENB;
-               fb->off_cntl = CLCD_PL110_CNTL;
-#endif
+               if (of_machine_is_compatible("arm,versatile-ab") ||
+                   of_machine_is_compatible("arm,versatile-pb")) {
+                       fb->off_ienb = CLCD_PL111_IENB;
+                       fb->off_cntl = CLCD_PL111_CNTL;
Quoted 8 lines

drivers/video/fbdev/amba-clcd.c static int clcdfb_register(struct clcd_fb *fb) · line 451

Quoted 6 lines
drivers/video/fbdev/amba-clcd.c +4 -0
+               } else {
+                       fb->off_ienb = CLCD_PL110_IENB;
+                       fb->off_cntl = CLCD_PL110_CNTL;
+               }
        }

Could that be done based on the AMBA device ID instead?

Unfortunately not. It's a mistake made on one Versatile board which reverses the registers. There's nothing to distinguish it in the primecell itself.

Signature · 3 lines
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
#3 lore raw

PATCH 1/1 video: ARM CLCD: runtime check for Versatile

Quoted 23 lines · On Wednesday 03 February 2016 00:41:54 Russell King - ARM Linux wrote:
Quoted 13 lines · Arnd Bergmann
Quoted 12 lines · On Tuesday 02 February 2016 21:47:39 Linus Walleij wrote:
        } else {
drivers/video/fbdev/amba-clcd.c +4 -7
-#ifdef CONFIG_ARCH_VERSATILE
-               fb->off_ienb = CLCD_PL111_IENB;
-               fb->off_cntl = CLCD_PL111_CNTL;
-#else
-               fb->off_ienb = CLCD_PL110_IENB;
-               fb->off_cntl = CLCD_PL110_CNTL;
-#endif
+               if (of_machine_is_compatible("arm,versatile-ab") ||
+                   of_machine_is_compatible("arm,versatile-pb")) {
+                       fb->off_ienb = CLCD_PL111_IENB;
+                       fb->off_cntl = CLCD_PL111_CNTL;
Quoted 8 lines

drivers/video/fbdev/amba-clcd.c static int clcdfb_register(struct clcd_fb *fb) · line 451

Quoted 6 lines
drivers/video/fbdev/amba-clcd.c +4 -0
+               } else {
+                       fb->off_ienb = CLCD_PL110_IENB;
+                       fb->off_cntl = CLCD_PL110_CNTL;
+               }
        }

Could that be done based on the AMBA device ID instead?

Quoted 3 lines

Unfortunately not. It's a mistake made on one Versatile board which reverses the registers. There's nothing to distinguish it in the primecell itself.

Ok, I see. It would be nice to have this knowledge locally in the driver, e.g. through a special compatible string for the variant on the versatile, or a bool property, but this way seems good enough as we can be reasonably sure that nobody else made the same mistake.

Arnd