mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Alexander Shiyan" <shc_work@mail.ru>
To: jon@ringle.org
Cc: "Jon Ringle" <jringle@gridpoint.com>,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v4 1/2] serial: sc16is7xx
Date: Thu, 03 Apr 2014 10:28:37 +0400	[thread overview]
Message-ID: <1396506517.887689599@f401.i.mail.ru> (raw)
In-Reply-To: <1396500555-28873-1-git-send-email-jon@ringle.org>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=utf-8, Size: 2718 bytes --]

Thu,  3 Apr 2014 00:49:14 -0400 от jon@ringle.org:
> From: Jon Ringle <jringle@gridpoint.com>
> 
> 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@gridpoint.com>
> ---
...
> +	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Ç+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

      parent reply	other threads:[~2014-04-03  6:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-03  4:49 jon
2014-04-03  4:49 ` [PATCH v4 2/2] serial: sc16is7xx: Add bindings documentation for the SC16IS7XX UARTs jon
2014-04-03  6:28 ` Alexander Shiyan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1396506517.887689599@f401.i.mail.ru \
    --to=shc_work@mail.ru \
    --cc=devicetree@vger.kernel.org \
    --cc=jon@ringle.org \
    --cc=jringle@gridpoint.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome