1
0
Fork 0

MLK-15092 reset: gpio-reset: add post reset delay

Some devices need to wait for some milliseconds after reset, so add
post reset delay in the gpio-reset chip.

The post reset delay is optional.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
5.4-rM2-2.2.x-imx-squashed
Fugang Duan 2017-06-15 16:45:29 +08:00 committed by Dong Aisheng
parent bc1f879da9
commit 80fcea5b45
2 changed files with 13 additions and 0 deletions

View File

@ -14,6 +14,7 @@ Required properties:
Optional properties: Optional properties:
- reset-delay-us: delay in microseconds. The gpio reset line will be asserted for - reset-delay-us: delay in microseconds. The gpio reset line will be asserted for
this duration to reset. this duration to reset.
- reset-post-delay-ms: delay in milliseconds to wait after reset.
- initially-in-reset: boolean. If not set, the initial state should be a - initially-in-reset: boolean. If not set, the initial state should be a
deasserted reset line. If this property exists, the deasserted reset line. If this property exists, the
reset line should be kept in reset. reset line should be kept in reset.

View File

@ -21,6 +21,7 @@ struct gpio_reset_data {
unsigned int gpio; unsigned int gpio;
bool active_low; bool active_low;
s32 delay_us; s32 delay_us;
s32 post_delay_ms;
}; };
static void gpio_reset_set(struct reset_controller_dev *rcdev, int asserted) static void gpio_reset_set(struct reset_controller_dev *rcdev, int asserted)
@ -47,6 +48,10 @@ static int gpio_reset(struct reset_controller_dev *rcdev, unsigned long id)
udelay(drvdata->delay_us); udelay(drvdata->delay_us);
gpio_reset_set(rcdev, 0); gpio_reset_set(rcdev, 0);
if (drvdata->post_delay_ms < 0)
return 0;
msleep(drvdata->post_delay_ms);
return 0; return 0;
} }
@ -116,6 +121,13 @@ static int gpio_reset_probe(struct platform_device *pdev)
else if (drvdata->delay_us < 0) else if (drvdata->delay_us < 0)
dev_warn(&pdev->dev, "reset delay too high\n"); dev_warn(&pdev->dev, "reset delay too high\n");
/* It is optional.
* Some devices need some milliseconds to wait after reset.
*/
ret = of_property_read_u32(np, "reset-post-delay-ms", &drvdata->post_delay_ms);
if (ret < 0)
drvdata->post_delay_ms = -1;
initially_in_reset = of_property_read_bool(np, "initially-in-reset"); initially_in_reset = of_property_read_bool(np, "initially-in-reset");
if (drvdata->active_low ^ initially_in_reset) if (drvdata->active_low ^ initially_in_reset)
gpio_flags = GPIOF_OUT_INIT_HIGH; gpio_flags = GPIOF_OUT_INIT_HIGH;