@@ -2949,6 +2949,7 @@ static void wr_reg_barrier(struct uart_port *port, u32 reg, u32 val)
2949
2949
2950
2950
struct samsung_early_console_data {
2951
2951
u32 txfull_mask ;
2952
+ u32 rxfifo_mask ;
2952
2953
};
2953
2954
2954
2955
static void samsung_early_busyuart (struct uart_port * port )
@@ -2983,19 +2984,41 @@ static void samsung_early_write(struct console *con, const char *s,
2983
2984
uart_console_write (& dev -> port , s , n , samsung_early_putc );
2984
2985
}
2985
2986
2987
+ static int samsung_early_read (struct console * con , char * s , unsigned int n )
2988
+ {
2989
+ struct earlycon_device * dev = con -> data ;
2990
+ const struct samsung_early_console_data * data = dev -> port .private_data ;
2991
+ int ch , ufstat , num_read = 0 ;
2992
+
2993
+ while (num_read < n ) {
2994
+ ufstat = rd_regl (& dev -> port , S3C2410_UFSTAT );
2995
+ if (!(ufstat & data -> rxfifo_mask ))
2996
+ break ;
2997
+ ch = rd_reg (& dev -> port , S3C2410_URXH );
2998
+ if (ch == NO_POLL_CHAR )
2999
+ break ;
3000
+
3001
+ s [num_read ++ ] = ch ;
3002
+ }
3003
+
3004
+ return num_read ;
3005
+ }
3006
+
2986
3007
static int __init samsung_early_console_setup (struct earlycon_device * device ,
2987
3008
const char * opt )
2988
3009
{
2989
3010
if (!device -> port .membase )
2990
3011
return - ENODEV ;
2991
3012
2992
3013
device -> con -> write = samsung_early_write ;
3014
+ device -> con -> read = samsung_early_read ;
2993
3015
return 0 ;
2994
3016
}
2995
3017
2996
3018
/* S3C2410 */
2997
3019
static struct samsung_early_console_data s3c2410_early_console_data = {
2998
3020
.txfull_mask = S3C2410_UFSTAT_TXFULL ,
3021
+ .rxfifo_mask = S3C2410_UFSTAT_RXFULL | S3C2410_UFSTAT_RXMASK ,
2999
3022
};
3000
3023
3001
3024
static int __init s3c2410_early_console_setup (struct earlycon_device * device ,
@@ -3011,6 +3034,7 @@ OF_EARLYCON_DECLARE(s3c2410, "samsung,s3c2410-uart",
3011
3034
/* S3C2412, S3C2440, S3C64xx */
3012
3035
static struct samsung_early_console_data s3c2440_early_console_data = {
3013
3036
.txfull_mask = S3C2440_UFSTAT_TXFULL ,
3037
+ .rxfifo_mask = S3C2440_UFSTAT_RXFULL | S3C2440_UFSTAT_RXMASK ,
3014
3038
};
3015
3039
3016
3040
static int __init s3c2440_early_console_setup (struct earlycon_device * device ,
@@ -3030,6 +3054,7 @@ OF_EARLYCON_DECLARE(s3c6400, "samsung,s3c6400-uart",
3030
3054
/* S5PV210, Exynos */
3031
3055
static struct samsung_early_console_data s5pv210_early_console_data = {
3032
3056
.txfull_mask = S5PV210_UFSTAT_TXFULL ,
3057
+ .rxfifo_mask = S5PV210_UFSTAT_RXFULL | S5PV210_UFSTAT_RXMASK ,
3033
3058
};
3034
3059
3035
3060
static int __init s5pv210_early_console_setup (struct earlycon_device * device ,
0 commit comments