All of lore.kernel.org
 help / color / mirror / Atom feed
* wip - magic-sysrq support for amlogic uart
@ 2016-06-24 17:45 Ben Dooks
  2016-06-24 17:45 ` [RFC] wip: add sysrq support Ben Dooks
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Dooks @ 2016-06-24 17:45 UTC (permalink / raw)
  To: linus-amlogic

This is something I added earlier. I think it might be useful
for people if it is properly sorted out.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFC] wip: add sysrq support
  2016-06-24 17:45 wip - magic-sysrq support for amlogic uart Ben Dooks
@ 2016-06-24 17:45 ` Ben Dooks
  2016-06-24 18:27   ` Kevin Hilman
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Dooks @ 2016-06-24 17:45 UTC (permalink / raw)
  To: linus-amlogic

---
 drivers/tty/serial/meson_uart.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
index 6aea0f4..8581c35 100644
--- a/drivers/tty/serial/meson_uart.c
+++ b/drivers/tty/serial/meson_uart.c
@@ -14,6 +14,8 @@
  *
  */
 
+#define SUPPORT_SYSRQ
+
 #include <linux/clk.h>
 #include <linux/console.h>
 #include <linux/delay.h>
@@ -83,6 +85,8 @@
 #define AML_UART_PORT_NUM		6
 #define AML_UART_DEV_NAME		"ttyAML"
 
+/* fake flag for handling breaks */
+#define AML_RX_BREAK			(1 << 31)
 
 static struct uart_driver meson_uart_driver;
 
@@ -183,12 +187,12 @@ static void meson_receive_chars(struct uart_port *port)
 {
 	struct tty_port *tport = &port->state->port;
 	char flag;
-	u32 status, ch, mode;
+	u32 ostatus, status, ch, mode;
 
 	do {
 		flag = TTY_NORMAL;
 		port->icount.rx++;
-		status = readl(port->membase + AML_UART_STATUS);
+		ostatus = status = readl(port->membase + AML_UART_STATUS);
 
 		if (status & AML_UART_ERR) {
 			if (status & AML_UART_TX_FIFO_WERR)
@@ -216,6 +220,14 @@ static void meson_receive_chars(struct uart_port *port)
 		ch = readl(port->membase + AML_UART_RFIFO);
 		ch &= 0xff;
 
+		if (ostatus & AML_UART_FRAME_ERR && ch == 0) {
+			uart_handle_break(port);
+			continue;
+		};
+
+		if (uart_handle_sysrq_char(port, ch))
+			continue;
+
 		if ((status & port->ignore_status_mask) == 0)
 			tty_insert_flip_char(tport, ch, flag);
 
@@ -284,7 +296,7 @@ static int meson_uart_startup(struct uart_port *port)
 
 	val = (AML_UART_RECV_IRQ(1) | AML_UART_XMIT_IRQ(port->fifosize / 2));
 	writel(val, port->membase + AML_UART_MISC);
-
+	
 	ret = request_irq(port->irq, meson_uart_interrupt, 0,
 			  meson_uart_type(port), port);
 
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [RFC] wip: add sysrq support
  2016-06-24 17:45 ` [RFC] wip: add sysrq support Ben Dooks
@ 2016-06-24 18:27   ` Kevin Hilman
  2016-06-24 18:32     ` Ben Dooks
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Hilman @ 2016-06-24 18:27 UTC (permalink / raw)
  To: linus-amlogic

Ben Dooks <ben.dooks@codethink.co.uk> writes:

> ---
>  drivers/tty/serial/meson_uart.c | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
> index 6aea0f4..8581c35 100644
> --- a/drivers/tty/serial/meson_uart.c
> +++ b/drivers/tty/serial/meson_uart.c
> @@ -14,6 +14,8 @@
>   *
>   */
>  
> +#define SUPPORT_SYSRQ
> +
>  #include <linux/clk.h>
>  #include <linux/console.h>
>  #include <linux/delay.h>
> @@ -83,6 +85,8 @@
>  #define AML_UART_PORT_NUM		6
>  #define AML_UART_DEV_NAME		"ttyAML"
>  
> +/* fake flag for handling breaks */
> +#define AML_RX_BREAK			(1 << 31)

Hmm, this flag isn't used anywhere.  ?

>  static struct uart_driver meson_uart_driver;
>  
> @@ -183,12 +187,12 @@ static void meson_receive_chars(struct uart_port *port)
>  {
>  	struct tty_port *tport = &port->state->port;
>  	char flag;
> -	u32 status, ch, mode;
> +	u32 ostatus, status, ch, mode;
>  
>  	do {
>  		flag = TTY_NORMAL;
>  		port->icount.rx++;
> -		status = readl(port->membase + AML_UART_STATUS);
> +		ostatus = status = readl(port->membase + AML_UART_STATUS);
>  
>  		if (status & AML_UART_ERR) {
>  			if (status & AML_UART_TX_FIFO_WERR)
> @@ -216,6 +220,14 @@ static void meson_receive_chars(struct uart_port *port)
>  		ch = readl(port->membase + AML_UART_RFIFO);
>  		ch &= 0xff;
>  
> +		if (ostatus & AML_UART_FRAME_ERR && ch == 0) {
> +			uart_handle_break(port);
> +			continue;
> +		};
> +
> +		if (uart_handle_sysrq_char(port, ch))
> +			continue;
> +
>  		if ((status & port->ignore_status_mask) == 0)
>  			tty_insert_flip_char(tport, ch, flag);
>  
> @@ -284,7 +296,7 @@ static int meson_uart_startup(struct uart_port *port)
>  
>  	val = (AML_UART_RECV_IRQ(1) | AML_UART_XMIT_IRQ(port->fifosize / 2));
>  	writel(val, port->membase + AML_UART_MISC);
> -
> +	
>  	ret = request_irq(port->irq, meson_uart_interrupt, 0,
>  			  meson_uart_type(port), port);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFC] wip: add sysrq support
  2016-06-24 18:27   ` Kevin Hilman
@ 2016-06-24 18:32     ` Ben Dooks
  0 siblings, 0 replies; 4+ messages in thread
From: Ben Dooks @ 2016-06-24 18:32 UTC (permalink / raw)
  To: linus-amlogic

On 24/06/16 19:27, Kevin Hilman wrote:
> Ben Dooks <ben.dooks@codethink.co.uk> writes:
> 
>> ---
>>  drivers/tty/serial/meson_uart.c | 18 +++++++++++++++---
>>  1 file changed, 15 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
>> index 6aea0f4..8581c35 100644
>> --- a/drivers/tty/serial/meson_uart.c
>> +++ b/drivers/tty/serial/meson_uart.c
>> @@ -14,6 +14,8 @@
>>   *
>>   */
>>  
>> +#define SUPPORT_SYSRQ
>> +

I think I also need to wrap this in an #ifdef.

>>  #include <linux/clk.h>
>>  #include <linux/console.h>
>>  #include <linux/delay.h>
>> @@ -83,6 +85,8 @@
>>  #define AML_UART_PORT_NUM		6
>>  #define AML_UART_DEV_NAME		"ttyAML"
>>  
>> +/* fake flag for handling breaks */
>> +#define AML_RX_BREAK			(1 << 31)

Ah, must have missed that one when cleaning up.



-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-24 18:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-24 17:45 wip - magic-sysrq support for amlogic uart Ben Dooks
2016-06-24 17:45 ` [RFC] wip: add sysrq support Ben Dooks
2016-06-24 18:27   ` Kevin Hilman
2016-06-24 18:32     ` Ben Dooks

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.