forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/drivers/tty/serial/st-asc.c
....@@ -5,10 +5,6 @@
55 * Copyright (C) 2003-2013 STMicroelectronics (R&D) Limited
66 */
77
8
-#if defined(CONFIG_SERIAL_ST_ASC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
9
-#define SUPPORT_SYSRQ
10
-#endif
11
-
128 #include <linux/module.h>
139 #include <linux/serial.h>
1410 #include <linux/console.h>
....@@ -508,7 +504,6 @@
508504 struct ktermios *old)
509505 {
510506 struct asc_port *ascport = to_asc_port(port);
511
- struct device_node *np = port->dev->of_node;
512507 struct gpio_desc *gpiod;
513508 unsigned int baud;
514509 u32 ctrl_val;
....@@ -540,10 +535,14 @@
540535 /* set character length */
541536 if ((cflag & CSIZE) == CS7) {
542537 ctrl_val |= ASC_CTL_MODE_7BIT_PAR;
538
+ cflag |= PARENB;
543539 } else {
544540 ctrl_val |= (cflag & PARENB) ? ASC_CTL_MODE_8BIT_PAR :
545541 ASC_CTL_MODE_8BIT;
542
+ cflag &= ~CSIZE;
543
+ cflag |= CS8;
546544 }
545
+ termios->c_cflag = cflag;
547546
548547 /* set stop bit */
549548 ctrl_val |= (cflag & CSTOPB) ? ASC_CTL_STOP_2BIT : ASC_CTL_STOP_1BIT;
....@@ -570,13 +569,12 @@
570569 pinctrl_select_state(ascport->pinctrl,
571570 ascport->states[NO_HW_FLOWCTRL]);
572571
573
- gpiod = devm_fwnode_get_gpiod_from_child(port->dev,
574
- "rts",
575
- &np->fwnode,
576
- GPIOD_OUT_LOW,
577
- np->name);
578
- if (!IS_ERR(gpiod))
572
+ gpiod = devm_gpiod_get(port->dev, "rts", GPIOD_OUT_LOW);
573
+ if (!IS_ERR(gpiod)) {
574
+ gpiod_set_consumer_name(gpiod,
575
+ port->dev->of_node->name);
579576 ascport->rts = gpiod;
577
+ }
580578 }
581579 }
582580
....@@ -730,6 +728,7 @@
730728 port->fifosize = ASC_FIFO_SIZE;
731729 port->dev = &pdev->dev;
732730 port->irq = platform_get_irq(pdev, 0);
731
+ port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_ST_ASC_CONSOLE);
733732
734733 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
735734 port->membase = devm_ioremap_resource(&pdev->dev, res);