From patchwork Thu Apr 20 08:09:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jammy Huang X-Patchwork-Id: 85778 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp178626vqo; Thu, 20 Apr 2023 01:52:13 -0700 (PDT) X-Google-Smtp-Source: AKy350acqJymJiXFYIAqEQFKQUj+lMFHpD/yulfc9R5lHjaFUFMu9F/HfKUkjsm+wh9frU0JSEuN X-Received: by 2002:a17:903:2301:b0:1a6:54cd:ccd9 with SMTP id d1-20020a170903230100b001a654cdccd9mr875198plh.9.1681980733366; Thu, 20 Apr 2023 01:52:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681980733; cv=none; d=google.com; s=arc-20160816; b=sSvHaSibhiBAYBUzJm7vQpXDVHubkfNRAs+w/0YboEuGWi1Ts5nCvKCzqM+yR+yJrt C12fafiKIgK6cK+KIqLSC66CTVGvdYea1Jup+Cb7aVGErWjX6wOiWR94usr2Sec6me7Q 8WQ4k42wApVFXPCW2HFMHlQlkYX1jLwfYe9lW6BJW11TbuY7IW/q3AgtWvogPtc9eMKd n+SX3iuhCebjZJTzpmzeeRLqGsvljNGihqjNvfZ6oEL8o1rPS70iRFswjTrE8Kb2kISH 7+MIlNkAtNnyMl18HL0nAmmobSYfMFW5rnbfoRktoNQEe3SQMCrt9WFN1s9qVg8dEr/B k/fQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bi7-20020a170902bf0700b0019c3ce49a13si1261996plb.372.2023.04.20.01.52.00; Thu, 20 Apr 2023 01:52:13 -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 S229612AbjDTIK3 (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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763684629402060153?= X-GMAIL-MSGID: =?utf-8?q?1763684629402060153?= 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. --- 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..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; }