Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OS
U-Boot.Mirror
提交
4906d698
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,发现更多精彩内容 >>
提交
4906d698
编写于
7月 22, 2021
作者:
T
Tom Rini
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'network_master' of
https://source.denx.de/u-boot/custodians/u-boot-net
上级
a15fa1ba
669884ea
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
112 addition
and
148 deletion
+112
-148
drivers/net/Kconfig
drivers/net/Kconfig
+1
-0
drivers/net/dwc_eth_qos.c
drivers/net/dwc_eth_qos.c
+24
-130
drivers/net/eth-phy-uclass.c
drivers/net/eth-phy-uclass.c
+76
-10
drivers/net/fsl-mc/mc.c
drivers/net/fsl-mc/mc.c
+2
-2
drivers/net/phy/aquantia.c
drivers/net/phy/aquantia.c
+3
-2
drivers/net/smc91111.c
drivers/net/smc91111.c
+1
-1
drivers/net/smc911x.c
drivers/net/smc911x.c
+1
-1
include/netdev.h
include/netdev.h
+2
-2
net/eth-uclass.c
net/eth-uclass.c
+2
-0
未找到文件。
drivers/net/Kconfig
浏览文件 @
4906d698
...
...
@@ -206,6 +206,7 @@ config DWC_ETH_QOS_IMX
config DWC_ETH_QOS_STM32
bool "Synopsys DWC Ethernet QOS device support for STM32"
depends on DWC_ETH_QOS
select DM_ETH_PHY
default y if ARCH_STM32MP
help
The Synopsys Designware Ethernet QOS IP block with the specific
...
...
drivers/net/dwc_eth_qos.c
浏览文件 @
4906d698
...
...
@@ -27,6 +27,8 @@
* all clock and reset signals to the HW block.
*/
#define LOG_CATEGORY UCLASS_ETH
#include <common.h>
#include <clk.h>
#include <cpu_func.h>
...
...
@@ -281,7 +283,7 @@ struct eqos_ops {
int
(
*
eqos_remove_resources
)(
struct
udevice
*
dev
);
int
(
*
eqos_stop_resets
)(
struct
udevice
*
dev
);
int
(
*
eqos_start_resets
)(
struct
udevice
*
dev
);
void
(
*
eqos_stop_clks
)(
struct
udevice
*
dev
);
int
(
*
eqos_stop_clks
)(
struct
udevice
*
dev
);
int
(
*
eqos_start_clks
)(
struct
udevice
*
dev
);
int
(
*
eqos_calibrate_pads
)(
struct
udevice
*
dev
);
int
(
*
eqos_disable_calibration
)(
struct
udevice
*
dev
);
...
...
@@ -307,7 +309,6 @@ struct eqos_priv {
struct
clk
clk_slave_bus
;
struct
mii_dev
*
mii
;
struct
phy_device
*
phy
;
int
phyaddr
;
u32
max_speed
;
void
*
descs
;
int
tx_desc_idx
,
rx_desc_idx
;
...
...
@@ -614,12 +615,7 @@ err:
#endif
}
static
int
eqos_start_clks_imx
(
struct
udevice
*
dev
)
{
return
0
;
}
static
void
eqos_stop_clks_tegra186
(
struct
udevice
*
dev
)
static
int
eqos_stop_clks_tegra186
(
struct
udevice
*
dev
)
{
#ifdef CONFIG_CLK
struct
eqos_priv
*
eqos
=
dev_get_priv
(
dev
);
...
...
@@ -634,9 +630,10 @@ static void eqos_stop_clks_tegra186(struct udevice *dev)
#endif
debug
(
"%s: OK
\n
"
,
__func__
);
return
0
;
}
static
void
eqos_stop_clks_stm32
(
struct
udevice
*
dev
)
static
int
eqos_stop_clks_stm32
(
struct
udevice
*
dev
)
{
#ifdef CONFIG_CLK
struct
eqos_priv
*
eqos
=
dev_get_priv
(
dev
);
...
...
@@ -649,11 +646,7 @@ static void eqos_stop_clks_stm32(struct udevice *dev)
#endif
debug
(
"%s: OK
\n
"
,
__func__
);
}
static
void
eqos_stop_clks_imx
(
struct
udevice
*
dev
)
{
/* empty */
return
0
;
}
static
int
eqos_start_resets_tegra186
(
struct
udevice
*
dev
)
...
...
@@ -695,39 +688,6 @@ static int eqos_start_resets_tegra186(struct udevice *dev)
return
0
;
}
static
int
eqos_start_resets_stm32
(
struct
udevice
*
dev
)
{
struct
eqos_priv
*
eqos
=
dev_get_priv
(
dev
);
int
ret
;
debug
(
"%s(dev=%p):
\n
"
,
__func__
,
dev
);
if
(
dm_gpio_is_valid
(
&
eqos
->
phy_reset_gpio
))
{
ret
=
dm_gpio_set_value
(
&
eqos
->
phy_reset_gpio
,
1
);
if
(
ret
<
0
)
{
pr_err
(
"dm_gpio_set_value(phy_reset, assert) failed: %d"
,
ret
);
return
ret
;
}
udelay
(
2
);
ret
=
dm_gpio_set_value
(
&
eqos
->
phy_reset_gpio
,
0
);
if
(
ret
<
0
)
{
pr_err
(
"dm_gpio_set_value(phy_reset, deassert) failed: %d"
,
ret
);
return
ret
;
}
}
debug
(
"%s: OK
\n
"
,
__func__
);
return
0
;
}
static
int
eqos_start_resets_imx
(
struct
udevice
*
dev
)
{
return
0
;
}
static
int
eqos_stop_resets_tegra186
(
struct
udevice
*
dev
)
{
struct
eqos_priv
*
eqos
=
dev_get_priv
(
dev
);
...
...
@@ -738,28 +698,6 @@ static int eqos_stop_resets_tegra186(struct udevice *dev)
return
0
;
}
static
int
eqos_stop_resets_stm32
(
struct
udevice
*
dev
)
{
struct
eqos_priv
*
eqos
=
dev_get_priv
(
dev
);
int
ret
;
if
(
dm_gpio_is_valid
(
&
eqos
->
phy_reset_gpio
))
{
ret
=
dm_gpio_set_value
(
&
eqos
->
phy_reset_gpio
,
1
);
if
(
ret
<
0
)
{
pr_err
(
"dm_gpio_set_value(phy_reset, assert) failed: %d"
,
ret
);
return
ret
;
}
}
return
0
;
}
static
int
eqos_stop_resets_imx
(
struct
udevice
*
dev
)
{
return
0
;
}
static
int
eqos_calibrate_pads_tegra186
(
struct
udevice
*
dev
)
{
struct
eqos_priv
*
eqos
=
dev_get_priv
(
dev
);
...
...
@@ -848,26 +786,6 @@ static ulong eqos_get_tick_clk_rate_imx(struct udevice *dev)
return
imx_get_eqos_csr_clk
();
}
static
int
eqos_calibrate_pads_stm32
(
struct
udevice
*
dev
)
{
return
0
;
}
static
int
eqos_calibrate_pads_imx
(
struct
udevice
*
dev
)
{
return
0
;
}
static
int
eqos_disable_calibration_stm32
(
struct
udevice
*
dev
)
{
return
0
;
}
static
int
eqos_disable_calibration_imx
(
struct
udevice
*
dev
)
{
return
0
;
}
static
int
eqos_set_full_duplex
(
struct
udevice
*
dev
)
{
struct
eqos_priv
*
eqos
=
dev_get_priv
(
dev
);
...
...
@@ -964,11 +882,6 @@ static int eqos_set_tx_clk_speed_tegra186(struct udevice *dev)
return
0
;
}
static
int
eqos_set_tx_clk_speed_stm32
(
struct
udevice
*
dev
)
{
return
0
;
}
static
int
eqos_set_tx_clk_speed_imx
(
struct
udevice
*
dev
)
{
struct
eqos_priv
*
eqos
=
dev_get_priv
(
dev
);
...
...
@@ -1773,7 +1686,6 @@ static int eqos_probe_resources_stm32(struct udevice *dev)
struct
eqos_priv
*
eqos
=
dev_get_priv
(
dev
);
int
ret
;
phy_interface_t
interface
;
struct
ofnode_phandle_args
phandle_args
;
debug
(
"%s(dev=%p):
\n
"
,
__func__
,
dev
);
...
...
@@ -1813,24 +1725,6 @@ static int eqos_probe_resources_stm32(struct udevice *dev)
if
(
ret
)
pr_warn
(
"No phy clock provided %d"
,
ret
);
eqos
->
phyaddr
=
-
1
;
ret
=
dev_read_phandle_with_args
(
dev
,
"phy-handle"
,
NULL
,
0
,
0
,
&
phandle_args
);
if
(
!
ret
)
{
/* search "reset-gpios" in phy node */
ret
=
gpio_request_by_name_nodev
(
phandle_args
.
node
,
"reset-gpios"
,
0
,
&
eqos
->
phy_reset_gpio
,
GPIOD_IS_OUT
|
GPIOD_IS_OUT_ACTIVE
);
if
(
ret
)
pr_warn
(
"gpio_request_by_name(phy reset) not provided %d"
,
ret
);
eqos
->
phyaddr
=
ofnode_read_u32_default
(
phandle_args
.
node
,
"reg"
,
-
1
);
}
debug
(
"%s: OK
\n
"
,
__func__
);
return
0
;
...
...
@@ -1936,11 +1830,6 @@ static int eqos_remove_resources_stm32(struct udevice *dev)
return
0
;
}
static
int
eqos_remove_resources_imx
(
struct
udevice
*
dev
)
{
return
0
;
}
static
int
eqos_probe
(
struct
udevice
*
dev
)
{
struct
eqos_priv
*
eqos
=
dev_get_priv
(
dev
);
...
...
@@ -2029,6 +1918,11 @@ static int eqos_remove(struct udevice *dev)
return
0
;
}
static
int
eqos_null_ops
(
struct
udevice
*
dev
)
{
return
0
;
}
static
const
struct
eth_ops
eqos_ops
=
{
.
start
=
eqos_start
,
.
stop
=
eqos_stop
,
...
...
@@ -2074,13 +1968,13 @@ static struct eqos_ops eqos_stm32_ops = {
.
eqos_flush_buffer
=
eqos_flush_buffer_generic
,
.
eqos_probe_resources
=
eqos_probe_resources_stm32
,
.
eqos_remove_resources
=
eqos_remove_resources_stm32
,
.
eqos_stop_resets
=
eqos_
stop_resets_stm32
,
.
eqos_start_resets
=
eqos_
start_resets_stm32
,
.
eqos_stop_resets
=
eqos_
null_ops
,
.
eqos_start_resets
=
eqos_
null_ops
,
.
eqos_stop_clks
=
eqos_stop_clks_stm32
,
.
eqos_start_clks
=
eqos_start_clks_stm32
,
.
eqos_calibrate_pads
=
eqos_
calibrate_pads_stm32
,
.
eqos_disable_calibration
=
eqos_
disable_calibration_stm32
,
.
eqos_set_tx_clk_speed
=
eqos_
set_tx_clk_speed_stm32
,
.
eqos_calibrate_pads
=
eqos_
null_ops
,
.
eqos_disable_calibration
=
eqos_
null_ops
,
.
eqos_set_tx_clk_speed
=
eqos_
null_ops
,
.
eqos_get_tick_clk_rate
=
eqos_get_tick_clk_rate_stm32
};
...
...
@@ -2101,13 +1995,13 @@ static struct eqos_ops eqos_imx_ops = {
.
eqos_inval_buffer
=
eqos_inval_buffer_generic
,
.
eqos_flush_buffer
=
eqos_flush_buffer_generic
,
.
eqos_probe_resources
=
eqos_probe_resources_imx
,
.
eqos_remove_resources
=
eqos_
remove_resources_imx
,
.
eqos_stop_resets
=
eqos_
stop_resets_imx
,
.
eqos_start_resets
=
eqos_
start_resets_imx
,
.
eqos_stop_clks
=
eqos_
stop_clks_imx
,
.
eqos_start_clks
=
eqos_
start_clks_imx
,
.
eqos_calibrate_pads
=
eqos_
calibrate_pads_imx
,
.
eqos_disable_calibration
=
eqos_
disable_calibration_imx
,
.
eqos_remove_resources
=
eqos_
null_ops
,
.
eqos_stop_resets
=
eqos_
null_ops
,
.
eqos_start_resets
=
eqos_
null_ops
,
.
eqos_stop_clks
=
eqos_
null_ops
,
.
eqos_start_clks
=
eqos_
null_ops
,
.
eqos_calibrate_pads
=
eqos_
null_ops
,
.
eqos_disable_calibration
=
eqos_
null_ops
,
.
eqos_set_tx_clk_speed
=
eqos_set_tx_clk_speed_imx
,
.
eqos_get_tick_clk_rate
=
eqos_get_tick_clk_rate_imx
};
...
...
drivers/net/eth-phy-uclass.c
浏览文件 @
4906d698
...
...
@@ -3,15 +3,24 @@
* Copyright 2020 NXP
*/
#define LOG_CATEGORY UCLASS_ETH_PHY
#include <common.h>
#include <dm.h>
#include <log.h>
#include <net.h>
#include <asm-generic/gpio.h>
#include <dm/device_compat.h>
#include <dm/device-internal.h>
#include <dm/uclass-internal.h>
#include <dm/lists.h>
#include <linux/delay.h>
struct
eth_phy_device_priv
{
struct
mii_dev
*
mdio_bus
;
struct
gpio_desc
reset_gpio
;
u32
reset_assert_delay
;
u32
reset_deassert_delay
;
};
int
eth_phy_binds_nodes
(
struct
udevice
*
eth_dev
)
...
...
@@ -20,27 +29,33 @@ int eth_phy_binds_nodes(struct udevice *eth_dev)
const
char
*
node_name
;
int
ret
;
mdio_node
=
dev_read_subnode
(
eth_dev
,
"mdio"
);
/* search a subnode named "mdio.*" */
dev_for_each_subnode
(
mdio_node
,
eth_dev
)
{
node_name
=
ofnode_get_name
(
mdio_node
);
if
(
!
strncmp
(
node_name
,
"mdio"
,
4
))
break
;
}
if
(
!
ofnode_valid
(
mdio_node
))
{
de
bug
(
"%s: %s mdio subnode not found!
"
,
__func__
,
eth_dev
->
name
);
de
v_dbg
(
eth_dev
,
"%s: %s mdio subnode not found!
\n
"
,
__func__
,
eth_dev
->
name
);
return
-
ENXIO
;
}
dev_dbg
(
eth_dev
,
"%s: %s subnode found!
\n
"
,
__func__
,
node_name
);
ofnode_for_each_subnode
(
phy_node
,
mdio_node
)
{
node_name
=
ofnode_get_name
(
phy_node
);
de
bug
(
"* Found child node: '%s'
\n
"
,
node_name
);
de
v_dbg
(
eth_dev
,
"* Found child node: '%s'
\n
"
,
node_name
);
ret
=
device_bind_driver_to_node
(
eth_dev
,
"eth_phy_generic_drv"
,
node_name
,
phy_node
,
NULL
);
if
(
ret
)
{
de
bug
(
" - Eth phy binding error: %d
\n
"
,
ret
);
de
v_dbg
(
eth_dev
,
" - Eth phy binding error: %d
\n
"
,
ret
);
continue
;
}
de
bug
(
" - bound phy device: '%s'
\n
"
,
node_name
);
de
v_dbg
(
eth_dev
,
" - bound phy device: '%s'
\n
"
,
node_name
);
}
return
0
;
...
...
@@ -81,14 +96,14 @@ struct mii_dev *eth_phy_get_mdio_bus(struct udevice *eth_dev)
*/
uc_priv
=
(
struct
eth_phy_device_priv
*
)(
dev_get_uclass_priv
(
phy_dev
));
if
(
uc_priv
->
mdio_bus
)
printf
(
"Get shared mii bus on %s
\n
"
,
eth_dev
->
name
);
log_notice
(
"Get shared mii bus on %s
\n
"
,
eth_dev
->
name
);
else
printf
(
"Can't get shared mii bus on %s
\n
"
,
eth_dev
->
name
);
log_notice
(
"Can't get shared mii bus on %s
\n
"
,
eth_dev
->
name
);
return
uc_priv
->
mdio_bus
;
}
}
else
{
printf
(
"FEC: can't find phy-handle
\n
"
);
log_notice
(
"FEC: can't find phy-handle
\n
"
);
}
return
NULL
;
...
...
@@ -101,7 +116,7 @@ int eth_phy_get_addr(struct udevice *dev)
if
(
dev_read_phandle_with_args
(
dev
,
"phy-handle"
,
NULL
,
0
,
0
,
&
phandle_args
))
{
de
bug
(
"Failed to find phy-handle"
);
de
v_dbg
(
dev
,
"Failed to find phy-handle"
);
return
-
ENODEV
;
}
...
...
@@ -110,13 +125,64 @@ int eth_phy_get_addr(struct udevice *dev)
return
reg
;
}
/* parsing generic properties of devicetree/bindings/net/ethernet-phy.yaml */
static
int
eth_phy_of_to_plat
(
struct
udevice
*
dev
)
{
struct
eth_phy_device_priv
*
uc_priv
=
dev_get_uclass_priv
(
dev
);
int
ret
;
if
(
!
CONFIG_IS_ENABLED
(
DM_GPIO
))
return
0
;
/* search "reset-gpios" in phy node */
ret
=
gpio_request_by_name
(
dev
,
"reset-gpios"
,
0
,
&
uc_priv
->
reset_gpio
,
GPIOD_IS_OUT
);
if
(
ret
!=
-
ENOENT
)
return
ret
;
uc_priv
->
reset_assert_delay
=
dev_read_u32_default
(
dev
,
"reset-assert-us"
,
0
);
uc_priv
->
reset_deassert_delay
=
dev_read_u32_default
(
dev
,
"reset-deassert-us"
,
0
);
return
0
;
}
void
eth_phy_reset
(
struct
udevice
*
dev
,
int
value
)
{
struct
eth_phy_device_priv
*
uc_priv
=
dev_get_uclass_priv
(
dev
);
u32
delay
;
if
(
!
CONFIG_IS_ENABLED
(
DM_GPIO
))
return
;
if
(
!
dm_gpio_is_valid
(
&
uc_priv
->
reset_gpio
))
return
;
dm_gpio_set_value
(
&
uc_priv
->
reset_gpio
,
value
);
delay
=
value
?
uc_priv
->
reset_assert_delay
:
uc_priv
->
reset_deassert_delay
;
if
(
delay
)
udelay
(
delay
);
}
static
int
eth_phy_pre_probe
(
struct
udevice
*
dev
)
{
/* Assert and deassert the reset signal */
eth_phy_reset
(
dev
,
1
);
eth_phy_reset
(
dev
,
0
);
return
0
;
}
UCLASS_DRIVER
(
eth_phy_generic
)
=
{
.
id
=
UCLASS_ETH_PHY
,
.
name
=
"eth_phy_generic"
,
.
per_device_auto
=
sizeof
(
struct
eth_phy_device_priv
),
.
pre_probe
=
eth_phy_pre_probe
,
};
U_BOOT_DRIVER
(
eth_phy_generic_drv
)
=
{
.
name
=
"eth_phy_generic_drv"
,
.
id
=
UCLASS_ETH_PHY
,
.
of_to_plat
=
eth_phy_of_to_plat
,
};
drivers/net/fsl-mc/mc.c
浏览文件 @
4906d698
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright 2014 Freescale Semiconductor, Inc.
* Copyright 2017-2018, 2020 NXP
* Copyright 2017-2018, 2020
-2021
NXP
*/
#include <common.h>
#include <command.h>
...
...
@@ -1126,7 +1126,7 @@ static int dpio_exit(void)
goto
err
;
}
dpio_close
(
dflt_mc_io
,
MC_CMD_NO_FLAGS
,
dflt_dpio
->
dpio_handle
);
err
=
dpio_close
(
dflt_mc_io
,
MC_CMD_NO_FLAGS
,
dflt_dpio
->
dpio_handle
);
if
(
err
<
0
)
{
printf
(
"dpio_close() failed: %d
\n
"
,
err
);
goto
err
;
...
...
drivers/net/phy/aquantia.c
浏览文件 @
4906d698
...
...
@@ -3,7 +3,7 @@
* Aquantia PHY drivers
*
* Copyright 2014 Freescale Semiconductor, Inc.
* Copyright 2018 NXP
* Copyright 2018
, 2021
NXP
*/
#include <config.h>
#include <common.h>
...
...
@@ -554,8 +554,9 @@ int aquantia_config(struct phy_device *phydev)
int
aquantia_startup
(
struct
phy_device
*
phydev
)
{
u32
reg
,
speed
;
u32
speed
;
int
i
=
0
;
int
reg
;
phydev
->
duplex
=
DUPLEX_FULL
;
...
...
drivers/net/smc91111.c
浏览文件 @
4906d698
...
...
@@ -1269,7 +1269,7 @@ static void print_packet( byte * buf, int length )
}
#endif
int
smc91111_initialize
(
u8
dev_num
,
in
t
base_addr
)
int
smc91111_initialize
(
u8
dev_num
,
phys_addr_
t
base_addr
)
{
struct
smc91111_priv
*
priv
;
struct
eth_device
*
dev
;
...
...
drivers/net/smc911x.c
浏览文件 @
4906d698
...
...
@@ -478,7 +478,7 @@ static int smc911x_recv(struct eth_device *dev)
return
ret
;
}
int
smc911x_initialize
(
u8
dev_num
,
in
t
base_addr
)
int
smc911x_initialize
(
u8
dev_num
,
phys_addr_
t
base_addr
)
{
struct
smc911x_priv
*
priv
;
int
ret
;
...
...
include/netdev.h
浏览文件 @
4906d698
...
...
@@ -70,8 +70,8 @@ int rtl8169_initialize(struct bd_info *bis);
int
scc_initialize
(
struct
bd_info
*
bis
);
int
sh_eth_initialize
(
struct
bd_info
*
bis
);
int
skge_initialize
(
struct
bd_info
*
bis
);
int
smc91111_initialize
(
u8
dev_num
,
in
t
base_addr
);
int
smc911x_initialize
(
u8
dev_num
,
in
t
base_addr
);
int
smc91111_initialize
(
u8
dev_num
,
phys_addr_
t
base_addr
);
int
smc911x_initialize
(
u8
dev_num
,
phys_addr_
t
base_addr
);
int
uec_standard_init
(
struct
bd_info
*
bis
);
int
uli526x_initialize
(
struct
bd_info
*
bis
);
int
armada100_fec_register
(
unsigned
long
base_addr
);
...
...
net/eth-uclass.c
浏览文件 @
4906d698
...
...
@@ -5,6 +5,8 @@
* Joe Hershberger, National Instruments
*/
#define LOG_CATEGORY UCLASS_ETH
#include <common.h>
#include <bootstage.h>
#include <dm.h>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录