10-23-2018, 03:18 PM
So, just a rundown of steps that I need to perform in order to do mmap operations on GPIO for Rock64:
1. Select which GPIO pin I want to use (I need a full name, like GPIO3_A4)
2. Look up 18.5 "GPIO interface description" for which IOMUX bit I'll need to set (In case of GPIO3_A4 - GRF_GPIO3AL_IOMUX)
3. Look that IOMUX in 3.3.3 "Detail Register Description" and GPIO3A[4] for details of which bit to set.
4.Mmap to GRF memory (I can get offset from TPM Memory Mapping section, so address is probably FF10_0000, 64K of memory)
5. Offset to memory of that IOMUX, setup IOMUX to allow writes to bits 14:12 (bits specific to GPIO3A[4])
6. Write 000 to 14:12 to set up GPIO3A[4] to be accessible for GPIO operations
7. Get the offset of GPIO bank I'm about to use (TPM Memory Mapping section, in case of GPIO3 it's probably FF24_0000, 64K of memory)
And then the last part I'm not really sure about is where exactly do I set direction and get/set value of that pin, but it has probably to do with section 18.5.
Anyone willing to tell me I'm on the right track?
1. Select which GPIO pin I want to use (I need a full name, like GPIO3_A4)
2. Look up 18.5 "GPIO interface description" for which IOMUX bit I'll need to set (In case of GPIO3_A4 - GRF_GPIO3AL_IOMUX)
3. Look that IOMUX in 3.3.3 "Detail Register Description" and GPIO3A[4] for details of which bit to set.
4.Mmap to GRF memory (I can get offset from TPM Memory Mapping section, so address is probably FF10_0000, 64K of memory)
5. Offset to memory of that IOMUX, setup IOMUX to allow writes to bits 14:12 (bits specific to GPIO3A[4])
6. Write 000 to 14:12 to set up GPIO3A[4] to be accessible for GPIO operations
7. Get the offset of GPIO bank I'm about to use (TPM Memory Mapping section, in case of GPIO3 it's probably FF24_0000, 64K of memory)
And then the last part I'm not really sure about is where exactly do I set direction and get/set value of that pin, but it has probably to do with section 18.5.
Anyone willing to tell me I'm on the right track?