History log of /freebsd-11.0-release/sys/dev/gpio/gpiobus.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 303975 11-Aug-2016 gjb

Copy stable/11@r303970 to releng/11.0 as part of the 11.0-RELEASE
cycle.

Prune svn:mergeinfo from the new branch, and rename it to RC1.

Update __FreeBSD_version.

Use the quarterly branch for the default FreeBSD.conf pkg(8) repo and
the dvd1.iso packages population.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 302408 08-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 301539 07-Jun-2016 mmel

INTRNG: As follow up of r301451, implement mapping and configuration
of gpio pin interrupts by new way.

Note: This removes last consumer of intr_ddata machinery and we remove it
in separate commit.


# 300871 27-May-2016 ian

Don't wrap the declaration of gpio_alloc_intr_resource() in #ifdef INTRNG,
wrap the implementation so that it returns an error if INTRNG support is
not available. It should be possible to write a non-INTRNG implementation
of this function some day. In the meantime, there is code that contains
calls to this function (so the decl is needed), but have runtime checks to
avoid calling it in the non-INTRNG case.


# 300750 26-May-2016 ian

Rename gpiobus_map_pin() to gpiobus_acquire_pin(), to better reflect the
fact that the caller is requesting exclusive use of the pin, and also to
better match the inverse operation which is named gpiobus_release_pin().


# 299563 12-May-2016 gonzo

Add gpiobus_release_pin function to release mapped pin

Add gpiobus_release_pin as a counterpart for gpiobus_map_pin. Without it
it's impossible to properly release pin so if kernel module is reloaded
it can't re-use pins again


# 298739 28-Apr-2016 mmel

INTRNG: Define 'INTR_IRQ_INVALID' constant and use it consistently
as error indicator.


# 298738 28-Apr-2016 mmel

GPIO: Add support for gpio pin interrupts.
Add new function gpio_alloc_intr_resource(), which allows an allocation
of interrupt resource associated to given gpio pin. It also allows to
specify interrupt configuration.

Note: This functionality is dependent on INTRNG, and must be
implemented in each GPIO controller.


# 297199 22-Mar-2016 jhibbits

Fix the resource_list_print_type() calls to use uintmax_t.

Missed a bunch from r297000.


# 295832 20-Feb-2016 jhibbits

Introduce a RMAN_IS_DEFAULT_RANGE() macro, and use it.

This simplifies checking for default resource range for bus_alloc_resource(),
and improves readability.

This is part of, and related to, the migration of rman_res_t from u_long to
uintmax_t.

Discussed with: jhb
Suggested by: marcel


# 294883 27-Jan-2016 jhibbits

Convert rman to use rman_res_t instead of u_long

Summary:
Migrate to using the semi-opaque type rman_res_t to specify rman resources. For
now, this is still compatible with u_long.

This is step one in migrating rman to use uintmax_t for resources instead of
u_long.

Going forward, this could feasibly be used to specify architecture-specific
definitions of resource ranges, rather than baking a specific integer type into
the API.

This change has been broken out to facilitate MFC'ing drivers back to 10 without
breaking ABI.

Reviewed By: jhb
Sponsored by: Alex Perez/Inertial Computing
Differential Revision: https://reviews.freebsd.org/D5075


# 293872 14-Jan-2016 adrian

[gpiobus] handle the case of there being a single GPIO pin available.

PR: kern/206035
Submitted by: Stanislav Galabov <sgalabov@gmail.com>


# 286909 18-Aug-2015 loos

Fix the use of plural in two cases that I missed on r285784.

This should cause no functional change.


# 286845 17-Aug-2015 loos

Fix a few bugs when gpiobus is detaching:

- Detach the gpiobus and the gpioc devices from the GPIO controller.

- Fix the leak of gpiobus IRQ rman(9) region descriptor.

- Fix the leak of child ivars and IRQ resource list.

While here return NULL (instead of 0) for a device_t that fails to allocate
the ivar memory.

Tested with gpiobus built as a module.

Sponsored by: Rubicon Communications (Netgate)


# 285833 24-Jul-2015 imp

Panic when a device is trying to recursively acquire rather than hang
indefinitely. Improve error messages from other panics.


# 285784 22-Jul-2015 loos

Cosmetic change. When printing the child's mapped pins, use the plural
only when necessary.

Reported by: Daniel O'Connor <darius@dons.net.au>,
Sulev-Madis Silber (ketas)


# 279761 08-Mar-2015 loos

Add a new ioctl to allow the setting of GPIO pin names.

When a gpiobus child is added, use its name to identify the mapped pin
names.

Make the respective changes to libgpio.

Add a new '-n' flag to gpioctl(8) to set the pin name.

Differential Revision: https://reviews.freebsd.org/D2002
Reviewed by: rpaulo
Requested by: many


# 279622 05-Mar-2015 loos

Use the child device name here is lame because at the point that this
happens, the child device is not yet specified.


# 279620 05-Mar-2015 loos

Add a bus_probe_nomatch() method for gpiobus/ofw_gpiobus.

This prints a warning when your system have a hinted child or a FDT child
node for which you don't have a matching driver:

gpiobus0: <unknown device> at pin(s) 24 irq 24


# 279553 02-Mar-2015 loos

Move duplicate code to a new public function.

This new function can be used by other drivers to reserve the use of GPIO
pins.

Anyway, the use of ofw_gpiobus_parse_gpios() is preferred when possible.

Requested by: Michal Meloun


# 279402 28-Feb-2015 loos

Rename and move gpiobus_alloc_ivars() and gpiobus_free_ivars() so they can
be used on non FDT systems.

This prevents access to uninitialized memory on drivers that try to access
pin flags on non FDT systems.


# 278108 02-Feb-2015 loos

Register the GPIO controller device reference on xref table for FDT systems.


# 277996 31-Jan-2015 loos

Implement GPIO_GET_BUS() method for all GPIO drivers.

Add helper routines to deal with attach and detach of gpiobus and gpioc
devices that are common to all drivers.


# 274670 18-Nov-2014 loos

Moves all the duplicate code to a single function.

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


# 274643 18-Nov-2014 loos

Fix gpiobus_child_location_str() to return a real string with the mapped
pins.

Make gpiobus_print_pins() static again.


# 274638 18-Nov-2014 loos

Add basic interrupt management code to gpiobus and ofw_gpiobus.

This is the general support to allow the use of GPIO pins as interrupt
sources for direct gpiobus children.

The use of GPIO pins as generic interrupt sources (for an ethernet driver
for example) will only be possible when arm/intrng is complete. Then, most
of this code will need to be rewritten, but it works for now, is better
than what we have and will allow further developments.

Tested on: ar71xx (RSPRO), am335x (BBB), bcm2835 (Raspberry pi)
Differential Revision: https://reviews.freebsd.org/D999
Reviewed by: rpaulo


# 273917 31-Oct-2014 loos

Fix the gpiobus locking by using a more sane model where it isn't necessary
hold the gpiobus lock between the gpio calls.

gpiobus_acquire_lock() now accepts a third parameter which tells gpiobus
what to do when the bus is already busy.

When GPIOBUS_WAIT wait is used, the calling thread will be put to sleep
until the bus became free.

With GPIOBUS_DONTWAIT the calling thread will receive EWOULDBLOCK right
away and then it can act upon.

This fixes the gpioiic(4) locking issues that arises when doing multiple
concurrent access on the bus.


# 273569 23-Oct-2014 loos

Move the duplicated code to a single function.

No functional changes.


# 265310 04-May-2014 loos

Move gpiobus routines to dev/gpio. Avoid polluting ofw_bus with bus
specific parts.

Requested by: nwhitehorn


# 265289 03-May-2014 loos

Really 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@) and tested with a
universe build.

Reported by: bde


# 265191 01-May-2014 loos

Remove unnecessary headers. Sort out the headers. Add a missing header on
ofw_gpiobus.c (it was working because of sys/libkern.h).


# 261842 13-Feb-2014 loos

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.

Approved by: adrian (mentor, implicit)


# 258050 12-Nov-2013 loos

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.

Approved by: adrian (mentor)


# 258047 12-Nov-2013 loos

Move the KASSERT() check to the point before the increase of number of pins.

Approved by: adrian (mentor)


# 255254 05-Sep-2013 sbruno

Minor printf nit to keep out clean


# 254988 28-Aug-2013 loos

Properly free gpiobus ivars when gpiobus_parse_pins() fails and also on
gpiobus detachment.

Suggested by: imp
Approved by: adrian (mentor)


# 243464 23-Nov-2012 gonzo

Style fixes

- Remove C++ - style comments
- Use proper device name in panic messages


# 227849 22-Nov-2011 hselasky

Rename device_delete_all_children() into device_delete_children().

Suggested by: jhb @ and marius @
MFC after: 1 week


# 227843 22-Nov-2011 marius

- There's no need to overwrite the default device method with the default
one. Interestingly, these are actually the default for quite some time
(bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9)
since r52045) but even recently added device drivers do this unnecessarily.
Discussed with: jhb, marcel
- While at it, use DEVMETHOD_END.
Discussed with: jhb
- Also while at it, use __FBSDID.


# 227701 19-Nov-2011 hselasky

Move the device_delete_all_children() function from usb_util.c
to kern/subr_bus.c. Simplify this function so that it no longer
depends on malloc() to execute. Identify a few other places where
it makes sense to use device_delete_all_children().

MFC after: 1 week


# 215142 11-Nov-2010 thompsa

Add a GPIO driver for the Gateworks Cambria platform.

The external gpio pins are connected to a PLD on the i2c bus, unfortunatley
this device does not conform by failing to send an ack after each byte written.
The iicbb driver will abort the transfer when the address is not ack'd and it
would introduce a lot of churn to be able to pass a flag down to
iicbb_start/iicbb_write. Instead we do bad things by grabbing the iicbus but
then doing our own bit banging.


# 213277 29-Sep-2010 gonzo

Fix legal staff in GPIO sources:
- license clause now contains "AUTHOR AND CONTRIBUTORS"
instead of just "AUTHOR"
- Add license/copyright to gpioc.c

Spotted by: Edward Tomasz Napierala, Andrew Turner


# 213237 28-Sep-2010 gonzo

Initial GPIO bus support. Includes:
- GPIO bus controller interface
- GPIO bus interface
- Implementation of GPIO led(4) compatible device
- Implementation of iic(4) bus over GPIO (author: Luiz Otavio O Souza)

Tested by: Luiz Otavio O Souza, Alexandr Rybalko