#include <common.h>
#include <console.h>
#include <cpu_func.h>
+#include <flash.h>
#include <irq_func.h>
+#include <uuid.h>
+#include <linux/delay.h>
#define PHYS_FLASH_1 CONFIG_SYS_FLASH_BASE
#define FLASH_BANK_SIZE 0x200000
flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
-void flash_print_info (flash_info_t * info)
+void flash_print_info(flash_info_t *info)
{
int i;
}
-unsigned long flash_init (void)
+unsigned long flash_init(void)
{
int i, j;
ulong size = 0;
size += flash_info[i].size;
}
- flash_protect (FLAG_PROTECT_SET,
- CONFIG_SYS_FLASH_BASE,
- CONFIG_SYS_FLASH_BASE + 0x3ffff, &flash_info[0]);
+ flash_protect(FLAG_PROTECT_SET,
+ CONFIG_SYS_FLASH_BASE,
+ CONFIG_SYS_FLASH_BASE + 0x3ffff, &flash_info[0]);
return size;
}
#define TMO 4
-int flash_erase (flash_info_t * info, int s_first, int s_last)
+int flash_erase(flash_info_t *info, int s_first, int s_last)
{
ulong result;
int iflag, cflag, prot, sect;
do {
result = *addr;
- /* check timeout */
- if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
+ /* check timeout, 1000ms */
+ if (get_timer(start) > 1000) {
MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
chip1 = TMO;
break;
outahere:
/* allow flash to settle - wait 10 ms */
- udelay (10000);
+ mdelay(10);
if (iflag)
enable_interrupts();
return rc;
}
-static int write_word (flash_info_t * info, ulong dest, ulong data)
+static int write_word(flash_info_t *info, ulong dest, ulong data)
{
volatile u16 *addr = (volatile u16 *) dest;
ulong result;
do {
result = *addr;
- /* check timeout */
- if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
+ /* check timeout, 1000ms */
+ if (get_timer(start) > 1000) {
chip1 = ERR | TMO;
break;
}
}
-int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
+int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
{
ulong wp, data;
int rc;