Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2307620ybi; Thu, 20 Jun 2019 12:43:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqykTQdFDNJ7xUU9JD3d6nBDs5BvrrXo5fMsL8xefRTzmCJFHCm93/bxbmcuElFbzvtmRfvY X-Received: by 2002:a62:b503:: with SMTP id y3mr10292326pfe.4.1561059814806; Thu, 20 Jun 2019 12:43:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561059814; cv=none; d=google.com; s=arc-20160816; b=XmhZnjrRocKpHu7Jqlcuwsdh68yxAthZUUKsdWgPuFRQoiuysxYuv5BMclEEQqJUAO qIYtPw5Y4+xwDEsZp+fj1AyTW/cpWuVn+IHE6dL3OtWdbHbYKMbJtpzAXEL0ULyO1Hcv 0HrU87lb1SjF72j4BwixQxZVQJ3f/2tGbweCqfmI4bsjJndhvz3ZW5dVJ+n4A2YyxCXM Qs49Jxt9LQGjf3VmcLGySjkaRcYKNdD8lUQJJbitKEKLA/FtZgfeB7fiWz2QafWXAIQq dheMhsnce/OH/k5fnsNSsKeHpLsWpDHP22wHU4D7O9oYYrRQ2ny3V1k2/RJO8ogmjrI7 YftQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:to:from; bh=TDzUUgrfPFH01f6WAPxPe7smPcbIsLKKJuSJrZ0rRhQ=; b=CDzEIHYIQLOTMLMx4VfN1iqHlVVr6UMdxFIq8+N+wOoe7j7qWcI0IuWJ1k44JpsPZT CuX6bp5w7szMCEIj8vrNQxvkwTMvDRIrONIqG0utLTiPFuU9qbiTrD6GOjrvtqum/q/D xvW+GVWAamg06mYkHDkvFJbAJdvrX1FP07UQxbXeGNPsy2lmruvIfWKFnsBqhdBKjNy+ HJ5zgnVMOfxCdQ10UB19fiVGhy2kxU4hSmx0bmmrDVMzKrcBXBXxe4TEwbF06uNsEdVY oZqapI1bEMWgV7fchy6JRV4otXHR8pLHgJI99cSYWIcI+3AcmCAiGXmZ1eqagB7XWn2g NtWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v16si399167pfe.39.2019.06.20.12.43.19; Thu, 20 Jun 2019 12:43:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726839AbfFTTmt (ORCPT + 99 others); Thu, 20 Jun 2019 15:42:49 -0400 Received: from honk.sigxcpu.org ([24.134.29.49]:44536 "EHLO honk.sigxcpu.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726254AbfFTTmo (ORCPT ); Thu, 20 Jun 2019 15:42:44 -0400 Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id 42734FB03; Thu, 20 Jun 2019 21:42:42 +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 GYBZvfl4xjlP; Thu, 20 Jun 2019 21:42:38 +0200 (CEST) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id 24BA247322; Thu, 20 Jun 2019 21:42:38 +0200 (CEST) From: =?UTF-8?q?Guido=20G=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=20F=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 v12 0/2] Mixel MIPI DPHY support for NXPs i.MX8 SOCs Date: Thu, 20 Jun 2019 21:42:35 +0200 Message-Id: X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 the 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 20190617. 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 form v11 * as per review comments from Kishon Vijay Abraham I * Use a single line debug message to not trip up check patch Changes from v10 * Collect Reviewed-by: from Fabio Estevam * Collect Reviewed-by: from Sam Ravnborg * As per review comments from Sam Ravnborg * Terminate all dev_{dbg,err} with '\n' * Add more whitespace to CM/CN/CO macros * Drop another non-ascii symbol in a debug message Changes from v9 * As per review comments from Fabio Estevam * Sort includes alphabetically * Remove excessive new lines between functions * Drop error message on devm_ioremap_resource, handled by the core already. * Don't default to it on i.MX8 * As per review comments from Sam Ravnborg * Use clearer variablenames: struct regmap *regs -> regmap void __iomem *regs -> base * Use u32 for all parameters of get_best_ratio() * Don't use non-ascii symbols in debug message * Change MODULE_LICENSE to GPL * As per review comment from Andreas Färber * Change co-authored-by: to co-developed-by: * Collect Signed-off-by from Robert Chiras 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 | 10 + drivers/phy/freescale/Makefile | 1 + .../phy/freescale/phy-fsl-imx8-mipi-dphy.c | 497 ++++++++++++++++++ 4 files changed, 537 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 -- 2.20.1