Message ID | 20230420080947.27226-1-jammy_huang@aspeedtech.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> 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 <rfc822;cjcooper78@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; 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 <jammy_huang@aspeedtech.com> To: <airlied@redhat.com>, <tzimmermann@suse.de> CC: <airlied@gmail.com>, <daniel@ffwll.ch>, <dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org> 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: <linux-kernel.vger.kernel.org> 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?= |
Series |
[v2] drm/ast: Fix ARM compatibility
|
|
Commit Message
Jammy Huang
April 20, 2023, 8:09 a.m. UTC
ARM architecture only has 'memory', so all devices are accessed by
MMIO if possible.
Signed-off-by: Jammy Huang <jammy_huang@aspeedtech.com>
---
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
Comments
Hi Am 20.04.23 um 10:09 schrieb Jammy Huang: > ARM architecture only has 'memory', so all devices are accessed by > MMIO if possible. > > Signed-off-by: Jammy Huang <jammy_huang@aspeedtech.com> > --- > 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 By 'adapted', you mean 'adopted'? Apart from that: Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> I also ran this patch on an AST2100, which still works as before. Best regards Thomas > + * 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 -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Hi Thomas, Thanks for help. I will update a new patch per your comments On 2023/4/20 下午 04:57, Thomas Zimmermann wrote: > Hi > > Am 20.04.23 um 10:09 schrieb Jammy Huang: >> ARM architecture only has 'memory', so all devices are accessed by >> MMIO if possible. >> >> Signed-off-by: Jammy Huang <jammy_huang@aspeedtech.com> >> --- >> 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 > > By 'adapted', you mean 'adopted'? > > Apart from that: > > Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> > > I also ran this patch on an AST2100, which still works as before. > > Best regards > Thomas > >> + * 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 >
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; }