From patchwork Fri Jan 12 20:12:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 10161605 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 94DCC602D8 for ; Fri, 12 Jan 2018 20:15:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84B9E28A1E for ; Fri, 12 Jan 2018 20:15:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7929F28A8F; Fri, 12 Jan 2018 20:15:58 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 37F1028A1E for ; Fri, 12 Jan 2018 20:15:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9B1DD6E956; Fri, 12 Jan 2018 20:15:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 34CF76E956 for ; Fri, 12 Jan 2018 20:15:54 +0000 (UTC) Received: by mail-lf0-x241.google.com with SMTP id g72so1699208lfg.5 for ; Fri, 12 Jan 2018 12:15:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:user-agent:date:to:cc:subject:mime-version :content-disposition; bh=U++TbgcK0R46wj/pLcxzKc2HId8462l83Cgh5Lj23NM=; b=13ViukaIsNHeH1Q9rbs3y9M5LrRNZXeuoCSJftWa0mxfVp2+BrzUZFxl/u4t+alhNR u1a6pZHzIf7w8OaoQEBZ8/eNqGUXWuRIuhHxoaeDhjcCP3iVZ8KL3dmBz0Gu8luDhUNx +bnMYHW1q4Kyr1CHd9Nammjl94eKGQYIfnmQhr0Wcr3wMC2K7nAS/A5HcrqL944CusYx +OAkf6fucS3qU/HeCktSbApixwoBSbDiKJyNgY+ry8Gy/A//0uIM8bswQQ02v16Sc2ge +LlBBO07mAFdENLXwlcVzXw8zGWz69kwUAZYrBQLHQPx9jD4HyL35stvS5UVpMfDcRLr oV3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:user-agent:date:to:cc:subject :mime-version:content-disposition; bh=U++TbgcK0R46wj/pLcxzKc2HId8462l83Cgh5Lj23NM=; b=oXH+35Rsj4eAC4E31RdzNw+SyAsOTg0KivItwPoMD/S/8U7MZ9KihJuHCdHCsJSYXG mCmOSDpFotFW0A/+pOudYUr4qTnhTsQw4mmJw90maM1dlKOL2l3YYtYfmTzKks9ov2y3 VQIQD9KZI5Jksk0pUnmIeZdkg6cedu7QoFSqYKABwdY0kc3HbRJRC+OMUX/fCIMG4xxp 494sLD9jrG95xZXm9YACRWSRSdwB5qXP4hijsLw8YgbhkEe2xqljvtcuiZZRi4iKk1PV OKGEynI/Cs9KmhBIfdw7BQa9knob1zO2CRIA4EVlQ8UmfLQhJ6ZoaCn4Of0On6V8lamm boqA== X-Gm-Message-State: AKwxyteZXpusKna0J3bHdss+eRztBNTi6wpN8540IZiYaYl2Z9mLzRtn 06DnFxwkZBtGu+xuC5VAD+fsIVUVs7o= X-Google-Smtp-Source: ACJfBotmSeLrF+itWCjSwnQRgXolqRb90r/hyWQW1cUxdxVw7yczOYkMFTLHziFjM5/CMSkau/OmGg== X-Received: by 10.25.227.5 with SMTP id a5mr11561511lfh.51.1515788153381; Fri, 12 Jan 2018 12:15:53 -0800 (PST) Received: from wasted.cogentembedded.com ([31.173.80.187]) by smtp.gmail.com with ESMTPSA id v207sm3904205lfa.3.2018.01.12.12.15.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jan 2018 12:15:52 -0800 (PST) From: Sergei Shtylyov X-Google-Original-From: "Sergei Shtylyov" Received: by wasted.cogentembedded.com (sSMTP sendmail emulation); Fri, 12 Jan 2018 23:15:50 +0300 Message-Id: <20180112201550.368547609@cogentembedded.com> User-Agent: quilt/0.64 Date: Fri, 12 Jan 2018 23:12:04 +0300 To: Laurent Pinchart , David Airlie , dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH 1/2] drm: rcar-du: lvds: fix LVDS startup on R-Car gen3 MIME-Version: 1.0 Content-Disposition: inline; filename=drm-rcar-du-lvds-fix-LVDS-startup-on-R-Car-gen3.patch Cc: Sergei Shtylyov X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP According to the latest revisions of the R-Car gen3 manual, the LVDS mode must be set before the LVDS I/O pins are enabled, not after -- fix the gen3 LVDS startup sequence accordingly... While at it, also fix the comment preceding the first LVDCR0 write in the R-Car gen2 startup code that still talks about hardcoding the LVDS mode 0... Fixes: e947eccbeba4 ("drm: rcar-du: Add support for LVDS mode selection") Signed-off-by: Sergei Shtylyov --- drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) Index: linux/drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c =================================================================== --- linux.orig/drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c +++ linux/drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c @@ -60,8 +60,8 @@ static void rcar_du_lvdsenc_start_gen2(s rcar_lvds_write(lvds, LVDPLLCR, pllcr); /* - * Select the input, hardcode mode 0, enable LVDS operation and turn - * bias circuitry on. + * Set the LVDS mode, select the input, enable LVDS operation, + * and turn bias circuitry on. */ lvdcr0 = (lvds->mode << LVDCR0_LVMD_SHIFT) | LVDCR0_BEN | LVDCR0_LVEN; if (rcrtc->index == 2) @@ -106,6 +106,9 @@ static void rcar_du_lvdsenc_start_gen3(s rcar_lvds_write(lvds, LVDPLLCR, pllcr); + lvdcr0 = lvds->mode << LVDCR0_LVMD_SHIFT; + rcar_lvds_write(lvds, LVDCR0, lvdcr0); + /* Turn all the channels on. */ rcar_lvds_write(lvds, LVDCR1, LVDCR1_CHSTBY(3) | LVDCR1_CHSTBY(2) | @@ -115,7 +118,8 @@ static void rcar_du_lvdsenc_start_gen3(s * Turn the PLL on, set it to LVDS normal mode, wait for the startup * delay and turn the output on. */ - lvdcr0 = (lvds->mode << LVDCR0_LVMD_SHIFT) | LVDCR0_PLLON; + + lvdcr0 = | LVDCR0_PLLON; rcar_lvds_write(lvds, LVDCR0, lvdcr0); lvdcr0 |= LVDCR0_PWD;