#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_cache.h>
+#include <cyg/hal/hal_misc.h>
#include <cyg/io/nand_bbt.h>
#include <redboot.h>
#include <stdlib.h>
#define _FLASH_PRIVATE_
#include <cyg/io/flash.h>
+#ifdef CYGHWR_FLASH_NAND_BBT_HEADER
#include CYGHWR_FLASH_NAND_BBT_HEADER
+#endif
#include <cyg/io/imx_nfc.h>
u32 id[2];
int i;
-#if 0
- return FLASH_ERR_DRV_WRONG_PART;
-#endif
nfc_printf(NFC_DEBUG_MAX, "%s()\n", __FUNCTION__);
if (nfc_iomux_setup)
nfc_printf(NFC_DEBUG_MIN, "%s: read flash id from chip %d @ %p\n",
__FUNCTION__, cs_line, ptr);
-#if 0
-#if 1
- {
- int i;
- const int nwords = 512 >> 2;
-
- for (i = 0; i < 8; i++) {
- int j;
-
- for (j = 0; j < nwords; j++) {
- ptr[i * nwords + j] = 0xdeadbeef;
- }
- }
- }
-#else
- {
- int i;
- const int nwords = 512 >> 2;
-
- for (i = 0; i < 8; i++) {
- int j;
- for (j = 0; j < nwords; j++) {
- id[i * nwords + j] = 0xdeadbeef;
- }
- }
- }
-#endif
-#endif
NFC_PRESET(MXC_UNLOCK_BLK_END);
NFC_SET_NFC_ACTIVE_CS(cs_line);
NFC_CMD_INPUT(FLASH_Read_ID);
return 0;
}
+static inline void mxc_nfc_buf_clear(unsigned long buf, u8 pattern, int size)
+{
+ int i;
+ u16 *p = (u16 *)buf;
+ u16 fill = pattern;
+
+ fill = (fill << 8) | pattern;
+ for (i = 0; i < size >> 1; i++) {
+ p[i] = fill;
+ }
+}
+
+#ifdef CYGHWR_FLASH_NAND_BBT_HEADER
/*
* check_short_pattern - [GENERIC] check if a pattern is in the buffer
* @buf: the buffer to search
return 0;
}
-static inline void mxc_nfc_buf_clear(unsigned long buf, u8 pattern, int size)
-{
- int i;
- u16 *p = (u16 *)buf;
- u16 fill = pattern;
-
- fill = (fill << 8) | pattern;
- for (i = 0; i < size >> 1; i++) {
- p[i] = fill;
- }
-}
-
static int mxc_nfc_write_bbt(struct nand_bbt_descr *td, struct nand_bbt_descr *md)
{
int ret = -1;
{
return mxc_nfc_update_bbt(g_mxc_nfc_bbt_main_descr, g_mxc_nfc_bbt_mirror_descr);
}
+#else
+static int program_bbt_to_flash(void)
+{
+ return 0;
+}
+#endif
/*!
* Unconditionally erase a block without checking the BI field.
static void do_nand_cmds(int argc, char *argv[])
{
struct cmd *cmd;
-#if 0
- unsigned long ctrl, l2, sid, cs;
- unsigned int d, i;
-
- HAL_FLASH_CACHES_OFF(d, i);
- diag_printf("DCACHE: %d ICACHE: %d\n", d, i);
- HAL_FLASH_CACHES_ON(d, i);
-
- asm volatile(
- "MRC p15, 0, %0, c1, c0, 0;"
- "MRC p15, 0, %1, c1, c0, 1;"
- "MRC p15, 1, %2, c0, c0, 7;"
- "MRC p15, 1, %3, c0, c0, 0;"
- : "=r"(ctrl), "=r"(l2), "=r"(sid), "=r"(cs)
- );
-
- diag_printf("ctrl: %08lx aux: %08lx sid: %08lx cs: %08lx\n", ctrl, l2, sid, cs);
-#endif
if (!mxcnfc_init_ok) {
flash_hwr_init();