From patchwork Wed Jul 31 12:21:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 11067647 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E1EF613A4 for ; Wed, 31 Jul 2019 12:22:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CECEC2885F for ; Wed, 31 Jul 2019 12:22:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C2EE7288EE; Wed, 31 Jul 2019 12:22:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 379912885F for ; Wed, 31 Jul 2019 12:22:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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:References: List-Owner; bh=AfAVZ1j3f0KMv7at19/n36+jAgoaXSqL5zn3IygEui0=; b=cjIPcQWrnWOcNg NH8xCXGZy8eAWTc8uLAftW9UahCvRvVCn2Z+RL5c1z7KmTjBhk9xO8ETVdCvrvV/a0d7uP6UCnNEW eNOGWVBALOZCcxbGDmZbXIvaGkuNyM07O0Y9tzvtK9I8kiMrEq5Xl9OAW9tv5X8+fN+R3qi0BYEbb /ugQDOeRclMum1ps1QLaYC/9CsphhsYUH25YJOIbb5u1VIfWLltUELMjlo0I1YfykvIlpkD8HSzry SGqW3mIe0DiFYj1do9cYQculIpjUwBK6GBFPvH4F0Iq7AJNjrDUmXGu/bGkzTPSPq36zkb2cRygkr ZGF1hJyoh3gFDB0vbfBA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hsnci-0003O9-DC; Wed, 31 Jul 2019 12:22:28 +0000 Received: from relay9-d.mail.gandi.net ([217.70.183.199]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hsnc2-0002aH-3T for linux-arm-kernel@lists.infradead.org; Wed, 31 Jul 2019 12:21:50 +0000 X-Originating-IP: 86.250.200.211 Received: from localhost.localdomain (lfbn-1-17395-211.w86-250.abo.wanadoo.fr [86.250.200.211]) (Authenticated sender: miquel.raynal@bootlin.com) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 01901FF807; Wed, 31 Jul 2019 12:21:28 +0000 (UTC) From: Miquel Raynal To: Gregory Clement , Jason Cooper , Andrew Lunn , Sebastian Hesselbarth , Kishon Vijay Abraham I Subject: [PATCH v3 00/19] Enhance CP110 COMPHY support Date: Wed, 31 Jul 2019 14:21:07 +0200 Message-Id: <20190731122126.3049-1-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190731_052146_865674_003BA7BC X-CRM114-Status: GOOD ( 15.08 ) 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: devicetree@vger.kernel.org, Antoine Tenart , Grzegorz Jaszczyk , Russell King , Maxime Chevallier , Nadav Haklai , Rob Herring , Thomas Petazzoni , Miquel Raynal , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Armada CP110 have a COMPHY IP which supports configuring SERDES lanes in one mode, either: - SATA - USB3 host - PCIe (several width) - Ethernet (several modes) As of today, only a few Ethernet modes are supported and the code is embedded in the Linux driver. A more complete COMPHY driver that can be used by both Linux and U-Boot is embedded in the firmware and can be run through SMC calls. First the current COMPHY driver is updated to use SMC calls but fallbacks to the already existing functions if the firmware is not up-to-date. Then, more Ethernet modes are added (through SMC calls only). SATA, USB3H and PCIe modes are also supported one by one. There is one subtle difference with the PCIe functions: we must tell the firmware the number of lanes to configure (x1, x2 or x4). This parameter depends on the number of entries in the 'phys' property describing the PCIe PHY. We use the "submode" parameter of the generic PHY API to carry this value. The Armada-8k PCIe driver has been updated to follow this idea and this change has been merged already: http://patchwork.ozlabs.org/patch/1072763/ Thanks, Miquèl Changes since v2: ----------------- * Inverted two arguments in a trace. * Avoid warning the user when EPROBE_DEFER is returned (clocks case). * Added Maxime C. and Grzegorz J. 's Tested-by tags (only on the "introducing SMC calls" patch, but they tested the whole series). * Added Rob's Reviewed-by on the bindings. * Also updated the bindings as suggested by Rob to reflect that there can be from one to four PHYs in the PCIe nodes (hence, the need for the phy-names property). Changes since v1: ----------------- * All modes report their errors to the user. * If the firmware is too old, advise the user to update it. * Credit Grzegorz for his work. * Fix wrong speed in Ethernet modes. * Add COMPHY necessary clocks. * Update bindings. * The security flaw related to the fact that we must give the CP address to the firmware has been mitigated by the addition of extra checks in ATF recently. Grzegorz Jaszczyk (5): phy: mvebu-cp110-comphy: Add SMC call support phy: mvebu-cp110-comphy: Add RXAUI support phy: mvebu-cp110-comphy: Add USB3 host/device support phy: mvebu-cp110-comphy: Add SATA support phy: mvebu-cp110-comphy: Add PCIe support Miquel Raynal (14): phy: mvebu-cp110-comphy: Add clocks support phy: mvebu-cp110-comphy: Explicitly initialize the lane submode phy: mvebu-cp110-comphy: List already supported Ethernet modes phy: mvebu-cp110-comphy: Rename the macro handling only Ethernet modes phy: mvebu-cp110-comphy: Allow non-Ethernet modes to be configured phy: mvebu-cp110-comphy: Cosmetic change in a helper phy: mvebu-cp110-comphy: Update comment about powering off all lanes at boot dt-bindings: phy: Add Marvell COMPHY clocks dt-bindings: pci: add PHY properties to Armada 7K/8K controller bindings arm64: dts: marvell: Add CP110 COMPHY clocks arm64: dts: marvell: Add 7k/8k per-port PHYs in SATA nodes arm64: dts: marvell: Add 7k/8k PHYs in USB3 nodes arm64: dts: marvell: Add 7k/8k PHYs in PCIe nodes arm64: dts: marvell: Convert 7k/8k usb-phy properties to phy-supply .../devicetree/bindings/pci/pci-armada8k.txt | 6 + .../bindings/phy/phy-mvebu-comphy.txt | 10 + .../arm64/boot/dts/marvell/armada-7040-db.dts | 37 +- .../marvell/armada-8040-clearfog-gt-8k.dts | 22 +- .../arm64/boot/dts/marvell/armada-8040-db.dts | 43 +- .../boot/dts/marvell/armada-8040-mcbin.dtsi | 38 +- arch/arm64/boot/dts/marvell/armada-cp110.dtsi | 13 + drivers/phy/marvell/phy-mvebu-cp110-comphy.c | 412 +++++++++++++++--- 8 files changed, 499 insertions(+), 82 deletions(-)