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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 745FFC7EE23 for ; Fri, 26 May 2023 10:50:51 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4981384706; Fri, 26 May 2023 12:50:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id B13B0846EF; Fri, 26 May 2023 12:50:46 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 097E984706 for ; Fri, 26 May 2023 12:50:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=andre.przywara@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 5A3F3D75; Fri, 26 May 2023 03:51:27 -0700 (PDT) Received: from slackpad.lan (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 959EA3F762; Fri, 26 May 2023 03:50:41 -0700 (PDT) Date: Fri, 26 May 2023 11:50:15 +0100 From: Andre Przywara To: Sam Edwards Cc: u-boot@lists.denx.de Subject: Re: [RFC PATCH 10/17] clk: sunxi: Add support for the D1 CCU Message-ID: <20230526115015.33d1cea3@slackpad.lan> In-Reply-To: <9d95e7f4-4ec2-b025-df11-22e2101b1fc9@gmail.com> References: <20221206004549.29015-1-andre.przywara@arm.com> <20221206004549.29015-11-andre.przywara@arm.com> <9d95e7f4-4ec2-b025-df11-22e2101b1fc9@gmail.com> Organization: Arm Ltd. X-Mailer: Claws Mail 4.1.1 (GTK 3.24.31; x86_64-slackware-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean On Thu, 25 May 2023 18:34:45 -0600 Sam Edwards wrote: Hi Sam, thanks for staying on this! > On 12/5/22 17:45, Andre Przywara wrote: > > +static struct ccu_clk_gate d1_gates[] = { > > + [CLK_BUS_MMC0] = GATE(0x84c, BIT(0)), > > + [CLK_BUS_MMC1] = GATE(0x84c, BIT(1)), > > + [CLK_BUS_MMC2] = GATE(0x84c, BIT(2)), > > + [CLK_BUS_UART0] = GATE(0x90c, BIT(0)), > > + [CLK_BUS_UART1] = GATE(0x90c, BIT(1)), > > + [CLK_BUS_UART2] = GATE(0x90c, BIT(2)), > > + [CLK_BUS_UART3] = GATE(0x90c, BIT(3)), > > + [CLK_BUS_UART4] = GATE(0x90c, BIT(4)), > > + [CLK_BUS_UART5] = GATE(0x90c, BIT(5)), > > + [CLK_BUS_I2C0] = GATE(0x91c, BIT(0)), > > + [CLK_BUS_I2C1] = GATE(0x91c, BIT(1)), > > + [CLK_BUS_I2C2] = GATE(0x91c, BIT(2)), > > + [CLK_BUS_I2C3] = GATE(0x91c, BIT(3)), > > + [CLK_SPI0] = GATE(0x940, BIT(31)), > > + [CLK_SPI1] = GATE(0x944, BIT(31)), > > + [CLK_BUS_SPI0] = GATE(0x96c, BIT(0)), > > + [CLK_BUS_SPI1] = GATE(0x96c, BIT(1)), > > + > > + [CLK_BUS_EMAC] = GATE(0x97c, BIT(0)), > > + > > + [CLK_USB_OHCI0] = GATE(0xa70, BIT(31)), > > + [CLK_USB_OHCI1] = GATE(0xa74, BIT(31)), > > + [CLK_BUS_OHCI0] = GATE(0xa8c, BIT(0)), > > + [CLK_BUS_OHCI1] = GATE(0xa8c, BIT(1)), > > + [CLK_BUS_EHCI0] = GATE(0xa8c, BIT(4)), > > + [CLK_BUS_EHCI1] = GATE(0xa8c, BIT(5)), > > + [CLK_BUS_OTG] = GATE(0xa8c, BIT(8)), > > + [CLK_BUS_LRADC] = GATE(0xa9c, BIT(0)), > > + > > + [CLK_RISCV] = GATE(0xd04, BIT(31)), > > +}; > > Would it be reasonable to add (possibly one for APB1 also): > [CLK_APB0] = GATE_DUMMY, > > ...in order to suppress this warning at init: > sunxi_set_gate: (CLK#24) unhandled Yeah, seems like we are working in lockstep, as I found and fixed the very same issue in the very same way on Wednesday ;-) > As I understand it, CLK_APB0 is only for speed control and doesn't have > a gate, but since the FDT references it, other drivers are asking the > clock driver to ungate it, resulting in that (safe-to-ignore) warning. The APB0 bus transports register accesses to a certain subset of "low speed" peripherals, Those peripherals include the clock control unit (CCU) itself, and the GPIO registers, so it's quite essential for normal operation. CLK_APB0 is the clock driving that bus, and as it's controlled via the CCU, you just cannot turn that off. Check "Figure 3-3 System bus tree" in the manual. Linux never really touches that clock (for said reasons), and Allwinner recommends a certain frequency, which we set up in the SPL. So to not boil the ocean here for something that doesn't need control anyway, we just introduced those "dummy gates", to appease U-Boot's clock framework and avoid that warning. Long story short: you did everything right ;-) > PS: Do you have any plans for PSCI support, so we can get the second > core up too? I'd like to patch that in and include it in your series > once my available time permits. Just thought I'd check that you/someone > wasn't working on it already. :) I checked the manuals, and it seems the required bits are documented, but IIRC they differ from the other (much older) 32-bit parts. So it would require some refactoring of the existing sunxi PSCI code to accommodate the T113. That's not really a problem, but I didn't find time yet to tackle this, so if you want to beat me on it: be my guest. For the basic operation SMP is not essential, so I don't want to let that hold back the T113 U-Boot support in general. The plan is to have an extra patch on top for PSCI, and merge that when it's ready - which could be together with the basic support, if we get it done on time. Cheers, Andre