diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2024-07-05 16:00:30 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-08-12 14:23:44 -0400 |
commit | 15e52374698ba7395ff0ece0d3d70435a66406c4 (patch) | |
tree | 778f81817b2381decc920b49242e91f994f2d8ee /firmware/target/mips/ingenic_jz47xx/ata-nand-jz4760.c | |
parent | 9ff308a589f3655453fe047d9b08ca5e2a01f06d (diff) | |
download | rockbox-15e52374698ba7395ff0ece0d3d70435a66406c4.tar.gz rockbox-15e52374698ba7395ff0ece0d3d70435a66406c4.zip |
storage: 64-bit sector offsets
* Create new 'sector_t' type alias:
* uint64_t for all targets with HAVE_LBA48 or HAVE_SDUC
* unsigned long for the everything else
* Alter all storage APIs to use sector_t instead of 'unsigned long'
* Alter Volume/Partition/storage info structures to use sector_t
* Disk cache converted to sector_t
* ATA Core:
* convert to using sector_t for sector addresses and drive sizes
* Always fill out upper 16 bits of LBA48 addresses
* IDENTIFY INFO is fixed at 512 bytes, not SECTOR_SIZE
* USB mass storage:
* convert to using sector_t for sector addesses and drive sizes
* Implement READ_16/WRITE_16 for LBA48 addresses
* Convert FAT code to use sector_t for all sector references
* output_dyn_value() now accepts int64_t instead of 'int'
* Corrected "rockbox info" to work for (MULTIVOLUME & !MULTIDRIVE)
* Better reporting of disk and (logical+physical) sector sizes in debug info
* Detect SDUC cards and report on storage debug_info screen
To-do: SDUC
* Refactor SD core to remove duplicate code in every driver
* Card probe and init state machine
* Implement core SDUC support
* SD2.0 needs to be 2.0+ (fixed for jz47xx and x1000)
* Host and Card ID (ACMD41)
* 32-bit addressing for all read/write/erase operations (CMD22)
* ADD SDUC to target device drivers, defining HAVE_SDUC as appropriate
Change-Id: Ib0138781a0081664d11511037685503df1b93608
Diffstat (limited to 'firmware/target/mips/ingenic_jz47xx/ata-nand-jz4760.c')
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/ata-nand-jz4760.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4760.c b/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4760.c index 914cd6d9d3..ff9b7e419e 100644 --- a/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4760.c +++ b/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4760.c | |||
@@ -110,7 +110,7 @@ struct nand_param { | |||
110 | 110 | ||
111 | static struct nand_info* chip_info = NULL; | 111 | static struct nand_info* chip_info = NULL; |
112 | static struct nand_info* bank; | 112 | static struct nand_info* bank; |
113 | static unsigned long nand_size; | 113 | static sector_t nand_size; |
114 | static struct nand_param internal_param; | 114 | static struct nand_param internal_param; |
115 | static struct mutex nand_mtx; | 115 | static struct mutex nand_mtx; |
116 | #ifdef USE_DMA | 116 | #ifdef USE_DMA |
@@ -281,7 +281,7 @@ static void jz_rs_correct(unsigned char *dat, int idx, int mask) | |||
281 | /* | 281 | /* |
282 | * Read oob | 282 | * Read oob |
283 | */ | 283 | */ |
284 | static int jz_nand_read_oob(unsigned long page_addr, unsigned char *buf, int size) | 284 | static int jz_nand_read_oob(sector_t page_addr, unsigned char *buf, int size) |
285 | { | 285 | { |
286 | struct nand_param *nandp = &internal_param; | 286 | struct nand_param *nandp = &internal_param; |
287 | int page_size, row_cycle, bus_width; | 287 | int page_size, row_cycle, bus_width; |
@@ -337,7 +337,7 @@ static int jz_nand_read_oob(unsigned long page_addr, unsigned char *buf, int siz | |||
337 | * page - page number within a block: 0, 1, 2, ... | 337 | * page - page number within a block: 0, 1, 2, ... |
338 | * dst - pointer to target buffer | 338 | * dst - pointer to target buffer |
339 | */ | 339 | */ |
340 | static int jz_nand_read_page(unsigned long page_addr, unsigned char *dst) | 340 | static int jz_nand_read_page(sector_t page_addr, unsigned char *dst) |
341 | { | 341 | { |
342 | struct nand_param *nandp = &internal_param; | 342 | struct nand_param *nandp = &internal_param; |
343 | int page_size, oob_size; | 343 | int page_size, oob_size; |
@@ -532,7 +532,7 @@ int nand_init(void) | |||
532 | return res; | 532 | return res; |
533 | } | 533 | } |
534 | 534 | ||
535 | static inline int read_sector(unsigned long start, unsigned int count, | 535 | static inline int read_sector(sector_t start, unsigned int count, |
536 | void* buf, unsigned int chip_size) | 536 | void* buf, unsigned int chip_size) |
537 | { | 537 | { |
538 | register int ret; | 538 | register int ret; |
@@ -548,7 +548,7 @@ static inline int read_sector(unsigned long start, unsigned int count, | |||
548 | return ret; | 548 | return ret; |
549 | } | 549 | } |
550 | 550 | ||
551 | static inline int write_sector(unsigned long start, unsigned int count, | 551 | static inline int write_sector(sector_t start, unsigned int count, |
552 | const void* buf, unsigned int chip_size) | 552 | const void* buf, unsigned int chip_size) |
553 | { | 553 | { |
554 | int ret = 0; | 554 | int ret = 0; |
@@ -563,14 +563,14 @@ static inline int write_sector(unsigned long start, unsigned int count, | |||
563 | return ret; | 563 | return ret; |
564 | } | 564 | } |
565 | 565 | ||
566 | int nand_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* buf) | 566 | int nand_read_sectors(IF_MD(int drive,) sector_t start, int count, void* buf) |
567 | { | 567 | { |
568 | #ifdef HAVE_MULTIDRIVE | 568 | #ifdef HAVE_MULTIDRIVE |
569 | (void)drive; | 569 | (void)drive; |
570 | #endif | 570 | #endif |
571 | int ret = 0; | 571 | int ret = 0; |
572 | unsigned int _count, chip_size = chip_info->page_size; | 572 | unsigned int _count, chip_size = chip_info->page_size; |
573 | unsigned long _start; | 573 | sector_t _start; |
574 | 574 | ||
575 | logf("start"); | 575 | logf("start"); |
576 | mutex_lock(&nand_mtx); | 576 | mutex_lock(&nand_mtx); |
@@ -590,14 +590,14 @@ int nand_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* bu | |||
590 | return ret; | 590 | return ret; |
591 | } | 591 | } |
592 | 592 | ||
593 | int nand_write_sectors(IF_MD(int drive,) unsigned long start, int count, const void* buf) | 593 | int nand_write_sectors(IF_MD(int drive,) sector_t start, int count, const void* buf) |
594 | { | 594 | { |
595 | #ifdef HAVE_MULTIDRIVE | 595 | #ifdef HAVE_MULTIDRIVE |
596 | (void)drive; | 596 | (void)drive; |
597 | #endif | 597 | #endif |
598 | int ret = 0; | 598 | int ret = 0; |
599 | unsigned int _count, chip_size = chip_info->page_size; | 599 | unsigned int _count, chip_size = chip_info->page_size; |
600 | unsigned long _start; | 600 | sector_t _start; |
601 | 601 | ||
602 | logf("start"); | 602 | logf("start"); |
603 | mutex_lock(&nand_mtx); | 603 | mutex_lock(&nand_mtx); |