From patchwork Thu Dec 17 11:53: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: 11979647 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 412D5C2BB48 for ; Thu, 17 Dec 2020 11:55:31 +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 DAD64238E5 for ; Thu, 17 Dec 2020 11:55:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DAD64238E5 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=J4b9HcFwB7tkqgccLivc5RLAqyv+81kMsDXWVRGRidQ=; b=uePuq7H7S1XXYjZPknuRwyQwj WqvMh6zZWSoggQp4CrnlOQReuo9eDBxfgGYjIcXyQkaiT3UYAtIs+uyN3fblyLVGFsXeIac81i5af C8Y7J+3blBFwWHIG8F7/OZWIsfRzSc4y+3q+XasorAQNSlNsqYG4auFqJLdF/4+kCZCY65Rj5H4Eu A2r8VAwW2oHZnazLDoMuHpJ8DUt8P2oRe93xcsOr9ZwYvnddk8cKq92+AhgXUjk6tizTr+1qXPOQy 1VNbNuCLhC894VG/o2ts7BiI+tveNzzIhLjGyAiHNVV0eu4l2cIZitzKz9ImvuHzYyvlY23gi0DDw rqr3Elz1A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kprrI-0002JH-2t; Thu, 17 Dec 2020 11:54:12 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kprr9-0002I8-H9 for linux-arm-kernel@lists.infradead.org; Thu, 17 Dec 2020 11:54:05 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20201217115347euoutp0245203270e0dd15391f19836b927e3599~RftyOzb3r1026610266euoutp02G for ; Thu, 17 Dec 2020 11:53:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20201217115347euoutp0245203270e0dd15391f19836b927e3599~RftyOzb3r1026610266euoutp02G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1608206027; bh=4D2ygLyKzRgVS3qMV6DdZglnSQ/S2hR8DaD1xUTXRi4=; h=From:To:Cc:Subject:Date:References:From; b=cZfDTpSjhffRhm3UATDRD3DR+c6JS1p48bYE/77/wq0aL+QQu+SBPENWyrmGTEROi weD5weeeQbd1F4fPzrKN/jNy0P0YAvLgna2xVCDu7O0XuJXMQEK0CwKwTthC8qVBhZ zE7EF9wA10OvFkhiJLf+L5MFaaE7gBLJaJweeovU= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201217115342eucas1p1d5d62b7427344c38dbfb412eefe110fe~RfttPt56a2472224722eucas1p1p; Thu, 17 Dec 2020 11:53:42 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id E3.9D.45488.6C64BDF5; Thu, 17 Dec 2020 11:53:42 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201217115341eucas1p11b7d1ffe89f9411223523eb5b5da170a~RftsvOzBf2279122791eucas1p14; Thu, 17 Dec 2020 11:53:41 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20201217115341eusmtrp15bdad5cf09e0acf0a90e16fc45493a28~RftsuYjNc2059420594eusmtrp1z; Thu, 17 Dec 2020 11:53:41 +0000 (GMT) X-AuditID: cbfec7f5-c5fff7000000b1b0-bb-5fdb46c6060a Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 56.A7.21957.5C64BDF5; Thu, 17 Dec 2020 11:53:41 +0000 (GMT) Received: from localhost (unknown [106.120.51.46]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201217115341eusmtip18f3cfb9d9d963a0a62be134aeccd8147~Rftsfwbxv2868728687eusmtip1b; Thu, 17 Dec 2020 11:53:41 +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 v9 0/3] AX88796C SPI Ethernet Adapter Date: Thu, 17 Dec 2020 12:53:27 +0100 Message-Id: <20201217115330.28431-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+NgFrrIKsWRmVeSWpSXmKPExsWy7djP87rH3G7HG9xqFbQ4f/cQs8XGGetZ Leacb2GxmH/kHKvFovczWC2uvb3DatH/+DWzxfnzG9gtLmzrY7W4eWgFo8Wmx9dYLS7vmsNm MeP8PiaLQ1P3MlqsPXKX3eLYAjGL1r1H2B0EPS5fu8jssWXlTSaPnbPusntsWtXJ5rF5Sb3H zh2fmTz6tqxi9Pi8SS6AI4rLJiU1J7MstUjfLoErY99SsYLNWhWrrraxNjD+Uehi5OSQEDCR uPRgG1sXIxeHkMAKRolnN48yQzhfGCXe/F0JlfnMKDHr6QMWmJb7TxexQiSWM0rcf76HEcJ5 zijx8x2Iw8nBJuAo0b/0BFiViMA9Zon17Q/AqpgF9jFK7Lw3hRmkSljAVOLhr/+sIDaLgKrE owubwHbwClhL7D5+gwlin7xE+/LtbBBxQYmTM5+A1fALaEmsaboOZjMD1TRvnQ12uYTAYk6J Kz9/M0M0u0js/g7RLCEgLPHq+BZ2CFtG4vTkHqBmDiC7XmLyJDOI3h5GiW1zfkA9ai1x59wv NpAaZgFNifW79CHCjhInd/9jgmjlk7jxVhDiBD6JSdumM0OEeSU62oQgqlUk1vXvgRooJdH7 agUjhO0hsXLtf+YJjIqzkDw2C8kzsxD2LmBkXsUonlpanJueWmycl1quV5yYW1yal66XnJ+7 iRGY6k7/O/51B+OKVx/1DjEycTAeYpTgYFYS4U04cDNeiDclsbIqtSg/vqg0J7X4EKM0B4uS OO+urWvihQTSE0tSs1NTC1KLYLJMHJxSDUzV97btnFeyweGd7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l8YZmBqaGJmaWBqaWZsZK4rxb566JFxJITyxJzU5NLUgt gulj4uCUamDameDnWH3i0O56N76dsnO8bt3gcSt5X/p2f0FRrYr3Tq2Q3wnuvyc/dJU4EqvL fG/v09zkgt9xL+QEUzlkq6o/fVsuyWW7zf52fF+Dd+GSk5sOJYY9TeuxifqY/HfxZ5mrzotk pF4/j1Hoty1JXV6xs7t2/rPZRTLCn+4UMEn3Pfzu8u5l/MpFzKWtZ7sDtNlOHnN6fO+B1dYC dmbBCDbV19fF5lttregqDLqjcH39n8LwyKDX7yZPDlvNeWiB0cv/M1jP32yN36j4qZRHYu55 rw3FJaXJtVEfnu3V6p7rbblv+kWWS55WxVMNPGa035ReKj+1/cbLSC6rcz9Pf/Hrl+Dr5jae KLJgrb6ExF0lluKMREMt5qLiRACpdZ35XAMAAA== X-CMS-MailID: 20201217115341eucas1p11b7d1ffe89f9411223523eb5b5da170a X-Msg-Generator: CA X-RootMTR: 20201217115341eucas1p11b7d1ffe89f9411223523eb5b5da170a X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201217115341eucas1p11b7d1ffe89f9411223523eb5b5da170a References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201217_065403_776606_98662B21 X-CRM114-Status: GOOD ( 25.38 ) 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 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 | 1105 +++++++++++++++++ drivers/net/ethernet/asix/ax88796c_main.h | 558 +++++++++ drivers/net/ethernet/asix/ax88796c_spi.c | 115 ++ drivers/net/ethernet/asix/ax88796c_spi.h | 69 + 13 files changed, 2236 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