From patchwork Tue Dec 3 10:16:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuti Amonkar X-Patchwork-Id: 11271199 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9BA8713A4 for ; Tue, 3 Dec 2019 12:49:02 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 83D4920684 for ; Tue, 3 Dec 2019 12:49:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 83D4920684 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cadence.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 399616E506; Tue, 3 Dec 2019 12:48:39 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx0a-0014ca01.pphosted.com (mx0a-0014ca01.pphosted.com [208.84.65.235]) by gabe.freedesktop.org (Postfix) with ESMTPS id E363C6E03E for ; Tue, 3 Dec 2019 10:28:44 +0000 (UTC) Received: from pps.filterd (m0042385.ppops.net [127.0.0.1]) by mx0a-0014ca01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xB3ACE7i020552; Tue, 3 Dec 2019 02:16:53 -0800 Received: from nam05-co1-obe.outbound.protection.outlook.com (mail-co1nam05lp2052.outbound.protection.outlook.com [104.47.48.52]) by mx0a-0014ca01.pphosted.com with ESMTP id 2wknv0ukgc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 03 Dec 2019 02:16:53 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DlQpJPa35yHlRnXfjRPYKS4k+JRKlQq6QiTNJoM1Uo8w1a8NJZDGlUg+WFw/OlZI3awbFNPPRThGimqaEiMzEYgbndZiAlv5KQ6VFeAwEFQXB+6ZcdSZvXXHyJBVLBrupUv0kcL+h3w9+edz8Vb8TrAWTRppxBoSFasSI/S/c56/MTXi8XSXR7vgZBybRV1X2TpsEDo0YQNCuPSXdFulvvAUqU6fH7H3vOblgemvDnMcspEkFuoCnLw4F8txHUxNvyU55kjz6da51qB1ltiGPP5BJEj2vrcOd/V1yzSnmqwaKEvBPUODPekCGE02gUmJCn22lef0qbDytbymWYTs/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=O8aFk3wzRAeAbAWm4QDM3FPu3SweaS/RjSoUO6by5N4=; b=nKPsBUQ9RrXgKfrV0S7xUZj2pPDguwYEYF8D0t/ZmpeYCn15Nn7tfGnT0uNx2co8BYUVxBtkeqHyzJy6hKuRn9oD5Bx6m5GZZPMTTtJ/H7xD2ObtEIX2bnfWxy8r16eOvzztCard3/EtB73sWx0Xy0uesvucYrj5CvFPZtb91KCUtin5LePWOmWpsUgfGfOedUD6Hk+1CwM3/iy9M7szWagC/63azODMt1WMm4TLRgo9s1kli7U9ZJjdwl4Nps4E1r5+Z9l9HBFtwO5pR9wgAATwNjKE/xgMppnm4aZm8Z6tcUTUPV2otO3lFvLFN5F/FV1U/HnDleHajd+X2B9SfA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=softfail (sender ip is 199.43.4.28) smtp.rcpttodomain=ti.com smtp.mailfrom=cadence.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=cadence.com; dkim=none (message not signed); arc=none Received: from BYAPR07CA0019.namprd07.prod.outlook.com (2603:10b6:a02:bc::32) by BN7PR07MB4290.namprd07.prod.outlook.com (2603:10b6:406:b0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.18; Tue, 3 Dec 2019 10:16:50 +0000 Received: from MW2NAM12FT048.eop-nam12.prod.protection.outlook.com (2a01:111:f400:fe5a::203) by BYAPR07CA0019.outlook.office365.com (2603:10b6:a02:bc::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.18 via Frontend Transport; Tue, 3 Dec 2019 10:16:50 +0000 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning cadence.com discourages use of 199.43.4.28 as permitted sender) Received: from rmmaillnx1.cadence.com (199.43.4.28) by MW2NAM12FT048.mail.protection.outlook.com (10.13.180.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.18 via Frontend Transport; Tue, 3 Dec 2019 10:16:49 +0000 Received: from maileu3.global.cadence.com (maileu3.cadence.com [10.160.88.99]) by rmmaillnx1.cadence.com (8.14.4/8.14.4) with ESMTP id xB3AGg8k006738 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Tue, 3 Dec 2019 05:16:47 -0500 X-CrossPremisesHeadersFilteredBySendConnector: maileu3.global.cadence.com Received: from maileu3.global.cadence.com (10.160.88.99) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 3 Dec 2019 11:16:43 +0100 Received: from vleu-orange.cadence.com (10.160.88.83) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Tue, 3 Dec 2019 11:16:43 +0100 Received: from vleu-orange.cadence.com (localhost.localdomain [127.0.0.1]) by vleu-orange.cadence.com (8.14.4/8.14.4) with ESMTP id xB3AGhGR001558; Tue, 3 Dec 2019 11:16:43 +0100 Received: (from yamonkar@localhost) by vleu-orange.cadence.com (8.14.4/8.14.4/Submit) id xB3AGhA7001552; Tue, 3 Dec 2019 11:16:43 +0100 From: Yuti Amonkar To: Subject: [PATCH v1 3/3] drm/mhdp: add j721e wrapper Date: Tue, 3 Dec 2019 11:16:06 +0100 Message-ID: <1575368166-861-4-git-send-email-yamonkar@cadence.com> X-Mailer: git-send-email 2.4.5 In-Reply-To: <1575368166-861-1-git-send-email-yamonkar@cadence.com> References: <1575368166-861-1-git-send-email-yamonkar@cadence.com> MIME-Version: 1.0 X-OrganizationHeadersPreserved: maileu3.global.cadence.com X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:199.43.4.28; IPV:CAL; SCL:-1; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(136003)(346002)(376002)(39860400002)(396003)(199004)(189003)(36092001)(8936002)(305945005)(81166006)(316002)(51416003)(16586007)(5660300002)(76176011)(42186006)(2906002)(81156014)(4326008)(356004)(50466002)(54906003)(26005)(8676002)(6666004)(107886003)(478600001)(446003)(2616005)(966005)(87636003)(11346002)(6306002)(70586007)(86362001)(2351001)(336012)(186003)(70206006)(14444005)(50226002)(76130400001)(426003)(48376002)(26826003)(6916009)(36756003)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN7PR07MB4290; H:rmmaillnx1.cadence.com; FPR:; SPF:SoftFail; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 54f3b3ee-510b-4764-464c-08d777d9e8ff X-MS-TrafficTypeDiagnostic: BN7PR07MB4290: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:418; X-Forefront-PRVS: 02408926C4 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cn9S/rTUR0oUKktVbqGm77B1NuAQivdHw8p/7qqmzqS3AXyOEtH9ktwlbdLSyx4gxS0R9vHcuC1KXoP53F31ZYU1feQh2CnowjBeX/bvJ3R8BGWBoI9R/rIJvbvjhvMhvEWh5akdDNppk5tGOpeRPLxocSuGMbNn+MM4+eBSCAFWvH5Qqv6NMBp9eh+5BLutzHuxilg1SYpZoYj8pCHrkNoFTUFw1adc2jpixz8vlCf6zQAow1BfLfa/kWB/JJDmd2fPOAYeggck8aWAaZ+nDjyUPvJdh97GIh3L+VDYT2e9f7cGTgghaiqdYYPpmqnBnvS43yzBy0610E3YYqDzv+i5GX0MGMTb9aU+1uMDk6dtkm5wd3tyiirkLTaXc+klJLKr9K2yRw8jUg7M3fmFnKnSfHCP7DsAJjzdh/HevnH5V4ciRNtPzcD1XBYZF95Hbcl+Us0pnWtqXr8LuEJLAxXUbZp9AXgyXJYvOi3P0TtuhxawL6XhFWGdqkQaq1o3 X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2019 10:16:49.5435 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 54f3b3ee-510b-4764-464c-08d777d9e8ff X-MS-Exchange-CrossTenant-Id: d36035c5-6ce6-4662-a3dc-e762e61ae4c9 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=d36035c5-6ce6-4662-a3dc-e762e61ae4c9; Ip=[199.43.4.28]; Helo=[rmmaillnx1.cadence.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB4290 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-12-03_02:2019-11-29,2019-12-03 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_check_notspam policy=outbound_check score=0 adultscore=0 spamscore=0 suspectscore=1 clxscore=1015 mlxlogscore=999 phishscore=0 impostorscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 priorityscore=1501 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1912030082 X-Mailman-Approved-At: Tue, 03 Dec 2019 12:48:27 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=proofpoint; bh=O8aFk3wzRAeAbAWm4QDM3FPu3SweaS/RjSoUO6by5N4=; b=eazh604jTQTuuICe0uP898csWepXDcXRznrMz+ekD2eeXL9ggtZl8iKaX5Lf4UelkOp8 VumY6wBNffPIaB6vI8uIPMy/lPJPUGmRXcR0imFeQWiLkVFZUfXKO5N0vtwjkEoWvzu7 UxB7Mo6QbLcpM5wOtqBpvknNPCQ4u9XW+JL25smNgZt2jNXVKBpgr2Dh5A+0sENJP/JZ cpu31MuMDyySbvNNsFo6nqxzRpfDCePw4eelOSzHOgdN4f3+ErH4IRsv5NrfG32kLDXW WmhJgG3MS1SLId7wJIjKW8ly+L0BkVldYFZUEI/qQKvJDWtXVZAdJh/wVCkCseXx1JJR MA== X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=O8aFk3wzRAeAbAWm4QDM3FPu3SweaS/RjSoUO6by5N4=; b=FjLaCxN1k6uLYDHXBNePY4fUmjcXCRz/bEH53cR7FYt2u0mo/PJTLs9t2k9l/GLiRHbbU4ST5PvtpQuWnC3btFUDRqYlnfDrR445PHSY+kaVQKsRG0AKLI9AAyFOQjstvkIuAQZ9AcLdTag/5WqFXSA0ShfUVi1dkEg77ZVYMEs= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mparab@cadence.com, yamonkar@cadence.com, praneeth@ti.com, dkangude@cadence.com, jsarha@ti.com, tomi.valkeinen@ti.com, sjakhade@cadence.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add j721e wrapper for mhdp, which sets up the clock and data muxes. Signed-off-by: Yuti Amonkar --- drivers/gpu/drm/bridge/Kconfig | 10 ++++ drivers/gpu/drm/bridge/Makefile | 3 ++ drivers/gpu/drm/bridge/cdns-mhdp-j721e.c | 79 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/bridge/cdns-mhdp-j721e.h | 55 ++++++++++++++++++++++ drivers/gpu/drm/bridge/cdns-mhdp.c | 14 +++++- drivers/gpu/drm/bridge/cdns-mhdp.h | 1 + 6 files changed, 161 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp-j721e.c create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp-j721e.h diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index 616c05f..4b6799b 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -48,6 +48,16 @@ config DRM_CDNS_MHDP It takes a DPI stream as input and output it encoded in DP format. +if DRM_CDNS_MHDP + +config DRM_CDNS_MHDP_J721E + bool "J721E Cadence DPI/DP wrapper support" + default y + help + Support J721E Cadence DPI/DP wrapper.It sets up + the clock and data muxes. +endif + config DRM_DUMB_VGA_DAC tristate "Dumb VGA DAC Bridge support" depends on OF diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile index c1a0da7..d358184 100644 --- a/drivers/gpu/drm/bridge/Makefile +++ b/drivers/gpu/drm/bridge/Makefile @@ -20,3 +20,6 @@ obj-$(CONFIG_DRM_CDNS_MHDP) += mhdp8546.o obj-y += synopsys/ mhdp8546-objs := cdns-mhdp.o +ifeq ($(CONFIG_DRM_CDNS_MHDP_J721E),y) + mhdp8546-objs += cdns-mhdp-j721e.o +endif diff --git a/drivers/gpu/drm/bridge/cdns-mhdp-j721e.c b/drivers/gpu/drm/bridge/cdns-mhdp-j721e.c new file mode 100644 index 0000000..a87faf5 --- /dev/null +++ b/drivers/gpu/drm/bridge/cdns-mhdp-j721e.c @@ -0,0 +1,79 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * TI j721e Cadence MHDP DP wrapper + * + * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ + * Author: Jyri Sarha +#include + +#include "cdns-mhdp-j721e.h" + +#define REVISION 0x00 +#define DPTX_IPCFG 0x04 +#define ECC_MEM_CFG 0x08 +#define DPTX_DSC_CFG 0x0c +#define DPTX_SRC_CFG 0x10 +#define DPTX_VIF_SECURE_MODE_CFG 0x14 +#define DPTX_VIF_CONN_STATUS 0x18 +#define PHY_CLK_STATUS 0x1c + +#define DPTX_SRC_AIF_EN BIT(16) +#define DPTX_SRC_VIF_3_IN30B BIT(11) +#define DPTX_SRC_VIF_2_IN30B BIT(10) +#define DPTX_SRC_VIF_1_IN30B BIT(9) +#define DPTX_SRC_VIF_0_IN30B BIT(8) +#define DPTX_SRC_VIF_3_SEL_DPI5 BIT(7) +#define DPTX_SRC_VIF_3_SEL_DPI3 0 +#define DPTX_SRC_VIF_2_SEL_DPI4 BIT(6) +#define DPTX_SRC_VIF_2_SEL_DPI2 0 +#define DPTX_SRC_VIF_1_SEL_DPI3 BIT(5) +#define DPTX_SRC_VIF_1_SEL_DPI1 0 +#define DPTX_SRC_VIF_0_SEL_DPI2 BIT(4) +#define DPTX_SRC_VIF_0_SEL_DPI0 0 +#define DPTX_SRC_VIF_3_EN BIT(3) +#define DPTX_SRC_VIF_2_EN BIT(2) +#define DPTX_SRC_VIF_1_EN BIT(1) +#define DPTX_SRC_VIF_0_EN BIT(0) + +/* TODO turn DPTX_IPCFG fw_mem_clk_en at pm_runtime_suspend. */ + +int cdns_mhdp_j721e_init(struct cdns_mhdp_device *mhdp) +{ + struct platform_device *pdev = to_platform_device(mhdp->dev); + struct resource *regs; + + regs = platform_get_resource(pdev, IORESOURCE_MEM, 1); + mhdp->j721e_regs = devm_ioremap_resource(&pdev->dev, regs); + if (IS_ERR(mhdp->j721e_regs)) + return PTR_ERR(mhdp->j721e_regs); + + return 0; +} + +void cdns_mhdp_j721e_fini(struct cdns_mhdp_device *mhdp) +{ +} + +void cdns_mhdp_j721e_enable(struct cdns_mhdp_device *mhdp) +{ + /* + * Eneble VIF_0 and select DPI2 as its input. DSS0 DPI0 is connected + * to eDP DPI2. This is the only supported SST configuration on + * J721E. + */ + writel(DPTX_SRC_VIF_0_EN | DPTX_SRC_VIF_0_SEL_DPI2, + mhdp->j721e_regs + DPTX_SRC_CFG); +} + +void cdns_mhdp_j721e_disable(struct cdns_mhdp_device *mhdp) +{ + /* Put everything to defaults */ + writel(0, mhdp->j721e_regs + DPTX_DSC_CFG); +} diff --git a/drivers/gpu/drm/bridge/cdns-mhdp-j721e.h b/drivers/gpu/drm/bridge/cdns-mhdp-j721e.h new file mode 100644 index 0000000..bd53508 --- /dev/null +++ b/drivers/gpu/drm/bridge/cdns-mhdp-j721e.h @@ -0,0 +1,55 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * TI j721e Cadence MHDP DP wrapper + * + * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ + * Author: Jyri Sarha +#include "cdns-mhdp.h" + +struct cdns_mhdp_j721e_wrap; + +#ifdef CONFIG_DRM_CDNS_MHDP_J721E + +int cdns_mhdp_j721e_init(struct cdns_mhdp_device *mhdp); + +void cdns_mhdp_j721e_fini(struct cdns_mhdp_device *mhdp); + +void cdns_mhdp_j721e_enable(struct cdns_mhdp_device *mhdp); + +void cdns_mhdp_j721e_disable(struct cdns_mhdp_device *mhdp); + +#else + +static inline +int cdns_mhdp_j721e_init(struct cdns_mhdp_device *mhdp) +{ + return 0; +} + +static inline +void cdns_mhdp_j721e_fini(struct cdns_mhdp_device *mhdp) +{ +} + +static inline +void cdns_mhdp_j721e_sst_enable(struct cdns_mhdp_device *mhdp); +{ +} + +static inline +void cdns_mhdp_j721e_sst_disable(struct cdns_mhdp_device *mhdp) +{ +} +#endif /* CONFIG_DRM_CDNS_MHDP_J721E */ + +#endif /* !CDNS_MHDP_J721E_H */ diff --git a/drivers/gpu/drm/bridge/cdns-mhdp.c b/drivers/gpu/drm/bridge/cdns-mhdp.c index 42468e1..146ff7a 100644 --- a/drivers/gpu/drm/bridge/cdns-mhdp.c +++ b/drivers/gpu/drm/bridge/cdns-mhdp.c @@ -36,9 +36,21 @@ #include #include "cdns-mhdp.h" - +#include "cdns-mhdp-j721e.h" + +#ifdef CONFIG_DRM_CDNS_MHDP_J721E +static const struct mhdp_platform_ops mhdp_ti_j721e_ops = { + .init = cdns_mhdp_j721e_init, + .exit = cdns_mhdp_j721e_fini, + .enable = cdns_mhdp_j721e_enable, + .disable = cdns_mhdp_j721e_disable, +}; +#endif static const struct of_device_id mhdp_ids[] = { { .compatible = "cdns,mhdp8546", }, +#ifdef CONFIG_DRM_CDNS_MHDP_J721E + { .compatible = "ti,j721e-mhdp8546", .data = &mhdp_ti_j721e_ops }, +#endif { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, mhdp_ids); diff --git a/drivers/gpu/drm/bridge/cdns-mhdp.h b/drivers/gpu/drm/bridge/cdns-mhdp.h index 9acb89d..c9013be 100644 --- a/drivers/gpu/drm/bridge/cdns-mhdp.h +++ b/drivers/gpu/drm/bridge/cdns-mhdp.h @@ -335,6 +335,7 @@ struct mhdp_platform_ops { struct cdns_mhdp_device { void __iomem *regs; + void __iomem *j721e_regs; struct device *dev; struct clk *clk;