Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1710139rdb; Tue, 20 Feb 2024 05:00:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX8+i+sjzcVgJxz6NoxlArCkum5pI44zbdEO5BrG5vEmfxakn4JVr/fCO9epTU42xgKrLmvGAK4gjWx86M37Rn19jcNYaB0tpu1V4lY8g== X-Google-Smtp-Source: AGHT+IFJSh5lO0/tzlaBxQqcw8feYrbbSJ6ZQ7Lwe0z7EGZIWO+5DXLHIwIgwgGhwWWXzy/17pOn X-Received: by 2002:a17:906:1198:b0:a3e:a5b9:d69d with SMTP id n24-20020a170906119800b00a3ea5b9d69dmr3585793eja.74.1708434039130; Tue, 20 Feb 2024 05:00:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708434039; cv=pass; d=google.com; s=arc-20160816; b=nlAetgX3Az6fk94UiJz65ZtwU2f059tZAsiLbvusO9R+StGFrrXSp0cXNGL65DRYg9 VrDWe2gbYTGf2lPQu6xIP3FkdEuzv82PhcBrojJstYJPple+pRRdcDAHXzLl4whDz5xX X8cW50qqA41cFvjncfBMU0HtL6E00aBzqMIILLH7tiHQ+0CZqKqwMzOGGRf3W5kmqywE uRk/QjrTt/IvbWiKZD8TtTjLFVb3Ns83joTqHGwbvWe9jAjUyHQ2khVnozLwmORJTY5q KDnWAlhWNnRYdIbFsm17gvvO3LbLwkCW2pJrymVFzQajacCIG5Ae9h7NJqqSHFUYIyAO njXw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=MJU+qiLfShMKFnClWJ+LsA155QSh6V5eijJEbScCWrE=; fh=qvNfBa3AoYDNBt1uVhnLHRXMjxHOrnwZYJdcaTUolrA=; b=WmOpNrNcILdiLcuGAsVW9+vaJQCJkRg9WUG0QVi5wlqTcoV9Q02H2Um5Sc4NgGw8lw ZsteLp9qg9vcTpUt7YY+UQjJ3YdtMmmiiS++qYFw+q1l3imGtCpgdDVwstfO2Ve52is3 YEkBsiHcLttMIzu/vAFR/eo8NNNRtxy50MTIzryGi4MTLn4Hzu471RVjvLcV9einHYeX ujFz4rz2Y+SLzFIXFOFWLt9uVO4llnxbJM7whXNag+/L85yDrwp8CdYDgsVzlEtkenC0 ANzsdPTZ7wCd0A9WtM87BriLpZ2tQk3yePzYqswCwJZC++9R/8hPrUu47jdk2j8Yxiie gFbw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ErXJ9GPd; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-73050-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73050-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id s11-20020a170906354b00b00a3e7a8fe869si2209551eja.679.2024.02.20.05.00.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 05:00:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73050-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ErXJ9GPd; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-73050-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73050-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B18521F21385 for ; Tue, 20 Feb 2024 13:00:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6AC3169E06; Tue, 20 Feb 2024 12:59:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ErXJ9GPd" Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15BF16A036 for ; Tue, 20 Feb 2024 12:59:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708433984; cv=none; b=qS+EtgEizYyH195zoyBdA/yzXN9ZwXWLka/4iHUOUZVj9hCIogqwX1wx1TFa4HOmZjNniTePUWtnKY5VPHXbt5qci2888cxpofpT2sV/6TN1Lg9tW565yQH6WpZDrjyXkyWL/lrIZ33hrHY/elEx8mYmWahkkZ4KtqHusu9rB04= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708433984; c=relaxed/simple; bh=eoBqasf2Lf4kUVh5GoF8UMFjxTzmG4XIhpcZ+yy2rOQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oVXA/dKfwmPC1k8EPaVS85dx8siBXUABC142So2U5efuEImqZk7jRmFav5h6ANhqyskNZUGiNw6o+mof99xB9jSAXGh6hnDpJG4B/wZo2rxcFYNDp6rqj+jpEOI02E0hd//IiO6YBVFuuRwPocC9gYx65+SjubO87l9igH3aao4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ErXJ9GPd; arc=none smtp.client-ip=209.85.208.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-5643eccad0bso3966481a12.1 for ; Tue, 20 Feb 2024 04:59:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708433981; x=1709038781; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=MJU+qiLfShMKFnClWJ+LsA155QSh6V5eijJEbScCWrE=; b=ErXJ9GPdY2vCmdZZR65DgGzv4xGBcCIw41YwESt5pfLLNVT04z6FHsgse8/sMPZ20q uhEz9+GG9P5bqBhhbIesflY3YGaFlEiUv8R14d6FKuXCnXB89V1bSs3HCMvrGhjxjq0k E/4CqZUU03qqxl/B1vhiek1mDhKTtrFY63mFinobwCUTNfnHneK1eWXVspSfcRy+VDhj w3rNU8X4vAdyCb4aECTJLnGOlHMjv/qK6tSUDGIlTQng9tiWvk2TmeB7uvHEXiVNMfjj gTSg9NADViJSwuP6JQ7hzHavlRlHeYro2ogM0xWXOpO74ti+Cymzx7nAq2wrm+KtFXie w/xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708433981; x=1709038781; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MJU+qiLfShMKFnClWJ+LsA155QSh6V5eijJEbScCWrE=; b=g9s43xCoGRjMFDNHXI1dVFLOYZ9XMP49j1LVjY5UMTeXQQuGJLOOdWDgoZvPMisrk1 AkhhlqFq2JGc3V4zMe0pHFOQDEbdiG4m9z+WwY+Fkm2mwbYuBJNSnBB5za6R/N2AEqnS 2CAcaFnAQRKC1rhgfqFJQVt9ul6IdMPXL5Ktm1FdhP11RYPr7cDUPq+EfEgfDbT+zrmn 7a77bXrJGpzn5zL6ZVwLCu9huWGcwHLg9TVSMM5wKYuBd7SoRgtbd/N7/zacs9NegO9X IKD6ZCO0Ee6750J8dAMjbbVZHu7TSVP9ssEWuVEaBku14JckzRijB+pa0Q/Q441myb2K hBhw== X-Forwarded-Encrypted: i=1; AJvYcCUAkzTpR226ZLU3fHcyzTbCATs46ASDAATjDaHxyLp6EKvmeJVbwFMmpzXV0TUlWfJHpjTCAMwt4VWlQLYvCYNYfxB7aTZnC8y3cxlN X-Gm-Message-State: AOJu0Ywhvx9oh6PeoF5A5xTHq3Z/hAJPJDokihYtvuqn6V3hbPzBUudt 5Imp12B6R2UG4Tpl4JAMvscCoBsxYAd8yfjds+D6PrEdnBln87nq2Y17MoavW0Y= X-Received: by 2002:a17:906:ae9b:b0:a3e:e84b:232 with SMTP id md27-20020a170906ae9b00b00a3ee84b0232mr1571112ejb.75.1708433981473; Tue, 20 Feb 2024 04:59:41 -0800 (PST) Received: from [127.0.1.1] ([188.24.162.93]) by smtp.gmail.com with ESMTPSA id rf23-20020a1709076a1700b00a3ce36ce4f9sm3948802ejc.83.2024.02.20.04.59.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 04:59:41 -0800 (PST) From: Abel Vesa Date: Tue, 20 Feb 2024 14:59:23 +0200 Subject: [PATCH RFC v4 3/4] spmi: pmic-arb: Make core resources acquiring a version operation Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240220-spmi-multi-master-support-v4-3-dc813c878ba8@linaro.org> References: <20240220-spmi-multi-master-support-v4-0-dc813c878ba8@linaro.org> In-Reply-To: <20240220-spmi-multi-master-support-v4-0-dc813c878ba8@linaro.org> To: Stephen Boyd , Matthias Brugger , Bjorn Andersson , Konrad Dybcio , Dmitry Baryshkov , Neil Armstrong , AngeloGioacchino Del Regno , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Srini Kandagatla , Johan Hovold , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, Abel Vesa X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=7622; i=abel.vesa@linaro.org; h=from:subject:message-id; bh=eoBqasf2Lf4kUVh5GoF8UMFjxTzmG4XIhpcZ+yy2rOQ=; b=owEBbQKS/ZANAwAKARtfRMkAlRVWAcsmYgBl1KI1j15AdL3iObZKp8qMphgZYSKDsh31QNQGz 5Y2y/XmNEeJAjMEAAEKAB0WIQRO8+4RTnqPKsqn0bgbX0TJAJUVVgUCZdSiNQAKCRAbX0TJAJUV VqvlEACaWqBY3l0w5nJxEJWtUZlGVcc8i5vgbq9Ncmz8w4q5pUhhuIS/3b6W5hGZ4TL+tP/mg2q 6S789JPyXknh5/qovzv+uz+pOjxrRzEFKYRvTZDhzs1YXYbWEQKVI5OyxQ+bh7Rt957cYOkoqYG mHCndlJn19SfnHO936OBxfRdgBFtaScKy/AUdjcojLUPzkYpPORLiGf3/MEEk3MAtXj4IrTmosw da2mW5zL6nLvt7G2aLO/bKJgy273QHrx9fel3AsS2cuQ7KxNsg8ZLdFOiWiT1RyqGOK7XlxpKw1 qq1bYsd3lrRUhu4X0mIcv/cwwoPWNaWJyrhzFhy5NjIaYORHfPG/gR0m/HSwNmA+tuCCt+HlmFf dSOw1R1dzYWb/6+OwpjxrhRfGh1xSnAUzGegb6OPgxYI+LiBbtr6Xb8/t7L+m9nv/Iemz4lw3di WKxSiYOMUgty84gLbjOr2Jpz0lklzSiqLo0YByvdh0J8rX0p1fUKnw+aDfZXK6e6yil0IHi2IN2 WGQRW9ylhdxQLg9ucGvOZ9LvJX7FVXYDLN84atY5i0CRzjitKvtpnBIu63ciXDKB/Tvi5MPC5uk KPXcaABYYhJ5/jtiRnv+Pd6oWfBYsiMViXaMlgsKwduSOE9KZ1rofsPy2R8Mrxel98nAZ8P0A2z sb6iQ/31pk0uj/g== X-Developer-Key: i=abel.vesa@linaro.org; a=openpgp; fpr=6AFF162D57F4223A8770EF5AF7BF214136F41FAE Rather than setting up the core, obsrv and chnls in probe by using version specific conditionals, add a dedicated "get_core_resources" version specific op and move the acquiring in there. Signed-off-by: Abel Vesa --- drivers/spmi/spmi-pmic-arb.c | 115 +++++++++++++++++++++++++++---------------- 1 file changed, 72 insertions(+), 43 deletions(-) diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index 38fed8a585fe..5aad188a3db2 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -203,6 +203,7 @@ struct spmi_pmic_arb { */ struct pmic_arb_ver_ops { const char *ver_str; + int (*get_core_resources)(struct platform_device *pdev, void __iomem *core); int (*init_apid)(struct spmi_pmic_arb *pmic_arb, int index); int (*ppid_to_apid)(struct spmi_pmic_arb *pmic_arb, u16 ppid); /* spmi commands (read_cmd, write_cmd, cmd) functionality */ @@ -956,6 +957,19 @@ static int pmic_arb_init_apid_min_max(struct spmi_pmic_arb *pmic_arb) return 0; } +static int pmic_arb_get_core_resources_v1(struct platform_device *pdev, + void __iomem *core) +{ + struct spmi_pmic_arb *pmic_arb = platform_get_drvdata(pdev); + + pmic_arb->wr_base = core; + pmic_arb->rd_base = core; + + pmic_arb->max_periphs = PMIC_ARB_MAX_PERIPHS; + + return 0; +} + static int pmic_arb_init_apid_v1(struct spmi_pmic_arb *pmic_arb, int index) { u32 *mapping_table; @@ -1063,6 +1077,35 @@ static u16 pmic_arb_find_apid(struct spmi_pmic_arb *pmic_arb, u16 ppid) return apid; } +static int pmic_arb_get_obsrvr_chnls_v2(struct platform_device *pdev) +{ + struct spmi_pmic_arb *pmic_arb = platform_get_drvdata(pdev); + struct device *dev = &pdev->dev; + struct resource *res; + + pmic_arb->rd_base = devm_platform_ioremap_resource_byname(pdev, "obsrvr"); + if (IS_ERR(pmic_arb->rd_base)) + return PTR_ERR(pmic_arb->rd_base); + + pmic_arb->wr_base = devm_platform_ioremap_resource_byname(pdev, "chnls"); + if (IS_ERR(pmic_arb->wr_base)) + return PTR_ERR(pmic_arb->wr_base); + + return 0; +} + +static int pmic_arb_get_core_resources_v2(struct platform_device *pdev, + void __iomem *core) +{ + struct spmi_pmic_arb *pmic_arb = platform_get_drvdata(pdev); + + pmic_arb->core = core; + + pmic_arb->max_periphs = PMIC_ARB_MAX_PERIPHS; + + return pmic_arb_get_obsrvr_chnls_v2(pdev); +} + static int pmic_arb_ppid_to_apid_v2(struct spmi_pmic_arb *pmic_arb, u16 ppid) { u16 apid_valid; @@ -1246,6 +1289,18 @@ static int pmic_arb_offset_v5(struct spmi_pmic_arb *pmic_arb, u8 sid, u16 addr, return offset; } +static int pmic_arb_get_core_resources_v7(struct platform_device *pdev, + void __iomem *core) +{ + struct spmi_pmic_arb *pmic_arb = platform_get_drvdata(pdev); + + pmic_arb->core = core; + + pmic_arb->max_periphs = PMIC_ARB_MAX_PERIPHS_V7; + + return pmic_arb_get_obsrvr_chnls_v2(pdev); +} + /* * Only v7 supports 2 buses. Each bus will get a different apid count, read * from different registers. @@ -1469,6 +1524,7 @@ pmic_arb_apid_owner_v7(struct spmi_pmic_arb *pmic_arb, u16 n) static const struct pmic_arb_ver_ops pmic_arb_v1 = { .ver_str = "v1", + .get_core_resources = pmic_arb_get_core_resources_v1, .init_apid = pmic_arb_init_apid_v1, .ppid_to_apid = pmic_arb_ppid_to_apid_v1, .non_data_cmd = pmic_arb_non_data_cmd_v1, @@ -1484,6 +1540,7 @@ static const struct pmic_arb_ver_ops pmic_arb_v1 = { static const struct pmic_arb_ver_ops pmic_arb_v2 = { .ver_str = "v2", + .get_core_resources = pmic_arb_get_core_resources_v2, .init_apid = pmic_arb_init_apid_v1, .ppid_to_apid = pmic_arb_ppid_to_apid_v2, .non_data_cmd = pmic_arb_non_data_cmd_v2, @@ -1499,6 +1556,7 @@ static const struct pmic_arb_ver_ops pmic_arb_v2 = { static const struct pmic_arb_ver_ops pmic_arb_v3 = { .ver_str = "v3", + .get_core_resources = pmic_arb_get_core_resources_v2, .init_apid = pmic_arb_init_apid_v1, .ppid_to_apid = pmic_arb_ppid_to_apid_v2, .non_data_cmd = pmic_arb_non_data_cmd_v2, @@ -1514,6 +1572,7 @@ static const struct pmic_arb_ver_ops pmic_arb_v3 = { static const struct pmic_arb_ver_ops pmic_arb_v5 = { .ver_str = "v5", + .get_core_resources = pmic_arb_get_core_resources_v2, .init_apid = pmic_arb_init_apid_v5, .ppid_to_apid = pmic_arb_ppid_to_apid_v5, .non_data_cmd = pmic_arb_non_data_cmd_v2, @@ -1529,6 +1588,7 @@ static const struct pmic_arb_ver_ops pmic_arb_v5 = { static const struct pmic_arb_ver_ops pmic_arb_v7 = { .ver_str = "v7", + .get_core_resources = pmic_arb_get_core_resources_v7, .init_apid = pmic_arb_init_apid_v7, .ppid_to_apid = pmic_arb_ppid_to_apid_v5, .non_data_cmd = pmic_arb_non_data_cmd_v2, @@ -1565,16 +1625,6 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev) pmic_arb = spmi_controller_get_drvdata(ctrl); pmic_arb->spmic = ctrl; - /* - * Please don't replace this with devm_platform_ioremap_resource() or - * devm_ioremap_resource(). These both result in a call to - * devm_request_mem_region() which prevents multiple mappings of this - * register address range. SoCs with PMIC arbiter v7 may define two - * arbiter devices, for the two physical SPMI interfaces, which share - * some register address ranges (i.e. "core", "obsrvr", and "chnls"). - * Ensure that both devices probe successfully by calling devm_ioremap() - * which does not result in a devm_request_mem_region() call. - */ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "core"); core = devm_ioremap(&ctrl->dev, res->start, resource_size(res)); if (IS_ERR(core)) @@ -1584,44 +1634,23 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev) hw_ver = readl_relaxed(core + PMIC_ARB_VERSION); - if (hw_ver < PMIC_ARB_VERSION_V2_MIN) { + if (hw_ver < PMIC_ARB_VERSION_V2_MIN) pmic_arb->ver_ops = &pmic_arb_v1; - pmic_arb->wr_base = core; - pmic_arb->rd_base = core; - } else { - pmic_arb->core = core; - - if (hw_ver < PMIC_ARB_VERSION_V3_MIN) - pmic_arb->ver_ops = &pmic_arb_v2; - else if (hw_ver < PMIC_ARB_VERSION_V5_MIN) - pmic_arb->ver_ops = &pmic_arb_v3; - else if (hw_ver < PMIC_ARB_VERSION_V7_MIN) - pmic_arb->ver_ops = &pmic_arb_v5; - else - pmic_arb->ver_ops = &pmic_arb_v7; - - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, - "obsrvr"); - pmic_arb->rd_base = devm_ioremap(&ctrl->dev, res->start, - resource_size(res)); - if (IS_ERR(pmic_arb->rd_base)) - return PTR_ERR(pmic_arb->rd_base); - - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, - "chnls"); - pmic_arb->wr_base = devm_ioremap(&ctrl->dev, res->start, - resource_size(res)); - if (IS_ERR(pmic_arb->wr_base)) - return PTR_ERR(pmic_arb->wr_base); - } + else if (hw_ver < PMIC_ARB_VERSION_V3_MIN) + pmic_arb->ver_ops = &pmic_arb_v2; + else if (hw_ver < PMIC_ARB_VERSION_V5_MIN) + pmic_arb->ver_ops = &pmic_arb_v3; + else if (hw_ver < PMIC_ARB_VERSION_V7_MIN) + pmic_arb->ver_ops = &pmic_arb_v5; + else + pmic_arb->ver_ops = &pmic_arb_v7; dev_info(&ctrl->dev, "PMIC arbiter version %s (0x%x)\n", pmic_arb->ver_ops->ver_str, hw_ver); - if (hw_ver < PMIC_ARB_VERSION_V7_MIN) - pmic_arb->max_periphs = PMIC_ARB_MAX_PERIPHS; - else - pmic_arb->max_periphs = PMIC_ARB_MAX_PERIPHS_V7; + err = pmic_arb->ver_ops->get_core_resources(pdev, core); + if (err) + return err; err = pmic_arb->ver_ops->init_apid(pmic_arb, 0); if (err) -- 2.34.1