tree:
https://github.com/frank-w/BPI-R2-4.14 5.15-rtl8367dsa
head: c795ca3e9bf72973b4819834fac0728a9108f600
commit: 54251835782f2792cb404b5c12dd412deb72dd7c [31/43] net: phy: add rtl8367 switch phy
driver for r64 v0.1
config: riscv-randconfig-r034-20211114 (attached as .config)
compiler: clang version 14.0.0 (
https://github.com/llvm/llvm-project
c3dddeeafb529e769cde87bd29ef6271ac6bfa5c)
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
#
https://github.com/frank-w/BPI-R2-4.14/commit/54251835782f2792cb404b5c12d...
git remote add frank-w-bpi-r2-4.14
https://github.com/frank-w/BPI-R2-4.14
git fetch --no-tags frank-w-bpi-r2-4.14 5.15-rtl8367dsa
git checkout 54251835782f2792cb404b5c12dd412deb72dd7c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
> drivers/net/phy/rtk/rtl8367s_mdio.c:45:14: error: no previous
prototype for function 'mii_mgr_read' [-Werror,-Wmissing-prototypes]
unsigned int mii_mgr_read(unsigned int phy_addr,unsigned int phy_register,unsigned int
*read_data)
^
drivers/net/phy/rtk/rtl8367s_mdio.c:45:1: note: declare 'static' if the
function is not intended to be used outside of this translation unit
unsigned int mii_mgr_read(unsigned int phy_addr,unsigned int phy_register,unsigned int
*read_data)
^
static
> drivers/net/phy/rtk/rtl8367s_mdio.c:58:14: error: no previous
prototype for function 'mii_mgr_write' [-Werror,-Wmissing-prototypes]
unsigned int mii_mgr_write(unsigned int phy_addr,unsigned int phy_register,unsigned int
write_data)
^
drivers/net/phy/rtk/rtl8367s_mdio.c:58:1: note: declare 'static' if the
function is not intended to be used outside of this translation unit
unsigned int mii_mgr_write(unsigned int phy_addr,unsigned int phy_register,unsigned int
write_data)
^
static
> drivers/net/phy/rtk/rtl8367s_mdio.c:213:6: error: no previous
prototype for function 'init_gsw' [-Werror,-Wmissing-prototypes]
void
init_gsw(void)
^
drivers/net/phy/rtk/rtl8367s_mdio.c:213:1: note: declare 'static' if the
function is not intended to be used outside of this translation unit
void init_gsw(void)
^
static
3 errors generated.
--
> drivers/net/phy/rtk/rtl8367s_dbg.c:169:5: error: no previous
prototype for function 'gsw_debug_proc_init' [-Werror,-Wmissing-prototypes]
int gsw_debug_proc_init(void)
^
drivers/net/phy/rtk/rtl8367s_dbg.c:169:1: note: declare 'static' if the
function is not intended to be used outside of this translation unit
int gsw_debug_proc_init(void)
^
static
> drivers/net/phy/rtk/rtl8367s_dbg.c:190:6: error: no previous
prototype for function 'gsw_debug_proc_exit' [-Werror,-Wmissing-prototypes]
void gsw_debug_proc_exit(void)
^
drivers/net/phy/rtk/rtl8367s_dbg.c:190:1: note: declare 'static' if the
function is not intended to be used outside of this translation unit
void gsw_debug_proc_exit(void)
^
static
2 errors generated.
--
> drivers/net/phy/rtk/rtl8367c/l2.c:2248:9: error: variable
'pmask' is used uninitialized whenever switch default is taken
[-Werror,-Wsometimes-uninitialized]
default:
^~~~~~~
drivers/net/phy/rtk/rtl8367c/l2.c:2253:47: note: uninitialized use occurs here
if ((retVal = rtk_switch_portmask_P2L_get(pmask, pFlood_portmask))!=RT_ERR_OK)
^~~~~
drivers/net/phy/rtk/rtl8367c/l2.c:2223:21: note: initialize the variable
'pmask' to silence this warning
rtk_uint32 pmask;
^
= 0
1 error generated.
--
> drivers/net/phy/rtk/rtl8367c/rtk_switch.c:43:6: error: macro
expansion producing 'defined' has undefined behavior
[-Werror,-Wexpansion-to-defined]
#if (AUTO_PROBE ||
defined(FORCE_PROBE_RTL8367C))
^
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:41:22: note: expanded from macro
'AUTO_PROBE'
#define AUTO_PROBE (!defined(FORCE_PROBE_RTL8367C) &&
!defined(FORCE_PROBE_RTL8370B) && !defined(FORCE_PROBE_RTL8364B) &&
!defined(FORCE_PROBE_RTL8363SC_VB))
^
> drivers/net/phy/rtk/rtl8367c/rtk_switch.c:43:6: error: macro
expansion producing 'defined' has undefined behavior
[-Werror,-Wexpansion-to-defined]
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:41:56:
note: expanded from macro 'AUTO_PROBE'
#define AUTO_PROBE (!defined(FORCE_PROBE_RTL8367C) &&
!defined(FORCE_PROBE_RTL8370B) && !defined(FORCE_PROBE_RTL8364B) &&
!defined(FORCE_PROBE_RTL8363SC_VB))
^
> drivers/net/phy/rtk/rtl8367c/rtk_switch.c:43:6: error: macro
expansion producing 'defined' has undefined behavior
[-Werror,-Wexpansion-to-defined]
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:41:90:
note: expanded from macro 'AUTO_PROBE'
#define AUTO_PROBE (!defined(FORCE_PROBE_RTL8367C) &&
!defined(FORCE_PROBE_RTL8370B) && !defined(FORCE_PROBE_RTL8364B) &&
!defined(FORCE_PROBE_RTL8363SC_VB))
^
> drivers/net/phy/rtk/rtl8367c/rtk_switch.c:43:6: error: macro
expansion producing 'defined' has undefined behavior
[-Werror,-Wexpansion-to-defined]
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:41:124: note: expanded from macro
'AUTO_PROBE'
#define AUTO_PROBE (!defined(FORCE_PROBE_RTL8367C) &&
!defined(FORCE_PROBE_RTL8370B) && !defined(FORCE_PROBE_RTL8364B) &&
!defined(FORCE_PROBE_RTL8363SC_VB))
^
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:112:6: error: macro expansion producing
'defined' has undefined behavior [-Werror,-Wexpansion-to-defined]
#if (AUTO_PROBE || defined(FORCE_PROBE_RTL8370B))
^
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:41:22: note: expanded from macro
'AUTO_PROBE'
#define AUTO_PROBE (!defined(FORCE_PROBE_RTL8367C) &&
!defined(FORCE_PROBE_RTL8370B) && !defined(FORCE_PROBE_RTL8364B) &&
!defined(FORCE_PROBE_RTL8363SC_VB))
^
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:112:6: error: macro expansion producing
'defined' has undefined behavior [-Werror,-Wexpansion-to-defined]
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:41:56: note: expanded from macro
'AUTO_PROBE'
#define AUTO_PROBE (!defined(FORCE_PROBE_RTL8367C) &&
!defined(FORCE_PROBE_RTL8370B) && !defined(FORCE_PROBE_RTL8364B) &&
!defined(FORCE_PROBE_RTL8363SC_VB))
^
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:112:6: error: macro expansion producing
'defined' has undefined behavior [-Werror,-Wexpansion-to-defined]
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:41:90: note: expanded from macro
'AUTO_PROBE'
#define AUTO_PROBE (!defined(FORCE_PROBE_RTL8367C) &&
!defined(FORCE_PROBE_RTL8370B) && !defined(FORCE_PROBE_RTL8364B) &&
!defined(FORCE_PROBE_RTL8363SC_VB))
^
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:112:6: error: macro expansion producing
'defined' has undefined behavior [-Werror,-Wexpansion-to-defined]
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:41:124: note: expanded from macro
'AUTO_PROBE'
#define AUTO_PROBE (!defined(FORCE_PROBE_RTL8367C) &&
!defined(FORCE_PROBE_RTL8370B) && !defined(FORCE_PROBE_RTL8364B) &&
!defined(FORCE_PROBE_RTL8363SC_VB))
^
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:181:6: error: macro expansion producing
'defined' has undefined behavior [-Werror,-Wexpansion-to-defined]
#if (AUTO_PROBE || defined(FORCE_PROBE_RTL8364B))
^
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:41:22: note: expanded from macro
'AUTO_PROBE'
#define AUTO_PROBE (!defined(FORCE_PROBE_RTL8367C) &&
!defined(FORCE_PROBE_RTL8370B) && !defined(FORCE_PROBE_RTL8364B) &&
!defined(FORCE_PROBE_RTL8363SC_VB))
^
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:181:6: error: macro expansion producing
'defined' has undefined behavior [-Werror,-Wexpansion-to-defined]
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:41:56: note: expanded from macro
'AUTO_PROBE'
#define AUTO_PROBE (!defined(FORCE_PROBE_RTL8367C) &&
!defined(FORCE_PROBE_RTL8370B) && !defined(FORCE_PROBE_RTL8364B) &&
!defined(FORCE_PROBE_RTL8363SC_VB))
^
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:181:6: error: macro expansion producing
'defined' has undefined behavior [-Werror,-Wexpansion-to-defined]
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:41:90: note: expanded from macro
'AUTO_PROBE'
#define AUTO_PROBE (!defined(FORCE_PROBE_RTL8367C) &&
!defined(FORCE_PROBE_RTL8370B) && !defined(FORCE_PROBE_RTL8364B) &&
!defined(FORCE_PROBE_RTL8363SC_VB))
^
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:181:6: error: macro expansion producing
'defined' has undefined behavior [-Werror,-Wexpansion-to-defined]
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:41:124: note: expanded from macro
'AUTO_PROBE'
#define AUTO_PROBE (!defined(FORCE_PROBE_RTL8367C) &&
!defined(FORCE_PROBE_RTL8370B) && !defined(FORCE_PROBE_RTL8364B) &&
!defined(FORCE_PROBE_RTL8363SC_VB))
^
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:250:6: error: macro expansion producing
'defined' has undefined behavior [-Werror,-Wexpansion-to-defined]
#if (AUTO_PROBE || defined(FORCE_PROBE_RTL8363SC_VB))
^
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:41:22: note: expanded from macro
'AUTO_PROBE'
#define AUTO_PROBE (!defined(FORCE_PROBE_RTL8367C) &&
!defined(FORCE_PROBE_RTL8370B) && !defined(FORCE_PROBE_RTL8364B) &&
!defined(FORCE_PROBE_RTL8363SC_VB))
^
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:250:6: error: macro expansion producing
'defined' has undefined behavior [-Werror,-Wexpansion-to-defined]
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:41:56: note: expanded from macro
'AUTO_PROBE'
#define AUTO_PROBE (!defined(FORCE_PROBE_RTL8367C) &&
!defined(FORCE_PROBE_RTL8370B) && !defined(FORCE_PROBE_RTL8364B) &&
!defined(FORCE_PROBE_RTL8363SC_VB))
^
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:250:6: error: macro expansion producing
'defined' has undefined behavior [-Werror,-Wexpansion-to-defined]
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:41:90: note: expanded from macro
'AUTO_PROBE'
#define AUTO_PROBE (!defined(FORCE_PROBE_RTL8367C) &&
!defined(FORCE_PROBE_RTL8370B) && !defined(FORCE_PROBE_RTL8364B) &&
!defined(FORCE_PROBE_RTL8363SC_VB))
^
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:250:6: error: macro expansion producing
'defined' has undefined behavior [-Werror,-Wexpansion-to-defined]
drivers/net/phy/rtk/rtl8367c/rtk_switch.c:41:124: note: expanded from macro
'AUTO_PROBE'
#define AUTO_PROBE (!defined(FORCE_PROBE_RTL8367C) &&
!defined(FORCE_PROBE_RTL8370B) && !defined(FORCE_PROBE_RTL8364B) &&
!defined(FORCE_PROBE_RTL8363SC_VB))
^
16 errors generated.
--
> drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_eav.c:717:14:
error: variable 'sec_h' is used uninitialized whenever 'if' condition is
false [-Werror,-Wsometimes-uninitialized]
}else if(port == 9){
^~~~~~~~~
drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_eav.c:730:26: note: uninitialized use
occurs here
timeStamp->second = (sec_h<<16) | sec_l;
^~~~~
drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_eav.c:717:11: note: remove the
'if' if its condition is always true
}else if(port == 9){
^~~~~~~~~~~~~
drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_eav.c:654:21: note: initialize the
variable 'sec_h' to silence this warning
rtk_uint32 sec_h, sec_l, nsec8_h, nsec8_l;
^
= 0
> drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_eav.c:717:14:
error: variable 'sec_l' is used uninitialized whenever 'if' condition is
false [-Werror,-Wsometimes-uninitialized]
}else if(port == 9){
^~~~~~~~~
drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_eav.c:730:39: note: uninitialized use
occurs here
timeStamp->second = (sec_h<<16) | sec_l;
^~~~~
drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_eav.c:717:11: note: remove the
'if' if its condition is always true
}else if(port == 9){
^~~~~~~~~~~~~
drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_eav.c:654:28: note: initialize the
variable 'sec_l' to silence this warning
rtk_uint32 sec_h, sec_l, nsec8_h, nsec8_l;
^
= 0
> drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_eav.c:717:14:
error: variable 'nsec8_h' is used uninitialized whenever 'if' condition is
false [-Werror,-Wsometimes-uninitialized]
}else if(port == 9){
^~~~~~~~~
drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_eav.c:731:22: note: uninitialized use
occurs here
nano_second_8 = (nsec8_h<<16) | nsec8_l;
^~~~~~~
drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_eav.c:717:11: note: remove the
'if' if its condition is always true
}else if(port == 9){
^~~~~~~~~~~~~
drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_eav.c:654:37: note: initialize the
variable 'nsec8_h' to silence this warning
rtk_uint32 sec_h, sec_l, nsec8_h, nsec8_l;
^
= 0
> drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_eav.c:717:14:
error: variable 'nsec8_l' is used uninitialized whenever 'if' condition is
false [-Werror,-Wsometimes-uninitialized]
}else if(port == 9){
^~~~~~~~~
drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_eav.c:731:37: note: uninitialized use
occurs here
nano_second_8 = (nsec8_h<<16) | nsec8_l;
^~~~~~~
drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_eav.c:717:11: note: remove the
'if' if its condition is always true
}else if(port == 9){
^~~~~~~~~~~~~
drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_eav.c:654:46: note: initialize the
variable 'nsec8_l' to silence this warning
rtk_uint32 sec_h, sec_l, nsec8_h, nsec8_l;
^
= 0
4 errors generated.
--
> drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_port.c:4823:18:
error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
if( (regData == 0x6367) )
~~~~~~~~^~~~~~~~~
drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_port.c:4823:18: note: remove extraneous
parentheses around the comparison to silence this warning
if( (regData == 0x6367) )
~ ^ ~
drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_port.c:4823:18: note: use '=' to
turn this equality comparison into an assignment
if( (regData == 0x6367) )
^~
=
1 error generated.
--
> drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_svlan.c:500:13:
error: variable 'regAddr' is used uninitialized whenever 'if' condition is
false [-Werror,-Wsometimes-uninitialized]
else if(index == 63)
^~~~~~~~~~~
drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_svlan.c:503:34: note: uninitialized use
occurs here
retVal = rtl8367c_setAsicReg(regAddr, regData);
^~~~~~~
drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_svlan.c:500:10: note: remove the
'if' if its condition is always true
else if(index == 63)
^~~~~~~~~~~~~~~
drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_svlan.c:474:23: note: initialize the
variable 'regAddr' to silence this warning
rtk_uint32 regAddr, regData;
^
= 0
drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_svlan.c:554:13: error: variable
'regAddr' is used uninitialized whenever 'if' condition is false
[-Werror,-Wsometimes-uninitialized]
else if(index == 63)
^~~~~~~~~~~
drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_svlan.c:557:34: note: uninitialized use
occurs here
retVal = rtl8367c_getAsicReg(regAddr, ®Data);
^~~~~~~
drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_svlan.c:554:10: note: remove the
'if' if its condition is always true
else if(index == 63)
^~~~~~~~~~~~~~~
drivers/net/phy/rtk/rtl8367c/rtl8367c_asicdrv_svlan.c:529:23: note: initialize the
variable 'regAddr' to silence this warning
rtk_uint32 regAddr,regData;
^
= 0
2 errors generated.
--
> drivers/net/phy/rtk/rtl8367c/stat.c:143:50: error: implicit
conversion from enumeration type 'rtk_stat_global_type_t' (aka 'enum
rtk_stat_global_type_e') to different enumeration type 'RTL8367C_MIBCOUNTER'
(aka 'enum RTL8367C_MIBCOUNTER_E') [-Werror,-Wenum-conversion]
if
((retVal = rtl8367c_getAsicMIBsCounter(0, cntr_idx, pCntr)) != RT_ERR_OK)
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~
> drivers/net/phy/rtk/rtl8367c/stat.c:175:49: error: implicit
conversion from enumeration type 'enum rtk_stat_global_type_e' to different
enumeration type 'RTL8367C_MIBCOUNTER' (aka 'enum RTL8367C_MIBCOUNTER_E')
[-Werror,-Wenum-conversion]
if ((retVal =
rtl8367c_getAsicMIBsCounter(0,DOT1D_TP_LEARNED_ENTRY_DISCARDS_INDEX,
&pGlobal_cntrs->dot1dTpLearnedEntryDiscards)) != RT_ERR_OK)
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
--
> drivers/net/phy/rtk/rtl8367c/vlan.c:953:22: error: implicit
conversion from enumeration type 'rtk_vlan_protoVlan_frameType_t' (aka 'enum
rtk_vlan_protoVlan_frameType_e') to different enumeration type
'rtl8367c_provlan_frametype' [-Werror,-Wenum-conversion]
tmp =
pInfo->frame_type;
~ ~~~~~~~^~~~~~~~~~
drivers/net/phy/rtk/rtl8367c/vlan.c:979:41: error: implicit conversion from enumeration
type 'rtk_vlan_protoVlan_frameType_t' (aka 'enum
rtk_vlan_protoVlan_frameType_e') to different enumeration type
'rtl8367c_provlan_frametype' [-Werror,-Wenum-conversion]
ppb_data_cfg.frameType = pInfo->frame_type;
~ ~~~~~~~^~~~~~~~~~
> drivers/net/phy/rtk/rtl8367c/vlan.c:1270:84: error: implicit
conversion from enumeration type 'rtk_vlan_tagMode_t' (aka 'enum
rtk_vlan_tagMode_e') to different enumeration type 'rtl8367c_egtagmode'
[-Werror,-Wenum-conversion]
if ((retVal =
rtl8367c_setAsicVlanEgressTagMode(rtk_switch_port_L2P_get(port), tag_mode)) != RT_ERR_OK)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^~~~~~~~
3 errors generated.
vim +/mii_mgr_read +45 drivers/net/phy/rtk/rtl8367s_mdio.c
43
44 /*mii_mgr_read/mii_mgr_write is the callback API for rtl8367 driver*/
45 unsigned int mii_mgr_read(unsigned int phy_addr,unsigned int
phy_register,unsigned int *read_data)
46 {
47 struct mii_bus *bus = _gsw->bus;
48
49 mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
50
51 *read_data = bus->read(bus, phy_addr, phy_register);
52
53 mutex_unlock(&bus->mdio_lock);
54
55 return 0;
56 }
57
58 unsigned int mii_mgr_write(unsigned int phy_addr,unsigned int
phy_register,unsigned int write_data)
59 {
60 struct mii_bus *bus = _gsw->bus;
61
62 mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
63
64 bus->write(bus, phy_addr, phy_register, write_data);
65
66 mutex_unlock(&bus->mdio_lock);
67
68 return 0;
69 }
70
71 static int rtl8367s_hw_reset(void)
72 {
73 struct rtk_gsw *gsw = _gsw;
74 int ret;
75
76 ret = devm_gpio_request(gsw->dev, gsw->reset_pin,
"mediatek,reset-pin");
77
78 if (ret)
79 printk("fail to devm_gpio_request\n");
80
81 gpio_direction_output(gsw->reset_pin, 0);
82
83 usleep_range(1000, 1100);
84
85 gpio_set_value(gsw->reset_pin, 1);
86
87 mdelay(500);
88
89 devm_gpio_free(gsw->dev, gsw->reset_pin);
90
91 return 0;
92
93 }
94
95 static int rtl8367s_vlan_config(int want_at_p0)
96 {
97 rtk_vlan_cfg_t vlan1, vlan2;
98
99 /* Set LAN/WAN VLAN partition */
100 memset(&vlan1, 0x00, sizeof(rtk_vlan_cfg_t));
101
102 RTK_PORTMASK_PORT_SET(vlan1.mbr, EXT_PORT0);
103 RTK_PORTMASK_PORT_SET(vlan1.mbr, UTP_PORT1);
104 RTK_PORTMASK_PORT_SET(vlan1.mbr, UTP_PORT2);
105 RTK_PORTMASK_PORT_SET(vlan1.mbr, UTP_PORT3);
106 RTK_PORTMASK_PORT_SET(vlan1.untag, EXT_PORT0);
107 RTK_PORTMASK_PORT_SET(vlan1.untag, UTP_PORT1);
108 RTK_PORTMASK_PORT_SET(vlan1.untag, UTP_PORT2);
109 RTK_PORTMASK_PORT_SET(vlan1.untag, UTP_PORT3);
110
111 if (want_at_p0) {
112 RTK_PORTMASK_PORT_SET(vlan1.mbr, UTP_PORT4);
113 RTK_PORTMASK_PORT_SET(vlan1.untag, UTP_PORT4);
114 } else {
115 RTK_PORTMASK_PORT_SET(vlan1.mbr, UTP_PORT0);
116 RTK_PORTMASK_PORT_SET(vlan1.untag, UTP_PORT0);
117 }
118
119 vlan1.ivl_en = 1;
120
121 rtk_vlan_set(1, &vlan1);
122
123 memset(&vlan2, 0x00, sizeof(rtk_vlan_cfg_t));
124
125 RTK_PORTMASK_PORT_SET(vlan2.mbr, EXT_PORT1);
126 RTK_PORTMASK_PORT_SET(vlan2.untag, EXT_PORT1);
127
128 if (want_at_p0) {
129 RTK_PORTMASK_PORT_SET(vlan2.mbr, UTP_PORT0);
130 RTK_PORTMASK_PORT_SET(vlan2.untag, UTP_PORT0);
131 } else {
132 RTK_PORTMASK_PORT_SET(vlan2.mbr, UTP_PORT4);
133 RTK_PORTMASK_PORT_SET(vlan2.untag, UTP_PORT4);
134 }
135
136 vlan2.ivl_en = 1;
137 rtk_vlan_set(2, &vlan2);
138
139 rtk_vlan_portPvid_set(EXT_PORT0, 1, 0);
140 rtk_vlan_portPvid_set(UTP_PORT1, 1, 0);
141 rtk_vlan_portPvid_set(UTP_PORT2, 1, 0);
142 rtk_vlan_portPvid_set(UTP_PORT3, 1, 0);
143 rtk_vlan_portPvid_set(EXT_PORT1, 2, 0);
144
145 if (want_at_p0) {
146 rtk_vlan_portPvid_set(UTP_PORT0, 2, 0);
147 rtk_vlan_portPvid_set(UTP_PORT4, 1, 0);
148 } else {
149 rtk_vlan_portPvid_set(UTP_PORT0, 1, 0);
150 rtk_vlan_portPvid_set(UTP_PORT4, 2, 0);
151 }
152
153 return 0;
154 }
155
156 static int rtl8367s_hw_init(void)
157 {
158
159 rtl8367s_hw_reset();
160
161 if(rtk_switch_init())
162 return -1;
163
164 mdelay(500);
165
166 if (rtk_vlan_reset())
167 return -1;
168
169 if (rtk_vlan_init())
170 return -1;
171
172 return 0;
173 }
174
175 static void set_rtl8367s_sgmii(void)
176 {
177 rtk_port_mac_ability_t mac_cfg;
178 rtk_mode_ext_t mode;
179
180 mode = MODE_EXT_HSGMII;
181 mac_cfg.forcemode = MAC_FORCE;
182 mac_cfg.speed = PORT_SPEED_2500M;
183 mac_cfg.duplex = PORT_FULL_DUPLEX;
184 mac_cfg.link = PORT_LINKUP;
185 mac_cfg.nway = DISABLED;
186 mac_cfg.txpause = ENABLED;
187 mac_cfg.rxpause = ENABLED;
188 rtk_port_macForceLinkExt_set(EXT_PORT0, mode, &mac_cfg);
189 rtk_port_sgmiiNway_set(EXT_PORT0, DISABLED);
190 rtk_port_phyEnableAll_set(ENABLED);
191
192 }
193
194 static void set_rtl8367s_rgmii(void)
195 {
196 rtk_port_mac_ability_t mac_cfg;
197 rtk_mode_ext_t mode;
198
199 mode = MODE_EXT_RGMII;
200 mac_cfg.forcemode = MAC_FORCE;
201 mac_cfg.speed = PORT_SPEED_1000M;
202 mac_cfg.duplex = PORT_FULL_DUPLEX;
203 mac_cfg.link = PORT_LINKUP;
204 mac_cfg.nway = DISABLED;
205 mac_cfg.txpause = ENABLED;
206 mac_cfg.rxpause = ENABLED;
207 rtk_port_macForceLinkExt_set(EXT_PORT1, mode, &mac_cfg);
208 rtk_port_rgmiiDelayExt_set(EXT_PORT1, 1, 3);
209 rtk_port_phyEnableAll_set(ENABLED);
210
211 }
212
213 void init_gsw(void)
214 {
215 rtl8367s_hw_init();
216 set_rtl8367s_sgmii();
217 set_rtl8367s_rgmii();
218 }
219
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org