Skip to contentSkip to conversation

spi: spi-uclass: Add support to manually relocate spi memory ops

PATCH New Michal Simek 3 participants 3 messages Mar 17, 2021 – Mar 27, 2021 SPI

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 spi: spi-uclass: Add support to manually relocate spi memory ops

From: T Karthik Reddy <[email protected]>

Add spi memory operations to relocate manually when CONFIG_NEEDS_MANUAL_RELOC is enabled.

---

Changes in v2:
- Check if mem_ops is defined before relocation - reported-by Pratyush Yadav <[email protected]>

 drivers/spi/spi-uclass.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/spi/spi-uclass.c +11 -0
index 7155d4aebd6d..ee30110b5658 100644
@@ -11,6 +11,7 @@
 #include <log.h>
 #include <malloc.h>
 #include <spi.h>
+#include <spi-mem.h>
 #include <dm/device_compat.h>
 #include <asm/global_data.h>
 #include <dm/device-internal.h>
@@ -199,6 +200,16 @@ static int spi_post_probe(struct udevice *bus)
 			ops->set_mode += gd->reloc_off;
 		if (ops->cs_info)
 			ops->cs_info += gd->reloc_off;
+		if (ops->mem_ops) {
+			struct spi_controller_mem_ops *mem_ops =
+				(struct spi_controller_mem_ops *)ops->mem_ops;
+			if (mem_ops->adjust_op_size)
+				mem_ops->adjust_op_size += gd->reloc_off;
+			if (mem_ops->supports_op)
+				mem_ops->supports_op += gd->reloc_off;
+			if (mem_ops->exec_op)
+				mem_ops->exec_op += gd->reloc_off;
+		}
 		reloc_done++;
 	}
 #endif
Signature · 1 line
2.30.1
#1 lore raw

PATCH v2 1/1 spi: spi-uclass: Add support to manually relocate spi memory ops

Quoted 8 lines · Michal Simek

From: T Karthik Reddy <[email protected]>

Add spi memory operations to relocate manually when CONFIG_NEEDS_MANUAL_RELOC is enabled.

Signature · 3 lines
Regards,
Pratyush Yadav
Texas Instruments Inc.
#2 lore raw

PATCH v2 1/1 spi: spi-uclass: Add support to manually relocate spi memory ops

Quoted 8 lines · Michal Simek

From: T Karthik Reddy <[email protected]>

Add spi memory operations to relocate manually when CONFIG_NEEDS_MANUAL_RELOC is enabled.

Signature · 5 lines
Regards,
Pratyush Yadav
Texas Instruments Inc.

Applied to u-boot-dm/next, thanks!