From patchwork Thu Nov 12 11:51:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lukasz Stelmach X-Patchwork-Id: 11899805 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1C183697 for ; Thu, 12 Nov 2020 11:51:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DE49C22228 for ; Thu, 12 Nov 2020 11:51:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="V2GcAWEp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728217AbgKLLvf (ORCPT ); Thu, 12 Nov 2020 06:51:35 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:42315 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728115AbgKLLvZ (ORCPT ); Thu, 12 Nov 2020 06:51:25 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20201112115113euoutp029bd0c91aa66110a999c60ef101a99d30~GwGjYevJV2676326763euoutp02D for ; Thu, 12 Nov 2020 11:51:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20201112115113euoutp029bd0c91aa66110a999c60ef101a99d30~GwGjYevJV2676326763euoutp02D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1605181873; bh=Nr1kBMcXOOnVTauNxdoaW0t2tbm/z4Kaq30A0/2CSuA=; h=From:To:Cc:Subject:Date:References:From; b=V2GcAWEpoxlA1iw8kesKYrSQaZyo37MrCL/0LvOIqkakddDp/XJfztHFCWC5KWqwR P64oLFTLEJ/BXef1spYjJwr8tr+dFmMLcjbwJZxZD/jeWBw2B/SNTCEqAPAtEWGS7f u3R3BSvm/gBAg8noGzUBq9DEYStgLe50+a3sPwWM= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201112115108eucas1p1371c75403afdaec70ea4f3481de719a8~GwGeWGcmC1142211422eucas1p12; Thu, 12 Nov 2020 11:51:08 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 24.EF.45488.CA12DAF5; Thu, 12 Nov 2020 11:51:08 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201112115107eucas1p1abe7589e6caffc579c22d39395f1efa0~GwGd6ODLg1142611426eucas1p1g; Thu, 12 Nov 2020 11:51:07 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20201112115107eusmtrp1ebb1b52f58c9afc2c19323d2c89a6f93~GwGd5Q8En1853418534eusmtrp1H; Thu, 12 Nov 2020 11:51:07 +0000 (GMT) X-AuditID: cbfec7f5-c77ff7000000b1b0-c2-5fad21ac303a Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id DF.A7.16282.BA12DAF5; Thu, 12 Nov 2020 11:51:07 +0000 (GMT) Received: from localhost (unknown [106.120.51.46]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20201112115107eusmtip22400c01805f616fa3f7272a32760a950~GwGdoaLco1181211812eusmtip2k; Thu, 12 Nov 2020 11:51:07 +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 v6 0/5] AX88796C SPI Ethernet Adapter Date: Thu, 12 Nov 2020 12:51:01 +0100 Message-Id: <20201112115106.16224-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+NgFjrPKsWRmVeSWpSXmKPExsWy7djPc7prFNfGG3xcx2dx/u4hZouNM9az Wsw538JiMf/IOVaLRe9nsFpce3uH1aL/8Wtmi/PnN7BbXNjWx2px89AKRotNj6+xWlzeNYfN Ysb5fUwWh6buZbRYe+Quu8WxBWIWrXuPsDsIely+dpHZY8vKm0weO2fdZffYtKqTzWPzknqP nTs+M3n0bVnF6PF5k1wARxSXTUpqTmZZapG+XQJXRtfdY0wFO1QrDs66xdTA+Femi5GTQ0LA RGLulvlsXYxcHEICKxglWvfNYoVwvjBKHFuxjR3C+cwocffJYSCHA6zlU78RRHw5o8S2lduh Op4zSvx+9ooRZC6bgKNE/9ITYAkRgXvMEuvbHzCCOMwC+xgldt6bwgxSJSxgKtG9aBITiM0i oCrRuuYhWDevgLXEj1mzWSEulJdoX76dDSIuKHFy5hMWEJtfQEtiTdN1MJsZqKZ562xmkAUS Aos5JZ7uXcQCcauLROucYog5whKvjm9hh7BlJE5P7oEqqZeYPMkMorUH6J05P1ggaqwl7pz7 xQZSwyygKbF+lz5E2FHi0ooXzBCtfBI33gpCXMAnMWnbdKgwr0RHmxBEtYrEuv49UAOlJHpf rWCEKPGQ6HjgMYFRcRaSt2YheWUWwtoFjMyrGMVTS4tz01OLjfNSy/WKE3OLS/PS9ZLzczcx AtPc6X/Hv+5gXPHqo94hRiYOxkOMEhzMSiK8yg5r4o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OxhXvvqod4iRiYPxEKMEB7OSCK+yw5p4Id6UxMqq1KL8 +KLSnNTiQ4ymQB9MZJYSTc4HJoq8knhDMwNTQxMzSwNTSzNjJXFekyNATQLpiSWp2ampBalF MH1MHJxSDUxZJ8Mm57v/WPNNVPOA+rnPL5KfB6x7Wm2Qd/f3xsVKs3/vXfMmfeoSVt7g7nsK jqZ8Su07svYd22EsZ/m7pHC9fWWSZ/tRF/WrHw6tO97Rsqd17adW06xApelBUU/8Fro/CGFL zKlubduzj+nNrtTiBS85KmO36n9oZ5lrL8DF4Z3qZftrSeod5fWvdHM6NXLeXLWM1YheZCxz Yv18BRNtoyP/TxjG/jWcs/hv8ZvdLB9FbT3b5oXYJJZeOGeXWub2/vPKX40/nqX9uPNKO/hD pO/zBY57Vl/QrTm0UappSuoX6Zvd376Yzp8mOHXVFR/BxtNh1stdWLT/m0//PJ3dZKLT5bii 2c+vHEn2/7RaiaU4I9FQi7moOBEAXVqGQFwDAAA= X-CMS-MailID: 20201112115107eucas1p1abe7589e6caffc579c22d39395f1efa0 X-Msg-Generator: CA X-RootMTR: 20201112115107eucas1p1abe7589e6caffc579c22d39395f1efa0 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201112115107eucas1p1abe7589e6caffc579c22d39395f1efa0 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 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 (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 | 237 ++++ 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, 2294 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