#define NAND_CONFIGURATION1_REG 0xDEADEEEE
#define NFC_FLASH_CONFIG2_REG 0xDEADEEEE
#define NFC_FLASH_CONFIG2_ECC_EN 0xDEADEEEE
-#define write_nfc_ip_reg(a, b)
+#define write_nfc_ip_reg(a, b) CYG_EMPTY_STATEMENT
#endif
#ifndef MXCFLASH_SELECT_MULTI
__FUNCTION__, __LINE__, &id[0], data);
memcpy(data, id, sizeof(id));
}
- nfc_printf(NFC_DEBUG_MAX, "%s@%d %p\n", __FUNCTION__, __LINE__,
+ nfc_printf(NFC_DEBUG_MAX, "%s@%d called from %p\n", __FUNCTION__, __LINE__,
__builtin_return_address(0));
}
static const flash_dev_info_t supported_devices[] = {
#include <cyg/io/mxc_nand_parts.inl>
};
-#define NUM_DEVICES NUM_ELEMS(supported_devices)
-
-#define COL_CYCLE flash_dev_info->col_cycle
-#define ROW_CYCLE flash_dev_info->row_cycle
-#define NF_PG_SZ ((flash_dev_info->page_size) * num_of_nand_chips)
-#define NF_SPARE_SZ ((flash_dev_info->spare_size) * num_of_nand_chips)
-#define NF_PG_PER_BLK flash_dev_info->pages_per_block
-#define NF_DEV_SZ ((flash_dev_info->device_size) * num_of_nand_chips_for_nandsize)
-#define NF_BLK_SZ ((flash_dev_info->block_size) * num_of_nand_chips)
-#define NF_BLK_CNT ((flash_dev_info->block_count) / scale_block_cnt)
-#define NF_VEND_INFO flash_dev_info->vendor_info
-#define NF_OPTIONS flash_dev_info->options
-#define NF_BBT_MAX_NR flash_dev_info->bbt_blk_max_nr
-#define NF_OPTIONS flash_dev_info->options
-#define NF_BI_OFF flash_dev_info->bi_off
+#define NUM_DEVICES NUM_ELEMS(supported_devices)
+
+#define COL_CYCLE flash_dev_info->col_cycle
+#define ROW_CYCLE flash_dev_info->row_cycle
+#define NF_PG_SZ (flash_dev_info->page_size * num_of_nand_chips)
+#define NF_SPARE_SZ (flash_dev_info->spare_size * num_of_nand_chips)
+#define NF_PG_PER_BLK flash_dev_info->pages_per_block
+#define NF_DEV_SZ (flash_dev_info->device_size * num_of_nand_chips_for_nandsize)
+#define NF_BLK_SZ (flash_dev_info->block_size * num_of_nand_chips)
+#define NF_BLK_CNT (flash_dev_info->block_count / scale_block_cnt)
+#define NF_VEND_INFO flash_dev_info->vendor_info
+#define NF_OPTIONS flash_dev_info->options
+#define NF_BBT_MAX_NR flash_dev_info->bbt_blk_max_nr
+#define NF_OPTIONS flash_dev_info->options
+#define NF_BI_OFF flash_dev_info->bi_off
#define MXC_NAND_ADDR_MASK (NF_DEV_SZ - 1)
#define BLOCK_TO_OFFSET(blk) ((blk) * NF_PG_PER_BLK * NF_PG_SZ)
static u8 *g_bbt, *g_page_buf;
static u32 g_bbt_sz;
-static bool mxcnfc_init_ok = false;
+static bool mxcnfc_init_ok;
static bool mxc_nfc_scan_done;
// this callback allows the platform specific function to be called right
flash_addr_t s = (unsigned long)start & MXC_NAND_ADDR_MASK;
flash_addr_t e = ((unsigned long)end - 1) & MXC_NAND_ADDR_MASK;
+ if (start == end)
+ return;
if (flash_enable++ == 0) {
flash_region_start = s;
flash_region_end = e;
flash_addr_t s = (unsigned long)start & MXC_NAND_ADDR_MASK;
flash_addr_t e = ((unsigned long)end - 1) & MXC_NAND_ADDR_MASK;
+ if (start == end)
+ return;
if (flash_enable) {
if (--flash_enable == 0) {
diag_printf1("Disabling flash region 0x%08llx..0x%08llx\n",
NFC_CMD_INPUT(FLASH_Reset);
// Look through table for device data
- nfc_printf(NFC_DEBUG_MAX, "%s@%d %p\n", __FUNCTION__, __LINE__, &id[0]);
flash_dev_query(&id[0]);
- nfc_printf(NFC_DEBUG_MAX, "%s@%d\n", __FUNCTION__, __LINE__);
flash_dev_info = supported_devices;
for (i = 0; i < NUM_DEVICES; i++) {
break;
flash_dev_info++;
}
- nfc_printf(NFC_DEBUG_MAX, "%s@%d\n", __FUNCTION__, __LINE__);
// Did we find the device? If not, return error.
if (NUM_DEVICES == i) {
nfc_printf(NFC_DEBUG_MED, "%s(): %d out of NUM_DEVICES=%d, id=0x%02x\n",
__FUNCTION__, i, NUM_DEVICES, flash_dev_info->device_id);
- if (nfc_setup) {
- nfc_printf(NFC_DEBUG_MAX, "%s@%d\n", __FUNCTION__, __LINE__);
+ if (nfc_setup)
g_nfc_version = nfc_setup(NF_PG_SZ / num_of_nand_chips, flash_dev_info->port_size,
- flash_dev_info->type, num_of_nand_chips);
- }
- nfc_printf(NFC_DEBUG_MAX, "%s@%d\n", __FUNCTION__, __LINE__);
+ flash_dev_info->type, num_of_nand_chips);
+
diag_printf1("NFC version: %02x\n", g_nfc_version);
if (g_nfc_version >= MXC_NFC_V3) {
for (i = 2; i <= NUM_OF_CS_LINES; i++) {