diff options
Diffstat (limited to 'firmware/target/arm/ata-nand-telechips.c')
-rw-r--r-- | firmware/target/arm/ata-nand-telechips.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/firmware/target/arm/ata-nand-telechips.c b/firmware/target/arm/ata-nand-telechips.c index 81dde33938..2ae425f4c6 100644 --- a/firmware/target/arm/ata-nand-telechips.c +++ b/firmware/target/arm/ata-nand-telechips.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include "panic.h" | 26 | #include "panic.h" |
27 | #include "nand_id.h" | 27 | #include "nand_id.h" |
28 | #include "storage.h" | 28 | #include "storage.h" |
29 | #include "buffer.h" | ||
30 | 29 | ||
31 | #define SECTOR_SIZE 512 | 30 | #define SECTOR_SIZE 512 |
32 | 31 | ||
@@ -122,8 +121,9 @@ struct lpt_entry | |||
122 | #ifdef BOOTLOADER | 121 | #ifdef BOOTLOADER |
123 | static struct lpt_entry lpt_lookup[MAX_SEGMENTS]; | 122 | static struct lpt_entry lpt_lookup[MAX_SEGMENTS]; |
124 | #else | 123 | #else |
125 | /* buffer_alloc'd in nand_init() when the correct size has been determined */ | 124 | /* core_alloc()'d in nand_init() when the correct size has been determined */ |
126 | static struct lpt_entry* lpt_lookup = NULL; | 125 | #include "core_alloc.h" |
126 | static int lpt_handle; | ||
127 | #endif | 127 | #endif |
128 | 128 | ||
129 | /* Write Caches */ | 129 | /* Write Caches */ |
@@ -607,6 +607,9 @@ static bool nand_read_sector_of_logical_segment(int log_segment, int sector, | |||
607 | int page_in_segment = sector / sectors_per_page; | 607 | int page_in_segment = sector / sectors_per_page; |
608 | int sector_in_page = sector % sectors_per_page; | 608 | int sector_in_page = sector % sectors_per_page; |
609 | 609 | ||
610 | #ifndef BOOTLOADER | ||
611 | struct lpt_entry* lpt_lookup = core_get_data(lpt_handle); | ||
612 | #endif | ||
610 | int bank = lpt_lookup[log_segment].bank; | 613 | int bank = lpt_lookup[log_segment].bank; |
611 | int phys_segment = lpt_lookup[log_segment].phys_segment; | 614 | int phys_segment = lpt_lookup[log_segment].phys_segment; |
612 | 615 | ||
@@ -918,7 +921,8 @@ int nand_init(void) | |||
918 | #ifndef BOOTLOADER | 921 | #ifndef BOOTLOADER |
919 | /* Use chip info to allocate the correct size LPT buffer */ | 922 | /* Use chip info to allocate the correct size LPT buffer */ |
920 | lptbuf_size = sizeof(struct lpt_entry) * segments_per_bank * total_banks; | 923 | lptbuf_size = sizeof(struct lpt_entry) * segments_per_bank * total_banks; |
921 | lpt_lookup = buffer_alloc(lptbuf_size); | 924 | lpt_handle = core_alloc("lpt lookup", lptbuf_size); |
925 | struct lpt_entry* lpt_lookup = core_get_data(lpt_handle); | ||
922 | #else | 926 | #else |
923 | /* Use a static array in the bootloader */ | 927 | /* Use a static array in the bootloader */ |
924 | lptbuf_size = sizeof(lpt_lookup); | 928 | lptbuf_size = sizeof(lpt_lookup); |
@@ -968,6 +972,9 @@ int nand_init(void) | |||
968 | 972 | ||
969 | if (log_segment < segments_per_bank * total_banks) | 973 | if (log_segment < segments_per_bank * total_banks) |
970 | { | 974 | { |
975 | #ifndef BOOTLOADER | ||
976 | lpt_lookup = core_get_data(lpt_handle); | ||
977 | #endif | ||
971 | if (lpt_lookup[log_segment].bank == -1 || | 978 | if (lpt_lookup[log_segment].bank == -1 || |
972 | lpt_lookup[log_segment].phys_segment == -1) | 979 | lpt_lookup[log_segment].phys_segment == -1) |
973 | { | 980 | { |