Re: [kbuild-all] [PATCH] net: stmmac: socfpga: re-use the `interface` parameter from platform data

2019-10-09 Thread Rong Chen




On 9/9/19 4:53 PM, Ardelean, Alexandru wrote:

On Sat, 2019-09-07 at 20:54 +0800, kbuild test robot wrote:

[External]

Hi Alexandru,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]

Hmm, this error should be expectable I guess: I applied this on net-next/master.


Sorry for the inconvenience, we'll take a look. btw, 0day-CI introduced 
'--base' option to record base tree info in format-patch.

please see https://stackoverflow.com/a/37406982

Best Regards,
Rong Chen



Alex


[cannot apply to v5.3-rc7 next-20190904]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Alexandru-Ardelean/net-stmmac-socfpga-re-use-the-interface-parameter-from-platform-data/20190907-190627
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 7.4.0
reproduce:
 wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
 chmod +x ~/bin/make.cross
 # save the attached .config to linux build tree
 GCC_VERSION=7.4.0 make.cross ARCH=sparc64

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

In file included from include/linux/dma-mapping.h:7:0,
 from include/linux/skbuff.h:30,
 from include/linux/if_ether.h:19,
 from include/uapi/linux/ethtool.h:19,
 from include/linux/ethtool.h:18,
 from include/linux/phy.h:16,
 from 
drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c:11:
drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c: In function 
'socfpga_gen5_set_phy_mode':

drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c:264:44: error: 'phymode' 
undeclared (first use in this
function); did you mean 'phy_modes'?

   dev_err(dwmac->dev, "bad phy mode %d\n", phymode);
^
include/linux/device.h:1499:32: note: in definition of macro 'dev_err'
  _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
^~~
drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c:264:44: note: each 
undeclared identifier is reported only once
for each function it appears in
   dev_err(dwmac->dev, "bad phy mode %d\n", phymode);
^
include/linux/device.h:1499:32: note: in definition of macro 'dev_err'
  _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
^~~
drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c: In function 
'socfpga_gen10_set_phy_mode':
drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c:340:6: error: 
'phymode' undeclared (first use in this
function); did you mean 'phy_modes'?
  phymode == PHY_INTERFACE_MODE_MII ||
  ^~~
  phy_modes

vim +264 drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c

40ae25505fe834 Dinh Nguyen2019-06-05  255
40ae25505fe834 Dinh Nguyen2019-06-05  256  static int 
socfpga_gen5_set_phy_mode(struct socfpga_dwmac *dwmac)
40ae25505fe834 Dinh Nguyen2019-06-05  257  {
40ae25505fe834 Dinh Nguyen2019-06-05  258   struct regmap 
*sys_mgr_base_addr = dwmac->sys_mgr_base_addr;
40ae25505fe834 Dinh Nguyen2019-06-05  259   u32 reg_offset = 
dwmac->reg_offset;
40ae25505fe834 Dinh Nguyen2019-06-05  260   u32 reg_shift = 
dwmac->reg_shift;
40ae25505fe834 Dinh Nguyen2019-06-05  261   u32 ctrl, val, module;
40ae25505fe834 Dinh Nguyen2019-06-05  262
6169afbe4a340b Alexandru Ardelean 2019-09-06  263   if 
(socfpga_set_phy_mode_common(dwmac, )) {
801d233b7302ee Dinh Nguyen2014-03-26 @264   dev_err(dwmac->dev, 
"bad phy mode %d\n", phymode);
801d233b7302ee Dinh Nguyen2014-03-26  265   return -EINVAL;
801d233b7302ee Dinh Nguyen2014-03-26  266   }
801d233b7302ee Dinh Nguyen2014-03-26  267
b4834c86e11baf Ley Foon Tan   2014-08-20  268   /* Overwrite val to 
GMII if splitter core is enabled. The
phymode here
b4834c86e11baf Ley Foon Tan   2014-08-20  269* is the actual phy 
mode on phy hardware, but phy interface
from
b4834c86e11baf Ley Foon Tan   2014-08-20  270* EMAC core is GMII.
b4834c86e11baf Ley Foon Tan   2014-08-20  271*/
b4834c86e11baf Ley Foon Tan   2014-08-20  272   if 
(dwmac->splitter_base)
b4834c86e11baf Ley Foon Tan   2014-08-20  273   val = 
SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII;
b4834c86e11baf Ley Foon Tan   2014-08-20  274
70cb136f773083 Joachim Eastwood   2016-05-01  275   /* Assert reset to the 
enet controller before changing the phy
mode */
bc8a2d9bcbf1ca Dinh Nguyen2018-06-19  276   
reset_control_assert(dwmac->stmmac_ocp_rst);

Re: [PATCH] net: stmmac: socfpga: re-use the `interface` parameter from platform data

2019-09-10 Thread Ardelean, Alexandru
On Tue, 2019-09-10 at 17:46 +0200, David Miller wrote:
> [External]
> 
> From: David Miller 
> Date: Tue, 10 Sep 2019 17:45:44 +0200 (CEST)
> 
> > From: Alexandru Ardelean 
> > Date: Fri, 6 Sep 2019 15:30:54 +0300
> > 
> > > The socfpga sub-driver defines an `interface` field in the `socfpga_dwmac`
> > > struct and parses it on init.
> > > 
> > > The shared `stmmac_probe_config_dt()` function also parses this from the
> > > device-tree and makes it available on the returned `plat_data` (which is
> > > the same data available via `netdev_priv()`).
> > > 
> > > All that's needed now is to dig that information out, via some
> > > `dev_get_drvdata()` && `netdev_priv()` calls and re-use it.
> > > 
> > > Signed-off-by: Alexandru Ardelean 
> > 
> > This doesn't build even on net-next.
> 

Right.
My bad.

I think I got confused with multiple/cross-testing and probably this change 
didn't even get compiled.

Apologies for this.
Will send a good version.

Alex

> Specifically:
> 
> drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c: In function 
> ‘socfpga_gen5_set_phy_mode’:
> drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c:264:44: error: ‘phymode’ 
> undeclared (first use in this function);
> did you mean ‘phy_modes’?
>   264 |   dev_err(dwmac->dev, "bad phy mode %d\n", phymode);
>   |^~~
> ./include/linux/device.h:1499:32: note: in definition of macro ‘dev_err’
>  1499 |  _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
>   |^~~
> drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c:264:44: note: each 
> undeclared identifier is reported only once for
> each function it appears in
>   264 |   dev_err(dwmac->dev, "bad phy mode %d\n", phymode);
>   |^~~
> ./include/linux/device.h:1499:32: note: in definition of macro ‘dev_err’
>  1499 |  _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
>   |^~~
> drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c: In function 
> ‘socfpga_gen10_set_phy_mode’:
> drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c:340:6: error: ‘phymode’ 
> undeclared (first use in this function);
> did you mean ‘phy_modes’?
>   340 |  phymode == PHY_INTERFACE_MODE_MII ||
>   |  ^~~
>   |  phy_modes


Re: [PATCH] net: stmmac: socfpga: re-use the `interface` parameter from platform data

2019-09-10 Thread David Miller
From: David Miller 
Date: Tue, 10 Sep 2019 17:45:44 +0200 (CEST)

> From: Alexandru Ardelean 
> Date: Fri, 6 Sep 2019 15:30:54 +0300
> 
>> The socfpga sub-driver defines an `interface` field in the `socfpga_dwmac`
>> struct and parses it on init.
>> 
>> The shared `stmmac_probe_config_dt()` function also parses this from the
>> device-tree and makes it available on the returned `plat_data` (which is
>> the same data available via `netdev_priv()`).
>> 
>> All that's needed now is to dig that information out, via some
>> `dev_get_drvdata()` && `netdev_priv()` calls and re-use it.
>> 
>> Signed-off-by: Alexandru Ardelean 
> 
> This doesn't build even on net-next.

Specifically:

drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c: In function 
‘socfpga_gen5_set_phy_mode’:
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c:264:44: error: ‘phymode’ 
undeclared (first use in this function); did you mean ‘phy_modes’?
  264 |   dev_err(dwmac->dev, "bad phy mode %d\n", phymode);
  |^~~
./include/linux/device.h:1499:32: note: in definition of macro ‘dev_err’
 1499 |  _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
  |^~~
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c:264:44: note: each 
undeclared identifier is reported only once for each function it appears in
  264 |   dev_err(dwmac->dev, "bad phy mode %d\n", phymode);
  |^~~
./include/linux/device.h:1499:32: note: in definition of macro ‘dev_err’
 1499 |  _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
  |^~~
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c: In function 
‘socfpga_gen10_set_phy_mode’:
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c:340:6: error: ‘phymode’ 
undeclared (first use in this function); did you mean ‘phy_modes’?
  340 |  phymode == PHY_INTERFACE_MODE_MII ||
  |  ^~~
  |  phy_modes


Re: [PATCH] net: stmmac: socfpga: re-use the `interface` parameter from platform data

2019-09-10 Thread David Miller
From: Alexandru Ardelean 
Date: Fri, 6 Sep 2019 15:30:54 +0300

> The socfpga sub-driver defines an `interface` field in the `socfpga_dwmac`
> struct and parses it on init.
> 
> The shared `stmmac_probe_config_dt()` function also parses this from the
> device-tree and makes it available on the returned `plat_data` (which is
> the same data available via `netdev_priv()`).
> 
> All that's needed now is to dig that information out, via some
> `dev_get_drvdata()` && `netdev_priv()` calls and re-use it.
> 
> Signed-off-by: Alexandru Ardelean 

This doesn't build even on net-next.

And if your patch does target net-next you must indicate this properly in the
Subject line as "[PATCH net-next]" vs. "[PATCH net]"


Re: [PATCH] net: stmmac: socfpga: re-use the `interface` parameter from platform data

2019-09-09 Thread Ardelean, Alexandru
On Sat, 2019-09-07 at 20:54 +0800, kbuild test robot wrote:
> [External]
> 
> Hi Alexandru,
> 
> I love your patch! Yet something to improve:
> 
> [auto build test ERROR on linus/master]

Hmm, this error should be expectable I guess: I applied this on net-next/master.

Alex

> [cannot apply to v5.3-rc7 next-20190904]
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improve the system]
> 
> url:
> https://github.com/0day-ci/linux/commits/Alexandru-Ardelean/net-stmmac-socfpga-re-use-the-interface-parameter-from-platform-data/20190907-190627
> config: sparc64-allmodconfig (attached as .config)
> compiler: sparc64-linux-gcc (GCC) 7.4.0
> reproduce:
> wget 
> https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
> ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> GCC_VERSION=7.4.0 make.cross ARCH=sparc64 
> 
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot 
> 
> All errors (new ones prefixed by >>):
> 
>In file included from include/linux/dma-mapping.h:7:0,
> from include/linux/skbuff.h:30,
> from include/linux/if_ether.h:19,
> from include/uapi/linux/ethtool.h:19,
> from include/linux/ethtool.h:18,
> from include/linux/phy.h:16,
> from 
> drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c:11:
>drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c: In function 
> 'socfpga_gen5_set_phy_mode':
> > > drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c:264:44: error: 
> > > 'phymode' undeclared (first use in this
> > > function); did you mean 'phy_modes'?
>   dev_err(dwmac->dev, "bad phy mode %d\n", phymode);
>^
>include/linux/device.h:1499:32: note: in definition of macro 'dev_err'
>  _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
>^~~
>drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c:264:44: note: each 
> undeclared identifier is reported only once
> for each function it appears in
>   dev_err(dwmac->dev, "bad phy mode %d\n", phymode);
>^
>include/linux/device.h:1499:32: note: in definition of macro 'dev_err'
>  _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
>^~~
>drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c: In function 
> 'socfpga_gen10_set_phy_mode':
>drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c:340:6: error: 
> 'phymode' undeclared (first use in this
> function); did you mean 'phy_modes'?
>  phymode == PHY_INTERFACE_MODE_MII ||
>  ^~~
>  phy_modes
> 
> vim +264 drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c
> 
> 40ae25505fe834 Dinh Nguyen2019-06-05  255  
> 40ae25505fe834 Dinh Nguyen2019-06-05  256  static int 
> socfpga_gen5_set_phy_mode(struct socfpga_dwmac *dwmac)
> 40ae25505fe834 Dinh Nguyen2019-06-05  257  {
> 40ae25505fe834 Dinh Nguyen2019-06-05  258 struct regmap 
> *sys_mgr_base_addr = dwmac->sys_mgr_base_addr;
> 40ae25505fe834 Dinh Nguyen2019-06-05  259 u32 reg_offset = 
> dwmac->reg_offset;
> 40ae25505fe834 Dinh Nguyen2019-06-05  260 u32 reg_shift = 
> dwmac->reg_shift;
> 40ae25505fe834 Dinh Nguyen2019-06-05  261 u32 ctrl, val, module;
> 40ae25505fe834 Dinh Nguyen2019-06-05  262  
> 6169afbe4a340b Alexandru Ardelean 2019-09-06  263 if 
> (socfpga_set_phy_mode_common(dwmac, )) {
> 801d233b7302ee Dinh Nguyen2014-03-26 @264 
> dev_err(dwmac->dev, "bad phy mode %d\n", phymode);
> 801d233b7302ee Dinh Nguyen2014-03-26  265 return -EINVAL;
> 801d233b7302ee Dinh Nguyen2014-03-26  266 }
> 801d233b7302ee Dinh Nguyen2014-03-26  267  
> b4834c86e11baf Ley Foon Tan   2014-08-20  268 /* Overwrite val to 
> GMII if splitter core is enabled. The
> phymode here
> b4834c86e11baf Ley Foon Tan   2014-08-20  269  * is the actual phy 
> mode on phy hardware, but phy interface
> from
> b4834c86e11baf Ley Foon Tan   2014-08-20  270  * EMAC core is GMII.
> b4834c86e11baf Ley Foon Tan   2014-08-20  271  */
> b4834c86e11baf Ley Foon Tan   2014-08-20  272 if 
> (dwmac->splitter_base)
> b4834c86e11baf Ley Foon Tan   2014-08-20  273 val = 
> SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII;
> b4834c86e11baf Ley Foon Tan   2014-08-20  274  
> 70cb136f773083 Joachim Eastwood   2016-05-01  275 /* Assert reset to the 
> enet controller before changing the phy
> mode */
> bc8a2d9bcbf1ca Dinh Nguyen2018-06-19  276 
> reset_control_assert(dwmac->stmmac_ocp_rst);
> 70cb136f773083 Joachim Eastwood   2016-05-01  277 
> reset_control_assert(dwmac->stmmac_rst);
> 

Re: [PATCH] net: stmmac: socfpga: re-use the `interface` parameter from platform data

2019-09-07 Thread kbuild test robot
Hi Alexandru,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.3-rc7 next-20190904]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Alexandru-Ardelean/net-stmmac-socfpga-re-use-the-interface-parameter-from-platform-data/20190907-190627
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 7.4.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=sparc64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

   In file included from include/linux/dma-mapping.h:7:0,
from include/linux/skbuff.h:30,
from include/linux/if_ether.h:19,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from include/linux/phy.h:16,
from 
drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c:11:
   drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c: In function 
'socfpga_gen5_set_phy_mode':
>> drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c:264:44: error: 
>> 'phymode' undeclared (first use in this function); did you mean 'phy_modes'?
  dev_err(dwmac->dev, "bad phy mode %d\n", phymode);
   ^
   include/linux/device.h:1499:32: note: in definition of macro 'dev_err'
 _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
   ^~~
   drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c:264:44: note: each 
undeclared identifier is reported only once for each function it appears in
  dev_err(dwmac->dev, "bad phy mode %d\n", phymode);
   ^
   include/linux/device.h:1499:32: note: in definition of macro 'dev_err'
 _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
   ^~~
   drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c: In function 
'socfpga_gen10_set_phy_mode':
   drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c:340:6: error: 'phymode' 
undeclared (first use in this function); did you mean 'phy_modes'?
 phymode == PHY_INTERFACE_MODE_MII ||
 ^~~
 phy_modes

vim +264 drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c

40ae25505fe834 Dinh Nguyen2019-06-05  255  
40ae25505fe834 Dinh Nguyen2019-06-05  256  static int 
socfpga_gen5_set_phy_mode(struct socfpga_dwmac *dwmac)
40ae25505fe834 Dinh Nguyen2019-06-05  257  {
40ae25505fe834 Dinh Nguyen2019-06-05  258   struct regmap 
*sys_mgr_base_addr = dwmac->sys_mgr_base_addr;
40ae25505fe834 Dinh Nguyen2019-06-05  259   u32 reg_offset = 
dwmac->reg_offset;
40ae25505fe834 Dinh Nguyen2019-06-05  260   u32 reg_shift = 
dwmac->reg_shift;
40ae25505fe834 Dinh Nguyen2019-06-05  261   u32 ctrl, val, module;
40ae25505fe834 Dinh Nguyen2019-06-05  262  
6169afbe4a340b Alexandru Ardelean 2019-09-06  263   if 
(socfpga_set_phy_mode_common(dwmac, )) {
801d233b7302ee Dinh Nguyen2014-03-26 @264   
dev_err(dwmac->dev, "bad phy mode %d\n", phymode);
801d233b7302ee Dinh Nguyen2014-03-26  265   return -EINVAL;
801d233b7302ee Dinh Nguyen2014-03-26  266   }
801d233b7302ee Dinh Nguyen2014-03-26  267  
b4834c86e11baf Ley Foon Tan   2014-08-20  268   /* Overwrite val to 
GMII if splitter core is enabled. The phymode here
b4834c86e11baf Ley Foon Tan   2014-08-20  269* is the actual phy 
mode on phy hardware, but phy interface from
b4834c86e11baf Ley Foon Tan   2014-08-20  270* EMAC core is GMII.
b4834c86e11baf Ley Foon Tan   2014-08-20  271*/
b4834c86e11baf Ley Foon Tan   2014-08-20  272   if 
(dwmac->splitter_base)
b4834c86e11baf Ley Foon Tan   2014-08-20  273   val = 
SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII;
b4834c86e11baf Ley Foon Tan   2014-08-20  274  
70cb136f773083 Joachim Eastwood   2016-05-01  275   /* Assert reset to the 
enet controller before changing the phy mode */
bc8a2d9bcbf1ca Dinh Nguyen2018-06-19  276   
reset_control_assert(dwmac->stmmac_ocp_rst);
70cb136f773083 Joachim Eastwood   2016-05-01  277   
reset_control_assert(dwmac->stmmac_rst);
70cb136f773083 Joachim Eastwood   2016-05-01  278  
801d233b7302ee Dinh Nguyen2014-03-26  279   
regmap_read(sys_mgr_base_addr, reg_offset, );
801d233b7302ee Dinh Nguyen2014-03-26  280   ctrl &= 
~(SYSMGR_EMACGRP_CTRL_PHYSEL_MASK << reg_shift);
801d233b7302ee Dinh Nguyen2014-03-26  281   ctrl |= val << 

[PATCH] net: stmmac: socfpga: re-use the `interface` parameter from platform data

2019-09-06 Thread Alexandru Ardelean
The socfpga sub-driver defines an `interface` field in the `socfpga_dwmac`
struct and parses it on init.

The shared `stmmac_probe_config_dt()` function also parses this from the
device-tree and makes it available on the returned `plat_data` (which is
the same data available via `netdev_priv()`).

All that's needed now is to dig that information out, via some
`dev_get_drvdata()` && `netdev_priv()` calls and re-use it.

Signed-off-by: Alexandru Ardelean 
---
 .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c   | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c 
b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index c141fe783e87..3094bb1f77e5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -46,7 +46,6 @@ struct socfpga_dwmac_ops {
 };
 
 struct socfpga_dwmac {
-   int interface;
u32 reg_offset;
u32 reg_shift;
struct  device *dev;
@@ -110,8 +109,6 @@ static int socfpga_dwmac_parse_data(struct socfpga_dwmac 
*dwmac, struct device *
struct resource res_tse_pcs;
struct resource res_sgmii_adapter;
 
-   dwmac->interface = of_get_phy_mode(np);
-
sys_mgr_base_addr =
altr_sysmgr_regmap_lookup_by_phandle(np, "altr,sysmgr-syscon");
if (IS_ERR(sys_mgr_base_addr)) {
@@ -231,8 +228,12 @@ static int socfpga_dwmac_parse_data(struct socfpga_dwmac 
*dwmac, struct device *
return ret;
 }
 
-static int socfpga_set_phy_mode_common(int phymode, u32 *val)
+static int socfpga_set_phy_mode_common(struct socfpga_dwmac *dwmac, u32 *val)
 {
+   struct net_device *ndev = dev_get_drvdata(dwmac->dev);
+   struct stmmac_priv *priv = netdev_priv(ndev);
+   int phymode = priv->plat->interface;
+
switch (phymode) {
case PHY_INTERFACE_MODE_RGMII:
case PHY_INTERFACE_MODE_RGMII_ID:
@@ -255,12 +256,11 @@ static int socfpga_set_phy_mode_common(int phymode, u32 
*val)
 static int socfpga_gen5_set_phy_mode(struct socfpga_dwmac *dwmac)
 {
struct regmap *sys_mgr_base_addr = dwmac->sys_mgr_base_addr;
-   int phymode = dwmac->interface;
u32 reg_offset = dwmac->reg_offset;
u32 reg_shift = dwmac->reg_shift;
u32 ctrl, val, module;
 
-   if (socfpga_set_phy_mode_common(phymode, )) {
+   if (socfpga_set_phy_mode_common(dwmac, )) {
dev_err(dwmac->dev, "bad phy mode %d\n", phymode);
return -EINVAL;
}
@@ -314,12 +314,11 @@ static int socfpga_gen5_set_phy_mode(struct socfpga_dwmac 
*dwmac)
 static int socfpga_gen10_set_phy_mode(struct socfpga_dwmac *dwmac)
 {
struct regmap *sys_mgr_base_addr = dwmac->sys_mgr_base_addr;
-   int phymode = dwmac->interface;
u32 reg_offset = dwmac->reg_offset;
u32 reg_shift = dwmac->reg_shift;
u32 ctrl, val, module;
 
-   if (socfpga_set_phy_mode_common(phymode, ))
+   if (socfpga_set_phy_mode_common(dwmac, ))
return -EINVAL;
 
/* Overwrite val to GMII if splitter core is enabled. The phymode here
-- 
2.20.1