From patchwork Sat Aug 14 18:11:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Bauer X-Patchwork-Id: 12436783 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9AEFC432BE for ; Sat, 14 Aug 2021 18:18:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B00A760FF2 for ; Sat, 14 Aug 2021 18:18:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238805AbhHNSSb (ORCPT ); Sat, 14 Aug 2021 14:18:31 -0400 Received: from perseus.uberspace.de ([95.143.172.134]:59242 "EHLO perseus.uberspace.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229751AbhHNSSb (ORCPT ); Sat, 14 Aug 2021 14:18:31 -0400 X-Greylist: delayed 399 seconds by postgrey-1.27 at vger.kernel.org; Sat, 14 Aug 2021 14:18:30 EDT Received: (qmail 6036 invoked from network); 14 Aug 2021 18:11:20 -0000 Received: from localhost (HELO localhost) (127.0.0.1) by perseus.uberspace.de with SMTP; 14 Aug 2021 18:11:20 -0000 From: David Bauer To: davem@davemloft.net, kuba@kernel.org, robh+dt@kernel.org Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 1/2] dt-bindings: net: add RTL8152 binding documentation Date: Sat, 14 Aug 2021 20:11:06 +0200 Message-Id: <20210814181107.138992-1-mail@david-bauer.net> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add binding documentation for the Realtek RTL8152 / RTL8153 USB ethernet adapters. Signed-off-by: David Bauer --- .../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 + +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>; + }; + }; From patchwork Sat Aug 14 18:11:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Bauer X-Patchwork-Id: 12436785 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E2F2C4320E for ; Sat, 14 Aug 2021 18:18:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0E2AD60F92 for ; Sat, 14 Aug 2021 18:18:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238961AbhHNSSd (ORCPT ); Sat, 14 Aug 2021 14:18:33 -0400 Received: from perseus.uberspace.de ([95.143.172.134]:59256 "EHLO perseus.uberspace.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229751AbhHNSSc (ORCPT ); Sat, 14 Aug 2021 14:18:32 -0400 Received: (qmail 6045 invoked from network); 14 Aug 2021 18:11:21 -0000 Received: from localhost (HELO localhost) (127.0.0.1) by perseus.uberspace.de with SMTP; 14 Aug 2021 18:11:21 -0000 From: David Bauer To: davem@davemloft.net, kuba@kernel.org, robh+dt@kernel.org Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 2/2] r8152: add LED configuration from OF Date: Sat, 14 Aug 2021 20:11:07 +0200 Message-Id: <20210814181107.138992-2-mail@david-bauer.net> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210814181107.138992-1-mail@david-bauer.net> References: <20210814181107.138992-1-mail@david-bauer.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 --- 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 #include #include +#include #include #include #include @@ -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)