From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 932BD208979 for ; Wed, 12 Feb 2025 10:44:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739357085; cv=none; b=Y5NVBapkMmXTB74Ao9pKJ8pWP0ZsmnuQa7xvrejYuOvjr7OS7GJgz8x500yd+G1mB9UGAnM+E+U9vkfN/16RGWj2xLfB2byvE2+Wg8vjlc3uhr+C/oZVmC2SgAksNukqXXU9X3kqkXf+UkXrFG5T2REsMi4QsPFcEYNAJOPT8rc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739357085; c=relaxed/simple; bh=qVVPJPtnqsJdp2z+AfZj8jLWGGvu1Agn7BuY6aOLCS4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Z1BFT8aYeRspK+3n2GphlfjY0rGP2n9UrBUNDpWoNQc+snvVco+ogb21c1R2uUggeZR/3wMvbeGy6WWAHC4sYZrY/2NmsoCUWaUa0G42red8YLs2c1Dwtau0x2hvrffOq5cJF8c2V80ozaFBilyjncPKxNXHX0W+ZjtC4eT3F6Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0147F12FC; Wed, 12 Feb 2025 02:45:04 -0800 (PST) Received: from bogus (e133711.arm.com [10.1.196.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B5E1E3F6A8; Wed, 12 Feb 2025 02:44:40 -0800 (PST) Date: Wed, 12 Feb 2025 10:44:37 +0000 From: Sudeep Holla To: Peng Fan Cc: Cristian Marussi , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Alexandre Belloni , , , , , , Peng Fan Subject: Re: [PATCH 4/4] rtc: imx-sm-bbm: Support multiple RTCs Message-ID: References: <20250120-rtc-v1-0-08c50830bac9@nxp.com> <20250120-rtc-v1-4-08c50830bac9@nxp.com> <20250212064117.GC15796@localhost.localdomain> Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250212064117.GC15796@localhost.localdomain> On Wed, Feb 12, 2025 at 02:41:17PM +0800, Peng Fan wrote: > On Tue, Feb 11, 2025 at 05:01:12PM +0000, Sudeep Holla wrote: > >On Mon, Jan 20, 2025 at 10:25:36AM +0800, Peng Fan (OSS) wrote: > >> From: Peng Fan > >> > >> i.MX95 EVK has two RTCs exported by SCMI BBM protocol. Current driver > >> only enables the 1st RTC inside BBNSM module, leaving the board RTC > >> not used by Linux. > >> > >> To use the 2nd RTC, use 'bbm_info' to get the number of RTCs, register > >> them all, and set 'bbnsm' as private info for rtc device to know which > >> RTC it is when using rtc_class_ops to access rtc device. > >> > >> Signed-off-by: Peng Fan > >> --- > >> drivers/rtc/rtc-imx-sm-bbm.c | 69 +++++++++++++++++++++++++++----------------- > >> 1 file changed, 43 insertions(+), 26 deletions(-) > >> > >> diff --git a/drivers/rtc/rtc-imx-sm-bbm.c b/drivers/rtc/rtc-imx-sm-bbm.c > >> index daa472be7c80697aa3cd3432eccef0c877e4c378..a29b30555d0c0581ecaa8b79760209dc780d2f0e 100644 > >> --- a/drivers/rtc/rtc-imx-sm-bbm.c > >> +++ b/drivers/rtc/rtc-imx-sm-bbm.c > >> @@ -15,16 +15,18 @@ struct scmi_imx_bbm { > >> struct rtc_device *rtc_dev; > >> struct scmi_protocol_handle *ph; > >> struct notifier_block nb; > >> + u32 bbm_rtc_id; > > > >Is it not same as rtc_dev->id ? Why do you need a copy in this wrapper/ > >container structure ? > > In theroy yes. The current system I use that all RTCs are managed by BBM > protocol. So only two RTCs are registered. > > In case there is other RTCs that not managed BBM, the rtc_dev->id > will not be equal to bbm_rtc_id. > > For example RTC1 is directly managed by Linux, RTC0 is managed by BBM. > > The RTC1 is probed first, so its rtc_dev->id is 0. But from BBM protocol, > the RTC0 use id 0 for BBM SCMI server to handle the RTC0. > > I maybe overthinking here. But to avoid potential issues, I would like to > keep bbm_rtc_id. > Fair enough, I didn't think of this mix(firmware controlled RTC + Linux controlled ones). -- Regards, Sudeep