From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (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 9B7B8219ED for ; Wed, 7 Feb 2024 09:08:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707296891; cv=none; b=fKYbK/CDY6L7MGuTkaZ2yKJ7k+iBk+zX+LGi2kPUyevindU5XXQzU/FB/s6EEVmzA0B5qdUxD+rTE+X1zckDafGAtGbbdKXe7GQh+x4qfhvaD+NhZBd9m0gEAWaNmyBqv/B7uXCcDQoVrnZbqsnX5AVONKcOqxUkyVARgwTf1VQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707296891; c=relaxed/simple; bh=LizzINJGC5xEtbjImiJIdvLHBRIezQZMDq+PcR30woo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CQXZGhp4NHdDIyk31zJyrINSEvb4u2jQLRR4yRh/RJ4kQfvEmH1vGLiJLxifAUH6C2lNlVXZYq7mC++2E/Q2KlijHTpwwJmNyIaUbe0RWtkYXXGdNaxoUNDmb/N6UVJGsglEEy+tuy1SfS1GuZnLzbPVWMhtqFrl8sCTR48AzzE= 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=RpSPfZS/; arc=none smtp.client-ip=209.85.208.53 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="RpSPfZS/" Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-55ee686b5d5so434235a12.0 for ; Wed, 07 Feb 2024 01:08:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707296888; x=1707901688; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=TsNj2DX8RJsqHOPPwaVUY94IMVrEnah0wSC3qGvPZMs=; b=RpSPfZS/b4nBCeABEu4lz/XDRF8B1yEUohQNd5l1jbMbaOaXdRCIWw/8f4W89WLOhi WHPAoKx4yu0BxaYmFDMaoEGwZlu76DlJjGNisHlVTlyG5UYvqG61DFdAGkBKEJBzgEJl TsKcSF/mEYoyiwvKoA56mBIPZps8pq2eM7fPx8eI7knUM34Fhdn7YcGppK3abP2xYCnj 9KS1AlVnNtwSuqXaVpJCSI759RBN04qJ7AKKytRma7AK7lzWJrredhWxnlKVUU0j+Tg/ o/p7ChaTziizWy6Dh7D6w6ruip3htITTEvgUBCfJmeVXDUAe/HH5rq9kc1H06HQGEtnf 1MRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707296888; x=1707901688; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=TsNj2DX8RJsqHOPPwaVUY94IMVrEnah0wSC3qGvPZMs=; b=iZrnXJY6uRG5fDT3FDKydTrUVPpMb1mklI5LcSqzlLu7fFMEz2kLWSRk3pO/kLZCAl cIpHxJWwhdLizmPeAs7vYxc72euDZLV8maB72lNppo9hwuCS0rishC/h6PdygRvhGJoJ yc3YjVyXL8Q/5bqx+DFZUNRPF9o6G/DdXz9U+WI4R3poUQe+cxlakBr41ig2Uz6PeTHM qr5De7cdrlkhkWGACZQTKZOTJ4atIhHZK2eOxq0Dr5H/cRpJGC34x5sdgeyt8hWNYAy+ uM3y+zqkLszYtbXwyk2nKg+BDySgMLrIsA7VtbTIKioPXbFquzRvYECZ54YUfYp/QRt1 0PTQ== X-Gm-Message-State: AOJu0YzlsDI+j+NKgXBZ0VcPa8BKAeUD+4yoFuP5QG3yL24oQaVfgeaj A7+bskfmwfQfu7FzfimZC8SQvMqVEd6ilQf8/OovvNvrt4BCRXVOsivaBThQUqmBGlIJ5+jCNwp H X-Google-Smtp-Source: AGHT+IGGcb322HA0o5RHNBrkSMZHPf8n0gbux/28bD/rBXtfoFtT5yhn0dzUVOa8i9Lwlhq6DNXeqQ== X-Received: by 2002:aa7:de04:0:b0:560:1652:e7cb with SMTP id h4-20020aa7de04000000b005601652e7cbmr3693310edv.16.1707296887842; Wed, 07 Feb 2024 01:08:07 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCU+rUyq+VfYElNWnIEpSD69Mb31OSI6iMCKmXTJb2gIF+MK3w0nklCk7YxlQ+5SIw0shtAqcVLEaz/kdD6yXacs0svf29R+lPj51I/s7oUy5k9KXkmvEJa+O2vyTor9OF3RAmfabD52nteSiJDIccTcCpF4M5DXn3Umz8/2QwXkurxzG9hpkpdyi9NRbS6uVU6AeZLoyg8HDrejOTjxVqtfAAHlKHqhOQSx4DM8gfmAHSdKyPH0mMNMzs02NKqM71p/d3WIIcVrWIzN6nWpy7x5wmrxhHTNYswC5C15P/PtXH8zWNchzR10lWKgqHFeSGEhJME0W3wzBhAgAf9TXOt0VvttXVnkFSawr64adMdlTIeJpWLwo8w5pujtBg5TtwKKyObqtuo= Received: from linaro.org ([62.231.97.49]) by smtp.gmail.com with ESMTPSA id f1-20020aa7d841000000b00560cd4f3098sm450117eds.95.2024.02.07.01.08.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 01:08:07 -0800 (PST) Date: Wed, 7 Feb 2024 11:08:05 +0200 From: Abel Vesa To: Dmitry Baryshkov 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 Subject: Re: [PATCH RFC 1/2] spmi: Add support for multi-master Message-ID: References: <20240207-spmi-multi-master-support-v1-0-ce57f301c7fd@linaro.org> <20240207-spmi-multi-master-support-v1-1-ce57f301c7fd@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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. > > > > > 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 From mboxrd@z Thu Jan 1 00:00:00 1970 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 5D733C4828D for ; Wed, 7 Feb 2024 09:08:26 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+m3skoZtJweVbnAGKlhGCqH/VIlTCX2E25w3Uhe/ljc=; b=jgddpjt/3J2UMM oCndBv7NPVKZRkIb2yCWftHo+tcaixfChW9v6sEACOYNf7JFXP1gpWKIE/YFVMZhKK/4QuoEZX5N2 ak1beqX7nWVqjvosWA4w/PLszK584VTrX+PSLJYS5I2OF2p8IsmiikGeXwT5ZQN64YBbTRYeLsJ0F XoUr5VBkoAfMN+d6sGJVcxRAiUiOt3h4Nbghs5HyE8aZeK8GXODHxfhgRIwfs8QMl+M8S0bS+d2KM DMH/ie3W0slRYKVxTV6hiZWqTBniozoKIL9JPPnqRkSMUM+LMWy1B+YbPw/buKav4uX+zJjP1xkBX fXHt2ZKnQxKFwIkPC9Qw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXdue-0000000A80x-2h4V; Wed, 07 Feb 2024 09:08:12 +0000 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXdub-0000000A801-3OTX for linux-arm-kernel@lists.infradead.org; Wed, 07 Feb 2024 09:08:11 +0000 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-55a5e7fa471so411117a12.1 for ; Wed, 07 Feb 2024 01:08:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707296888; x=1707901688; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=TsNj2DX8RJsqHOPPwaVUY94IMVrEnah0wSC3qGvPZMs=; b=Zu26lZWiYILNerwNggx7TgRMLcTHqwWFTCeGLXNM0HGv6O0rVbyq5fBlx6rd4jPHJT mHTywWUbUMp7ScnDD0NPh3HhLIWoxPP+BAj/DG2kcG37u7FANfXbjFDS4HGgKNRxW8fj /28nUq1eorhnzTqwuHZ3+YoS/MsW/ziDzxhsZErM7m+nEpKXWlfBdmww6NaEwBmYRVUk XUe9GXEdFnwXVJVeKvzPZE0jr+RnPuOYUP3+ihAdslVq3H5mIgwXM9o35BcEg5+sxICb IOz4HPcsJQgRgktAy3nuNEEXv/jiJyizWv65eq7AP2VL3je4lQEDaaRO7qJ9hN2n8snW x3Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707296888; x=1707901688; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=TsNj2DX8RJsqHOPPwaVUY94IMVrEnah0wSC3qGvPZMs=; b=h2IrTUnTNwEAOcb0S384P4xiaNIdjz1JSbyEwypTSa3RCtk278N0FxcJZ8CdmEkTD3 RNGqLJQmxzvFyzntsoJ7K0yUNoxFCfzBXdEzLLikrVHpPRIf1svZOr4LqIutDrZ8vd77 qpLqbQ40c1k0GEnPVUlqE93FoNXZXosvBsiO/tAgHDlZ83pjF6cQ+2k26qi2kMGz7KJr F2Tb2qhtPf8Wt3rgmJEkluMPjQ7FKAUEwhAxdz5mFb6e6oKwAfg1AciMTgd4pK48laJ9 vz4s/AE4pCVKczeILlL8z/F6CO6W6nmEgrVaGinSRrxTyv2ekNycryO/bTBdkef0Co1h 8IRg== X-Gm-Message-State: AOJu0YxlSJN/JOF4w69Z6df9r8cZTdkhMtGuyX5Jm/dYMKcCCuBC4bee 8OYyQGNgGgC6pro3CC+4CddBt7b2f8lP8sHc69tF/JjhF+Lfz8XZKlwOyfPTtNs= X-Google-Smtp-Source: AGHT+IGGcb322HA0o5RHNBrkSMZHPf8n0gbux/28bD/rBXtfoFtT5yhn0dzUVOa8i9Lwlhq6DNXeqQ== X-Received: by 2002:aa7:de04:0:b0:560:1652:e7cb with SMTP id h4-20020aa7de04000000b005601652e7cbmr3693310edv.16.1707296887842; Wed, 07 Feb 2024 01:08:07 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCU+rUyq+VfYElNWnIEpSD69Mb31OSI6iMCKmXTJb2gIF+MK3w0nklCk7YxlQ+5SIw0shtAqcVLEaz/kdD6yXacs0svf29R+lPj51I/s7oUy5k9KXkmvEJa+O2vyTor9OF3RAmfabD52nteSiJDIccTcCpF4M5DXn3Umz8/2QwXkurxzG9hpkpdyi9NRbS6uVU6AeZLoyg8HDrejOTjxVqtfAAHlKHqhOQSx4DM8gfmAHSdKyPH0mMNMzs02NKqM71p/d3WIIcVrWIzN6nWpy7x5wmrxhHTNYswC5C15P/PtXH8zWNchzR10lWKgqHFeSGEhJME0W3wzBhAgAf9TXOt0VvttXVnkFSawr64adMdlTIeJpWLwo8w5pujtBg5TtwKKyObqtuo= Received: from linaro.org ([62.231.97.49]) by smtp.gmail.com with ESMTPSA id f1-20020aa7d841000000b00560cd4f3098sm450117eds.95.2024.02.07.01.08.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 01:08:07 -0800 (PST) Date: Wed, 7 Feb 2024 11:08:05 +0200 From: Abel Vesa To: Dmitry Baryshkov 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 Subject: Re: [PATCH RFC 1/2] spmi: Add support for multi-master Message-ID: References: <20240207-spmi-multi-master-support-v1-0-ce57f301c7fd@linaro.org> <20240207-spmi-multi-master-support-v1-1-ce57f301c7fd@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240207_010809_879411_1ED91B9B X-CRM114-Status: GOOD ( 31.62 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. > > > > > 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel