+// SPDX-License-Identifier: GPL-2.0+
/*
* (C) Copyright 2000-2003
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
* TsiChung Liew (Tsi-Chung.Liew@freescale.com)
- *
- * SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
+#include <flash.h>
+#include <init.h>
+#include <irq_func.h>
#include <asm/immap.h>
ulong flash_get_size(FPWV * addr, flash_info_t * info);
int flash_get_offsets(ulong base, flash_info_t * info);
int write_word(flash_info_t * info, FPWV * dest, u16 data);
-void inline spin_wheel(void);
+static inline void spin_wheel(void);
flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
int flash_get_offsets(ulong base, flash_info_t * info)
{
- int j, k;
+ int i;
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) {
info->start[0] = base;
- for (k = 0, j = 0; j < CONFIG_SYS_SST_SECT; j++, k++) {
- info->start[k + 1] = info->start[k] + CONFIG_SYS_SST_SECTSZ;
- info->protect[k] = 0;
+ info->protect[0] = 0;
+ for (i = 1; i < CONFIG_SYS_SST_SECT; i++) {
+ info->start[i] = info->start[i - 1]
+ + CONFIG_SYS_SST_SECTSZ;
+ info->protect[i] = 0;
}
}
count = 0;
}
- if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
+ /* check timeout, 1000ms */
+ if (get_timer(start) > 1000) {
printf("Timeout\n");
*addr = 0x00F0; /* reset to read mode */
enable_interrupts();
while ((*addr & 0x0080) != 0x0080) {
- if (get_timer(start) >
- CONFIG_SYS_FLASH_ERASE_TOUT) {
+ /* check timeout, 1000ms */
+ if (get_timer(start) > 1000) {
printf("Timeout\n");
*addr = 0x00F0; /* reset to read mode */
/* data polling for D7 */
while (res == 0
&& (*dest & (u8) 0x00800080) != (data & (u8) 0x00800080)) {
- if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
+ /* check timeout, 500ms */
+ if (get_timer(start) > 500) {
*dest = (u8) 0x00F000F0; /* reset bank */
res = 1;
}
return (res);
}
-void inline spin_wheel(void)
+static inline void spin_wheel(void)
{
static int p = 0;
static char w[] = "\\/-";