summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2021-03-27 17:17:19 -0400
committerSolomon Peachy <pizza@shaftnet.org>2021-03-27 17:18:21 -0400
commit83fcbedc65f4b9ae7e491ecf6f07c0af4b245f74 (patch)
treed7f7027548890297afba44919ab3f99b4446319a /firmware/target/arm
parent961ffa61dd9126d9f6a01a88a26cac3e7bc87657 (diff)
downloadrockbox-83fcbedc65f4b9ae7e491ecf6f07c0af4b245f74.tar.gz
rockbox-83fcbedc65f4b9ae7e491ecf6f07c0af4b245f74.tar.bz2
rockbox-83fcbedc65f4b9ae7e491ecf6f07c0af4b245f74.zip
rk27xx: Take advantage of STORAGE_NEEDS_BOUNCE_BUFFER
(And get rid of its custom realignment code) Change-Id: Iff27d717b870d3db239310421776744ea6863373
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/rk27xx/sd-rk27xx.c9
-rw-r--r--firmware/target/arm/rk27xx/system-target.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/firmware/target/arm/rk27xx/sd-rk27xx.c b/firmware/target/arm/rk27xx/sd-rk27xx.c
index e5467058de..2ddf91a67e 100644
--- a/firmware/target/arm/rk27xx/sd-rk27xx.c
+++ b/firmware/target/arm/rk27xx/sd-rk27xx.c
@@ -41,6 +41,7 @@
#include "sysfont.h"
#define RES_NO (-1)
+// #define ALIGN_BUF
/* debug stuff */
unsigned long sd_debug_time_rd = 0;
@@ -51,7 +52,9 @@ static tCardInfo card_info;
/* for compatibility */
static long last_disk_activity = -1;
+#ifdef ALIGN_BUF
static unsigned char aligned_buf[512] STORAGE_ALIGN_ATTR;
+#endif
static struct mutex sd_mtx SHAREDBSS_ATTR;
#ifndef BOOTLOADER
@@ -397,8 +400,10 @@ static inline void read_sd_data(unsigned char **dst)
{
void *buf = *dst;
+#ifdef ALIGN_BUF
if (!IS_ALIGNED(((unsigned long)*dst), CACHEALIGN_SIZE))
buf = aligned_buf;
+#endif
commit_discard_dcache_range((const void *)buf, 512);
@@ -413,8 +418,10 @@ static inline void read_sd_data(unsigned char **dst)
/* wait for DMA engine to finish transfer */
while (A2A_DMA_STS & 1);
+#ifdef ALIGN_BUF
if (buf == aligned_buf)
memcpy(*dst, aligned_buf, 512);
+#endif
*dst += 512;
}
@@ -423,11 +430,13 @@ static inline void write_sd_data(unsigned char **src)
{
void *buf = *src;
+#ifdef ALIGN_BUF
if (!IS_ALIGNED(((unsigned long)*src), CACHEALIGN_SIZE))
{
buf = aligned_buf;
memcpy(aligned_buf, *src, 512);
}
+#endif
commit_discard_dcache_range((const void *)buf, 512);
diff --git a/firmware/target/arm/rk27xx/system-target.h b/firmware/target/arm/rk27xx/system-target.h
index a5b27cc6b2..eca675a2af 100644
--- a/firmware/target/arm/rk27xx/system-target.h
+++ b/firmware/target/arm/rk27xx/system-target.h
@@ -53,5 +53,6 @@ void commit_discard_idcache(void);
#define CPUFREQ_MAX 200000000
#define STORAGE_WANTS_ALIGN
+#define STORAGE_NEEDS_BOUNCE_BUFFER
#endif /* SYSTEM_TARGET_H */