.. | .. |
---|
8 | 8 | * Copyright (C) 2000 Deep Blue Solutions Ltd. |
---|
9 | 9 | */ |
---|
10 | 10 | |
---|
11 | | -#if defined(CONFIG_SERIAL_CLPS711X_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) |
---|
12 | | -#define SUPPORT_SYSRQ |
---|
13 | | -#endif |
---|
14 | | - |
---|
15 | 11 | #include <linux/module.h> |
---|
16 | 12 | #include <linux/device.h> |
---|
17 | 13 | #include <linux/console.h> |
---|
.. | .. |
---|
442 | 438 | static int uart_clps711x_probe(struct platform_device *pdev) |
---|
443 | 439 | { |
---|
444 | 440 | struct device_node *np = pdev->dev.of_node; |
---|
445 | | - int ret, index = np ? of_alias_get_id(np, "serial") : pdev->id; |
---|
446 | 441 | struct clps711x_port *s; |
---|
447 | 442 | struct resource *res; |
---|
448 | 443 | struct clk *uart_clk; |
---|
449 | | - int irq; |
---|
450 | | - |
---|
451 | | - if (index < 0 || index >= UART_CLPS711X_NR) |
---|
452 | | - return -EINVAL; |
---|
| 444 | + int irq, ret; |
---|
453 | 445 | |
---|
454 | 446 | s = devm_kzalloc(&pdev->dev, sizeof(*s), GFP_KERNEL); |
---|
455 | 447 | if (!s) |
---|
.. | .. |
---|
473 | 465 | if (s->rx_irq < 0) |
---|
474 | 466 | return s->rx_irq; |
---|
475 | 467 | |
---|
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); |
---|
478 | 471 | |
---|
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"); |
---|
490 | 473 | s->port.dev = &pdev->dev; |
---|
491 | 474 | s->port.iotype = UPIO_MEM32; |
---|
492 | 475 | s->port.mapbase = res->start; |
---|
493 | 476 | s->port.type = PORT_CLPS711X; |
---|
494 | 477 | s->port.fifosize = 16; |
---|
| 478 | + s->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_CLPS711X_CONSOLE); |
---|
495 | 479 | s->port.flags = UPF_SKIP_TEST | UPF_FIXED_TYPE; |
---|
496 | 480 | s->port.uartclk = clk_get_rate(uart_clk); |
---|
497 | 481 | s->port.ops = &uart_clps711x_ops; |
---|