From: jason@lakedaemon.net (Jason Cooper)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/4] memory: mvebu-devbus: fix the conversion of the bus width
Date: Wed, 16 Apr 2014 17:09:24 -0400 [thread overview]
Message-ID: <20140416210924.GL28159@titan.lakedaemon.net> (raw)
In-Reply-To: <1397489361-5833-2-git-send-email-thomas.petazzoni@free-electrons.com>
Thomas,
On Mon, Apr 14, 2014 at 05:29:18PM +0200, Thomas Petazzoni wrote:
> According to the Armada 370 and Armada XP datasheets, the part of the
> Device Bus register that configure the bus width should contain 0 for
> a 8 bits bus width, and 1 for a 16 bits bus width (other values are
> unsupported/reserved).
>
> However, the current conversion done in the driver to convert from a
> bus width in bits to the value expected by the register leads to
> setting the register to 1 for a 8 bits bus, and 2 for a 16 bits bus.
>
> This mistake was compensated by a mistake in the existing Device Tree
> files for Armada 370/XP platforms: they were declaring a 8 bits bus
> width, while the hardware in fact uses a 16 bits bus width.
>
> This commit fixes that by adjusting the conversion logic.
>
> This patch fixes a bug that was introduced in
> 3edad321b1bd2e6c8b5f38146c115c8982438f06 ('drivers: memory: Introduce
> Marvell EBU Device Bus driver'), which was merged in v3.11.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: stable at vger.kernel.org
> ---
> drivers/memory/mvebu-devbus.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/memory/mvebu-devbus.c b/drivers/memory/mvebu-devbus.c
> index 110c036..b59a17f 100644
> --- a/drivers/memory/mvebu-devbus.c
> +++ b/drivers/memory/mvebu-devbus.c
> @@ -108,8 +108,19 @@ static int devbus_set_timing_params(struct devbus *devbus,
> node->full_name);
> return err;
> }
> - /* Convert bit width to byte width */
> - r.bus_width /= 8;
> +
> + /*
> + * The bus width is encoded into the register as 0 for 8 bits,
> + * and 1 for 16 bits, so we do the necessary conversion here.
> + */
> + if (r.bus_width == 8)
> + r.bus_width = 0;
> + else if (r.bus_width == 16)
> + r.bus_width = 1;
> + else {
> + dev_err(devbus->dev, "invalid bus width %d\n", r.bus_width);
> + return -EINVAL;
> + }
This looks strikingly similar to patch 4/29 of your own orion5x DT
conversion series, but with completely different code... Which one
would you prefer I take?
thx,
Jason.
next prev parent reply other threads:[~2014-04-16 21:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-14 15:29 [PATCH v2 0/4] ARM: mvebu: fix bus width handling in mvebu-devbus Thomas Petazzoni
2014-04-14 15:29 ` [PATCH v2 1/4] memory: mvebu-devbus: fix the conversion of the bus width Thomas Petazzoni
2014-04-16 21:09 ` Jason Cooper [this message]
2014-04-16 21:28 ` Thomas Petazzoni
2014-04-17 4:48 ` Jason Cooper
2014-04-14 15:29 ` [PATCH v2 2/4] ARM: mvebu: fix NOR bus-width in Armada XP GP Device Tree Thomas Petazzoni
2014-04-17 5:08 ` Jason Cooper
2014-04-17 7:09 ` Thomas Petazzoni
2014-04-17 14:23 ` Jason Cooper
2014-04-14 15:29 ` [PATCH v2 3/4] ARM: mvebu: fix NOR bus-width in Armada XP DB " Thomas Petazzoni
2014-04-14 15:29 ` [PATCH v2 4/4] ARM: mvebu: fix NOR bus-width in Armada XP OpenBlocks AX3 " Thomas Petazzoni
2014-04-14 17:00 ` [PATCH v2 0/4] ARM: mvebu: fix bus width handling in mvebu-devbus Ezequiel Garcia
2014-04-16 8:17 ` Gregory CLEMENT
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=20140416210924.GL28159@titan.lakedaemon.net \
--to=jason@lakedaemon.net \
--cc=linux-arm-kernel@lists.infradead.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