Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OS
U-Boot.Mirror
提交
002e9108
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,发现更多精彩内容 >>
提交
002e9108
编写于
10月 18, 2017
作者:
T
Tom Rini
浏览文件
操作
浏览文件
下载
差异文件
Merge
git://git.denx.de/u-boot-spi
上级
eb0044db
ca1ac16d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
65 addition
and
7 deletion
+65
-7
drivers/mtd/spi/spi_flash.c
drivers/mtd/spi/spi_flash.c
+33
-0
drivers/mtd/spi/sunxi_spi_spl.c
drivers/mtd/spi/sunxi_spi_spl.c
+32
-7
未找到文件。
drivers/mtd/spi/spi_flash.c
浏览文件 @
002e9108
...
...
@@ -113,6 +113,27 @@ static int write_cr(struct spi_flash *flash, u8 wc)
#endif
#ifdef CONFIG_SPI_FLASH_BAR
/*
* This "clean_bar" is necessary in a situation when one was accessing
* spi flash memory > 16 MiB by using Bank Address Register's BA24 bit.
*
* After it the BA24 bit shall be cleared to allow access to correct
* memory region after SW reset (by calling "reset" command).
*
* Otherwise, the BA24 bit may be left set and then after reset, the
* ROM would read/write/erase SPL from 16 MiB * bank_sel address.
*/
static
int
clean_bar
(
struct
spi_flash
*
flash
)
{
u8
cmd
,
bank_sel
=
0
;
if
(
flash
->
bank_curr
==
0
)
return
0
;
cmd
=
flash
->
bank_write_cmd
;
return
spi_flash_write_common
(
flash
,
&
cmd
,
1
,
&
bank_sel
,
1
);
}
static
int
write_bar
(
struct
spi_flash
*
flash
,
u32
offset
)
{
u8
cmd
,
bank_sel
;
...
...
@@ -339,6 +360,10 @@ int spi_flash_cmd_erase_ops(struct spi_flash *flash, u32 offset, size_t len)
len
-=
erase_size
;
}
#ifdef CONFIG_SPI_FLASH_BAR
ret
=
clean_bar
(
flash
);
#endif
return
ret
;
}
...
...
@@ -397,6 +422,10 @@ int spi_flash_cmd_write_ops(struct spi_flash *flash, u32 offset,
offset
+=
chunk_len
;
}
#ifdef CONFIG_SPI_FLASH_BAR
ret
=
clean_bar
(
flash
);
#endif
return
ret
;
}
...
...
@@ -500,6 +529,10 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
data
+=
read_len
;
}
#ifdef CONFIG_SPI_FLASH_BAR
ret
=
clean_bar
(
flash
);
#endif
free
(
cmd
);
return
ret
;
}
...
...
drivers/mtd/spi/sunxi_spi_spl.c
浏览文件 @
002e9108
...
...
@@ -8,6 +8,7 @@
#include <spl.h>
#include <asm/gpio.h>
#include <asm/io.h>
#include <libfdt.h>
#ifdef CONFIG_SPL_OS_BOOT
#error CONFIG_SPL_OS_BOOT is not supported yet
...
...
@@ -261,27 +262,51 @@ static void spi0_read_data(void *buf, u32 addr, u32 len)
}
}
static
ulong
spi_load_read
(
struct
spl_load_info
*
load
,
ulong
sector
,
ulong
count
,
void
*
buf
)
{
spi0_read_data
(
buf
,
sector
,
count
);
return
count
;
}
/*****************************************************************************/
static
int
spl_spi_load_image
(
struct
spl_image_info
*
spl_image
,
struct
spl_boot_device
*
bootdev
)
{
int
err
;
int
ret
=
0
;
struct
image_header
*
header
;
header
=
(
struct
image_header
*
)(
CONFIG_SYS_TEXT_BASE
);
spi0_init
();
spi0_read_data
((
void
*
)
header
,
CONFIG_SYS_SPI_U_BOOT_OFFS
,
0x40
);
err
=
spl_parse_image_header
(
spl_image
,
header
);
if
(
err
)
return
err
;
spi0_read_data
((
void
*
)
spl_image
->
load_addr
,
CONFIG_SYS_SPI_U_BOOT_OFFS
,
spl_image
->
size
);
if
(
IS_ENABLED
(
CONFIG_SPL_LOAD_FIT
)
&&
image_get_magic
(
header
)
==
FDT_MAGIC
)
{
struct
spl_load_info
load
;
debug
(
"Found FIT image
\n
"
);
load
.
dev
=
NULL
;
load
.
priv
=
NULL
;
load
.
filename
=
NULL
;
load
.
bl_len
=
1
;
load
.
read
=
spi_load_read
;
ret
=
spl_load_simple_fit
(
spl_image
,
&
load
,
CONFIG_SYS_SPI_U_BOOT_OFFS
,
header
);
}
else
{
ret
=
spl_parse_image_header
(
spl_image
,
header
);
if
(
ret
)
return
ret
;
spi0_read_data
((
void
*
)
spl_image
->
load_addr
,
CONFIG_SYS_SPI_U_BOOT_OFFS
,
spl_image
->
size
);
}
spi0_deinit
();
return
0
;
return
ret
;
}
/* Use priorty 0 to override the default if it happens to be linked in */
SPL_LOAD_IMAGE_METHOD
(
"sunxi SPI"
,
0
,
BOOT_DEVICE_SPI
,
spl_spi_load_image
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录