int s5p_serial_setbrg(struct udevice *dev, int baudrate) { struct s5p_serial_platdata *plat = dev->platdata; struct s5p_uart *const uart = plat->reg; u32 uclk = get_uart_clk(plat->port_id); s5p_serial_baud(uart, uclk, baudrate); return 0; }
void serial_setbrg_dev(const int dev_index) { struct s5p_uart *const uart = s5p_get_base_uart(dev_index); u32 uclk = get_uart_clk(dev_index); u32 baudrate = gd->baudrate; u32 val; val = uclk / baudrate; writel(val / 16 - 1, &uart->ubrdiv); if (use_divslot) writew(udivslot[val % 16], &uart->rest.slot); else writeb(val % 16, &uart->rest.value); }
int s5p_serial_setbrg(struct udevice *dev, int baudrate) { struct s5p_serial_platdata *plat = dev->platdata; struct s5p_uart *const uart = plat->reg; u32 uclk; #ifdef CONFIG_CLK_EXYNOS struct clk clk; u32 ret; ret = clk_get_by_index(dev, 1, &clk); if (ret < 0) return ret; uclk = clk_get_rate(&clk); #else uclk = get_uart_clk(plat->port_id); #endif s5p_serial_baud(uart, uclk, baudrate); return 0; }