Re: [PATCH v4 1/2] serial: sc16is7xx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thu,  3 Apr 2014 00:49:14 -0400 от jon@xxxxxxxxxx:
> From: Jon Ringle <jringle@xxxxxxxxxxxxx>
> 
> The SC16IS7xx is a slave I2C-bus/SPI interface to a single-channel
> high performance UART. The SC16IS7xx’s internal register set is
> backward-compatible with the widely used and widely popular 16C450.
> 
> The SC16IS7xx also provides additional advanced features such as
> auto hardware and software flow control, automatic RS-485 support, and
> software reset.
> 
> Signed-off-by: Jon Ringle <jringle@xxxxxxxxxxxxx>
> ---
...
> +	tristate "SC16IS7xx serial support"
> +	select SERIAL_CORE
> +	select REGMAP_I2C if I2C
> +	default n

"n" is already default choice. There is no need to specify this.

...
> +#include <linux/serial.h>
> +#include <linux/spi/spi.h>

What a reason to include SPI header?

...
> + * The programmer must program the TCR such that TCR[3:0] > TCR[7:4]. There is
> + * no built-in hardware check to make sure this condition is met. Also, the TCR
> + * must be programmed with this condition before auto RTS or software flow
> + * control is enabled to avoid spurious operation of the device.
> + */
> +#define SC16IS7XX_TCR_RX_HALT(words)	(((words / 4) & 0x0f) << 0)
> +#define SC16IS7XX_TCR_RX_RESUME(words)	(((words / 4) & 0x0f) << 4)

"words" on the right side should be framed by brackets.

...
> + * When TLR is used for RX trigger level control, FCR[7:6] should be left at the
> + * default state, that is, ‘00’.
> + */
> +#define SC16IS7XX_TLR_TX_TRIGGER(words)	(((words / 4) & 0x0f) << 0)
> +#define SC16IS7XX_TLR_RX_TRIGGER(words)	(((words / 4) & 0x0f) << 4)

Ditto.

...
> +static void sc16is7xx_config_rs485(struct uart_port *port,
> +				   struct serial_rs485 *rs485)
> +{
> +	struct sc16is7xx_one *one = to_sc16is7xx_one(port, port);
> +
> +	one->rs485 = *rs485;
> +
> +	if (one->rs485.flags & SER_RS485_ENABLED) {
> +		sc16is7xx_port_update(port, SC16IS7XX_EFCR_REG,
> +				      SC16IS7XX_EFCR_AUTO_RS485_BIT,
> +				      SC16IS7XX_EFCR_AUTO_RS485_BIT);
> +	} else {
> +		sc16is7xx_port_update(port, SC16IS7XX_EFCR_REG,
> +				      SC16IS7XX_EFCR_AUTO_RS485_BIT,
> +				      0);
> +	}
> +}

This function will get "unused" warning if TIOCSRS485 and
TIOCGRS485 is not defined.

...
> +static int sc16is7xx_startup(struct uart_port *port)
> +{
...
> +	sc16is7xx_port_update(port, SC16IS7XX_EFCR_REG,
> +			      SC16IS7XX_EFCR_AUTO_RS485_BIT,
> +			      SC16IS7XX_EFCR_AUTO_RS485_BIT);

You should do not set optional RS485 mode unconditionally.
Since IOCTL for RS485 is used, this should be enough.

---

��.n��������+%������w��{.n�����{����*jg��������ݢj����G�������j:+v���w�m������w�������h�����٥





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux