From patchwork Thu Nov 21 08:17:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Qian Wang X-Patchwork-Id: 11255883 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 30F74109A for ; Thu, 21 Nov 2019 08:17:56 +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 0F77D2089D for ; Thu, 21 Nov 2019 08:17:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F77D2089D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.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 0E4D46E196; Thu, 21 Nov 2019 08:17:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40080.outbound.protection.outlook.com [40.107.4.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id C23986E196 for ; Thu, 21 Nov 2019 08:17:51 +0000 (UTC) Received: from VI1PR08CA0194.eurprd08.prod.outlook.com (2603:10a6:800:d2::24) by DB8PR08MB5130.eurprd08.prod.outlook.com (2603:10a6:10:e9::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.30; Thu, 21 Nov 2019 08:17:48 +0000 Received: from AM5EUR03FT023.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::205) by VI1PR08CA0194.outlook.office365.com (2603:10a6:800:d2::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.17 via Frontend Transport; Thu, 21 Nov 2019 08:17:48 +0000 Received-SPF: Fail (protection.outlook.com: domain of arm.com does not designate 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT023.mail.protection.outlook.com (10.152.16.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.17 via Frontend Transport; Thu, 21 Nov 2019 08:17:48 +0000 Received: ("Tessian outbound 512f710540da:v33"); Thu, 21 Nov 2019 08:17:47 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 68236fe4c5645d19 X-CR-MTA-TID: 64aa7808 Received: from e6ad9d4a2a70.2 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.4.50]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 86D7F68A-C55A-474C-88CB-635C05D0CFF2.1; Thu, 21 Nov 2019 08:17:41 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-am5eur02lp2050.outbound.protection.outlook.com [104.47.4.50]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e6ad9d4a2a70.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 21 Nov 2019 08:17:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CtaMiEmbtDMEnGnekvsOvGTX5TOC8RYd2ih69tEdCfoiZQH0/5G9Z8OQk0ZmtXGdZjWDjjP0QKuXXo0L+KdJYqn4Qvlbf3I22/zApWjtd8TcfKHaiaMPhHB++F/hb6FJKsJVSYASFp3G+ahoHkUjrT2kABUhjsSB/GtIHlWnPDnwIP7OA/wdMufB6BEXXBPLbsFNwJA27N2T/nBbiaVAfqA1vw5DwoQWiLXkRwnQkWO+Xw/vtrSjzDOQ/YrfV/ftYVCfVSJjJVW3aBrFjixGQO6EOJGR/3hE1bkBrqHFGriyFqg+V/Fr6noG1qPiLl8jpLDIbXBS1icP/hFGeNe9qw== 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=9lAQlM/MhNbuQGxmnX34Fv0G6hKdyUmVSxsfm5aa6sQ=; b=Re5/4Iz3D0p7YPWsHI925hZGnYbxYf/OD5bwk8s4XHV7U6IN1I2DROiWHO1qCw8dkGnyY+FQjQj7PSJ45VN+quBeb0bss10IABUmdnfu8FWX3HqGLKD+K3UL2ChrVwuwAHbxMBo9aI9iiOd1Fq0mI6DFZ2eM8sm+c6iFtnD3TIy9yfu8aJ23c1SM2iZ4mIPR9LwUy3Bm/pbB5W3s0pfnYHifJXQB0jufO2ZOU9PeSWDExhV+hGOqskXDpYPq8dWRk9WWbM5C+PBo4CGPPv+uWd2dSWzvY1JKvswC7uc5NR6W/uZuftwGjRxA+RfAOlc8fwGGnunBp0A6qUTmRU2hVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Received: from VE1PR08MB5006.eurprd08.prod.outlook.com (10.255.159.31) by VE1PR08MB4910.eurprd08.prod.outlook.com (10.255.114.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.17; Thu, 21 Nov 2019 08:17:39 +0000 Received: from VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::a809:417a:faf3:61a7]) by VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::a809:417a:faf3:61a7%6]) with mapi id 15.20.2474.019; Thu, 21 Nov 2019 08:17:39 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau , "airlied@linux.ie" , Brian Starkey , "maarten.lankhorst@linux.intel.com" , Mihail Atanassov Subject: [PATCH v2 1/2] drm/komeda: Update the chip identify Thread-Topic: [PATCH v2 1/2] drm/komeda: Update the chip identify Thread-Index: AQHVoEQj/p8RiR47xEOSjyW11KmivQ== Date: Thu, 21 Nov 2019 08:17:39 +0000 Message-ID: <20191121081717.29518-2-james.qian.wang@arm.com> References: <20191121081717.29518-1-james.qian.wang@arm.com> In-Reply-To: <20191121081717.29518-1-james.qian.wang@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [113.29.88.7] x-clientproxiedby: HK2PR03CA0056.apcprd03.prod.outlook.com (2603:1096:202:17::26) To VE1PR08MB5006.eurprd08.prod.outlook.com (2603:10a6:803:113::31) Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=james.qian.wang@arm.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 589c2002-80c2-4cb3-6e51-08d76e5b4bb3 X-MS-TrafficTypeDiagnostic: VE1PR08MB4910:|VE1PR08MB4910:|DB8PR08MB5130: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:4125;OLM:4125; x-forefront-prvs: 0228DDDDD7 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(376002)(396003)(346002)(366004)(136003)(39850400004)(189003)(199004)(6116002)(3846002)(2616005)(6486002)(478600001)(86362001)(4326008)(446003)(102836004)(6636002)(71190400001)(26005)(71200400001)(54906003)(110136005)(14454004)(186003)(2501003)(11346002)(6436002)(316002)(6512007)(99286004)(25786009)(2906002)(66946007)(64756008)(7736002)(66556008)(66066001)(305945005)(15650500001)(1076003)(66476007)(256004)(14444005)(36756003)(52116002)(76176011)(386003)(6506007)(55236004)(81166006)(81156014)(8676002)(50226002)(103116003)(66446008)(8936002)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB4910; H:VE1PR08MB5006.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 5uuTMF1hHNDz2ddxeirpR7kF1Oh3TFLuKeoa6inyNwO8o+M9w9dSvnQ3ij4Qt4PPxgo6sgxhMwFj/xi+VjyaCdORIve7wGD1u+T26njUW3c3repc4SC2Iyf+7rgSFABibvoxi4k3iWfbGekjrVDJ8PNaCn+eUGopk3uNcKTW4lZoJnsfAt+ydhZDJvBsx94Vkp0lPE+eoontqyn/uVMOxsbbxz4vueRpBAfecfneNEYDqde3Jd1/AhSThOy2Tq3Jn1SBWXqNx8NQNyWnXY1OeERsYhr7Y+RebMzVWU4xnjyDoMGCpQVLo9+pUVp/0UpECfRIWJDgYsIGTM9ipAXoSaakBP+zP7l6VhZ35iOxgs7LbVkdwlUKS8vD21yD82ooyNoOsZwTHmNG9wva/r0ROlWlKPjfBeFYm5rVdE9ASUXgph0TW+YQCED0Fu1fgzHA MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4910 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=james.qian.wang@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT023.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; IPV:CAL; SCL:-1; CTRY:IE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(376002)(396003)(39860400002)(136003)(346002)(1110001)(339900001)(189003)(199004)(6506007)(386003)(14454004)(26826003)(356004)(26005)(81156014)(81166006)(478600001)(8676002)(66066001)(186003)(8746002)(86362001)(50226002)(11346002)(446003)(47776003)(8936002)(102836004)(50466002)(336012)(76176011)(36756003)(2616005)(105606002)(1076003)(7736002)(15650500001)(6116002)(3846002)(305945005)(54906003)(316002)(14444005)(36906005)(6486002)(6636002)(6512007)(70206006)(70586007)(2906002)(2501003)(5660300002)(25786009)(110136005)(22756006)(99286004)(4326008)(23756003)(103116003)(76130400001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB8PR08MB5130; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:Fail; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; MX:1; A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: db5bdc58-c6cb-42cd-9cb9-08d76e5b462a NoDisclaimer: True X-Forefront-PRVS: 0228DDDDD7 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +6nBXbrV7s2zurJxoDK4SSoBBF/kdsUweKKQ9u0VzrKF2cM6ig6WCEveK9talppQHJ55Bm2V54x1qFhUm9xxXhwHclhZ58Wa85P9t87ASXId8UjRSzF1UeBHqKOAJhajJSRGYYQpNr7neJdYxRtj8jaebdfwoQYvaN3n2vUdNbmXURPDZXPWDzec/Mo5ozMyHx2xs7KxYGBp26VPcIijLbiHkJb22FcNaoKID/z9b6kjGafkeYX7owKQZnFm/ln+dJ7YY+AAeIpmL+EHtOk+VMGrhaoQ95d/cYBIY5aPCRUEOdZjPEclr+F2keIk8ncWUT/GVw5HsejX4gCT1GgJaO1mDTHQPV8bXCfJl0NG4MscyF9EH3L8pjD38A3YD0+mKZD4eqG3HPIv176qiSUmca6l+Bj1fnWdOehCG6PoiLo3B90egLxi/pMc5RCKaZDe X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2019 08:17:48.6593 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 589c2002-80c2-4cb3-6e51-08d76e5b4bb3 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5130 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9lAQlM/MhNbuQGxmnX34Fv0G6hKdyUmVSxsfm5aa6sQ=; b=JrYaVlb30A3DB7aIw/Lsie1WuLiMOtsgwv6m7e2h8XRuZSk0LJa5t5SgYaZrZFKGEDKLQ1tgp3S9+hAR1a87tSx9UzWzymOWQmDf6DPo0kss7NW2SfbNHqW0kX9uR3EE0NND58KpV2bxPO1Ku5awfHhGiSBZKBVHRU7FAcjVnkA= X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9lAQlM/MhNbuQGxmnX34Fv0G6hKdyUmVSxsfm5aa6sQ=; b=JrYaVlb30A3DB7aIw/Lsie1WuLiMOtsgwv6m7e2h8XRuZSk0LJa5t5SgYaZrZFKGEDKLQ1tgp3S9+hAR1a87tSx9UzWzymOWQmDf6DPo0kss7NW2SfbNHqW0kX9uR3EE0NND58KpV2bxPO1Ku5awfHhGiSBZKBVHRU7FAcjVnkA= X-Mailman-Original-Authentication-Results: spf=fail (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.freedesktop.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.freedesktop.org; dmarc=none action=none header.from=arm.com; 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: nd , "Oscar Zhang \(Arm Technology China\)" , "Tiannan Zhu \(Arm Technology China\)" , "Jonathan Chai \(Arm Technology China\)" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Julien Yin \(Arm Technology China\)" , "Channing Chen \(Arm Technology China\)" , "james qian wang \(Arm Technology China\)" , "Thomas Sun \(Arm Technology China\)" , "Lowry Li \(Arm Technology China\)" , Ben Davis Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 1. Drop komeda-CORE product id comparison and put it into the d71_identify 2. Update pipeline node DT-binding: (a). Skip the needless pipeline DT node. (b). Return fail if the essential pipeline DT node is missing. With these changes, for one family chips no need to change the DT. v2: Rebase Signed-off-by: James Qian Wang (Arm Technology China) Reviewed-by: Mihail Atanassov --- .../gpu/drm/arm/display/komeda/d71/d71_dev.c | 27 +++++++-- .../gpu/drm/arm/display/komeda/komeda_dev.c | 60 ++++++++++--------- .../gpu/drm/arm/display/komeda/komeda_dev.h | 14 +---- .../gpu/drm/arm/display/komeda/komeda_drv.c | 9 +-- 4 files changed, 58 insertions(+), 52 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c index 822b23a1ce75..9b3bf353b6cc 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c @@ -594,10 +594,27 @@ static const struct komeda_dev_funcs d71_chip_funcs = { const struct komeda_dev_funcs * d71_identify(u32 __iomem *reg_base, struct komeda_chip_info *chip) { - chip->arch_id = malidp_read32(reg_base, GLB_ARCH_ID); - chip->core_id = malidp_read32(reg_base, GLB_CORE_ID); - chip->core_info = malidp_read32(reg_base, GLB_CORE_INFO); - chip->bus_width = D71_BUS_WIDTH_16_BYTES; + const struct komeda_dev_funcs *funcs; + u32 product_id; - return &d71_chip_funcs; + chip->core_id = malidp_read32(reg_base, GLB_CORE_ID); + + product_id = MALIDP_CORE_ID_PRODUCT_ID(chip->core_id); + + switch (product_id) { + case MALIDP_D71_PRODUCT_ID: + funcs = &d71_chip_funcs; + break; + default: + funcs = NULL; + DRM_ERROR("Unsupported product: 0x%x\n", product_id); + } + + if (funcs) { + chip->arch_id = malidp_read32(reg_base, GLB_ARCH_ID); + chip->core_info = malidp_read32(reg_base, GLB_CORE_INFO); + chip->bus_width = D71_BUS_WIDTH_16_BYTES; + } + + return funcs; } diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c index 4dd4699d4e3d..8e0bce46555b 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c @@ -116,22 +116,14 @@ static struct attribute_group komeda_sysfs_attr_group = { .attrs = komeda_sysfs_entries, }; -static int komeda_parse_pipe_dt(struct komeda_dev *mdev, struct device_node *np) +static int komeda_parse_pipe_dt(struct komeda_pipeline *pipe) { - struct komeda_pipeline *pipe; + struct device_node *np = pipe->of_node; struct clk *clk; - u32 pipe_id; - int ret = 0; - - ret = of_property_read_u32(np, "reg", &pipe_id); - if (ret != 0 || pipe_id >= mdev->n_pipelines) - return -EINVAL; - - pipe = mdev->pipelines[pipe_id]; clk = of_clk_get_by_name(np, "pxclk"); if (IS_ERR(clk)) { - DRM_ERROR("get pxclk for pipeline %d failed!\n", pipe_id); + DRM_ERROR("get pxclk for pipeline %d failed!\n", pipe->id); return PTR_ERR(clk); } pipe->pxlclk = clk; @@ -145,7 +137,6 @@ static int komeda_parse_pipe_dt(struct komeda_dev *mdev, struct device_node *np) of_graph_get_port_by_id(np, KOMEDA_OF_PORT_OUTPUT); pipe->dual_link = pipe->of_output_links[0] && pipe->of_output_links[1]; - pipe->of_node = of_node_get(np); return 0; } @@ -154,7 +145,9 @@ static int komeda_parse_dt(struct device *dev, struct komeda_dev *mdev) { struct platform_device *pdev = to_platform_device(dev); struct device_node *child, *np = dev->of_node; - int ret; + struct komeda_pipeline *pipe; + u32 pipe_id = U32_MAX; + int ret = -1; mdev->irq = platform_get_irq(pdev, 0); if (mdev->irq < 0) { @@ -169,31 +162,44 @@ static int komeda_parse_dt(struct device *dev, struct komeda_dev *mdev) ret = 0; for_each_available_child_of_node(np, child) { - if (of_node_cmp(child->name, "pipeline") == 0) { - ret = komeda_parse_pipe_dt(mdev, child); - if (ret) { - DRM_ERROR("parse pipeline dt error!\n"); - of_node_put(child); - break; + if (of_node_name_eq(child, "pipeline")) { + of_property_read_u32(child, "reg", &pipe_id); + if (pipe_id >= mdev->n_pipelines) { + DRM_WARN("Skip the redundant DT node: pipeline-%u.\n", + pipe_id); + continue; } + mdev->pipelines[pipe_id]->of_node = of_node_get(child); } } + for (pipe_id = 0; pipe_id < mdev->n_pipelines; pipe_id++) { + pipe = mdev->pipelines[pipe_id]; + + if (!pipe->of_node) { + DRM_ERROR("Omit DT node for pipeline-%d.\n", pipe->id); + return -EINVAL; + } + ret = komeda_parse_pipe_dt(pipe); + if (ret) + return ret; + } + mdev->side_by_side = !of_property_read_u32(np, "side_by_side_master", &mdev->side_by_side_master); - return ret; + return 0; } struct komeda_dev *komeda_dev_create(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); - const struct komeda_product_data *product; + komeda_identify_func komeda_identify; struct komeda_dev *mdev; int err = 0; - product = of_device_get_match_data(dev); - if (!product) + komeda_identify = of_device_get_match_data(dev); + if (!komeda_identify) return ERR_PTR(-ENODEV); mdev = devm_kzalloc(dev, sizeof(*mdev), GFP_KERNEL); @@ -221,11 +227,9 @@ struct komeda_dev *komeda_dev_create(struct device *dev) clk_prepare_enable(mdev->aclk); - mdev->funcs = product->identify(mdev->reg_base, &mdev->chip); - if (!komeda_product_match(mdev, product->product_id)) { - DRM_ERROR("DT configured %x mismatch with real HW %x.\n", - product->product_id, - MALIDP_CORE_ID_PRODUCT_ID(mdev->chip.core_id)); + mdev->funcs = komeda_identify(mdev->reg_base, &mdev->chip); + if (!mdev->funcs) { + DRM_ERROR("Failed to identify the HW.\n"); err = -ENODEV; goto disable_clk; } diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h index 471604b42431..dacdb00153e9 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h @@ -58,11 +58,6 @@ | KOMEDA_EVENT_MODE \ ) -/* malidp device id */ -enum { - MALI_D71 = 0, -}; - /* pipeline DT ports */ enum { KOMEDA_OF_PORT_OUTPUT = 0, @@ -76,12 +71,6 @@ struct komeda_chip_info { u32 bus_width; }; -struct komeda_product_data { - u32 product_id; - const struct komeda_dev_funcs *(*identify)(u32 __iomem *reg, - struct komeda_chip_info *info); -}; - struct komeda_dev; struct komeda_events { @@ -243,6 +232,9 @@ komeda_product_match(struct komeda_dev *mdev, u32 target) return MALIDP_CORE_ID_PRODUCT_ID(mdev->chip.core_id) == target; } +typedef const struct komeda_dev_funcs * +(*komeda_identify_func)(u32 __iomem *reg, struct komeda_chip_info *chip); + const struct komeda_dev_funcs * d71_identify(u32 __iomem *reg, struct komeda_chip_info *chip); diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c index d6c2222c5d33..b7a1097c45c4 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c @@ -123,15 +123,8 @@ static int komeda_platform_remove(struct platform_device *pdev) return 0; } -static const struct komeda_product_data komeda_products[] = { - [MALI_D71] = { - .product_id = MALIDP_D71_PRODUCT_ID, - .identify = d71_identify, - }, -}; - static const struct of_device_id komeda_of_match[] = { - { .compatible = "arm,mali-d71", .data = &komeda_products[MALI_D71], }, + { .compatible = "arm,mali-d71", .data = d71_identify, }, {}, }; From patchwork Thu Nov 21 08:17:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Qian Wang X-Patchwork-Id: 11255885 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 573B814E5 for ; Thu, 21 Nov 2019 08:18: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 3D45220898 for ; Thu, 21 Nov 2019 08:18:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3D45220898 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.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 740736E141; Thu, 21 Nov 2019 08:18:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10069.outbound.protection.outlook.com [40.107.1.69]) by gabe.freedesktop.org (Postfix) with ESMTPS id D8F7E6EB95 for ; Thu, 21 Nov 2019 08:17:56 +0000 (UTC) Received: from VI1PR0801CA0073.eurprd08.prod.outlook.com (2603:10a6:800:7d::17) by VI1PR08MB3037.eurprd08.prod.outlook.com (2603:10a6:803:42::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.27; Thu, 21 Nov 2019 08:17:54 +0000 Received: from AM5EUR03FT014.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::206) by VI1PR0801CA0073.outlook.office365.com (2603:10a6:800:7d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.18 via Frontend Transport; Thu, 21 Nov 2019 08:17:54 +0000 Received-SPF: Fail (protection.outlook.com: domain of arm.com does not designate 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT014.mail.protection.outlook.com (10.152.16.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.17 via Frontend Transport; Thu, 21 Nov 2019 08:17:53 +0000 Received: ("Tessian outbound af6b7800e6cb:v33"); Thu, 21 Nov 2019 08:17:52 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c5807edc8ee2474d X-CR-MTA-TID: 64aa7808 Received: from 8339bfbc747e.2 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.4.52]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id AAFBD1A8-7EA8-48BC-8535-3AC62EB5B825.1; Thu, 21 Nov 2019 08:17:47 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-am5eur02lp2052.outbound.protection.outlook.com [104.47.4.52]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 8339bfbc747e.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 21 Nov 2019 08:17:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MCYA0mQWFT8TVX3DHDLJyu3hqcz+upn7lCqh9aK0xgyw2zaq694G07HwMlLSGIj8+zZZhVIjimoW4hu5ACcNaSkkiSa7Tk4eHhGjisJ4TCOpMZNh4J1UzTYJgMigQEVjzxwHjrXRcH/kRuiTPyga9aHz+MlX6s3M8e3znXzWEpQ1QsJG+3i/kDj+wmvnpm+ps6uWz9n2W6i1kOmMz8qjk5cfRKcl5LpYOxZ7T+qlkTp2ZKUtg0LjU1eW1fZ2f+Rcpbx4GwAiRNJCZKy5svqnfmU/2ymeROQfd0PX64SVFPQ+wcYdq4RkkgbMtT/Jg4XmBO+Z1jOzJaOovRTi7Do4eg== 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=QASb25Jew3FsFszPjgiiGr3y2lMle5ccT+pKmrURqnE=; b=PtqaFdxMze/vsq/r94PXQXfFQwHT4290p2+pycPujvLO/O3hZqy6Y76WeV08TRx+MIIIo3YyDKnt8iavh28L26lZxrqhGXEEqvAjPsEKrfkvamkTH7buUUMuMlRsa0UnbJz9DcbJFcfKX6oCHKiMb6Gh54CZdKpp6gpxvA59NGvhYlLLG3W2acPKp9DVi5zuz9PcQqyQOzsQa8c5aREGb8k81Lk9MjG1veRpDnS5Shh3g2AgQ3CDU4ur0DA+QVdVQlQ5bdzhdq/lHIC+2ZdJNSnccXVHh7Ip14BCC8sFhCvOw/0Z7x5F1I051TB1+ZI+5GpExYYcv6iTQKJCK3Eb5A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Received: from VE1PR08MB5006.eurprd08.prod.outlook.com (10.255.159.31) by VE1PR08MB4910.eurprd08.prod.outlook.com (10.255.114.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.17; Thu, 21 Nov 2019 08:17:45 +0000 Received: from VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::a809:417a:faf3:61a7]) by VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::a809:417a:faf3:61a7%6]) with mapi id 15.20.2474.019; Thu, 21 Nov 2019 08:17:45 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau , "airlied@linux.ie" , Brian Starkey , "maarten.lankhorst@linux.intel.com" , Mihail Atanassov Subject: [PATCH v2 2/2] drm/komeda: Enable new product D32 support Thread-Topic: [PATCH v2 2/2] drm/komeda: Enable new product D32 support Thread-Index: AQHVoEQnHODp0nh43k+zk6WDkpPTxA== Date: Thu, 21 Nov 2019 08:17:45 +0000 Message-ID: <20191121081717.29518-3-james.qian.wang@arm.com> References: <20191121081717.29518-1-james.qian.wang@arm.com> In-Reply-To: <20191121081717.29518-1-james.qian.wang@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [113.29.88.7] x-clientproxiedby: HK2PR03CA0056.apcprd03.prod.outlook.com (2603:1096:202:17::26) To VE1PR08MB5006.eurprd08.prod.outlook.com (2603:10a6:803:113::31) Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=james.qian.wang@arm.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 37c19b4b-9997-47a9-5de4-08d76e5b4ede X-MS-TrafficTypeDiagnostic: VE1PR08MB4910:|VE1PR08MB4910:|VI1PR08MB3037: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:8273;OLM:8273; x-forefront-prvs: 0228DDDDD7 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(376002)(396003)(346002)(366004)(136003)(39850400004)(189003)(199004)(6116002)(3846002)(2616005)(6486002)(478600001)(86362001)(4326008)(446003)(102836004)(6636002)(71190400001)(26005)(71200400001)(54906003)(110136005)(14454004)(186003)(2501003)(11346002)(6436002)(316002)(6512007)(99286004)(25786009)(2906002)(66946007)(64756008)(7736002)(66556008)(66066001)(305945005)(1076003)(66476007)(256004)(14444005)(36756003)(52116002)(76176011)(386003)(6506007)(55236004)(81166006)(81156014)(8676002)(50226002)(103116003)(66446008)(8936002)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB4910; H:VE1PR08MB5006.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: PxP72KOwQXGJio0A8mGPnfzZ1LQyj/uf5pUMtcznNlJKNNZbAESVsEbgWZC1dUMwQK5zLBy5TDd2l1O+hkopnBcNVeZt7IV9kBVBRi+Dv9MKEFbLY7NUUqEW6PxuIyUa3YX4FjNoP970M65tBvnp1jC4IxoqstgsiVSqq5awH/t4p93kp7lhvJlqHv8U5ry71HGEQetLZwG4OnoqODximXMHI8ZElIPzY24XqYOPM7YgpuE2VxSJOKyJ5wCYMUZlJK4350/+/P1/a1vvDvQ/eAgPlHoC32D/ubWJPsOgXud66s2w67nzPFPSYsdOQvTJBBF1LB+y1SwW9Eay/uHVGa6sEndQ663Zsin9cOXJ7rojygQPpaH49ZhFso7a+HMm5ik9JCoHON6SBZrK8k3Ve1uYg4FzyMAWEDf30McEcRlqwQ35Znfu3h2dBSC1zn8n MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4910 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=james.qian.wang@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT014.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; IPV:CAL; SCL:-1; CTRY:IE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(136003)(39850400004)(396003)(376002)(346002)(1110001)(339900001)(189003)(199004)(47776003)(81156014)(81166006)(54906003)(36906005)(316002)(5660300002)(2501003)(66066001)(6486002)(110136005)(305945005)(105606002)(1076003)(70206006)(103116003)(76130400001)(14444005)(99286004)(70586007)(86362001)(4326008)(50466002)(2616005)(478600001)(6636002)(356004)(2906002)(25786009)(14454004)(22756006)(6512007)(8676002)(26005)(6116002)(7736002)(50226002)(3846002)(102836004)(36756003)(23756003)(8936002)(26826003)(11346002)(446003)(186003)(6506007)(76176011)(386003)(8746002)(336012); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB3037; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:Fail; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; MX:1; A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 1530753a-151d-4646-32c9-08d76e5b496a NoDisclaimer: True X-Forefront-PRVS: 0228DDDDD7 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VO7mlusPjxSmo+0sJxSMRP3IGfm7tn1QOYJ/adI3X4dObIeLLISqwJ4KatSHxGLUNyD3MfNYpOCHgzzXGp5ZZB1HLG5i76ysMNSsurgB+yUaRM0bMALfz5x2z0+ToLP4U6KLTGu2MxGlQtS1W5rypPNc73HsdgX3CB9xcxkyEookST7nvcYingWpwj2fZDyZo/dpaYoIk1h3p0hwT+PRPFmhJ769bE+wWcADxomECIjqG49x+vtoEcAapHsM6BiHxcfXLnOMU+9QXrGaka2S9c6ABBVcqiHhiT5lFsBUMnKLUWz1kNkZNz8sDpuviddQbcWjK/uy7B4CA0jOAmm+1mWe+A+JJniQUFqXhfOG3j8eTRNINIGT9sLg0InMmr9TsT8lDs2CsgKSTAPfFTf8CgdU7OHY4ePHU3xEqR9K2dI7pfSDZHjGU8mKP9Z9mSq8 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2019 08:17:53.9868 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 37c19b4b-9997-47a9-5de4-08d76e5b4ede X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3037 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QASb25Jew3FsFszPjgiiGr3y2lMle5ccT+pKmrURqnE=; b=Y568bpsBWUBkHlzkJ3HfphKeRYbxgKKVI4UHpwr/vAzxci3hHj3Q4lMxaifC5g/KL+Z7IpPx46UVKYdzD7psgUQiaxEQHExCxgY1I1OHV1NXQRSs2uzapHvgoq7zlEAM9rPMrF46lvU5i3WaMCyjPS/3PMhaBlP/g8y13WoZQ4w= X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QASb25Jew3FsFszPjgiiGr3y2lMle5ccT+pKmrURqnE=; b=Y568bpsBWUBkHlzkJ3HfphKeRYbxgKKVI4UHpwr/vAzxci3hHj3Q4lMxaifC5g/KL+Z7IpPx46UVKYdzD7psgUQiaxEQHExCxgY1I1OHV1NXQRSs2uzapHvgoq7zlEAM9rPMrF46lvU5i3WaMCyjPS/3PMhaBlP/g8y13WoZQ4w= X-Mailman-Original-Authentication-Results: spf=fail (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.freedesktop.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.freedesktop.org; dmarc=none action=none header.from=arm.com; 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: nd , "Oscar Zhang \(Arm Technology China\)" , "Tiannan Zhu \(Arm Technology China\)" , "Jonathan Chai \(Arm Technology China\)" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Julien Yin \(Arm Technology China\)" , "Channing Chen \(Arm Technology China\)" , "james qian wang \(Arm Technology China\)" , "Thomas Sun \(Arm Technology China\)" , "Lowry Li \(Arm Technology China\)" , Ben Davis Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" D32 is simple version of D71, the difference is: - Only has one pipeline - Drop the periph block and merge it to GCU v2: Rebase. Signed-off-by: James Qian Wang (Arm Technology China) --- .../drm/arm/display/include/malidp_product.h | 3 +- .../arm/display/komeda/d71/d71_component.c | 2 +- .../gpu/drm/arm/display/komeda/d71/d71_dev.c | 43 ++++++++++++------- .../gpu/drm/arm/display/komeda/d71/d71_regs.h | 13 ++++++ .../gpu/drm/arm/display/komeda/komeda_drv.c | 1 + 5 files changed, 44 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/arm/display/include/malidp_product.h b/drivers/gpu/drm/arm/display/include/malidp_product.h index 96e2e4016250..dbd3d4765065 100644 --- a/drivers/gpu/drm/arm/display/include/malidp_product.h +++ b/drivers/gpu/drm/arm/display/include/malidp_product.h @@ -18,7 +18,8 @@ #define MALIDP_CORE_ID_STATUS(__core_id) (((__u32)(__core_id)) & 0xFF) /* Mali-display product IDs */ -#define MALIDP_D71_PRODUCT_ID 0x0071 +#define MALIDP_D71_PRODUCT_ID 0x0071 +#define MALIDP_D32_PRODUCT_ID 0x0032 union komeda_config_id { struct { diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c index 6dadf4413ef3..c7f7e9c545c7 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c @@ -1274,7 +1274,7 @@ static int d71_timing_ctrlr_init(struct d71_dev *d71, ctrlr = to_ctrlr(c); - ctrlr->supports_dual_link = true; + ctrlr->supports_dual_link = d71->supports_dual_link; return 0; } diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c index 9b3bf353b6cc..2d429e310e5b 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c @@ -371,23 +371,33 @@ static int d71_enum_resources(struct komeda_dev *mdev) goto err_cleanup; } - /* probe PERIPH */ + /* Only the legacy HW has the periph block, the newer merges the periph + * into GCU + */ value = malidp_read32(d71->periph_addr, BLK_BLOCK_INFO); - if (BLOCK_INFO_BLK_TYPE(value) != D71_BLK_TYPE_PERIPH) { - DRM_ERROR("access blk periph but got blk: %d.\n", - BLOCK_INFO_BLK_TYPE(value)); - err = -EINVAL; - goto err_cleanup; + if (BLOCK_INFO_BLK_TYPE(value) != D71_BLK_TYPE_PERIPH) + d71->periph_addr = NULL; + + if (d71->periph_addr) { + /* probe PERIPHERAL in legacy HW */ + value = malidp_read32(d71->periph_addr, PERIPH_CONFIGURATION_ID); + + d71->max_line_size = value & PERIPH_MAX_LINE_SIZE ? 4096 : 2048; + d71->max_vsize = 4096; + d71->num_rich_layers = value & PERIPH_NUM_RICH_LAYERS ? 2 : 1; + d71->supports_dual_link = !!(value & PERIPH_SPLIT_EN); + d71->integrates_tbu = !!(value & PERIPH_TBU_EN); + } else { + value = malidp_read32(d71->gcu_addr, GCU_CONFIGURATION_ID0); + d71->max_line_size = GCU_MAX_LINE_SIZE(value); + d71->max_vsize = GCU_MAX_NUM_LINES(value); + + value = malidp_read32(d71->gcu_addr, GCU_CONFIGURATION_ID1); + d71->num_rich_layers = GCU_NUM_RICH_LAYERS(value); + d71->supports_dual_link = GCU_DISPLAY_SPLIT_EN(value); + d71->integrates_tbu = GCU_DISPLAY_TBU_EN(value); } - value = malidp_read32(d71->periph_addr, PERIPH_CONFIGURATION_ID); - - d71->max_line_size = value & PERIPH_MAX_LINE_SIZE ? 4096 : 2048; - d71->max_vsize = 4096; - d71->num_rich_layers = value & PERIPH_NUM_RICH_LAYERS ? 2 : 1; - d71->supports_dual_link = value & PERIPH_SPLIT_EN ? true : false; - d71->integrates_tbu = value & PERIPH_TBU_EN ? true : false; - for (i = 0; i < d71->num_pipelines; i++) { pipe = komeda_pipeline_add(mdev, sizeof(struct d71_pipeline), &d71_pipeline_funcs); @@ -415,7 +425,7 @@ static int d71_enum_resources(struct komeda_dev *mdev) } /* loop the register blks and probe */ - i = 2; /* exclude GCU and PERIPH */ + i = 1; /* exclude GCU */ offset = D71_BLOCK_SIZE; /* skip GCU */ while (i < d71->num_blocks) { blk_base = mdev->reg_base + (offset >> 2); @@ -425,9 +435,9 @@ static int d71_enum_resources(struct komeda_dev *mdev) err = d71_probe_block(d71, &blk, blk_base); if (err) goto err_cleanup; - i++; } + i++; offset += D71_BLOCK_SIZE; } @@ -603,6 +613,7 @@ d71_identify(u32 __iomem *reg_base, struct komeda_chip_info *chip) switch (product_id) { case MALIDP_D71_PRODUCT_ID: + case MALIDP_D32_PRODUCT_ID: funcs = &d71_chip_funcs; break; default: diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h b/drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h index 1727dc993909..81de6a23e7f3 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h @@ -72,6 +72,19 @@ #define GCU_CONTROL_MODE(x) ((x) & 0x7) #define GCU_CONTROL_SRST BIT(16) +/* GCU_CONFIGURATION registers */ +#define GCU_CONFIGURATION_ID0 0x100 +#define GCU_CONFIGURATION_ID1 0x104 + +/* GCU configuration */ +#define GCU_MAX_LINE_SIZE(x) ((x) & 0xFFFF) +#define GCU_MAX_NUM_LINES(x) ((x) >> 16) +#define GCU_NUM_RICH_LAYERS(x) ((x) & 0x7) +#define GCU_NUM_PIPELINES(x) (((x) >> 3) & 0x7) +#define GCU_NUM_SCALERS(x) (((x) >> 6) & 0x7) +#define GCU_DISPLAY_SPLIT_EN(x) (((x) >> 16) & 0x1) +#define GCU_DISPLAY_TBU_EN(x) (((x) >> 17) & 0x1) + /* GCU opmode */ #define INACTIVE_MODE 0 #define TBU_CONNECT_MODE 1 diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c index b7a1097c45c4..ad38bbc7431e 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c @@ -125,6 +125,7 @@ static int komeda_platform_remove(struct platform_device *pdev) static const struct of_device_id komeda_of_match[] = { { .compatible = "arm,mali-d71", .data = d71_identify, }, + { .compatible = "arm,mali-d32", .data = d71_identify, }, {}, };