[U-Boot] [PATCH] video: Add new driver for Silicon Motion SM501/SM502 Part 1/2

ksi at koi8.net
2008-12-07T06:33:35Z

On Sun, 7 Dec 2008, Wolfgang Denk wrote:

> Dear Anatolij & Stefan,
>
> In message <493AD29C.80409@denx.de> you wrote:
>>
>>> 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.
>
> I agree with Anatolij here. A merge would definitely be best.

We are about to build our first prototype for MPC8548E based motherboard and
I also have SM502 on it. It is very good that there is somebody else working
on it and I want to take part in the process.

As for the SM502, it is a multi-function chip that has more than just video.
I'm writing an I2C driver for it right now and I want to ask you guys for
your opinion.

MPC8548 has _TWO_ I2C controllers and it is taken care of in fsl_i2c.c by
defining a "bus number." There is a function that one uses to set a bus for
consecutive operations with i2c_read() and friends (they do NOT take a bus
number as a parameter.) That means one sets a bus and then all the
operations are done on that bus until it is changed again.

This might be OK but it is definitely not portable and SOC-specific. In my
case I have a _THIRD_ I2C bus off of SM502... What do you think would be a
best approach to address this:

a.) Rewrite _ALL_ I2C code to make those i2c_read() etc. functions to take
an additional parameter, bus number

b.) Make a global var i2c_bus or something and add a global function kinda
i2c_set_bus() so all i2c_read()/i2c_write() functions use that variable

c.) Add a third bus for SM502 I2C adapter to fsl_i2c.c (horrible hack)

d.) Make SM502 I2C a totally separate entity with its own set of functions
(like sm502_i2c_read() etc.)

Please tell what you think. I personally lean towards option b.) but I might
be wrong :)

And there is another useful part of SM502 that's begging for implementation
-- USB controller with legacy KBD/Mouse support...

---
******************************************************************
* KSI at home KOI8 Net < > The impossible we do immediately. *
* Las Vegas NV, USA < > Miracles require 24-hour notice. *
******************************************************************