Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp444244rwr; Thu, 20 Apr 2023 01:25:45 -0700 (PDT) X-Google-Smtp-Source: AKy350ayTPHNPzwZdCGaxOFVXMMbbvHnLdyab9/DEJURX334vmr/9rR8gjfUczybRU+PD2vrRlGV X-Received: by 2002:a05:6a21:6da2:b0:ee:3ddf:9737 with SMTP id wl34-20020a056a216da200b000ee3ddf9737mr596021pzb.28.1681979144981; Thu, 20 Apr 2023 01:25:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681979144; cv=none; d=google.com; s=arc-20160816; b=kdwl2SkXU4SIyoyIomaGMOMM7a6w+fMehpPJABkZ9RgeXr1JexgtNHS4BNGa5XiiGe cgfV9Xnoe3r+8/malUXv4lVcZoCAIzycFOE8a2VevJnDJWZPuUAxBozzDBeUVx3ytpN5 Iq+6vByhRi6imhiIzRKMp85otRso4A/CyL/8+5VHOg6KPE41Uh8EAKpN8Q3ttOhs21mK y/DAFXQiUf7uAxQEhkd8dmuLdLMVc9goyM5ZR2KZwGv2Vxtzp4tbb2FIHfrbKF2n991Z /p+MtvxZ749aveDFlFSnxOPyXuopCjBu+7NYMC6jdeVz5SOIsNN4r2KWR8YRLr+s+6BH PF+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=eC+fHL67xcwBlpafPEYV+besUHqfpBF1TzgIakGqTgg=; b=otyavDhAa3yiydyGaFWKZAYv1v186IF24G6aoa/qDXwyJPO5A67NTffAHwasTkQy85 4DOF2AYbQ9hbRbYCyPC7DCg82DkK39QAAAjSZLZ/sg7e2BlvPV84cBgHsd3edTrP49Bm 1VWOzvEsGMnIUjMU5JbCuyaeqMW5YLPAlkWxCPJFz9Dc4Uh15Wk7BdfgnFMgt/kE8OhC Ekw9fMzW2MjuHl10eCZXVsnvOaGldMvOR8SVYQdmdaqmqfbBt3zWvgnaFSFlcUx5P2nV bJDV6se3Hn+vGHzD8mJbt4ypHJK8AyV+BohuCNBWp+MuTjdXu0/h1eGPUiaSdBB7kmEI Wc7A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q7-20020a656847000000b005194990735csi1185637pgt.163.2023.04.20.01.25.34; Thu, 20 Apr 2023 01:25:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234344AbjDTIK3 (ORCPT + 99 others); Thu, 20 Apr 2023 04:10:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233817AbjDTIK1 (ORCPT ); Thu, 20 Apr 2023 04:10:27 -0400 Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D2A61700 for ; Thu, 20 Apr 2023 01:10:23 -0700 (PDT) Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 33K7rRRH055548; Thu, 20 Apr 2023 15:53:27 +0800 (GMT-8) (envelope-from jammy_huang@aspeedtech.com) Received: from JammyHuang-PC.aspeed.com (192.168.2.115) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 20 Apr 2023 16:09:49 +0800 From: Jammy Huang To: , CC: , , , Subject: [PATCH v2] drm/ast: Fix ARM compatibility Date: Thu, 20 Apr 2023 16:09:47 +0800 Message-ID: <20230420080947.27226-1-jammy_huang@aspeedtech.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [192.168.2.115] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 33K7rRRH055548 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ARM architecture only has 'memory', so all devices are accessed by MMIO if possible. Signed-off-by: Jammy Huang --- v2 changes: - Use MMIO after AST2500 which enable MMIO by default. --- drivers/gpu/drm/ast/ast_main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c index f83ce77127cb..d384e810fa4d 100644 --- a/drivers/gpu/drm/ast/ast_main.c +++ b/drivers/gpu/drm/ast/ast_main.c @@ -425,11 +425,12 @@ struct ast_private *ast_device_create(const struct drm_driver *drv, return ERR_PTR(-EIO); /* - * If we don't have IO space at all, use MMIO now and - * assume the chip has MMIO enabled by default (rev 0x20 - * and higher). + * After AST2500, MMIO is enabled by default, and it should be adapted + * to be compatible with Arm. */ - if (!(pci_resource_flags(pdev, 2) & IORESOURCE_IO)) { + if (pdev->revision >= 0x40) { + ast->ioregs = ast->regs + AST_IO_MM_OFFSET; + } else if (!(pci_resource_flags(pdev, 2) & IORESOURCE_IO)) { drm_info(dev, "platform has no IO space, trying MMIO\n"); ast->ioregs = ast->regs + AST_IO_MM_OFFSET; } base-commit: e62252bc55b6d4eddc6c2bdbf95a448180d6a08d -- 2.25.1