Skip to content

Commit 7cf563b

Browse files
Akash Asthanaandersson
authored andcommitted
tty: serial: qcom_geni_serial: Add interconnect support
Get the interconnect paths for Uart based Serial Engine device and vote according to the baud rate requirement of the driver. Signed-off-by: Akash Asthana <[email protected]> Reviewed-by: Matthias Kaehlcke <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent bf225ed commit 7cf563b

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

drivers/tty/serial/qcom_geni_serial.c

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,7 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport,
945945
struct qcom_geni_serial_port *port = to_dev_port(uport, uport);
946946
unsigned long clk_rate;
947947
u32 ver, sampling_rate;
948+
unsigned int avg_bw_core;
948949

949950
qcom_geni_serial_stop_rx(uport);
950951
/* baud rate */
@@ -966,6 +967,16 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport,
966967
ser_clk_cfg = SER_CLK_EN;
967968
ser_clk_cfg |= clk_div << CLK_DIV_SHFT;
968969

970+
/*
971+
* Bump up BW vote on CPU and CORE path as driver supports FIFO mode
972+
* only.
973+
*/
974+
avg_bw_core = (baud > 115200) ? Bps_to_icc(CORE_2X_50_MHZ)
975+
: GENI_DEFAULT_BW;
976+
port->se.icc_paths[GENI_TO_CORE].avg_bw = avg_bw_core;
977+
port->se.icc_paths[CPU_TO_GENI].avg_bw = Bps_to_icc(baud);
978+
geni_icc_set_bw(&port->se);
979+
969980
/* parity */
970981
tx_trans_cfg = readl(uport->membase + SE_UART_TX_TRANS_CFG);
971982
tx_parity_cfg = readl(uport->membase + SE_UART_TX_PARITY_CFG);
@@ -1235,11 +1246,14 @@ static void qcom_geni_serial_pm(struct uart_port *uport,
12351246
if (old_state == UART_PM_STATE_UNDEFINED)
12361247
old_state = UART_PM_STATE_OFF;
12371248

1238-
if (new_state == UART_PM_STATE_ON && old_state == UART_PM_STATE_OFF)
1249+
if (new_state == UART_PM_STATE_ON && old_state == UART_PM_STATE_OFF) {
1250+
geni_icc_enable(&port->se);
12391251
geni_se_resources_on(&port->se);
1240-
else if (new_state == UART_PM_STATE_OFF &&
1241-
old_state == UART_PM_STATE_ON)
1252+
} else if (new_state == UART_PM_STATE_OFF &&
1253+
old_state == UART_PM_STATE_ON) {
12421254
geni_se_resources_off(&port->se);
1255+
geni_icc_disable(&port->se);
1256+
}
12431257
}
12441258

12451259
static const struct uart_ops qcom_geni_console_pops = {
@@ -1337,6 +1351,17 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
13371351
return -ENOMEM;
13381352
}
13391353

1354+
ret = geni_icc_get(&port->se, NULL);
1355+
if (ret)
1356+
return ret;
1357+
port->se.icc_paths[GENI_TO_CORE].avg_bw = GENI_DEFAULT_BW;
1358+
port->se.icc_paths[CPU_TO_GENI].avg_bw = GENI_DEFAULT_BW;
1359+
1360+
/* Set BW for register access */
1361+
ret = geni_icc_set_bw(&port->se);
1362+
if (ret)
1363+
return ret;
1364+
13401365
port->name = devm_kasprintf(uport->dev, GFP_KERNEL,
13411366
"qcom_geni_serial_%s%d",
13421367
uart_console(uport) ? "console" : "uart", uport->line);

0 commit comments

Comments
 (0)