From patchwork Wed Dec 2 21:47:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lukasz Stelmach X-Patchwork-Id: 11947233 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=-13.2 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 DA620C6369E for ; Wed, 2 Dec 2020 21:49:03 +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 6261B217A0 for ; Wed, 2 Dec 2020 21:49:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6261B217A0 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=LLStk5d8UhtXssnuMkNTYrsOGJ7G9cVu++5gJJOLTtM=; b=XSqvYRK4piMOQF+8ZILtXqGj7 ba9oNXM4U2nYXnvkuimhCQ4Zec7HTdPW+22IBqRLK6cXhuKppKexteeV5LZq+Qu5rgOf9cWq9z6nE cnMMK//FgT/zVmOuF1C0a+NKXgk64Q11COoSznFSnPKfUAe7a52165IAo1kGmJcLxn5kmY5ond96D wb8yt9jlbO+1G9lp8WxlbqP/OduhZyu6B6gl44mwUTfr9xd/tlGdfCOmcgcYKkQfEbdtKffmx+tiI +Dw7RfX4p/1O/2voc6lgffgK0K/Qij1/uG6n1cTsM8bVOH+SIpqB2AxFPgajeVMzKFrub1KwJG7hm AiJGbXiyw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kkZyW-0000Zd-GH; Wed, 02 Dec 2020 21:47:48 +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 1kkZyO-0000XE-31 for linux-arm-kernel@lists.infradead.org; Wed, 02 Dec 2020 21:47:42 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201202214722euoutp01fd3c94d7e4a85a6b09929727cfd4f8ee~NBIw68Q0R1738017380euoutp01X for ; Wed, 2 Dec 2020 21:47:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201202214722euoutp01fd3c94d7e4a85a6b09929727cfd4f8ee~NBIw68Q0R1738017380euoutp01X DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1606945642; bh=F4WpgkgZS9YZMduRIt/gpbIZzkvDXHrFXvAqW+afTyw=; h=From:To:Cc:Subject:Date:References:From; b=UCBYgksqlZtZcXS6s0e2LGC7gAjdJBrpCQ+aF3r6kMYaJLNvJi9OoCmQzvrSgvHEZ 73TQXe5B1JflCPX1fcBPlfsagSDos2/qOdhUc008SWV9QXpimzUkbxFYVkNc8t4D4p fkHg+Qn8eoPJZdUFoju4U3YNO+Z2Nocmr7wTeTeQ= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201202214712eucas1p17e1efbdfde2a82d87506b52e0e79ace5~NBInUWABK2962729627eucas1p1k; Wed, 2 Dec 2020 21:47:12 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 52.8C.27958.F5B08CF5; Wed, 2 Dec 2020 21:47:11 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201202214711eucas1p15c135e19e371890891c38dcf50c86eb2~NBImucwxm0134901349eucas1p1a; Wed, 2 Dec 2020 21:47:11 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201202214711eusmtrp28ee9c511dc25fa617ba59e3ca0d5ea33~NBImtmZvP2287322873eusmtrp2O; Wed, 2 Dec 2020 21:47:11 +0000 (GMT) X-AuditID: cbfec7f2-efdff70000006d36-f6-5fc80b5fd6ff Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 0E.2E.21957.F5B08CF5; Wed, 2 Dec 2020 21:47:11 +0000 (GMT) Received: from localhost (unknown [106.120.51.46]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201202214711eusmtip16a730c2e8365759d6c685d5b5c819215~NBImez5bY1804018040eusmtip1f; Wed, 2 Dec 2020 21:47:11 +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 v8 0/3] AX88796C SPI Ethernet Adapter Date: Wed, 2 Dec 2020 22:47:06 +0100 Message-Id: <20201202214709.16192-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+NgFrrAKsWRmVeSWpSXmKPExsWy7djPc7rx3CfiDe5us7A4f/cQs8XGGetZ Leacb2GxmH/kHKvFovczWC2uvb3DatH/+DWzxfnzG9gtLmzrY7W4eWgFo8Wmx9dYLS7vmsNm MeP8PiaLQ1P3MlqsPXKX3eLYAjGL1r1H2B0EPS5fu8jssWXlTSaPnbPusntsWtXJ5rF5Sb3H zh2fmTz6tqxi9Pi8SS6AI4rLJiU1J7MstUjfLoEr4/Oy22wFP1UrfrS9Ymtg3CLbxcjJISFg ItE+ZztzFyMXh5DACkaJX2dPs0E4Xxglzp1Zxg5SJSTwmVFi0psQmI7zW3ewQBQtZ5RYPfkJ K4TznFFi96xPYB1sAo4S/UtPgCVEBO4xS6xvf8AI4jAL7GOU2HlvCjNIlbCAqcSklu9gNouA qsTZw30sIDavgLVE27O1rBD75CXal29ng4gLSpyc+QSshl9AS2JN03UwmxmopnnrbLAvJAQW c0qcm7OSHaLZRaLn+WEWCFtY4tXxLVBxGYn/O+czdTFyANn1EpMnmUH09jBKbJvzA6reWuLO uV9sIDXMApoS63fpQ5Q7SixfmQ1h8knceCsIcQGfxKRt05khwrwSHW1CEDNUJNb174GaJyXR +2oFI4TtIfH/93b2CYyKs5D8NQvJL7MQ1i5gZF7FKJ5aWpybnlpsmJdarlecmFtcmpeul5yf u4kRmOhO/zv+aQfj3Fcf9Q4xMnEwHmKU4GBWEuFl+XckXog3JbGyKrUoP76oNCe1+BCjNAeL kjjvqtlr4oUE0hNLUrNTUwtS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icxSosn5wESRVxJvaGZgamhiZmlgamlmrCTOu3XumnghgfTEktTs1NSC 1CKYPiYOTqkGJuZllh3m88rf7pDc8uBoVOwT4Wt9ZWyC/2ddq/3CnyKfdipHb9Kn+fu3RX3g PxFT+Ghdj0k/d2vaQZeksttsP8VaxFZWX42Ov8FxLni7z9uYDBljk8y1/XMNFM7tldP1Enhk 1xh1qU8q4QirmjK78/nPGxVUvBvSSq7V6c9as2nB1uZ9qX8MZr1oyGqTWPggzs/5a87D/Vuj XvWteFRvGfJZVk8+7BjXL9XX/X2l+Qdvnotb1OC7g6ElNzTL/+23T0blT/e9PlP7h22dWEC2 6RaGZ+vOGrK29H1/vubwsrWHOMoW5kqFHgp+ZxLwwPHzzGXGd2+4rrKrPZFy8N8kOy/prt6L T1y/fZ63bltPqRJLcUaioRZzUXEiAKSeBmxcAwAA X-CMS-MailID: 20201202214711eucas1p15c135e19e371890891c38dcf50c86eb2 X-Msg-Generator: CA X-RootMTR: 20201202214711eucas1p15c135e19e371890891c38dcf50c86eb2 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201202214711eucas1p15c135e19e371890891c38dcf50c86eb2 References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201202_164740_543305_46E0ED71 X-CRM114-Status: GOOD ( 24.13 ) 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 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 | 221 ++++ drivers/net/ethernet/asix/ax88796c_ioctl.h | 26 + drivers/net/ethernet/asix/ax88796c_main.c | 1127 +++++++++++++++++ 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, 2242 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