
The current bounce buffer logic checks if the user passed buffer is DMA aligned, and if so, the same buffer is used. This can be an issue on platforms which have certain IP's that are unable to access memory addresses above a certain point. Introduce a config symbol that can be used by such platforms which forces the bounce buffer logic to allocate the buffer from the heap which is part of the U-Boot image area.
Signed-off-by: Sughosh Ganu sughosh.ganu@linaro.org --- common/bouncebuf.c | 2 +- drivers/core/Kconfig | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/common/bouncebuf.c b/common/bouncebuf.c index b2f87e4d93..f827378e5f 100644 --- a/common/bouncebuf.c +++ b/common/bouncebuf.c @@ -44,7 +44,7 @@ int bounce_buffer_start_extalign(struct bounce_buffer *state, void *data, state->len_aligned = roundup(len, alignment); state->flags = flags;
- if (!addr_is_aligned(state)) { + if (CONFIG_IS_ENABLED(BOUNCE_BUFFER_ALLOC) || !addr_is_aligned(state)) { state->bounce_buffer = memalign(alignment, state->len_aligned); if (!state->bounce_buffer) diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig index 6b4330fe4e..94258e8761 100644 --- a/drivers/core/Kconfig +++ b/drivers/core/Kconfig @@ -476,4 +476,11 @@ config BOUNCE_BUFFER A second possible use of bounce buffers is their ability to provide aligned buffers for DMA operations.
+config BOUNCE_BUFFER_ALLOC + bool "Allocate memory for bounce buffer" + depends on BOUNCE_BUFFER + help + Certain platforms have IP's which are unable to access addresses above + a certain value. This symbol forces the bounce buffer to be allocated + from within the U-Boot image area for such platforms. endmenu