From patchwork Wed Oct 28 21:40:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lukasz Stelmach X-Patchwork-Id: 311051 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.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 4939EC388F7 for ; Thu, 29 Oct 2020 02:04:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E6B1F208C3 for ; Thu, 29 Oct 2020 02:04:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="DStvbDMd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727266AbgJ1Vky (ORCPT ); Wed, 28 Oct 2020 17:40:54 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:60059 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727274AbgJ1Vkw (ORCPT ); Wed, 28 Oct 2020 17:40:52 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20201028214029euoutp02403cf76b461d86c32416cbdce3f8f76e~CRdw4ilPC0334203342euoutp02R for ; Wed, 28 Oct 2020 21:40:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20201028214029euoutp02403cf76b461d86c32416cbdce3f8f76e~CRdw4ilPC0334203342euoutp02R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1603921229; bh=wGXPKJVb69pqXKx2ZIgRaFvmKeW6gzHu0+eGvJQYRIQ=; h=From:To:Cc:Subject:Date:References:From; b=DStvbDMdFn1CC16wNBuUKgxy5ljQrBBdVp9n6GntBNflNxDQhI/FUoTPY3uS9Bqc6 2TEWQnCx/26p6anb2TPmz79XtC4jrImbCclOGN5SXZ/LzGcnJfrfuSACV7nHvEoo7A zxbQ/wmWtJijtauurYUs3LlNhIKE7tK92aWVe2E0= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201028214018eucas1p1c7366cff1bed104e95a7926d5941091f~CRdm-pLh_2052320523eucas1p1V; Wed, 28 Oct 2020 21:40:18 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id F0.8F.06456.245E99F5; Wed, 28 Oct 2020 21:40:18 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20201028214017eucas1p21a93b489acce80ff8a2fd1adfc9c1649~CRdl0RlxO2075420754eucas1p2h; Wed, 28 Oct 2020 21:40:17 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201028214017eusmtrp20aa630ac5af1f94ca829c4a5eea6a5f4~CRdlzgVSt3218532185eusmtrp2i; Wed, 28 Oct 2020 21:40:17 +0000 (GMT) X-AuditID: cbfec7f2-7efff70000001938-fd-5f99e5425717 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 5F.8E.06314.F35E99F5; Wed, 28 Oct 2020 21:40:15 +0000 (GMT) Received: from localhost (unknown [106.120.51.46]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20201028214015eusmtip23525b6aea39a22a94207c9a0fa86248f~CRdkAn-cQ2585225852eusmtip2c; Wed, 28 Oct 2020 21:40:15 +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_St?= =?utf-8?q?elmach?= Subject: [PATCH v4 0/5] AX88796C SPI Ethernet Adapter Date: Wed, 28 Oct 2020 22:40:07 +0100 Message-Id: <20201028214012.9712-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: H4sIAAAAAAAAA02SfUhTYRTGe3fv3W7W9LosDxqTRl8KatIHb5+kFlyhP6IgIrA128UiN2PL WkVallnit6bbFAyztJEfrbWapsQyy0qnraxMK1IJFftaSSpZbtfI/55zzu95z3PgpQnJeyqA Pqg+wmnUigSZ0Iu0tow5QqMGDPIVDbmh2NFrJ/BNfS2FSx3nSFzW3E7h8i96CneN9FA4p2+Y wA5HnQh3WLMp/MZehbC5r4vCzvpSIdY7mgTYfqkR4ermXhFuubwApzU2izb7ss6uToK1XH8j YG3GXhFrNl0UsrcqUljbXZeAzbaYEOsyS7fTe7w2KLmEg0c5TfimfV4HJrvT0OFRqa4mtwKd RgbIQLNpYFZBd/VnQQbyoiVMFYIrdWkEX/xAMDBYJOILFwLLnfvon8VkMlD8oBJBY8vEtOUT gsmLDyg3JWQiIefqYw/lx7wjoDb9A3IXBNOEwPaukHBT85jVUFNZT7o1ySyBlx15Hi1m1oFl Yp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WNF0Ha2UGKm/eOpt5AqPALCQdsxA6ZiGpWsDIvIpRJLW0ODc9t9hQ rzgxt7g0L10vOT93EyMwTrcd+7l5B+OljcGHGAU4GJV4eC/cnhkvxJpYVlyZe4hRgoNZSYTX 6ezpOCHelMTKqtSi/Pii0pzU4kOMpkDvTGSWEk3OB6aQvJJ4Q1NDcwtLQ3Njc2MzCyVx3g6B gzFCAumJJanZqakFqUUwfUwcnFINjE2TPKslrVliNjNcshXbts3xpH3z/xULjm32s14u61qS 1TxlxVfOVctFlnWd8BT+9OTZ9i0BTU7bN0Z89vji2LDn3dUJW5f9DVJxqPZh3xX+wGFH0JsP h2U+VwScuF3HM5sjiMFp3j2Gjz/Kxfk/9/PvZJmsFnPrYdCf3SGnz/za7V11/9/rO5ZKLMUZ iYZazEXFiQBr3XV56QIAAA== X-CMS-MailID: 20201028214017eucas1p21a93b489acce80ff8a2fd1adfc9c1649 X-Msg-Generator: CA X-RootMTR: 20201028214017eucas1p21a93b489acce80ff8a2fd1adfc9c1649 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201028214017eucas1p21a93b489acce80ff8a2fd1adfc9c1649 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 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 | 69 + .../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 | 22 + drivers/net/ethernet/asix/Makefile | 6 + drivers/net/ethernet/asix/ax88796c_ioctl.c | 197 +++ drivers/net/ethernet/asix/ax88796c_ioctl.h | 26 + drivers/net/ethernet/asix/ax88796c_main.c | 1144 +++++++++++++++++ drivers/net/ethernet/asix/ax88796c_main.h | 578 +++++++++ drivers/net/ethernet/asix/ax88796c_spi.c | 111 ++ drivers/net/ethernet/asix/ax88796c_spi.h | 69 + 16 files changed, 2265 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