MT7530 interrupt support
Subsystems (8)
v2 cover MT7530 interrupt support
Add support for MT7530 interrupt controller.
DENG Qingfang (4):
net: phy: add MediaTek PHY driver
net: dsa: mt7530: add interrupt support
dt-bindings: net: dsa: add MT7530 interrupt controller binding
staging: mt7621-dts: enable MT7530 interrupt controller
.../devicetree/bindings/net/dsa/mt7530.txt | 5 + drivers/net/dsa/mt7530.c | 203 ++++++++++++++++-- drivers/net/dsa/mt7530.h | 18 +- drivers/net/phy/Kconfig | 5 + drivers/net/phy/Makefile | 1 + drivers/net/phy/mediatek.c | 109 ++++++++++ drivers/staging/mt7621-dts/mt7621.dtsi | 3 + 7 files changed, 323 insertions(+), 21 deletions(-) create mode 100644 drivers/net/phy/mediatek.c
Signature · 1 line
2.25.1
RFC v2 1/4 net: phy: add MediaTek PHY driver
Add support for MediaTek PHYs found in MT7530 and MT7531 switches. The initialization procedure is from the vendor driver, but due to lack of documentation, the function of some register values remains unknown.
---
RFC v1 -> RFC v2:
- Add PHY interface mode check, suggested by Andrew.
drivers/net/phy/Kconfig | 5 ++ drivers/net/phy/Makefile | 1 + drivers/net/phy/mediatek.c | 112 +++++++++++++++++++++++++++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 drivers/net/phy/mediatek.c
drivers/net/phy/Kconfig +5 -0
@@ -207,6 +207,11 @@ config MARVELL_88X2222_PHY Support for the Marvell 88X2222 Dual-port Multi-speed Ethernet Transceiver. +config MEDIATEK_PHY + tristate "MediaTek PHYs" + help + Supports the MediaTek switch integrated PHYs. + config MICREL_PHY tristate "Micrel PHYs" help
drivers/net/phy/Makefile +1 -0
@@ -64,6 +64,7 @@ obj-$(CONFIG_LXT_PHY) += lxt.o obj-$(CONFIG_MARVELL_10G_PHY) += marvell10g.o obj-$(CONFIG_MARVELL_PHY) += marvell.o obj-$(CONFIG_MARVELL_88X2222_PHY) += marvell-88x2222.o +obj-$(CONFIG_MEDIATEK_PHY) += mediatek.o obj-$(CONFIG_MESON_GXL_PHY) += meson-gxl.o obj-$(CONFIG_MICREL_KS8995MA) += spi_ks8995.o obj-$(CONFIG_MICREL_PHY) += micrel.o
drivers/net/phy/mediatek.c new file +112 -0
112 lines not on this page · raw message
Signature · 1 line
2.25.1
RFC v2 2/4 net: dsa: mt7530: add interrupt support
In reply to DENG QingfangAdd support for MT7530 interrupt controller to handle internal PHYs. In order to assign an IRQ number to each PHY, the registration of MDIO bus is also done in this driver.
---
RFC v1 -> RFC v2:
- Split MDIO and IRQ setup function
drivers/net/dsa/Kconfig | 1 + drivers/net/dsa/mt7530.c | 238 +++++++++++++++++++++++++++++++++++---- drivers/net/dsa/mt7530.h | 18 ++- 3 files changed, 236 insertions(+), 21 deletions(-)
drivers/net/dsa/Kconfig +1 -0
@@ -36,6 +36,7 @@ config NET_DSA_LANTIQ_GSWIP config NET_DSA_MT7530 tristate "MediaTek MT753x and MT7621 Ethernet switch support" select NET_DSA_TAG_MTK + select MEDIATEK_PHY help This enables support for the MediaTek MT7530, MT7531, and MT7621 Ethernet switch chips.
drivers/net/dsa/mt7530.c +219 -19
306 lines not on this page · raw message
drivers/net/dsa/mt7530.h +16 -2
@@ -7,6 +7,7 @@#define __MT7530_H#define MT7530_NUM_PORTS 7 +#define MT7530_NUM_PHYS 5#define MT7530_CPU_PORT 6#define MT7530_NUM_FDB_RECORDS 2048#define MT7530_ALL_MEMBERS 0xff
@@ -381,6 +382,12 @@ enum mt7531_sgmii_force_duplex {#define SYS_CTRL_SW_RST BIT(1)#define SYS_CTRL_REG_RST BIT(0) +/* Register for system interrupt */ +#define MT7530_SYS_INT_EN 0x7008 + +/* Register for system interrupt status */ +#define MT7530_SYS_INT_STS 0x700c +/* Register for PHY Indirect Access Control */ #define MT7531_PHY_IAC 0x701C#define MT7531_PHY_ACS_ST BIT(31)
@@ -702,6 +709,11 @@ static const char *p5_intf_modes(unsigned int p5_interface) } } +/* Forward declaration */ +struct mt7530_priv ; +static int mt753x_phy_read (struct mii_bus *,int ,int ); +static int mt753x_phy_write (struct mii_bus *,int ,int ,u16 ); +/* struct mt753x_info - This is the main data structure for holding the specific * part for each supported device * @sw_setup: Holding the handler to a device initialization
@@ -726,8 +738,8 @@ struct mt753x_info {enum mt753x_id id;int (*sw_setup)(struct dsa_switch *ds); -int (*phy_read)(struct dsa_switch *ds,int port,int regnum); -int (*phy_write)(struct dsa_switch *ds,int port,int regnum,u16 val); +int (*phy_read)(struct mt7530_priv *priv,int port,int regnum); +int (*phy_write)(struct mt7530_priv *priv,int port,int regnum,u16 val);int (*pad_setup)(struct dsa_switch *ds,phy_interface_t interface);int (*cpu_port_config)(struct dsa_switch *ds,int port); bool (*phy_mode_supported)(struct dsa_switch *ds, int port,
@@ -782,6 +794,8 @@ struct mt7530_priv {struct mt7530_port ports[MT7530_NUM_PORTS ];/* protect among processes for registers access*/ struct mutex reg_mutex; +struct irq_domain *irq_domain; +u32 irq_enable; };struct mt7530_hw_vlan_entry {
Signature · 1 line
2.25.1
RFC v2 3/4 dt-bindings: net: dsa: add MT7530 interrupt controller binding
In reply to DENG QingfangAdd device tree binding to support MT7530 interrupt controller.
---
RFC v1 -> RFC v2:
- No changes.
Documentation/devicetree/bindings/net/dsa/mt7530.txt | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/net/dsa/mt7530.txt +5 -0
@@ -81,6 +81,11 @@ Optional properties: - gpio-controller: Boolean; if defined, MT7530's LED controller will run on GPIO mode. - #gpio-cells: Must be 2 if gpio-controller is defined. +- interrupt-controller: Boolean; Enables the internal interrupt controller. + +If interrupt-controller is defined, the following property is required. + +- interrupts: Parent interrupt for the interrupt controller. See Documentation/devicetree/bindings/net/dsa/dsa.txt for a list of additional required, optional properties and how the integrated switch subnodes must
Signature · 1 line
2.25.1
RFC v2 4/4 staging: mt7621-dts: enable MT7530 interrupt controller
In reply to DENG QingfangEnable MT7530 interrupt controller in the MT7621 SoC.
---
RFC v1 -> RFC v2:
- No changes.
drivers/staging/mt7621-dts/mt7621.dtsi | 3 +++ 1 file changed, 3 insertions(+)
drivers/staging/mt7621-dts/mt7621.dtsi +3 -0
@@ -447,6 +447,9 @@ switch0: switch0@0 { mediatek,mcm; resets = <&rstctrl 2>; reset-names = "mcm"; + interrupt-controller; + interrupt-parent = <&gic>; + interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>; ports { #address-cells = <1>;
Signature · 1 line
2.25.1
Re: [RFC v2 net-next 1/4] net: phy: add MediaTek PHY driver
In reply to DENG QingfangQuoted 5 lines · DENG Qingfang
Add support for MediaTek PHYs found in MT7530 and MT7531 switches. The initialization procedure is from the vendor driver, but due to lack of documentation, the function of some register values remains unknown.
Signed-off-by DENG Qingfang <[email protected]>
Andrew
Andrew Lunn
maintainerRe: [RFC v2 net-next 2/4] net: dsa: mt7530: add interrupt support
In reply to DENG QingfangQuoted 8 lines · DENG Qingfang
Add support for MT7530 interrupt controller to handle internal PHYs. In order to assign an IRQ number to each PHY, the registration of MDIO bus is also done in this driver.
Signed-off-by DENG Qingfang <[email protected]>---
RFC v1 -> RFC v2:
- Split MDIO and IRQ setup function
Thanks for the split. It looks good.
drivers/net/dsa/mt7530.h static const char *p5_intf_modes(unsigned int p5_interface) · line 715
Quoted 4 lines
drivers/net/dsa/mt7530.h +4
-0+/* Forward declaration */ +struct mt7530_priv ; +static int mt753x_phy_read (struct mii_bus *,int ,int ); +static int mt753x_phy_write (struct mii_bus *,int ,int ,u16 );
It is better to move the functions to before mt7530_setup_mdio().
Andrew
Re: [RFC v2 net-next 3/4] dt-bindings: net: dsa: add MT7530 interrupt controller binding
In reply to DENG QingfangQuoted 3 lines · DENG Qingfang
Add device tree binding to support MT7530 interrupt controller.
Signed-off-by DENG Qingfang <[email protected]>
Andrew
Re: [RFC v2 net-next 4/4] staging: mt7621-dts: enable MT7530 interrupt controller
In reply to DENG QingfangQuoted 3 lines · DENG Qingfang
Enable MT7530 interrupt controller in the MT7621 SoC.
Signed-off-by DENG Qingfang <[email protected]>
Andrew