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 1A08FCD3431 for ; Wed, 4 Sep 2024 07:35:22 +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:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kySmQ0NpSqWHNg8+6rJZj9OzeWLaHHajMIIiNyf6JOU=; b=ps080EmoZutQT0tfPKV9mfrdgF zCAPNHW3C9gZ1MbOZkQHg27txlO7a1sDtEHslWdezS7xKnD69FG2Zbhsa0dcE+6KoM7BJuHvIGGP+ Vo/fV5QHPxJzY2KpnNLGnXCEKeaDJwowOm2Ufe5aeMX9sNc40w+eYhfhK2DZLcTjV49VmzIyw6XGM rbx7oXGgyWRSLWOEuZESQTzzAJvodiUy0NLBc4z77e+uqPbkm2BGdJOg74wDRnGuNG4YZUl56WyPg kqat6tPy410Y2Y7pXvtumNumTtM84v5POPY8QIaDlelsvxOuwJPB3tFpiWqctjTB7WHxAhhCOi63b CcUXz6/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1slkXl-00000003DAP-29vc; Wed, 04 Sep 2024 07:35:09 +0000 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1slkWX-00000003Cw8-2xmZ for linux-arm-kernel@lists.infradead.org; Wed, 04 Sep 2024 07:33:55 +0000 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-a86859e2fc0so704142866b.3 for ; Wed, 04 Sep 2024 00:33:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1725435231; x=1726040031; darn=lists.infradead.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=kySmQ0NpSqWHNg8+6rJZj9OzeWLaHHajMIIiNyf6JOU=; b=PbI8/emgWS8qiUsYBgWjFGqxz1KBmZ2GlUQ6PzEnxeQJnZohVAw69FkcA1V7JS7eh7 wbUXK93GXh2xyqeOLJvklio2KlJ/u4zbyJq8VRIdQMCzhpADog0XEAwboziHQKDUTsqv sN2kvTCz73eOxD4LEFW8CKnMHZRer2zXQx+EGlIldBOp/xGy/TKPp8U6blD5BnBQwVfb 7EuYxRukOLvIfqRd5sQSBCMYJM7zSiHMsRQh9Nte15COyRH66tagRkmyjqp7L83zA0Po 0r39Uez+N789isdGpfaPdxhbHzyfAN4n5bW2ue15D5vk4oViLS9FYiShGT1vcJk59zVl oW/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725435231; x=1726040031; h=content-transfer-encoding:in-reply-to:from:references: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=kySmQ0NpSqWHNg8+6rJZj9OzeWLaHHajMIIiNyf6JOU=; b=PC0uGOKm2XAM5OxA1CkiRdfo1c6rfXcf97omWNQEHkW1vigUmYOu7EMeq+zSC3L4oK 5LfsKT6iCsXMChNOXuFfk473DDnhCqz+J9IzNCdaeL7fHNShU0kjTHU5nAiIZBroxmjA cByPcrdOh/7MBPH5tzas5m6Wo+I29++dw4urwTbg4HJ5iq+w0fvONOlmDzvuqMMTzclr +yFVlZlU7pihVjPN6RYTAn9xgd9mVfpi3wlPS2Dvt4zNi8UMKUxqsg6m9tHbAl6JvHKv a+9ziGTvbm7dPFwAeonmG8g3JqPLyOIMtwhPKMGNOoPE7T8pLsim/hVE5syV5ajvqVaH e32g== X-Forwarded-Encrypted: i=1; AJvYcCWFIx0bzLfK1IH1Yt7FvFei3IBJ7V5gitBJSqGFDyPKVVyEiyxWlzPk62poKNz/k5De3hxWF2PIALRNytJOMI0l@lists.infradead.org X-Gm-Message-State: AOJu0Yw9hvS2ZVxyX4xX0inNyRgSZWKUOmuiAhiZnz6NOaB2NVPK/A+N +/x/AIr2BzjEpsMArnUrNCG3Oo4LLtdEac7XW5nGQgPebDPQ2S0H0DuufN2Sj5w= X-Google-Smtp-Source: AGHT+IGl05aPVJ2VVVeagU0VruOPFextWHrrfb3lApSLDF6oIkmfcuyVCehiFDjMGW4cA5W88nFnEQ== X-Received: by 2002:a17:907:9690:b0:a86:78fd:1df0 with SMTP id a640c23a62f3a-a8a32ed8959mr245881866b.34.1725435231164; Wed, 04 Sep 2024 00:33:51 -0700 (PDT) Received: from [192.168.50.4] ([82.78.167.144]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a89891a3dbdsm771648966b.131.2024.09.04.00.33.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Sep 2024 00:33:50 -0700 (PDT) Message-ID: <6bc72d8a-c7b8-40de-b4c2-0170dde36d33@tuxon.dev> Date: Wed, 4 Sep 2024 10:33:49 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: get, prepare, enable a clock not in DT? Content-Language: en-US To: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Nicolas Ferre References: <20240816-ludicrous-lagging-65e750c57ab4@thorsis.com> <384919bc-7d45-445a-bc85-630c599d43ef@tuxon.dev> <20240820-grandpa-down-fec4231f971c@thorsis.com> <20240828-gainfully-cringing-2f420d8882bd@thorsis.com> <6cd18742-7ba8-4b0c-aff9-7065bccd4095@tuxon.dev> <20240902-machinist-straggler-cce44ffa4a7c@thorsis.com> From: claudiu beznea In-Reply-To: <20240902-machinist-straggler-cce44ffa4a7c@thorsis.com> 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-20240904_003353_768209_3A6F21E0 X-CRM114-Status: GOOD ( 27.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, Alexander, On 02.09.2024 11:24, Alexander Dahl wrote: > Hello Claudiu, > > Am Sat, Aug 31, 2024 at 06:49:59PM +0300 schrieb claudiu beznea: >> Hi, Alexander, >> >> On 28.08.2024 09:55, Alexander Dahl wrote: >>> Hello Claudiu, >>> >>> Am Fri, Aug 23, 2024 at 05:29:44PM +0300 schrieb claudiu beznea: >>>> >>>> >>>> On 20.08.2024 15:17, Alexander Dahl wrote: >>>>> By chance: I don't have a sama7g5 based board at hand for testing. >>>>> The datasheet says the same as for sam9x60. >>>>> Does the nvmem_microchip_otpc driver actually work without timeout on >>>>> sama7g5? >>>> >>>> Yes! This should be because system bus is clocked from MCK0 (as mentioned >>>> in peripheral identifiers table) which is enabled by bootloader. >>> >>> Not sure I can follow. Citing the SAMA7G5 datasheet section 30.4 >>> (OTPC Product Dependencies): >>> >>> "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." >> >> I don't see this in [1]. Only: >> >> "The OTPC is clocked through the Power Management Controller (PMC), so the >> programmer must first to configure the PMC." >> >> From this I got that it is about the MCK0 listed in table Table 8-11. >> Peripheral Identifiers. >> >> [1] >> https://ww1.microchip.com/downloads/aemDocuments/documents/MPU32/ProductDocuments/DataSheets/SAMA7G5-Series-Data-Sheet-DS60001765A.pdf > > Well, this seems to be an older version revision A from 03/2022. > I have DS60001765B (revision B) from 12/2023 and got this here (note > the missing 'A' in the filename): > > https://ww1.microchip.com/downloads/aemDocuments/documents/MPU32/ProductDocuments/DataSheets/SAMA7G5-Series-Data-Sheet-DS60001765.pdf This version clearly express your findings. The unknown now is the "peripheral clock" that need to be enabled along with the main_rc_oscillator. For that you may want to play around with PMC Peripheral Control Register, PMC peripheral clock status register and see if OTPC fails to work when disabling the peripheral clock with the OTPC ID as there is no information about peripheral clock for OTPC in the peripheral identifers table. Hope this helps. Thank you, Claudiu Beznea > > Linked here: > > https://www.microchip.com/en-us/product/sama7g54 > > The revision history is not very specific, it only says "Updated Power > Management". Errata sheet has nothing interesting on that topic. > > We both cited what we saw in the datasheets. Revision A has the > section you cited, revision B has the section I cited. > >>> Table from section 8.5 (Peripheral Clocks …) has no check mark at "PMC >>> clock control" but indeed lists MCK0 as main system bus clock. >> >> This is what I was taking about. >> >>> If it >>> works on SAMA7G5 without explicitly enabling main RC oscillator, then >>> either that clock is on accidentally, or the datasheet is wrong in the >>> OTPC section. >> >> Might be. > > I don't have a SAMA7G5 at hand. Someone who has could test if OTPC > works with/without MCK0, and with/without main RC osc, all possible > combinations would be most helpful: with none of those, with only one, > only the other, both. > > Hope we get this clock stuff sorted out?! > > Greets > Alex > >> >> Thank you, >> Claudiu Beznea >> >>> >>> Personally I find the "clocked through PMC" part in the OTPC >>> section suspicious, because in the peripheral identifiers table OTPC >>> has no "PMC Clock Control" mark. >>> >>> Not sure what's the difference between SAM9X60 and SAMA7G5 internally, >>> though. From a user's POV it's possible one of them requires the >>> main RC osc, and the other does not, but currently you can't tell from >>> the datasheets. >>> >>>> Here is a snapshot of reading the NVMEM on a SAMA7G5 with bootconfig and >>>> thermal calibration packets: >>>> https://www.linux4sam.org/bin/view/Linux4SAM/ThermalFaq >>> >>> Greets >>> Alex >>> >>