Trouble porting linux driver to DDE Kit

Norman Feske norman.feske at ...1...
Thu Oct 25 19:15:50 CEST 2012


Hi Alexander,

> For now, I'll keep working on our other projects (that includes rebasing
> and upstreaming our drivers and writing more omap4 support).

that sounds excellent!

> One interesting question is how
> to handle gpio mux for various SoC. I mean, alternate pin functions.
> Ideally, we should be able to set up all the hardware from Genode, and most
> SoCs have
> their GPIO pins multiplexed to multiple functions. Probably the
> easiest thing is to use strings for pin names, or just integers?
> Like, "Gpio.set_mux(unsigned pin, string &name)"
> vs "Gpio.set_mux(unsigned pin, unsigned af)"

I am not sure that I fully comprehend the issue. The gpio driver just
takes physical pins as arguments. But the meaning of the pins depends on
the platform. So you'd like to use names instead of physical pin numbers
in order to map the meaning of pins to physical pins? Just for the sake
of an example, on one platform the 'hdmi_detect' signal is connected to
gpio 17, and on another platform, the signal is connected to gpio 43.
You'd like the HDMI driver to just specify 'hdmi_detect' as argument to
the gpio driver instead of 17 or respectively 43?

I think, the mapping of names to physical resources (be it pins,
physical addresses, or irqs) should have the form of enum values (or
constants) in platform-specific header files (such as those files
located at 'os/include/platform'. For example, the 'pl011_defs.h' file
contains physical properties of the pl011 UART. There exists a file for
the pbxa9 platform but also for vea9x4 platform. Depending on the
platform of the build directory, either the 'include/platform/pbxa9' or
'include/platform/vea9x4' gets added to the include-search path. So the
pl011 driver can always refer to the named enum values.

When going back to the HDMI driver example, there would be a
'include/platform/<platform-name>/hdmi_defs.h' file for each platform
that has HDMI. On one platform this file may contain the line

  enum { HDMI_DETECT_GPIO = 17 };

and for the other platform, the file would contain the line

  enum { HDMI_DETECT_GPIO = 43 };

The HDMI driver would just include 'hdmi_defs.h' and will call the gpio
driver with the named enum value 'HDMI_DETECT_GPIO' as argument.

I sincerely hope that I haven't missed the point of your question. I so,
please get me on track. ;-)

Cheers
Norman

-- 
Dr.-Ing. Norman Feske
Genode Labs

http://www.genode-labs.com · http://genode.org

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth




More information about the users mailing list