From patchwork Tue Feb 9 12:59:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 12078075 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55C89C433DB for ; Tue, 9 Feb 2021 13:03:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ECBEF64E75 for ; Tue, 9 Feb 2021 13:03:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ECBEF64E75 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lRsv+EZBcc0l9XWbyujdyhqzv1f/k6hr+qyUCK7eDWQ=; b=jdJvcAQpTVbMNqznnY+CWNDTR R4rs6vlB29afZPJD4fVDv9gMi/v/QrfCCXAdTvH30CWyHri5UzK/mrswxvw3D1R1R9PsE8aBsol1/ 3R+51B0D9HWdUySE4EOtH9oAf26/jnJJPH03YHomoE36r/VZqp1rz8huvmoF8xnlkDykvDYEPvIxt Cx9bauFNNiIL4QXUh+CoDaK/l5KTGw8eMbbpoT91/42Zxi0fHJ8LQ2IZdxxkQDcr1qNzk2vgMGkxO uhNwGAAMn+dsriIf47jPvidTZqP9CO1Cqd+k2jJoJshbvUQaz9aAWajpyrmUIC21IgVnL/SS0LQ9C GHw2dQGAw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l9SeA-0004bU-Cu; Tue, 09 Feb 2021 13:01:38 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l9SdL-0004Iq-JC; Tue, 09 Feb 2021 13:00:52 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 75425AFC1; Tue, 9 Feb 2021 13:00:46 +0000 (UTC) From: Nicolas Saenz Julienne To: f.fainelli@gmail.com, linux-kernel@vger.kernel.org, Lee Jones , Nicolas Saenz Julienne , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com Subject: [RFC/PATCH v2 08/16] mfd: bcm2835-pm: Add support for BCM2711 Date: Tue, 9 Feb 2021 13:59:04 +0100 Message-Id: <20210209125912.3398-9-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210209125912.3398-1-nsaenzjulienne@suse.de> References: <20210209125912.3398-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210209_080047_906190_80710C69 X-CRM114-Status: GOOD ( 20.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mripard@kernel.org, eric@anholt.net, wahrenst@gmx.net, phil@raspberrypi.com, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In BCM2711 the new Argon ASB took over V3D. The old ASB is still present with the ISP and H264 bits, and V3D is in the same place in the new ASB as the old one. As per the devicetree bindings, BCM2711 will provide both the old and new ASB resources, so get both of them and pass them into 'bcm2835-power,' which will take care of selecting which one to use accordingly. Since the Argon ASB's resources were being provided prior to formalizing the bindings[1], also support the old firmwares that didn't use 'reg-names.' Signed-off-by: Nicolas Saenz Julienne [1] See: 7dbe8c62ceeb ("ARM: dts: Add minimal Raspberry Pi 4 support") --- Changes since v1: - Use reg-names - Correct ASB names drivers/mfd/bcm2835-pm.c | 25 +++++++++++++++++++++++-- include/linux/mfd/bcm2835-pm.h | 1 + 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/bcm2835-pm.c b/drivers/mfd/bcm2835-pm.c index 182ccdc2a06b..26666ad11f12 100644 --- a/drivers/mfd/bcm2835-pm.c +++ b/drivers/mfd/bcm2835-pm.c @@ -6,6 +6,7 @@ * the WDT and power drivers. */ +#include #include #include #include @@ -17,6 +18,9 @@ #include #include +#define BCM2835 BIT(1) +#define BCM2711 BIT(2) + static const struct mfd_cell bcm2835_pm_devs[] = { { .name = "bcm2835-wdt" }, }; @@ -28,6 +32,8 @@ static const struct mfd_cell bcm2835_power_devs[] = { static int bcm2835_pm_get_pdata(struct platform_device *pdev, struct bcm2835_pm *pm) { + bool is_bcm2711 = (uintptr_t)device_get_match_data(pm->dev) & BCM2711; + /* If no 'reg-names' property is found we can assume we're using old * firmware. */ @@ -41,6 +47,10 @@ static int bcm2835_pm_get_pdata(struct platform_device *pdev, pm->rpivid_asb = devm_platform_ioremap_resource(pdev, 1); if (IS_ERR(pm->rpivid_asb)) pm->rpivid_asb = NULL; + + pm->argon_asb = devm_platform_ioremap_resource(pdev, 2); + if (IS_ERR(pm->argon_asb)) + pm->argon_asb = NULL; } else { pm->base = devm_platform_ioremap_resource_byname(pdev, "pm"); if (IS_ERR(pm->base)) @@ -50,6 +60,16 @@ static int bcm2835_pm_get_pdata(struct platform_device *pdev, "rpivid_asb"); if (IS_ERR(pm->base)) pm->rpivid_asb = NULL; + + pm->argon_asb = devm_platform_ioremap_resource_byname(pdev, + "argon_asb"); + if (IS_ERR(pm->base)) + pm->argon_asb = NULL; + + if (pm->argon_asb && !is_bcm2711) { + dev_err(pm->dev, "Argon ASB support only present in BCM2711\n"); + return -EINVAL; + } } return 0; @@ -90,8 +110,9 @@ static int bcm2835_pm_probe(struct platform_device *pdev) } static const struct of_device_id bcm2835_pm_of_match[] = { - { .compatible = "brcm,bcm2835-pm-wdt", }, - { .compatible = "brcm,bcm2835-pm", }, + { .compatible = "brcm,bcm2835-pm-wdt", .data = (void *)BCM2835}, + { .compatible = "brcm,bcm2835-pm", .data = (void *)BCM2835}, + { .compatible = "brcm,bcm2711-pm", .data = (void *)BCM2711}, {}, }; MODULE_DEVICE_TABLE(of, bcm2835_pm_of_match); diff --git a/include/linux/mfd/bcm2835-pm.h b/include/linux/mfd/bcm2835-pm.h index ed4bd548db09..89fb2b5cdc1a 100644 --- a/include/linux/mfd/bcm2835-pm.h +++ b/include/linux/mfd/bcm2835-pm.h @@ -9,6 +9,7 @@ struct bcm2835_pm { struct device *dev; void __iomem *base; void __iomem *rpivid_asb; + void __iomem *argon_asb; }; #endif /* BCM2835_MFD_PM_H */