mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
iriver_flash: make cfi_read_id use FB directly
Change-Id: Id747b0846515443871a0df10d83e3b1fc4731e7c
This commit is contained in:
parent
e5b963b8e1
commit
bee736f3ea
1 changed files with 10 additions and 12 deletions
|
@ -67,26 +67,24 @@ static volatile uint16_t* FB = (uint16_t*)0x00000000; /* Flash base address */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* read the manufacturer and device ID */
|
/* read the manufacturer and device ID */
|
||||||
bool cfi_read_id(volatile uint16_t* pBase, uint8_t* pManufacturerID, uint8_t* pDeviceID)
|
bool cfi_read_id(uint8_t* pManufacturerID, uint8_t* pDeviceID)
|
||||||
{
|
{
|
||||||
uint8_t not_manu, not_id; /* read values before switching to ID mode */
|
uint8_t not_manu, not_id; /* read values before switching to ID mode */
|
||||||
uint8_t manu, id; /* read values when in ID mode */
|
uint8_t manu, id; /* read values when in ID mode */
|
||||||
|
|
||||||
pBase = (uint16_t*)((uint32_t)pBase & 0xFFF80000); /* down to 512k align */
|
|
||||||
|
|
||||||
/* read the normal content */
|
/* read the normal content */
|
||||||
not_manu = pBase[0]; /* should be 'A' (0x41) and 'R' (0x52) */
|
not_manu = FB[0]; /* should be 'A' (0x41) and 'R' (0x52) */
|
||||||
not_id = pBase[1]; /* from the "ARCH" marker */
|
not_id = FB[1]; /* from the "ARCH" marker */
|
||||||
|
|
||||||
pBase[0x5555] = 0xAA; /* enter command mode */
|
FB[0x5555] = 0xAA; /* enter command mode */
|
||||||
pBase[0x2AAA] = 0x55;
|
FB[0x2AAA] = 0x55;
|
||||||
pBase[0x5555] = 0x90; /* ID command */
|
FB[0x5555] = 0x90; /* ID command */
|
||||||
rb->sleep(HZ/50); /* Atmel wants 20ms pause here */
|
rb->sleep(HZ/50); /* Atmel wants 20ms pause here */
|
||||||
|
|
||||||
manu = pBase[0];
|
manu = FB[0];
|
||||||
id = pBase[1];
|
id = FB[1];
|
||||||
|
|
||||||
pBase[0] = 0xF0; /* reset flash (back to normal read mode) */
|
FB[0] = 0xF0; /* reset flash (back to normal read mode) */
|
||||||
rb->sleep(HZ/50); /* Atmel wants 20ms pause here */
|
rb->sleep(HZ/50); /* Atmel wants 20ms pause here */
|
||||||
|
|
||||||
/* I assume success if the obtained values are different from
|
/* I assume success if the obtained values are different from
|
||||||
|
@ -149,7 +147,7 @@ bool cfi_get_flash_info(struct flash_info* pInfo)
|
||||||
{
|
{
|
||||||
rb->memset(pInfo, 0, sizeof(struct flash_info));
|
rb->memset(pInfo, 0, sizeof(struct flash_info));
|
||||||
|
|
||||||
if (!cfi_read_id(FB, &pInfo->manufacturer, &pInfo->id))
|
if (!cfi_read_id(&pInfo->manufacturer, &pInfo->id))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (pInfo->manufacturer == 0xBF) /* SST */
|
if (pInfo->manufacturer == 0xBF) /* SST */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue