Skip to content

Commit 43c51bb

Browse files
ey3ballgregkh
authored andcommitted
sc16is7xx: make sure device is in suspend once probed
Previously sc16is7xx_power was called in order to set the device to a low power mode. However since SC16IS7XX_EFR_ENABLE_BIT was not set beforehand this suspend request had not effect. Also, soft-reset the device prior to port initialization. It may otherwise be in a state (interrupt pending, fifo not empty) which prevents it from sleeping. Signed-off-by: Florian Vallee <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 81bb549 commit 43c51bb

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

drivers/tty/serial/sc16is7xx.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,6 +1205,10 @@ static int sc16is7xx_probe(struct device *dev,
12051205
}
12061206
#endif
12071207

1208+
/* reset device, purging any pending irq / data */
1209+
regmap_write(s->regmap, SC16IS7XX_IOCONTROL_REG << SC16IS7XX_REG_SHIFT,
1210+
SC16IS7XX_IOCONTROL_SRESET_BIT);
1211+
12081212
for (i = 0; i < devtype->nr_uart; ++i) {
12091213
s->p[i].line = i;
12101214
/* Initialize port data */
@@ -1234,6 +1238,22 @@ static int sc16is7xx_probe(struct device *dev,
12341238
init_kthread_work(&s->p[i].reg_work, sc16is7xx_reg_proc);
12351239
/* Register port */
12361240
uart_add_one_port(&sc16is7xx_uart, &s->p[i].port);
1241+
1242+
/* Enable EFR */
1243+
sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_LCR_REG,
1244+
SC16IS7XX_LCR_CONF_MODE_B);
1245+
1246+
regcache_cache_bypass(s->regmap, true);
1247+
1248+
/* Enable write access to enhanced features */
1249+
sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_EFR_REG,
1250+
SC16IS7XX_EFR_ENABLE_BIT);
1251+
1252+
regcache_cache_bypass(s->regmap, false);
1253+
1254+
/* Restore access to general registers */
1255+
sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_LCR_REG, 0x00);
1256+
12371257
/* Go to suspend mode */
12381258
sc16is7xx_power(&s->p[i].port, 0);
12391259
}

0 commit comments

Comments
 (0)