Skip to content

Commit e927c13

Browse files
xxkentabrodkin
authored andcommitted
ARCv3:DBG: add global variable to change UART baud in MDB
This patch adds the ability to change the UART baud using global variable glb_uart_baud. This is for debugging/developing purposes. Use this to set UART baud before starting a kernel right after load.
1 parent fc1f556 commit e927c13

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

arch/arc/kernel/devtree.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717

1818
static unsigned int __initdata arc_base_baud;
1919

20+
//These two variables exist only for debugging perposes
2021
volatile unsigned int glb_clock_freq = 50000000;
22+
volatile unsigned int glb_uart_baud = 115200;
2123

2224
unsigned int __init arc_early_base_baud(void)
2325
{

drivers/tty/serial/8250/8250_early.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,16 @@ static void __init init_port(struct earlycon_device *device)
154154
}
155155
}
156156

157+
extern volatile unsigned int glb_uart_baud;
158+
157159
int __init early_serial8250_setup(struct earlycon_device *device,
158160
const char *options)
159161
{
160162
if (!(device->port.membase || device->port.iobase))
161163
return -ENODEV;
162164

165+
device->baud = glb_uart_baud; // For changing UART baud in MDB runtime
166+
163167
if (!device->baud) {
164168
struct uart_port *port = &device->port;
165169
unsigned int ier;

drivers/tty/serial/8250/8250_port.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2668,6 +2668,8 @@ static void serial8250_set_divisor(struct uart_port *port, unsigned int baud,
26682668
serial8250_do_set_divisor(port, baud, quot, quot_frac);
26692669
}
26702670

2671+
extern volatile unsigned int glb_uart_baud;
2672+
26712673
static unsigned int serial8250_get_baud_rate(struct uart_port *port,
26722674
struct ktermios *termios,
26732675
struct ktermios *old)
@@ -2695,7 +2697,8 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port,
26952697
* slower than nominal still match standard baud rates without
26962698
* causing transmission errors.
26972699
*/
2698-
return uart_get_baud_rate(port, termios, old, min, max);
2700+
//return uart_get_baud_rate(port, termios, old, min, max);
2701+
return glb_uart_baud; // For changing UART baud in MDB
26992702
}
27002703

27012704
/*

0 commit comments

Comments
 (0)