All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] omap3: Fix SPI registers on am33xx and am43xx
@ 2016-05-19  7:11 Martin Hejnfelt
  2016-05-23 22:14 ` [U-Boot] [U-Boot, " Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Hejnfelt @ 2016-05-19  7:11 UTC (permalink / raw)
  To: u-boot

When the base registers are read from device tree the base is not
0x48030100 as the driver expects, but 0x48030000, resulting in
non functioning SPI. To deal with this, use same idea as how this
is done in the linux kernel (drivers/spi/spi-omap2-mcspi.c) and
add a structure with a field that is used to shift the registers
on these systems.

v2: Fixed commit subject line to correct cpu

Signed-off-by: Martin Hejnfelt <mh@newtec.dk>
---
 drivers/spi/omap3_spi.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c
index 2fe34c9..60e9d6e 100644
--- a/drivers/spi/omap3_spi.c
+++ b/drivers/spi/omap3_spi.c
@@ -35,6 +35,12 @@ DECLARE_GLOBAL_DATA_PTR;
 #define OMAP3_MCSPI4_BASE	0x480BA000
 #endif
 
+#define OMAP4_MCSPI_REG_OFFSET	0x100
+
+struct omap2_mcspi_platform_config {
+	unsigned int regs_offset;
+};
+
 /* per-register bitmasks */
 #define OMAP3_MCSPI_SYSCONFIG_SMARTIDLE (2 << 3)
 #define OMAP3_MCSPI_SYSCONFIG_ENAWAKEUP BIT(2)
@@ -623,7 +629,10 @@ static int omap3_spi_probe(struct udevice *dev)
 	const void *blob = gd->fdt_blob;
 	int node = dev->of_offset;
 
-	priv->regs = (struct mcspi *)dev_get_addr(dev);
+	struct omap2_mcspi_platform_config* data =
+		(struct omap2_mcspi_platform_config*)dev_get_driver_data(dev);
+
+	priv->regs = (struct mcspi *)(dev_get_addr(dev) + data->regs_offset);
 	priv->pin_dir = fdtdec_get_uint(blob, node, "ti,pindir-d0-out-d1-in",
 					    MCSPI_PINDIR_D0_IN_D1_OUT);
 	priv->wordlen = SPI_DEFAULT_WORDLEN;
@@ -662,9 +671,17 @@ static const struct dm_spi_ops omap3_spi_ops = {
 	 */
 };
 
+static struct omap2_mcspi_platform_config omap2_pdata = {
+	.regs_offset = 0,
+};
+
+static struct omap2_mcspi_platform_config omap4_pdata = {
+	.regs_offset = OMAP4_MCSPI_REG_OFFSET,
+};
+
 static const struct udevice_id omap3_spi_ids[] = {
-	{ .compatible = "ti,omap2-mcspi" },
-	{ .compatible = "ti,omap4-mcspi" },
+	{ .compatible = "ti,omap2-mcspi", .data = (ulong)&omap2_pdata },
+	{ .compatible = "ti,omap4-mcspi", .data = (ulong)&omap4_pdata },
 	{ }
 };
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [U-Boot, v2] omap3: Fix SPI registers on am33xx and am43xx
  2016-05-19  7:11 [U-Boot] [PATCH v2] omap3: Fix SPI registers on am33xx and am43xx Martin Hejnfelt
@ 2016-05-23 22:14 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2016-05-23 22:14 UTC (permalink / raw)
  To: u-boot

On Thu, May 19, 2016 at 09:11:58AM +0200, Martin Hejnfelt wrote:

> When the base registers are read from device tree the base is not
> 0x48030100 as the driver expects, but 0x48030000, resulting in
> non functioning SPI. To deal with this, use same idea as how this
> is done in the linux kernel (drivers/spi/spi-omap2-mcspi.c) and
> add a structure with a field that is used to shift the registers
> on these systems.
> 
> v2: Fixed commit subject line to correct cpu
> 
> Signed-off-by: Martin Hejnfelt <mh@newtec.dk>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160523/5e3c6935/attachment.sig>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-23 22:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-19  7:11 [U-Boot] [PATCH v2] omap3: Fix SPI registers on am33xx and am43xx Martin Hejnfelt
2016-05-23 22:14 ` [U-Boot] [U-Boot, " Tom Rini

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.