All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <florian-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
To: Jonas Gorski <jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>,
	linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH 5/6] spi/bcm63xx: move register definitions into the driver
Date: Thu, 10 Sep 2015 12:10:36 -0700	[thread overview]
Message-ID: <55F1D5AC.5020407@openwrt.org> (raw)
In-Reply-To: <1441894304-22316-6-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>

On 10/09/15 07:11, Jonas Gorski wrote:
> Move all register definitions and structs into the driver. This allows
> us dropping the platform_data struct and drop any arch specific
> includes.
> 
> Since we now have full control over the message width, we can drop the
> size check, which was broken anyway, since it never set ret to any error
> code.
> 
> Also since we now have no arch depedendent resources, we can now allow
> compiling it for any arch, hidding behind COMPILE_TEST.
> 
> Signed-off-by: Jonas Gorski <jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
> ---

[snip]

> +	switch (resource_size(r)) {
> +	case SPI_6348_RSET_SIZE:
> +		bs->reg_offsets = bcm6348_spi_reg_offsets;
> +		bs->msg_type_shift = SPI_6348_MSG_TYPE_SHIFT;
> +		bs->msg_ctl_width = SPI_6348_MSG_CTL_WIDTH;
> +		bs->fifo_size = SPI_6348_MSG_DATA_SIZE;
> +		break;
> +	case SPI_6358_RSET_SIZE:
> +		bs->reg_offsets = bcm6358_spi_reg_offsets;
> +		bs->msg_type_shift = SPI_6358_MSG_TYPE_SHIFT;
> +		bs->msg_ctl_width = SPI_6358_MSG_CTL_WIDTH;
> +		bs->fifo_size = SPI_6358_MSG_DATA_SIZE;
>  		break;

This is a little fragile, I would rather create more specialized
platform_id names, like "bcm6348-spi" and "bcm6358-spi", very much like
what the FEC driver does, such that:

- you could directly pass this information as part of an additional
structure which specializes the instance of the driver
- the conversion to Device Tree in your other patches would make this
more natural or nearly identical

What do you think?
--
Florian
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-09-10 19:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-10 14:11 [PATCH 0/6] spi/bcm63xx: cleanup and decouple from arch code Jonas Gorski
     [not found] ` <1441894304-22316-1-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
2015-09-10 14:11   ` [PATCH 1/6] spi/bcm63xx: remove unused rx_tail variable Jonas Gorski
     [not found]     ` <1441894304-22316-2-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
2015-09-14 18:54       ` Applied "spi/bcm63xx: remove unused rx_tail variable" to the spi tree Mark Brown
2015-09-10 14:11   ` [PATCH 2/6] spi/bcm63xx: always use a fixed number of CS Jonas Gorski
     [not found]     ` <1441894304-22316-3-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
2015-09-14 18:54       ` Applied "spi/bcm63xx: always use a fixed number of CS" to the spi tree Mark Brown
2015-09-10 14:11   ` [PATCH 3/6] spi/bcm63xx: hardcode busnum to 0 Jonas Gorski
     [not found]     ` <1441894304-22316-4-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
2015-09-14 18:54       ` Applied "spi/bcm63xx: hardcode busnum to 0" to the spi tree Mark Brown
2015-09-10 14:11   ` [PATCH 4/6] spi/bcm63xx: replace custom io accessors with standard ones Jonas Gorski
     [not found]     ` <1441894304-22316-5-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
2015-09-14 18:54       ` Applied "spi/bcm63xx: replace custom io accessors with standard ones" to the spi tree Mark Brown
2015-09-10 14:11   ` [PATCH 5/6] spi/bcm63xx: move register definitions into the driver Jonas Gorski
     [not found]     ` <1441894304-22316-6-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
2015-09-10 19:10       ` Florian Fainelli [this message]
     [not found]         ` <55F1D5AC.5020407-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
2015-09-11 10:27           ` Jonas Gorski
     [not found]             ` <CAOiHx=mXBnfMx1SO+iG=BB6038c99YS8MkM8Nn-itHOoHzAJiQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-11 11:22               ` Mark Brown
2015-09-10 14:11   ` [PATCH 6/6] spi/bcm63xx: move message control word description to register offsets Jonas Gorski

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=55F1D5AC.5020407@openwrt.org \
    --to=florian-p3rkhjxn3npafugrpc6u6w@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.