Skip to content

Commit

Permalink
tty: serial: max310x: increase delay waiting for stable crystal oscil…
Browse files Browse the repository at this point in the history
…lator

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
  • Loading branch information
tkisky authored and gibsson committed May 18, 2022
1 parent 082d007 commit e5dfe3e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions drivers/tty/serial/max310x.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,11 +613,18 @@ static u32 max310x_set_ref_clk(struct device *dev, struct max310x_port *s,

/* Wait for crystal */
if (xtal) {
unsigned long delay = jiffies + msecs_to_jiffies(100);
unsigned int val;
msleep(10);
regmap_read(s->regmap, MAX310X_STS_IRQSTS_REG, &val);
if (!(val & MAX310X_STS_CLKREADY_BIT)) {

while (1) {
regmap_read(s->regmap, MAX310X_STS_IRQSTS_REG, &val);
if (val & MAX310X_STS_CLKREADY_BIT)
break;
msleep(1);
if (time_before(jiffies, delay))
continue;
dev_warn(dev, "clock is not stable yet\n");
break;
}
}

Expand Down

0 comments on commit e5dfe3e

Please sign in to comment.