diff mbox

[LEDE-DEV] kernel: b53: enable port 5 on BCM53125

Message ID 1471358878-28114-1-git-send-email-zajec5@gmail.com
State Changes Requested
Delegated to: Rafał Miłecki
Headers show

Commit Message

Rafał Miłecki Aug. 16, 2016, 2:47 p.m. UTC
From: Rafał Miłecki <rafal@milecki.pl>

On all devices suppored so far BCM53125 got port 8 connected to the SoC
interface and ports 0-4 to physical ports. On BCM53573 there is slightly
more comlex setup. We have 2 SoC interfaces: one (eth0) connected to
port 8 and another (eth1) connected to port 5. This change allows using
port 5 to fully support such case. It also enables port 8 by default
which would be added during init anyway.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 target/linux/generic/files/drivers/net/phy/b53/b53_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jonas Gorski Aug. 17, 2016, 10:28 a.m. UTC | #1
Hi,

On 16 August 2016 at 16:47, Rafał Miłecki <zajec5@gmail.com> wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
>
> On all devices suppored so far BCM53125 got port 8 connected to the SoC
> interface and ports 0-4 to physical ports. On BCM53573 there is slightly
> more comlex setup. We have 2 SoC interfaces: one (eth0) connected to
> port 8 and another (eth1) connected to port 5. This change allows using
> port 5 to fully support such case. It also enables port 8 by default
> which would be added during init anyway.
>
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
>  target/linux/generic/files/drivers/net/phy/b53/b53_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
> index d96d8b8..1a1be82 100644
> --- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
> +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
> @@ -1206,7 +1206,7 @@ static const struct b53_chip_data b53_switch_chips[] = {
>                 .dev_name = "BCM53125",
>                 .alias = "bcm53125",
>                 .vlans = 4096,
> -               .enabled_ports = 0x1f,
> +               .enabled_ports = 0x13f,

is there maybe some way of autodetecting this? maybe check if the
appropriate port override registers are set or so? Maybe we can use
the strap bus register for that?

>                 .cpu_port = B53_CPU_PORT,
>                 .vta_regs = B53_VTA_REGS,
>                 .duplex_reg = B53_DUPLEX_STAT_GE,
> --

Jonas
Rafał Miłecki Aug. 18, 2016, 6:06 a.m. UTC | #2
On 17 August 2016 at 12:28, Jonas Gorski <jonas.gorski@gmail.com> wrote:
> On 16 August 2016 at 16:47, Rafał Miłecki <zajec5@gmail.com> wrote:
>> From: Rafał Miłecki <rafal@milecki.pl>
>>
>> On all devices suppored so far BCM53125 got port 8 connected to the SoC
>> interface and ports 0-4 to physical ports. On BCM53573 there is slightly
>> more comlex setup. We have 2 SoC interfaces: one (eth0) connected to
>> port 8 and another (eth1) connected to port 5. This change allows using
>> port 5 to fully support such case. It also enables port 8 by default
>> which would be added during init anyway.
>>
>> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
>> ---
>>  target/linux/generic/files/drivers/net/phy/b53/b53_common.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
>> index d96d8b8..1a1be82 100644
>> --- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
>> +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
>> @@ -1206,7 +1206,7 @@ static const struct b53_chip_data b53_switch_chips[] = {
>>                 .dev_name = "BCM53125",
>>                 .alias = "bcm53125",
>>                 .vlans = 4096,
>> -               .enabled_ports = 0x1f,
>> +               .enabled_ports = 0x13f,
>
> is there maybe some way of autodetecting this? maybe check if the
> appropriate port override registers are set or so? Maybe we can use
> the strap bus register for that?

In BCM53573 the initial state of B53_GMII_PORT_OVERRIDE_CTRL(5) is
0x0b (GMII_PO_LINK | GMII_PO_FULL_DUPLEX | GMII_PO_SPEED_100M). It
doesn't have GMII_PO_EN set, so we can't use this register to check if
port 5 is used/connected to some interface.
I just checked my old BCM4706 with BCM53125 and it has initial value
of above register equal to 0x0b as well.

As we talked yesterday, B53_STRAP_VALUE register contains value
0x000000180f2c so it doesn't have SV_GMII_CTRL_115 set. On the other
hand my BCM4706 with BCM53125 has B53_STRAP_VALUE: equal to
0x00000002be2c so there are some differences. Any idea what these
other bits may mean?
Florian Fainelli Aug. 20, 2016, 7:21 p.m. UTC | #3
Le 17/08/2016 à 23:06, Rafał Miłecki a écrit :
> On 17 August 2016 at 12:28, Jonas Gorski <jonas.gorski@gmail.com> wrote:
>> On 16 August 2016 at 16:47, Rafał Miłecki <zajec5@gmail.com> wrote:
>>> From: Rafał Miłecki <rafal@milecki.pl>
>>>
>>> On all devices suppored so far BCM53125 got port 8 connected to the SoC
>>> interface and ports 0-4 to physical ports. On BCM53573 there is slightly
>>> more comlex setup. We have 2 SoC interfaces: one (eth0) connected to
>>> port 8 and another (eth1) connected to port 5. This change allows using
>>> port 5 to fully support such case. It also enables port 8 by default
>>> which would be added during init anyway.
>>>
>>> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
>>> ---
>>>  target/linux/generic/files/drivers/net/phy/b53/b53_common.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
>>> index d96d8b8..1a1be82 100644
>>> --- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
>>> +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
>>> @@ -1206,7 +1206,7 @@ static const struct b53_chip_data b53_switch_chips[] = {
>>>                 .dev_name = "BCM53125",
>>>                 .alias = "bcm53125",
>>>                 .vlans = 4096,
>>> -               .enabled_ports = 0x1f,
>>> +               .enabled_ports = 0x13f,
>>
>> is there maybe some way of autodetecting this? maybe check if the
>> appropriate port override registers are set or so? Maybe we can use
>> the strap bus register for that?
> 
> In BCM53573 the initial state of B53_GMII_PORT_OVERRIDE_CTRL(5) is
> 0x0b (GMII_PO_LINK | GMII_PO_FULL_DUPLEX | GMII_PO_SPEED_100M). It
> doesn't have GMII_PO_EN set, so we can't use this register to check if
> port 5 is used/connected to some interface.

Using this technique is not quite reliable since you basically depend on
the bootloader having configured this properly for you which may not be
the case at all.

> I just checked my old BCM4706 with BCM53125 and it has initial value
> of above register equal to 0x0b as well.
> 
> As we talked yesterday, B53_STRAP_VALUE register contains value
> 0x000000180f2c so it doesn't have SV_GMII_CTRL_115 set. On the other
> hand my BCM4706 with BCM53125 has B53_STRAP_VALUE: equal to
> 0x00000002be2c so there are some differences. Any idea what these
> other bits may mean?

AFAICT this register is not defined for the 53125 so you are reading
undefined values here.

You could try to read the WAN_PORT_MAP in 0x00, 0x26 (16 bits) and see
if it's already configured for Port 5 which would indicate that Port 5
is configured as WAN, thus usable.
Jonas Gorski Aug. 26, 2016, 10:04 a.m. UTC | #4
On 20 August 2016 at 21:21, Florian Fainelli <f.fainelli@gmail.com> wrote:
> Le 17/08/2016 à 23:06, Rafał Miłecki a écrit :
>> On 17 August 2016 at 12:28, Jonas Gorski <jonas.gorski@gmail.com> wrote:
>>> On 16 August 2016 at 16:47, Rafał Miłecki <zajec5@gmail.com> wrote:
>>>> From: Rafał Miłecki <rafal@milecki.pl>
>>>>
>>>> On all devices suppored so far BCM53125 got port 8 connected to the SoC
>>>> interface and ports 0-4 to physical ports. On BCM53573 there is slightly
>>>> more comlex setup. We have 2 SoC interfaces: one (eth0) connected to
>>>> port 8 and another (eth1) connected to port 5. This change allows using
>>>> port 5 to fully support such case. It also enables port 8 by default
>>>> which would be added during init anyway.
>>>>
>>>> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
>>>> ---
>>>>  target/linux/generic/files/drivers/net/phy/b53/b53_common.c | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
>>>> index d96d8b8..1a1be82 100644
>>>> --- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
>>>> +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
>>>> @@ -1206,7 +1206,7 @@ static const struct b53_chip_data b53_switch_chips[] = {
>>>>                 .dev_name = "BCM53125",
>>>>                 .alias = "bcm53125",
>>>>                 .vlans = 4096,
>>>> -               .enabled_ports = 0x1f,
>>>> +               .enabled_ports = 0x13f,
>>>
>>> is there maybe some way of autodetecting this? maybe check if the
>>> appropriate port override registers are set or so? Maybe we can use
>>> the strap bus register for that?
>>
>> In BCM53573 the initial state of B53_GMII_PORT_OVERRIDE_CTRL(5) is
>> 0x0b (GMII_PO_LINK | GMII_PO_FULL_DUPLEX | GMII_PO_SPEED_100M). It
>> doesn't have GMII_PO_EN set, so we can't use this register to check if
>> port 5 is used/connected to some interface.
>
> Using this technique is not quite reliable since you basically depend on
> the bootloader having configured this properly for you which may not be
> the case at all.
>
>> I just checked my old BCM4706 with BCM53125 and it has initial value
>> of above register equal to 0x0b as well.
>>
>> As we talked yesterday, B53_STRAP_VALUE register contains value
>> 0x000000180f2c so it doesn't have SV_GMII_CTRL_115 set. On the other
>> hand my BCM4706 with BCM53125 has B53_STRAP_VALUE: equal to
>> 0x00000002be2c so there are some differences. Any idea what these
>> other bits may mean?
>
> AFAICT this register is not defined for the 53125 so you are reading
> undefined values here.
>
> You could try to read the WAN_PORT_MAP in 0x00, 0x26 (16 bits) and see
> if it's already configured for Port 5 which would indicate that Port 5
> is configured as WAN, thus usable.

But will this tell us if is also configured to use the IMP port?

Regardless of that, depending on how you register the switch we could
pass platform data to b53 - b53 already allows overriding the port
mask from the platform data, so you could then just pass 0x13f as the
port mask. The phy driver would just need updating to detect and use
the platform data.


Jonas
diff mbox

Patch

diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
index d96d8b8..1a1be82 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
@@ -1206,7 +1206,7 @@  static const struct b53_chip_data b53_switch_chips[] = {
 		.dev_name = "BCM53125",
 		.alias = "bcm53125",
 		.vlans = 4096,
-		.enabled_ports = 0x1f,
+		.enabled_ports = 0x13f,
 		.cpu_port = B53_CPU_PORT,
 		.vta_regs = B53_VTA_REGS,
 		.duplex_reg = B53_DUPLEX_STAT_GE,