net: mdio: add ipq8064 mdio driver
Subsystems (5)
PATCH v7 1/2 net: mdio: add ipq8064 mdio driver
Currently ipq806x soc use generic bitbang driver to comunicate with the gmac ethernet interface. Add a dedicated driver created by chunkeey to fix this.
---
Changes in v7:
- Add myself as module author and copyright
- Reduced usleep_range to 8-10 as suggested by chunkeey
Changes in v6:
- Fix error in commit description
- Add co-developed tag
Changes in v5:
- Rename define to more rappresentative name
Changes in v4:
- Fix wrong print value in dev_err
Changes in v3:
- Fix wrong return logic on error
Changes in v2:
- Use regmap_read_poll_timeout
- Reject clause 45
drivers/net/phy/Kconfig | 8 ++ drivers/net/phy/Makefile | 1 + drivers/net/phy/mdio-ipq8064.c | 169 +++++++++++++++++++++++++++++++++ 3 files changed, 178 insertions(+) create mode 100644 drivers/net/phy/mdio-ipq8064.c
drivers/net/phy/Kconfig +8 -0
@@ -157,6 +157,14 @@ config MDIO_I2C This is library mode. +config MDIO_IPQ8064 + tristate "Qualcomm IPQ8064 MDIO interface support" + depends on HAS_IOMEM && OF_MDIO + depends on MFD_SYSCON + help + This driver supports the MDIO interface found in the network + interface units of the IPQ8064 SoC + config MDIO_MOXART tristate "MOXA ART MDIO interface support" depends on ARCH_MOXART || COMPILE_TEST
drivers/net/phy/Makefile +1 -0
@@ -36,6 +36,7 @@ obj-$(CONFIG_MDIO_CAVIUM) += mdio-cavium.o obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o obj-$(CONFIG_MDIO_HISI_FEMAC) += mdio-hisi-femac.o obj-$(CONFIG_MDIO_I2C) += mdio-i2c.o +obj-$(CONFIG_MDIO_IPQ8064) += mdio-ipq8064.o obj-$(CONFIG_MDIO_MOXART) += mdio-moxart.o obj-$(CONFIG_MDIO_MSCC_MIIM) += mdio-mscc-miim.o obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o
drivers/net/phy/mdio-ipq8064.c new file +169 -0
169 lines not on this page · raw message
Signature · 1 line
2.25.0
PATCH v7 2/2 Documentation: devictree: Add ipq806x mdio bindings
Add documentations for ipq806x mdio driver.
---
Changes in v7:
- Fix dt_binding_check problem
.../bindings/net/qcom,ipq8064-mdio.yaml | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml new file +55 -0
@@ -0,0 +1,55 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/qcom,ipq8064-mdio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm ipq806x MDIO bus controller + +maintainers: + - Ansuel Smith <[email protected]> + +description: |+ + The ipq806x soc have a MDIO dedicated controller that is + used to comunicate with the gmac phy conntected. + Child nodes of this MDIO bus controller node are standard + Ethernet PHY device nodes as described in + Documentation/devicetree/bindings/net/phy.txt + +allOf: + - $ref: "mdio.yaml#" + +properties: + compatible: + const: qcom,ipq8064-mdio + reg: + maxItems: 1 + description: address and length of the register set for the device + clocks: + maxItems: 1 + description: A reference to the clock supplying the MDIO bus controller + +required: + - compatible + - reg + - clocks + - "#address-cells" + - "#size-cells" + +examples: + - | + mdio0: mdio@37000000 { + #address-cells = <1>; + #size-cells = <0>; + + compatible = "qcom,ipq8064-mdio", "syscon"; + reg = <0x37000000 0x200000>; + resets = <&gcc GMAC_CORE1_RESET>; + reset-names = "stmmaceth"; + clocks = <&gcc GMAC_CORE1_CLK>; + + switch@10 { + compatible = "qca,qca8337"; + /* ... */ + }; + };
Signature · 1 line
2.25.0
Andrew Lunn
maintainerRe: [PATCH v7 2/2] Documentation: devictree: Add ipq806x mdio bindings
Quoted 21 lines · Ansuel Smith
Add documentations for ipq806x mdio driver.
Signed-off-by Ansuel Smith <[email protected]>---
Changes in v7:
- Fixdt_binding_checkproblem.../bindings/net/qcom,ipq8064-mdio.yaml | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yamlDocumentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml new file +4
-0@@ -0,0 +1,55 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/qcom,ipq8064-mdio.yaml#
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml line 14
Quoted 10 lines
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml new file +10
-0+$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm ipq806x MDIO bus controller + +maintainers: + - Ansuel Smith <[email protected]> + +description: |+ + The ipq806x soc have a MDIO dedicated controller that is + used to comunicate with the gmac phy conntected.
used to communicate with the connected gmac phy.
Andrew
Re: [PATCH v7 2/2] Documentation: devictree: Add ipq806x mdio bindings
In reply to Ansuel SmithQuoted 1 line · Ansuel Smith
typo in the subject. Use 'dt-bindings: net: ...' for the subject prefix.
Quoted 6 lines
Add documentations for ipq806x mdio driver.
Signed-off-by Ansuel Smith <[email protected]>---
Changes in v7:
- Fixdt_binding_checkproblem
Um, no you didn't...
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml line 1
Quoted 12 lines
.../bindings/net/qcom,ipq8064-mdio.yaml | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yamlDocumentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml new file +1
-0@@ -0,0 +1,55 @@ +# SPDX-License-Identifier: GPL-2.0-or-later
Dual license new bindings please:
(GPL-2.0-only OR BSD-2-Clause)
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml line 12
Quoted 11 lines
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml new file +11
-0+%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/qcom,ipq8064-mdio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm ipq806x MDIO bus controller + +maintainers: + - Ansuel Smith <[email protected]> + +description: |+
Don't need '|+' unless you need specific formatting.
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml line 24
Quoted 12 lines
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml new file +12
-0+ The ipq806x soc have a MDIO dedicated controller that is + used to comunicate with the gmac phy conntected. + Child nodes of this MDIO bus controller node are standard + Ethernet PHY device nodes as described in + Documentation/devicetree/bindings/net/phy.txt + +allOf: + - $ref: "mdio.yaml#" + +properties: + compatible: + const: qcom,ipq8064-mdio
blank line between properties please.
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml line 27
Quoted 3 lines
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml new file +3
-0+ reg: + maxItems: 1 + description: address and length of the register set for the device
That's every 'reg', you can drop this.
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml line 30
Quoted 3 lines
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml new file +3
-0+ clocks: + maxItems: 1 + description: A reference to the clock supplying the MDIO bus controller
That's every 'clocks', you can drop this.
Quoted 5 lines
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml new file +5
-0+ +required: + - compatible + - reg + - clocks
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml line 45
Quoted 10 lines
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml new file +10
-0+ - "#address-cells" + - "#size-cells" + +examples: + - | + mdio0: mdio@37000000 { + #address-cells = <1>; + #size-cells = <0>; + + compatible = "qcom,ipq8064-mdio", "syscon";
'syscon' doesn't match the schema and is wrong.
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml line 48
Quoted 4 lines
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml new file +3
-0+ reg = <0x37000000 0x200000>; + resets = <&gcc GMAC_CORE1_RESET>; + reset-names = "stmmaceth";
Not documented.
Quoted 1 line
+ clocks = <&gcc
GMAC_CORE1_CLK>;
You need to include the header for these defines.
Quoted 9 lines
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml new file +6
-1+ + switch@10 { + compatible = "qca,qca8337"; + /* ... */ + }; + }; --2.25.0
R: [PATCH v7 2/2] Documentation: devictree: Add ipq806x mdio bindings
Quoted 6 lines
Quoted 1 line · Ansuel Smith
typo in the subject. Use 'dt-bindings: net: ...' for the subject prefix.
Quoted 9 lines
Quoted 6 lines
Add documentations for ipq806x mdio driver.
Signed-off-by Ansuel Smith <[email protected]>---
Changes in v7:
- Fixdt_binding_checkproblemUm, no you didn't...
Does make dt_check_binding still gives errors?
If yes can you give me some advice on how to test only this since it gives me errors on checking other upstream Documentation ?
I will fix the other problem in v8. Sorry for the mess and thanks.
Quoted 102 lines
Quoted 2 lines
.../bindings/net/qcom,ipq8064-mdio.yaml | 55+++++++++++++++++++
Quoted 2 lines
1 file changed, 55 insertions(+) create mode 100644
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yamlReview
Quoted 2 lines
(quoted diff) +0
-0
mdio.yamlb/Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yamlDocumentation/devicetree/bindings/net/qcom,ipq8064-
Quoted 4 lines
new file mode 100644
index 000000000000..3178cbfdc661Documentation/devicetree/bindings/net/qcom,ipq8064- new file +0
-0
mdio.yamlDocumentation/devicetree/bindings/net/qcom,ipq8064- line 1
Quoted 2 lines
Documentation/devicetree/bindings/net/qcom,ipq8064- new file +1
-0@@ -0,0 +1,55 @@ +# SPDX-License-Identifier: GPL-2.0-or-laterDual license new bindings please:
(GPL-2.0-only OR BSD-2-Clause)
Documentation/devicetree/bindings/net/qcom,ipq8064- line 12
Quoted 11 lines
Documentation/devicetree/bindings/net/qcom,ipq8064- new file +11
-0+%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/qcom,ipq8064-mdio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm ipq806x MDIO bus controller + +maintainers: + - Ansuel Smith <[email protected]> + +description: |+Don't need '|+' unless you need specific formatting.
Documentation/devicetree/bindings/net/qcom,ipq8064- line 24
Quoted 12 lines
Documentation/devicetree/bindings/net/qcom,ipq8064- new file +12
-0+ The ipq806x soc have a MDIO dedicated controller that is + used to comunicate with the gmac phy conntected. + Child nodes of this MDIO bus controller node are standard + Ethernet PHY device nodes as described in + Documentation/devicetree/bindings/net/phy.txt + +allOf: + - $ref: "mdio.yaml#" + +properties: + compatible: + const: qcom,ipq8064-mdioblank line between properties please.
Documentation/devicetree/bindings/net/qcom,ipq8064- line 27
Quoted 3 lines
Documentation/devicetree/bindings/net/qcom,ipq8064- new file +3
-0+ reg: + maxItems: 1 + description: address and length of the register set for the deviceThat's every 'reg', you can drop this.
Documentation/devicetree/bindings/net/qcom,ipq8064- line 30
Quoted 3 lines
Documentation/devicetree/bindings/net/qcom,ipq8064- new file +3
-0+ clocks: + maxItems: 1 + description: A reference to the clock supplying the MDIO buscontroller
That's every 'clocks', you can drop this.
Quoted 5 lines
Documentation/devicetree/bindings/net/qcom,ipq8064- new file +5
-0+ +required: + - compatible + - reg + - clocksDocumentation/devicetree/bindings/net/qcom,ipq8064- line 45
Quoted 10 lines
Documentation/devicetree/bindings/net/qcom,ipq8064- new file +10
-0+ - "#address-cells" + - "#size-cells" + +examples: + - | + mdio0: mdio@37000000 { + #address-cells = <1>; + #size-cells = <0>; + + compatible = "qcom,ipq8064-mdio", "syscon";'syscon' doesn't match the schema and is wrong.
Documentation/devicetree/bindings/net/qcom,ipq8064-
Quoted 4 lines
Documentation/devicetree/bindings/net/qcom,ipq8064- new file +3
-0+ reg = <0x37000000 0x200000>; + resets = <&gcc GMAC_CORE1_RESET>; + reset-names = "stmmaceth";Not documented.
Quoted 1 line
+ clocks = <&gcc
GMAC_CORE1_CLK>;You need to include the header for these defines.
Quoted 9 lines
Documentation/devicetree/bindings/net/qcom,ipq8064- new file +6
-1+ + switch@10 { + compatible = "qca,qca8337"; + /* ... */ + }; + }; --2.25.0
Re: [PATCH v7 2/2] Documentation: devictree: Add ipq806x mdio bindings
Quoted 14 lines · On Tue, Feb 25, 2020 at 12:40 PM <[email protected]> wrote:
Quoted 14 lines
Quoted 1 line · Ansuel Smith
typo in the subject. Use 'dt-bindings: net: ...' for the subject prefix.
Quoted 6 lines
Add documentations for ipq806x mdio driver.
Signed-off-by Ansuel Smith <[email protected]>---
Changes in v7:
- Fixdt_binding_checkproblem
Quoted 6 lines
Quoted 2 lines
Um, no you didn't...
Does make
dt_check_bindingstill gives errors?
If yes can you give me some advice on how to test only this since it gives me errors on checking other upstream Documentation ?
Don't use linux-next. Linus' master is only warnings. If you have errors on that, then you may need to update dtschema.
Also, using 'make -k' helps if there are make errors.
Rob
Andrew Lunn
maintainerdrivers/net/phy/mdio-ipq8064.c line 59
Quoted 7 lines
drivers/net/phy/mdio-ipq8064.c new file +7
-0+static int +ipq8064_mdio_read (struct mii_bus *bus,int phy_addr,int reg_offset) +{ +struct ipq8064_mdio *priv = bus->priv; +u32 miiaddr =MII_BUSY |MII_CLKRANGE_250_300M ; +u32 ret_val; +int err;
Hi Ansuel
Reverse Christmas tree. priv needs to move down a line.
Quoted 14 lines
drivers/net/phy/mdio-ipq8064.c new file +14
-0+ +/* Reject clause 45 */ +if (reg_offset &MII_ADDR_C45 ) +return -EOPNOTSUPP ; + + miiaddr |= ((phy_addr <<MII_ADDR_SHIFT ) &MII_ADDR_MASK ) | + ((reg_offset <<MII_REG_SHIFT ) &MII_REG_MASK ); + +regmap_write (priv->base,MII_ADDR_REG_ADDR , miiaddr); +usleep_range (8 ,10 ); + + err =ipq8064_mdio_wait_busy (priv); +if (err) +return err;
drivers/net/phy/mdio-ipq8064.c line 83
Quoted 10 lines
drivers/net/phy/mdio-ipq8064.c new file +10
-0+ +regmap_read (priv->base,MII_DATA_REG_ADDR , &ret_val); +return (int )ret_val; +} + +static int +ipq8064_mdio_write (struct mii_bus *bus,int phy_addr,int reg_offset,u16 data) +{ +struct ipq8064_mdio *priv = bus->priv; +u32 miiaddr =MII_WRITE |MII_BUSY |MII_CLKRANGE_250_300M ;
Same here.
Quoted 12 lines
drivers/net/phy/mdio-ipq8064.c new file +12
-0+static int +ipq8064_mdio_probe (struct platform_device *pdev) +{ +struct device_node *np = pdev->dev.of_node; +struct ipq8064_mdio *priv; +struct mii_bus *bus; +int ret; + + bus =devm_mdiobus_alloc_size (&pdev->dev,sizeof (*priv)); +if (!bus) +return -ENOMEM ; +
drivers/net/phy/mdio-ipq8064.c line 121
Quoted 10 lines
drivers/net/phy/mdio-ipq8064.c new file +10
-0+ bus->name ="ipq8064_mdio_bus" ; + bus->read = ipq8064_mdio_read; + bus->write = ipq8064_mdio_write; +snprintf (bus->id,MII_BUS_ID_SIZE ,"%s-mii" ,dev_name (&pdev->dev)); + bus->parent = &pdev->dev; + + priv = bus->priv; + priv->base =syscon_node_to_regmap (np); +if (IS_ERR (priv->base) && priv->base !=ERR_PTR (-EPROBE_DEFER )) + priv->base =syscon_regmap_lookup_by_phandle (np,"master" );
"master" is not documented in the binding. Do we really need two different ways to get the base address?
Andrew