net: dwc_eth_qos: Change eqos_ops function to static
Subsystems (2)
PATCH 1/2 net: dwc_eth_qos: Change eqos_ops function to static
This patch solves many warnings when compiling with W=1:
warning: no previous prototype for '....' [-Wmissing-prototypes]
---
drivers/net/dwc_eth_qos.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/dwc_eth_qos.c +6 -6
@@ -621,7 +621,7 @@ err:return ret; } -void eqos_stop_clks_tegra186 (struct udevice *dev) +static void eqos_stop_clks_tegra186 (struct udevice *dev) {struct eqos_priv *eqos =dev_get_priv (dev);
@@ -636,7 +636,7 @@ void eqos_stop_clks_tegra186(struct udevice *dev)debug ("%s: OK\n" , __func__); } -void eqos_stop_clks_stm32 (struct udevice *dev) +static void eqos_stop_clks_stm32 (struct udevice *dev) {struct eqos_priv *eqos =dev_get_priv (dev);
@@ -1290,7 +1290,7 @@ err:return ret; } -void eqos_stop (struct udevice *dev) +static void eqos_stop (struct udevice *dev) {struct eqos_priv *eqos =dev_get_priv (dev);int i;
@@ -1344,7 +1344,7 @@ void eqos_stop(struct udevice *dev)debug ("%s: OK\n" , __func__); } -int eqos_send (struct udevice *dev,void *packet,int length) +static int eqos_send (struct udevice *dev,void *packet,int length) {struct eqos_priv *eqos =dev_get_priv (dev);struct eqos_desc *tx_desc;
@@ -1385,7 +1385,7 @@ int eqos_send(struct udevice *dev, void *packet, int length)return -ETIMEDOUT ; } -int eqos_recv (struct udevice *dev,int flags,uchar **packetp) +static int eqos_recv (struct udevice *dev,int flags,uchar **packetp) {struct eqos_priv *eqos =dev_get_priv (dev);struct eqos_desc *rx_desc;
@@ -1409,7 +1409,7 @@ int eqos_recv(struct udevice *dev, int flags, uchar **packetp)return length; } -int eqos_free_pkt (struct udevice *dev,uchar *packet,int length) +static int eqos_free_pkt (struct udevice *dev,uchar *packet,int length) {struct eqos_priv *eqos =dev_get_priv (dev);uchar *packet_expected;
Signature · 1 line
2.7.4
PATCH 2/2 net: dwc_et_qos: update weak function board_interface_eth_init
Align the board and driver prototype for board_interface_eth_init to avoid execution issue (the interface_type parameter is defined as int or phy_interface_t).
To have a generic weak function (it should be reused by other driver) I change the prototype to use directly udevice.
This prototype is added in netdev.h to allow compilation check and avoid warning when compiling with W=1 on file board/st/stm32mp1/stm32mp1.c
warning: no previous prototype for 'board_interface_eth_init'\
[-Wmissing-prototypes]
int board_interface_eth_init(int interface_type, ....
^~~~~~~~~~~~~~~~~~~~~~~~
---
board/st/stm32mp1/stm32mp1.c | 17 +++++++++++++---- drivers/net/dwc_eth_qos.c | 16 +++------------- include/netdev.h | 3 +++ 3 files changed, 19 insertions(+), 17 deletions(-)
board/st/stm32mp1/stm32mp1.c +13 -4
@@ -16,6 +16,7 @@#include <misc.h> #include <mtd.h> #include <mtd_node.h> +#include <netdev.h> #include <phy.h> #include <reset.h> #include <syscon.h>
@@ -560,13 +561,21 @@ void board_quiesce_devices(void)setup_led (LEDST_OFF ); } -/* board interface eth init */ -/* this is a weak define that we are overriding */ -int board_interface_eth_init (phy_interface_t interface_type, -bool eth_clk_sel_reg,bool eth_ref_clk_sel_reg) +/* eth init function : weak called in eqos driver */ +int board_interface_eth_init (struct udevice *dev, +phy_interface_t interface_type) {u8 *syscfg;u32 value; +bool eth_clk_sel_reg = false; +bool eth_ref_clk_sel_reg = false; + +/* Gigabit Ethernet 125MHz clock selection. */ + eth_clk_sel_reg =dev_read_bool (dev,"st,eth_clk_sel" ); + +/* Ethernet 50Mhz RMII clock selection */ + eth_ref_clk_sel_reg = +dev_read_bool (dev,"st,eth_ref_clk_sel" ); syscfg = (u8 *)syscon_get_first_range (STM32MP_SYSCON_SYSCFG );
drivers/net/dwc_eth_qos.c +3 -13
@@ -1591,8 +1591,8 @@ err_free_reset_eqos: }/* board-specific Ethernet Interface initializations. */ -__weak int board_interface_eth_init (int interface_type,bool eth_clk_sel_reg, -bool eth_ref_clk_sel_reg) +__weak int board_interface_eth_init (struct udevice *dev, +phy_interface_t interface_type) {return 0 ; }
@@ -1602,8 +1602,6 @@ static int eqos_probe_resources_stm32(struct udevice *dev)struct eqos_priv *eqos =dev_get_priv (dev);int ret;phy_interface_t interface; -bool eth_clk_sel_reg = false; -bool eth_ref_clk_sel_reg = false;debug ("%s(dev=%p):\n" , __func__, dev);
@@ -1614,15 +1612,7 @@ static int eqos_probe_resources_stm32(struct udevice *dev)return -EINVAL ; } -/* Gigabit Ethernet 125MHz clock selection. */ - eth_clk_sel_reg =dev_read_bool (dev,"st,eth_clk_sel" ); - -/* Ethernet 50Mhz RMII clock selection */ - eth_ref_clk_sel_reg = -dev_read_bool (dev,"st,eth_ref_clk_sel" ); - - ret =board_interface_eth_init (interface, eth_clk_sel_reg, - eth_ref_clk_sel_reg); + ret =board_interface_eth_init (dev, interface);if (ret)return -EINVAL ;
include/netdev.h +3 -0
@@ -10,6 +10,7 @@#ifndef _NETDEV_H_#define _NETDEV_H_ +#include <phy_interface.h> /* * Board and CPU-specific initialization functions
@@ -21,6 +22,8 @@*/ int board_eth_init (bd_t *bis); +int board_interface_eth_init (struct udevice *dev, +phy_interface_t interface_type);int cpu_eth_init (bd_t *bis);/* Driver initialization prototypes */
Signature · 1 line
2.7.4
PATCH 2/2 net: dwc_et_qos: update weak function board_interface_eth_init
Quoted 127 lines · Patrick Delaunay
Align the board and driver prototype for
board_interface_eth_initto avoid execution issue (theinterface_typeparameter is defined as int orphy_interface_t).To have a generic weak function (it should be reused by other driver) I change the prototype to use directly udevice.
This prototype is added in
netdev.hto allow compilation check and avoid warning when compiling with W=1 on fileboard/st/stm32mp1/stm32mp1.cwarning: no previous prototype for 'board_interface_eth_init'\
[-Wmissing-prototypes]
int board_interface_eth_init(intinterface_type, ....
^~~~~~~~~~~~~~~~~~~~~~~~Signed-off-by Patrice Chotard <[email protected]>Signed-off-by Patrick Delaunay <[email protected]>---
board/st/stm32mp1/stm32mp1.c | 17 +++++++++++++---- drivers/net/dwc_eth_qos.c | 16 +++------------- include/netdev.h | 3 +++ 3 files changed, 19 insertions(+), 17 deletions(-)board/st/stm32mp1/stm32mp1.c +13
-4@@ -16,6 +16,7 @@#include <misc.h> #include <mtd.h> #include <mtd_node.h> +#include <netdev.h> #include <phy.h> #include <reset.h> #include <syscon.h> @@ -560,13 +561,21 @@ void board_quiesce_devices(void)setup_led (LEDST_OFF ); } -/* board interface eth init */ -/* this is a weak define that we are overriding */ -int board_interface_eth_init (phy_interface_t interface_type, -bool eth_clk_sel_reg,bool eth_ref_clk_sel_reg) +/* eth init function : weak called in eqos driver */ +int board_interface_eth_init (struct udevice *dev, +phy_interface_t interface_type) {u8 *syscfg;u32 value; +bool eth_clk_sel_reg = false; +bool eth_ref_clk_sel_reg = false; + +/* Gigabit Ethernet 125MHz clock selection. */ + eth_clk_sel_reg =dev_read_bool (dev,"st,eth_clk_sel" ); + +/* Ethernet 50Mhz RMII clock selection */ + eth_ref_clk_sel_reg = +dev_read_bool (dev,"st,eth_ref_clk_sel" ); syscfg = (u8 *)syscon_get_first_range (STM32MP_SYSCON_SYSCFG );drivers/net/dwc_eth_qos.c +3
-13@@ -1591,8 +1591,8 @@ err_free_reset_eqos: }/* board-specific Ethernet Interface initializations. */ -__weak int board_interface_eth_init (int interface_type,bool eth_clk_sel_reg, -bool eth_ref_clk_sel_reg) +__weak int board_interface_eth_init (struct udevice *dev, +phy_interface_t interface_type) {return 0 ; }@@ -1602,8 +1602,6 @@ static int eqos_probe_resources_stm32(struct udevice *dev)struct eqos_priv *eqos =dev_get_priv (dev);int ret;phy_interface_t interface; -bool eth_clk_sel_reg = false; -bool eth_ref_clk_sel_reg = false;debug ("%s(dev=%p):\n" , __func__, dev);@@ -1614,15 +1612,7 @@ static int eqos_probe_resources_stm32(struct udevice *dev)return -EINVAL ; } -/* Gigabit Ethernet 125MHz clock selection. */ - eth_clk_sel_reg =dev_read_bool (dev,"st,eth_clk_sel" ); - -/* Ethernet 50Mhz RMII clock selection */ - eth_ref_clk_sel_reg = -dev_read_bool (dev,"st,eth_ref_clk_sel" ); - - ret =board_interface_eth_init (interface, eth_clk_sel_reg, - eth_ref_clk_sel_reg); + ret =board_interface_eth_init (dev, interface);if (ret)return -EINVAL ;include/netdev.h +3
-1@@ -10,6 +10,7 @@#ifndef _NETDEV_H_#define _NETDEV_H_ +#include <phy_interface.h> /* * Board and CPU-specific initialization functions @@ -21,6 +22,8 @@*/ int board_eth_init (bd_t *bis); +int board_interface_eth_init (struct udevice *dev, +phy_interface_t interface_type);int cpu_eth_init (bd_t *bis);/* Driver initialization prototypes */ --
Quoted 2 lines
2.7.4
why can you just write a phy driver specific to this board and hook it to the eth
driver in the dts ?
PATCH 2/2 net: dwc_et_qos: update weak function board_interface_eth_init
Hi Ramon,
No need to write specific phy driver, uboot phy generic driver is working fine.
The goal of board_interface_eth_init function is only to configure syscfg register with good value in function of interface type (MII, RMII, GMII ...). And this syscfg value is specific for each platform. After syscfg register value is use to configure (set some mux) for ethernet clock tree path in RCC.
Regards,
Christophe
--
Sent from: http://u-boot.10912.n7.nabble.com/
PATCH 2/2 net: dwc_et_qos: update weak function board_interface_eth_init
In reply to Patrick DelaunayQuoted 12 lines · Patrick Delaunay
Align the board and driver prototype for
board_interface_eth_initto avoid execution issue (theinterface_typeparameter is defined as int orphy_interface_t).To have a generic weak function (it should be reused by other driver) I change the prototype to use directly udevice.
This prototype is added in
netdev.hto allow compilation check and avoid warning when compiling with W=1 on fileboard/st/stm32mp1/stm32mp1.c
Quoted 7 lines
warning: no previous prototype for 'board_interface_eth_init'\
[-Wmissing-prototypes]
int board_interface_eth_init(intinterface_type, ....
^~~~~~~~~~~~~~~~~~~~~~~~Signed-off-by Patrice Chotard <[email protected]>Signed-off-by Patrick Delaunay <[email protected]>
[U-Boot] net: dwc_et_qos: update weak function board_interface_eth_init
In reply to Patrick DelaunayHi Patrick,
https://patchwork.ozlabs.org/patch/1140379/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git
Thanks!
-Joe
PATCH 1/2 net: dwc_eth_qos: Change eqos_ops function to static
In reply to Patrick DelaunayQuoted 72 lines · Patrick Delaunay
This patch solves many warnings when compiling with W=1:
warning: no previous prototype for '....' [-Wmissing-prototypes]Signed-off-by Patrice Chotard <[email protected]>Signed-off-by Patrick Delaunay <[email protected]>---
drivers/net/dwc_eth_qos.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/net/dwc_eth_qos.c +6
-7@@ -621,7 +621,7 @@ err:return ret; } -void eqos_stop_clks_tegra186 (struct udevice *dev) +static void eqos_stop_clks_tegra186 (struct udevice *dev) {struct eqos_priv *eqos =dev_get_priv (dev);@@ -636,7 +636,7 @@ void eqos_stop_clks_tegra186(struct udevice *dev)debug ("%s: OK\n" , __func__); } -void eqos_stop_clks_stm32 (struct udevice *dev) +static void eqos_stop_clks_stm32 (struct udevice *dev) {struct eqos_priv *eqos =dev_get_priv (dev);@@ -1290,7 +1290,7 @@ err:return ret; } -void eqos_stop (struct udevice *dev) +static void eqos_stop (struct udevice *dev) {struct eqos_priv *eqos =dev_get_priv (dev);int i;@@ -1344,7 +1344,7 @@ void eqos_stop(struct udevice *dev)debug ("%s: OK\n" , __func__); } -int eqos_send (struct udevice *dev,void *packet,int length) +static int eqos_send (struct udevice *dev,void *packet,int length) {struct eqos_priv *eqos =dev_get_priv (dev);struct eqos_desc *tx_desc;@@ -1385,7 +1385,7 @@ int eqos_send(struct udevice *dev, void *packet, int length)return -ETIMEDOUT ; } -int eqos_recv (struct udevice *dev,int flags,uchar **packetp) +static int eqos_recv (struct udevice *dev,int flags,uchar **packetp) {struct eqos_priv *eqos =dev_get_priv (dev);struct eqos_desc *rx_desc;@@ -1409,7 +1409,7 @@ int eqos_recv(struct udevice *dev, int flags, uchar **packetp)return length; } -int eqos_free_pkt (struct udevice *dev,uchar *packet,int length) +static int eqos_free_pkt (struct udevice *dev,uchar *packet,int length) {struct eqos_priv *eqos =dev_get_priv (dev);uchar *packet_expected; --2.7.4
Quoted 4 lines
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH 1/2 net: dwc_eth_qos: Change eqos_ops function to static
In reply to Patrick DelaunayQuoted 6 lines · Patrick Delaunay
This patch solves many warnings when compiling with W=1:
warning: no previous prototype for '....' [-Wmissing-prototypes]Signed-off-by Patrice Chotard <[email protected]>Signed-off-by Patrick Delaunay <[email protected]>
Hi Patrick,
https://patchwork.ozlabs.org/patch/1140378/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git
Thanks!
-Joe