@@ -550,6 +550,7 @@ static void s3c24xx_serial_stop_rx(struct uart_port *port)
550550 case TYPE_APPLE_S5L :
551551 s3c24xx_clear_bit (port , APPLE_S5L_UCON_RXTHRESH_ENA , S3C2410_UCON );
552552 s3c24xx_clear_bit (port , APPLE_S5L_UCON_RXTO_ENA , S3C2410_UCON );
553+ s3c24xx_clear_bit (port , APPLE_S5L_UCON_RXTO_LEGACY_ENA , S3C2410_UCON );
553554 break ;
554555 default :
555556 disable_irq_nosync (ourport -> rx_irq );
@@ -707,9 +708,8 @@ static void enable_rx_pio(struct s3c24xx_uart_port *ourport)
707708
708709static void s3c24xx_serial_rx_drain_fifo (struct s3c24xx_uart_port * ourport );
709710
710- static irqreturn_t s3c24xx_serial_rx_chars_dma (void * dev_id )
711+ static irqreturn_t s3c24xx_serial_rx_chars_dma (struct s3c24xx_uart_port * ourport )
711712{
712- struct s3c24xx_uart_port * ourport = dev_id ;
713713 struct uart_port * port = & ourport -> port ;
714714 struct s3c24xx_uart_dma * dma = ourport -> dma ;
715715 struct tty_struct * tty = tty_port_tty_get (& ourport -> port .state -> port );
@@ -843,9 +843,8 @@ static void s3c24xx_serial_rx_drain_fifo(struct s3c24xx_uart_port *ourport)
843843 tty_flip_buffer_push (& port -> state -> port );
844844}
845845
846- static irqreturn_t s3c24xx_serial_rx_chars_pio (void * dev_id )
846+ static irqreturn_t s3c24xx_serial_rx_chars_pio (struct s3c24xx_uart_port * ourport )
847847{
848- struct s3c24xx_uart_port * ourport = dev_id ;
849848 struct uart_port * port = & ourport -> port ;
850849
851850 uart_port_lock (port );
@@ -855,13 +854,11 @@ static irqreturn_t s3c24xx_serial_rx_chars_pio(void *dev_id)
855854 return IRQ_HANDLED ;
856855}
857856
858- static irqreturn_t s3c24xx_serial_rx_irq (int irq , void * dev_id )
857+ static irqreturn_t s3c24xx_serial_rx_irq (struct s3c24xx_uart_port * ourport )
859858{
860- struct s3c24xx_uart_port * ourport = dev_id ;
861-
862859 if (ourport -> dma && ourport -> dma -> rx_chan )
863- return s3c24xx_serial_rx_chars_dma (dev_id );
864- return s3c24xx_serial_rx_chars_pio (dev_id );
860+ return s3c24xx_serial_rx_chars_dma (ourport );
861+ return s3c24xx_serial_rx_chars_pio (ourport );
865862}
866863
867864static void s3c24xx_serial_tx_chars (struct s3c24xx_uart_port * ourport )
@@ -928,9 +925,8 @@ static void s3c24xx_serial_tx_chars(struct s3c24xx_uart_port *ourport)
928925 s3c24xx_serial_stop_tx (port );
929926}
930927
931- static irqreturn_t s3c24xx_serial_tx_irq (int irq , void * id )
928+ static irqreturn_t s3c24xx_serial_tx_irq (struct s3c24xx_uart_port * ourport )
932929{
933- struct s3c24xx_uart_port * ourport = id ;
934930 struct uart_port * port = & ourport -> port ;
935931
936932 uart_port_lock (port );
@@ -944,17 +940,17 @@ static irqreturn_t s3c24xx_serial_tx_irq(int irq, void *id)
944940/* interrupt handler for s3c64xx and later SoC's.*/
945941static irqreturn_t s3c64xx_serial_handle_irq (int irq , void * id )
946942{
947- const struct s3c24xx_uart_port * ourport = id ;
943+ struct s3c24xx_uart_port * ourport = id ;
948944 const struct uart_port * port = & ourport -> port ;
949945 u32 pend = rd_regl (port , S3C64XX_UINTP );
950946 irqreturn_t ret = IRQ_HANDLED ;
951947
952948 if (pend & S3C64XX_UINTM_RXD_MSK ) {
953- ret = s3c24xx_serial_rx_irq (irq , id );
949+ ret = s3c24xx_serial_rx_irq (ourport );
954950 wr_regl (port , S3C64XX_UINTP , S3C64XX_UINTM_RXD_MSK );
955951 }
956952 if (pend & S3C64XX_UINTM_TXD_MSK ) {
957- ret = s3c24xx_serial_tx_irq (irq , id );
953+ ret = s3c24xx_serial_tx_irq (ourport );
958954 wr_regl (port , S3C64XX_UINTP , S3C64XX_UINTM_TXD_MSK );
959955 }
960956 return ret ;
@@ -963,19 +959,21 @@ static irqreturn_t s3c64xx_serial_handle_irq(int irq, void *id)
963959/* interrupt handler for Apple SoC's.*/
964960static irqreturn_t apple_serial_handle_irq (int irq , void * id )
965961{
966- const struct s3c24xx_uart_port * ourport = id ;
962+ struct s3c24xx_uart_port * ourport = id ;
967963 const struct uart_port * port = & ourport -> port ;
968964 u32 pend = rd_regl (port , S3C2410_UTRSTAT );
969965 irqreturn_t ret = IRQ_NONE ;
970966
971- if (pend & (APPLE_S5L_UTRSTAT_RXTHRESH | APPLE_S5L_UTRSTAT_RXTO )) {
967+ if (pend & (APPLE_S5L_UTRSTAT_RXTHRESH | APPLE_S5L_UTRSTAT_RXTO |
968+ APPLE_S5L_UTRSTAT_RXTO_LEGACY )) {
972969 wr_regl (port , S3C2410_UTRSTAT ,
973- APPLE_S5L_UTRSTAT_RXTHRESH | APPLE_S5L_UTRSTAT_RXTO );
974- ret = s3c24xx_serial_rx_irq (irq , id );
970+ APPLE_S5L_UTRSTAT_RXTHRESH | APPLE_S5L_UTRSTAT_RXTO |
971+ APPLE_S5L_UTRSTAT_RXTO_LEGACY );
972+ ret = s3c24xx_serial_rx_irq (ourport );
975973 }
976974 if (pend & APPLE_S5L_UTRSTAT_TXTHRESH ) {
977975 wr_regl (port , S3C2410_UTRSTAT , APPLE_S5L_UTRSTAT_TXTHRESH );
978- ret = s3c24xx_serial_tx_irq (irq , id );
976+ ret = s3c24xx_serial_tx_irq (ourport );
979977 }
980978
981979 return ret ;
@@ -1195,7 +1193,8 @@ static void apple_s5l_serial_shutdown(struct uart_port *port)
11951193 ucon = rd_regl (port , S3C2410_UCON );
11961194 ucon &= ~(APPLE_S5L_UCON_TXTHRESH_ENA_MSK |
11971195 APPLE_S5L_UCON_RXTHRESH_ENA_MSK |
1198- APPLE_S5L_UCON_RXTO_ENA_MSK );
1196+ APPLE_S5L_UCON_RXTO_ENA_MSK |
1197+ APPLE_S5L_UCON_RXTO_LEGACY_ENA_MSK );
11991198 wr_regl (port , S3C2410_UCON , ucon );
12001199
12011200 wr_regl (port , S3C2410_UTRSTAT , APPLE_S5L_UTRSTAT_ALL_FLAGS );
@@ -1292,6 +1291,7 @@ static int apple_s5l_serial_startup(struct uart_port *port)
12921291 /* Enable Rx Interrupt */
12931292 s3c24xx_set_bit (port , APPLE_S5L_UCON_RXTHRESH_ENA , S3C2410_UCON );
12941293 s3c24xx_set_bit (port , APPLE_S5L_UCON_RXTO_ENA , S3C2410_UCON );
1294+ s3c24xx_set_bit (port , APPLE_S5L_UCON_RXTO_LEGACY_ENA , S3C2410_UCON );
12951295
12961296 return ret ;
12971297}
@@ -2148,13 +2148,15 @@ static int s3c24xx_serial_resume_noirq(struct device *dev)
21482148
21492149 ucon &= ~(APPLE_S5L_UCON_TXTHRESH_ENA_MSK |
21502150 APPLE_S5L_UCON_RXTHRESH_ENA_MSK |
2151- APPLE_S5L_UCON_RXTO_ENA_MSK );
2151+ APPLE_S5L_UCON_RXTO_ENA_MSK |
2152+ APPLE_S5L_UCON_RXTO_LEGACY_ENA_MSK );
21522153
21532154 if (ourport -> tx_enabled )
21542155 ucon |= APPLE_S5L_UCON_TXTHRESH_ENA_MSK ;
21552156 if (ourport -> rx_enabled )
21562157 ucon |= APPLE_S5L_UCON_RXTHRESH_ENA_MSK |
2157- APPLE_S5L_UCON_RXTO_ENA_MSK ;
2158+ APPLE_S5L_UCON_RXTO_ENA_MSK |
2159+ APPLE_S5L_UCON_RXTO_LEGACY_ENA_MSK ;
21582160
21592161 wr_regl (port , S3C2410_UCON , ucon );
21602162
@@ -2541,7 +2543,7 @@ static const struct s3c24xx_serial_drv_data s5l_serial_drv_data = {
25412543 .name = "Apple S5L UART" ,
25422544 .type = TYPE_APPLE_S5L ,
25432545 .port_type = PORT_8250 ,
2544- .iotype = UPIO_MEM ,
2546+ .iotype = UPIO_MEM32 ,
25452547 .fifosize = 16 ,
25462548 .rx_fifomask = S3C2410_UFSTAT_RXMASK ,
25472549 .rx_fifoshift = S3C2410_UFSTAT_RXSHIFT ,
@@ -2827,6 +2829,9 @@ OF_EARLYCON_DECLARE(gs101, "google,gs101-uart", gs101_early_console_setup);
28272829static int __init apple_s5l_early_console_setup (struct earlycon_device * device ,
28282830 const char * opt )
28292831{
2832+ /* Apple A7-A11 requires MMIO32 register accesses. */
2833+ device -> port .iotype = UPIO_MEM32 ;
2834+
28302835 /* Close enough to S3C2410 for earlycon... */
28312836 device -> port .private_data = & s3c2410_early_console_data ;
28322837
0 commit comments