dm: spi: Add support for all targets which requires MANUAL_RELOC
authorMichal Simek <michal.simek@xilinx.com>
Tue, 27 Oct 2015 12:36:42 +0000 (13:36 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 19 Nov 2015 12:10:16 +0000 (13:10 +0100)
It is follow up patch based on
"dm: Add support for all targets which requires MANUAL_RELOC"
(sha1: 484fdf5ba058b07be5ca82763aa2b72063540ef3)
to update function pointers for DM.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Simon Glass <sjg@chromium.org>
drivers/spi/spi-uclass.c

index 58388efbc3be29e8e96e3b64d78fee632bd05a0a..3c7d64ae63227d47702795fe9d5be722726a11ad 100644 (file)
@@ -118,6 +118,26 @@ static int spi_post_probe(struct udevice *bus)
        spi->max_hz = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
                                     "spi-max-frequency", 0);
 
+#if defined(CONFIG_NEEDS_MANUAL_RELOC)
+       struct dm_spi_ops *ops = spi_get_ops(bus);
+
+
+       if (ops->claim_bus)
+               ops->claim_bus += gd->reloc_off;
+       if (ops->release_bus)
+               ops->release_bus += gd->reloc_off;
+       if (ops->set_wordlen)
+               ops->set_wordlen += gd->reloc_off;
+       if (ops->xfer)
+               ops->xfer += gd->reloc_off;
+       if (ops->set_speed)
+               ops->set_speed += gd->reloc_off;
+       if (ops->set_mode)
+               ops->set_mode += gd->reloc_off;
+       if (ops->cs_info)
+               ops->cs_info += gd->reloc_off;
+#endif
+
        return 0;
 }