From patchwork Thu Aug 23 15:12:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10574255 X-Patchwork-Delegate: kieran@bingham.xyz 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 F364914BD for ; Thu, 23 Aug 2018 15:12:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D208B2C104 for ; Thu, 23 Aug 2018 15:12:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C59FF2C285; Thu, 23 Aug 2018 15:12:34 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77A942C104 for ; Thu, 23 Aug 2018 15:12:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732016AbeHWSmi (ORCPT ); Thu, 23 Aug 2018 14:42:38 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:59123 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732576AbeHWSmi (ORCPT ); Thu, 23 Aug 2018 14:42:38 -0400 X-Originating-IP: 2.224.242.101 Received: from w540.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 38B21E0010; Thu, 23 Aug 2018 15:12:32 +0000 (UTC) From: Jacopo Mondi To: Laurent Pinchart , David Airlie Cc: Jacopo Mondi , ulrich.hecht+renesas@gmail.com, kieran.bingham@ideasonboard.com, dri-devel@lists.freedesktop.org (open list:DRM DRIVERS FOR RENESAS), linux-renesas-soc@vger.kernel.org (open list:DRM DRIVERS FOR RENESAS) Subject: [PATCH 4/4] drm: rcar-du: Fix handling of PnMR register Date: Thu, 23 Aug 2018 17:12:14 +0200 Message-Id: <1535037134-373-5-git-send-email-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535037134-373-1-git-send-email-jacopo+renesas@jmondi.org> References: <1535037134-373-1-git-send-email-jacopo+renesas@jmondi.org> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP According to revision 1.00 of R-Car Gen3 Soc manual, setting bits PnMR[13:12] is only valid if the DU group has two channels. It is then valid writing to PnMR[13:12] for: R-Car H3 = DU group 0 and DU group 1 R-Car M3-W, M3-N: DU group 0 only R-Car D3/E3: DU group 0 (no group 1) It is always invalid writing PnMR[13:12] on: R-Car V3M/V3H: only group 0 is present, but with a single channel Signed-off-by: Jacopo Mondi --- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index 5c2462a..647d2fc 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c @@ -505,8 +505,17 @@ static void rcar_du_plane_setup_format_gen3(struct rcar_du_group *rgrp, unsigned int index, const struct rcar_du_plane_state *state) { - rcar_du_plane_write(rgrp, index, PnMR, - PnMR_SPIM_TP_OFF | state->format->pnmr); + u32 mask = BIT(rgrp->index * 2) | BIT(rgrp->index * 2 + 1); + u32 pnmr = PnMR_SPIM_TP_OFF; + + /* + * Setting PnMR[13:12] is only allowed when more than 1 channel is + * availble in the group. + */ + if ((rgrp->channels_mask & mask) == mask) + pnmr |= state->format->pnmr; + + rcar_du_plane_write(rgrp, index, PnMR, pnmr); rcar_du_plane_write(rgrp, index, PnDDCR4, state->format->edf | PnDDCR4_CODE);