Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp322692pxj; Wed, 16 Jun 2021 03:17:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqm73Yqyv1zqxlJaw03FTXekeZBzt+Uhi6APHF6r3K3Pni/x9eEmhpQIyCFuZ0qtbzUBsR X-Received: by 2002:a17:906:7f07:: with SMTP id d7mr4512855ejr.240.1623838662786; Wed, 16 Jun 2021 03:17:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623838662; cv=none; d=google.com; s=arc-20160816; b=OCnZen6x4cll91Ad/zgRwmS9LZQcALCteNJzN8ck9FmrqoadQv12AVdAFedFl8Ow3J nCj09UrqK0e9jFLdBI8FlR82d2KKY2M2E1mS99Uxa8mzcCQ7ysXY8lRyMfRh1iotjmoL qXcXZqZ2+bWZzy/hL2EahTOY6AybkGww60jzs/Vj1eAqmHH8u0iR8KiuLYO5TaKwwtpY iLSmGlQQ++l+LN3Q050FQlly5Sm6R4hA+CQvTpw+1aO7BPIiCigFZZ0XH48aSJvpmvlM FABAuIA7KGh8KMq0XWaOAXY7SW3uwV3kOof3o4ozBqVbbqj3jMDvE6AyOKZuP03hBrGd ODyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=9H1VtR0GEdIisPTdhw8rn8vyw2Rzh8GS9d4x3HwPXyg=; b=eOLT74qFOVKo2Sgodvoyu37PZSj8gjmjBSt8M164WvcMjwpYiVafwKpIiFttaevJtn amK3cCwCgSCdSY8gXNgKv3WQQzVnC0gbRSqDDTThCH/Phcfb1OX8uEXOyYliHfk6DSQJ ils6P4C956/010KmjoGuRbrC6DosyND5qXwpPXoWTtyBUP3Rfe85ed2Vk4pMXZaV1WGl HrwAelemuGQAGhZqXRG2d49UO3rBNsT/7wq+9ZOHFQ+A0S+hioPje1r9nh95b+pjMpWK FW1b/S1yabY7yCQYizgN9Kg2TvHESABxo3g7awGQY1WLQUO18eY6yT9SXSoMFHZbkBZZ dcTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bh4si2130246ejb.56.2021.06.16.03.17.20; Wed, 16 Jun 2021 03:17:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232007AbhFPKRR (ORCPT + 99 others); Wed, 16 Jun 2021 06:17:17 -0400 Received: from foss.arm.com ([217.140.110.172]:32874 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231452AbhFPKRQ (ORCPT ); Wed, 16 Jun 2021 06:17:16 -0400 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 334CD1042; Wed, 16 Jun 2021 03:15:10 -0700 (PDT) Received: from slackpad.fritz.box (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5423F3F70D; Wed, 16 Jun 2021 03:15:08 -0700 (PDT) Date: Wed, 16 Jun 2021 11:14:52 +0100 From: Andre Przywara To: Maxime Ripard Cc: Chen-Yu Tsai , Jernej Skrabec , Rob Herring , Icenowy Zheng , Samuel Holland , linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Ondrej Jirman , Alessandro Zummo , Alexandre Belloni , linux-rtc@vger.kernel.org Subject: Re: [PATCH v7 06/19] rtc: sun6i: Add support for RTCs without external LOSCs Message-ID: <20210616111452.1d7f2423@slackpad.fritz.box> In-Reply-To: <20210616091431.6tm3zdf77p2x3upc@gilmour> References: <20210615110636.23403-1-andre.przywara@arm.com> <20210615110636.23403-7-andre.przywara@arm.com> <20210616091431.6tm3zdf77p2x3upc@gilmour> Organization: Arm Ltd. X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.31; x86_64-slackware-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 16 Jun 2021 11:14:31 +0200 Maxime Ripard wrote: Hi, > On Tue, Jun 15, 2021 at 12:06:23PM +0100, Andre Przywara wrote: > > Some newer Allwinner RTCs (for instance the one in the H616 SoC) lack > > a pin for an external 32768 Hz oscillator. As a consequence, this LOSC > > can't be selected as the RTC clock source, and we must rely on the > > internal RC oscillator. > > To allow additions of clocks to the RTC node, add a feature bit to ignore > > any provided clocks for now (the current code would think this is the > > external LOSC). Later DTs and code can then for instance add the PLL > > based clock input, and older kernel won't get confused. > > > > Signed-off-by: Andre Przywara > > Honestly, I don't really know if it's worth it at this point. > > If we sums this up: > > - The RTC has 2 features that we use, mostly centered around 2 > registers set plus a global one > > - Those 2 features are programmed in a completely different way > > - Even the common part is different, given the discussion around the > clocks that we have. > > What is there to share in that driver aside from the probe, and maybe > the interrupt handling? Instead of complicating this further with more > special case that you were (rightfully) complaining about, shouldn't we > just acknowledge the fact that it's a completely separate design and > should be treated as such, with a completely separate driver? If you mean to have a separate clock driver, and one RTC driver: I agree, and IIUC Samuel has a prototype, covering the H6 and D1 as well: https://github.com/smaeul/linux/commit/6f8f761db1d8dd4b6abf006fb7e2427da79321c2 The only problem I see that they are sharing MMIO registers. Maybe it works because the RTC part never touches anything below 0x10, and the clock part just needs the first four registers? But this means we can't easily change this for the H6, as the existing H6 RTC code adds 0x10 to the MMIO base, and also old DTs will have the RTC base address in their RTC reg property. If we can somehow solve this (let the clock driver point to the RTC node to get a regmap?) I am all in, for the reasons you mentioned. Cheers, Andre