#
266135 |
|
15-May-2014 |
loos |
MFC r265012, r265191, r265289, r265310
r265012: Fix the gpio-specifier decoding by respecting the GPIO controller's #gpio-cells property.
Add a new ofw_bus method (OFW_BUS_MAP_GPIOS()) that allows the GPIO controller to implement its own mapping to deal with gpio-specifiers, allowing the decoding of gpio-specifiers to be controller specific.
The default ofw_bus_map_gpios() decodes the linux standard (#gpio-cells = <2>) and the FreeBSD standard (#gpio-cells = <3>).
It pass the gpio-specifier flag field to the children as an ivar variable so they can act upon.
r265191: Remove unnecessary headers. Sort out the headers. Add a missing header on ofw_gpiobus.c (it was working because of sys/libkern.h).
r265289: eally sort out the headers.
sys/systm.h must always come after sys/param.h.
Remove sys/types.h which should never be included together with sys/param.h.
Add sys/malloc.h for correctness even if it seems to don't be needed.
Remove more unused headers found by unusedinc (from bde@).
r265310: Move gpiobus routines to dev/gpio. Avoid polluting ofw_bus with bus specific parts.
|
#
266128 |
|
15-May-2014 |
ian |
MFC r261351, r261352, r261355, r261396, r261397, r261398, r261403, r261404, r261405
Open Firmware interrupt specifiers can consist of arbitrary-length byte strings and include arbitrary information (IRQ line/domain/sense). When the ofw_bus_map_intr() API was introduced, it assumed that, as on most systems, these were either 1 cell, containing an interrupt line, or 2, containing a line number plus a sense code. It turns out a non-negligible number of ARM systems use 3 (or even 4!) cells for interrupts, so make this more general.
Provide a simpler and more standards-compliant simplebus implementation to get the Routerboard 800 up and running with the vendor device tree. This does not implement some BERI-specific features (which hopefully won't be necessary soon), so move the old code to mips/beri, with a higher attach priority when built, until MIPS interrupt domain support is rearranged.
Allow nesting of simplebuses.
Add a set of helpers (ofw_bus_get_status() and ofw_bus_status_okay()) to process "status" properties of OF nodes.
Fix one remnant endian flaw in nexus.
|
#
266105 |
|
14-May-2014 |
loos |
MFC r258046, r258047, r258050, r259035, r259036, r259037, r261842, r261843, r261844, r261845, r261846, r262194, r262522, r262559
r258046: Fix a typo on a comment in ofw_bus_if.m, the default method will return -1 when a node doesn't exist.
r258047: Move the KASSERT() check to the point before the increase of number of pins.
r258050: Fix gpiobus to return BUS_PROBE_GENERIC insted of BUS_PROBE_SPECIFIC (0) so it can be overriden by its OFW/FDT version.
Give a chance for GPIO devices that implement the device_identify method to attach.
r259035: Remove unnecessary includes and an unused softc variable. While here apply two minor style(9) fixes.
r259036: Move the GPIOBUS_SET_PINFLAGS(..., ..., pin, GPIO_PIN_OUTPUT) to led(4) control callback function. This makes gpioled(4) works even if the pin is accidentally set to an input.
r259037: Fix the pin value reading on AM335x. Because of the inverted logic it was always returning '0' for all the reads, even for the outputs. It is now known to work with gpioiic(4) and gpioled(4).
r261842: Add an OFW GPIO compatible bus. This allows the use of the DTS files to describe GPIO bindings in the system.
Move the GPIOBUS lock macros to gpiobusvar.h as they are now shared between the OFW and the non OFW versions of GPIO bus.
Export gpiobus_print_pins() so it can also be used on the OFW GPIO bus.
r261843: Add OFW support to the in tree gpio compatible devices: gpioiic(4) and gpioled(4).
Tested on RPi and BBB (using the hardware I2C controller and gpioiic(4) for the I2C tests). It was also verified for regressions on RSPRO (MIPS/ar71xx) used as reference for a non OFW-based system.
Update the gpioled(4) and gpioiic(4) man pages with some details and examples about the FDT/OFW support.
Some compatibility details pointed out by imp@ will follow in subsequent commits.
r261844: Allow the use of OFW I2C bus together with iicbb(4) on OFW-based systems.
This change makes ofw_iicbus attach to iicbb(4) controllers in addition to the already supported i2c host bridges (iichb).
On iicbb(4) allow the direct access of the OFW parent node by its children, so they can be directly attached to iicbb(4) node on the DTS without the need of describing the i2c bus.
r261845: Allow the use of the OFW GPIO bus for ti_gpio and bcm2835_gpio. With this change the gpio children can be described as directly connected to the GPIO controller without the need of describing the OFW GPIO bus itself on the DTS file.
With this commit the OFW GPIO bus is fully functional on BBB and RPi.
GPIO controllers which want to use the OFW GPIO bus will need similar changes.
r261846: Make the gpioled(4) work out of the box on BBB.
Add gpioled(4) to BEAGLEBONE kernel and add the description of the four on-board leds of beaglebone-black to its DTS file.
r262194: Remove an unnecessary header.
r262522: Fix make depend for iicbus.
r262559: Inspired by r262522, fix make depend. This fixes the build of gpio modules.
|
#
265969 |
|
13-May-2014 |
ian |
MFC r256994, r257016, r257055, r257059, r257060, r257075
Add two new interfaces to ofw_bus: - ofw_bus_map_intr() Maps an (iparent, IRQ) tuple to a system-global interrupt number in some platform dependent way. This is meant to be implemented as a replacement for [FDT_]MAP_IRQ() that is an MI interface that knows about the bus hierarchy. - ofw_bus_config_intr() Configures an interrupt (previously mapped) based on firmware sense flags. This replaces manual interpretation of the sense field in bus drivers and will, in a follow-up, allow that interpretation to be redirected to the PIC drivers where it belongs. This will eventually replace the tables in /sys/dev/fdt/fdt_ARCH.c
The PowerPC/AIM code has been converted to use these globally, with an implementation in terms of MAP_IRQ() and powerpc_config_intr(), assuming OpenPIC, at the bus root in nexus(4). The ofw_bus_config_intr() will shortly be integrated into pic_if.m and bounced through nexus into the PIC tree.
Factor out MI portions of the PowerPC nexus device into /sys/dev/ofw. The sparc64 driver will be modified to use this shortly.
Allow PIC drivers to translate firmware sense codes for themselves. This is designed to replace the tables in dev/fdt/fdt_ARCH.c, but will not happen quite yet.
Do not map IRQs twice. This fixes PowerPC/FDT systems with multiple PICs, which would try to treat the previously-mapped interrupts from fdt_decode_intr() as interrupt line numbers on the same parent PIC.
Remove some of the code required for supporting ssm(4) on SPARC in favor of a more PowerPC/FDT-focused design. Whenever SPARC64 is integrated into this rework, this should be (trivially) revisited.
|
#
266135 |
|
15-May-2014 |
loos |
MFC r265012, r265191, r265289, r265310
r265012: Fix the gpio-specifier decoding by respecting the GPIO controller's #gpio-cells property.
Add a new ofw_bus method (OFW_BUS_MAP_GPIOS()) that allows the GPIO controller to implement its own mapping to deal with gpio-specifiers, allowing the decoding of gpio-specifiers to be controller specific.
The default ofw_bus_map_gpios() decodes the linux standard (#gpio-cells = <2>) and the FreeBSD standard (#gpio-cells = <3>).
It pass the gpio-specifier flag field to the children as an ivar variable so they can act upon.
r265191: Remove unnecessary headers. Sort out the headers. Add a missing header on ofw_gpiobus.c (it was working because of sys/libkern.h).
r265289: eally sort out the headers.
sys/systm.h must always come after sys/param.h.
Remove sys/types.h which should never be included together with sys/param.h.
Add sys/malloc.h for correctness even if it seems to don't be needed.
Remove more unused headers found by unusedinc (from bde@).
r265310: Move gpiobus routines to dev/gpio. Avoid polluting ofw_bus with bus specific parts.
|
#
266128 |
|
15-May-2014 |
ian |
MFC r261351, r261352, r261355, r261396, r261397, r261398, r261403, r261404, r261405
Open Firmware interrupt specifiers can consist of arbitrary-length byte strings and include arbitrary information (IRQ line/domain/sense). When the ofw_bus_map_intr() API was introduced, it assumed that, as on most systems, these were either 1 cell, containing an interrupt line, or 2, containing a line number plus a sense code. It turns out a non-negligible number of ARM systems use 3 (or even 4!) cells for interrupts, so make this more general.
Provide a simpler and more standards-compliant simplebus implementation to get the Routerboard 800 up and running with the vendor device tree. This does not implement some BERI-specific features (which hopefully won't be necessary soon), so move the old code to mips/beri, with a higher attach priority when built, until MIPS interrupt domain support is rearranged.
Allow nesting of simplebuses.
Add a set of helpers (ofw_bus_get_status() and ofw_bus_status_okay()) to process "status" properties of OF nodes.
Fix one remnant endian flaw in nexus.
|
#
266105 |
|
14-May-2014 |
loos |
MFC r258046, r258047, r258050, r259035, r259036, r259037, r261842, r261843, r261844, r261845, r261846, r262194, r262522, r262559
r258046: Fix a typo on a comment in ofw_bus_if.m, the default method will return -1 when a node doesn't exist.
r258047: Move the KASSERT() check to the point before the increase of number of pins.
r258050: Fix gpiobus to return BUS_PROBE_GENERIC insted of BUS_PROBE_SPECIFIC (0) so it can be overriden by its OFW/FDT version.
Give a chance for GPIO devices that implement the device_identify method to attach.
r259035: Remove unnecessary includes and an unused softc variable. While here apply two minor style(9) fixes.
r259036: Move the GPIOBUS_SET_PINFLAGS(..., ..., pin, GPIO_PIN_OUTPUT) to led(4) control callback function. This makes gpioled(4) works even if the pin is accidentally set to an input.
r259037: Fix the pin value reading on AM335x. Because of the inverted logic it was always returning '0' for all the reads, even for the outputs. It is now known to work with gpioiic(4) and gpioled(4).
r261842: Add an OFW GPIO compatible bus. This allows the use of the DTS files to describe GPIO bindings in the system.
Move the GPIOBUS lock macros to gpiobusvar.h as they are now shared between the OFW and the non OFW versions of GPIO bus.
Export gpiobus_print_pins() so it can also be used on the OFW GPIO bus.
r261843: Add OFW support to the in tree gpio compatible devices: gpioiic(4) and gpioled(4).
Tested on RPi and BBB (using the hardware I2C controller and gpioiic(4) for the I2C tests). It was also verified for regressions on RSPRO (MIPS/ar71xx) used as reference for a non OFW-based system.
Update the gpioled(4) and gpioiic(4) man pages with some details and examples about the FDT/OFW support.
Some compatibility details pointed out by imp@ will follow in subsequent commits.
r261844: Allow the use of OFW I2C bus together with iicbb(4) on OFW-based systems.
This change makes ofw_iicbus attach to iicbb(4) controllers in addition to the already supported i2c host bridges (iichb).
On iicbb(4) allow the direct access of the OFW parent node by its children, so they can be directly attached to iicbb(4) node on the DTS without the need of describing the i2c bus.
r261845: Allow the use of the OFW GPIO bus for ti_gpio and bcm2835_gpio. With this change the gpio children can be described as directly connected to the GPIO controller without the need of describing the OFW GPIO bus itself on the DTS file.
With this commit the OFW GPIO bus is fully functional on BBB and RPi.
GPIO controllers which want to use the OFW GPIO bus will need similar changes.
r261846: Make the gpioled(4) work out of the box on BBB.
Add gpioled(4) to BEAGLEBONE kernel and add the description of the four on-board leds of beaglebone-black to its DTS file.
r262194: Remove an unnecessary header.
r262522: Fix make depend for iicbus.
r262559: Inspired by r262522, fix make depend. This fixes the build of gpio modules.
|
#
265969 |
|
13-May-2014 |
ian |
MFC r256994, r257016, r257055, r257059, r257060, r257075
Add two new interfaces to ofw_bus: - ofw_bus_map_intr() Maps an (iparent, IRQ) tuple to a system-global interrupt number in some platform dependent way. This is meant to be implemented as a replacement for [FDT_]MAP_IRQ() that is an MI interface that knows about the bus hierarchy. - ofw_bus_config_intr() Configures an interrupt (previously mapped) based on firmware sense flags. This replaces manual interpretation of the sense field in bus drivers and will, in a follow-up, allow that interpretation to be redirected to the PIC drivers where it belongs. This will eventually replace the tables in /sys/dev/fdt/fdt_ARCH.c
The PowerPC/AIM code has been converted to use these globally, with an implementation in terms of MAP_IRQ() and powerpc_config_intr(), assuming OpenPIC, at the bus root in nexus(4). The ofw_bus_config_intr() will shortly be integrated into pic_if.m and bounced through nexus into the PIC tree.
Factor out MI portions of the PowerPC nexus device into /sys/dev/ofw. The sparc64 driver will be modified to use this shortly.
Allow PIC drivers to translate firmware sense codes for themselves. This is designed to replace the tables in dev/fdt/fdt_ARCH.c, but will not happen quite yet.
Do not map IRQs twice. This fixes PowerPC/FDT systems with multiple PICs, which would try to treat the previously-mapped interrupts from fdt_decode_intr() as interrupt line numbers on the same parent PIC.
Remove some of the code required for supporting ssm(4) on SPARC in favor of a more PowerPC/FDT-focused design. Whenever SPARC64 is integrated into this rework, this should be (trivially) revisited.
|