reserving gpios

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi folks,

as the kernel (2.6) doesn't allow to reserve individual bits (e.g
request_mem_region), there may arise configuration problems. Especially on
systems that have GPIOs with multiple functions and where are multiple
GPIOs are configured in one byte. (e.g. NS9750)

This may be solved by reserving non-existent physical memory, e.g. in
include/asm/arch/hardware.h with
# define request_gpio( start, length, name ) \
        request_region(IO_BASE+IO_SIZE+(start),(length),(name))
# define release_gpio( start, length ) \
        release_region(IO_BASE+IO_SIZE+(start),(length))

Start and length are the GPIOs numbers and length, IO_BASE+IO_SIZE points to
empty space.

Every driver can now ensure to be the only one using the GPIO.

Does anyone has a different approach?

Bye,
--
Markus Pietrek

(Remove _nospam from email address before replying)

Re: reserving gpios
Hello Markus,


Quoted text here. Click to load it

Have you thought about the usefullness of such an approach?

In an embedded system, failure of loading a driver because of a resource
conflict is a severe error.

Having two or more drivers using the same GPIO is the same.

So IMHO there is no much value in resource management of GPIO pins,
which are normaly not sharable, but allocated to fixed hardware functions.

best regards
Wolfgang Mes
 

Re: reserving gpios
Hi Wolfgang,

Quoted text here. Click to load it

Of course, but did not make it clear in the post, sorry for that.

For an embedded application where you have configured your system it may not
be important if you know all drivers. But think of a development board
where most features are supported and the customers are playing with them.
Who can ensure that they don't have two drivers loaded that want to toggle
the same pin, one for lighting an LED, another one for doing some I2C
stuff?  The hardware must be jumpered, of course!

Quoted text here. Click to load it

But isn't it more the case for the register sets and memory region? Who
wants to use a the ethernet registers if not the ethernet driver? And only
one driver with the same name can be loaded.

Bye,
--
Markus Pietrek

(Remove _nospam from email address before replying)

Re: reserving gpios

Quoted text here. Click to load it

How does your system know about the intended use?

Quoted text here. Click to load it

And how do you learn about the current jumper settings?

Quoted text here. Click to load it

So what? Either you don't use Ethernet, so nobody uses  the  ethernet
registers and parameter ram, or you do use ethernet, and the ethernet
driver will use this resource. Where is the problem?

Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88   Web: www.denx.de
We've slightly trimmed the long signature. Click to see the full one.

Site Timeline