mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-07-05 10:46:15 +09:00
serial: UniPhier: move LCR register setting to probe function
We do not have to set the LCR register every time we change the baud-rate. We just need to set it up once in the probe function. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
This commit is contained in:
parent
d0c47b3ef7
commit
099cf77c15
|
@ -45,12 +45,6 @@ static int uniphier_serial_setbrg(struct udevice *dev, int baudrate)
|
||||||
struct uniphier_serial __iomem *port = uniphier_serial_port(dev);
|
struct uniphier_serial __iomem *port = uniphier_serial_port(dev);
|
||||||
const unsigned int mode_x_div = 16;
|
const unsigned int mode_x_div = 16;
|
||||||
unsigned int divisor;
|
unsigned int divisor;
|
||||||
u32 tmp;
|
|
||||||
|
|
||||||
tmp = readl(&port->lcr_mcr);
|
|
||||||
tmp &= ~LCR_MASK;
|
|
||||||
tmp |= UART_LCR_WLEN8 << LCR_SHIFT;
|
|
||||||
writel(tmp, &port->lcr_mcr);
|
|
||||||
|
|
||||||
divisor = DIV_ROUND_CLOSEST(plat->uartclk, mode_x_div * baudrate);
|
divisor = DIV_ROUND_CLOSEST(plat->uartclk, mode_x_div * baudrate);
|
||||||
|
|
||||||
|
@ -93,14 +87,22 @@ static int uniphier_serial_pending(struct udevice *dev, bool input)
|
||||||
|
|
||||||
static int uniphier_serial_probe(struct udevice *dev)
|
static int uniphier_serial_probe(struct udevice *dev)
|
||||||
{
|
{
|
||||||
|
u32 tmp;
|
||||||
struct uniphier_serial_private_data *priv = dev_get_priv(dev);
|
struct uniphier_serial_private_data *priv = dev_get_priv(dev);
|
||||||
struct uniphier_serial_platform_data *plat = dev_get_platdata(dev);
|
struct uniphier_serial_platform_data *plat = dev_get_platdata(dev);
|
||||||
|
struct uniphier_serial __iomem *port;
|
||||||
|
|
||||||
priv->membase = map_sysmem(plat->base, sizeof(struct uniphier_serial));
|
port = map_sysmem(plat->base, sizeof(struct uniphier_serial));
|
||||||
|
if (!port)
|
||||||
if (!priv->membase)
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
priv->membase = port;
|
||||||
|
|
||||||
|
tmp = readl(&port->lcr_mcr);
|
||||||
|
tmp &= ~LCR_MASK;
|
||||||
|
tmp |= UART_LCR_WLEN8 << LCR_SHIFT;
|
||||||
|
writel(tmp, &port->lcr_mcr);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user