forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/drivers/tty/serial/clps711x.c
....@@ -8,10 +8,6 @@
88 * Copyright (C) 2000 Deep Blue Solutions Ltd.
99 */
1010
11
-#if defined(CONFIG_SERIAL_CLPS711X_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
12
-#define SUPPORT_SYSRQ
13
-#endif
14
-
1511 #include <linux/module.h>
1612 #include <linux/device.h>
1713 #include <linux/console.h>
....@@ -442,14 +438,10 @@
442438 static int uart_clps711x_probe(struct platform_device *pdev)
443439 {
444440 struct device_node *np = pdev->dev.of_node;
445
- int ret, index = np ? of_alias_get_id(np, "serial") : pdev->id;
446441 struct clps711x_port *s;
447442 struct resource *res;
448443 struct clk *uart_clk;
449
- int irq;
450
-
451
- if (index < 0 || index >= UART_CLPS711X_NR)
452
- return -EINVAL;
444
+ int irq, ret;
453445
454446 s = devm_kzalloc(&pdev->dev, sizeof(*s), GFP_KERNEL);
455447 if (!s)
....@@ -473,25 +465,17 @@
473465 if (s->rx_irq < 0)
474466 return s->rx_irq;
475467
476
- if (!np) {
477
- char syscon_name[9];
468
+ s->syscon = syscon_regmap_lookup_by_phandle(np, "syscon");
469
+ if (IS_ERR(s->syscon))
470
+ return PTR_ERR(s->syscon);
478471
479
- sprintf(syscon_name, "syscon.%i", index + 1);
480
- s->syscon = syscon_regmap_lookup_by_pdevname(syscon_name);
481
- if (IS_ERR(s->syscon))
482
- return PTR_ERR(s->syscon);
483
- } else {
484
- s->syscon = syscon_regmap_lookup_by_phandle(np, "syscon");
485
- if (IS_ERR(s->syscon))
486
- return PTR_ERR(s->syscon);
487
- }
488
-
489
- s->port.line = index;
472
+ s->port.line = of_alias_get_id(np, "serial");
490473 s->port.dev = &pdev->dev;
491474 s->port.iotype = UPIO_MEM32;
492475 s->port.mapbase = res->start;
493476 s->port.type = PORT_CLPS711X;
494477 s->port.fifosize = 16;
478
+ s->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_CLPS711X_CONSOLE);
495479 s->port.flags = UPF_SKIP_TEST | UPF_FIXED_TYPE;
496480 s->port.uartclk = clk_get_rate(uart_clk);
497481 s->port.ops = &uart_clps711x_ops;