Skip to contentSkip to conversation

TQM5200 + SM501 FB

DISCUSSION Wolfgang Denk 2 participants 3 messages Dec 4, 2009 – Dec 6, 2009

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

Dear Rolf Offermanns,

Quoted 3 lines · In message <[email protected]> you wrote:

does anyone has a working SM501 framebuffer on the STK5200 board? The board itself works fine on the 2.6.32 kernel.

This is a pretty well supported configuration.

Quoted 2 lines

I got a patch from TQ which used to work around 2.6.24 but it seems with the unification of the "simple mpc5200" boards the sm501 support got lost.

Don't expect any real support from TQ on this; so far they never spent any efforts on the arch/powerpc port of the TQM5200.

Quoted 3 lines

I toyed around with the patch a bit and I got the driver to probe and initialize the chip, but I don't get an output on the crt port and an open() on /dev/fb0 or /dev/fb1 fails with "no device".

Did you check if you eventually have forgotten to enable Framebuffer console in your kernel configuration? Make sure to set:

Device Drivers --->
Character devices --->
[*] Virtual terminal
[*] Support for console on virtual terminal (NEW)

...
Multifunction device drivers --->
<*> Support for Silicon Motion SM501

...
Graphics support --->

     <*> Support for frame buffer devices  --->
       [*]   Framebuffer foreign endianness support  --->
         Choice endianness support (Support for Big- and Little-Endian framebuffers)  --->
       ...
       <*>   Silicon Motion SM501 framebuffer support

     ...
     Console display driver support  --->
       [ ] VGA text console      (! disable VGA text console!)
       <*> Framebuffer Console support

Please find attached below a patch which fixes some issues (but we don't consider it clean enough for inclusion into mainline yet), and a known to be working config file. [Kudos to Anatolij for providing this.]

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
What was sliced bread the greatest thing since?
Quoted 1 line

From e503a4524ac714f0336ab0a7c02f92ae488e4940 Mon Sep 17 00:00:00 2001

From: Anatolij Gustschin <[email protected]>
Date: Tue, 7 Oct 2009 14:45:16 +0200
Subject: [PATCH] sm501: support SM501 on TQM5200

---
 drivers/mfd/sm501.c     |   40 ++++++++++++++++++++++++++++++++++++++++
 drivers/video/sm501fb.c |   12 +++++++++++-
 2 files changed, 51 insertions(+), 1 deletions(-)
drivers/mfd/sm501.c +40 -0
index 0cc5eef..970fa89 100644
@@ -27,6 +27,13 @@
 
 #include <asm/io.h>
 
+#if defined(CONFIG_PPC_MPC52xx)
+#undef readl
+#undef writel
+#define readl(addr)		__do_readl_be((addr))
+#define writel(val, addr)	__do_writel_be((val), (addr))
+#endif
+
 struct sm501_device {
 	struct list_head		list;
 	struct platform_device		pdev;
@@ -1378,12 +1385,14 @@ static int __devinit sm501_init_dev(struct sm501_devdata *sm)
 			sm501_register_gpio(sm);
 	}
 
+#if !defined(CONFIG_PPC_MPC52xx) /* prevent crash on tqm5200 */
 	if (pdata->gpio_i2c != NULL && pdata->gpio_i2c_nr > 0) {
 		if (!sm501_gpio_isregistered(sm))
 			dev_err(sm->dev, "no gpio available for i2c gpio.\n");
 		else
 			sm501_register_gpio_i2c(sm, pdata);
 	}
+#endif
 
 	ret = sm501_check_clocks(sm);
 	if (ret) {
@@ -1417,7 +1426,9 @@ static int __devinit sm501_plat_probe(struct platform_device *dev)
 	ret = platform_get_irq(dev, 0);
 	if (ret < 0) {
 		dev_err(&dev->dev, "failed to get irq resource\n");
+#if !defined(CONFIG_PPC_MPC52xx) /* we do not need irq on tqm5200 for fbdev */
 		goto err_res;
+#endif
 	}
 	sm->irq = ret;
 
@@ -1748,8 +1759,37 @@ static struct platform_driver sm501_plat_driver = {
 	.resume		= sm501_plat_resume,
 };
 
+#if defined(CONFIG_PPC_MPC52xx)
+/* define sm501 resources on tqm5200 */
+#define SM501_FB_BASE	0xe0000000
+#define SM501_FB_SIZE	0x00800000
+#define SM501_IO_BASE	0xe3e00000
+#define SM501_IO_SIZE	0x00200000
+#define SM501_FB_END	((SM501_FB_BASE) + (SM501_FB_SIZE) - 1)
+#define SM501_IO_END	((SM501_IO_BASE) + (SM501_IO_SIZE) - 1)
+
+static struct resource sm501_device0_resources[] = {
+	[0] = {.start = SM501_FB_BASE, .end = SM501_FB_END, .flags = IORESOURCE_MEM,},
+	[1] = {.start = SM501_IO_BASE, .end = SM501_IO_END, .flags = IORESOURCE_MEM,},
+};
+
+static struct platform_device sm501_device0 = {
+	.name = "sm501",
+	.id = 0,
+	.num_resources = ARRAY_SIZE(sm501_device0_resources),
+	.resource = sm501_device0_resources,
+};
+
+static struct platform_device *sm501_mfd_devices[] __initdata = {
+	&sm501_device0,
+};
+#endif
+
 static int __init sm501_base_init(void)
 {
+#if defined(CONFIG_PPC_MPC52xx)
+	platform_add_devices(sm501_mfd_devices, ARRAY_SIZE(sm501_mfd_devices));
+#endif
 	platform_driver_register(&sm501_plat_driver);
 	return pci_register_driver(&sm501_pci_driver);
 }
drivers/video/sm501fb.c +11 -1
index 924d794..6b65ecd 100644
@@ -43,6 +43,13 @@
 
 #define NR_PALETTE	256
 
+#if defined(CONFIG_PPC_MPC52xx)
+#undef readl
+#undef writel
+#define readl(addr)		__do_readl_be((addr))
+#define writel(val, addr)	__do_writel_be((val), (addr))
+#endif
+
 enum sm501_controller {
 	HEAD_CRT	= 0,
 	HEAD_PANEL	= 1,
@@ -1487,6 +1494,9 @@ static int sm501fb_init_fb(struct fb_info *fb,
 
 	fb->fbops = &par->ops;
 	fb->flags = FBINFO_FLAG_DEFAULT |
+#if defined(CONFIG_PPC_MPC52xx)
+		FBINFO_FOREIGN_ENDIAN |
+#endif
 		FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN;
 
 	/* fixed data */
@@ -1519,7 +1529,7 @@ static int sm501fb_init_fb(struct fb_info *fb,
 			fb->var.yres_virtual = fb->var.yres;
 		} else {
 			ret = fb_find_mode(&fb->var, fb,
-					   NULL, NULL, 0, NULL, 8);
+					   "640x480@60", NULL, 0, NULL, 16);
 
 			if (ret == 0 || ret == 4) {
 				dev_err(info->dev,
Signature · 1 line
1.5.6.3
#1 lore raw

Am 04.12.2009 um 23:04 schrieb Wolfgang Denk:

Quoted 5 lines

Please find attached below a patch which fixes some issues (but we don't consider it clean enough for inclusion into mainline yet), and a known to be working config file. [Kudos to Anatolij for providing this.]
=20

Thanks Wolfgang, I will try it on monday. What needs to be done to get = this into mainline?

Modify the sm501 stuff for fdt and extend the tqm5200.dts file with the = sm501 resources?

-Rolf=

#2 lore raw

Dear Rolf Offermanns,

Quoted 6 lines · In message <[email protected]> you wrote:

Thanks Wolfgang, I will try it on monday. What needs to be done to get this into mainline?

Modify the sm501 stuff for fdt and extend the tqm5200.dts file with the sm501 resources?

Right, especially the OF bindings in the SM501 driver and the device tree entries are still missing.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
He'd been wrong, there _was_ a light at the end of the tunnel, and it
was a flamethrower.                         - Terry Pratchett, _Mort_