reserving gpios

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)
Reply to
Markus Pietrek
Loading thread data ...

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 Mües

Reply to
Wolfgang Mües

Hi Wolfgang,

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!

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)
Reply to
Markus Pietrek

How does your system know about the intended use?

And how do you learn about the current jumper settings?

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
All I ask is a chance to prove that money can't make me happy.
Reply to
Wolfgang Denk

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.