From patchwork Fri Jan 19 18:29:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 10175861 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 59FAC60386 for ; Fri, 19 Jan 2018 18:36:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44B4B2877E for ; Fri, 19 Jan 2018 18:36:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3952B28786; Fri, 19 Jan 2018 18:36:05 +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 D3A8A2877E for ; Fri, 19 Jan 2018 18:36:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C57936EB04; Fri, 19 Jan 2018 18:36:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x243.google.com (mail-lf0-x243.google.com [IPv6:2a00:1450:4010:c07::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 158596EB04 for ; Fri, 19 Jan 2018 18:36:01 +0000 (UTC) Received: by mail-lf0-x243.google.com with SMTP id t139so3213144lff.0 for ; Fri, 19 Jan 2018 10:36:01 -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:to:cc:to:subject:mime-version :content-disposition; bh=OT+r7R9prgMsC5Dny04CoNLK2Actp6pNeecQQZFKf/I=; b=ceYTxcMfH0Vlcd1wcBQtb7M6Gv6YBrdvvzKQXeMZjnOM6fwfh6SwSYQtzOWyZd5aUr GaDqHQ01rHEKQ7y2tB7nEjoHN4nHLYQ3h+MHFZdCgNIiAASV4G81QmhoUCDZRr32MDzx MDqJHwkqs5EUtyaC0jr7fzMw7wJi+tI98Gr8bRHmYliUa9xLbe5Huw2UdMs+H6ZWrOEE rvGZq3HO8ThrriJN6J9+dMbjY+XwoPP8BVBmm3a0gmUtOfd/QL6/QYnxp+mmvOGJMSxv kh7MsFL8O1AUBIrjVRGWy6QkP8nOTAimbNpl3EHpQC+I/jqEDU6yBBN4gfoJw23MPSbu zC2Q== 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:to:cc:to :subject:mime-version:content-disposition; bh=OT+r7R9prgMsC5Dny04CoNLK2Actp6pNeecQQZFKf/I=; b=d7NnPYfUUtC8z0bX0D7a6IlGSZFDwmAzpqbC71avdQpGp+LxOYBWPCfZQ0zKnAarCh qCuQv0BCdCd3WdMXBDNsZu1RdXzXIoL3tA9ve0mcEQBcOcQFrsXMjdgZUtk8m1+zZ/wD q1zrzsY3nJbns6gtJ4KcvZP8G7CJg6RUwXeAwinHvyRtXe6w++WpN75W1u0hdWeafmmg h7L55sD4sAN9DWL7oGTVY062rH0guunmLPwdYg0g3qZf1PPiCxB3wFA3HdOxfvlH6wZs 4Ja18zl3ZQexFBDkcI9zSyKX+Wj3zDqEy1TeUFaPJmkmOJ4liv9x190GxWvRa+oGzHDh bWHQ== X-Gm-Message-State: AKwxytfWPtlWR8x3qWQh5ScmE2DVxc4shWxPmLZ9RoBhF6XvI/bvIwMu p1MY2riHT7Ms9ylGJELQy20l/BbG0NM= X-Google-Smtp-Source: ACJfBou78yXs4ZJbpjWIrfu3Q2RKnrgX77WkBJ8ffjeTRaTWqg45LyY1YY8f5Y7RfbgtfFsEfOJ0lQ== X-Received: by 10.46.2.221 with SMTP id y90mr11056386lje.39.1516386960452; Fri, 19 Jan 2018 10:36:00 -0800 (PST) Received: from wasted.cogentembedded.com ([31.173.82.43]) by smtp.gmail.com with ESMTPSA id b76sm1766998lfh.90.2018.01.19.10.35.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Jan 2018 10:35:59 -0800 (PST) From: Sergei Shtylyov X-Google-Original-From: "Sergei Shtylyov" Received: by wasted.cogentembedded.com (sSMTP sendmail emulation); Fri, 19 Jan 2018 21:35:57 +0300 Message-Id: <20180119183557.226328412@cogentembedded.com> User-Agent: quilt/0.64 Date: Fri, 19 Jan 2018 21:29:21 +0300 To: Laurent Pinchart , David Airlie , dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org To: Rob Herring To: devicetree@vger.kernel.org Subject: [PATCH 3/3] drm: rcar-du: lvds: add R8A77970 support MIME-Version: 1.0 Content-Disposition: inline; filename=drm-rcar-du-lvds-add-R8A77970-support.patch Cc: Mark Rutland , 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 Add support for the R-Car V3M (R8A77970) SoC to the LVDS encoder driver. Note that there are some differences with the other R-Car gen3 SoCs, e.g. LVDPLLCR has the same layout as in the R-Car gen2 SoCs... Signed-off-by: Sergei Shtylyov --- drivers/gpu/drm/rcar-du/rcar_lvds.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) Index: linux/drivers/gpu/drm/rcar-du/rcar_lvds.c =================================================================== --- linux.orig/drivers/gpu/drm/rcar-du/rcar_lvds.c +++ linux/drivers/gpu/drm/rcar-du/rcar_lvds.c @@ -32,6 +32,10 @@ enum rcar_lvds_mode { }; #define RCAR_LVDS_QUIRK_LANES (1 << 0) /* LVDS lanes 1 and 3 inverted */ +#define RCAR_LVDS_QUIRK_GEN2_PLLCR (1 << 1) /* LVDPLLCR has gen2-like */ + /* layout on R8A77970 */ +#define RCAR_LVDS_QUIRK_PHY (1 << 2) /* LVDS has PHY on R8A77970 */ + /* and R8A7799{0|5} */ struct rcar_lvds_device_info { unsigned int gen; @@ -162,6 +166,7 @@ static void rcar_lvds_enable(struct drm_ */ struct drm_crtc *crtc = lvds->bridge.encoder->crtc; const struct drm_display_mode *mode = &lvds->display_mode; + unsigned int quirks = lvds->info->quirks; unsigned int gen = lvds->info->gen; u32 lvdcr0 = lvds->mode << LVDCR0_LVMD_SHIFT; u32 lvdpllcr; @@ -186,7 +191,7 @@ static void rcar_lvds_enable(struct drm_ LVDCTRCR_CTR2SEL_DISP | LVDCTRCR_CTR1SEL_VSYNC | LVDCTRCR_CTR0SEL_HSYNC); - if (lvds->info->quirks & RCAR_LVDS_QUIRK_LANES) + if (quirks & RCAR_LVDS_QUIRK_LANES) lvdhcr = LVDCHCR_CHSEL_CH(0, 0) | LVDCHCR_CHSEL_CH(1, 3) | LVDCHCR_CHSEL_CH(2, 2) | LVDCHCR_CHSEL_CH(3, 1); else @@ -195,7 +200,7 @@ static void rcar_lvds_enable(struct drm_ rcar_lvds_write(lvds, LVDCHCR, lvdhcr); /* PLL clock configuration */ - if (gen < 3) + if (gen < 3 || quirks & RCAR_LVDS_QUIRK_GEN2_PLLCR) lvdpllcr = rcar_lvds_lvdpllcr_gen2(mode->clock); else lvdpllcr = rcar_lvds_lvdpllcr_gen3(mode->clock); @@ -227,6 +232,12 @@ static void rcar_lvds_enable(struct drm_ rcar_lvds_write(lvds, LVDCR0, lvdcr0); } + if (quirks & RCAR_LVDS_QUIRK_PHY) { + /* Turn on the LVDS PHY. */ + lvdcr0 |= LVDCR0_LVEN; + rcar_lvds_write(lvds, LVDCR0, lvdcr0); + } + /* Wait for the startup delay. */ usleep_range(100, 150); @@ -499,6 +510,11 @@ static const struct rcar_lvds_device_inf .gen = 3, }; +static const struct rcar_lvds_device_info rcar_lvds_r8a77970_info = { + .gen = 3, + .quirks = RCAR_LVDS_QUIRK_GEN2_PLLCR | RCAR_LVDS_QUIRK_PHY, +}; + static const struct of_device_id rcar_lvds_of_table[] = { { .compatible = "renesas,r8a7743-lvds", .data = &rcar_lvds_gen2_info }, { .compatible = "renesas,r8a7790-lvds", .data = &rcar_lvds_r8a7790_info }, @@ -506,6 +522,7 @@ static const struct of_device_id rcar_lv { .compatible = "renesas,r8a7793-lvds", .data = &rcar_lvds_gen2_info }, { .compatible = "renesas,r8a7795-lvds", .data = &rcar_lvds_gen3_info }, { .compatible = "renesas,r8a7796-lvds", .data = &rcar_lvds_gen3_info }, + { .compatible = "renesas,r8a77970-lvds", .data = &rcar_lvds_r8a77970_info }, { } };