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 321AECF11C1 for ; Thu, 10 Oct 2024 09:54:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=40jcWFUFi0Oxb77A5Qmw+6hx6Ee/l4XlcgBsvUfMoMI=; b=m/UjrjIu1N7UK7cKQzrtbv/YLp k+vXTyPeoFEcWGifI89h5+PItcla8Ijn+Rgbug5acRLPbFfrg8V54GzAGcXD30U4YRpk6LYXsKHXL x2enHCtzZDpwEc/Dym+SAeVpPnLvsGbnitIMK+apLIjt31JaRsCUU6dmRB/SbEMTj+Bn6tp+UrZ2v hqGTkc99/EdPXHbw4rok9F7wLK3VsXs366SWxeRlhfTVQ6ZJtAiMx1nIcOLXaWnkk/A+nK9xMMZLj mqwfp48lpik+VKl6WevHfh8ct/75DYFrVrteqk8HDh/t5KX7o9l3H9cety9dIEPs6fze/7BZg+auW XnizyDdA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sypsF-0000000CJBb-16dO; Thu, 10 Oct 2024 09:54:23 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sypqu-0000000CJ3V-3w5d for linux-arm-kernel@bombadil.infradead.org; Thu, 10 Oct 2024 09:53:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date:Message-ID: Sender:Reply-To:Content-ID:Content-Description; bh=40jcWFUFi0Oxb77A5Qmw+6hx6Ee/l4XlcgBsvUfMoMI=; b=i/ABgE4TLij3qfVrf3lPI0eEiY fI42twnK8ILCCm08MSsqtyLOH5ZtcR15fJfBWj/pPZ5IaY0CtO6mN1RMwbjxUFbZORRpO3ezrwisp dM+Uxf9Taxk4LZi9wMI45oUBpDY6lYtg1BK3uv0jJkBw997fk8SmGCmB+KP6SbPKbNwLhQf7VlBNH Cfn/XziOL0pmvgeGwJ81gA7nwLc9XQFTKbhtrq2cHy6V9IiwC97w57cTZVH57+irG6a/cyPqDl21w vjIZwj99j39XKvxmIo+RLEBrTUlMZUcjg/hSqZ2H/B0TmHl8/b7xLRbd59B5+vElJ/abjSeJ4p9we Y7RAZBTw==; Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sypqr-00000005KZ2-4BZ2 for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 09:52:59 +0000 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a9963e47b69so115854566b.1 for ; Thu, 10 Oct 2024 02:52:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1728553975; x=1729158775; darn=lists.infradead.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=40jcWFUFi0Oxb77A5Qmw+6hx6Ee/l4XlcgBsvUfMoMI=; b=WLuPB9Oz4h3QbfFhtaVXaPHw2eb+qiOqfFqhhV73K7xp+GtLHhQ6QDIN71AekdqcyH d2+WoVyV6J0BUS+PeNaGyhHbATSHss35/vWjTDEz3L0/6XC7Za1qbjafRShAJw1MPeFE G+kgMqHnlCeQJLtO+BzoPSxq8yLkIK2l1Jz/f6nBzT7jTfSF65PHmOzsGqENB0sLH0sQ Q+B5jzzfA0+KOlZNfDxl16hVN1ePzu5ISAv0CXtZdesBK5w7XcInirZiNe3zCkVfG+9X avvUBG58v1DYWqyENZbMbuAEk9lDz7oRv7mXw0dyNQF0WhIyoqPaWnRSGmxij/166YO3 FFAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728553975; x=1729158775; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=40jcWFUFi0Oxb77A5Qmw+6hx6Ee/l4XlcgBsvUfMoMI=; b=tOL2fxpQrHJiIpxFCwm11+kdBp6G8NEjbwUX+UU2GJxLzrO5N31mGPREupVF3R12T+ jkq5gZFyp8YaiPjWe8+n1A5/YM045Z4k7XD4NdGka/CdlqIoI6kfirPd6IuyQ9hjhbcE HygFttF2be33gbOCkOqqPflQ2/UOnBWt2rlCfXP8PO0OrJr5doHDcA9duIwOc61yWwzT LauAjgf2AV72jyJ1l3AL7qOAfHKLoZttQ+Kt/OebbwnHHNAvpxCVLJMqyENXXqeuj1YG zpbXK6JwdCtYvcorAynFPFXglWvVtMfesWkFelbN2H+BBGmw4tEP/OK5R7EJE0JHgoc7 XM5w== X-Forwarded-Encrypted: i=1; AJvYcCUGoKa8gELmN1StHUxCNp9Pxd3rA2+ZxrrXwxkW1x2Yeq+GuF+aITqSXgMnK2cXZ/VMso2wf+ke4GTwv1SPjffA@lists.infradead.org X-Gm-Message-State: AOJu0YxfWd4VC6wxy8CJhv7aIlWiJPGgM9hU5pINf/5VOgjuKJPxvluo coRxptq0RuSvO+PbN/UU6H6GqQPl91Rm6rWI9UVLF569fpiHC2hPJn6wpNU5S8g= X-Google-Smtp-Source: AGHT+IHGpgFAaHxId5Yu05QYCpBK0KheH6IwCDZNQtW0JlFbclcqU+qgTj7MahEzfh9iuoNu+rHtpQ== X-Received: by 2002:a17:907:1c8c:b0:a99:4698:cc5a with SMTP id a640c23a62f3a-a999e8ca4e9mr286372166b.47.1728553974406; Thu, 10 Oct 2024 02:52:54 -0700 (PDT) Received: from [192.168.50.4] ([82.78.167.23]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99a80dc524sm65297566b.148.2024.10.10.02.52.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Oct 2024 02:52:53 -0700 (PDT) Message-ID: <1c733190-bd46-43d0-8f3d-62e0ed5fde42@tuxon.dev> Date: Thu, 10 Oct 2024 12:52:52 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 05/12] dt-bindings: rtc: renesas,rzg3s-rtc: Document the Renesas RTCA-3 IP Content-Language: en-US To: Geert Uytterhoeven Cc: mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, alexandre.belloni@bootlin.com, magnus.damm@gmail.com, p.zabel@pengutronix.de, linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Claudiu Beznea References: <20240830130218.3377060-1-claudiu.beznea.uj@bp.renesas.com> <20240830130218.3377060-6-claudiu.beznea.uj@bp.renesas.com> From: claudiu beznea In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_105258_212489_2BC2A04C X-CRM114-Status: GOOD ( 28.66 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, Geert, On 10.10.2024 12:29, Geert Uytterhoeven wrote: > Hi Claudiu, > > On Fri, Aug 30, 2024 at 3:02 PM Claudiu wrote: >> From: Claudiu Beznea >> >> Document the RTC IP (RTCA-3) available on the Renesas RZ/G3S SoC. >> The RTC IP available on Renesas RZ/V2H is almost identical with the >> one found on Renesas RZ/G3S (it misses the time capture functionality >> which is not yet implemented on proposed driver). For this, added also a >> generic compatible that will be used at the moment as fallback for both >> RZ/G3S and RZ/V2H. >> >> Signed-off-by: Claudiu Beznea >> --- >> >> Changes in v3: >> - added RTC bus clock, reset and power-domain; it has been detected >> by reverse engineering that RTC and VBATTB clock, reset and power >> domain are shared; HW manual doesn't mention it >> - updated example with these and with assigned-clock properties >> needed to configure the VBATTCLK MUX with proper parent >> - updated example section with dt-bindings/clock/r9a08g045-cpg.h >> and dt-bindings/clock/r9a08g045-vbattb.h includes >> - for all these, dropped Conor's Rb tag > > Thanks for the update! > > Sorry for chiming in late, but this RTCA-3 block seems to be a > derivative of the RTC blocks found on older SuperH SoCs, and on RZ/A1 > and RZ/A2 ARM SoCs. Differences are found in (lack of) > 100/1000-year-count parts and the Year Alarm Enable Register, and in > some control register bits. At a 1st look it seems so, yes. I was inclined at the beginning to just use the rtc-sh but the RZ/G3S HW manual mentions a lot of restrictions that need to be followed when configuring the IP. Because of these restrictions I chose to have a different driver. Otherwise the rtc-sh would have become way too complication as far as I can tell. >From these restriction I can mention: - wait for 2*1/64 periods when configuring the alarm - from HW manual: When the RCR1 register is modified, check that all the bits have been updated before proceeding to the next processing - from HW manual: section 22.6.4. Notes on writing to and reading from registers) after writing to count registers, alarm registers, year alarm enable register, bits RCR2.AADJE, AADJP, and HR24 register, we need to do 3 empty reads before being able to fetch the registers content. - updates to RCR2.START need to be checked before continuing (note 2 from HW manual on RCR2 register: After writing to this bit, confirm that its value has actually changed before proceeding with further processing) - there are many bits that are synchronized w/ count source and need to be checked before proceeding (when setting it up). - According to HW manual (section 22.4.2. Clock and count mode setting procedure) we need to wait at least 6 cycles of the 32KHz clock after clock was enabled. - According to HW manual (section 22.3.19. RTC Control Register 2) when set 24 hours mode this needs to be done separate from stop operation. - According to HW manual (section 22.6.3. Notes on writing to and reading from registers) after reset we need to wait 6 clock cycles before writing to RTC registers. - According to HW manual (section 22.6.4. Notes on writing to and reading from registers) we need to wait 1/128 seconds while the clock is operating (RCR2.START bit = 1) to be able to read the counters after a return from reset. - and there are other restrictions Thank you, Claudiu Beznea > > The SuperH and RZ/A1 variant is supported by drivers/rtc/rtc-sh.c; > DT bindings for the latter are found in > Documentation/devicetree/bindings/rtc/renesas,sh-rtc.yaml. > > (My first guess was that RTC-A1 is used on RZ/A1, RTC-A2 on RZ/A2, > and RTC-A3 on RZ/A3, but apparently RZ/A3UL does not have an RTC... > Oh well, at least it is used on later RZ series SoCs...) > > Gr{oetje,eeting}s, > > Geert >