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

Wolfgang Denk
2008-12-07T09:44:05Z

Dear ksi at koi8.net,

In message <Pine.LNX.4.64ksi.0812062213500.4343@home-gw.koi8.net> you wrote:
>
> 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.

That's not new - the SM501 is pretty similar.

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

That's the general idea, also for example for device handling: we set
a current device (or bus) with one command, and then continue to use
that.

> This might be OK but it is definitely not portable and SOC-specific. In my

I think the "this" here refers to the specific implementation, not the
general approach, right?

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

I agree.

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

Feel free to submit patches :-)

Best regards,

Wolfgang Denk

--
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: wd at denx.de
You're too beautiful to ignore. Too much woman.
-- Kirk to Yeoman Rand, "The Enemy Within", stardate unknown