All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] dt-bindings: net: add RTL8152 binding documentation
@ 2021-08-14 18:11 David Bauer
  2021-08-14 18:11 ` [PATCH 2/2] r8152: add LED configuration from OF David Bauer
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: David Bauer @ 2021-08-14 18:11 UTC (permalink / raw)
  To: davem, kuba, robh+dt; +Cc: netdev, devicetree

Add binding documentation for the Realtek RTL8152 / RTL8153 USB ethernet
adapters.

Signed-off-by: David Bauer <mail@david-bauer.net>
---
 .../bindings/net/realtek,rtl8152.yaml         | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/realtek,rtl8152.yaml

diff --git a/Documentation/devicetree/bindings/net/realtek,rtl8152.yaml b/Documentation/devicetree/bindings/net/realtek,rtl8152.yaml
new file mode 100644
index 000000000000..ab760000b3a6
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/realtek,rtl8152.yaml
@@ -0,0 +1,43 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/realtek,rtl8152.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Realtek RTL8152/RTL8153 series USB ethernet
+
+maintainers:
+  - David Bauer <mail@david-bauer.net>
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - realtek,rtl8152
+              - realtek,rtl8153
+
+  reg:
+    description: The device number on the USB bus
+
+  realtek,led-data:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Value to be written to the LED configuration register.
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    usb@100 {
+      reg = <0x100 0x100>;
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      usb-eth@2 {
+        compatible = "realtek,rtl8153";
+        reg = <0x2>;
+        realtek,led-data = <0x87>;
+      };
+    };
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] r8152: add LED configuration from OF
  2021-08-14 18:11 [PATCH 1/2] dt-bindings: net: add RTL8152 binding documentation David Bauer
@ 2021-08-14 18:11 ` David Bauer
  2021-08-14 18:33 ` [PATCH 1/2] dt-bindings: net: add RTL8152 binding documentation Heiner Kallweit
  2021-08-15 14:46 ` Rob Herring
  2 siblings, 0 replies; 6+ messages in thread
From: David Bauer @ 2021-08-14 18:11 UTC (permalink / raw)
  To: davem, kuba, robh+dt; +Cc: netdev, devicetree

This adds the ability to configure the LED configuration register using
OF. This way, the correct value for board specific LED configuration can
be determined.

Signed-off-by: David Bauer <mail@david-bauer.net>
---
 drivers/net/usb/r8152.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index e09b107b5c99..6f92e8bb2f1a 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -11,6 +11,7 @@
 #include <linux/mii.h>
 #include <linux/ethtool.h>
 #include <linux/usb.h>
+#include <linux/of.h>
 #include <linux/crc32.h>
 #include <linux/if_vlan.h>
 #include <linux/uaccess.h>
@@ -6791,6 +6792,22 @@ static void rtl_tally_reset(struct r8152 *tp)
 	ocp_write_word(tp, MCU_TYPE_PLA, PLA_RSTTALLY, ocp_data);
 }
 
+static int r8152_led_configuration(struct r8152 *tp)
+{
+	u32 led_data;
+	int ret;
+
+	ret = of_property_read_u32(tp->udev->dev.of_node, "realtek,led-data",
+				   &led_data);
+
+	if (ret)
+		return ret;
+
+	ocp_write_word(tp, MCU_TYPE_PLA, PLA_LEDSEL, led_data);
+
+	return 0;
+}
+
 static void r8152b_init(struct r8152 *tp)
 {
 	u32 ocp_data;
@@ -6832,6 +6849,8 @@ static void r8152b_init(struct r8152 *tp)
 	ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_USB_CTRL);
 	ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN);
 	ocp_write_word(tp, MCU_TYPE_USB, USB_USB_CTRL, ocp_data);
+
+	r8152_led_configuration(tp);
 }
 
 static void r8153_init(struct r8152 *tp)
@@ -7988,6 +8007,8 @@ static void r8156_init(struct r8152 *tp)
 	rtl_tally_reset(tp);
 
 	tp->coalesce = 15000;	/* 15 us */
+
+	r8152_led_configuration(tp);
 }
 
 static void r8156b_init(struct r8152 *tp)
@@ -8117,6 +8138,8 @@ static void r8156b_init(struct r8152 *tp)
 	rtl_tally_reset(tp);
 
 	tp->coalesce = 15000;	/* 15 us */
+
+	r8152_led_configuration(tp);
 }
 
 static bool rtl_check_vendor_ok(struct usb_interface *intf)
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] dt-bindings: net: add RTL8152 binding documentation
  2021-08-14 18:11 [PATCH 1/2] dt-bindings: net: add RTL8152 binding documentation David Bauer
  2021-08-14 18:11 ` [PATCH 2/2] r8152: add LED configuration from OF David Bauer
@ 2021-08-14 18:33 ` Heiner Kallweit
  2021-08-14 22:26   ` David Bauer
  2021-08-15 14:46 ` Rob Herring
  2 siblings, 1 reply; 6+ messages in thread
From: Heiner Kallweit @ 2021-08-14 18:33 UTC (permalink / raw)
  To: David Bauer, davem, kuba, robh+dt, Pavel Machek
  Cc: netdev, devicetree, linux-leds

On 14.08.2021 20:11, David Bauer wrote:
> Add binding documentation for the Realtek RTL8152 / RTL8153 USB ethernet
> adapters.
> 
> Signed-off-by: David Bauer <mail@david-bauer.net>
> ---
>  .../bindings/net/realtek,rtl8152.yaml         | 43 +++++++++++++++++++
>  1 file changed, 43 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/realtek,rtl8152.yaml
> 
> diff --git a/Documentation/devicetree/bindings/net/realtek,rtl8152.yaml b/Documentation/devicetree/bindings/net/realtek,rtl8152.yaml
> new file mode 100644
> index 000000000000..ab760000b3a6
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/realtek,rtl8152.yaml
> @@ -0,0 +1,43 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/realtek,rtl8152.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Realtek RTL8152/RTL8153 series USB ethernet
> +
> +maintainers:
> +  - David Bauer <mail@david-bauer.net>
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - items:
> +          - enum:
> +              - realtek,rtl8152
> +              - realtek,rtl8153
> +
> +  reg:
> +    description: The device number on the USB bus
> +
> +  realtek,led-data:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description: Value to be written to the LED configuration register.
> +

+Pavel as LED subsystem maintainer

There's an ongoing discussion (with certain decisions taken already) about
how to configure network device LEDs.

> +required:
> +  - compatible
> +  - reg
> +
> +examples:
> +  - |
> +    usb@100 {
> +      reg = <0x100 0x100>;
> +      #address-cells = <1>;
> +      #size-cells = <0>;
> +
> +      usb-eth@2 {
> +        compatible = "realtek,rtl8153";
> +        reg = <0x2>;
> +        realtek,led-data = <0x87>;
> +      };
> +    };
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] dt-bindings: net: add RTL8152 binding documentation
  2021-08-14 18:33 ` [PATCH 1/2] dt-bindings: net: add RTL8152 binding documentation Heiner Kallweit
@ 2021-08-14 22:26   ` David Bauer
  2021-08-14 23:00     ` Heiner Kallweit
  0 siblings, 1 reply; 6+ messages in thread
From: David Bauer @ 2021-08-14 22:26 UTC (permalink / raw)
  To: Heiner Kallweit, davem, kuba, robh+dt, Pavel Machek
  Cc: netdev, devicetree, linux-leds

Hi Heiner,

On 8/14/21 8:33 PM, Heiner Kallweit wrote:
> On 14.08.2021 20:11, David Bauer wrote:
>> Add binding documentation for the Realtek RTL8152 / RTL8153 USB ethernet
>> adapters.
>>
>> Signed-off-by: David Bauer <mail@david-bauer.net>
>> ---
>>   .../bindings/net/realtek,rtl8152.yaml         | 43 +++++++++++++++++++
>>   1 file changed, 43 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/net/realtek,rtl8152.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/net/realtek,rtl8152.yaml b/Documentation/devicetree/bindings/net/realtek,rtl8152.yaml
>> new file mode 100644
>> index 000000000000..ab760000b3a6
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/net/realtek,rtl8152.yaml
>> @@ -0,0 +1,43 @@
>> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/net/realtek,rtl8152.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Realtek RTL8152/RTL8153 series USB ethernet
>> +
>> +maintainers:
>> +  - David Bauer <mail@david-bauer.net>
>> +
>> +properties:
>> +  compatible:
>> +    oneOf:
>> +      - items:
>> +          - enum:
>> +              - realtek,rtl8152
>> +              - realtek,rtl8153
>> +
>> +  reg:
>> +    description: The device number on the USB bus
>> +
>> +  realtek,led-data:
>> +    $ref: /schemas/types.yaml#/definitions/uint32
>> +    description: Value to be written to the LED configuration register.
>> +
> 
> +Pavel as LED subsystem maintainer
> 
> There's an ongoing discussion (with certain decisions taken already) about
> how to configure network device LEDs.

Thanks, I didn't knew about this.

Is there any place where i can read up specifics about
this topic?

Best
David

> 
>> +required:
>> +  - compatible
>> +  - reg
>> +
>> +examples:
>> +  - |
>> +    usb@100 {
>> +      reg = <0x100 0x100>;
>> +      #address-cells = <1>;
>> +      #size-cells = <0>;
>> +
>> +      usb-eth@2 {
>> +        compatible = "realtek,rtl8153";
>> +        reg = <0x2>;
>> +        realtek,led-data = <0x87>;
>> +      };
>> +    };
>>
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] dt-bindings: net: add RTL8152 binding documentation
  2021-08-14 22:26   ` David Bauer
@ 2021-08-14 23:00     ` Heiner Kallweit
  0 siblings, 0 replies; 6+ messages in thread
From: Heiner Kallweit @ 2021-08-14 23:00 UTC (permalink / raw)
  To: David Bauer, davem, kuba, robh+dt, Pavel Machek
  Cc: netdev, devicetree, linux-leds

On 15.08.2021 00:26, David Bauer wrote:
> Hi Heiner,
> 
> On 8/14/21 8:33 PM, Heiner Kallweit wrote:
>> On 14.08.2021 20:11, David Bauer wrote:
>>> Add binding documentation for the Realtek RTL8152 / RTL8153 USB ethernet
>>> adapters.
>>>
>>> Signed-off-by: David Bauer <mail@david-bauer.net>
>>> ---
>>>   .../bindings/net/realtek,rtl8152.yaml         | 43 +++++++++++++++++++
>>>   1 file changed, 43 insertions(+)
>>>   create mode 100644 Documentation/devicetree/bindings/net/realtek,rtl8152.yaml
>>>
>>> diff --git a/Documentation/devicetree/bindings/net/realtek,rtl8152.yaml b/Documentation/devicetree/bindings/net/realtek,rtl8152.yaml
>>> new file mode 100644
>>> index 000000000000..ab760000b3a6
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/net/realtek,rtl8152.yaml
>>> @@ -0,0 +1,43 @@
>>> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
>>> +%YAML 1.2
>>> +---
>>> +$id: http://devicetree.org/schemas/net/realtek,rtl8152.yaml#
>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>> +
>>> +title: Realtek RTL8152/RTL8153 series USB ethernet
>>> +
>>> +maintainers:
>>> +  - David Bauer <mail@david-bauer.net>
>>> +
>>> +properties:
>>> +  compatible:
>>> +    oneOf:
>>> +      - items:
>>> +          - enum:
>>> +              - realtek,rtl8152
>>> +              - realtek,rtl8153
>>> +
>>> +  reg:
>>> +    description: The device number on the USB bus
>>> +
>>> +  realtek,led-data:
>>> +    $ref: /schemas/types.yaml#/definitions/uint32
>>> +    description: Value to be written to the LED configuration register.
>>> +
>>
>> +Pavel as LED subsystem maintainer
>>
>> There's an ongoing discussion (with certain decisions taken already) about
>> how to configure network device LEDs.
> 
> Thanks, I didn't knew about this.
> 
> Is there any place where i can read up specifics about
> this topic?
> 

A recent mail thread about network device LEDs is here:
https://lore.kernel.org/netdev/20210716212427.821834-6-anthony.l.nguyen@intel.com/

To cut a long story short:
LED subsystem maintainer has ideas how a unified solution could like,
and he has some work-in-progress patches. And some statements exist
how not to do it and what to avoid. But there's still some open
issues, therefore no solution is available yet. It's not really clear
how to go on with network device LED support in the meantime.

> Best
> David
> 
Heiner

>>
>>> +required:
>>> +  - compatible
>>> +  - reg
>>> +
>>> +examples:
>>> +  - |
>>> +    usb@100 {
>>> +      reg = <0x100 0x100>;
>>> +      #address-cells = <1>;
>>> +      #size-cells = <0>;
>>> +
>>> +      usb-eth@2 {
>>> +        compatible = "realtek,rtl8153";
>>> +        reg = <0x2>;
>>> +        realtek,led-data = <0x87>;
>>> +      };
>>> +    };
>>>
>>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] dt-bindings: net: add RTL8152 binding documentation
  2021-08-14 18:11 [PATCH 1/2] dt-bindings: net: add RTL8152 binding documentation David Bauer
  2021-08-14 18:11 ` [PATCH 2/2] r8152: add LED configuration from OF David Bauer
  2021-08-14 18:33 ` [PATCH 1/2] dt-bindings: net: add RTL8152 binding documentation Heiner Kallweit
@ 2021-08-15 14:46 ` Rob Herring
  2 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2021-08-15 14:46 UTC (permalink / raw)
  To: David Bauer; +Cc: devicetree, kuba, davem, robh+dt, netdev

On Sat, 14 Aug 2021 20:11:06 +0200, David Bauer wrote:
> Add binding documentation for the Realtek RTL8152 / RTL8153 USB ethernet
> adapters.
> 
> Signed-off-by: David Bauer <mail@david-bauer.net>
> ---
>  .../bindings/net/realtek,rtl8152.yaml         | 43 +++++++++++++++++++
>  1 file changed, 43 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/realtek,rtl8152.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/net/realtek,rtl8152.yaml: 'additionalProperties' is a required property
	hint: A schema without a "$ref" to another schema must define all properties and use "additionalProperties"
	from schema $id: http://devicetree.org/meta-schemas/base.yaml#
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/net/realtek,rtl8152.yaml: ignoring, error in schema: 
warning: no schema found in file: ./Documentation/devicetree/bindings/net/realtek,rtl8152.yaml
Documentation/devicetree/bindings/net/realtek,rtl8152.example.dt.yaml:0:0: /example-0/usb@100/usb-eth@2: failed to match any schema with compatible: ['realtek,rtl8153']

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/1516862

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-08-15 14:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-14 18:11 [PATCH 1/2] dt-bindings: net: add RTL8152 binding documentation David Bauer
2021-08-14 18:11 ` [PATCH 2/2] r8152: add LED configuration from OF David Bauer
2021-08-14 18:33 ` [PATCH 1/2] dt-bindings: net: add RTL8152 binding documentation Heiner Kallweit
2021-08-14 22:26   ` David Bauer
2021-08-14 23:00     ` Heiner Kallweit
2021-08-15 14:46 ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.