linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Feng Tang <feng.tang@intel.com>
To: David Brownell <david-b@pacbell.net>
Cc: Greg KH <greg@kroah.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	Andrew Morton <akpm@linux-foundation.org>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	spi-devel-list <spi-devel-general@lists.sourceforge.net>,
	"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	"alan@lxorguk.ukuu.org.uk" <alan@lxorguk.ukuu.org.uk>
Subject: Re: [RFC][PATCH v3] serial: spi: add spi-uart driver for Maxim 3110
Date: Thu, 25 Feb 2010 15:44:11 +0800	[thread overview]
Message-ID: <20100225154411.6d1ec4d0@feng-i7> (raw)
In-Reply-To: <201002242043.15231.david-b@pacbell.net>

On Thu, 25 Feb 2010 12:43:14 +0800
David Brownell <david-b@pacbell.net> wrote:

> On Tuesday 23 February 2010, Feng Tang wrote:
> > 
> > +config SERIAL_MAX3110
> > +       tristate "SPI UART driver for Max3110"
> > +       select SERIAL_CORE
> > +       select SERIAL_CORE_CONSOLE
> 
> Shouldn't that depend on SPI_MASTER?  As it stands, you're
> permitting it to build on systems that you *know* don't have
> a prayer of running this code ... or often, even finishing
> the build.
> 
> 
> > +       help
> > +         This is the UART protocol driver for MAX3110 device
> > +
> > +config MAX3110_DESIGNWARE
> 
> Having this depend on a specific underlying SPI master controller
> is not a good thing.  It should instead be written so that it
> runs correctly on *any* controller which exports the standard SPI
> programming interface.
> 
> 
> 
> > +       boolean "Enable Max3110 to work with Designware controller"
> > +       default y
> > +       depends on SERIAL_MAX3110
> > +
> 
> That is, stuff like this, from your max3110 driver:
> 
> > +
> > +#ifdef CONFIG_MAX3110_DESIGNWARE
> > +static struct dw_spi_chip spi_uart = {
> > +       .poll_mode = 1,
> > +       .enable_dma = 0,
> > +       .type = SPI_FRF_SPI,
> > +};
> > +#endif
> 
> Is completely irrelevant for other hardware ... or else
> (as with DMA, which should be "enabled by default") is
> relevant, but shouldn't be parameterized.
> 
> 
> > +       spi->mode = SPI_MODE_0;
> > +       spi->bits_per_word = 16;
> > +#ifdef CONFIG_MAX3110_DESIGNWARE
> > +       spi->controller_data = &spi_uart;
> > +#endif
> 
> That all looks fishy too.  SPI_MODE should have
> been set up as part of device creation.  Ditto
> any spi->controller_data ... normally, that all
> gets set up as part of board-specific setup.
> 
> Normally one goes to a lot of effort to keep
> such board-specific code out of drivers.

Good point about the DW controller specific data, I'll remove them.
For those "bits_per_word" setting, I think we can put it here instead of
the board initialization code, as many types of boards can leverage the
setting here as it only works in 16b mode.

Thanks,
Feng

> 
> - Dave
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-02-25  7:44 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20091229222006.1ddb28a4@feng-desktop>
2009-12-29 14:59 ` [spi-devel-general] [RFC][PATCH] serial: spi: add spi-uart driver for Maxim 3110 Baruch Siach
2009-12-29 16:05   ` Tang, Feng
2009-12-29 18:43     ` Erwin Authried
2009-12-30  1:54       ` Feng Tang
2010-02-25  4:47       ` David Brownell
2010-02-25  7:49         ` Feng Tang
2009-12-29 15:02 ` Alan Cox
2010-02-08  8:59 ` [RFC][PATCH v2] " Feng Tang
     [not found] ` <20100208165946.0e4dde83@feng-i7>
2010-02-09  0:20   ` Andrew Morton
2010-02-09  0:26     ` Grant Likely
2010-02-09  1:36       ` Feng Tang
2010-02-17 22:58         ` Greg KH
2010-02-24  5:11           ` [RFC][PATCH v3] " Feng Tang
2010-02-24 10:44             ` Alan Cox
2010-02-24 14:25               ` Grant Likely
2010-02-24 23:18             ` Andrew Morton
2010-02-25  6:39               ` Feng Tang
2010-02-25  4:43             ` David Brownell
2010-02-25  7:44               ` Feng Tang [this message]
2010-02-25  8:11                 ` David Brownell
2010-02-26  3:47             ` [PATCH v4] " Feng Tang
     [not found]             ` <20100226114729.679bb933@feng-i7>
2010-02-26  9:59               ` Masakazu Mokuno
2010-02-26 19:41                 ` David Brownell
2010-03-01  2:30                   ` Feng Tang
2010-03-02  3:38                 ` Feng Tang
2010-02-09  9:25     ` [RFC][PATCH v2] " Alan Cox
2010-03-03  2:57   ` [PATCH v5] " Feng Tang
2010-03-03  3:59     ` Grant Likely
2010-03-03  4:51     ` David Brownell
2010-03-03  5:52       ` Feng Tang
2010-03-03  6:16         ` David Brownell
2010-03-03  6:37           ` Feng Tang
2010-03-03  7:25             ` David Brownell
2010-03-03  7:42               ` Feng Tang

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=20100225154411.6d1ec4d0@feng-i7 \
    --to=feng.tang@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=david-b@pacbell.net \
    --cc=grant.likely@secretlab.ca \
    --cc=greg@kroah.com \
    --cc=gregkh@suse.de \
    --cc=linux-serial@vger.kernel.org \
    --cc=spi-devel-general@lists.sourceforge.net \
    /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;
as well as URLs for NNTP newsgroup(s).