From patchwork Tue Nov 24 12:03:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lukasz Stelmach X-Patchwork-Id: 11928177 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=-11.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 A0F7CC56201 for ; Tue, 24 Nov 2020 12:04:37 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E64922076B for ; Tue, 24 Nov 2020 12:04:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="2dIlnUE2"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="ZMMXTc50" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E64922076B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:MIME-Version:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Owner; bh=kxcU6GTB4CB99t592JkTfJlsJPauPRe0+3WTvlR+tnk=; b=2dIlnUE27+kQ3P9hn9zrb9IdZ XiLsqajaRg/wAca01uhAT2Y+KhDlAP+k9e/JmduiDK2/17s7hbx1z4aOON4K2Ud+dadAziAonzRoN jFBLm+ZETlm2u//F+X+9RinMNA/pCfIQBJC/IfCGr9xywz68nN/j82E4iozMKm0hzU/Jk8ivqbcVN E7Mi/OEAle+kFCPB3M+YKz4OhzM9Tw/xwpHC+zuibL7LNoTbLwYgddGMJvnBou+kLlg/LXFjlQOnq zJPFlgh8R0E9Nm6mJUW8Qu/8Uqw/Ep2X1geYscD0CESn78sCYnZrcSKiMsck1S1Ux84LdWVCOg+Fd YTcM+Am+w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1khX3A-0006pu-Ke; Tue, 24 Nov 2020 12:04:00 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1khX37-0006nY-92 for linux-arm-kernel@lists.infradead.org; Tue, 24 Nov 2020 12:03:58 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201124120336euoutp013a46eee00862ddbf638b554261b6a64d~KcAynMjn_2642526425euoutp01L for ; Tue, 24 Nov 2020 12:03:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201124120336euoutp013a46eee00862ddbf638b554261b6a64d~KcAynMjn_2642526425euoutp01L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1606219416; bh=YJwwZT+jo9L5l/xiseHfV1MXYo4KzfpXBbVtn/uCpjc=; h=From:To:Cc:Subject:Date:References:From; b=ZMMXTc500X5EVjNvOueMWjLb71VqI2Cl+9sNxlgCpu0Yl6fOqtqX7XyA3H/383Gow yweEq4omcju6rJ9/GbG4q1i7b31x8SI4VABHIHXum2S01jjJF1rNW7kjQS1+Pt/pLs mOqtyrnlbqsuIKAjCTbI1IYmsexpYIxXqYibXCho= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20201124120336eucas1p20b2948b5ae5c334c6455edfd5298d094~KcAyaa3XK2294422944eucas1p23; Tue, 24 Nov 2020 12:03:36 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id BD.63.27958.896FCBF5; Tue, 24 Nov 2020 12:03:36 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20201124120336eucas1p20710fdff8434428ea0f011b02249b8a8~KcAyC17_U2906629066eucas1p2f; Tue, 24 Nov 2020 12:03:36 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201124120336eusmtrp24e22f53027c87a0b435f61585d6d876f~KcAyAjuEz3019630196eusmtrp2T; Tue, 24 Nov 2020 12:03:36 +0000 (GMT) X-AuditID: cbfec7f2-efdff70000006d36-5d-5fbcf6987d4d Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 58.2C.16282.796FCBF5; Tue, 24 Nov 2020 12:03:35 +0000 (GMT) Received: from localhost (unknown [106.120.51.46]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20201124120335eusmtip24e15a81771d0f07ac6f51fb462b078a8~KcAxxIb9h2324723247eusmtip2U; Tue, 24 Nov 2020 12:03:35 +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 Subject: [PATCH v7 0/3] AX88796C SPI Ethernet Adapter Date: Tue, 24 Nov 2020 13:03:27 +0100 Message-Id: <20201124120330.32445-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: H4sIAAAAAAAAA02ScUwbVRzHfb1ee63rOA7CfikLakUTZmRsc+ZFiA4z421/LIvGmDhjrd2l 4GhLrjCZVSFujJUIxTFi6cpKzJYyYDCg1pXBZi7NYA64IQ3CWIkyjY6NgSuwSUaVchj33+f9 3uf7fr9f8iiCGSK1VL6liOMthgKdQi0PXPlbfNG12KPPqltOxWJEIHCHq53EHvGIHHtDQyT+ dtZF4tGZmyR23rpDYFE8r8TXA9UkHheaEO68NUrikW6PArvESzIs1PUifC4UUeIrjSm4vDek 3JHIjowOE6z/7LiMDbojSraz2aFgu06XssELURlb7W9GbLQzbS/1njpnP1eQf5DjN7/6oTpv xDFLFp5KL+mqe0SWoaqNlYiigH4JgkvmSqSiGLoJwdRwaSVSr/A8gvO9N+TSRRSBUFMY57jf 1RGWS5IPgbftISFJfyC4N5gQZwWdC84z/WRcSqYnCWiv+AXFDwR9CUFw8sRqIoneDtW3KxVx ltPPgbNvdLWuobPhesRBSO2eggrf9wqpnghX639bHSmB3gStX/68ysSKc/i7k0S8AdA+Ffhq Hq2Fd4IrWENKnATTfX6lxBvhn6BXJu1fCrXHX5ayXyEIeB7KJScbbg4tKeIOQWdAe/dmqZwL HT/eXYuuh7GZRGmE9XA88A0hlTVw7Cgj2enQ5uxZe1ALVdNNSGIWnANLqAY9435sMfdjy7j/ 79uIiGa0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WsDIvIpRJLW0ODc9 t9hIrzgxt7g0L10vOT93EyMwUrcd+7llB+PKVx/1DjEycTAeYpTgYFYS4W2V2xkvxJuSWFmV WpQfX1Sak1p8iNEU6IOJzFKiyfnAVJFXEm9oZmBqaGJmaWBqaWasJM5rcmRNvJBAemJJanZq akFqEUwfEwenVAOT9pQD4fuOcLKbd3dfyO1muTah0SJm3dVFmoob/OZY+gesW8ko/WdHyZSY twf3+T65f/9HB4NGsmy5T10yh4x/rPWDqBPuEU+esJv5nssTmHDMXmSyfYXXpoU25YFhSjsW r1nRWRQYfPE0t5a8UMrd9YcbnZ6XPHxkKL4+/F61871H0Ztefs+U/RuylIHn6cp/L3Nkn7sL SGs+376zzF/+0meN03d5bVRfnrJNvX5komLNin7jfFZlto4PsYGXHu9mSb8VeSHo1oqJFdvY 1r6VN200P6bdahljznXoknJO48eJLT/L1t0s6Dd+LsmbH/nz8I18pc2BMt4+Vy/rCpqknNB7 8rrm6m6HjI93o72VWIozEg21mIuKEwETPcPxXQMAAA== X-CMS-MailID: 20201124120336eucas1p20710fdff8434428ea0f011b02249b8a8 X-Msg-Generator: CA X-RootMTR: 20201124120336eucas1p20710fdff8434428ea0f011b02249b8a8 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201124120336eucas1p20710fdff8434428ea0f011b02249b8a8 References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201124_070357_529362_BD5A0CA3 X-CRM114-Status: GOOD ( 24.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Szyprowski , =?utf-8?q?=C5=81ukasz_Stelm?= =?utf-8?q?ach?= , =?utf-8?q?Bart=C5=82omiej_=C5=BBo?= =?utf-8?q?lnierkiewicz?= Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 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 | 221 ++++ drivers/net/ethernet/asix/ax88796c_ioctl.h | 26 + drivers/net/ethernet/asix/ax88796c_main.c | 1132 +++++++++++++++++ drivers/net/ethernet/asix/ax88796c_main.h | 561 ++++++++ drivers/net/ethernet/asix/ax88796c_spi.c | 112 ++ drivers/net/ethernet/asix/ax88796c_spi.h | 69 + include/uapi/linux/ethtool.h | 1 + net/ethtool/common.c | 1 + 15 files changed, 2247 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