Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2338776rdb; Wed, 21 Feb 2024 04:53:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVaT215/1PVb6YdPWzHL4Us6SaAw/oiGc4DADTTOX3HWaD+5dVIybxeo3TTxJtexa80DgIpBLMqSJoJNSLfdTXOj8Y6zU7lfIFYZgdgog== X-Google-Smtp-Source: AGHT+IGXWp1MUO1Wh8Kp5dS0W/tHdQUPV/qUWRkjMeq76wQK3tYbDg7VzFeGvOnZDDCfF6YzwnlB X-Received: by 2002:a17:906:1555:b0:a3f:268:a8f8 with SMTP id c21-20020a170906155500b00a3f0268a8f8mr3202353ejd.71.1708520027197; Wed, 21 Feb 2024 04:53:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708520027; cv=pass; d=google.com; s=arc-20160816; b=0CLalqBU4g78tj3uDdMP9UQj9n5j3118o1/EGIDWFtiRPfZ3qGla8FNffc4spZ6tMZ glgI/+/rR2jxxO9VH8ZJZhm9Yr0MrIZEFaPL7zzT3vMV8MhfvVlAVyqJrTTq7U/AqDT5 s25XIj59GBR6Isdg3dZXKjSRV/j8APWHbO61jeAXavAkvAwZGOsxV115ahRScwTt1cXk oIUJNbOz5uBpp1YF06rFP4q1W8z/MLLsWWPdLoUa8gXuxjlXRL7xZ622gv1p3CwSkVa0 aZ5jKa0OoFPJt8c9QQVMsR4qJrcviKaXKpfHXt4xPFvZPjTxajnXZHMlpi6TZmy1lLji LyKg== 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=nJWCFRrkjZXs2WI32Il+ppCE1cfB8jGTI/OTy71gmgo=; fh=Xja2+bRZ9+c+Hr24bCfAjCA4fbdfWqJv28yyEoivCpM=; b=bySkXlZ1W8FDbCaPcpHrAT4L4Qraj8Sgy2LTLkqHNNL3ivZCQUfQuoPlrVjvHrYtA0 7UaX4WD9u0Z8wh1VRMMeCGHX9dLUrPD6ikgly+52/tmMpLVuymXoZaSSXay/HEUg1nRr 1CcZuSjoOp9+JO4UV47MfSo9fJv8x+aSyTl5y30gJUxcWZ8vVvj7onIHQUvO5kXLQvaV brtFvQ0RGUFVwQ4DPJFBU5YJTeIkZm9zE7vfjdsPCv0I5EyB6O1r3FMgROzlJFXTbOM/ PS9UhJ4FogS2JPwCcjcAbFJ9bFw+C5YpsqnjMhKWn+hPJeu2V5tznXuctzDGUZysFh5e ChtQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="HrXba5/y"; 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-74732-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74732-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. [147.75.80.249]) by mx.google.com with ESMTPS id l18-20020a1709061c5200b00a3ed810b4e5si2017922ejg.505.2024.02.21.04.53.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 04:53:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-74732-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="HrXba5/y"; 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-74732-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74732-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 BF0511F23A26 for ; Wed, 21 Feb 2024 12:53:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2EA2C6EB42; Wed, 21 Feb 2024 12:52:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="HrXba5/y" Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (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 9362569D2E for ; Wed, 21 Feb 2024 12:52:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708519977; cv=none; b=GvCfmWwg8hsRU/j/Krgi8eGCefunXxsg2gaGHA0HcPj8mupzT8a2SLcTMaKWH7uLyeph6Jg6ZWM5VkoPFQnStWbHXNGDndm+d8iRBhg7XkQu4j6I92WzYprMgBY0iHUimlxJTZ9KUJyfBRdi4eEnHSR1gdTgZfruguyOKJEEtS4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708519977; c=relaxed/simple; bh=BMjyfCYiK4XOXFgvoI4oZtTuPAW/B6RJ1erAWAohJjQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=REm7B9cnE9lk+EieKV7IExnFlwVytx+uNKvf6VT9cTh7yCUUp+K1g/tgwxcXxUY4asTo5axKYpR7vNBczsjWxxYH9gI4u1RqosL2avWny1Xg0ckSXuITJ9UZQrZ8RZHr5ju7O78p+zQs0vaZw0f7dyJl4bH5b1V4cv00jgWI2jM= 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=HrXba5/y; arc=none smtp.client-ip=209.85.218.47 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-ej1-f47.google.com with SMTP id a640c23a62f3a-a3f1bf03722so163496866b.1 for ; Wed, 21 Feb 2024 04:52:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708519974; x=1709124774; 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=nJWCFRrkjZXs2WI32Il+ppCE1cfB8jGTI/OTy71gmgo=; b=HrXba5/yWj9jyQhkp6DkIOWvI0SAHKJIIdRy3etH3BenZhDjRce1xjiU9++E3RHpr2 tNmvUgnwi7Vw0XI8D+m2C6Mb2r77X8mtHOcyriG+u93Fg7wFnFiLOkEozI+YjM28DR/V +wrijtAW6GPliB6HppLQgxZ0vQhJnT+rzH91ZUHjX8PXGIi/YQRWcyzcSJqyLRBK+qMv qCBY/vBG9/bXraXoJLGXIIiR3th88h/TNdqLxp0GpKmG8wFWIW1/hIGiCXgP0w3HG9S7 eS3mubclmZ5rbPIzkxKnXa/WHPU9AQ5bIWThGwnFqNFPV8CCG9sUP+SclxVZPBBwM2Ps Er0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708519974; x=1709124774; 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=nJWCFRrkjZXs2WI32Il+ppCE1cfB8jGTI/OTy71gmgo=; b=c/T4ImkG/0PsHDXIiKDwvf+dLpqKp0wBs1e4YnRFpj6IZgC6h2T0Rr6GLv5V6cVkxs FIRHr+1EA9OHb6wZHGRhEFChHlPDRugiX2/6xTl/IjZ6dMlT6awf1GUKMMyUwy0hrSgE ig390b7saGgOujtid5fm+yB5ObXiLp74hLf7qGqZwyNw4ebBGMLuSaaGEXbNOJOWbf4K LMcUxjCgkSjGHWlk6b4Aq848tl6mZ3kVHQVWcOs9tw7VruiL+NGb5hIPrwXmIxkOp6KR +XUMkbvoZpmboTaeOU+EtBGkxN+HXjdcM2UO73vhtBpbI1lY5axuC6WcZA1tnngOobfv Wm5Q== X-Forwarded-Encrypted: i=1; AJvYcCXWMwDgnd056Vca8tCjrxQ8RlvH+H1zNq1KcfpIDsycNYMdwDHo+baP5PZvWB81B+eq47WbbYMmOPUZVYjaEH+0/F1dYbrbts6Ilfk5 X-Gm-Message-State: AOJu0YwrKIHRF5niW24jRkhWjkvwo+h2BkFWV8LnUgHaAnCqRod4WQmP am9PG3cWY8yHpWgTt9P/2OfyLDSkDmQmPTD6yMIDUAC/69EyKToLPxQnG/qM6eY= X-Received: by 2002:a17:906:2b53:b0:a3e:5adb:cb21 with SMTP id b19-20020a1709062b5300b00a3e5adbcb21mr6741071ejg.59.1708519973858; Wed, 21 Feb 2024 04:52:53 -0800 (PST) Received: from [127.0.1.1] ([188.24.162.93]) by smtp.gmail.com with ESMTPSA id tl23-20020a170907c31700b00a3da5bf34absm4930392ejc.207.2024.02.21.04.52.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 04:52:53 -0800 (PST) From: Abel Vesa Date: Wed, 21 Feb 2024 14:52:39 +0200 Subject: [PATCH v5 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: <20240221-spmi-multi-master-support-v5-3-3255ca413a0b@linaro.org> References: <20240221-spmi-multi-master-support-v5-0-3255ca413a0b@linaro.org> In-Reply-To: <20240221-spmi-multi-master-support-v5-0-3255ca413a0b@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=7561; i=abel.vesa@linaro.org; h=from:subject:message-id; bh=BMjyfCYiK4XOXFgvoI4oZtTuPAW/B6RJ1erAWAohJjQ=; b=owEBbQKS/ZANAwAKARtfRMkAlRVWAcsmYgBl1fIdHibzQ+Jjjc8jNSuux/G34CPe3rNbfTzQp 8ARjlhyG8aJAjMEAAEKAB0WIQRO8+4RTnqPKsqn0bgbX0TJAJUVVgUCZdXyHQAKCRAbX0TJAJUV VtwQD/4oWs1npr+DBf9g/6zf37WLcDJhiyvwCiiaAc4Aztq0x89Kzd2KTGQYX2Ihglv55KDkS06 4eiymg3It4dCXcyRb+O6+RkIh58/dCqtY/ev1MaWrpoJhH0Iypl0hnLFMjsFwYZfgbHwHIRj7iD Lgiy2MZGx3JcLaZCzk6BoToZ+JiUTA7vsJ7cJ1ZaiRfz7XOxkSx+EC+58TAJb06cNOgRzv3jv3y vzkYPppTvw2/xzKcBugQG4IhZpKZKpe5pc6h4xB5F6bkeiCO6uaGjDaL3BTPq+MfxTUppXtouOH dFEH978wIgwayq2aqKLbIRrXTrbdHm6JVsbm25HfOCKi5PDpCvWQNDHGDgfPTmsrWHGp6jadkPE XVAVkvG3Xw8vik2OP2iyi/Wa8NTrgwWz5MVRiggmvmb73l3C+42ECW6ZYAqlEx6VBnRAwRF0qE0 AJmAjgovZ3oiPd/6zxz4fpMJl+qsgysoFcJikhGEYdEw2X+FD5DYo30s8ue+38tqPFcZXIuxUBL d7MDKE739S8ITwvwHSYCC/6mkpXWKBEB5WWxntpApugJLbIooyULFGFvXo8irewPysDJBFzOzTE tdbErOIrmrTyPUYN4etaaWdtQQ8jOAeSPL5Yq1eg61EMNTwxmNv3FFID2YpsWsSKiLLTKQl2gVx 7oaSEDIWQL3ByQQ== 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 | 113 +++++++++++++++++++++++++++---------------- 1 file changed, 70 insertions(+), 43 deletions(-) diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index 38fed8a585fe..188252bfb95f 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,33 @@ 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); + + 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 +1287,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 +1522,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 +1538,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 +1554,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 +1570,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 +1586,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 +1623,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 +1632,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