lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 14 Oct 2013 15:59:21 +0200
From:	Jean-Christophe PLAGNIOL-VILLARD <plagnioj@...osoft.com>
To:	Nicolas Ferre <nicolas.ferre@...el.com>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Josh Wu <josh.wu@...el.com>, Bo Shen <voice.shen@...el.com>,
	linux-arm-kernel@...ts.infradead.org, linux-serial@...r.kernel.org,
	Ludovic Desroches <ludovic.desroches@...el.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] tty/serial: at91: add a fallback option to determine
 uart/usart property

On 10:43 Thu 10 Oct     , Nicolas Ferre wrote:
> On older SoC, the "name" field is not filled in the register map.
> Fix the way to figure out if the serial port is an uart or an usart for these
> older products (with corresponding properties).
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@...el.com>
> ---
>  drivers/tty/serial/atmel_serial.c | 19 ++++++++++++++++++-
>  include/linux/atmel_serial.h      |  1 +
>  2 files changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index 6b0f75e..c7d99af 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -99,6 +99,7 @@ static void atmel_stop_rx(struct uart_port *port);
>  #define UART_PUT_RTOR(port,v)	__raw_writel(v, (port)->membase + ATMEL_US_RTOR)
>  #define UART_PUT_TTGR(port, v)	__raw_writel(v, (port)->membase + ATMEL_US_TTGR)
>  #define UART_GET_IP_NAME(port)	__raw_readl((port)->membase + ATMEL_US_NAME)
> +#define UART_GET_IP_VERSION(port) __raw_readl((port)->membase + ATMEL_US_VERSION)
>  
>   /* PDC registers */
>  #define UART_PUT_PTCR(port,v)	__raw_writel(v, (port)->membase + ATMEL_PDC_PTCR)
> @@ -1503,6 +1504,7 @@ static void atmel_get_ip_name(struct uart_port *port)
>  {
>  	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
>  	int name = UART_GET_IP_NAME(port);
> +	u32 version;
>  	int usart, uart;
>  	/* usart and uart ascii */
>  	usart = 0x55534152;
> @@ -1517,7 +1519,22 @@ static void atmel_get_ip_name(struct uart_port *port)
>  		dev_dbg(port->dev, "This is uart\n");
>  		atmel_port->is_usart = false;
>  	} else {
> -		dev_err(port->dev, "Not supported ip name, set to uart\n");
> +		/* fallback for older SoCs: use version field */
> +		version = UART_GET_IP_VERSION(port);
> +		switch (version) {
> +		case 0x302:
> +		case 0x10213:
> +			dev_dbg(port->dev, "This version is usart\n");
> +			atmel_port->is_usart = true;
> +			break;
> +		case 0x203:
> +		case 0x10202:
> +			dev_dbg(port->dev, "This version is uart\n");
> +			atmel_port->is_usart = false;
> +			break;
> +		default:
> +			dev_err(port->dev, "Not supported ip name nor version, set to uart\n");

it's not really an error a dev_warn is more oppropriate
> +		}
>  	}
>  }
>  
> diff --git a/include/linux/atmel_serial.h b/include/linux/atmel_serial.h
> index be201ca..00beddf 100644
> --- a/include/linux/atmel_serial.h
> +++ b/include/linux/atmel_serial.h
> @@ -125,5 +125,6 @@
>  #define ATMEL_US_IF		0x4c			/* IrDA Filter Register */
>  
>  #define ATMEL_US_NAME		0xf0			/* Ip Name */
> +#define ATMEL_US_VERSION	0xfc			/* Ip Version */
>  
>  #endif
> -- 
> 1.8.2.2
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists