[PATCH v5 1/3] memory: omap-gpmc: allow shared wait pins

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Benedikt Niedermayr <benedikt.niedermayr@xxxxxxxxxxx>

Newer kernels refuse to probe when using the same wait pin for
different chipselect regions.
But this may be a usecase when connecting for example FPGA or ASIC
modules to the gpmc, which only got one wait pin installed.

The wait-pin allocation is now tracked by the gpmc driver in order
to be sure that the wait pin has been indeed requested by gpmc.
Therefore the "wait_pin_alloc_mask" has been introduced.

Signed-off-by: Benedikt Niedermayr <benedikt.niedermayr@xxxxxxxxxxx>
---
 drivers/memory/omap-gpmc.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index d9bf1c2ac319..ea495e93766b 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -232,6 +232,7 @@ struct gpmc_device {
 	int irq;
 	struct irq_chip irq_chip;
 	struct gpio_chip gpio_chip;
+	unsigned long wait_pin_alloc_mask;
 	int nirqs;
 	struct resource *data;
 };
@@ -2221,9 +2222,16 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
 							 GPIO_ACTIVE_HIGH,
 							 GPIOD_IN);
 		if (IS_ERR(waitpin_desc)) {
-			dev_err(&pdev->dev, "invalid wait-pin: %d\n", wait_pin);
 			ret = PTR_ERR(waitpin_desc);
-			goto err;
+			if (ret == -EBUSY &&
+			    test_bit(wait_pin, &gpmc->wait_pin_alloc_mask)) {
+				dev_info(&pdev->dev, "shared wait-pin: %d\n", wait_pin);
+			} else {
+				dev_err(&pdev->dev, "invalid wait-pin: %d\n", wait_pin);
+				goto err;
+			}
+		} else {
+			set_bit(wait_pin, &gpmc->wait_pin_alloc_mask);
 		}
 	}
 
-- 
2.34.1




[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux