提交 97738613 编写于 作者: J Janusz Krzysztofik 提交者: Miquel Raynal

mtd: rawnand: ams-delta: Request data port GPIO resource

Data port used by the driver is actually an OMAP MPUIO device, already
under control of gpio-omap driver.  For that reason we used to not
request the memory region of the port as that would fail because the
region is already busy.  Despite that, we are still accessing the port
by just ioremapping it and performing read/write operations.  Moreover,
we are doing that without any proteciton from other users legally
manipulating the port pins over GPIO API.

The plan is to convert the driver to access the port over GPIO consumer
API.  Before that happens, already prevent from other users accessing
the port pins by requesting an array of its GPIO descriptors.
Signed-off-by: NJanusz Krzysztofik <jmkrzyszt@gmail.com>
Reviewed-by: NBoris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
上级 02e1ca60
...@@ -190,6 +190,7 @@ static int ams_delta_init(struct platform_device *pdev) ...@@ -190,6 +190,7 @@ static int ams_delta_init(struct platform_device *pdev)
struct mtd_info *mtd; struct mtd_info *mtd;
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
void __iomem *io_base; void __iomem *io_base;
struct gpio_descs *data_gpiods;
int err = 0; int err = 0;
if (!res) if (!res)
...@@ -275,8 +276,14 @@ static int ams_delta_init(struct platform_device *pdev) ...@@ -275,8 +276,14 @@ static int ams_delta_init(struct platform_device *pdev)
goto err_unmap; goto err_unmap;
} }
/* Initialize data port direction to a known state */ /* Request array of data pins, initialize them as input */
ams_delta_dir_input(priv, true); data_gpiods = devm_gpiod_get_array(&pdev->dev, "data", GPIOD_IN);
if (IS_ERR(data_gpiods)) {
err = PTR_ERR(data_gpiods);
dev_err(&pdev->dev, "data GPIO request failed: %d\n", err);
goto err_unmap;
}
priv->data_in = true;
/* Initialize the NAND controller object embedded in ams_delta_nand. */ /* Initialize the NAND controller object embedded in ams_delta_nand. */
priv->base.ops = &ams_delta_ops; priv->base.ops = &ams_delta_ops;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册