Add Xuelin iHIFI 770/770C/800 support

Taken from the xvortex fork (Roman Stolyarov)
Ported, rebased, and cleaned up by myself.

Change-Id: I7b2bca2d29502f2e4544e42f3d122786dd4b7978
This commit is contained in:
Solomon Peachy 2018-06-29 16:09:28 -04:00
parent af9459a799
commit d4942cc74c
95 changed files with 4419 additions and 534 deletions

View file

@ -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) */
}