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 ECDC4CCF9E5 for ; Wed, 25 Sep 2024 15:26:28 +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=a5r1SAqsqnNAJoiKgqj4VVR1DTD4O8B1o3mZjNQtIF0=; b=InUAjZj9qz4mvaTWJmtFJikB7Z d5N4doBpoZKoMMXGRxfraUqT5q7HHbi46Iw2hy09h6W46yoTT0/vp7v2BRdPCCoavgA7glmG1ByrT B9C0jNzAT2PezyP/yYB4JCdIa55kaTaV2NNKm4Woff+6KixP7tAJxwenytrOAxyItS4qeIY49Gdin nmvVJqInwigxbThguh7s6J7yZYuYH2sHqYAx+QmO2P+c5Ayc+czC2vqkuiiWDLnNKWA+wIjPmweUf Nk7gRwf3AXaly8ZsjBoSw7+x8kucIdtfep4L8km0uY0wWayKsduF6w2OLdKDBPfFNv/1EXISSxe0Z eDBT5Bhg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1stTuA-00000005s4T-2meC; Wed, 25 Sep 2024 15:26:14 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1stTsy-00000005rnz-2jau for linux-arm-kernel@lists.infradead.org; Wed, 25 Sep 2024 15:25:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1727277900; x=1758813900; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=8UbC7Glv53C5Wh4gGajAzcDOxSrszEi7y/jg4Pu+9Uc=; b=HkkzoF+4yB+4QgBPPkXRwRm5Y9kpzhtzwcB2woVD8dzVR3qqQY53H5w+ bSavJwYfXtq4MLOZacgvpVp9tt6n+z1FroLqjunaQwkHBnZhrM4uagYjG iVsVzGwibK2sIOCrBTJdRQUwUglSdJD7ERrJiL+9ucBzOfXRBfrHd7ZCa yK0WzwgoPh23NYesht4xWwyQmh5s7eHaMu8TUaFWfzbpt9RrqY3EzK/Mg tmUPpf6czXYsc8sC/vESsH3Elp47/mW4oyjZONIgTrGK7Lf3BOxtWTcWM KKDLBLWT4I33LHWbhdqEt/zQQGaksI9qGmZ7YXmIv00pR+4ZtAXtyBlXj A==; X-CSE-ConnectionGUID: OOlwZxHRS2etYem7By+NLw== X-CSE-MsgGUID: 0AFWp061Qqqb5rmbRepGNQ== X-IronPort-AV: E=Sophos;i="6.10,257,1719903600"; d="scan'208";a="32100963" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 25 Sep 2024 08:24:58 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 25 Sep 2024 08:24:28 -0700 Received: from [10.171.248.56] (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Wed, 25 Sep 2024 08:24:25 -0700 Message-ID: Date: Wed, 25 Sep 2024 17:24:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 09/12] clk: at91: sam9x60: Allow enabling main_rc_osc through DT Content-Language: en-US, fr-FR To: Ryan Wanner , Claudiu Beznea , CC: Conor Dooley , "moderated list:ARM/Microchip (AT91) SoC support" , Alexandre Belloni , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "open list:COMMON CLK FRAMEWORK" , Rob Herring , "open list" , Krzysztof Kozlowski , Christian Melki , "Michael Turquette" , Stephen Boyd References: <20240821105943.230281-1-ada@thorsis.com> <20240821105943.230281-10-ada@thorsis.com> <20240919-outsider-extending-e0a926bd23fa@thorsis.com> <464f599a-7f0b-4e4e-901a-8f88a25428d6@microchip.com> From: Nicolas Ferre Organization: microchip In-Reply-To: <464f599a-7f0b-4e4e-901a-8f88a25428d6@microchip.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240925_082500_898319_0D64642B X-CRM114-Status: GOOD ( 35.36 ) 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 On 24/09/2024 at 17:52, Ryan Wanner wrote: > Hello Alex, > > I think a possible solution is to put the DT binding ID for main rc oc > after PMC_MCK and then add 1 to all the other IDs that are not dependent > on PMC_MAIN, the IDs that are before the branch for the sama7g54. > > One issue I see with this solution is with SoCs that do not want the > main rc os exported to the DT the driver array might be allocating too > much memory, this can be solved by removing the +1 that is in the clock We're talking about a handful of bytes, we can surely afford that. My $0.02. Regards, Nicolas > drivers next to the device tree binding macro, since this macro is now > increased by 1 with this change. > > Doing a quick test on the sam9x60 and sama7g54 I did not see any glaring > issues with this potential solution. > > Best, > > Ryan > > > On 9/19/24 05:39, Alexander Dahl wrote: >> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe >> >> Hello Claudiu, >> >> after being busy with other things, I'm back looking at this series. >> As Nicolas pointed out [1], we need three clocks for the OTPC to work, >> quote: >> >> "for all the products, the main RC oscillator, the OTPC peripheral >> clock and the MCKx clocks associated to OTP must be enabled." >> >> I have a problem with making the main_rc_osc accessible for both >> SAM9X60 and SAMA7G5 here, see below. >> >> Am Wed, Aug 21, 2024 at 12:59:40PM +0200 schrieb Alexander Dahl: >>> SAM9X60 Datasheet (DS60001579G) Section "23.4 Product Dependencies" >>> says: >>> >>> "The OTPC is clocked through the Power Management Controller (PMC). >>> The user must power on the main RC oscillator and enable the >>> peripheral clock of the OTPC prior to reading or writing the OTP >>> memory." >>> >>> The code for enabling/disabling that clock is already present, it was >>> just not possible to hook into DT anymore, after at91 clk devicetree >>> binding rework back in 2018 for kernel v4.19. >>> >>> Signed-off-by: Alexander Dahl >>> --- >>> drivers/clk/at91/sam9x60.c | 3 ++- >>> include/dt-bindings/clock/at91.h | 1 + >>> 2 files changed, 3 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c >>> index e309cbf3cb9a..4d5ee20b8fc4 100644 >>> --- a/drivers/clk/at91/sam9x60.c >>> +++ b/drivers/clk/at91/sam9x60.c >>> @@ -207,7 +207,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np) >>> if (IS_ERR(regmap)) >>> return; >>> >>> - sam9x60_pmc = pmc_data_allocate(PMC_PLLACK + 1, >>> + sam9x60_pmc = pmc_data_allocate(PMC_MAIN_RC + 1, >>> nck(sam9x60_systemck), >>> nck(sam9x60_periphck), >>> nck(sam9x60_gck), 8); >>> @@ -218,6 +218,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np) >>> 50000000); >>> if (IS_ERR(hw)) >>> goto err_free; >>> + sam9x60_pmc->chws[PMC_MAIN_RC] = hw; >>> >>> hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL, 0); >>> if (IS_ERR(hw)) >>> diff --git a/include/dt-bindings/clock/at91.h b/include/dt-bindings/clock/at91.h >>> index 3e3972a814c1..f957625cb3ac 100644 >>> --- a/include/dt-bindings/clock/at91.h >>> +++ b/include/dt-bindings/clock/at91.h >>> @@ -25,6 +25,7 @@ >>> #define PMC_PLLBCK 8 >>> #define PMC_AUDIOPLLCK 9 >>> #define PMC_AUDIOPINCK 10 >>> +#define PMC_MAIN_RC 11 >>> >>> /* SAMA7G5 */ >>> #define PMC_CPUPLL (PMC_MAIN + 1) >> >> There are IDs defined in the devicetree bindings here, which are used >> both in dts and in driver code as array indexes. In v1 of the patch >> series I just added a new last element in the end of the generic list >> and used that for SAM9X60. >> >> For SAMA7G5 those IDs are branched of from PMC_MAIN in between, making >> SAMA7G5 using a different last element, and different values after >> PMC_MAIN. >> >> Now we need a new ID for main rc osc, but not only for SAM9X60, but >> also for SAMA7G5. I'm not sure what the implications would be, if the >> new ID would be added in between before PMC_MAIN, so all values would >> change? Adding it to the end of the lists would probably be safe, but >> then you would need a diffently named variant for SAMA7G5's different >> IDs. I find the current status somewhat unfortunate for future >> extensions. How should this new ID be added here? What would be the >> way forward? >> >> Greets >> Alex >> >> [1] https://lore.kernel.org/linux-clk/ec34efc2-2051-4b8a-b5d8-6e2fd5e08c28@microchip.com/T/#u >> >>> -- >>> 2.39.2 >>> >>> >> >