Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp138731rdh; Tue, 6 Feb 2024 23:23:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IEHo0gikBElInbwidk5LX7ooyz8HuxSG0sEHUCxEn9/OZVXbsmbm/pWBV+XeJrMQmEJT1fe X-Received: by 2002:ac2:4301:0:b0:511:5a9d:2469 with SMTP id l1-20020ac24301000000b005115a9d2469mr3023735lfh.27.1707290626815; Tue, 06 Feb 2024 23:23:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707290626; cv=pass; d=google.com; s=arc-20160816; b=M2kULNpaNJITbIV4pBTzx6JPK9+EGXk6V6nOH9ZIExyupeFOdBmRaCgMc7um0/SqwP 7LuPLwepbnXQREXqlKnFtJHIDz6QqjdsJZTeTfi1cxuBLo4SuRo1kq2qr5iTVMIKDlbF crMhJy//l7R3G1rSqLE6mi+Dxl1gbbD/n8o2KAL9jXQju4g1ukMfJ4DpDlekzbSKZdVj D1Ka+N2Ol5PvbBd0zOS6kUTAB/HqGuh63WTa1v7/P7Ukjg0Dx1KT9XwHy1ZPSmpvMHsM JINHbIEX4N25750yWAfKjlYa71d9ksnzRcEnLUqF4V2mWmf71qXpviiXArnaXrAVHkI7 H8aA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=ul/vL+oJkRgYUPa1hDePq1cyQcdFp3HR4K17flhmqx4=; fh=b8OVR7lK5pNLcZujHSBjfPOGwTwX50Mx+vYnAkraPEU=; b=aH8yUHBMQvaKtXTz8nUgD2ikkur/RaLAAUqty0oH7pG4SMOtrBcipmkpW+/YbL07s+ XF4n65YpY6x9kUE2GK57vE4Bz2ifcgY++iYVRMG0ISN//PLeeY34sL3YaxDvRhaZm9Qf CZmqaZyCxgjLk9SnaKA9MX/Hqv+S1T6L53lN4FTU1nyJ7SW0Ns+q8Y5fKIbi+Xy3wynW J9CUPkNJJm4bCTMNjxRPzZk8AlkvrUDP47xWpytaMmO+gAhQtlTRBmAIm4mRfnTS6JVM NNFLyUhdzUZhmp8evYEVJqpqxSUtQBdy4iI9bGcWTDzlq8L+VNW0lKpLGw4Mn6+1od9s c4AQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f0oztdqu; 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-56066-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56066-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=2; AJvYcCX+ygGB2Ho/1PHKgxd2d1G0B0bVkCV1k9AJm7aO/ZAgoCrf5yZ9bKVVz/UdsH4uEJdzpJ8fACx1eXE97LRJTcFGw5uCCtIPtTFGC1sspA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z23-20020a1709060ad700b00a3887a54588si175482ejf.833.2024.02.06.23.23.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 23:23:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56066-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=f0oztdqu; 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-56066-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56066-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 74F1F1F2562F for ; Wed, 7 Feb 2024 07:23:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DAE5D20322; Wed, 7 Feb 2024 07:23:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="f0oztdqu" Received: from mail-yw1-f181.google.com (mail-yw1-f181.google.com [209.85.128.181]) (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 62926200D9 for ; Wed, 7 Feb 2024 07:23:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707290603; cv=none; b=I+J0uD6iyaRp+C8Vh2/6r7cnhfm8j4e6rwrNrdIF9wCuBzf2QYjkN+8TU+95ifBapWMQlZ7kWqWGaCpfbMq8oPznaW32eJz+nl9m9tC104tqo6yciEjov7l7PByEJ7C5zf9/qkENTOWMGZ5KprssCAQMRR8P805tnMz0EL0PS4E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707290603; c=relaxed/simple; bh=B35jxefI6tcTL6IQRnkPUsKP9mX+pIhGZ//x/bqYndw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=VyF6zuCD5U4zzvyDKKJCHPjc0FMCAkVcM3Xk3XSmOopnjdU4gGPwgN/Uxy5knWcIzdc33Wcqcru82wa1ERRSBOcTZe1Hjf35ilQ9vAJTVEHVz4FzQE2vqWc8sgUXc4m7Hd57RkuIe4yrx/AWm5B84TdtbTsPmjjVPqjUTtuzI0E= 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=f0oztdqu; arc=none smtp.client-ip=209.85.128.181 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-yw1-f181.google.com with SMTP id 00721157ae682-6047a616bfeso2896027b3.3 for ; Tue, 06 Feb 2024 23:23:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707290600; x=1707895400; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ul/vL+oJkRgYUPa1hDePq1cyQcdFp3HR4K17flhmqx4=; b=f0oztdqudMwwXx9odYNv+UfkxoVxAcO2ZWMhLd786yM5dvwp7ylq0PuvRph4iUHaUB EZftHskPVUA5A6lzgh2statA75k0URUMfyBzYelUeZy2LscNHKInwhDkkpugXz9LRifZ uFEH/Rzgb1QUHgwLBjWQoFaOJip8V4b+1/nVa/vfmq14JOCcXHWhy2qj2G0aGTY8AmmM yR1SCMxJGl+IZ5gQRAj9lh10cS8aWGSrz/BVAnb+kPsDNWVTxOk4SpRG1JVnRZifERi8 ehzGNfcaCklvZVR6egrM7BjipmWlpAwnU1z4xg1epCkNkktKzRnabig1qQ4Uv401SkAC WFYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707290600; x=1707895400; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ul/vL+oJkRgYUPa1hDePq1cyQcdFp3HR4K17flhmqx4=; b=BKMDR6XVDEIzp1wzbTz1kDBpNGDlirtCea/jOfDd7bfbQMmpnq1fymq87BLqGoeSaH iypF0c73HvFkzJH007H9SC0DGUYkumFmTKqeH3KSN2Npqc61PUJkANsMBdPjr0LujEMQ s5oAzWDEq2g5u25Zoh85jfVawps7ef8Jk38ch39LHCn7idR3HuvFob/L8t19hOfBUjUo 2YIxQf+LxYriWz5iOgQal0hLF5Xu87we5AoAg1+3Mu/TL1jqsGy1/wy7oTgwUmoM0n/R JIJfCCtjofnlSrPy1G3O4V0C/BOjzwAfvLLOD0fh/Hs3J/al1J9hkD+wOwIf4BKcg+yd 1xjw== X-Gm-Message-State: AOJu0Yy7lukjpg9bu6eJZDAI72LInbURszjqal3LwJtixNod4CMSIVl4 OG+rr6up8h7VUV2fC5ZnhPqXF4+BWQfpvzyd6OB9JwkPHr2sO6G/Gh47o7kFp1BPOLUneIfKoUV 6lzkqvrs8ivV9hp09uqZ+5o5UoFbP5JMfZsolUw== X-Received: by 2002:a81:4148:0:b0:5ff:92f1:8e24 with SMTP id f8-20020a814148000000b005ff92f18e24mr4344209ywk.48.1707290600212; Tue, 06 Feb 2024 23:23:20 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240207-spmi-multi-master-support-v1-0-ce57f301c7fd@linaro.org> <20240207-spmi-multi-master-support-v1-1-ce57f301c7fd@linaro.org> In-Reply-To: From: Dmitry Baryshkov Date: Wed, 7 Feb 2024 09:23:09 +0200 Message-ID: Subject: Re: [PATCH RFC 1/2] spmi: Add support for multi-master To: Abel Vesa Cc: Stephen Boyd , Matthias Brugger , Bjorn Andersson , Konrad Dybcio , AngeloGioacchino Del Regno , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org Content-Type: text/plain; charset="UTF-8" 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. > > 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