On 8/1/2016 1:25 PM, John Kasunich wrote:
Is it device tree that determines whether pins are used for MMC or GPIO, etc?
Not exactly. Ultimately, it is the pinmux control register in the chip
that sets the pin mode. This is typically controlled by the kernel's
pinmux driver via device-tree entries, but can also be subjected to
'tricks', like I do with the universal cape overlay (I craft several
useful pin modes then export them using the pinmux-helper module so
pinmux control can happen at run-time in user space, but it's still the
kernel's pinmux driver that does the low-level writes to the physical
pinmux registers). It's also possible to circumvent the kernel entirely
and do things like setup the pinmux values via PRU initiated writes.
Seems like in the ideal world the "claimed" field in the bb_gpio_pin
structures would be set using data from device tree, so that if the MMC
is enabled you can't tell the HAL driver to use that pin.
As written, it looks like the only thing the "claimed" field does is keeps
you from using the same pin as a HAL input and HAL output at the
same time. It does nothing to convey "claims" on the pin by other
things like the MMC.
I guess I want to learn more about device tree.
The device tree is basically an *.ini file, just with a bit more
structure. It is a way to get pieces of key/value data from a
configuration file into the kernel code. Any meaning of the values in
the device-tree is provided by the kernel module code that looks at it.
And similar to an *.ini file, there are several ways to create
hard-to-find bugs (like subtle misspelling of a keyword) that are
difficult to fully check for when editing the dts file or creating the
binary dtbo.
--
Charles Steinkuehler
[email protected]
--
website: http://www.machinekit.io blog: http://blog.machinekit.io github:
https://github.com/machinekit
---
You received this message because you are subscribed to the Google Groups "Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.