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
parent
bc1f879da9
commit
80fcea5b45
|
@ -14,6 +14,7 @@ Required properties:
|
|||
Optional properties:
|
||||
- reset-delay-us: delay in microseconds. The gpio reset line will be asserted for
|
||||
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
|
||||
deasserted reset line. If this property exists, the
|
||||
reset line should be kept in reset.
|
||||
|
|
|
@ -21,6 +21,7 @@ struct gpio_reset_data {
|
|||
unsigned int gpio;
|
||||
bool active_low;
|
||||
s32 delay_us;
|
||||
s32 post_delay_ms;
|
||||
};
|
||||
|
||||
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);
|
||||
gpio_reset_set(rcdev, 0);
|
||||
|
||||
if (drvdata->post_delay_ms < 0)
|
||||
return 0;
|
||||
|
||||
msleep(drvdata->post_delay_ms);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -116,6 +121,13 @@ static int gpio_reset_probe(struct platform_device *pdev)
|
|||
else if (drvdata->delay_us < 0)
|
||||
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");
|
||||
if (drvdata->active_low ^ initially_in_reset)
|
||||
gpio_flags = GPIOF_OUT_INIT_HIGH;
|
||||
|
|
Loading…
Reference in New Issue