Modify

Opened 8 years ago

Closed 7 years ago

Last modified 4 years ago

#6326 closed defect (fixed)

Livebox eth1 doesn't work

Reported by: danitool Owned by: florian
Priority: normal Milestone: Barrier Breaker 14.07
Component: kernel Version: Trunk
Keywords: livebox ethernet Cc: dgcbueu@…

Description

Inventel livebox bcm6348 seems to have a problem with AC101L external Phy, not detected or activated, eth1 (red port) is up when kamikaze starts but it does not transmit or receive data, and it doesn't detect when ethernet cable is plugged or unplugged. Only eth0 works.

Attachments (1)

board_liveboxnew.diff (4.4 KB) - added by danitool <dgcbueu@…> 7 years ago.

Download all attachments as: .zip

Change History (31)

comment:1 Changed 8 years ago by danitool

mii-tool output:

root@OpenWrt:/# mii-tool eth0
eth0: negotiated 100baseTx-FD, link ok
root@OpenWrt:/# mii-tool eth1
  No MII transceiver present!.

comment:2 Changed 8 years ago by florian

  • Owner changed from developers to florian
  • Status changed from new to assigned

Can you please show me the output of ethtool eth1? I would like to check the PHY address settings.

comment:3 Changed 8 years ago by danitool

root@OpenWrt:/# ethtool eth1
Settings for eth1:
        Supported ports: [ ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Supports auto-negotiation: No
        Advertised link modes:  Not reported
        Advertised auto-negotiation: No
        Speed: 100Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 0
        Transceiver: external
        Auto-negotiation: off
        Link detected: yes

comment:4 Changed 8 years ago by florian

I am not sure this is the right PHY address for that particular setup. Could you change it in the driver from 0 to 31 and see if you have better results?

comment:5 Changed 8 years ago by danitool

How do I change in the driver the PHY address?

I did:

root@OpenWrt:/# ethtool -s eth1 phyad 31

but it changes nothing

comment:6 Changed 8 years ago by florian

You have to modify the bcm63xx_enet.c driver to change the PHY address and try different a one. Additionnaly, you might want to check that vlans are or are not configured on this interface.

comment:7 Changed 8 years ago by florian

Ping! Have you tried changing eth1's PHY address?

comment:8 Changed 8 years ago by dgcbueu@…

What do i need to modify in that file bcm63xx_enet.c?

804	if (priv->has_phy) {
805		/* connect to PHY */
806		snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT,
807			 priv->mac_id ? "1" : "0", priv->phy_id);
808
809		phydev = phy_connect(dev, phy_id, &bcm_enet_adjust_phy_link, 0,
810				     PHY_INTERFACE_MODE_MII);

do i need to change in line 807 something, 0 to 31 for example??

comment:9 Changed 8 years ago by florian

Can you try after r20765 and see if that helps?

comment:10 Changed 8 years ago by danitool <dgcbueu@…>

It didn't work, i tried r20765 and latest trunk.
No ping and no activity when i plug/unplug eth1

root@OpenWrt:/# ethtool eth1
Settings for eth1:
        Supported ports: [ ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Supports auto-negotiation: No
        Advertised link modes:  Not reported
        Advertised auto-negotiation: No
        Speed: 100Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 0
        Transceiver: external
        Auto-negotiation: off
        Link detected: yes

root@OpenWrt:/# ethtool eth0
Settings for eth0:
        Supported ports: [ MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Advertised auto-negotiation: Yes
        Speed: 100Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 1
        Transceiver: external
        Auto-negotiation: on
        Link detected: yes
root@OpenWrt:/# mii-tool eth0
eth0: negotiated 100baseTx-FD, link ok
root@OpenWrt:/# mii-tool eth1
  No MII transceiver present!.

comment:11 Changed 8 years ago by danitool <dgcbueu@…>

This is a piece of log from the original firmware running the livebox where eth1 works

Using /lib/modules/2.4.17/kernel/modulesrc/drivers/net/enet/impl2/bcm_enet.o
Resetting DSP and 2nd eth ..
GPIOio : 0xe9ffffc1
GPIOio : 0xe9fff180
bcm6348enet: bcmenet_module_init
bcm6348enet: bcm6348_net_probe
EnetInfo[1].ucPhyType = 3
EnetInfo[1].ucPhyAddress = 31
Broadcom BCM6348B0 Ethernet Network Device v0.1 Internal PHY
bcm6348enet: bcm6348_init_dev
bcm6348enet: init_buffers
bcm6348enet: init_dma
bcm6348enet: init_emac
mii_AutoConfigure
BMCR : 0x3000
BMCR : 0x3100
mii_GetConfig
BCM6348_ENET: Auto-negotiation timed-out
BCM6348_ENET: 10 MB Half-Duplex (assumed)
eth0: MAC Address: 00:07:3A:FF:FF:FF
Broadcom BCM6348B0 Ethernet Network Device v0.1 External PHY
bcm6348enet: bcm6348_init_dev
bcm6348enet: init_buffers
bcm6348enet: init_dma
bcm6348enet: init_emac
BMCR : 0x3000
BMCR : 0x3100
BCM6348_ENETMAC2 : AutoConfiguration Start 
mii_AutoConfigure
BMCR : 0x3100
BMCR : 0x3100
mii_GetConfig
BCM6348_ENET MAC2 : 100 MB Full-Duplex (auto-neg)
BCM6348_ENET MAC2 : Configuring for FULL DPLX
eMiiConfig : 0x0007

comment:12 Changed 8 years ago by anonymous

i have a bcm6348 with altima AC101L
would it help knowing -
gpio pin on phy chip
8 45 RXD3/PHYAD1
9 46 RXD2/PHYAD2
10 47 RXD1/PHYAD3
11 48 RXD0/PHYAD4
13 11 TXD0
13 12 TXD1
14 13 TXD2
15 14 TXD3

comment:13 Changed 8 years ago by anonymous

gpio		pin on phy chip
8			45 RXD3/PHYAD1	
9			46 RXD2/PHYAD2
10			47 RXD1/PHYAD3
11			48 RXD0/PHYAD4
13			11 TXD0
13			12 TXD1
14			13 TXD2
15			14 TXD3

comment:14 follow-up: Changed 8 years ago by anonymous

its ok. i figured out i have to set gpio 6 on (RST_L pin 42 on phy chip)
maybe its similar for livebox.

comment:15 Changed 8 years ago by florian

Probably, though the code also needs to be adapter to probe for PHY chips at an address different than 1 like it does currently.

Changed 7 years ago by danitool <dgcbueu@…>

comment:16 in reply to: ↑ 14 Changed 7 years ago by danitool <dgcbueu@…>

Replying to anonymous:

its ok. i figured out i have to set gpio 6 on (RST_L pin 42 on phy chip)
maybe its similar for livebox.

I probed it, and it works, thanks very much.
I added the code to set gpio 6 on in the archive board_livebox.c. Also I merged some code from board_bcm963xx.c to make a more complete work, but it is still a draft. I added gpio leds and eth1 as a led too.

+		/*workaround to fix eth1*/
+				{
+			.name		= "eth1",
+			.gpio		= 6,
+			.active_low	= 1,
+		},

I don't know where is the original board_livebox.c in the trunk tree, so i just made the patch to generate board_liveboxnew.c.
https://dev.openwrt.org/attachment/ticket/6326/board_liveboxnew.diff
Thanks.

comment:17 Changed 7 years ago by danitool <dgcbueu@…>

Well i was reading some stuff from the inventel's redboot:

  0x1000007F, // GPIO_00->GPIO_05 LED_00->LED_05 : OUT
              // GPIO_06 LED_06 or DSP_RST_N : OUT
              // GPIO_07 PAGE_BUTTON : IN
              // GPIO_08->GPIO_15 MII BLK : IN
              // GPIO_16->GPIO_27 PCI PCCARD BLK : IN
              // GPIO_28 BT_DECT_RST : OUT
              // GPIO_29->31 SPI BLK : IN
  0x00000000, // GPIO_32 MII BLK : IN
              // GPIO_33 BT_INT : IN
              // GPIO_34 DECT_INT : IN
              // GPIO_35 DSP_INT : IN
              // GPIO_36 ASSOCIATION_BUTTON : IN

The gpio 6 has some relation with eth1 and dsp then i changed the code in the livebox.c file to enable dsp but without the previous eth1 fix.

	.has_dsp			= 1,
	.dsp = {
		.gpio_rst		= 6,
		.gpio_int		= 35,
		.cs			= 2,
		.ext_irq		= 2,
	},

and built openwrt, falshed the device and eth1 works, maybe this has more logic. But i don't know which is the purpose of dsp, how it works, and if this is really useful.

So, how can I configure dsp correctly, if not already did it, and which is the relation with eth1?

comment:18 Changed 7 years ago by florian

There is no VoIP DSP driver working for your board yet. I suppose that the GPIO line is shared between the VoIP DSP and the Ethernet chip.

comment:19 Changed 7 years ago by danitool <dgcbueu@…>

I was playing again with the configuration of the board, now i have set:

	.enet1 = {
		.has_phy		= 1,
		.phy_id 		= 31,
	},

rather than forcing eth1, which have more sense because now the link is detected when I plug the ethernet cable, not like before with forced configuration and always up.

this is some log from dmesg

..................
[    8.539062] bcm63xx_enet bcm63xx_enet.1: attached PHY at address 31 [Generic PHY]
[   17.226562] mini_fo: using base directory: /
[   17.234375] mini_fo: using storage directory: /overlay
[   27.257812] bcm63xx_enet bcm63xx_enet.0: attached PHY at address 1 [Broadcom BCM63XX (1)]
[   28.664062] device eth0 entered promiscuous mode
[   29.976562] eth0: link UP - 100/full - flow control off
[   30.007812] br-lan: port 1(eth0) entering forwarding state
[   30.015625] br-lan: port 1(eth0) entering forwarding state
[   31.929687] bcm63xx_enet bcm63xx_enet.1: attached PHY at address 31 [Generic PHY]
[   32.843750] device eth1 entered promiscuous mode
...........

eth1 works and has the phy address 31 (it doesn't work if gpio 6 wasn't previously on).
This seems the right configuration

But now the negligible problem is the link is detected as

[  559.695312] eth1: link UP - 100/half - flow control off

But if reset the gpio 6 again

gpioctl clear 6
gpioctl set 6

now the link is detected as full duplex, and remains in this right status even if I unplug and plug again the ethernet cable.

comment:20 Changed 7 years ago by danitool <dgcbueu@…>

Now I have the perfect configuration I think, eth1 works and correctly detected.

Openwrt started, and when I plug for the first time the ethernet cable

eth1: link UP - 100/full - flow control off

Ok, this is the correct behavior. And now the info which ethtool returns. I started the ticket looking for this.

root@OpenWrt:/# ethtool eth1
Settings for eth1:
        Supported ports: [ MII ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Speed: 100Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 31
        Transceiver: external
        Auto-negotiation: on
        Link detected: yes

root@OpenWrt:/# mii-tool 
eth0: no link
eth1: negotiated 100baseTx-FD, link ok

Then, the job is done in a correct way.

The problem was:

the dsp (puts the gpio6 "on" which activates eth1 external phy) needs to be registered before the ethernet 1,

Then the problem is the order of registering devices. Thus, the code needs to have the correct order:

+	if (board.has_dsp)
+		bcm63xx_dsp_register(&board.dsp);
+
+	if (board.has_enet1 &&
+	    !board_get_mac_address(board.enet1.mac_addr))
+		bcm63xx_enet_register(1, &board.enet1);

Always dsp before ethernet.

comment:21 follow-up: Changed 7 years ago by florian

Or you can simply toggle the gpio manually using the following code snippet:

int ret;

ret = gpio_request(6, "dsp_eth_rst");
if (ret)
      return ret;

gpio_direction_output(6);
gpio_set_value(6, 0);

That should do it.

comment:22 Changed 7 years ago by danitool <dgcbueu@…>

I would be better, I will try it.

comment:23 Changed 7 years ago by danitool <dgcbueu@…>

It would be better, I will try it. *

comment:24 in reply to: ↑ 21 Changed 7 years ago by danitool <dgcbueu@…>

Replying to florian:

Or you can simply toggle the gpio manually using the following code snippet:

int ret;

ret = gpio_request(6, "dsp_eth_rst");
if (ret)
      return ret;

gpio_direction_output(6);
gpio_set_value(6, 0);

That should do it.

how do I instert this code?, I'm totally a newbie

comment:25 Changed 7 years ago by danitool <dgcbueu@…>

Is this right?

@@ -52,8 +52,8 @@
 	},
 
 	.enet1 = {
-		.force_speed_100	= 1,
-		.force_duplex_full	= 1,
+		.has_phy		= 1,
+		.phy_id 		= 31,
 	},
 
 	.has_ohci0			= 1,
@@ -172,6 +172,13 @@
 	return 0;
 }
 
+static void do_gpio6_reset(void)
+{
+	gpio_request(6, "dsp_eth_rst");
+	gpio_direction_output(6, 0);
+	gpio_set_value(6, 1);
+}
+
 static struct resource mtd_resources[] = {
 	{
 		.start          = 0,    /* filled at runtime */
@@ -206,6 +213,8 @@
 
 	if (board.has_enet1 &&
 	    !board_get_mac_address(board.enet1.mac_addr))
+	  	printk(KERN_INFO PFX "resetting gpio6 for eth1\n");
+		do_gpio6_reset();
 		bcm63xx_enet_register(1, &board.enet1);
 
 	if (board.has_ohci0)

well at least it works

comment:26 Changed 7 years ago by florian

That's correct yes.

comment:27 Changed 7 years ago by florian

Does this small code snippet works for you?

comment:28 Changed 7 years ago by danitool <dgcbueu@…>

Yes, this works for me

@@ -52,8 +52,8 @@
 	},
 
 	.enet1 = {
-		.force_speed_100	= 1,
-		.force_duplex_full	= 1,
+		.has_phy		= 1,
+		.phy_id 		= 31,
 	},
 
 	.has_ohci0			= 1,
@@ -172,6 +172,13 @@
 	return 0;
 }
 
+static void do_gpio6_reset(void)
+{
+	gpio_request(6, "dsp_eth_rst");
+	gpio_direction_output(6, 0);
+	gpio_set_value(6, 1);
+}
+
 static struct resource mtd_resources[] = {
 	{
 		.start          = 0,    /* filled at runtime */
@@ -206,6 +213,8 @@
 
 	if (board.has_enet1 &&
 	    !board_get_mac_address(board.enet1.mac_addr))
+	  	printk(KERN_INFO PFX "resetting gpio6 for eth1\n");
+		do_gpio6_reset();
 		bcm63xx_enet_register(1, &board.enet1);
 
 	if (board.has_ohci0)

comment:29 Changed 7 years ago by florian

  • Resolution set to fixed
  • Status changed from accepted to closed

Superseeded by #8677

comment:30 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.