diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2014-04-14 11:29:18 -0400 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2014-04-17 00:14:30 -0400 |
commit | ce965c3d2e68c5325dd5624eb101d70423022fef (patch) | |
tree | 40600af7e250fbeeb5465a91e9142ffc5c62363f /drivers/memory | |
parent | c9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff) |
memory: mvebu-devbus: fix the conversion of the bus width
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>
Link: https://lkml.kernel.org/r/1397489361-5833-2-git-send-email-thomas.petazzoni@free-electrons.com
Fixes: 3edad321b1bd ('drivers: memory: Introduce Marvell EBU Device Bus driver')
Cc: stable@vger.kernel.org # v3.11+
Acked-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'drivers/memory')
-rw-r--r-- | drivers/memory/mvebu-devbus.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/memory/mvebu-devbus.c b/drivers/memory/mvebu-devbus.c index 110c03627051..b59a17fb7c3e 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, | |||
108 | node->full_name); | 108 | node->full_name); |
109 | return err; | 109 | return err; |
110 | } | 110 | } |
111 | /* Convert bit width to byte width */ | 111 | |
112 | r.bus_width /= 8; | 112 | /* |
113 | * The bus width is encoded into the register as 0 for 8 bits, | ||
114 | * and 1 for 16 bits, so we do the necessary conversion here. | ||
115 | */ | ||
116 | if (r.bus_width == 8) | ||
117 | r.bus_width = 0; | ||
118 | else if (r.bus_width == 16) | ||
119 | r.bus_width = 1; | ||
120 | else { | ||
121 | dev_err(devbus->dev, "invalid bus width %d\n", r.bus_width); | ||
122 | return -EINVAL; | ||
123 | } | ||
113 | 124 | ||
114 | err = get_timing_param_ps(devbus, node, "devbus,badr-skew-ps", | 125 | err = get_timing_param_ps(devbus, node, "devbus,badr-skew-ps", |
115 | &r.badr_skew); | 126 | &r.badr_skew); |