From patchwork Fri May 7 14:01:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lukasz Stelmach X-Patchwork-Id: 12244645 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=-14.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 32330C43461 for ; Fri, 7 May 2021 14:01:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F18B061448 for ; Fri, 7 May 2021 14:01:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237362AbhEGOCl (ORCPT ); Fri, 7 May 2021 10:02:41 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:28986 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237378AbhEGOCX (ORCPT ); Fri, 7 May 2021 10:02:23 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20210507140114euoutp0116e7d86d90ea36e041976527c8dc66c1~8zaUTRNDJ1061910619euoutp014 for ; Fri, 7 May 2021 14:01:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20210507140114euoutp0116e7d86d90ea36e041976527c8dc66c1~8zaUTRNDJ1061910619euoutp014 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1620396074; bh=oxIapUBNQR3k7aZPKU/KtkFdGurWbp1SPZSx7pMXtCE=; h=From:To:Cc:Subject:Date:References:From; b=osznObsEm18nIwlH4HV5DxIsTG9ovNTn2ps10zn94XiOYgrB2ScRPwElhIKWb+mpD 9fwGTC4DePHvE0b+e/tQF1l6i8/EZnQ9bs0g+JRE1V7j0ZRip/OrkkB7ZZgmdAlau3 TPxeeAZA4bm10HMvmgFoDODPr3foKsKAFpVTSSZc= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20210507140113eucas1p228c7eebaaf9a5bca5d4867ff11170c7d~8zaTXVvGl0929309293eucas1p21; Fri, 7 May 2021 14:01:13 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id C4.CD.09452.92845906; Fri, 7 May 2021 15:01:13 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20210507140113eucas1p21220dba3bb049a157df40fe778e39893~8zaS4goqL2080320803eucas1p2-; Fri, 7 May 2021 14:01:13 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210507140113eusmtrp2d1cd130e7520e6f838e111a289e8155d~8zaS3p3ax1970319703eusmtrp2Q; Fri, 7 May 2021 14:01:13 +0000 (GMT) X-AuditID: cbfec7f2-a9fff700000024ec-f6-609548298d03 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 5E.51.08705.92845906; Fri, 7 May 2021 15:01:13 +0100 (BST) Received: from localhost (unknown [106.120.51.46]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210507140112eusmtip2d874c70c70e7e399b8a428561b19aa14~8zaSlwp3T3137331373eusmtip2D; Fri, 7 May 2021 14:01:12 +0000 (GMT) From: =?utf-8?q?=C5=81ukasz_Stelmach?= To: Andrew Lunn , jim.cromie@gmail.com, Heiner Kallweit , "David S. Miller" , Jakub Kicinski , Rob Herring , Kukjin Kim , Krzysztof Kozlowski , Russell King , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Cc: =?utf-8?q?Bart=C5=82omiej_=C5=BBolnierkiewicz?= , Marek Szyprowski , =?utf-8?q?=C5=81ukasz_Stelmach?= Subject: [PATCH net-next v12 0/3] AX88796C SPI Ethernet Adapter Date: Fri, 7 May 2021 16:01:07 +0200 Message-Id: <20210507140110.6323-1-l.stelmach@samsung.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Organization: Samsung R&D Institute Poland X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrEKsWRmVeSWpSXmKPExsWy7djPc7qaHlMTDDYvU7c4f/cQs8XGGetZ Leacb2GxmH/kHKvFovczWC2uvb3DatH/+DWzxfnzG9gtLmzrY7W4eWgFo8Wmx9dYLS7vmsNm MeP8PiaLQ1P3MlqsPXKX3eLYAjGL1r1H2B0EPS5fu8jssWXlTSaPnbPusntsWtXJ5rF5Sb3H zh2fmTz6tqxi9Pi8SS6AI4rLJiU1J7MstUjfLoErY8HEo4wFu/Uq7u+9zt7AOF2li5GTQ0LA ROL4tlesXYxcHEICKxgl1mx6yALhfGGUmHGmgQ3C+cwosef8J1aYltdXt7BDJJYzSnQ/ugNV 9ZxR4v7UJWBVbAKOEv1LT4ANFhG4xyyxvv0BI4jDLLCPUWLnvSnMIFXCAvYSi7rWMoHYLAKq EktONLOD2LwCVhJ71j+A2icv0b58OxtEXFDi5MwnLCA2v4CWxJqm62A2M1BN89bZzCALJASW c0o0zfrIDNHsIvF//kF2CFtY4tXxLVC2jMT/nfOBFnMA2fUSkyeZQfT2MEpsm/ODBaLGWuLO uV9sIDXMApoS63fpQ4QdJS5e/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naQKmEBe4lFXWuZQGwWAVWJJSeaweK8AlYSe9Y/YIXYIC/Rvnw7G0RcUOLkzCcs IEcwC6hLrJ8nBBLmF9CSWNN0nQXEZgYqb946m3kCo8AsJB2zEDpmIalawMi8ilEktbQ4Nz23 2FCvODG3uDQvXS85P3cTIzBOtx37uXkH47xXH/UOMTJxMB5ilOBgVhLhPb1ocoIQb0piZVVq UX58UWlOavEhRlOgDyYyS4km5wMTRV5JvKGZgamhiZmlgamlmbGSOO/WuWvihQTSE0tSs1NT C1KLYPqYODilGpjYD7zt+Jr1x0ZSQLtsi5art9ub+J9KqX73ZphZXL72ytjyzC+2eln+VdlG IqYaXHvqA89wK5+48Z3tdsxJFa204Mc7Ds2Veypx+dfpsL+F945lRdzO7c1Y/MTS0enhJ8XU /v2dp0x+CSr3c6ssFAx6LLBU1/zKrnPq1iqXwmIvtD798e1ouvXFrQvXS83clbJJ9kjWKbuT iy9Eb16wmu2N9dMfWS5uV8KNVmn/Dn2890y3/3Sf5yI9qrJxP6JeiNaENChdYmdd97S/1KRU 8iKb2u5A96I3a+q2hDxcY55k6VZ5VK6E3WTah2kKzydO/SoX3r/EQGnnJwFtk83XTbdK7jTt ebxlrUVmgejNOG4lluKMREMt5qLiRADfR+qPXAMAAA== X-CMS-MailID: 20210507140113eucas1p21220dba3bb049a157df40fe778e39893 X-Msg-Generator: CA X-RootMTR: 20210507140113eucas1p21220dba3bb049a157df40fe778e39893 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20210507140113eucas1p21220dba3bb049a157df40fe778e39893 References: Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org This is a driver for AX88796C Ethernet Adapter connected in SPI mode as found on ARTIK5 evaluation board. The driver has been ported from a v3.10.9 vendor kernel for ARTIK5 board. Changes in v12: - rebased to net-next-5.13 - added missing spaces after commas - corrected indentation Changes in v11: - changed stat counters to 64-bit - replaced WARN_ON(!mutex_is_locked()) with lockdep_assert_held() - replaced ax88796c_free_skb_queue() with __skb_queue_purge() - added cancel_work_sync() for ax_work - removed unused fields of struct skb_data - replaced MAX() with max() from minmax.h - rebased to net-next (resend) Changes in v10: - removed unused variable Changes in v9: - used pskb_extend_head() - used ethtool private flags instead of tunables to switch SPI compression - changed - alloc_skb() to netdev_alloc(skb) - __pskb_trim() to pskb_trim() - removed: - chages to skb->truesize - unnecessary casting to short - return f() in a void function - IRQF_SHARED flags - unnecessary memset(0) of kzalloc()ed buffer - unused endiannes detection - unnecessary __packed attribute for some structures - added: - temporary variable in AX_WRITE/READ sequences - missin mutex_unlock() in error paths - axspi_read_reg() returns a constant value in case of an error Changes in v8: - fixed the entry in MAINTAINERS - removed unnecessary netif_err() - changed netif_rx() to netif_rx_ni() for code running in a process context - added explicit type casting for ~BIT() Changes in v7: - removed duplicate code - moved a constant buffer definition away from a header file Changes in v6: - fixed typos in Kconfig - checked argument value in ax88796c_set_tunable - updated tags in commit messages Changes in v5: - coding style (local variable declarations) - added spi0 node in the DT binding example and removed interrupt-parent - removed comp module parameter - added CONFIG_SPI_AX88796C_COMPRESSION option to set the initial state of SPI compression - introduced new ethtool tunable "spi-compression" to controll SPI transfer compression - removed unused fields in struct ax88796c_device - switched from using buffers allocated on stack for SPI transfers to DMA safe ones embedded in struct ax_spi and allocated with kmalloc() Changes in v4: - fixed compilation problems in asix,ax88796c.yaml and in ax88796c_main.c introduced in v3 Changes in v3: - modify vendor-prefixes.yaml in a separate patch - fix several problems in the dt binding - removed unnecessary descriptions and properties - changed the order of entries - fixed problems with missing defines in the example - change (1 << N) to BIT(N), left a few (0 << N) - replace ax88796c_get_link(), ax88796c_get_link_ksettings(), ax88796c_set_link_ksettings(), ax88796c_nway_reset(), ax88796c_set_mac_address() with appropriate kernel functions. - disable PHY auto-polling in MAC and use PHYLIB to track the state of PHY and configure MAC - propagate return values instead of returning constants in several places - add WARN_ON() for unlocked mutex - remove local work queue and use the system_wq - replace phy_connect_direct() with phy_connect() and move devm_register_netdev() to the end of ax88796c_probe() (Unlike phy_connect_direct() phy_connect() does not crash if the network device isn't registered yet.) - remove error messages on ENOMEM - move free_irq() to the end of ax88796c_close() to avoid race condition - implement flow-control Changes in v2: - use phylib - added DT bindings - moved #includes to *.c files - used mutex instead of a semaphore for locking - renamed some constants - added error propagation for several functions - used ethtool for dumping registers - added control over checksum offloading - remove vendor specific PM - removed macaddr module parameter and added support for reading a MAC address from platform data (e.g. DT) - removed dependency on SPI from NET_VENDOR_ASIX - added an entry in the MAINTAINERS file - simplified logging with appropriate netif_* and netdev_* helpers - lots of style fixes Ɓukasz Stelmach (3): dt-bindings: vendor-prefixes: Add asix prefix dt-bindings: net: Add bindings for AX88796C SPI Ethernet Adapter net: ax88796c: ASIX AX88796C SPI Ethernet Adapter Driver .../bindings/net/asix,ax88796c.yaml | 73 ++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + MAINTAINERS | 6 + drivers/net/ethernet/Kconfig | 1 + drivers/net/ethernet/Makefile | 1 + drivers/net/ethernet/asix/Kconfig | 35 + drivers/net/ethernet/asix/Makefile | 6 + drivers/net/ethernet/asix/ax88796c_ioctl.c | 239 ++++ drivers/net/ethernet/asix/ax88796c_ioctl.h | 26 + drivers/net/ethernet/asix/ax88796c_main.c | 1146 +++++++++++++++++ drivers/net/ethernet/asix/ax88796c_main.h | 568 ++++++++ drivers/net/ethernet/asix/ax88796c_spi.c | 115 ++ drivers/net/ethernet/asix/ax88796c_spi.h | 69 + 13 files changed, 2287 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/asix,ax88796c.yaml create mode 100644 drivers/net/ethernet/asix/Kconfig create mode 100644 drivers/net/ethernet/asix/Makefile create mode 100644 drivers/net/ethernet/asix/ax88796c_ioctl.c create mode 100644 drivers/net/ethernet/asix/ax88796c_ioctl.h create mode 100644 drivers/net/ethernet/asix/ax88796c_main.c create mode 100644 drivers/net/ethernet/asix/ax88796c_main.h create mode 100644 drivers/net/ethernet/asix/ax88796c_spi.c create mode 100644 drivers/net/ethernet/asix/ax88796c_spi.h