From: Mika Westerberg <mika.westerberg-X3B1VOXEql0@public.gmane.org>
To: H Hartley Sweeten
<hartleys-3FF4nKcrg1dE2c76skzGb0EOCMrvLtNR@public.gmane.org>
Cc: grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
Linux Kernel
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Ryan Mallon <rmallon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH 5/8] spi: spi-ep93xx: remove 'dss' from per chip private data
Date: Sun, 30 Jun 2013 19:20:09 +0300 [thread overview]
Message-ID: <20130630162009.GC786@mwesterb-mobl.lan> (raw)
In-Reply-To: <201306281144.34074.hartleys-3FF4nKcrg1dE2c76skzGb0EOCMrvLtNR@public.gmane.org>
On Fri, Jun 28, 2013 at 11:44:33AM -0700, H Hartley Sweeten wrote:
> This value is only needed to set the bits per word for each transfer
> of a message. There is no reason to set the value in ep93xx_spi_enable()
> because ep93xx_spi_process_transfer() sets it again for each transfer.
>
> Just pass the t->bits_per_word directly to ep93xx_spi_chip_setup() in
> ep93xx_spi_process_transfer() and remove 'dss' from the per chip private
> data.
>
> Signed-off-by: H Hartley Sweeten <hsweeten-3FF4nKcrg1dE2c76skzGb0EOCMrvLtNR@public.gmane.org>
> Cc: Ryan Mallon <rmallon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Cc: Mika Westerberg <mika.westerberg-X3B1VOXEql0@public.gmane.org>
> Cc: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: Grant Likely <grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
> drivers/spi/spi-ep93xx.c | 20 +++++++-------------
> 1 file changed, 7 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c
> index 4fab3bb..cb22c89 100644
> --- a/drivers/spi/spi-ep93xx.c
> +++ b/drivers/spi/spi-ep93xx.c
> @@ -140,7 +140,6 @@ struct ep93xx_spi {
> * @rate: max rate in hz this chip supports
> * @div_cpsr: cpsr (pre-scaler) divider
> * @div_scr: scr divider
> - * @dss: bits per word (4 - 16 bits)
> * @ops: private chip operations
> *
> * This structure is used to store hardware register specific settings for each
> @@ -152,13 +151,9 @@ struct ep93xx_spi_chip {
> unsigned long rate;
> u8 div_cpsr;
> u8 div_scr;
> - u8 dss;
> struct ep93xx_spi_chip_ops *ops;
> };
>
> -/* converts bits per word to CR0.DSS value */
> -#define bits_per_word_to_dss(bpw) ((bpw) - 1)
I think you should keep this macro...
> -
> static int ep93xx_spi_enable(const struct ep93xx_spi *espi)
> {
> u8 regval;
> @@ -308,8 +303,6 @@ static int ep93xx_spi_setup(struct spi_device *spi)
> chip->rate = spi->max_speed_hz;
> }
>
> - chip->dss = bits_per_word_to_dss(spi->bits_per_word);
> -
> ep93xx_spi_cs_control(spi, false);
> return 0;
> }
> @@ -386,22 +379,25 @@ static void ep93xx_spi_cleanup(struct spi_device *spi)
> * ep93xx_spi_chip_setup() - configures hardware according to given @chip
> * @espi: ep93xx SPI controller struct
> * @chip: chip specific settings
> + * @bits_per_word: transfer bits_per_word
> *
> * This function sets up the actual hardware registers with settings given in
> * @chip. Note that no validation is done so make sure that callers validate
> * settings before calling this.
> */
> static void ep93xx_spi_chip_setup(const struct ep93xx_spi *espi,
> - const struct ep93xx_spi_chip *chip)
> + const struct ep93xx_spi_chip *chip,
> + u8 bits_per_word)
> {
> u16 cr0;
>
> cr0 = chip->div_scr << SSPCR0_SCR_SHIFT;
> cr0 |= (chip->spi->mode & (SPI_CPHA|SPI_CPOL)) << SSPCR0_MODE_SHIFT;
> - cr0 |= chip->dss;
> + cr0 |= (bits_per_word - 1);
... and use it here. It makes things less confusing, at least to me.
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
prev parent reply other threads:[~2013-06-30 16:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-28 18:44 [PATCH 5/8] spi: spi-ep93xx: remove 'dss' from per chip private data H Hartley Sweeten
[not found] ` <201306281144.34074.hartleys-3FF4nKcrg1dE2c76skzGb0EOCMrvLtNR@public.gmane.org>
2013-06-30 16:20 ` Mika Westerberg [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=20130630162009.GC786@mwesterb-mobl.lan \
--to=mika.westerberg-x3b1voxeql0@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=hartleys-3FF4nKcrg1dE2c76skzGb0EOCMrvLtNR@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=rmallon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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;
as well as URLs for NNTP newsgroup(s).