summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/rk27xx/sd-rk27xx.c
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2018-06-29 16:09:28 -0400
committerSolomon Peachy <pizza@shaftnet.org>2019-01-02 08:10:01 -0500
commitd4942cc74c82c465ea395637c77ed06565b8b497 (patch)
tree8c1fa737c93f8a2ade5a1566857dc4dc8f578bd6 /firmware/target/arm/rk27xx/sd-rk27xx.c
parentaf9459a7992596e932c6d8cc0a6366ff0f0b0fca (diff)
downloadrockbox-d4942cc74c82c465ea395637c77ed06565b8b497.tar.gz
rockbox-d4942cc74c82c465ea395637c77ed06565b8b497.tar.bz2
rockbox-d4942cc74c82c465ea395637c77ed06565b8b497.zip
Add Xuelin iHIFI 770/770C/800 support
Taken from the xvortex fork (Roman Stolyarov) Ported, rebased, and cleaned up by myself. Change-Id: I7b2bca2d29502f2e4544e42f3d122786dd4b7978
Diffstat (limited to 'firmware/target/arm/rk27xx/sd-rk27xx.c')
-rw-r--r--firmware/target/arm/rk27xx/sd-rk27xx.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/firmware/target/arm/rk27xx/sd-rk27xx.c b/firmware/target/arm/rk27xx/sd-rk27xx.c
index 2ddfd0cf0a..e5467058de 100644
--- a/firmware/target/arm/rk27xx/sd-rk27xx.c
+++ b/firmware/target/arm/rk27xx/sd-rk27xx.c
@@ -97,7 +97,7 @@ void INT_SD(void)
/* get the status */
cmd_error = SD_CMDRES;
semaphore_release(&command_completion_signal);
- }
+ }
/* data transfer status pending */
if(status & DATA_XFER_STAT)
@@ -140,13 +140,15 @@ static void mmu_buff_reset(void)
static inline bool card_detect_target(void)
{
-#if defined(RK27_GENERIC)
-/* My generic device uses PC7 pin, active low */
+#if defined(RK27_GENERIC) || defined(IHIFI770) || defined(IHIFI770C) || defined(IHIFI800)
+ /* PC7, active low */
return !(GPIO_PCDR & 0x80);
#elif defined(HM60X) || defined(HM801)
+ /* PF2, active low */
return !(GPIO_PFDR & (1<<2));
#elif defined(MA9) || defined(MA9C) || defined(MA8) || defined(MA8C)
- return (GPIO_PCDR & 0x80);
+ /* PC7, active high */
+ return (GPIO_PCDR & (1<<7));
#elif defined(IHIFI760) || defined(IHIFI960)
/* TODO: find out pin */
return true;
@@ -190,7 +192,7 @@ static bool send_cmd(const int cmd, const int arg, const int res,
#if 0
/* for some misterious reason the card does not report itself as being in TRAN
* but transfers are successful. Rockchip OF does not check the card state
- * after SELECT. I checked two different cards.
+ * after SELECT. I checked two different cards.
*/
static void print_card_status(void)
{
@@ -224,7 +226,7 @@ static int sd_wait_for_tran_state(void)
{
return 0;
}
-
+
if(TIME_AFTER(current_tick, timeout))
{
return -10 * ((response >> 9) & 0xf);
@@ -265,7 +267,7 @@ static int sd_init_card(void)
/* CMD0 Go Idle */
if(!send_cmd(SD_GO_IDLE_STATE, 0, RES_NO, NULL))
return -1;
-
+
sleep(1);
/* CMD8 Check for v2 sd card. Must be sent before using ACMD41
@@ -671,7 +673,7 @@ int sd_write_sectors(IF_MD(int drive,) unsigned long start, int count,
#endif
return ret;
-
+
#endif /* defined(BOOTLOADER) */
}