linux - Why there is `gpio_request` instead of `request_region` in raspberry pi driver? -


in book ldd3, if 1 driver want control pins of cpu, should call request_region() function declare usage of ports.

when want implement simple driver module on raspberry pi, however, found in this example request of ports implemented gpio_request() function.

why , when need use gpio_request() instead of request_region()? and, what's difference purposes these 2 functions.

btw: searched ldd3 page page can't find clues gpio... why there no introductions gpio? because of 2.6 kernel version?

in book ldd3, if 1 driver want control pins of cpu, should call request_region() function declare usage of ports.

first, word "port" ambiguous , requires context. port can refer physical connector (e.g. usb port), or logical connection (e.g. tcp port).

your understanding of request_region() flawed. routine management of i/o address space. question tagged raspberry-p1 uses arm processor , has no i/o address space manage. arm processors use memory-mapped device registers. use request_mem_region() in device driver memory addresses of peripheral's register block.

each gpio controlled bit position in 1 or more control registers. registers handled overall gpio subsystem. (there's lower-layer (closer hw) pin-control driver multiplexed pins, i.e. pins can assigned peripheral device or used gpio.)

the driver gpio (or pin-control) subsystem should perform request_mem_region() memory addresses of soc's gpio control registers. gpio_request() management of individual pin subordinate management of registers.

note use of request_mem_region() , gpio_request() not mutually exclusive in device driver. instance driver usb controller request_mem_region() memory addresses control registers. may have gpio_request() pin(s) control power usb connector(s) (assuming that's how power controlled logic external controller).

why there no introductions gpio? because of 2.6 kernel version?

conventions using gpio in linux appeared in documentation/gpio.h in 2007 version 2.6.22. generic (i.e. standardized rather platform specific) gpio support appeared in linux kernel several years later version 2.6.3x(?). prior (and after) each platform (e.g. soc manufacturer) had own set of routines accessing (and maybe managing) gpios.

ldd3 claims current of 2.6.10 kernel. book may x86-centric (as linux has x86 origins), , x86 processors typically not have gpios.


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -