Commit Graph

18 Commits (8f3b176e8654f19f8b545ceaad08423a1214b667)

Author SHA1 Message Date
INAGAKI Hiroshi 8f3b176e86 kernel: rtl8367b: fix external interface modes
The interface mode number of RGMII_33V is 7 on RTL8367, but it's 9 on
RTL8367B.

the external interface modes for RTL8367 are follows:

- 0, Disabled
- 1, RGMII
- 2, MII_MAC
- 3, MII_PHY
- 4, TMII_MAC
- 5, TMII_PHY
- 6, GMII
- 7, RGMII_33V

the external interface modes for RTL8367B are follows:

- 0, Disabled
- 1, RGMII
- 2, MII_MAC
- 3, MII_PHY
- 4, TMII_MAC
- 5, TMII_PHY
- 6, GMII
- 7, RMII_MAC
- 8, RMII_PHY
- 9, RGMII_33V

But the driver in U-Boot of RT-N56U GPL tar blocks using RGMII_33V (9)
mode and it seems to be unsupported on RTL8367B, so drop it from
switch-case in rtl8367b_extif_set_mode.

ref (RTL8367):

- TL-WR2453ND v1

ref (RTL8367B):

- ASUS RT-N56U
- TP-Link Archer C2 v1

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
4 years ago
INAGAKI Hiroshi 817e132332 kernel: rtl8367b: use id as a bit offset for BYPASS_LINE_RATE
In RTL8367B (RTL8367RB/RTL8367R-VB), the driver in GPL tars of the
devices with this switch directly uses the ID of external interface
as a bit offset.

We should use the same way.

ref (RTL8367B):
  - ASUS RT-N56U
  - TP-Link Archer C2 v1

ref (RTL8367):
  - TP-Link TL-WR2543ND v1

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
4 years ago
INAGAKI Hiroshi e714cf4195 kernel: rtl8367b: fix DEBUG register address for extif2
RTL8367B_CHIP_DEBUG1_REG (0x1304) is for external interface 1. For
external interface 2, use RTL8367B_CHIP_DEBUG2_REG (0x13e2) instead.

Fixes: 9801d61c4a ("kernel: rtl8367b: add configuration for extif2")
Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
4 years ago
Serge Vasilugin 9801d61c4a kernel: rtl8367b: add configuration for extif2
Both rtl8367b and rtl8367s have two extended interface
rtl8367rb: 5 port + 2*RGMII/MII
rtl8367s:  5 port + SGMII/HSGMI + RGMII/MII
(?)rtl8367sb:  5 port + 2*RGMII/MII
These interfaces correspond to EXT1 and EXT2 (ports 6 and 7 respectivly).

This patch allow to configure EXT2 in dts-file:

	rtl8367rb {
		compatible = "realtek,rtl8367b";
		cpu_port = <7>;
		realtek,extif2 = <1 0 1 1 1 1 1 1 2>;
		mii-bus = <&mdio0>;
		phy_id = <29>;
	};

Signed-off-by: Serge Vasilugin <vasilugin@yandex.ru>
[fix indent, replace magic value, alter commit message]
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
4 years ago
Chuanhong Guo c0bc706c31 generic: rtl8367b: add definition of debug reg
This commit adds definition of DEBUG0 and DEBUG1 registers and replace
magic values with proper register modifying.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
4 years ago
Christian Lamparter a9839fe638 generic: rtl8367b: make it possible to specify cpu_port via DT
This patch adds the feature to parse the existing cpu_port DT
property, which is used to specify which port is the cpu port
of the switch.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter 910c2f9e68 generic: rtl836x: support defered probe on mdio-bus
On the WNDAP620, the mdio and mdc lines are controlled by
the EMAC ethernet device. This results in a hen-vs-egg problem.
The rtl8367b driver is probed before the ethernet driver and
the mdio-bus is not available yet, which caused the rtl8367b
driver to fail.

This patch changes the rtl8366_smi_probe_of() function to
return -EPROBE_DEFER if the mdio-bus lookup failed and changes
rtl8366_smi_probe()'s signature to return the error code back to
the callee, so it can propagate back to the kernel. Which, will
retry the switch probe at a later time.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Mathias Kresin f9e7f19334 kernel: rtl8367b: drop redundant compatible
Remove the compatible without vendor prefix. It is formal wrong and not
used in the tree.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Thibaut VARENE 0369e35891 generic: provide get_port_stats() on rtl836x switches
This patch provides a generic switch_dev_ops 'get_port_stats()' callback by
taping into the relevant port MIB counters.

This callback is used by swconfig_leds led trigger to blink LEDs with port
network traffic.

Signed-off-by: Thibaut VARENE <hacks@slashdirt.org>
7 years ago
Mathias Kresin 369317ce48 kernel: rtl8367(b): fix build error
Fix build on targets not using CONFIG_MODULE_STRIPPED.

Neither RTL8367_DRIVER_DESC nor RTL8367B_DRIVER_DESC are defined
anywhere. It worked for targets using CONFIG_MODULE_STRIPPED since our
module stripper no-ops the various module info macros.

Signed-off-by: Mathias Kresin <dev@kresin.me>
8 years ago
Gabor Juhos 747b795b56 generic: rtl8367: add compatible string with vendor prefix
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 36230
11 years ago
Gabor Juhos f5d8d80ca9 generic: rtl8367b: fix rtl8367b_extif_init_of
* disable external interface if its property is not present
* show an error message if the extif property is not valid
* use proper error values intead of -1
* fix memory leak
* wrap long lines

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 36229
11 years ago
John Crispin 1105bd2897 add OF support to rtl8367b driver
Signed-off-by: John Crispin <blogic@openwrt.org>

SVN-Revision: 36159
11 years ago
Hauke Mehrtens 721bf97863 kernel: remove __devinit, __devexit and __devexit_p for kernel 3.8
These attributes where removed with kernel 3.8 and are now causing compile errors.

SVN-Revision: 35328
11 years ago
Gabor Juhos d153bdbba9 generic: rtl836x: fix compiler warnings
CC      drivers/net/phy/rtl8366rb.o
In file included from drivers/net/phy/rtl8366s.c:16:0:
include/linux/of_platform.h:106:13: warning: 'struct device' declared inside parameter list [enabled by default]
include/linux/of_platform.h:106:13: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
drivers/net/phy/rtl8366s.c: In function 'rtl8366s_probe':
drivers/net/phy/rtl8366s.c:1094:2: warning: label 'err_out' defined but not used [-Wunused-label]
drivers/net/phy/rtl8366s.c:1055:32: warning: unused variable 'pdata'[-Wunused-variable]
  CC      drivers/net/phy/rtl8366rb.o
In file included from drivers/net/phy/rtl8366rb.c:17:0:
include/linux/of_platform.h:106:13: warning: 'struct device' declared inside parameter list [enabled by default]
include/linux/of_platform.h:106:13: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
drivers/net/phy/rtl8366rb.c: In function 'rtl8366rb_probe':
drivers/net/phy/rtl8366rb.c:1214:2: warning: label 'err_out' defined but not used [-Wunused-label]
drivers/net/phy/rtl8366rb.c:1175:32: warning: unused variable 'pdata'[-Wunused-variable]
  CC      drivers/net/phy/rtl8367.o
In file included from drivers/net/phy/rtl8367.c:15:0:
include/linux/of_platform.h:106:13: warning: 'struct device' declared inside parameter list [enabled by default]
include/linux/of_platform.h:106:13: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
drivers/net/phy/rtl8367.c: In function 'rtl8367_probe':
drivers/net/phy/rtl8367.c:1712:2: warning: label 'err_out' defined but not used [-Wunused-label]
drivers/net/phy/rtl8367.c:1677:32: warning: unused variable 'pdata' [-Wunused-variable]
  CC      drivers/net/phy/rtl8367b.o
In file included from drivers/net/phy/rtl8367b.c:15:0:
include/linux/of_platform.h:106:13: warning: 'struct device' declared inside parameter list [enabled by default]
include/linux/of_platform.h:106:13: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
drivers/net/phy/rtl8367b.c: In function 'rtl8367b_probe':
drivers/net/phy/rtl8367b.c:1494:2: warning: label 'err_out' defined but not used [-Wunused-label]
drivers/net/phy/rtl8367b.c:1459:32: warning: unused variable 'pdata' [-Wunused-variable]

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 34731
12 years ago
Jonas Gorski eba8cccd88 linux: generic: rtl836*: fix compilation with !CONFIG_OF
fixes the following errors caused by r34682:

  CC [M]  drivers/net/phy/rtl8366_smi.o
In file included from drivers/net/phy/rtl8366_smi.c:26:0:
drivers/net/phy/rtl8366_smi.h:149:46: warning: 'struct platform_device' declared inside parameter list [enabled by default]
drivers/net/phy/rtl8366_smi.h:149:46: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
drivers/net/phy/rtl8366_smi.c:1398:65: warning: 'struct platform_device' declared inside parameter list [enabled by default]
drivers/net/phy/rtl8366_smi.c: In function 'rtl8366_smi_probe_plat':
drivers/net/phy/rtl8366_smi.c:1400:44: error: dereferencing pointer to incomplete type
drivers/net/phy/rtl8366_smi.c:1402:11: error: dereferencing pointer to incomplete type
drivers/net/phy/rtl8366_smi.c:1403:16: error: dereferencing pointer to incomplete type
drivers/net/phy/rtl8366_smi.c: At top level:
drivers/net/phy/rtl8366_smi.c:1415:46: warning: 'struct platform_device' declared inside parameter list [enabled by default]
drivers/net/phy/rtl8366_smi.c:1415:21: error: conflicting types for 'rtl8366_smi_probe'
drivers/net/phy/rtl8366_smi.h:149:21: note: previous declaration of 'rtl8366_smi_probe' was here
drivers/net/phy/rtl8366_smi.c: In function 'rtl8366_smi_probe':
drivers/net/phy/rtl8366_smi.c:1420:31: error: dereferencing pointer to incomplete type
drivers/net/phy/rtl8366_smi.c:1424:10: error: dereferencing pointer to incomplete type
drivers/net/phy/rtl8366_smi.c:1425:3: warning: passing argument 1 of 'rtl8366_smi_probe_of' from incompatible pointer type [enabled by default]
drivers/net/phy/rtl8366_smi.c:1392:19: note: expected 'struct device_node *' but argument is of type 'struct platform_device *'
drivers/net/phy/rtl8366_smi.c:1427:3: warning: passing argument 1 of 'rtl8366_smi_probe_plat' from incompatible pointer type [enabled by default]
drivers/net/phy/rtl8366_smi.c:1398:5: note: expected 'struct platform_device *' but argument is of type 'struct platform_device *'
drivers/net/phy/rtl8366_smi.c: At top level:
drivers/net/phy/rtl8366_smi.c:1438:1: error: conflicting types for 'rtl8366_smi_probe'
drivers/net/phy/rtl8366_smi.h:149:21: note: previous declaration of 'rtl8366_smi_probe' was here
make[7]: *** [drivers/net/phy/rtl8366_smi.o] Error 1
make[6]: *** [drivers/net/phy] Error 2
make[5]: *** [drivers/net] Error 2
make[4]: *** [drivers] Error 2

Signed-off-by: Jonas Gorski <jogo@openwrt.org>

SVN-Revision: 34703
12 years ago
John Crispin d8678644f9 make rtl8366 driver OF capable
SVN-Revision: 34682
12 years ago
Gabor Juhos 0045449b1b generic: add driver for the the RTL8367R{B,-VB} switches
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 33839
12 years ago