From patchwork Tue Jul 11 14:22:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 13308858 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 96F39C001DC for ; Tue, 11 Jul 2023 14:23:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=0ytjVID+R/F39GQVR6LdOd7h7iX75HP337tgGBxxp6M=; b=aypv1WBAM8b3rM F0yTouCfiOnCWW2aRCyw8DzITEQo/niF1CHWhJxI+G+nvqSZi9offgdB4+eYsn0dGHicSkG1uQ2sC tTXxcxNySsFlaq2mHB2gXO/tDwRgU/V0W1hGf37nn2jQHBpOZvPc+A/mqAm4DvUpUP5uV897GpLnP gVy6dmnQ4V/hBpHNXKhgI1FfHftSUrP2ZsUYzBIPIR4TZ5xGuEHsSk9i/bGSpV4L+wF0gkOswWltK c9sNn6rG1qrekpQIPFguvSDbxdpJG+HaP08IVnYIm7829haKhduRqMDTSTcA03oIzvpNghoEM9hIf /n6HdgZ+IANE41yA4fLQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qJEGL-00F7Sp-1b; Tue, 11 Jul 2023 14:22:45 +0000 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qJEGI-00F7QD-2B for linux-arm-kernel@lists.infradead.org; Tue, 11 Jul 2023 14:22:44 +0000 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-4fba74870abso8667062e87.0 for ; Tue, 11 Jul 2023 07:22:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689085360; x=1691677360; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=I8/R65mfXAHzbxX/Yt/oiagP1RewF0H/jSZoqHRKyvw=; b=dCOHcZgRV7aQaBQJZEZkD8dFT9zvxOL0hkhcvBNSBUON9Vq4i7QBWmjlgIK0rUhj5G X8bilbLBLi4EO2GlwctmtGL0ZCFgHrPHSaGK5pf5J5yip06zF6HeHRI57NNcaOYcOh66 ZquLBr6OKIgvq5KwVU/MeHe1sfkNZ+qprXu0K3+H5E0/8ghjptf9HJb3ZHEuxzdE9Ypo wgQnTFka3NbUsTQOR7Q4yOkpIbswbJRDqOWDQQV7yvsB5kG/P2BLIRxF9WSzupo9q9OK yAl0MFVP+1ity570RkO9aeo3VDFQnA2p4hEkl0EA1DJNAVSX/NSZFHFM1jDEYHgbl1rm Wr9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689085360; x=1691677360; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=I8/R65mfXAHzbxX/Yt/oiagP1RewF0H/jSZoqHRKyvw=; b=cvDjhaM2NCYvkCCG8QnNyo7nWj+iKoufiqsZnZJ168zmMOZ8r+E+f0EsRLP3XdSsWc WQQGsLBpLXSx3lQHjKmogR2DA3J5gaLoXcJzrYDQdAcyVIObVcxL48qIgLXwAr5e2NMD 9RnsbxowVnFxRsH8yz49ynEJHosFcLmR3o/bAVM7hfX/hmP1qIs4DKPS3n1C/0N741UJ k9939NJEnkw3pv+02Kp42pdngjEOrLyMdRPjEatduKSYE/LsvDkhOw2QoMT4AGm89MZj jPDaErH1K8xjozTy5OeJNgrOURwQA9GJxh+3C3t9KJ2cITyd1uN/w6Sy7zu2/D24wuOZ Hhew== X-Gm-Message-State: ABy/qLbnTC+3JJdqnb5/RnF6l6Wv5tmr/qta5AntHLrfffJCgpovjqYC lLultLRaoFnKZCMYufPZEibFUQ== X-Google-Smtp-Source: APBJJlE/tivtaqrrtnHL9NcH9jALxO9JvYPsHziSzSo82znvSr4dpsGom1ZqDwK6Qbzn+voN8gwwvw== X-Received: by 2002:a05:6512:2017:b0:4fb:89e2:fc27 with SMTP id a23-20020a056512201700b004fb89e2fc27mr12392141lfb.54.1689085359868; Tue, 11 Jul 2023 07:22:39 -0700 (PDT) Received: from uffe-tuxpro14.. (h-94-254-63-18.NA.cust.bahnhof.se. [94.254.63.18]) by smtp.gmail.com with ESMTPSA id eo29-20020a056512481d00b004f85885cff1sm337106lfb.134.2023.07.11.07.22.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jul 2023 07:22:39 -0700 (PDT) From: Ulf Hansson To: Arnd Bergmann , Olof Johansson Cc: Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Linus Walleij Subject: [PATCH v2 17/18] ARM: ux500: Convert power-domain code into a regular platform driver Date: Tue, 11 Jul 2023 16:22:37 +0200 Message-Id: <20230711142237.751837-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230711_072242_714807_70FE409B X-CRM114-Status: GOOD ( 19.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To make the code more standalone and moveable, let's convert it into a platform driver. Cc: Linus Walleij Signed-off-by: Ulf Hansson Reviewed-by: Linus Walleij --- arch/arm/mach-ux500/cpu-db8500.c | 5 ----- arch/arm/mach-ux500/pm_domains.c | 25 ++++++++++++++++++++----- arch/arm/mach-ux500/pm_domains.h | 17 ----------------- 3 files changed, 20 insertions(+), 27 deletions(-) delete mode 100644 arch/arm/mach-ux500/pm_domains.h diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c index 7cc0dd8ed991..b1a70f203372 100644 --- a/arch/arm/mach-ux500/cpu-db8500.c +++ b/arch/arm/mach-ux500/cpu-db8500.c @@ -26,8 +26,6 @@ #include #include -#include "pm_domains.h" - static int __init ux500_l2x0_unlock(void) { int i; @@ -115,9 +113,6 @@ static const struct of_device_id u8500_local_bus_nodes[] = { static void __init u8500_init_machine(void) { - /* Initialize ux500 power domains */ - ux500_pm_domains_init(); - of_platform_populate(NULL, u8500_local_bus_nodes, NULL, NULL); } diff --git a/arch/arm/mach-ux500/pm_domains.c b/arch/arm/mach-ux500/pm_domains.c index 427b9ac4af6c..3d4f111ed156 100644 --- a/arch/arm/mach-ux500/pm_domains.c +++ b/arch/arm/mach-ux500/pm_domains.c @@ -6,6 +6,9 @@ * * Implements PM domains using the generic PM domain for ux500. */ +#include +#include +#include #include #include #include @@ -13,7 +16,6 @@ #include #include -#include "pm_domains.h" static int pd_power_off(struct generic_pm_domain *domain) { @@ -49,18 +51,17 @@ static struct generic_pm_domain *ux500_pm_domains[NR_DOMAINS] = { [DOMAIN_VAPE] = &ux500_pm_domain_vape, }; -static const struct of_device_id ux500_pm_domain_matches[] __initconst = { +static const struct of_device_id ux500_pm_domain_matches[] = { { .compatible = "stericsson,ux500-pm-domains", }, { }, }; -int __init ux500_pm_domains_init(void) +static int ux500_pm_domains_probe(struct platform_device *pdev) { - struct device_node *np; + struct device_node *np = pdev->dev.of_node; struct genpd_onecell_data *genpd_data; int i; - np = of_find_matching_node(NULL, ux500_pm_domain_matches); if (!np) return -ENODEV; @@ -77,3 +78,17 @@ int __init ux500_pm_domains_init(void) of_genpd_add_provider_onecell(np, genpd_data); return 0; } + +static struct platform_driver ux500_pm_domains_driver = { + .probe = ux500_pm_domains_probe, + .driver = { + .name = "ux500_pm_domains", + .of_match_table = ux500_pm_domain_matches, + }, +}; + +static int __init ux500_pm_domains_init(void) +{ + return platform_driver_register(&ux500_pm_domains_driver); +} +arch_initcall(ux500_pm_domains_init); diff --git a/arch/arm/mach-ux500/pm_domains.h b/arch/arm/mach-ux500/pm_domains.h deleted file mode 100644 index 33c55f2c6b3c..000000000000 --- a/arch/arm/mach-ux500/pm_domains.h +++ /dev/null @@ -1,17 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (C) 2014 Linaro Ltd. - * - * Author: Ulf Hansson - */ - -#ifndef __MACH_UX500_PM_DOMAINS_H -#define __MACH_UX500_PM_DOMAINS_H - -#ifdef CONFIG_PM_GENERIC_DOMAINS -extern int __init ux500_pm_domains_init(void); -#else -static inline int ux500_pm_domains_init(void) { return 0; } -#endif - -#endif