History log of /fuchsia/zircon/system/dev/gpio/imx8/imx8-gpio.c
Revision Date Author Comments
# 72588575 25-Sep-2018 Suraj Malhotra <surajmalhotra@google.com>

[imx8-gpio] Migrate to use mmio_buffer_t.

Tested: Compiles.
Change-Id: I75c77f2491c461daa04905dc690bc42b54e6f183


# 6c2ccb39 19-Sep-2018 Mike Voydanoff <voydanoff@google.com>

[gpio] Refactor the GPIO protocol

This is a first step in a move toward using protocols to represent
individual resources. A similar change will be made to the I2C protocol
to bring it in line with how I2C is used on x86 platforms.

From the client's point of view, an instance of the ZX_PROTOCOL_GPIO
protocol now represents a single pin. The protocol remains the same,
except the "uint32_t index" has been removed from all the protocol functions.

For devices that have only one GPIO resource assigned to them, the driver
can simply call device_get_protocol() to access the GPIO protocol for the pin.
To for devices with more than one GPIO pins, a new API in the platform bus called
pdev_get_protocol() must be used instead.

In addition, we add a new protocol ZX_PROTOCOL_GPIO_IMPL, which is now
implemented by the GPIO drivers. This protocol is essentially the same as
the old GPIO protocol, except "index" has been renamed "pin".
Board drivers may use this protocol directly when doing low level system
configuration, specifying pin numbers directly.

TEST: Booted on VIM2 and Hikey.
On VIM2, USB, display, ethernet and the GPIO test driver are working properly
On Hikey, the system boots and USB is functional.

Change-Id: I44f1bc11ad9793543361a2d19d7a2de4458c334b


# 1c8d92c7 12-Sep-2018 Brijen Raval <braval@google.com>

[imx8m][clang-format] Run Clang-format

Test: Bootup on IMX8MQ

Change-Id: I45ea960b804dc2f165d00667c04eeabe834d1a64


# 79fab0b5 07-Sep-2018 Brijen Raval <braval@google.com>

[port][interrupt] Update documentation for PORT_BIND_TO_INTERRUPT

Test: Boot up on Astro
Change-Id: I0b3b0096b74e22fec24df08e7b11bcd0b833adb6


# 2d20e548 04-Sep-2018 Mike Voydanoff <voydanoff@google.com>

[ddk][gpio] Break gpio_config() API into two functions

gpio_config_in() is used to configure a pin for input, while
gpio_config_out() is used to configure a pin for output.
gpio_config_out() now takes an initial value for the pin,
so the configuration and value can be set atomically to avoid a
race condition or glitch between setting it as output and writing the value.

Also removed some unnecessary GPIO configuration flags.
Now we only have flags for configuring the pull-up in gpio_config_in().
gpio_get_interrupt() uses interrupt handle flags for configuring edge vs level triggered,
so we don't need GPIO_* flags for these.

TEST: manual testing on VIM2, astro and gauss

ZX-2564 #in progress
ZX-2465 #in progress

Change-Id: I280c489ba951ca5953c0a2d57135c3482dd96c37


# 9840161f 02-Sep-2018 Mike Voydanoff <voydanoff@google.com>

[board][imx8mevk] Remove unused header file

TEST: boot on madrone
Change-Id: Ib0c7053b828478e6c275b2b7d8b4541b9021d8eb


# fd3d6217 25-Aug-2018 Mike Voydanoff <voydanoff@google.com>

[platform-bus][aml-canvas] Add support for proxying SOC-specific protocols

This change adds support to the platform bus driver for proxying
SOC-specific protocols to platform devices without modifying the
platform bus source code. It also removes support for the Amlogic canvas
protocol from the platform bus driver and uses this new proxying support instead.

The Amlogic canvas driver is now split into two drivers:
the canvas implementation driver and the canvas proxy driver.
The implementation driver runs in the platform bus devhost and implements the main
functionality of the driver. The proxy driver runs in the devhosts of the
drivers that are clients of the canvas protocol and is responsible for proxying
the canvas protocol to the implementation driver.

To make this work we add a new protocol ZX_PROTOCOL_PLATFORM_PROXY
and add new support to ZX_PROTOCOL_PLATFORM_BUS.
In ZX_PROTOCOL_PLATFORM_BUS, the pbus_register_protocol() API now adds an
optional callback of type platform_proxy_cb_t. This callback handles
RPCs from a protocol proxy driver.

The new protocol ZX_PROTOCOL_PLATFORM_PROXY is used for protocol proxy drivers
to communicate with the platform bus in the client devhosts.
When the proxy driver loads, it calls platform_proxy_register_protocol()
to register its protocol implementation with the platform bus proxy driver.
When the client driver calls a protocol API implemented by the proxy driver,
the proxy driver calls platform_proxy_proxy() to proxy the protocol
to the implementation driver in the platform device devhost, via the channel
that connects the two devhosts.

Support for proxying the Amlogic canvas protocol is now removed from the
platform bus driver, since we are using this new mechanism instead.

Within the platform bus driver, we add a new class ProxyClient.
This is a subclass of ddk::Device that is used for binding the
protocol proxy drivers. In the case where a platform device relies on
SOC-specific protocols implemented using this new mechanism,
the platform bus proxy driver creates a PlatformProxyClient for each
of the protocols and waits for them all to register their protocols
via the ZX_PROTOCOL_PLATFORM_PROXY protocol before creating the
ProxyDevice object to bind the platform device driver.

Below illustrates the parts of the device tree is changed by this CL:

BEFORE:
[04:02:1] pid=1785 /boot/driver/platform-bus.so
<04:02:1> pid=2881 /boot/driver/platform-bus.proxy.so
[vim2-display] pid=2881 /boot/driver/vim-display.so
[display-controller] pid=2881 /boot/driver/display.so

AFTER:
[04:02:1] pid=1850 /boot/driver/platform-bus.so
<04:02:1> pid=3024 /boot/driver/platform-bus.proxy.so
[ProxyClient[7043414e]] pid=3024 /boot/driver/platform-bus.proxy.so
[aml-canvas-proxy] pid=3024 /boot/driver/aml-canvas.proxy.so
[ProxyDevice] pid=3024 /boot/driver/platform-bus.proxy.so
[vim2-display] pid=3024 /boot/driver/vim-display.so
[display-controller] pid=3024 /boot/driver/display.so

In the AFTER subtree, the platform proxy driver inserts a new root device that has
both the aml-canvas and vim2-display drivers as children.

TEST: manual testing on VIM2 and astro

Change-Id: Ibfa925948491fb3793dd934ee5737ace7903edb9


# 0d71f953 21-Aug-2018 Mike Voydanoff <voydanoff@google.com>

[dev][platform-bus] Clean-up and simplify platform bus protocol:

- Remove "flags" parameter from pbus_device_add().
Now platform devices can only be started in new devhosts.

- Add new API pbus_protocol_device_add(), for binding drivers that implement
platform bus protocols like GPIO and I2C_IMPL.
pbus_protocol_device_add() is equivalent to pbus_device_add(PDEV_ADD_PBUS_DEVHOST)
followed by pbus_wait_protocol().

- Remove pbus_wait_protocol(). pbus_protocol_device_add() does the wait for you automatically.

- Rename pbus_set_protocol() to pbus_register_protocol()

These changes will hopefully make the platform bus protocol easier
to understand and use.
I found two places where people accidentally using PDEV_ADD_PBUS_DEVHOST
inappropriately (probably copy & paste errors), which resulted in
the entire network stack and storage stack running in the platform bus devhost.
Hopefully this change will make it impossible for mistakes like that to happen again.

While doing this I also noticed that the gauss nand driver and vim2 ethernet driver
were running in the platform bus devhost. This change fixes that.

Also removed some remnants of the pbus_device_enable() API, which has been removed previously.

TEST: boot up on qemu, VIM2, gauss and astro and verified platform devices all start up properly

Change-Id: I580269bc6f53a63348ba8ab580259b1ba56dd393


# 601beaaf 03-Jul-2018 Mike Voydanoff <voydanoff@google.com>

[imx8][gpio] Fix invalid handle reference

Test: No longer causes exception on madrone board
Change-Id: I7ff688f4a0799f8e1bf2ef538ba46b074608309b


# 47cff597 26-Jun-2018 George Kulakowski <kulakowski@google.com>

[clock] zx_clock_get(ZX_CLOCK_MONOTONIC) -> zx_clock_get_monotonic()

Test: no functional change

Change-Id: Iaa513c521d96b178458acc707be3646067971701


# 997ec13a 24-May-2018 Adam Barth <abarth@google.com>

[syscalls] Remove count arguments from port_queue and port_wait

This argument is not used and always must be one. I tried implementing
some reasonable behavior for this parameter on port_queue, but it wasn't
clear what to do when we encounter an error during the queue operation
because there isn't an out parameter for how many we succeeded in
queuing.

Rather than having a half-baked feature, we should just remove the
parameter and add another function that does vectorized versions of
these operations if we need that in the future.

Change-Id: Ifffcd6d705442cc830912a67c8117ffe5ec8295d


# fbc064a4 26-Apr-2018 Brijen Raval <braval@google.com>

[imx8m][gpio][interrupts] Add GPIO IRQ support for NXP

Change-Id: I2bc59f60092670d0daadcf88548ce8982744054b


# 0a33144c 05-Apr-2018 Payam Moradshahi <payamm@google.com>

[zircon][nxp][imx8] Add iM8X board driver and GPIO driver

Change-Id: Ie85a6d81ae64ac1c75c80fd6e1cbc9bc4f5f5e29