diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2018-06-29 14:11:19 +1000 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2018-07-02 16:10:15 +0200 |
commit | a7ca13826e478f9b201eb2f9f20de0b978a82ad9 (patch) | |
tree | f362209f8c9660343ecf2ccea6545a9c9b1fa53a /include/linux/gpio | |
parent | 0f1e03c2b5a395e3eb38899a41c7e74afbc16ba0 (diff) | |
download | linux-a7ca13826e478f9b201eb2f9f20de0b978a82ad9.tar.gz linux-a7ca13826e478f9b201eb2f9f20de0b978a82ad9.tar.bz2 linux-a7ca13826e478f9b201eb2f9f20de0b978a82ad9.zip |
gpio: aspeed: Add interfaces for co-processor to grab GPIOs
On the Aspeed chip, the GPIOs can be under control of the ARM
chip or of the ColdFire coprocessor. (There's a third command
source, the LPC bus, which we don't use or support yet).
The control of which master is allowed to modify a given
GPIO is per-bank (8 GPIOs).
Unfortunately, systems already exist for which we want to
use GPIOs of both sources in the same bank.
This provides an API exported by the gpio-aspeed driver
that an aspeed coprocessor driver can use to "grab" some
GPIOs for use by the coprocessor, and allow the coprocessor
driver to provide callbacks for arbitrating access.
Once at least one GPIO of a given bank has been "grabbed"
by the coprocessor, the entire bank is marked as being
under coprocessor control. It's command source is switched
to the coprocessor.
If the ARM then tries to write to a GPIO in such a marked bank,
the provided callbacks are used to request access from the
coprocessor driver, which is responsible to doing whatever
is necessary to "pause" the coprocessor or prevent it from
trying to use the GPIOs while the ARM is doing its accesses.
During that time, the command source for the bank is temporarily
switched back to the ARM.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'include/linux/gpio')
-rw-r--r-- | include/linux/gpio/aspeed.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/gpio/aspeed.h b/include/linux/gpio/aspeed.h new file mode 100644 index 000000000000..1bfb3cdc86d0 --- /dev/null +++ b/include/linux/gpio/aspeed.h @@ -0,0 +1,15 @@ +#ifndef __GPIO_ASPEED_H +#define __GPIO_ASPEED_H + +struct aspeed_gpio_copro_ops { + int (*request_access)(void *data); + int (*release_access)(void *data); +}; + +int aspeed_gpio_copro_grab_gpio(struct gpio_desc *desc, + u16 *vreg_offset, u16 *dreg_offset, u8 *bit); +int aspeed_gpio_copro_release_gpio(struct gpio_desc *desc); +int aspeed_gpio_copro_set_ops(const struct aspeed_gpio_copro_ops *ops, void *data); + + +#endif /* __GPIO_ASPEED_H */ |