net: macb: Add option and clock support
v2 cover net: macb: Add option and clock support
The CONFIG_MACB option is added in KConfig to be used to select the Cadence MACB Ethernet driver, and the clock is supported.
Changes in v2:
- Use positive logic, #ifdef...#else...#endif.
- Remove unnecessary splitting the signature of macb_mdc_clk_div() and others.
- Add Acked-by tag.
Wenyou Yang (3):
net: Kconfig: Add CONFIG_MACB option
net: macb: Add the clock support
net: macb: Remove redundant #ifdef CONFIG_DM_ETH
drivers/net/Kconfig | 10 ++++++++++ drivers/net/macb.c | 44 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 51 insertions(+), 3 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/3 net: Kconfig: Add CONFIG_MACB option
Add CONFIG_MACB option in KConfig to be used to select the Cadence MACB Ethernet driver.
---
Changes in v2: None
drivers/net/Kconfig | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/Kconfig +10 -0
@@ -137,6 +137,16 @@ config MVPP2 This driver supports the network interface units in the Marvell ARMADA 375 SoC. +config MACB + bool "Cadence MACB/GEM Ethernet Interface" + depends on DM_ETH + select PHYLIB + help + The Cadence MACB ethernet interface is found on many Atmel + AT91 and SAMA5 parts. This driver also supports the Cadence + GEM (Gigabit Ethernet MAC) found in some ARM SoC devices. + Say Y to include support for the MACB/GEM chip. + config PCH_GBE bool "Intel Platform Controller Hub EG20T GMAC driver" depends on DM_ETH && DM_PCI
Signature · 1 line
2.7.4
PATCH v2 1/3 net: Kconfig: Add CONFIG_MACB option
Hi Tom,
Quoted 19 lines · Wenyou Yang
Add
CONFIG_MACBoption in KConfig to be used to select the Cadence MACB Ethernet driver.Signed-off-by Wenyou Yang <[email protected]>---
Changes in v2: None
drivers/net/Kconfig | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/net/Kconfig +0
-0@@ -137,6 +137,16 @@ config MVPP2 This driver supports the network interface units in the Marvell ARMADA 375 SoC.
drivers/net/Kconfig config MVPP2 · line 149
Quoted 10 lines
drivers/net/Kconfig +10
-0+config MACB + bool "Cadence MACB/GEM Ethernet Interface" + depends on DM_ETH + select PHYLIB + help + The Cadence MACB ethernet interface is found on many Atmel + AT91 and SAMA5 parts. This driver also supports the Cadence + GEM (Gigabit Ethernet MAC) found in some ARM SoC devices. + Say Y to include support for the MACB/GEM chip. +
I contend that this patch needs to include running moveconfig, but the last time I made that comment, you had some other solution that involved some distro default or something. I'd like to apply this series, but this is blocking it. Please provide guidance.
Thanks,
-Joe
Quoted 10 lines
drivers/net/Kconfig +0
-1config PCH_GBE bool "Intel Platform Controller Hub EG20T GMAC driver" depends on DM_ETH && DM_PCI --2.7.4
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH v2 1/3 net: Kconfig: Add CONFIG_MACB option
Quoted 22 lines · Joe Hershberger
Hi Tom,
Quoted 19 lines · Wenyou Yang
Add
CONFIG_MACBoption in KConfig to be used to select the Cadence MACB Ethernet driver.Signed-off-by Wenyou Yang <[email protected]>---
Changes in v2: None
drivers/net/Kconfig | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/net/Kconfig +0
-0@@ -137,6 +137,16 @@ config MVPP2 This driver supports the network interface units in the Marvell ARMADA 375 SoC.
Quoted 15 lines
drivers/net/Kconfig config MVPP2 · line 149
Quoted 10 lines
drivers/net/Kconfig +10
-0+config MACB + bool "Cadence MACB/GEM Ethernet Interface" + depends on DM_ETH + select PHYLIB + help + The Cadence MACB ethernet interface is found on many Atmel + AT91 and SAMA5 parts. This driver also supports the Cadence + GEM (Gigabit Ethernet MAC) found in some ARM SoC devices. + Say Y to include support for the MACB/GEM chip. +I contend that this patch needs to include running moveconfig, but the last time I made that comment, you had some other solution that involved some distro default or something. I'd like to apply this series, but this is blocking it. Please provide guidance.
OK, this one is small enough that you can fold in doing a moveconfig as part of applying it. My concern is that for more wide ranging options it's a pain to get moveconfig to migrate 100% of the configs and then ensure that there's no binary size changes.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161130/fd314704/attachment.sig>
[U-Boot] net: Kconfig: Add CONFIG_MACB option
In reply to Wenyou YangPATCH v2 2/3 net: macb: Add the clock support
In reply to Wenyou YangDue to introducing the at91 clock driver, add the clock support.
---
Changes in v2:
- Use positive logic, #ifdef...#else...#endif.
- Remove unnecessary splitting the signature of macb_mdc_clk_div() and others.
drivers/net/macb.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
drivers/net/macb.c +41 -0
@@ -4,6 +4,7 @@* SPDX-License-Identifier: GPL-2.0+ */ #include <common.h> +#include <clk.h> #include <dm.h> /*
@@ -112,6 +113,7 @@ struct macb_device {struct mii_dev *bus;#ifdef CONFIG_DM_ETH +unsigned long pclk_rate;phy_interface_t phy_interface;#endif };
@@ -754,7 +756,11 @@ static int _macb_write_hwaddr(struct macb_device *macb, unsigned char *enetaddr)static u32 macb_mdc_clk_div (int id,struct macb_device *macb) {u32 config; +#ifdef CONFIG_DM_ETH +unsigned long macb_hz = macb->pclk_rate; +#else unsigned long macb_hz =get_macb_pclk_rate (id); +#endif if (macb_hz <20000000 ) config =MACB_BF (CLK ,MACB_CLK_DIV8 );
@@ -771,7 +777,12 @@ static u32 macb_mdc_clk_div(int id, struct macb_device *macb)static u32 gem_mdc_clk_div (int id,struct macb_device *macb) {u32 config; + +#ifdef CONFIG_DM_ETH +unsigned long macb_hz = macb->pclk_rate; +#else unsigned long macb_hz =get_macb_pclk_rate (id); +#endif if (macb_hz <20000000 ) config =GEM_BF (CLK ,GEM_CLK_DIV8 );
@@ -991,6 +1002,30 @@ static const struct eth_ops macb_eth_ops = { .write_hwaddr = macb_write_hwaddr, }; +static int macb_enable_clk (struct udevice *dev) +{ +struct macb_device *macb =dev_get_priv (dev); +struct clk clk; +ulong clk_rate; +int ret; + + ret =clk_get_by_index (dev,0 , &clk); +if (ret) +return -EINVAL ; + + ret =clk_enable (&clk); +if (ret) +return ret; + + clk_rate =clk_get_rate (&clk); +if (!clk_rate) +return -EINVAL ; + + macb->pclk_rate = clk_rate; + +return 0 ; +} +static int macb_eth_probe (struct udevice *dev) {struct eth_pdata *pdata =dev_get_platdata (dev);
@@ -998,6 +1033,7 @@ static int macb_eth_probe(struct udevice *dev)#ifdef CONFIG_DM_ETH const char *phy_mode; +int ret; phy_mode =fdt_getprop (gd->fdt_blob, dev->of_offset,"phy-mode" ,NULL );if (phy_mode)
@@ -1010,7 +1046,12 @@ static int macb_eth_probe(struct udevice *dev) macb->regs = (void *)pdata->iobase; + ret =macb_enable_clk (dev); +if (ret) +return ret; +_macb_eth_initialize (macb); +#if defined(CONFIG_CMD_MII ) || defined(CONFIG_PHYLIB )int retval;struct mii_dev *mdiodev =mdio_alloc ();
Signature · 1 line
2.7.4
PATCH v2 2/3 net: macb: Add the clock support
Quoted 3 lines · Wenyou Yang
Due to introducing the at91 clock driver, add the clock support.
Signed-off-by Wenyou Yang <[email protected]>
[U-Boot] net: macb: Add the clock support
In reply to Wenyou YangPATCH v2 3/3 net: macb: Remove redundant #ifdef CONFIG_DM_ETH
In reply to Wenyou YangRemove the redundant #ifdef CONFIG_DM_ETH/#endif.
---
Changes in v2:
- Add Acked-by tag.
drivers/net/macb.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/macb.c +0 -3
@@ -1030,8 +1030,6 @@ static int macb_eth_probe(struct udevice *dev) {struct eth_pdata *pdata =dev_get_platdata (dev);struct macb_device *macb =dev_get_priv (dev); - -#ifdef CONFIG_DM_ETH const char *phy_mode;int ret;
@@ -1042,7 +1040,6 @@ static int macb_eth_probe(struct udevice *dev)debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode);return -EINVAL ; } -#endif macb->regs = (void *)pdata->iobase;
Signature · 1 line
2.7.4
[U-Boot] net: macb: Remove redundant #ifdef CONFIG_DM_ETH