Skip to contentSkip to conversation

serial: samsung: enable clock before accessing interrupt mask resister

PATCH RESEND In review 남영민 2 participants 2 messages Feb 1, 2017 – Feb 8, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20170201102546epcas1p25107505cc2ff66f06211f945d2ddd679@epcas1p2.samsung.com

남영민

author
#1 lore raw

PATCH RESEND 1/1 serial: samsung: enable clock before accessing interrupt mask resister

Ensure that the uart clock is enabled prior to writing to the interrupt mask register in s3c24xx_serial_resume_noirq function. Without enabing the uart clock, the uart register cannot be accessed.

---
 drivers/tty/serial/samsung.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/tty/serial/samsung.c +3 -0
index f44615f..06488fd 100644
@@ -1921,6 +1921,7 @@ static int s3c24xx_serial_resume(struct device *dev)
 static int s3c24xx_serial_resume_noirq(struct device *dev)
 {
 	struct uart_port *port = s3c24xx_dev_to_port(dev);
+	struct s3c24xx_uart_port *ourport = to_ourport(port);
 
 	if (port) {
 		/* restore IRQ mask */
@@ -1930,7 +1931,9 @@ static int s3c24xx_serial_resume_noirq(struct device *dev)
 				uintm &= ~S3C64XX_UINTM_TXD_MSK;
 			if (rx_enabled(port))
 				uintm &= ~S3C64XX_UINTM_RXD_MSK;
+			clk_prepare_enable(ourport->clk);
 			wr_regl(port, S3C64XX_UINTM, uintm);
+			clk_disable_unprepare(ourport->clk);
 		}
 	}
 
Signature · 1 line
2.8.1
#2 lore raw

Hello Youngmin,

I was wondering if this fixes an actual issue. The changes look sane, but shouldn't be current code trigger some imprecise external abort on system resume then?

I'm asking because on my Exynos4412 board nothing like that happens on system resume. And if I read the code correctly, s3c24xx_serial_has_interrupt_mask() returns 1 in my case.

With best wishes,
Tobias

Quoted 32 lines · 남영민

Ensure that the uart clock is enabled prior to writing to the interrupt mask register in s3c24xx_serial_resume_noirq function. Without enabing the uart clock, the uart register cannot be accessed.

---
 drivers/tty/serial/samsung.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/tty/serial/samsung.c +3 -0
index f44615f..06488fd 100644
@@ -1921,6 +1921,7 @@ static int s3c24xx_serial_resume(struct device *dev)
 static int s3c24xx_serial_resume_noirq(struct device *dev)
 {
 	struct uart_port *port = s3c24xx_dev_to_port(dev);
+	struct s3c24xx_uart_port *ourport = to_ourport(port);
 
 	if (port) {
 		/* restore IRQ mask */
@@ -1930,7 +1931,9 @@ static int s3c24xx_serial_resume_noirq(struct device *dev)
 				uintm &= ~S3C64XX_UINTM_TXD_MSK;
 			if (rx_enabled(port))
 				uintm &= ~S3C64XX_UINTM_RXD_MSK;
+			clk_prepare_enable(ourport->clk);
 			wr_regl(port, S3C64XX_UINTM, uintm);
+			clk_disable_unprepare(ourport->clk);
 		}
 	}