serial: msm_geni_serial: Set clock freq correctly for RUMI

This patch adds RUMI specific changes to enable UART clock to
run at half the rate. On RUMI we do see some garbage logs when
setting the clock based on baud rate, this change is to fix
garbage RUMI console logs.


Change-Id: I47e7397f5597067a3981f75354c1f0f85f3cfe9d
Signed-off-by: Mukesh Kumar Savaliya <msavaliy@codeaurora.org>
This commit is contained in:
Mukesh Kumar Savaliya 2020-02-07 12:28:03 +05:30 • committed by Gerrit - the friendly Code Review server
commit bf01ddc5a6

View file

@ -171,6 +171,7 @@ struct msm_geni_serial_port {
u32 cur_tx_remaining;
bool startup_in_progress;
bool is_console;
bool rumi_platform;
};
static const struct uart_ops msm_geni_serial_pops;
@ -1993,6 +1994,14 @@ static void msm_geni_serial_set_termios(struct uart_port *uport,
unsigned long clk_rate;
unsigned long flags;
/* QUP_2.5.0 and older RUMI has sampling rate as 32 */
if (IS_ENABLED(CONFIG_SERIAL_MSM_GENI_HALF_SAMPLING) &&
port->rumi_platform && port->is_console) {
geni_write_reg_nolog(0x21, uport->membase, GENI_SER_M_CLK_CFG);
geni_write_reg_nolog(0x21, uport->membase, GENI_SER_S_CLK_CFG);
geni_read_reg_nolog(uport->membase, GENI_SER_M_CLK_CFG);
}
if (!uart_console(uport)) {
int ret = msm_geni_serial_power_on(uport);
@ -2331,6 +2340,13 @@ msm_geni_serial_earlycon_setup(struct earlycon_device *dev,
*/
msm_geni_serial_poll_cancel_tx(uport);
if (IS_ENABLED(CONFIG_SERIAL_MSM_GENI_HALF_SAMPLING)) {
/* Only for earlyconsole */
geni_write_reg_nolog(0x21, uport->membase, GENI_SER_M_CLK_CFG);
geni_write_reg_nolog(0x21, uport->membase, GENI_SER_S_CLK_CFG);
geni_read_reg_nolog(uport->membase, GENI_SER_M_CLK_CFG);
}
se_get_packing_config(8, 1, false, &cfg0, &cfg1);
geni_se_init(uport->membase, (DEF_FIFO_DEPTH_WORDS >> 1),
(DEF_FIFO_DEPTH_WORDS - 2));
@ -2647,6 +2663,10 @@ static int msm_geni_serial_probe(struct platform_device *pdev)
dev_port->serial_rsc.ctrl_dev = &pdev->dev;
dev_port->is_console = is_console;
/* RUMI specific */
dev_port->rumi_platform = of_property_read_bool(pdev->dev.of_node,
"qcom,rumi_platform");
if (of_property_read_u32(pdev->dev.of_node, "qcom,wakeup-byte",
&wake_char)) {
dev_dbg(&pdev->dev, "No Wakeup byte specified\n");
@ -2779,6 +2799,14 @@ static int msm_geni_serial_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev);
}
if (IS_ENABLED(CONFIG_SERIAL_MSM_GENI_HALF_SAMPLING) &&
dev_port->rumi_platform && dev_port->is_console) {
/* No ver info available, if do later then RUMI console fails */
geni_write_reg_nolog(0x21, uport->membase, GENI_SER_M_CLK_CFG);
geni_write_reg_nolog(0x21, uport->membase, GENI_SER_S_CLK_CFG);
geni_read_reg_nolog(uport->membase, GENI_SER_M_CLK_CFG);
}
dev_info(&pdev->dev, "Serial port%d added.FifoSize %d is_console%d\n",
line, uport->fifosize, is_console);
device_create_file(uport->dev, &dev_attr_loopback);