Thread (90 messages) 90 messages, 11 authors, 2021-03-02

Re: [PATCH v2 22/25] tty: serial: samsung_tty: Add support for Apple UARTs

From: Hector Martin <hidden>
Date: 2021-02-18 17:05:41
Also in: linux-devicetree, lkml

On 16/02/2021 04.13, Krzysztof Kozlowski wrote:
On Mon, Feb 15, 2021 at 09:17:10PM +0900, Hector Martin wrote:
quoted
@@ -389,10 +396,12 @@ static void enable_tx_pio(struct s3c24xx_uart_port *ourport)
  	ucon = rd_regl(port, S3C2410_UCON);
  	ucon &= ~(S3C64XX_UCON_TXMODE_MASK);
  	ucon |= S3C64XX_UCON_TXMODE_CPU;
-	wr_regl(port,  S3C2410_UCON, ucon);
  
  	/* Unmask Tx interrupt */
  	switch (ourport->info->type) {
+	case TYPE_APPLE_S5L:
+		ucon |= APPLE_S5L_UCON_TXTHRESH_ENA_MSK;
+		break;
  	case TYPE_S3C6400:
  		s3c24xx_clear_bit(port, S3C64XX_UINTM_TXD, S3C64XX_UINTM);
  		break;
@@ -401,7 +410,16 @@ static void enable_tx_pio(struct s3c24xx_uart_port *ourport)
  		break;
  	}
  
+	wr_regl(port,  S3C2410_UCON, ucon);
You are now configuring the PIO mode after unmasking interrupt. I don't
think it's a good idea to change the order... and if it were, it
would deserve a separate patch.
For v3 I moved the wr_regl back and just write it again in the 
TYPE_APPLE_S5L branch; that way, setting the PIO mode and unmasking the 
interrupt are two discrete operations on S5L, like they are on other types.
quoted
  	/* Keep all interrupts masked and cleared */
  	switch (ourport->info->type) {
+	case TYPE_APPLE_S5L: {
Usually you put TYPE_APPLE at the end of switch, so please keep it
consistent. Can be first or last - just everywhere the same, unless you
have a fall-through on purpose.
Good point, thanks, moved it for v3. It was actually inconsistent in 
more places, I made all the orders the same (the enum order, and 
default: always goes at the end).
quoted
@@ -2179,6 +2329,32 @@ static int s3c24xx_serial_resume_noirq(struct device *dev)
  	if (port) {
  		/* restore IRQ mask */
  		switch (ourport->info->type) {
+		case TYPE_APPLE_S5L: {
+			unsigned int ucon;
+
+			clk_prepare_enable(ourport->clk);
+			if (!IS_ERR(ourport->baudclk))
+				clk_prepare_enable(ourport->baudclk);
We should start checking the return values of clk operations. I know
that existing code does it only in few places, so basically you are not
making it worse...
Added error checking for these for v3, thanks.
quoted
+#define S5L_SERIAL_DRV_DATA ((kernel_ulong_t)&s5l_serial_drv_data)
+#else
+#define S5L_SERIAL_DRV_DATA ((kernel_ulong_t)NULL)
+#endif
+
+
Only one line break.
Fixed in v3.

Thank you for the reviews!

-- 
Hector Martin (marcan@marcan.st)
Public Key: https://mrcn.st/pub

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help