linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] video: ARM CLCD: runtime check for Versatile
@ 2016-02-02 20:47 Linus Walleij
  2016-02-02 21:10 ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2016-02-02 20:47 UTC (permalink / raw)
  To: linux-arm-kernel

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 <robh@kernel.org>
Cc: Russell King <linux@arm.linux.org.uk>
Fixes: a29da136de34 ("ARM: versatile: convert to multi-platform")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/video/fbdev/amba-clcd.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/video/fbdev/amba-clcd.c b/drivers/video/fbdev/amba-clcd.c
index 9362424c2340..f9ef06d0cd48 100644
--- a/drivers/video/fbdev/amba-clcd.c
+++ b/drivers/video/fbdev/amba-clcd.c
@@ -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);
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] video: ARM CLCD: runtime check for Versatile
  2016-02-02 20:47 [PATCH] video: ARM CLCD: runtime check for Versatile Linus Walleij
@ 2016-02-02 21:10 ` Arnd Bergmann
  2016-02-03  0:41   ` Russell King - ARM Linux
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2016-02-02 21:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 02 February 2016 21:47:39 Linus Walleij wrote:
>         } 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;
> +               }
>         }
> 

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

	Arnd

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] video: ARM CLCD: runtime check for Versatile
  2016-02-02 21:10 ` Arnd Bergmann
@ 2016-02-03  0:41   ` Russell King - ARM Linux
  2016-02-03  9:05     ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: Russell King - ARM Linux @ 2016-02-03  0:41 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Feb 02, 2016 at 10:10:49PM +0100, Arnd Bergmann wrote:
> On Tuesday 02 February 2016 21:47:39 Linus Walleij wrote:
> >         } 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;
> > +               }
> >         }
> > 
> 
> 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.

-- 
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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] video: ARM CLCD: runtime check for Versatile
  2016-02-03  0:41   ` Russell King - ARM Linux
@ 2016-02-03  9:05     ` Arnd Bergmann
  0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2016-02-03  9:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 03 February 2016 00:41:54 Russell King - ARM Linux wrote:
> On Tue, Feb 02, 2016 at 10:10:49PM +0100, Arnd Bergmann wrote:
> > On Tuesday 02 February 2016 21:47:39 Linus Walleij wrote:
> > >         } 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;
> > > +               }
> > >         }
> > > 
> > 
> > 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.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-03  9:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-02 20:47 [PATCH] video: ARM CLCD: runtime check for Versatile Linus Walleij
2016-02-02 21:10 ` Arnd Bergmann
2016-02-03  0:41   ` Russell King - ARM Linux
2016-02-03  9:05     ` Arnd Bergmann

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).