Skip to content

Change use of /dev/mem to /dev/gpiomem#25

Open
MikeDK wants to merge 8 commits intoWallaceIT:masterfrom
MikeDK:master
Open

Change use of /dev/mem to /dev/gpiomem#25
MikeDK wants to merge 8 commits intoWallaceIT:masterfrom
MikeDK:master

Conversation

@MikeDK
Copy link
Contributor

@MikeDK MikeDK commented Nov 18, 2024

If we use /dev/gpiomem instead of /dev/mem, we have some benefits...:

  • /dev/gpiomem can be accessed by users of group "gpio" - so no root access required any more!
  • the GPIO_BASE macro is not needed any more ... so theoretically we would not need any difference between raspberry pi 1, 2 and 4 - they could use one single .h file and only one build target is needed for raspberries
  • in 64bit kernels there is a kernel config option which prohibits userspace access to /dev/mem ... this is enabled in nearly every recent OS, so one would have to pass kernel options to disable this behaviour .... but because we use gpiomem now, this is not needed!

Compiling for all build configs, but I have only tested the raspberrypi4 one

…rks, and we also do not need root access anymore because /dev/gpiomem access is permitted to group gpio members
@MikeDK
Copy link
Contributor Author

MikeDK commented Nov 18, 2024

added another commit which removes the unnecessary build configs and .h files ... there is now only one "raspberrypi" build target

@Grix
Copy link

Grix commented Nov 20, 2024

This is not universally supported, not all host boards have a gpiomem driver. So at the very least this change should be optional behind a flag, not changed outright.

@MikeDK
Copy link
Contributor Author

MikeDK commented Nov 20, 2024

Ok you're right ... I will add a flag to the raspberrypi.h file and restore the stuff to the a10 and am335x

@MikeDK
Copy link
Contributor Author

MikeDK commented Nov 20, 2024

done adding a flag for /dev/gpiomem usage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants