From patchwork Fri Apr 21 00:33:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jammy Huang X-Patchwork-Id: 86097 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp727235vqo; Thu, 20 Apr 2023 17:57:01 -0700 (PDT) X-Google-Smtp-Source: AKy350bArKQqBGpU1L8OftHFCAeHEAw0F4Lm9sBCgf/D5WLVJyXAqVuexTEdFALmJdo7H8BkGUHL X-Received: by 2002:a17:902:b490:b0:1a9:1b4:9fe3 with SMTP id y16-20020a170902b49000b001a901b49fe3mr2491355plr.19.1682038621273; Thu, 20 Apr 2023 17:57:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682038621; cv=none; d=google.com; s=arc-20160816; b=AOurMB/qI5z5AthukVtTehMtpPlbAIzrEuQ5Vz+UoVsleDHtvvTteYMNGuB4ySCFc9 5TT1WHnqwFR/aRipH8pPSgzehsqLOFJBUrwvHajulg1Tw+YExETyjxcUdOn+CBcxUKR7 0T9Vn+p+YQmWrDhOaA2mRNmbv9iLeIUWaGYmD4MDAI3Lt5gaQ4R3SLvwJCqgofUVq3Oj BBe2qyoMb3FQTryHieK27dAJjlHK1MHrv2bN542EMLq0dfFEIQvw16AGASt5Go5ybexh gC4bdGCCHQN4OY9wOWay1GxUNJ6oHot0nOuSsHb7hCkgJgU9P2bA95DmI1/GDXQku3Ge qv2g== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a18-20020a170902ecd200b001a6dfb34f89si3438200plh.386.2023.04.20.17.56.46; Thu, 20 Apr 2023 17:57:01 -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 S233086AbjDUAel (ORCPT + 99 others); Thu, 20 Apr 2023 20:34:41 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763745329500479508?= X-GMAIL-MSGID: =?utf-8?q?1763745329500479508?= 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(-) base-commit: e62252bc55b6d4eddc6c2bdbf95a448180d6a08d 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; }