Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp278710rdh; Wed, 7 Feb 2024 04:46:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXq2EPG08sen3AmrupCKvno0LnraXHAYn9A+DCUby1zwh1qPENXF+xMXvBPPXuk47dZZJqNVuwZo1CvejloCByzYffRnGc0bJ1VZPCPkw== X-Google-Smtp-Source: AGHT+IH6yYv2rLCzoQoepZMOWNUTtgnyQRtfPN0QGRPfYFlxDLX/Qk2XGV2LqJfpC0kmTO/3A8GJ X-Received: by 2002:ac8:425a:0:b0:42a:b315:190d with SMTP id r26-20020ac8425a000000b0042ab315190dmr4772134qtm.17.1707310014241; Wed, 07 Feb 2024 04:46:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707310014; cv=pass; d=google.com; s=arc-20160816; b=F6qpOG6RHawubZPgPCjpyz0LjpuH19ZxCiosOHVJ1Xa7ENtZfakT4792cFyRMpM2JH ZAJ3dOX8khBo7NXYjO6ET4bE4WlC7OWdEr6w2V2bG/N31F+ZmsfSdsAYlleyHlCgkMaL qs0WJA+YlKO4GYTIuW/LwE3YiYVfr9D+mbY+nub3VlWaX8wl/TndwoY9h8JmZDTzorNa XaySYm5CnqSi9Mze5I3p1ogvcC8e+0jCR8KmSpb1fP7CvSc2JD0bNyQ7HwYnnxmnmMPe 9kRuSz4ryYrHUKPXu0lSozoHRaHBk3hEScVrP4W/16Z8rdBBmHq63F6KgNzzB83kPDAH G61Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=ZFgPrE3Thwr3HoBLi9vLhUpfrYpRYmqYSC/PfoBg37s=; fh=tQJDy0pA1o6r+jy5JnjLRE0A1NBtHILj/KkZDlyzYRc=; b=tpcAoft0U1Q9/NxgTAMXdc9JyVW31w2nV6pPPFRkiCAAboaEr621FsD1uTnWzSOS82 p6DlWgzGiWKtHovjJ5ScDgF+60pueI8iNsBV6S7A8tkIDiitqug2tvGYg7kprdh0dEOZ CS3zIaipsrTD0TvWMeYuD7Jwfysm7sYffl0mM5uV/OddFKquinxOdAv9ovajVqD2RLVZ yyOuExUtZQT45NobIQh0Ov2H6Vsf6vag1cyTRk12w840hnL9E1QpgCTvwCbVyL+2WCeD HaniLELnQlffLoraYKKj8o5iRYdACKssSZ8WSosDfSZldr3rHBBpMOLPxo6qQvyY2Wro 0DUg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=VQGTaYAO; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-56496-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56496-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com X-Forwarded-Encrypted: i=2; AJvYcCWPwqeihK4MnaySz3knO2xYrfYffi8DV0I5xDfaCdexfU7ewpQ/Gjm47nnwYeGMOUx9yLKPj1nRLHCwRGzxeOVsSw3MFOcHE7xXtLDczA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v22-20020a05622a189600b0042c3e85b33asi1031871qtc.170.2024.02.07.04.46.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 04:46:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56496-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=VQGTaYAO; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-56496-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56496-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 049AC1C2442B for ; Wed, 7 Feb 2024 12:46:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A53FF76053; Wed, 7 Feb 2024 12:46:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="VQGTaYAO" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1781A76044; Wed, 7 Feb 2024 12:46:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707310003; cv=none; b=QPgLHmVh/rLzbYGK77v7P4O8cI+w1TBOrT4av2wd97p5Zqd/TdHtVgf5PxiZ3J2QEvgGSnSFVQRLilSyULCVsMohFlX145z6OTAS2FAODOsFeo8Ac501mCVO09NbeA06Qc81O+4IcYzwYu1p8edQGuqAOIaTittzdCKlrFkhtYo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707310003; c=relaxed/simple; bh=iTpYch75tcd9ZP7LW6ilopgE85q/9ga/hzmsirOsblg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=cVijszrHqIc39gG20lMMlM4JbaAxUJsC0rV4IwpFGQa1O8QcS15okrL2zj0cYQ94S8mS2F+uW2ZeDIiJn4D4UjV5lpz81VIJSNjPAfdshwGCO8PaSVrO8lMbToZ6348QQrI0OWdkHCVG4SZ8K7nG4jqVqJgUu4hWDALS4Bu3d9Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=VQGTaYAO; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1707310000; bh=iTpYch75tcd9ZP7LW6ilopgE85q/9ga/hzmsirOsblg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=VQGTaYAO4UXkiE0SOdaExAt58ciEwIUI3p9ZgpZEu+eCNSJxgbpxPs2NOIfFTeiR7 Ejg7EiYSdzzI7FECNLfqmcv/vDBRoa6nYNtgdrqgiAiurXxYo16CKpsK30eiU5OGIE 1azFEDU2fWDxFLpi35B9jYhbGZjIQ+navGvU6rIG+6e6KL13IVN3C/BNIJtEP22Ydh PmVnuxsbLojV6DqTRizND8lKy+tTq4Y6EXiLCkIwy3HBsAINd3sb8TRnv+apYRwDG/ Nntuj2uPQfgUbo/DRbXnW43pjmZUE8B+61OjrxN9RGSPsIw3GPMKYmrxuTEBiqbLrZ JxSBt4tZRxDQw== Received: from [100.113.186.2] (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 933E337809D0; Wed, 7 Feb 2024 12:46:39 +0000 (UTC) Message-ID: Date: Wed, 7 Feb 2024 13:46:38 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RFC 1/2] spmi: Add support for multi-master Content-Language: en-US To: Dmitry Baryshkov , Abel Vesa Cc: Stephen Boyd , Matthias Brugger , Bjorn Andersson , Konrad Dybcio , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org References: <20240207-spmi-multi-master-support-v1-0-ce57f301c7fd@linaro.org> <20240207-spmi-multi-master-support-v1-1-ce57f301c7fd@linaro.org> From: AngeloGioacchino Del Regno In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Il 07/02/24 12:45, Dmitry Baryshkov ha scritto: > On Wed, 7 Feb 2024 at 11:08, Abel Vesa wrote: >> >> On 24-02-07 09:23:09, Dmitry Baryshkov wrote: >>> On Wed, 7 Feb 2024 at 09:19, Abel Vesa wrote: >>>> >>>> On 24-02-07 01:55:39, Dmitry Baryshkov wrote: >>>>> On Wed, 7 Feb 2024 at 01:34, Abel Vesa wrote: >>>>>> >>>>>> Some newer SPMI controllers support multiple bus masters. >>>>>> Such a master can control multiple slave devices. The generic >>>>>> framework needs to be able to pass on the master id to the >>>>>> controller-specific driver. So do that. The framework will >>>>>> check if the devicetree child nodes are actually bus masters >>>>>> and will register the devices for each master. The legacy >>>>>> approach will still be supported for backwards compatibility. >>>>> >>>>> Please remind me, are those two actual bus musters driving a single >>>>> bus in parallel or two SPMI buses being handled by a single device? In >>>>> the latter case this implementation is incorrect. There should be >>>>> multiple spmi_controller instances, one for each bus. Allocate them in >>>>> a loop and set ctrl->dev.of_node after allocating. >>>> >>>> It's two SPMI buses (two sets of wires) handled by the same controller, >>>> HW-wise. >>>> >>>> If we register two spmi controllers with the kernel framework, it will >>>> be HW inaccurate, because there is just one controller which has >>>> multiple masters. >>> >>> struct spmi_controller is a controller for a single bus. Inside your >>> device you have two SPMI buses, each can be controlled by its own >>> struct spmi_controller. Just like devices that control multiple I2C, >>> SPI or USB busses register a separate instance of the bus controller. >> >> Well, this is what this patchset is trying to do in the generic part. >> The SPMI controller supports multiple buses (HW-wise) and therefore SW >> implementation shouldn't be tied to single bus requirement. > > So, after the off-line discussion: > - add new compatible string for sm8450+ > - register two spmi controller instances Well, I don't know about the actual hardware that you're trying to implement but, in my opinion, the "idea" of this series does actually make sense. The SPMI specification says that SPMI supports up to 4 masters, and up to 16 slaves. Just my two cents. Cheers, Angelo > - drop the master-id from the SPMI interface > - optionally: think about having a new separate driver for v7 SPMI. > >> >>> >>>> >>>> I'm not saying it might not work. But, to me, it looks more like a hack. >>>> >>>> Basically, we would be mapping HW bus masters to kernel controllers. >>> >>> Buses, not just masters. >>> >>>> >>>>> >>>>>> >>>>>> Signed-off-by: Abel Vesa >>>>>> --- >>>>>> drivers/spmi/spmi-mtk-pmif.c | 6 ++-- >>>>>> drivers/spmi/spmi-pmic-arb.c | 10 +++--- >>>>>> drivers/spmi/spmi.c | 76 ++++++++++++++++++++++++++++++-------------- >>>>>> include/linux/spmi.h | 10 +++--- >>>>>> 4 files changed, 67 insertions(+), 35 deletions(-) >>>>> >>>>> -- >>>>> With best wishes >>>>> Dmitry >>> >>> >>> >>> -- >>> With best wishes >>> Dmitry > > >