From patchwork Tue Nov 3 15:15:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lukasz Stelmach X-Patchwork-Id: 11878005 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=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=no 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 C8F70C2D0A3 for ; Tue, 3 Nov 2020 15:17:02 +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 3828920735 for ; Tue, 3 Nov 2020 15:17:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LGnHjw6b"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="aiOk7NtN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3828920735 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=REvZi0SxDMSF3B4HMuXL8b014OQ6bv4f5DHCJkHHlvE=; b=LGnHjw6bz7eCUJhFyQ6D8/7ZR 6Qn4XCnuEtZ/FejVV83O8h9n3Dzhdmoi6qSN7Ego/RnKPwwubgvxwaHdCLDLnkZ0ljWpnmMOwl95q Vr/WRRwo/Qp0Qs8IbwXh3BStl8f+08TnxCBRONNFugnAe7BlMbmzjNwA33uEawxn0XUjUJv1MpqZO VEh1vUDKWEusUK+dpSOuKwz1GwLxaboa9r/q24yBW0uAAnJ1i6qvcDmYTdOlsVlQgMTHzzJhuFf5B fBH2pIzqE+0G4Gzi5McJl3yaKREusUGeTsOXOW75nWhRpiZ7YzEOmggSClUZIxz3OogP318Vr8/AH bJC2Ir+Ew==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZy2u-0006tj-Cy; Tue, 03 Nov 2020 15:16:28 +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 1kZy2V-0006nZ-8A for linux-arm-kernel@lists.infradead.org; Tue, 03 Nov 2020 15:16:09 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201103151547euoutp019cd7c7160ae35ae9ac5a7ba5261d60bf~ECFlq0zkw1982319823euoutp01L for ; Tue, 3 Nov 2020 15:15:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201103151547euoutp019cd7c7160ae35ae9ac5a7ba5261d60bf~ECFlq0zkw1982319823euoutp01L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1604416547; bh=ZTba4AdOdPYDi8vp/FOZDz4jSiA/NsyY2ZVYuq+hr7Y=; h=From:To:Cc:Subject:Date:References:From; b=aiOk7NtNBnEk40ebb1TWKP0kqam6ump9r0oT/dTDEDLZZd7ukP8EioR0EqRkeLSKU nEeJTjfxj3OFgzhUgxwZqHpZHtjYBV+C2sk7V/0cZ9rw1WSZqN6WpIGlmg83Jjp5de 3zR2cC/u7fqAmqPW7DTjbVeD2RW2pfZLKtkjMmeQ= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20201103151539eucas1p2a2bbb79dc79d75f19dae42bd2ec83e62~ECFeHxH2l2454424544eucas1p2F; Tue, 3 Nov 2020 15:15:39 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 7A.BB.06456.B1471AF5; Tue, 3 Nov 2020 15:15:39 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20201103151538eucas1p2682c895caedc83638c9a99e7f307e42b~ECFdth0NI3058530585eucas1p2x; Tue, 3 Nov 2020 15:15:38 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201103151538eusmtrp2c9ae7f00da49232c784f957f88b735e8~ECFdssTMG0549405494eusmtrp2e; Tue, 3 Nov 2020 15:15:38 +0000 (GMT) X-AuditID: cbfec7f2-7efff70000001938-3b-5fa1741b3422 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 0E.8D.06017.A1471AF5; Tue, 3 Nov 2020 15:15:38 +0000 (GMT) Received: from localhost (unknown [106.120.51.46]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201103151538eusmtip11380aae5dc705f13cbd7f4fea160e325~ECFdiKCUV0103701037eusmtip1O; Tue, 3 Nov 2020 15:15:38 +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 v5 0/5] AX88796C SPI Ethernet Adapter Date: Tue, 3 Nov 2020 16:15:31 +0100 Message-Id: <20201103151536.26472-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: H4sIAAAAAAAAA01SWUwTURTldWY6Q7U4jI3eAEJsahSi4s6LKCDRZD4w0fhhggsWmODCZgso +sGmrRKhFlkrUdwC1gWoWAEBY4O4oFQFUVTcUIkIMYoYxLhQpkT+zj33nHfOTR5DcK8pD2ZH fJKgiVfHKqUy0trys22eZ9KpiAX6x67Y3m0jcHVxJYVL7QdIfLK5jcKnvxRTuHPgJYUNPZ8J bLdX0fihNZfCXbYKhC09nRRury+V4mJ7kwTbChoRvtTcTeOWsmn4YGMzHeLOt3c+Ivia810S vs7UTfMW82Epf+VsGl9XOyjhc2vMiB+0eK9jwmUrooXYHSmCxj9om2x7QWsLnVit2ntDN0Km o0KvbOTKALsEWnqvSrKRjOHYCgRVb384h+8IdCcyaHEYRPDk11c0bhka0kvFRTmC9udfnJZe BFn3+0mHSsquAsO5O5RjoWBfEVCpf4McA8E2Iah7lU84VFPZpdBrbKIdmGRnwXWTcYyXs4Hw 4mYJKeb5gL78mlTk3eFuyfsxfgrrBxczn45hYlSTdfU44QgA9icNw+YMp3k1GNPtzuJToe92 DS1iL/hbd3K0NzOK0+BY3jLRewSBtXTY6Q2El20jUoeGYH2hst5fpFfBBVMOKVrd4NmAu1jB DfKsRYRIy+GQjhPVKrhsaHA+6AE5fRXOMjzYDb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emcgsJZqcD0wheSXxhqaG5haWhubG5sZmFkrivB0C B2OEBNITS1KzU1MLUotg+pg4OKUaGNfpKD/+ciq187bsevFJ4tlrL2XvdzgZeJb1tbPRuVVP r7xa2NzHv3nhzQL/8g0bLi1r4gzZsK7t46/f1nnb47v6jaWluFgM2BtNhb92RGYdW7BB7Vtd +RHFylf+D/XO1s3b0Obyt2zr1ZLSVWkJa3mNTWd84uu6W32yJWtjZ/96i4OTZX20ApVYijMS DbWYi4oTAVJOnwHpAgAA X-CMS-MailID: 20201103151538eucas1p2682c895caedc83638c9a99e7f307e42b X-Msg-Generator: CA X-RootMTR: 20201103151538eucas1p2682c895caedc83638c9a99e7f307e42b X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201103151538eucas1p2682c895caedc83638c9a99e7f307e42b References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201103_101603_543183_634E292E X-CRM114-Status: GOOD ( 22.76 ) 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 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 (5): 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 ARM: dts: exynos: Add Ethernet to Artik 5 board ARM: defconfig: Enable ax88796c driver .../bindings/net/asix,ax88796c.yaml | 73 ++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + MAINTAINERS | 6 + arch/arm/boot/dts/exynos3250-artik5-eval.dts | 29 + arch/arm/configs/exynos_defconfig | 2 + arch/arm/configs/multi_v7_defconfig | 2 + 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 | 235 ++++ 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 | 109 ++ drivers/net/ethernet/asix/ax88796c_spi.h | 70 + include/uapi/linux/ethtool.h | 1 + net/ethtool/common.c | 1 + 18 files changed, 2292 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