Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OS
U-Boot.Mirror
提交
0e5d3e31
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,发现更多精彩内容 >>
提交
0e5d3e31
编写于
4月 01, 2018
作者:
T
Tom Rini
浏览文件
操作
浏览文件
下载
差异文件
Merge
git://git.denx.de/u-boot-dm
上级
f3b623fa
641599a6
变更
15
显示空白变更内容
内联
并排
Showing
15 changed file
with
172 addition
and
34 deletion
+172
-34
arch/sandbox/dts/test.dts
arch/sandbox/dts/test.dts
+48
-0
cmd/cbfs.c
cmd/cbfs.c
+1
-1
common/image-fdt.c
common/image-fdt.c
+3
-0
drivers/core/fdtaddr.c
drivers/core/fdtaddr.c
+11
-6
drivers/core/ofnode.c
drivers/core/ofnode.c
+4
-1
drivers/core/root.c
drivers/core/root.c
+11
-5
drivers/core/uclass.c
drivers/core/uclass.c
+26
-0
drivers/pinctrl/pinctrl-uclass.c
drivers/pinctrl/pinctrl-uclass.c
+5
-14
fs/cbfs/cbfs.c
fs/cbfs/cbfs.c
+2
-2
include/dm/uclass-id.h
include/dm/uclass-id.h
+1
-0
include/dm/uclass.h
include/dm/uclass.h
+16
-0
include/image.h
include/image.h
+1
-0
include/linux/libfdt.h
include/linux/libfdt.h
+0
-3
lib/libfdt/fdt_region.c
lib/libfdt/fdt_region.c
+0
-2
test/dm/test-fdt.c
test/dm/test-fdt.c
+43
-0
未找到文件。
arch/sandbox/dts/test.dts
浏览文件 @
0e5d3e31
...
...
@@ -27,6 +27,10 @@
testfdt3
=
"/b-test"
;
testfdt5
=
"/some-bus/c-test@5"
;
testfdt8
=
"/a-test"
;
fdt_dummy0
=
"/translation-test@8000/dev@0,0"
;
fdt_dummy1
=
"/translation-test@8000/dev@1,100"
;
fdt_dummy2
=
"/translation-test@8000/dev@2,200"
;
fdt_dummy3
=
"/translation-test@8000/noxlatebus@3,300/dev@42"
;
usb0
=
&
usb_0
;
usb1
=
&
usb_1
;
usb2
=
&
usb_2
;
...
...
@@ -487,6 +491,50 @@
reg
=
<
9
1
>;
};
};
translation
-
test
@
8000
{
compatible
=
"simple-bus"
;
reg
=
<
0x8000
0x4000
>;
#
address
-
cells
=
<
0x2
>;
#
size
-
cells
=
<
0x1
>;
ranges
=
<
0
0x0
0x8000
0x1000
1
0x100
0x9000
0x1000
2
0x200
0xA000
0x1000
3
0x300
0xB000
0x1000
>;
dev
@
0
,
0
{
compatible
=
"denx,u-boot-fdt-dummy"
;
reg
=
<
0
0x0
0x1000
>;
};
dev
@
1
,
100
{
compatible
=
"denx,u-boot-fdt-dummy"
;
reg
=
<
1
0x100
0x1000
>;
};
dev
@
2
,
200
{
compatible
=
"denx,u-boot-fdt-dummy"
;
reg
=
<
2
0x200
0x1000
>;
};
noxlatebus
@
3
,
300
{
compatible
=
"simple-bus"
;
reg
=
<
3
0x300
0x1000
>;
#
address
-
cells
=
<
0x1
>;
#
size
-
cells
=
<
0x0
>;
dev
@
42
{
compatible
=
"denx,u-boot-fdt-dummy"
;
reg
=
<
0x42
>;
};
};
};
};
#
include
"sandbox_pmic.dtsi"
cmd/cbfs.c
浏览文件 @
0e5d3e31
...
...
@@ -22,7 +22,7 @@ static int do_cbfs_init(cmd_tbl_t *cmdtp, int flag, int argc,
return
0
;
}
if
(
argc
==
2
)
{
end_of_rom
=
(
int
)
simple_strtoul
(
argv
[
1
],
&
ep
,
16
);
end_of_rom
=
simple_strtoul
(
argv
[
1
],
&
ep
,
16
);
if
(
*
ep
)
{
puts
(
"
\n
** Invalid end of ROM **
\n
"
);
return
1
;
...
...
common/image-fdt.c
浏览文件 @
0e5d3e31
...
...
@@ -21,6 +21,9 @@
#define CONFIG_SYS_FDT_PAD 0x3000
#endif
/* adding a ramdisk needs 0x44 bytes in version 2008.10 */
#define FDT_RAMDISK_OVERHEAD 0x80
DECLARE_GLOBAL_DATA_PTR
;
static
void
fdt_error
(
const
char
*
msg
)
...
...
drivers/core/fdtaddr.c
浏览文件 @
0e5d3e31
...
...
@@ -49,12 +49,17 @@ fdt_addr_t devfdt_get_addr_index(struct udevice *dev, int index)
reg
+=
index
*
(
na
+
ns
);
if
(
ns
)
{
/*
* Use the full-fledged translate function for complex
* bus setups.
*/
addr
=
fdt_translate_address
((
void
*
)
gd
->
fdt_blob
,
dev_of_offset
(
dev
),
reg
);
}
else
{
/* Non translatable if #size-cells == 0 */
addr
=
fdt_read_number
(
reg
,
na
);
}
}
else
{
/*
* Use the "simple" translate function for less complex
...
...
drivers/core/ofnode.c
浏览文件 @
0e5d3e31
...
...
@@ -227,13 +227,16 @@ fdt_addr_t ofnode_get_addr_index(ofnode node, int index)
uint
flags
;
u64
size
;
int
na
;
int
ns
;
prop_val
=
of_get_address
(
ofnode_to_np
(
node
),
index
,
&
size
,
&
flags
);
if
(
!
prop_val
)
return
FDT_ADDR_T_NONE
;
if
(
IS_ENABLED
(
CONFIG_OF_TRANSLATE
))
{
ns
=
of_n_size_cells
(
ofnode_to_np
(
node
));
if
(
IS_ENABLED
(
CONFIG_OF_TRANSLATE
)
&&
ns
>
0
)
{
return
of_translate_address
(
ofnode_to_np
(
node
),
prop_val
);
}
else
{
na
=
of_n_addr_cells
(
ofnode_to_np
(
node
));
...
...
drivers/core/root.c
浏览文件 @
0e5d3e31
...
...
@@ -333,7 +333,8 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
int
dm_extended_scan_fdt
(
const
void
*
blob
,
bool
pre_reloc_only
)
{
int
node
,
ret
;
int
ret
;
ofnode
node
;
ret
=
dm_scan_fdt
(
gd
->
fdt_blob
,
pre_reloc_only
);
if
(
ret
)
{
...
...
@@ -342,12 +343,17 @@ int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)
}
/* bind fixed-clock */
node
=
ofnode_
to_offset
(
ofnode_path
(
"/clocks"
)
);
node
=
ofnode_
path
(
"/clocks"
);
/* if no DT "clocks" node, no need to go further */
if
(
node
<
0
)
if
(
!
ofnode_valid
(
node
)
)
return
ret
;
ret
=
dm_scan_fdt_node
(
gd
->
dm_root
,
gd
->
fdt_blob
,
node
,
#if CONFIG_IS_ENABLED(OF_LIVE)
if
(
of_live_active
())
ret
=
dm_scan_fdt_live
(
gd
->
dm_root
,
node
.
np
,
pre_reloc_only
);
else
#endif
ret
=
dm_scan_fdt_node
(
gd
->
dm_root
,
gd
->
fdt_blob
,
node
.
of_offset
,
pre_reloc_only
);
if
(
ret
)
debug
(
"dm_scan_fdt_node() failed: %d
\n
"
,
ret
);
...
...
drivers/core/uclass.c
浏览文件 @
0e5d3e31
...
...
@@ -457,6 +457,32 @@ int uclass_get_device_by_ofnode(enum uclass_id id, ofnode node,
}
#if CONFIG_IS_ENABLED(OF_CONTROL)
int
uclass_get_device_by_phandle_id
(
enum
uclass_id
id
,
uint
phandle_id
,
struct
udevice
**
devp
)
{
struct
udevice
*
dev
;
struct
uclass
*
uc
;
int
ret
;
*
devp
=
NULL
;
ret
=
uclass_get
(
id
,
&
uc
);
if
(
ret
)
return
ret
;
list_for_each_entry
(
dev
,
&
uc
->
dev_head
,
uclass_node
)
{
uint
phandle
;
phandle
=
dev_read_phandle
(
dev
);
if
(
phandle
==
phandle_id
)
{
*
devp
=
dev
;
return
uclass_get_device_tail
(
dev
,
ret
,
devp
);
}
}
return
-
ENODEV
;
}
int
uclass_get_device_by_phandle
(
enum
uclass_id
id
,
struct
udevice
*
parent
,
const
char
*
name
,
struct
udevice
**
devp
)
{
...
...
drivers/pinctrl/pinctrl-uclass.c
浏览文件 @
0e5d3e31
...
...
@@ -12,6 +12,7 @@
#include <dm/lists.h>
#include <dm/pinctrl.h>
#include <dm/util.h>
#include <dm/of_access.h>
DECLARE_GLOBAL_DATA_PTR
;
...
...
@@ -63,16 +64,13 @@ static int pinctrl_config_one(struct udevice *config)
*/
static
int
pinctrl_select_state_full
(
struct
udevice
*
dev
,
const
char
*
statename
)
{
const
void
*
fdt
=
gd
->
fdt_blob
;
int
node
=
dev_of_offset
(
dev
);
char
propname
[
32
];
/* long enough */
const
fdt32_t
*
list
;
uint32_t
phandle
;
int
config_node
;
struct
udevice
*
config
;
int
state
,
size
,
i
,
ret
;
state
=
fdt_stringlist_search
(
fdt
,
node
,
"pinctrl-names"
,
statename
);
state
=
dev_read_stringlist_search
(
dev
,
"pinctrl-names"
,
statename
);
if
(
state
<
0
)
{
char
*
end
;
/*
...
...
@@ -85,22 +83,15 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
}
snprintf
(
propname
,
sizeof
(
propname
),
"pinctrl-%d"
,
state
);
list
=
fdt_getprop
(
fdt
,
node
,
propname
,
&
size
);
list
=
dev_read_prop
(
dev
,
propname
,
&
size
);
if
(
!
list
)
return
-
EINVAL
;
size
/=
sizeof
(
*
list
);
for
(
i
=
0
;
i
<
size
;
i
++
)
{
phandle
=
fdt32_to_cpu
(
*
list
++
);
config_node
=
fdt_node_offset_by_phandle
(
fdt
,
phandle
);
if
(
config_node
<
0
)
{
dev_err
(
dev
,
"prop %s index %d invalid phandle
\n
"
,
propname
,
i
);
return
-
EINVAL
;
}
ret
=
uclass_get_device_by_of_offset
(
UCLASS_PINCONFIG
,
config_node
,
&
config
);
ret
=
uclass_get_device_by_phandle_id
(
UCLASS_PINCONFIG
,
phandle
,
&
config
);
if
(
ret
)
return
ret
;
...
...
fs/cbfs/cbfs.c
浏览文件 @
0e5d3e31
...
...
@@ -168,9 +168,9 @@ static int file_cbfs_load_header(uintptr_t end_of_rom,
struct
cbfs_header
*
header
)
{
struct
cbfs_header
*
header_in_rom
;
int32_t
offset
=
*
(
u32
*
)(
end_of_rom
-
3
);
header_in_rom
=
(
struct
cbfs_header
*
)(
uintptr_t
)
*
(
u32
*
)(
end_of_rom
-
3
);
header_in_rom
=
(
struct
cbfs_header
*
)(
end_of_rom
+
offset
+
1
);
swap_header
(
header
,
header_in_rom
);
if
(
header
->
magic
!=
good_magic
||
header
->
offset
>
...
...
include/dm/uclass-id.h
浏览文件 @
0e5d3e31
...
...
@@ -19,6 +19,7 @@ enum uclass_id {
UCLASS_TEST_FDT
,
UCLASS_TEST_BUS
,
UCLASS_TEST_PROBE
,
UCLASS_TEST_DUMMY
,
UCLASS_SPI_EMUL
,
/* sandbox SPI device emulator */
UCLASS_I2C_EMUL
,
/* sandbox I2C device emulator */
UCLASS_PCI_EMUL
,
/* sandbox PCI device emulator */
...
...
include/dm/uclass.h
浏览文件 @
0e5d3e31
...
...
@@ -210,6 +210,22 @@ int uclass_get_device_by_of_offset(enum uclass_id id, int node,
int
uclass_get_device_by_ofnode
(
enum
uclass_id
id
,
ofnode
node
,
struct
udevice
**
devp
);
/**
* uclass_get_device_by_phandle_id() - Get a uclass device by phandle id
*
* This searches the devices in the uclass for one with the given phandle id.
*
* The device is probed to activate it ready for use.
*
* @id: uclass ID to look up
* @phandle_id: the phandle id to look up
* @devp: Returns pointer to device (there is only one for each node)
* @return 0 if OK, -ENODEV if there is no device match the phandle, other
* -ve on error
*/
int
uclass_get_device_by_phandle_id
(
enum
uclass_id
id
,
uint
phandle_id
,
struct
udevice
**
devp
);
/**
* uclass_get_device_by_phandle() - Get a uclass device by phandle
*
...
...
include/image.h
浏览文件 @
0e5d3e31
...
...
@@ -21,6 +21,7 @@
/* Define this to avoid #ifdefs later on */
struct
lmb
;
struct
fdt_region
;
#ifdef USE_HOSTCC
#include <sys/types.h>
...
...
include/linux/libfdt.h
浏览文件 @
0e5d3e31
...
...
@@ -309,7 +309,4 @@ int fdt_add_alias_regions(const void *fdt, struct fdt_region *region, int count,
extern
struct
fdt_header
*
working_fdt
;
/* Pointer to the working fdt */
/* adding a ramdisk needs 0x44 bytes in version 2008.10 */
#define FDT_RAMDISK_OVERHEAD 0x80
#endif
/* _INCLUDE_LIBFDT_H_ */
lib/libfdt/fdt_region.c
浏览文件 @
0e5d3e31
...
...
@@ -14,8 +14,6 @@
#include "fdt_host.h"
#endif
#include "libfdt_internal.h"
#define FDT_MAX_DEPTH 32
static
int
str_in_list
(
const
char
*
str
,
char
*
const
list
[],
int
count
)
...
...
test/dm/test-fdt.c
浏览文件 @
0e5d3e31
...
...
@@ -419,3 +419,46 @@ static int dm_test_first_next_ok_device(struct unit_test_state *uts)
return
0
;
}
DM_TEST
(
dm_test_first_next_ok_device
,
DM_TESTF_SCAN_PDATA
|
DM_TESTF_SCAN_FDT
);
static
const
struct
udevice_id
fdt_dummy_ids
[]
=
{
{
.
compatible
=
"denx,u-boot-fdt-dummy"
,
},
{
}
};
UCLASS_DRIVER
(
fdt_dummy
)
=
{
.
name
=
"fdt_dummy"
,
.
id
=
UCLASS_TEST_DUMMY
,
.
flags
=
DM_UC_FLAG_SEQ_ALIAS
,
};
U_BOOT_DRIVER
(
fdt_dummy_drv
)
=
{
.
name
=
"fdt_dummy_drv"
,
.
of_match
=
fdt_dummy_ids
,
.
id
=
UCLASS_TEST_DUMMY
,
};
static
int
dm_test_fdt_translation
(
struct
unit_test_state
*
uts
)
{
struct
udevice
*
dev
;
/* Some simple translations */
ut_assertok
(
uclass_find_device_by_seq
(
UCLASS_TEST_DUMMY
,
0
,
true
,
&
dev
));
ut_asserteq_str
(
"dev@0,0"
,
dev
->
name
);
ut_asserteq
(
0x8000
,
dev_read_addr
(
dev
));
ut_assertok
(
uclass_find_device_by_seq
(
UCLASS_TEST_DUMMY
,
1
,
true
,
&
dev
));
ut_asserteq_str
(
"dev@1,100"
,
dev
->
name
);
ut_asserteq
(
0x9000
,
dev_read_addr
(
dev
));
ut_assertok
(
uclass_find_device_by_seq
(
UCLASS_TEST_DUMMY
,
2
,
true
,
&
dev
));
ut_asserteq_str
(
"dev@2,200"
,
dev
->
name
);
ut_asserteq
(
0xA000
,
dev_read_addr
(
dev
));
/* No translation for busses with #size-cells == 0 */
ut_assertok
(
uclass_find_device_by_seq
(
UCLASS_TEST_DUMMY
,
3
,
true
,
&
dev
));
ut_asserteq_str
(
"dev@42"
,
dev
->
name
);
ut_asserteq
(
0x42
,
dev_read_addr
(
dev
));
return
0
;
}
DM_TEST
(
dm_test_fdt_translation
,
DM_TESTF_SCAN_PDATA
|
DM_TESTF_SCAN_FDT
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录