Commit 210325f0 authored by Roger Quadros's avatar Roger Quadros

memory: omap-gpmc: Reserve WAITPIN if needed for WAIT monitoring

If the device attached to GPMC wants to use the WAIT pin
for WAIT monitoring then we reserve it internally for
exclusive use.
Signed-off-by: default avatarRoger Quadros <rogerq@ti.com>
Acked-by: default avatarTony Lindgren <tony@atomide.com>
parent d2d00862
...@@ -1911,6 +1911,8 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, ...@@ -1911,6 +1911,8 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
const char *name; const char *name;
int ret, cs; int ret, cs;
u32 val; u32 val;
struct gpio_desc *waitpin_desc = NULL;
struct gpmc_device *gpmc = platform_get_drvdata(pdev);
if (of_property_read_u32(child, "reg", &cs) < 0) { if (of_property_read_u32(child, "reg", &cs) < 0) {
dev_err(&pdev->dev, "%s has no 'reg' property\n", dev_err(&pdev->dev, "%s has no 'reg' property\n",
...@@ -2020,16 +2022,30 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, ...@@ -2020,16 +2022,30 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
goto err; goto err;
} }
/* Reserve wait pin if it is required and valid */
if (gpmc_s.wait_on_read || gpmc_s.wait_on_write) {
unsigned int wait_pin = gpmc_s.wait_pin;
waitpin_desc = gpiochip_request_own_desc(&gpmc->gpio_chip,
wait_pin, "WAITPIN");
if (IS_ERR(waitpin_desc)) {
dev_err(&pdev->dev, "invalid wait-pin: %d\n", wait_pin);
ret = PTR_ERR(waitpin_desc);
goto err;
}
}
gpmc_cs_show_timings(cs, "before gpmc_cs_program_settings"); gpmc_cs_show_timings(cs, "before gpmc_cs_program_settings");
ret = gpmc_cs_program_settings(cs, &gpmc_s); ret = gpmc_cs_program_settings(cs, &gpmc_s);
if (ret < 0) if (ret < 0)
goto err; goto err_cs;
ret = gpmc_cs_set_timings(cs, &gpmc_t, &gpmc_s); ret = gpmc_cs_set_timings(cs, &gpmc_t, &gpmc_s);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to set gpmc timings for: %s\n", dev_err(&pdev->dev, "failed to set gpmc timings for: %s\n",
child->name); child->name);
goto err; goto err_cs;
} }
/* Clear limited address i.e. enable A26-A11 */ /* Clear limited address i.e. enable A26-A11 */
...@@ -2060,6 +2076,10 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, ...@@ -2060,6 +2076,10 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
dev_err(&pdev->dev, "failed to create gpmc child %s\n", child->name); dev_err(&pdev->dev, "failed to create gpmc child %s\n", child->name);
ret = -ENODEV; ret = -ENODEV;
err_cs:
if (waitpin_desc)
gpiochip_free_own_desc(waitpin_desc);
err: err:
gpmc_cs_free(cs); gpmc_cs_free(cs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment