Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OS
U-Boot.Mirror
提交
e6009629
U
U-Boot.Mirror
项目概览
OS
/
U-Boot.Mirror
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
U-Boot.Mirror
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e6009629
编写于
5月 05, 2003
作者:
W
wdenk
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix ATC board configuration and flash driver
上级
9c62cc58
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
92 addition
and
94 deletion
+92
-94
board/atc/flash.c
board/atc/flash.c
+90
-92
include/configs/atc.h
include/configs/atc.h
+2
-2
未找到文件。
board/atc/flash.c
浏览文件 @
e6009629
...
...
@@ -292,9 +292,8 @@ ulong flash_get_size (FPWV *addr, flash_info_t *info)
/* The manufacturer codes are only 1 byte, so just use 1 byte.
* This works for any bus width and any FLASH device width.
*/
udelay
(
1000000
);
//psl
//psl switch (addr[1] & 0xff) {
switch
(
addr
[
0
]
&
0xff
)
{
//psl
udelay
(
100
);
switch
(
addr
[
0
]
&
0xff
)
{
case
(
uchar
)
AMD_MANUFACT
:
info
->
flash_id
=
FLASH_MAN_AMD
;
...
...
@@ -312,7 +311,6 @@ ulong flash_get_size (FPWV *addr, flash_info_t *info)
}
/* Check 16 bits or 32 bits of ID so work on 32 or 16 bit bus. */
//psl if (info->flash_id != FLASH_UNKNOWN) switch (addr[0]) {
if
(
info
->
flash_id
!=
FLASH_UNKNOWN
)
switch
(
addr
[
1
])
{
case
(
FPW
)
AMD_ID_LV640U
:
/* 29LV640 and 29LV641 have same ID */
...
...
@@ -519,46 +517,46 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
*/
int
write_buff
(
flash_info_t
*
info
,
uchar
*
src
,
ulong
addr
,
ulong
cnt
)
{
FPW
data
=
0
;
/* 16 or 32 bit word, matches flash bus width on MPC8XX */
int
bytes
;
/* number of bytes to program in current word */
int
left
;
/* number of bytes left to program */
int
i
,
res
;
FPW
data
=
0
;
/* 16 or 32 bit word, matches flash bus width on MPC8XX */
int
bytes
;
/* number of bytes to program in current word */
int
left
;
/* number of bytes left to program */
int
i
,
res
;
for
(
left
=
cnt
,
res
=
0
;
left
>
0
&&
res
==
0
;
addr
+=
sizeof
(
data
),
left
-=
sizeof
(
data
)
-
bytes
)
{
for
(
left
=
cnt
,
res
=
0
;
left
>
0
&&
res
==
0
;
addr
+=
sizeof
(
data
),
left
-=
sizeof
(
data
)
-
bytes
)
{
bytes
=
addr
&
(
sizeof
(
data
)
-
1
);
addr
&=
~
(
sizeof
(
data
)
-
1
);
bytes
=
addr
&
(
sizeof
(
data
)
-
1
);
addr
&=
~
(
sizeof
(
data
)
-
1
);
/* combine source and destination data so can program
* an entire word of 16 or 32 bits
*/
for
(
i
=
0
;
i
<
sizeof
(
data
);
i
++
)
{
data
<<=
8
;
if
(
i
<
bytes
||
i
-
bytes
>=
left
)
data
+=
*
((
uchar
*
)
addr
+
i
);
else
data
+=
*
src
++
;
}
/* combine source and destination data so can program
* an entire word of 16 or 32 bits
*/
for
(
i
=
0
;
i
<
sizeof
(
data
);
i
++
)
{
data
<<=
8
;
if
(
i
<
bytes
||
i
-
bytes
>=
left
)
data
+=
*
((
uchar
*
)
addr
+
i
);
else
data
+=
*
src
++
;
}
/* write one word to the flash */
switch
(
info
->
flash_id
&
FLASH_VENDMASK
)
{
case
FLASH_MAN_AMD
:
res
=
write_word_amd
(
info
,
(
FPWV
*
)
addr
,
data
);
break
;
case
FLASH_MAN_INTEL
:
res
=
write_word_intel
(
info
,
(
FPWV
*
)
addr
,
data
);
break
;
default:
/* unknown flash type, error! */
printf
(
"missing or unknown FLASH type
\n
"
);
res
=
1
;
/* not really a timeout, but gives error */
break
;
/* write one word to the flash */
switch
(
info
->
flash_id
&
FLASH_VENDMASK
)
{
case
FLASH_MAN_AMD
:
res
=
write_word_amd
(
info
,
(
FPWV
*
)
addr
,
data
);
break
;
case
FLASH_MAN_INTEL
:
res
=
write_word_intel
(
info
,
(
FPWV
*
)
addr
,
data
);
break
;
default:
/* unknown flash type, error! */
printf
(
"missing or unknown FLASH type
\n
"
);
res
=
1
;
/* not really a timeout, but gives error */
break
;
}
}
}
return
(
res
);
return
(
res
);
}
/*-----------------------------------------------------------------------
...
...
@@ -573,43 +571,43 @@ int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
*/
static
int
write_word_amd
(
flash_info_t
*
info
,
FPWV
*
dest
,
FPW
data
)
{
ulong
start
;
int
flag
;
int
res
=
0
;
/* result, assume success */
FPWV
*
base
;
/* first address in flash bank */
/* Check if Flash is (sufficiently) erased */
if
((
*
dest
&
data
)
!=
data
)
{
return
(
2
);
}
ulong
start
;
int
flag
;
int
res
=
0
;
/* result, assume success */
FPWV
*
base
;
/* first address in flash bank */
/* Check if Flash is (sufficiently) erased */
if
((
*
dest
&
data
)
!=
data
)
{
return
(
2
);
}
base
=
(
FPWV
*
)(
info
->
start
[
0
]);
base
=
(
FPWV
*
)(
info
->
start
[
0
]);
/* Disable interrupts which might cause a timeout here */
flag
=
disable_interrupts
();
/* Disable interrupts which might cause a timeout here */
flag
=
disable_interrupts
();
base
[
FLASH_CYCLE1
]
=
(
FPW
)
0x00AA00AA
;
/* unlock */
base
[
FLASH_CYCLE2
]
=
(
FPW
)
0x00550055
;
/* unlock */
base
[
FLASH_CYCLE1
]
=
(
FPW
)
0x00A000A0
;
/* selects program mode */
base
[
FLASH_CYCLE1
]
=
(
FPW
)
0x00AA00AA
;
/* unlock */
base
[
FLASH_CYCLE2
]
=
(
FPW
)
0x00550055
;
/* unlock */
base
[
FLASH_CYCLE1
]
=
(
FPW
)
0x00A000A0
;
/* selects program mode */
*
dest
=
data
;
/* start programming the data */
*
dest
=
data
;
/* start programming the data */
/* re-enable interrupts if necessary */
if
(
flag
)
enable_interrupts
();
/* re-enable interrupts if necessary */
if
(
flag
)
enable_interrupts
();
start
=
get_timer
(
0
);
start
=
get_timer
(
0
);
/* data polling for D7 */
while
(
res
==
0
&&
(
*
dest
&
(
FPW
)
0x00800080
)
!=
(
data
&
(
FPW
)
0x00800080
))
{
if
(
get_timer
(
start
)
>
CFG_FLASH_WRITE_TOUT
)
{
*
dest
=
(
FPW
)
0x00F000F0
;
/* reset bank */
res
=
1
;
/* data polling for D7 */
while
(
res
==
0
&&
(
*
dest
&
(
FPW
)
0x00800080
)
!=
(
data
&
(
FPW
)
0x00800080
))
{
if
(
get_timer
(
start
)
>
CFG_FLASH_WRITE_TOUT
)
{
*
dest
=
(
FPW
)
0x00F000F0
;
/* reset bank */
res
=
1
;
}
}
}
return
(
res
);
return
(
res
);
}
/*-----------------------------------------------------------------------
...
...
@@ -624,42 +622,42 @@ static int write_word_amd (flash_info_t *info, FPWV *dest, FPW data)
*/
static
int
write_word_intel
(
flash_info_t
*
info
,
FPWV
*
dest
,
FPW
data
)
{
ulong
start
;
int
flag
;
int
res
=
0
;
/* result, assume success */
ulong
start
;
int
flag
;
int
res
=
0
;
/* result, assume success */
/* Check if Flash is (sufficiently) erased */
if
((
*
dest
&
data
)
!=
data
)
{
return
(
2
);
}
/* Check if Flash is (sufficiently) erased */
if
((
*
dest
&
data
)
!=
data
)
{
return
(
2
);
}
/* Disable interrupts which might cause a timeout here */
flag
=
disable_interrupts
();
/* Disable interrupts which might cause a timeout here */
flag
=
disable_interrupts
();
*
dest
=
(
FPW
)
0x00500050
;
/* clear status register */
*
dest
=
(
FPW
)
0x00FF00FF
;
/* make sure in read mode */
*
dest
=
(
FPW
)
0x00400040
;
/* program setup */
*
dest
=
(
FPW
)
0x00500050
;
/* clear status register */
*
dest
=
(
FPW
)
0x00FF00FF
;
/* make sure in read mode */
*
dest
=
(
FPW
)
0x00400040
;
/* program setup */
*
dest
=
data
;
/* start programming the data */
*
dest
=
data
;
/* start programming the data */
/* re-enable interrupts if necessary */
if
(
flag
)
enable_interrupts
();
/* re-enable interrupts if necessary */
if
(
flag
)
enable_interrupts
();
start
=
get_timer
(
0
);
start
=
get_timer
(
0
);
while
(
res
==
0
&&
(
*
dest
&
(
FPW
)
0x00800080
)
!=
(
FPW
)
0x00800080
)
{
if
(
get_timer
(
start
)
>
CFG_FLASH_WRITE_TOUT
)
{
*
dest
=
(
FPW
)
0x00B000B0
;
/* Suspend program */
res
=
1
;
while
(
res
==
0
&&
(
*
dest
&
(
FPW
)
0x00800080
)
!=
(
FPW
)
0x00800080
)
{
if
(
get_timer
(
start
)
>
CFG_FLASH_WRITE_TOUT
)
{
*
dest
=
(
FPW
)
0x00B000B0
;
/* Suspend program */
res
=
1
;
}
}
}
if
(
res
==
0
&&
(
*
dest
&
(
FPW
)
0x00100010
))
res
=
1
;
/* write failed, time out error is close enough */
if
(
res
==
0
&&
(
*
dest
&
(
FPW
)
0x00100010
))
res
=
1
;
/* write failed, time out error is close enough */
*
dest
=
(
FPW
)
0x00500050
;
/* clear status register */
*
dest
=
(
FPW
)
0x00FF00FF
;
/* make sure in read mode */
*
dest
=
(
FPW
)
0x00500050
;
/* clear status register */
*
dest
=
(
FPW
)
0x00FF00FF
;
/* make sure in read mode */
return
(
res
);
return
(
res
);
}
include/configs/atc.h
浏览文件 @
e6009629
...
...
@@ -232,7 +232,7 @@
#define CFG_SDRAM_BASE 0x00000000
#define CFG_SDRAM_MAX_SIZE 0x08000000
/* max. 128 MB */
#define CFG_MONITOR_BASE TEXT_BASE
#define CFG_MONITOR_LEN (
256 << 10)
/* Reserve 256
kB for Monitor */
#define CFG_MONITOR_LEN (
192 << 10)
/* Reserve 192
kB for Monitor */
#define CFG_MALLOC_LEN (128 << 10)
/* Reserve 128 kB for malloc()*/
#if (CFG_MONITOR_BASE < CFG_FLASH_BASE)
...
...
@@ -242,7 +242,7 @@
#if 1
/* environment is in Flash */
#define CFG_ENV_IS_IN_FLASH 1
# define CFG_ENV_ADDR (CFG_FLASH_BASE+0x
4
0000)
# define CFG_ENV_ADDR (CFG_FLASH_BASE+0x
3
0000)
# define CFG_ENV_SIZE 0x10000
# define CFG_ENV_SECT_SIZE 0x10000
#else
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录