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

In the LDD3 book, if one driver wants to control the CPU pins, it must call a function request_region()to declare port usage.

When I want to implement a simple driver module on my Raspberry Pi, however, what I found in this example , the port request is implemented using a function gpio_request(),

Why and when do we need to use gpio_request()instead request_region()? And what are the distinctive goals for these two functions.

BTW: I searched the LDD3 page for page, but I cannot find any clues about GPIO... why there are no introductions for GPIO? Is this due to kernel version 2.6?

+4
source share
1 answer

In the LDD3 book, if one driver wants to control the contacts of the CPU, it must call the request_region () function to declare the use of ports.

Firstly, the word "port" is ambiguous and requires context. The port can refer to a physical connector (for example, a USB port) or a logical connection (for example, a TCP port).

Your understanding of request_region () is incorrect. This procedure is for managing the I / O address space. Your question is tagged with a tag raspberry-p1that uses an ARM processor and does not have an I / O address space for management. ARM processors use device registers with memory. You would use request_mem_region () in the device driver for the memory addresses of this block of peripheral registers.

GPIO . GPIO. ( , ( HW) , .. , GPIO.)

GPIO ( pin-control) request_mem_region() SoC GPIO. A gpio_request() , .

, request_mem_region() gpio_request() . , USB request_mem_region() . gpio_request() pin (s), USB- () ( , , ).

- GPIO? - 2.6?

GPIO Linux Documentation/gpio.h 2007 2.6.22. ( , ) GPIO Linux 2.6.3x (?). ( ) (, SoC) (, , ) GPIO.

LDD3 , 2.6.10. , x86- ( Linux x86 ), x86 GPIO.

+2

All Articles