History log of /freebsd-10-stable/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
Revision Date Author Comments
# 322724 20-Aug-2017 marius

MFC: r266470, r273546, r276017, r277932, r279153, r279778, r279780, r278797,
r278861, r280283, r280284, r280294, r280452, r280558, r280571, r281863,
r282049, r282357, r282440, r282441, r282358, r282359, r283550, r283918,
r290171, r290667, r290381, r290533, r290666, r292483, r295659, r297545,
r298305, r298383, r298428, r306489, r306557, r307067, r307068, r307087,
r307088, r307089, r307091, r307092, r307093, r307098, r307115, r307154,
r307240, r307241, r315967, r316476

Unbreak BCM2835/RPI-B support by bringing it in line with stable/11 and
head:

- Optimise reading of pending interrupt registers.

- Fix a bug where some DTS layouts could cause the premature ending of the
search (i.e. without returning any result) and you would end up with a
random MAC address.

- Reduce the diff between head and arm_intrng with the bcm2835 interrupt
controller.

- Allow the retrieving of the reserved pins state.

- Add support to the bcm2835 mailbox driver to work before interrupts are
enabled. This will be needed to enable the power on devices early on in the
boot process.

- Add support for enabling the USB on the Raspberry Pi boards when it hasn't
been done by U-Boot. This allows the USB to work when we load the kernel
directly.

- Call config_intrhook_disestablish on failure of the bcm2835 fb and fbd intr
hooks. With this we can get through the boot even if these functions fail.

- Add the structures needed to get/set the power state. These can be used
when, for example, we boot without U-Boot and wish to enable USB, or to
suspend an unneeded device.

- Add a mask to match only the relative base address of BSC controllers.

- Move the code to set the device power to the bcm2835 mailbox driver so it
can be reused by other drivers.

- Add the SOC_BCM2835 and SOC_BCM2836 options for the arm kernel and add the
former to std.bcm2835.

- Add a helper function to read clock frequencies from videocore and use this
to get the default frequency of the sdhci device.

- Add partial support for the Raspberry Pi 2.

- Remove a debug #error from the bcm2835 sdhci driver.

- Fetch the SDHCI frequency from videocore (our prefered source) and only if
it fails, fetch the clock-frequency from DTB. If both methods fail, use the
hardcoded default.

- Pass the supplied buffer length instead of a fixed size.

- Add the routines to query and setup the framebuffer state using the
BCM2835_MBOX_CHAN_PROP channel. The old channel (BCM2835_MBOX_CHAN_FB)
seems deprecated on recent firmware versions and is causing a freeze on
RPi 2.

- Fix DMA on RPi 2. BCM2836 has a different base address for peripherals.

- Enable DMA for sdhci on RPi 2 (BCM2836).

- Add a missing wakeup when releasing ownership of the SPI hardware.

- Fix framebuffer compatibility with new RPi firmware.

- Refactor bcm2835_cpufreq to use bcm2835_mbox_property API.

- Fix the sc(4) framebuffer driver on RPi 2.

- Fix the vt(4) framebuffer driver on RPi 2.

- Remove unused mutex and softc variables.

- Refactor mailbox property API to make it usable for /dev/vcio driver.

- Replace semaphore-base locking with sleep/wait synchronization.

- Fix infinite loop if response from VideoCore never received.

- Set have_message in interrupt to handle "response before READ" case.

- Serialize access to property channel when using bcm2835_mbox_property.

- Force framebuffer virtual viewport to be the same as physical.

- Use proper type of tag in bcm2835_mbox_fb_init.

- bcm2835_cpufreq: Only attach driver if we correcly match on the machine
compatible string.

- Add dev.fb.X.resync sysctl to resync ARM framebuffer with VideoCore.

- Do not use DMA channels used by GPU.

- Define local-intc for BCM2836 platform (RPI2) and make BCM2835 intc
a child of it.

- Fix build for Pi kernels with syscons enabled.

- Use VM_MEMATTR_WRITE_COMBINING memattr for mmap(2) on framebuffer.

- Make intc driver compatible with upstream DTS.

- Make Rapsberry Pi watchdog driver compatible with upstream DTS.

- Make sure intc is attached before interrupt consumers.

- Make framebuffer driver compatible with upstream DT.

- Add one more heuristic to determine MAC address of the SMSC device.

- Add compatibility strings from upstream DT.

- Fix spelling mistake, BCM2835_PASWORD -> BCM2835_PASSWORD.

Approved by: re (kib)


# 278786 14-Feb-2015 loos

MFC r274670, r274671, r276168:

Moves all the duplicate code to a single function.

Verify for invalid modes and unwanted flags before pass the new flags to
driver.

Make gpio_default_map_gpios() static. No functional changes.

Improves the GPIO API description a little bit.

gpio_pin_max must return the maximum supported pin number and not the total
number of pins on the system.


# 278782 14-Feb-2015 loos

MFC r273799:

Make the GPIO children attach to the first unit available and not only to
unit 0.

This fix a bug where a GPIO controller could fail to attach its children
(gpioc and gpiobus) if another GPIO driver attach first.


# 266164 15-May-2014 loos

MFC r256871, r259034, r266010

r256871:
Implement watchdog function and register it with watchdog list.

r259034:
Make the sysctl node read-only.

r266010:
Remove extra newlines.
No functional changes.


# 266152 15-May-2014 ian

MFC r261410

Follow r261352 by updating all drivers which are children of simplebus
to check the status property in their probe routines.


# 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.


# 261077 23-Jan-2014 loos

MFC r257127:

Remove all the instances of '#undef DEBUG' from kernel.

Suggested by: rpaulo
Approved by: adrian (mentor)


# 259329 13-Dec-2013 ian

MFC r257199, r257200, r257217:

Remove all #include <machine/pmap.h> from arm code. It's already
included by vm/pmap.h, which is a prerequisite for arm/machine/pmap.h
so there's no reason to ever include it directly.

Remove #include <machine/frame.h> from all the arm code that doesn't
really need it. That would be almost everywhere it was included. Add
it in a couple files that really do need it and were previously getting
it by accident via another header.

Remove the last dregs of trapframe_t. It turns out only arm was using
this type, so remove it to make arm code more consistant with other
platforms.


# 278786 14-Feb-2015 loos

MFC r274670, r274671, r276168:

Moves all the duplicate code to a single function.

Verify for invalid modes and unwanted flags before pass the new flags to
driver.

Make gpio_default_map_gpios() static. No functional changes.

Improves the GPIO API description a little bit.

gpio_pin_max must return the maximum supported pin number and not the total
number of pins on the system.


# 278782 14-Feb-2015 loos

MFC r273799:

Make the GPIO children attach to the first unit available and not only to
unit 0.

This fix a bug where a GPIO controller could fail to attach its children
(gpioc and gpiobus) if another GPIO driver attach first.


# 266164 15-May-2014 loos

MFC r256871, r259034, r266010

r256871:
Implement watchdog function and register it with watchdog list.

r259034:
Make the sysctl node read-only.

r266010:
Remove extra newlines.
No functional changes.


# 266152 15-May-2014 ian

MFC r261410

Follow r261352 by updating all drivers which are children of simplebus
to check the status property in their probe routines.


# 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.


# 261077 23-Jan-2014 loos

MFC r257127:

Remove all the instances of '#undef DEBUG' from kernel.

Suggested by: rpaulo
Approved by: adrian (mentor)


# 259329 13-Dec-2013 ian

MFC r257199, r257200, r257217:

Remove all #include <machine/pmap.h> from arm code. It's already
included by vm/pmap.h, which is a prerequisite for arm/machine/pmap.h
so there's no reason to ever include it directly.

Remove #include <machine/frame.h> from all the arm code that doesn't
really need it. That would be almost everywhere it was included. Add
it in a couple files that really do need it and were previously getting
it by accident via another header.

Remove the last dregs of trapframe_t. It turns out only arm was using
this type, so remove it to make arm code more consistant with other
platforms.