From patchwork Tue Apr 30 14:40:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Guido_G=C3=BCnther?= X-Patchwork-Id: 10923739 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 9445D92A for ; Tue, 30 Apr 2019 14:40:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83B6628B2D for ; Tue, 30 Apr 2019 14:40:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7794528B8D; Tue, 30 Apr 2019 14:40:36 +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=unavailable 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 4C6A228B7A for ; Tue, 30 Apr 2019 14:40: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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=hbRk++8AoRBmU2DMQsXsxm42x2DbvtriMlHC9ZCAghU=; b=gH4SBNdrwPEBhi kACgEpwX9DRSXgumVSOvz6qyYgEJLKlu7IfdOlaHbwwbvqaX5oS6qZPhBWsDeaifGvkkiUtPR17PP zREN7DxiCOqrrX0YFv7nQbmi9cH6+eOMcn+ufHruVDPto43qB9VUfES6T/yHz6+F5ahxwvYfstQkq 2WoCB1+Wy2mTxPiRZvQiP6qSI260Yozi5F4Bs0LCWpDb1UVtQrS3aPGD/6mjgjZgQ5RAs56loPV2P YnQangKAGJzv8+CGUDpjytRuGwWvRqBMyKCF6hNRfUlvBhJv5E61CNcoNVL7gg5ejAeYpH6rVVVaS 6yRFsvqRGY3yGa1JvCpg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hLTvu-0004kU-Ei; Tue, 30 Apr 2019 14:40:34 +0000 Received: from honk.sigxcpu.org ([24.134.29.49]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hLTve-0004Vh-CK for linux-arm-kernel@lists.infradead.org; Tue, 30 Apr 2019 14:40:20 +0000 Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id D653FFB03; Tue, 30 Apr 2019 16:40:15 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZxhPMDPfx7vw; Tue, 30 Apr 2019 16:40:12 +0200 (CEST) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id 5A6FE4027E; Tue, 30 Apr 2019 16:40:11 +0200 (CEST) From: =?utf-8?q?Guido_G=C3=BCnther?= To: Kishon Vijay Abraham I , Rob Herring , Mark Rutland , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Thierry Reding , =?utf-8?q?Andreas_F=C3=A4rber?= , Martin Blumenstingl , Heiko Stuebner , Johan Hovold , Lucas Stach , Abel Vesa , Li Jun , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, Robert Chiras , Sam Ravnborg , Maxime Ripard Subject: [PATCH v9 0/2] Mixel MIPI DPHY support for NXPs i.MX8 SOCs Date: Tue, 30 Apr 2019 16:40:09 +0200 Message-Id: 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-20190430_074018_731036_C48A96FE X-CRM114-Status: GOOD ( 14.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 This is basically a resend of v8 with one minor debug printk fixed and Rob's Reviewed-by for binding docs collteted. Thanks Rob! This adds initial support for the Mixel IP based mipi dphy as found on i.MX8 processors. It has support for the i.MX8MQ, support for other variants can be added - once the platform specific parts are in - via the provided devdata. The driver is somewhat based on what's found in NXPs BSP. Public documentation on the DPHY's registers is currently thin in the i.MX8 reference manuals (even on the i.MX8QXP form 11/18) so most of the values were taken from existing drivers. Newer NXP drivers have a bit more details so where possible the timings are calculated and validated. This was tested with an initial version of a NWL MIPI DSI host controller driver https://lists.freedesktop.org/archives/dri-devel/2019-March/209685.html and a forward ported DCSS driver on linux-next 20190408. Robert Chiras (the author of the corresponding driver in NXPs vendor tree) got this driver to work in his tree as well using mxsfb: https://www.spinics.net/lists/arm-kernel/msg711950.html Changes from v8 * Collect Reviewed-by from Rob Herring * Fix {hs,clk}_prepare vs {hs,clk}_zero debug print out Changes from v7 * As per review comments from Rob Herring * Use fsl, as vendor prefix * Drop changes to vendor-prefixes.txt due to that * Shorten mixel_dphy to dphy in the example * Fix an indentation error noticed by checkpatch that got introduced in v6 * Use lowercase letters in hex addresses in DT bindings example Changes from v6 * Depend on HAS_IOMEM (fixes a build problem on UM spotted by kbuild) Changes from v5 * Fix build problems on mips (spotted by the kbuild test robot) by using u32 consistently and long long for lp_t. Changes from v4 * Build by default on ARCH_MXC && ARM64 Changes form v3 * Check correct variable after devm_ioremap_resource * Add Robert Chiras as Co-authored-by since he's the author of the driver in NXPs BSP. Changes from v2 * As per review comments from Fabio Estevam * KConfig: select REGMAP_MMIO * Drop phy_read * Don't make phy_write inline * Remove duplicate debugging output * Comment style and typo fixes * Add #defines's for PLL lock timing values * Return correct error value when PLL fails to lock * Check error when enabling clock * Use devm_ioremap_resource * As per review comments from Robert Chiras * Deassert PD_DPHY after PLL lock (as per mixel ref manual) * Assert PD_{DPHY,PLL} before power on (as per mixel ref manual)manual * Add exit phy_op to reset CN/CM/CO Changes from v1 * As per review comments from Fabio Estevam * Kconfig: tristate mixel dphy support. * Drop unused 'ret' in mixel_dphy_ref_power_off. * Match values of DPHY_RXL{PRP,DRP} to those of https://source.codeaurora.org/external/imx/linux-imx/log/?h=imx_4.14.78_1.0.0_ga The previous values were based on 4.9. * Use resource size on devm_ioremap, we have that in dt already. * Use regmap so it's simple to dump the registers. * Use regmap_read_poll_timeout instead of open coded loop. * Add undocumented rxhs_settle register * As per review comments from Sam Ravnborg * Move driver to d/phy/freescale/ * Move SPDX-License-Identifier to top of file. * Drop '/* #define DEBUG 1 */'. * Use GPL-2.0+ since the vendor driver uses that as well. * Drop the mutex, register access is now protected by regmap. * Fix various style / indentation issues. * Check for register read, write and ioremap errors * Improve phy timing calculations * Use LP clock rate where sensible, check for errors * Use ad hoc forumulas for timings involving hs clock * Switch from dphy_ops to devdata. Other i.MX8 variants differ in register layout too * Add Mixel Inc to vendor-prefixes.txt To: Kishon Vijay Abraham I ,Rob Herring ,Mark Rutland ,Shawn Guo ,Sascha Hauer ,Pengutronix Kernel Team ,Fabio Estevam ,NXP Linux Team ,Thierry Reding ,"Andreas Färber" ,Martin Blumenstingl ,Heiko Stuebner ,Johan Hovold ,Lucas Stach ,Abel Vesa ,Li Jun ,linux-kernel@vger.kernel.org,devicetree@vger.kernel.org,linux-arm-kernel@lists.infradead.org,dri-devel@lists.freedesktop.org,Robert Chiras ,Sam Ravnborg ,Maxime Ripard Guido Günther (2): dt-bindings: phy: Add documentation for mixel dphy phy: Add driver for mixel mipi dphy found on NXP's i.MX8 SoCs .../bindings/phy/mixel,mipi-dsi-phy.txt | 29 + drivers/phy/freescale/Kconfig | 11 + drivers/phy/freescale/Makefile | 1 + .../phy/freescale/phy-fsl-imx8-mipi-dphy.c | 506 ++++++++++++++++++ 4 files changed, 547 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/mixel,mipi-dsi-phy.txt create mode 100644 drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c