Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1557373rwr; Thu, 20 Apr 2023 17:40:06 -0700 (PDT) X-Google-Smtp-Source: AKy350Ypgam+OSb583NSiSXXEyZHaUDczqprc2dXJbecGDNxWxkX5l0yUKJc26yOtuml1YKU9gJK X-Received: by 2002:a05:6a20:7351:b0:f0:4395:fbf1 with SMTP id v17-20020a056a20735100b000f04395fbf1mr4292366pzc.27.1682037606088; Thu, 20 Apr 2023 17:40:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682037606; cv=none; d=google.com; s=arc-20160816; b=LeaCrMbUQHBD9eIjH2PQ0IqJfAj6VE0oSEHzZwz70Fm/ndNnM8ZjeJZpCQY0BiinOw QTSBJwr4ECaqLoSu1pvXW8zE655l9/ZYMxJJy/BlKXWuQmb88RNIBi92ST3bTSQgN3zn BCX2Xd1j3ZZ2/ELSivT7U4+0yz3YFnlObixmuc/383MogTSw6kHE0dRgqHuxeq1iyvzh /QvpPiZIgw8sWkTFm5LY13n0UJ03Q/TXz9iGN7sXs7tbUWCe88jWD2CfBu7FFnNiK/S5 958yrOEHAhN/+8OCAt5EIpthLfa+FvPB+q7F2QtvEUEUkE+hNOsskTKCMDnTdQi+SR1V 0F9Q== 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=mfX1Cc00r7E+iyvNGWtPorQQj8KtCvk/RxAVXXKfWa4=; b=w4oF4spxdZv+RztpeKlwoJSTgB4GGmF5RW4gHbeHZumc6a48Xoe4thygsTC/hVzIcx 9TKk1sHWLfy0687MPnKcm3m/xlAIlYWLbJO62UQrvEs8Q4MgkleuFfzfNXUdJbp9/0sQ eWJOsDxP50ULOJC13oX6gGjWOhXVo2VIZyutS5rNvarzMwstXBvBUEgFcDr4XNAMTqPC 3ZgHjNgs2R6fmnkWZxUpGkB1R+1K/i7hCtdmiyF8WpfWeyzKVpOhDrATqf7iekBMjjZF kff5lHMhMJ1wgNTKlYHqS2Cr0ZlEeM98CQFY015PVvdN6JejoJEdGm2nnr40K/OdYNTK LyRQ== 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 h192-20020a636cc9000000b004fb33a76e2csi2829854pgc.834.2023.04.20.17.39.51; Thu, 20 Apr 2023 17:40:06 -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 S232146AbjDUAek (ORCPT + 99 others); Thu, 20 Apr 2023 20:34:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229521AbjDUAej (ORCPT ); Thu, 20 Apr 2023 20:34:39 -0400 Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8C5946A4 for ; Thu, 20 Apr 2023 17:34:36 -0700 (PDT) Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 33L0HaJe052144; Fri, 21 Apr 2023 08:17:36 +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; Fri, 21 Apr 2023 08:34:00 +0800 From: Jammy Huang To: , CC: , , , Subject: [PATCH v3] drm/ast: Fix ARM compatibility Date: Fri, 21 Apr 2023 08:33:54 +0800 Message-ID: <20230421003354.27767-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 33L0HaJe052144 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 Reviewed-by: Thomas Zimmermann --- v2 changes: - Use MMIO after AST2500 which enable MMIO by default. v3 changes: - Correct comments --- 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..a6d0ee4da2b8 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 adopted + * 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