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 C790CC433EF for ; Fri, 24 Dec 2021 07:00:17 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3B8538373B; Fri, 24 Dec 2021 08:00:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=rock-chips.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 EB8978376C; Fri, 24 Dec 2021 08:00:12 +0100 (CET) Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.70.206]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EDD8E8373B for ; Fri, 24 Dec 2021 08:00:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=kever.yang@rock-chips.com Received: from localhost (unknown [192.168.167.32]) by regular1.263xmail.com (Postfix) with ESMTP id 29DFD1C36; Fri, 24 Dec 2021 15:00:04 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-SKE-CHECKED: 1 X-ABS-CHECKED: 1 X-ANTISPAM-LEVEL: 2 Received: from [192.168.60.65] (unknown [103.29.142.67]) by smtp.263.net (postfix) whith ESMTP id P40002T140570815084288S1640329192466001_; Fri, 24 Dec 2021 15:00:03 +0800 (CST) X-IP-DOMAINF: 1 X-RL-SENDER: kever.yang@rock-chips.com X-SENDER: yk@rock-chips.com X-LOGIN-NAME: kever.yang@rock-chips.com X-FST-TO: philipp.tomsich@vrull.eu X-RCPT-COUNT: 17 X-LOCAL-RCPT-COUNT: 0 X-MUTI-DOMAIN-COUNT: 0 X-SENDER-IP: 103.29.142.67 X-ATTACHMENT-NUM: 0 X-UNIQUE-TAG: <6d3dca9d63cf2c6f57af324ad20b831d> X-System-Flag: 0 Subject: Re: [PATCH v2 1/4] rockchip: gru: Set up SoC IO domain registers To: Alper Nebi Yasak , u-boot@lists.denx.de Cc: Artem Lapkin , Christian Hewitt , Fabio Estevam , Jagan Teki , Lokesh Vutla , "Marty E . Plummer" , Heiko Schocher , Simon Glass , Andre Przywara , Neil Armstrong , Tim Harvey , Johan Jonker , Alexandre Vicenzi , Peter Robinson , Philipp Tomsich References: <20211213221528.43102-1-alpernebiyasak@gmail.com> <20211213221528.43102-2-alpernebiyasak@gmail.com> From: Kever Yang Message-ID: <0be4180f-e25a-589c-8dcd-8dadf466114c@rock-chips.com> Date: Fri, 24 Dec 2021 14:59:50 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211213221528.43102-2-alpernebiyasak@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 at phobos.denx.de X-Virus-Status: Clean On 2021/12/14 上午6:15, Alper Nebi Yasak wrote: > The RK3399 SoC needs to know the voltage value provided by some > regulators, which is done by setting relevant register bits. Configure > these the way other RK3399 boards do, but with the same values as are > set in the equivalent code in coreboot. > > Signed-off-by: Alper Nebi Yasak Reviewed-by: Kever Yang Thanks, - Kever > --- > There is a driver for this on Rockchip's repo, I managed to forward-port > it and get it working. If that's more desirable than doing it per-board > like this I can send that upstream (but I'd prefer to do it after this). > > Changes in v2: > - Drop unnecessary ifdef. > - Clarify commit message regarding 'values set in coreboot'. > > board/google/gru/gru.c | 52 ++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 52 insertions(+) > > diff --git a/board/google/gru/gru.c b/board/google/gru/gru.c > index 23080c1798b7..cbf62a9427c9 100644 > --- a/board/google/gru/gru.c > +++ b/board/google/gru/gru.c > @@ -6,6 +6,17 @@ > #include > #include > #include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define GRF_IO_VSEL_BT656_SHIFT 0 > +#define GRF_IO_VSEL_AUDIO_SHIFT 1 > +#define PMUGRF_CON0_VSEL_SHIFT 8 > +#define PMUGRF_CON0_VOL_SHIFT 9 > > #ifdef CONFIG_SPL_BUILD > /* provided to defeat compiler optimisation in board_init_f() */ > @@ -54,3 +65,44 @@ int board_early_init_r(void) > return 0; > } > #endif > + > +static void setup_iodomain(void) > +{ > + struct rk3399_grf_regs *grf = > + syscon_get_first_range(ROCKCHIP_SYSCON_GRF); > + struct rk3399_pmugrf_regs *pmugrf = > + syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF); > + > + /* BT656 and audio is in 1.8v domain */ > + rk_setreg(&grf->io_vsel, (1 << GRF_IO_VSEL_BT656_SHIFT | > + 1 << GRF_IO_VSEL_AUDIO_SHIFT)); > + > + /* > + * Set GPIO1 1.8v/3.0v source select to PMU1830_VOL > + * and explicitly configure that PMU1830_VOL to be 1.8V > + */ > + rk_setreg(&pmugrf->soc_con0, (1 << PMUGRF_CON0_VSEL_SHIFT | > + 1 << PMUGRF_CON0_VOL_SHIFT)); > +} > + > +int misc_init_r(void) > +{ > + const u32 cpuid_offset = 0x7; > + const u32 cpuid_length = 0x10; > + u8 cpuid[cpuid_length]; > + int ret; > + > + setup_iodomain(); > + > + ret = rockchip_cpuid_from_efuse(cpuid_offset, cpuid_length, cpuid); > + if (ret) > + return ret; > + > + ret = rockchip_cpuid_set(cpuid, cpuid_length); > + if (ret) > + return ret; > + > + ret = rockchip_setup_macaddr(); > + > + return ret; > +}