aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-03 12:01:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-03 12:01:02 -0400
commit49eb7b0750d9483c74e9c14ae6ea1e9d62481c3c (patch)
tree68f76b18328d070a4b5182f9ed82c2134cae16d2 /arch
parent5142c33ed86acbcef5c63a63d2b7384b9210d39f (diff)
parent9ce4f8f3f45443922c98e25133b8c9790fc7949a (diff)
Merge tag 'tty-3.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty into next
Pull tty/serial driver updates from Greg KH: "Here is the big tty / serial driver pull request for 3.16-rc1. A variety of different serial driver fixes and updates and additions, nothing huge, and no real major core tty changes at all. All have been in linux-next for a while" * tag 'tty-3.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (84 commits) Revert "serial: imx: remove the DMA wait queue" serial: kgdb_nmi: Improve console integration with KDB I/O serial: kgdb_nmi: Switch from tasklets to real timers serial: kgdb_nmi: Use container_of() to locate private data serial: cpm_uart: No LF conversion in put_poll_char() serial: sirf: Fix compilation failure console: Remove superfluous readonly check console: Use explicit pointer type for vc_uni_pagedir* fields vgacon: Fix & cleanup refcounting ARM: tty: Move HVC DCC assembly to arch/arm tty/hvc/hvc_console: Fix wakeup of HVC thread on hvc_kick() drivers/tty/n_hdlc.c: replace kmalloc/memset by kzalloc vt: emulate 8- and 24-bit colour codes. printk/of_serial: fix serial console cessation part way through boot. serial: 8250_dma: check the result of TX buffer mapping serial: uart: add hw flow control support configuration tty/serial: at91: add interrupts for modem control lines tty/serial: at91: use mctrl_gpio helpers tty/serial: Add GPIOLIB helpers for controlling modem lines ARM: at91: gpio: implement get_direction ...
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/dcc.h41
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c16
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c7
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c4
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c4
-rw-r--r--arch/arm/mach-at91/at91sam9g45_devices.c5
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c5
-rw-r--r--arch/arm/mach-at91/gpio.c13
-rw-r--r--arch/arm64/Kconfig3
-rw-r--r--arch/arm64/Kconfig.debug9
-rw-r--r--arch/arm64/kernel/Makefile1
-rw-r--r--arch/arm64/kernel/early_printk.c156
-rw-r--r--arch/x86/Kconfig3
13 files changed, 70 insertions, 197 deletions
diff --git a/arch/arm/include/asm/dcc.h b/arch/arm/include/asm/dcc.h
new file mode 100644
index 000000000000..b74899de0774
--- /dev/null
+++ b/arch/arm/include/asm/dcc.h
@@ -0,0 +1,41 @@
1/* Copyright (c) 2010, 2014 The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#include <asm/barrier.h>
14
15static inline u32 __dcc_getstatus(void)
16{
17 u32 __ret;
18 asm volatile("mrc p14, 0, %0, c0, c1, 0 @ read comms ctrl reg"
19 : "=r" (__ret) : : "cc");
20
21 return __ret;
22}
23
24static inline char __dcc_getchar(void)
25{
26 char __c;
27
28 asm volatile("mrc p14, 0, %0, c0, c5, 0 @ read comms data reg"
29 : "=r" (__c));
30 isb();
31
32 return __c;
33}
34
35static inline void __dcc_putchar(char c)
36{
37 asm volatile("mcr p14, 0, %0, c0, c5, 0 @ write a char"
38 : /* no output register */
39 : "r" (c));
40 isb();
41}
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 4860918b411e..3f4bb58aea54 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -15,6 +15,7 @@
15 15
16#include <linux/dma-mapping.h> 16#include <linux/dma-mapping.h>
17#include <linux/gpio.h> 17#include <linux/gpio.h>
18#include <linux/gpio/driver.h>
18#include <linux/platform_device.h> 19#include <linux/platform_device.h>
19#include <linux/i2c-gpio.h> 20#include <linux/i2c-gpio.h>
20 21
@@ -924,7 +925,6 @@ static struct resource dbgu_resources[] = {
924static struct atmel_uart_data dbgu_data = { 925static struct atmel_uart_data dbgu_data = {
925 .use_dma_tx = 0, 926 .use_dma_tx = 0,
926 .use_dma_rx = 0, /* DBGU not capable of receive DMA */ 927 .use_dma_rx = 0, /* DBGU not capable of receive DMA */
927 .rts_gpio = -EINVAL,
928}; 928};
929 929
930static u64 dbgu_dmamask = DMA_BIT_MASK(32); 930static u64 dbgu_dmamask = DMA_BIT_MASK(32);
@@ -963,7 +963,14 @@ static struct resource uart0_resources[] = {
963static struct atmel_uart_data uart0_data = { 963static struct atmel_uart_data uart0_data = {
964 .use_dma_tx = 1, 964 .use_dma_tx = 1,
965 .use_dma_rx = 1, 965 .use_dma_rx = 1,
966 .rts_gpio = -EINVAL, 966};
967
968static struct gpiod_lookup_table uart0_gpios_table = {
969 .dev_id = "atmel_usart",
970 .table = {
971 GPIO_LOOKUP("pioA", 21, "rts", GPIO_ACTIVE_LOW),
972 { },
973 },
967}; 974};
968 975
969static u64 uart0_dmamask = DMA_BIT_MASK(32); 976static u64 uart0_dmamask = DMA_BIT_MASK(32);
@@ -994,7 +1001,7 @@ static inline void configure_usart0_pins(unsigned pins)
994 * We need to drive the pin manually. The serial driver will driver 1001 * We need to drive the pin manually. The serial driver will driver
995 * this to high when initializing. 1002 * this to high when initializing.
996 */ 1003 */
997 uart0_data.rts_gpio = AT91_PIN_PA21; 1004 gpiod_add_lookup_table(&uart0_gpios_table);
998 } 1005 }
999} 1006}
1000 1007
@@ -1014,7 +1021,6 @@ static struct resource uart1_resources[] = {
1014static struct atmel_uart_data uart1_data = { 1021static struct atmel_uart_data uart1_data = {
1015 .use_dma_tx = 1, 1022 .use_dma_tx = 1,
1016 .use_dma_rx = 1, 1023 .use_dma_rx = 1,
1017 .rts_gpio = -EINVAL,
1018}; 1024};
1019 1025
1020static u64 uart1_dmamask = DMA_BIT_MASK(32); 1026static u64 uart1_dmamask = DMA_BIT_MASK(32);
@@ -1066,7 +1072,6 @@ static struct resource uart2_resources[] = {
1066static struct atmel_uart_data uart2_data = { 1072static struct atmel_uart_data uart2_data = {
1067 .use_dma_tx = 1, 1073 .use_dma_tx = 1,
1068 .use_dma_rx = 1, 1074 .use_dma_rx = 1,
1069 .rts_gpio = -EINVAL,
1070}; 1075};
1071 1076
1072static u64 uart2_dmamask = DMA_BIT_MASK(32); 1077static u64 uart2_dmamask = DMA_BIT_MASK(32);
@@ -1110,7 +1115,6 @@ static struct resource uart3_resources[] = {
1110static struct atmel_uart_data uart3_data = { 1115static struct atmel_uart_data uart3_data = {
1111 .use_dma_tx = 1, 1116 .use_dma_tx = 1,
1112 .use_dma_rx = 1, 1117 .use_dma_rx = 1,
1113 .rts_gpio = -EINVAL,
1114}; 1118};
1115 1119
1116static u64 uart3_dmamask = DMA_BIT_MASK(32); 1120static u64 uart3_dmamask = DMA_BIT_MASK(32);
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index adcfb88a5d7d..ef88e0fe4e80 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -819,7 +819,6 @@ static struct resource dbgu_resources[] = {
819static struct atmel_uart_data dbgu_data = { 819static struct atmel_uart_data dbgu_data = {
820 .use_dma_tx = 0, 820 .use_dma_tx = 0,
821 .use_dma_rx = 0, /* DBGU not capable of receive DMA */ 821 .use_dma_rx = 0, /* DBGU not capable of receive DMA */
822 .rts_gpio = -EINVAL,
823}; 822};
824 823
825static u64 dbgu_dmamask = DMA_BIT_MASK(32); 824static u64 dbgu_dmamask = DMA_BIT_MASK(32);
@@ -858,7 +857,6 @@ static struct resource uart0_resources[] = {
858static struct atmel_uart_data uart0_data = { 857static struct atmel_uart_data uart0_data = {
859 .use_dma_tx = 1, 858 .use_dma_tx = 1,
860 .use_dma_rx = 1, 859 .use_dma_rx = 1,
861 .rts_gpio = -EINVAL,
862}; 860};
863 861
864static u64 uart0_dmamask = DMA_BIT_MASK(32); 862static u64 uart0_dmamask = DMA_BIT_MASK(32);
@@ -910,7 +908,6 @@ static struct resource uart1_resources[] = {
910static struct atmel_uart_data uart1_data = { 908static struct atmel_uart_data uart1_data = {
911 .use_dma_tx = 1, 909 .use_dma_tx = 1,
912 .use_dma_rx = 1, 910 .use_dma_rx = 1,
913 .rts_gpio = -EINVAL,
914}; 911};
915 912
916static u64 uart1_dmamask = DMA_BIT_MASK(32); 913static u64 uart1_dmamask = DMA_BIT_MASK(32);
@@ -954,7 +951,6 @@ static struct resource uart2_resources[] = {
954static struct atmel_uart_data uart2_data = { 951static struct atmel_uart_data uart2_data = {
955 .use_dma_tx = 1, 952 .use_dma_tx = 1,
956 .use_dma_rx = 1, 953 .use_dma_rx = 1,
957 .rts_gpio = -EINVAL,
958}; 954};
959 955
960static u64 uart2_dmamask = DMA_BIT_MASK(32); 956static u64 uart2_dmamask = DMA_BIT_MASK(32);
@@ -998,7 +994,6 @@ static struct resource uart3_resources[] = {
998static struct atmel_uart_data uart3_data = { 994static struct atmel_uart_data uart3_data = {
999 .use_dma_tx = 1, 995 .use_dma_tx = 1,
1000 .use_dma_rx = 1, 996 .use_dma_rx = 1,
1001 .rts_gpio = -EINVAL,
1002}; 997};
1003 998
1004static u64 uart3_dmamask = DMA_BIT_MASK(32); 999static u64 uart3_dmamask = DMA_BIT_MASK(32);
@@ -1042,7 +1037,6 @@ static struct resource uart4_resources[] = {
1042static struct atmel_uart_data uart4_data = { 1037static struct atmel_uart_data uart4_data = {
1043 .use_dma_tx = 1, 1038 .use_dma_tx = 1,
1044 .use_dma_rx = 1, 1039 .use_dma_rx = 1,
1045 .rts_gpio = -EINVAL,
1046}; 1040};
1047 1041
1048static u64 uart4_dmamask = DMA_BIT_MASK(32); 1042static u64 uart4_dmamask = DMA_BIT_MASK(32);
@@ -1081,7 +1075,6 @@ static struct resource uart5_resources[] = {
1081static struct atmel_uart_data uart5_data = { 1075static struct atmel_uart_data uart5_data = {
1082 .use_dma_tx = 1, 1076 .use_dma_tx = 1,
1083 .use_dma_rx = 1, 1077 .use_dma_rx = 1,
1084 .rts_gpio = -EINVAL,
1085}; 1078};
1086 1079
1087static u64 uart5_dmamask = DMA_BIT_MASK(32); 1080static u64 uart5_dmamask = DMA_BIT_MASK(32);
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 43b21f456f6e..29baacb5c359 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -881,7 +881,6 @@ static struct resource dbgu_resources[] = {
881static struct atmel_uart_data dbgu_data = { 881static struct atmel_uart_data dbgu_data = {
882 .use_dma_tx = 0, 882 .use_dma_tx = 0,
883 .use_dma_rx = 0, /* DBGU not capable of receive DMA */ 883 .use_dma_rx = 0, /* DBGU not capable of receive DMA */
884 .rts_gpio = -EINVAL,
885}; 884};
886 885
887static u64 dbgu_dmamask = DMA_BIT_MASK(32); 886static u64 dbgu_dmamask = DMA_BIT_MASK(32);
@@ -920,7 +919,6 @@ static struct resource uart0_resources[] = {
920static struct atmel_uart_data uart0_data = { 919static struct atmel_uart_data uart0_data = {
921 .use_dma_tx = 1, 920 .use_dma_tx = 1,
922 .use_dma_rx = 1, 921 .use_dma_rx = 1,
923 .rts_gpio = -EINVAL,
924}; 922};
925 923
926static u64 uart0_dmamask = DMA_BIT_MASK(32); 924static u64 uart0_dmamask = DMA_BIT_MASK(32);
@@ -964,7 +962,6 @@ static struct resource uart1_resources[] = {
964static struct atmel_uart_data uart1_data = { 962static struct atmel_uart_data uart1_data = {
965 .use_dma_tx = 1, 963 .use_dma_tx = 1,
966 .use_dma_rx = 1, 964 .use_dma_rx = 1,
967 .rts_gpio = -EINVAL,
968}; 965};
969 966
970static u64 uart1_dmamask = DMA_BIT_MASK(32); 967static u64 uart1_dmamask = DMA_BIT_MASK(32);
@@ -1008,7 +1005,6 @@ static struct resource uart2_resources[] = {
1008static struct atmel_uart_data uart2_data = { 1005static struct atmel_uart_data uart2_data = {
1009 .use_dma_tx = 1, 1006 .use_dma_tx = 1,
1010 .use_dma_rx = 1, 1007 .use_dma_rx = 1,
1011 .rts_gpio = -EINVAL,
1012}; 1008};
1013 1009
1014static u64 uart2_dmamask = DMA_BIT_MASK(32); 1010static u64 uart2_dmamask = DMA_BIT_MASK(32);
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 953616e5dbcb..309390d8e2f8 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -1326,7 +1326,6 @@ static struct resource dbgu_resources[] = {
1326static struct atmel_uart_data dbgu_data = { 1326static struct atmel_uart_data dbgu_data = {
1327 .use_dma_tx = 0, 1327 .use_dma_tx = 0,
1328 .use_dma_rx = 0, /* DBGU not capable of receive DMA */ 1328 .use_dma_rx = 0, /* DBGU not capable of receive DMA */
1329 .rts_gpio = -EINVAL,
1330}; 1329};
1331 1330
1332static u64 dbgu_dmamask = DMA_BIT_MASK(32); 1331static u64 dbgu_dmamask = DMA_BIT_MASK(32);
@@ -1365,7 +1364,6 @@ static struct resource uart0_resources[] = {
1365static struct atmel_uart_data uart0_data = { 1364static struct atmel_uart_data uart0_data = {
1366 .use_dma_tx = 1, 1365 .use_dma_tx = 1,
1367 .use_dma_rx = 1, 1366 .use_dma_rx = 1,
1368 .rts_gpio = -EINVAL,
1369}; 1367};
1370 1368
1371static u64 uart0_dmamask = DMA_BIT_MASK(32); 1369static u64 uart0_dmamask = DMA_BIT_MASK(32);
@@ -1409,7 +1407,6 @@ static struct resource uart1_resources[] = {
1409static struct atmel_uart_data uart1_data = { 1407static struct atmel_uart_data uart1_data = {
1410 .use_dma_tx = 1, 1408 .use_dma_tx = 1,
1411 .use_dma_rx = 1, 1409 .use_dma_rx = 1,
1412 .rts_gpio = -EINVAL,
1413}; 1410};
1414 1411
1415static u64 uart1_dmamask = DMA_BIT_MASK(32); 1412static u64 uart1_dmamask = DMA_BIT_MASK(32);
@@ -1453,7 +1450,6 @@ static struct resource uart2_resources[] = {
1453static struct atmel_uart_data uart2_data = { 1450static struct atmel_uart_data uart2_data = {
1454 .use_dma_tx = 1, 1451 .use_dma_tx = 1,
1455 .use_dma_rx = 1, 1452 .use_dma_rx = 1,
1456 .rts_gpio = -EINVAL,
1457}; 1453};
1458 1454
1459static u64 uart2_dmamask = DMA_BIT_MASK(32); 1455static u64 uart2_dmamask = DMA_BIT_MASK(32);
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index d943363c1845..391ab6bb536a 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -1528,7 +1528,6 @@ static struct resource dbgu_resources[] = {
1528static struct atmel_uart_data dbgu_data = { 1528static struct atmel_uart_data dbgu_data = {
1529 .use_dma_tx = 0, 1529 .use_dma_tx = 0,
1530 .use_dma_rx = 0, 1530 .use_dma_rx = 0,
1531 .rts_gpio = -EINVAL,
1532}; 1531};
1533 1532
1534static u64 dbgu_dmamask = DMA_BIT_MASK(32); 1533static u64 dbgu_dmamask = DMA_BIT_MASK(32);
@@ -1567,7 +1566,6 @@ static struct resource uart0_resources[] = {
1567static struct atmel_uart_data uart0_data = { 1566static struct atmel_uart_data uart0_data = {
1568 .use_dma_tx = 1, 1567 .use_dma_tx = 1,
1569 .use_dma_rx = 1, 1568 .use_dma_rx = 1,
1570 .rts_gpio = -EINVAL,
1571}; 1569};
1572 1570
1573static u64 uart0_dmamask = DMA_BIT_MASK(32); 1571static u64 uart0_dmamask = DMA_BIT_MASK(32);
@@ -1611,7 +1609,6 @@ static struct resource uart1_resources[] = {
1611static struct atmel_uart_data uart1_data = { 1609static struct atmel_uart_data uart1_data = {
1612 .use_dma_tx = 1, 1610 .use_dma_tx = 1,
1613 .use_dma_rx = 1, 1611 .use_dma_rx = 1,
1614 .rts_gpio = -EINVAL,
1615}; 1612};
1616 1613
1617static u64 uart1_dmamask = DMA_BIT_MASK(32); 1614static u64 uart1_dmamask = DMA_BIT_MASK(32);
@@ -1655,7 +1652,6 @@ static struct resource uart2_resources[] = {
1655static struct atmel_uart_data uart2_data = { 1652static struct atmel_uart_data uart2_data = {
1656 .use_dma_tx = 1, 1653 .use_dma_tx = 1,
1657 .use_dma_rx = 1, 1654 .use_dma_rx = 1,
1658 .rts_gpio = -EINVAL,
1659}; 1655};
1660 1656
1661static u64 uart2_dmamask = DMA_BIT_MASK(32); 1657static u64 uart2_dmamask = DMA_BIT_MASK(32);
@@ -1699,7 +1695,6 @@ static struct resource uart3_resources[] = {
1699static struct atmel_uart_data uart3_data = { 1695static struct atmel_uart_data uart3_data = {
1700 .use_dma_tx = 1, 1696 .use_dma_tx = 1,
1701 .use_dma_rx = 1, 1697 .use_dma_rx = 1,
1702 .rts_gpio = -EINVAL,
1703}; 1698};
1704 1699
1705static u64 uart3_dmamask = DMA_BIT_MASK(32); 1700static u64 uart3_dmamask = DMA_BIT_MASK(32);
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 044ad8bc6963..0b1d71a7d9bf 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -993,7 +993,6 @@ static struct resource dbgu_resources[] = {
993static struct atmel_uart_data dbgu_data = { 993static struct atmel_uart_data dbgu_data = {
994 .use_dma_tx = 0, 994 .use_dma_tx = 0,
995 .use_dma_rx = 0, /* DBGU not capable of receive DMA */ 995 .use_dma_rx = 0, /* DBGU not capable of receive DMA */
996 .rts_gpio = -EINVAL,
997}; 996};
998 997
999static u64 dbgu_dmamask = DMA_BIT_MASK(32); 998static u64 dbgu_dmamask = DMA_BIT_MASK(32);
@@ -1032,7 +1031,6 @@ static struct resource uart0_resources[] = {
1032static struct atmel_uart_data uart0_data = { 1031static struct atmel_uart_data uart0_data = {
1033 .use_dma_tx = 1, 1032 .use_dma_tx = 1,
1034 .use_dma_rx = 1, 1033 .use_dma_rx = 1,
1035 .rts_gpio = -EINVAL,
1036}; 1034};
1037 1035
1038static u64 uart0_dmamask = DMA_BIT_MASK(32); 1036static u64 uart0_dmamask = DMA_BIT_MASK(32);
@@ -1084,7 +1082,6 @@ static struct resource uart1_resources[] = {
1084static struct atmel_uart_data uart1_data = { 1082static struct atmel_uart_data uart1_data = {
1085 .use_dma_tx = 1, 1083 .use_dma_tx = 1,
1086 .use_dma_rx = 1, 1084 .use_dma_rx = 1,
1087 .rts_gpio = -EINVAL,
1088}; 1085};
1089 1086
1090static u64 uart1_dmamask = DMA_BIT_MASK(32); 1087static u64 uart1_dmamask = DMA_BIT_MASK(32);
@@ -1128,7 +1125,6 @@ static struct resource uart2_resources[] = {
1128static struct atmel_uart_data uart2_data = { 1125static struct atmel_uart_data uart2_data = {
1129 .use_dma_tx = 1, 1126 .use_dma_tx = 1,
1130 .use_dma_rx = 1, 1127 .use_dma_rx = 1,
1131 .rts_gpio = -EINVAL,
1132}; 1128};
1133 1129
1134static u64 uart2_dmamask = DMA_BIT_MASK(32); 1130static u64 uart2_dmamask = DMA_BIT_MASK(32);
@@ -1172,7 +1168,6 @@ static struct resource uart3_resources[] = {
1172static struct atmel_uart_data uart3_data = { 1168static struct atmel_uart_data uart3_data = {
1173 .use_dma_tx = 1, 1169 .use_dma_tx = 1,
1174 .use_dma_rx = 1, 1170 .use_dma_rx = 1,
1175 .rts_gpio = -EINVAL,
1176}; 1171};
1177 1172
1178static u64 uart3_dmamask = DMA_BIT_MASK(32); 1173static u64 uart3_dmamask = DMA_BIT_MASK(32);
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index 12ed05bbdc5c..d3f05aaad8ba 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -50,6 +50,7 @@ static int at91_gpiolib_request(struct gpio_chip *chip, unsigned offset);
50static void at91_gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip); 50static void at91_gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip);
51static void at91_gpiolib_set(struct gpio_chip *chip, unsigned offset, int val); 51static void at91_gpiolib_set(struct gpio_chip *chip, unsigned offset, int val);
52static int at91_gpiolib_get(struct gpio_chip *chip, unsigned offset); 52static int at91_gpiolib_get(struct gpio_chip *chip, unsigned offset);
53static int at91_gpiolib_get_direction(struct gpio_chip *chip, unsigned offset);
53static int at91_gpiolib_direction_output(struct gpio_chip *chip, 54static int at91_gpiolib_direction_output(struct gpio_chip *chip,
54 unsigned offset, int val); 55 unsigned offset, int val);
55static int at91_gpiolib_direction_input(struct gpio_chip *chip, 56static int at91_gpiolib_direction_input(struct gpio_chip *chip,
@@ -61,6 +62,7 @@ static int at91_gpiolib_to_irq(struct gpio_chip *chip, unsigned offset);
61 .chip = { \ 62 .chip = { \
62 .label = name, \ 63 .label = name, \
63 .request = at91_gpiolib_request, \ 64 .request = at91_gpiolib_request, \
65 .get_direction = at91_gpiolib_get_direction, \
64 .direction_input = at91_gpiolib_direction_input, \ 66 .direction_input = at91_gpiolib_direction_input, \
65 .direction_output = at91_gpiolib_direction_output, \ 67 .direction_output = at91_gpiolib_direction_output, \
66 .get = at91_gpiolib_get, \ 68 .get = at91_gpiolib_get, \
@@ -800,6 +802,17 @@ static int at91_gpiolib_request(struct gpio_chip *chip, unsigned offset)
800 return 0; 802 return 0;
801} 803}
802 804
805static int at91_gpiolib_get_direction(struct gpio_chip *chip, unsigned offset)
806{
807 struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip);
808 void __iomem *pio = at91_gpio->regbase;
809 unsigned mask = 1 << offset;
810 u32 osr;
811
812 osr = __raw_readl(pio + PIO_OSR);
813 return !(osr & mask);
814}
815
803static int at91_gpiolib_direction_input(struct gpio_chip *chip, 816static int at91_gpiolib_direction_input(struct gpio_chip *chip,
804 unsigned offset) 817 unsigned offset)
805{ 818{
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index e759af5d7098..f5f63b715d91 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -112,6 +112,9 @@ config IOMMU_HELPER
112config KERNEL_MODE_NEON 112config KERNEL_MODE_NEON
113 def_bool y 113 def_bool y
114 114
115config FIX_EARLYCON_MEM
116 def_bool y
117
115source "init/Kconfig" 118source "init/Kconfig"
116 119
117source "kernel/Kconfig.freezer" 120source "kernel/Kconfig.freezer"
diff --git a/arch/arm64/Kconfig.debug b/arch/arm64/Kconfig.debug
index d10ec334c93b..1c1b75629842 100644
--- a/arch/arm64/Kconfig.debug
+++ b/arch/arm64/Kconfig.debug
@@ -20,15 +20,6 @@ config STRICT_DEVMEM
20 20
21 If in doubt, say Y. 21 If in doubt, say Y.
22 22
23config EARLY_PRINTK
24 bool "Early printk support"
25 default y
26 help
27 Say Y here if you want to have an early console using the
28 earlyprintk=<name>[,<addr>][,<options>] kernel parameter. It
29 is assumed that the early console device has been initialised
30 by the boot loader prior to starting the Linux kernel.
31
32config PID_IN_CONTEXTIDR 23config PID_IN_CONTEXTIDR
33 bool "Write the current PID to the CONTEXTIDR register" 24 bool "Write the current PID to the CONTEXTIDR register"
34 help 25 help
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index 7d811d9522bc..7a6fce5167e9 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -18,7 +18,6 @@ arm64-obj-$(CONFIG_SMP) += smp.o smp_spin_table.o topology.o
18arm64-obj-$(CONFIG_PERF_EVENTS) += perf_regs.o 18arm64-obj-$(CONFIG_PERF_EVENTS) += perf_regs.o
19arm64-obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o 19arm64-obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o
20arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o 20arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
21arm64-obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
22arm64-obj-$(CONFIG_ARM64_CPU_SUSPEND) += sleep.o suspend.o 21arm64-obj-$(CONFIG_ARM64_CPU_SUSPEND) += sleep.o suspend.o
23arm64-obj-$(CONFIG_JUMP_LABEL) += jump_label.o 22arm64-obj-$(CONFIG_JUMP_LABEL) += jump_label.o
24arm64-obj-$(CONFIG_KGDB) += kgdb.o 23arm64-obj-$(CONFIG_KGDB) += kgdb.o
diff --git a/arch/arm64/kernel/early_printk.c b/arch/arm64/kernel/early_printk.c
deleted file mode 100644
index 2dc36d00addf..000000000000
--- a/arch/arm64/kernel/early_printk.c
+++ /dev/null
@@ -1,156 +0,0 @@
1/*
2 * Earlyprintk support.
3 *
4 * Copyright (C) 2012 ARM Ltd.
5 * Author: Catalin Marinas <catalin.marinas@arm.com>
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19#include <linux/kernel.h>
20#include <linux/console.h>
21#include <linux/init.h>
22#include <linux/string.h>
23#include <linux/mm.h>
24#include <linux/io.h>
25
26#include <linux/amba/serial.h>
27#include <linux/serial_reg.h>
28
29#include <asm/fixmap.h>
30
31static void __iomem *early_base;
32static void (*printch)(char ch);
33
34/*
35 * PL011 single character TX.
36 */
37static void pl011_printch(char ch)
38{
39 while (readl_relaxed(early_base + UART01x_FR) & UART01x_FR_TXFF)
40 ;
41 writeb_relaxed(ch, early_base + UART01x_DR);
42 while (readl_relaxed(early_base + UART01x_FR) & UART01x_FR_BUSY)
43 ;
44}
45
46/*
47 * Semihosting-based debug console
48 */
49static void smh_printch(char ch)
50{
51 asm volatile("mov x1, %0\n"
52 "mov x0, #3\n"
53 "hlt 0xf000\n"
54 : : "r" (&ch) : "x0", "x1", "memory");
55}
56
57/*
58 * 8250/16550 (8-bit aligned registers) single character TX.
59 */
60static void uart8250_8bit_printch(char ch)
61{
62 while (!(readb_relaxed(early_base + UART_LSR) & UART_LSR_THRE))
63 ;
64 writeb_relaxed(ch, early_base + UART_TX);
65}
66
67/*
68 * 8250/16550 (32-bit aligned registers) single character TX.
69 */
70static void uart8250_32bit_printch(char ch)
71{
72 while (!(readl_relaxed(early_base + (UART_LSR << 2)) & UART_LSR_THRE))
73 ;
74 writel_relaxed(ch, early_base + (UART_TX << 2));
75}
76
77struct earlycon_match {
78 const char *name;
79 void (*printch)(char ch);
80};
81
82static const struct earlycon_match earlycon_match[] __initconst = {
83 { .name = "pl011", .printch = pl011_printch, },
84 { .name = "smh", .printch = smh_printch, },
85 { .name = "uart8250-8bit", .printch = uart8250_8bit_printch, },
86 { .name = "uart8250-32bit", .printch = uart8250_32bit_printch, },
87 {}
88};
89
90static void early_write(struct console *con, const char *s, unsigned n)
91{
92 while (n-- > 0) {
93 if (*s == '\n')
94 printch('\r');
95 printch(*s);
96 s++;
97 }
98}
99
100static struct console early_console_dev = {
101 .name = "earlycon",
102 .write = early_write,
103 .flags = CON_PRINTBUFFER | CON_BOOT,
104 .index = -1,
105};
106
107/*
108 * Parse earlyprintk=... parameter in the format:
109 *
110 * <name>[,<addr>][,<options>]
111 *
112 * and register the early console. It is assumed that the UART has been
113 * initialised by the bootloader already.
114 */
115static int __init setup_early_printk(char *buf)
116{
117 const struct earlycon_match *match = earlycon_match;
118 phys_addr_t paddr = 0;
119
120 if (!buf) {
121 pr_warning("No earlyprintk arguments passed.\n");
122 return 0;
123 }
124
125 while (match->name) {
126 size_t len = strlen(match->name);
127 if (!strncmp(buf, match->name, len)) {
128 buf += len;
129 break;
130 }
131 match++;
132 }
133 if (!match->name) {
134 pr_warning("Unknown earlyprintk arguments: %s\n", buf);
135 return 0;
136 }
137
138 /* I/O address */
139 if (!strncmp(buf, ",0x", 3)) {
140 char *e;
141 paddr = simple_strtoul(buf + 1, &e, 16);
142 buf = e;
143 }
144 /* no options parsing yet */
145
146 if (paddr)
147 early_base = (void __iomem *)set_fixmap_offset_io(FIX_EARLYCON_MEM_BASE, paddr);
148
149 printch = match->printch;
150 early_console = &early_console_dev;
151 register_console(&early_console_dev);
152
153 return 0;
154}
155
156early_param("earlyprintk", setup_early_printk);
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 9c43ea3cf510..650433ab184f 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -261,6 +261,9 @@ config ARCH_HWEIGHT_CFLAGS
261config ARCH_SUPPORTS_UPROBES 261config ARCH_SUPPORTS_UPROBES
262 def_bool y 262 def_bool y
263 263
264config FIX_EARLYCON_MEM
265 def_bool y
266
264source "init/Kconfig" 267source "init/Kconfig"
265source "kernel/Kconfig.freezer" 268source "kernel/Kconfig.freezer"
266 269