public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Althoefer <stefan.althoefer@web.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] video: Add new driver for Silicon Motion SM501/SM502 Part 1/2
Date: Sat, 06 Dec 2008 23:35:04 +0100	[thread overview]
Message-ID: <gheulf$eio$1@ger.gmane.org> (raw)
In-Reply-To: <493AD29C.80409@denx.de>

Hi Anatolij,

<snip>

>> Use CONFIG_VIDEO_SM501NEW to enable the driver.
> 
> not sure if CONFIG_VIDEO_SM501NEW is a good chose here. Maybe
> we should use s.th. like CONFIG_VIDEO_SM50x. This applies to
> the file names too: sm50x.h, sm50x.c, etc. Even better would
> be a merge with the existing driver.

The CONFIG_VIDEO_SM501 driver is completely differently configured
(boards supply tables with register settings). This will be very
hard to merge. SM50x might be a better name, but is it good style
to mix lowercase and uppercase letters in macro name?

<snip>

>> +#define SM501FB_FLAG_USE_INIT_MODE	(1<<0)
>> +#define SM501FB_FLAG_DISABLE_AT_EXIT	(1<<1)
>> +#define SM501FB_FLAG_USE_HWCURSOR	(1<<2)
>> +#define SM501FB_FLAG_USE_HWACCEL	(1<<3)
>> +
>> +struct sm501_platdata_fbsub {
>> +	struct fb_videomode	*def_mode;
>> +	unsigned int		 def_bpp;
>> +	unsigned long		 max_mem;
>> +	unsigned int		 flags;
>> +};
>> +
>> +enum sm501_fb_routing {
>> +	SM501_FB_OWN		= 0,	/* CRT=>CRT, Panel=>Panel */
>> +	SM501_FB_CRT_PANEL	= 1,	/* Panel=>CRT, Panel=>Panel */
>> +};
>> +
>> +/* sm501_platdata_fb flag field bit definitions */
>> +
>> +#define SM501_FBPD_SWAP_FB_ENDIAN	(1<<0)	/* need to endian swap */
>> +
>> +/* sm501_platdata_fb
>> + *
>> + * configuration data for the framebuffer driver
>> +*/
>> +
>> +struct sm501_platdata_fb {
>> +	enum sm501_fb_routing		 fb_route;
>> +	unsigned int			 flags;
>> +	struct sm501_platdata_fbsub	*fb_crt;
>> +	struct sm501_platdata_fbsub	*fb_pnl;
>> +};
>> +
>> +/* gpio i2c */
>> +
>> +struct sm501_platdata_gpio_i2c {
>> +	unsigned int		pin_sda;
>> +	unsigned int		pin_scl;
>> +};
> 
> all this stuff above starting from
> "#define SM501FB_FLAG_USE_INIT_MODE"
> can be removed if you remove "init_gpiop", "fb", "gpio_i2c" and
> "gpio_i2c_nr" from the "struct sm501_platdata" definition below.
> Also remove ".fb = &sm501_fb_pdata" from "sm501_pci_platdata"
> declaration in drivers/video/sm501new.c. These structure members
> aren't referenced in this U-Boot driver, so they aren't needed
> (unused and nearly dead code and data).
> 
> <snip>
>> +#define SM501_USE_USB_HOST	(1<<0)
>> +#define SM501_USE_USB_SLAVE	(1<<1)
>> +#define SM501_USE_SSP0		(1<<2)
>> +#define SM501_USE_SSP1		(1<<3)
>> +#define SM501_USE_UART0		(1<<4)
>> +#define SM501_USE_UART1		(1<<5)
>> +#define SM501_USE_FBACCEL	(1<<6)
>> +#define SM501_USE_AC97		(1<<7)
>> +#define SM501_USE_I2S		(1<<8)
> 
> These macros aren't used, remove them too.
> 
>> +
>> +#define SM501_USE_ALL		(0xffffffff)
>> +
>> +struct sm501_initdata {
>> +	struct sm501_reg_init	gpio_low;
>> +	struct sm501_reg_init	gpio_high;
>> +	struct sm501_reg_init	misc_timing;
>> +	struct sm501_reg_init	misc_control;
>> +
>> +	unsigned long		devices;
> 
> "devices" member is only initialized in "sm501_pci_initdata"
> declaration and isn't referenced anywhere in the code, so
> another candidate to remove.
> 
>> +/* sm501_platdata
>> + *
>> + * This is passed with the platform device to allow the board
>> + * to control the behaviour of the SM501 driver(s) which attach
>> + * to the device.
>> + *
>> +*/
>> +
>> +struct sm501_platdata {
>> +	struct sm501_initdata		*init;
>> +	struct sm501_init_gpio		*init_gpiop;
>> +	struct sm501_platdata_fb	*fb;
>> +
>> +	struct sm501_platdata_gpio_i2c	*gpio_i2c;
>> +	unsigned int			 gpio_i2c_nr;
> 
> see above suggestion to remove init_gpiop, fb, gpio_i2c and
> gpio_i2c_nr.
> 
> 
>> diff -uprN u-boot-orig//drivers/video/sm501new-regs.h u-boot/drivers/video/sm501new-regs.h
>> --- u-boot-orig//drivers/video/sm501new-regs.h	1970-01-01 01:00:00.000000000 +0100
>> +++ u-boot/drivers/video/sm501new-regs.h	2008-12-02 18:28:42.000000000 +0100
>> @@ -0,0 +1,365 @@
>> +/* sm501-regs.h
>> + *
>> + * Copyright 2006 Simtec Electronics
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> + *
>> + * Silicon Motion SM501 register definitions
>> +*/
> 
> please, fix multi-line comment style.
> 
> Also check all below defined macros in this file. If some
> macro isn't used in the driver code, then remove it.
> 
>> +/* System Configuration area */
>> +/* System config base */
>> +#define SM501_SYS_CONFIG		(0x000000)
>> +
>> +/* config 1 */
>> +#define SM501_SYSTEM_CONTROL 		(0x000000)
>> +#define SM501_MISC_CONTROL		(0x000004)
>> +
>> +#define SM501_MISC_BUS_SH		(0x0)
>> +#define SM501_MISC_BUS_PCI		(0x1)
>> +#define SM501_MISC_BUS_XSCALE		(0x2)
>> +#define SM501_MISC_BUS_NEC		(0x6)
>> +#define SM501_MISC_BUS_MASK		(0x7)
> <snip>

I agree in removing dead code and structure components that will
never make sense in u-boot environment. However, should I really
delete definitions form -regs.h? This is well developed (linux)
and things might be needed for future development. I did not
touch this file compared to kernel source.

- Stefan

  reply	other threads:[~2008-12-06 22:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-04 21:10 [U-Boot] [PATCH] video: Add new driver for Silicon Motion SM501/SM502 Part 1/2 Stefan Althoefer
2008-12-06 19:29 ` Anatolij Gustschin
2008-12-06 22:35   ` Stefan Althoefer [this message]
2008-12-07  0:47   ` Wolfgang Denk
2008-12-07  6:33     ` ksi at koi8.net
2008-12-07  9:44       ` Wolfgang Denk
2008-12-07 18:19         ` ksi at koi8.net
2008-12-07 21:23           ` Wolfgang Denk
2008-12-07 22:21             ` ksi at koi8.net
2008-12-07 10:07     ` Stefan Althoefer
2008-12-08 13:03       ` Anatolij Gustschin

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='gheulf$eio$1@ger.gmane.org' \
    --to=stefan.althoefer@web.de \
    --cc=u-boot@lists.denx.de \
    /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