aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKefeng Wang <wangkefeng.wang@huawei.com>2016-10-18 12:53:00 +0800
committerGraeme Gregory <graeme.gregory@linaro.org>2017-06-06 10:00:43 +0100
commit0d2d2a67c95fd4304dd00b935a6695131e9ab12b (patch)
treef2b96878117f906c7fd0c5913db095d7c65f2dea
parentaa6a05a8e11dc75328502e98204f6ea7ff597ada (diff)
downloadleg-kernel-0d2d2a67c95fd4304dd00b935a6695131e9ab12b.tar.gz
serial: 8250_hisi_lpc: fix panic without lpc node
When 8250_hisi_lpc enabled, but without relevant node in DT or ACPI, the iobase in struct uart_port is not initialized, so io_serial_out will fail and lead to panic. Fix this by check whether arm64_isa_pio is set or not, and only enable HISILICON_LPC in arm64. Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: Xinliang Liu <xinliang.liu@linaro.org>
-rw-r--r--drivers/bus/Kconfig2
-rw-r--r--drivers/tty/serial/8250/8250_hisi_lpc.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
index f252268be3a7..bee81816299c 100644
--- a/drivers/bus/Kconfig
+++ b/drivers/bus/Kconfig
@@ -94,7 +94,7 @@ config MVEBU_MBUS
config HISILICON_LPC
bool "Workaround for nonstandard ISA I/O space on Hisilicon Hip0X SoC"
- depends on ARCH_HISI || COMPILE_TEST
+ depends on (ARCH_HISI || COMPILE_TEST) && ARM64
select ARM64_INDIRECT_PIO
help
This driver support for some legacy driver that use the ISA I/O ports,
diff --git a/drivers/tty/serial/8250/8250_hisi_lpc.c b/drivers/tty/serial/8250/8250_hisi_lpc.c
index ff6e883e9bf4..eb596a484572 100644
--- a/drivers/tty/serial/8250/8250_hisi_lpc.c
+++ b/drivers/tty/serial/8250/8250_hisi_lpc.c
@@ -273,6 +273,11 @@ static struct platform_device hisi_lpc_uart = {
static int __init hisi_lpc_uart_init(void)
{
+ if (!arm64_isa_pio) {
+ pr_warn("no indirect ISA port I/O for Hisilicon LPC uart");
+ return -EINVAL;
+ }
+
return platform_device_register(&hisi_lpc_uart);
}