* [PATCH 1/2] bgmac: register fixed PHY for ARM BCM470X / BCM5301X chipsets
@ 2015-03-20 22:14 Rafał Miłecki
2015-03-20 22:14 ` [PATCH 2/2] bgmac: allow enabling on ARCH_BCM_5301X Rafał Miłecki
2015-03-21 1:45 ` [PATCH 1/2] bgmac: register fixed PHY for ARM BCM470X / BCM5301X chipsets David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Rafał Miłecki @ 2015-03-20 22:14 UTC (permalink / raw)
To: David S. Miller, netdev; +Cc: Hauke Mehrtens, Rafał Miłecki
On ARM SoCs with bgmac Ethernet hardware we don't have any normal PHY.
There is always a switch attached but it's not even controlled over MDIO
like in case of MIPS devices.
We need a fixed PHY to be able to send/receive packets from the switch.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
drivers/net/ethernet/broadcom/bgmac.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
index 0469f72..efda7cf 100644
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -14,6 +14,7 @@
#include <linux/etherdevice.h>
#include <linux/mii.h>
#include <linux/phy.h>
+#include <linux/phy_fixed.h>
#include <linux/interrupt.h>
#include <linux/dma-mapping.h>
#include <bcm47xx_nvram.h>
@@ -1330,13 +1331,46 @@ static void bgmac_adjust_link(struct net_device *net_dev)
}
}
+static int bgmac_fixed_phy_register(struct bgmac *bgmac)
+{
+ struct fixed_phy_status fphy_status = {
+ .link = 1,
+ .speed = SPEED_1000,
+ .duplex = DUPLEX_FULL,
+ };
+ struct phy_device *phy_dev;
+ int err;
+
+ phy_dev = fixed_phy_register(PHY_POLL, &fphy_status, NULL);
+ if (!phy_dev || IS_ERR(phy_dev)) {
+ bgmac_err(bgmac, "Failed to register fixed PHY device\n");
+ return -ENODEV;
+ }
+
+ err = phy_connect_direct(bgmac->net_dev, phy_dev, bgmac_adjust_link,
+ PHY_INTERFACE_MODE_MII);
+ if (err) {
+ bgmac_err(bgmac, "Connecting PHY failed\n");
+ return err;
+ }
+
+ bgmac->phy_dev = phy_dev;
+
+ return err;
+}
+
static int bgmac_mii_register(struct bgmac *bgmac)
{
+ struct bcma_chipinfo *ci = &bgmac->core->bus->chipinfo;
struct mii_bus *mii_bus;
struct phy_device *phy_dev;
char bus_id[MII_BUS_ID_SIZE + 3];
int i, err = 0;
+ if (ci->id == BCMA_CHIP_ID_BCM4707 ||
+ ci->id == BCMA_CHIP_ID_BCM53018)
+ return bgmac_fixed_phy_register(bgmac);
+
mii_bus = mdiobus_alloc();
if (!mii_bus)
return -ENOMEM;
--
1.8.4.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] bgmac: allow enabling on ARCH_BCM_5301X
2015-03-20 22:14 [PATCH 1/2] bgmac: register fixed PHY for ARM BCM470X / BCM5301X chipsets Rafał Miłecki
@ 2015-03-20 22:14 ` Rafał Miłecki
2015-03-21 1:45 ` David Miller
2015-03-21 1:45 ` [PATCH 1/2] bgmac: register fixed PHY for ARM BCM470X / BCM5301X chipsets David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Rafał Miłecki @ 2015-03-20 22:14 UTC (permalink / raw)
To: David S. Miller, netdev; +Cc: Hauke Mehrtens, Rafał Miłecki
Home routers based on ARM SoCs like BCM4708 also have bcma bus with core
supported by bgmac.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
drivers/net/ethernet/broadcom/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/Kconfig b/drivers/net/ethernet/broadcom/Kconfig
index ee4fdfe..a6f9142 100644
--- a/drivers/net/ethernet/broadcom/Kconfig
+++ b/drivers/net/ethernet/broadcom/Kconfig
@@ -142,7 +142,7 @@ config BNX2X_SRIOV
config BGMAC
tristate "BCMA bus GBit core support"
- depends on BCMA_HOST_SOC && HAS_DMA && BCM47XX
+ depends on BCMA_HOST_SOC && HAS_DMA && (BCM47XX || ARCH_BCM_5301X)
select PHYLIB
---help---
This driver supports GBit MAC and BCM4706 GBit MAC cores on BCMA bus.
--
1.8.4.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] bgmac: register fixed PHY for ARM BCM470X / BCM5301X chipsets
2015-03-20 22:14 [PATCH 1/2] bgmac: register fixed PHY for ARM BCM470X / BCM5301X chipsets Rafał Miłecki
2015-03-20 22:14 ` [PATCH 2/2] bgmac: allow enabling on ARCH_BCM_5301X Rafał Miłecki
@ 2015-03-21 1:45 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2015-03-21 1:45 UTC (permalink / raw)
To: zajec5; +Cc: netdev, hauke
From: Rafał Miłecki <zajec5@gmail.com>
Date: Fri, 20 Mar 2015 23:14:31 +0100
> On ARM SoCs with bgmac Ethernet hardware we don't have any normal PHY.
> There is always a switch attached but it's not even controlled over MDIO
> like in case of MIPS devices.
> We need a fixed PHY to be able to send/receive packets from the switch.
>
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Applied to net-next.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] bgmac: allow enabling on ARCH_BCM_5301X
2015-03-20 22:14 ` [PATCH 2/2] bgmac: allow enabling on ARCH_BCM_5301X Rafał Miłecki
@ 2015-03-21 1:45 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2015-03-21 1:45 UTC (permalink / raw)
To: zajec5; +Cc: netdev, hauke
From: Rafał Miłecki <zajec5@gmail.com>
Date: Fri, 20 Mar 2015 23:14:32 +0100
> Home routers based on ARM SoCs like BCM4708 also have bcma bus with core
> supported by bgmac.
>
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Also applied to net-next, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-03-21 1:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-20 22:14 [PATCH 1/2] bgmac: register fixed PHY for ARM BCM470X / BCM5301X chipsets Rafał Miłecki
2015-03-20 22:14 ` [PATCH 2/2] bgmac: allow enabling on ARCH_BCM_5301X Rafał Miłecki
2015-03-21 1:45 ` David Miller
2015-03-21 1:45 ` [PATCH 1/2] bgmac: register fixed PHY for ARM BCM470X / BCM5301X chipsets David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).