summaryrefslogtreecommitdiff
path: root/drivers/gpio
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2016-11-23 16:14:23 -0800
committerOleksandr Suvorov <oleksandr.suvorov@toradex.com>2021-01-27 11:03:27 +0200
commitb4afeb8e4f41948b83d0b32653b1ad56611e5cf9 (patch)
tree78ecee95c45fa2fc944dda03e9253dab955c1408 /drivers/gpio
parent955712697c7fdfb4702421b88d676cde0d42c284 (diff)
gpio: mxc: clear interrupt mask/status optionally
Add a kernel parameter ("gpio-mxc.noclearirq") to disable unconditional interrupt mask/clearing. This is useful when a second CPU (the Cortex-M4) is accessing the same GPIO bank. Using the same GPIO bank from the Cortex-A7 and M4 sounds risky, but it seems to work quite well. Most registers are write only (e.g. interrupt status register can be cleared with a single write), which makes them safe for concurrent access. However, sharing a single GPIO bank between two cores does not allow to use the Resource Domain Controller. Hence for secure applications assigning a dedicated GPIO bank is still preferable. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> (cherry picked from commit 4cfa939c693b20ca213f054c1dfe5583d966beb4) (cherry picked from commit 6fe2ede9d83fee52703dc3403aa0a2cf29704595)
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-mxc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 0185b6e57e78..5a2cf486a686 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -7,6 +7,7 @@
// Authors: Daniel Mack, Juergen Beisert.
// Copyright (C) 2004-2010 Freescale Semiconductor, Inc. All Rights Reserved.
+#include <linux/moduleparam.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/init.h>
@@ -33,6 +34,10 @@
#define IMX_SC_IRQ_PAD (1 << 1)
#endif
+static bool noclearirq = false;
+module_param(noclearirq, bool, 0);
+MODULE_PARM_DESC(noclearirq, "do not clear IRQ mask/status on probe");
+
enum mxc_gpio_hwtype {
IMX1_GPIO, /* runs on i.mx1 */
IMX21_GPIO, /* runs on i.mx21 and i.mx27 */
@@ -671,8 +676,10 @@ static int mxc_gpio_probe(struct platform_device *pdev)
goto out_pm_dis;
/* disable the interrupt and clear the status */
- writel(0, port->base + GPIO_IMR);
- writel(~0, port->base + GPIO_ISR);
+ if (!noclearirq) {
+ writel(0, port->base + GPIO_IMR);
+ writel(~0, port->base + GPIO_ISR);
+ }
if (mxc_gpio_hwtype == IMX21_GPIO) {
/*