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 51E4DC25B08 for ; Wed, 17 Aug 2022 11:24:46 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 32B68849D4; Wed, 17 Aug 2022 13:24:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="XKxwEzWJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 17C038480C; Wed, 17 Aug 2022 13:24:18 +0200 (CEST) Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DDAE68498F for ; Wed, 17 Aug 2022 13:24:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=aford173@gmail.com Received: by mail-io1-xd35.google.com with SMTP id q74so6310651iod.9 for ; Wed, 17 Aug 2022 04:24:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=/ZRAFFeYKH7i5OzTcVbdCJ4CitQ6wUfo0oWlPIIzu/Q=; b=XKxwEzWJnV6kQxcn1dt0BjrcRCljVpgQ3uY/lomcXbKyge9dgQmhJHMXDdW8M28oJ3 bE7yB5nkwzE1Q/KssRhMPHtWEI27CQEdb5ovEBE4FHrJLcu8be/hawrAuuSiM8xtlTah pIYFzW6wWJP8swb4SEemf9J5kZ04c81waL/zi/zjugipdb5i25jHlDH0RSOOJZJiYqN/ Bpc6f/GJtkDnDOxOvhh2SM+8scf8BKbU2wZFa0FCt3KP+9zZB9xtps/fOflPiegBdaL4 Tkv3I4SGyO+b/KRyHorW0DfzbiHPlorjdDD1yz9CJXi/C+0doWVhFcPndu5GADj60CqZ y1NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=/ZRAFFeYKH7i5OzTcVbdCJ4CitQ6wUfo0oWlPIIzu/Q=; b=zGcrYJxrAK3SDxIyU+QLLuuCmhFtFfe+I9gh8qf8yeqzaMFY7niBFpLgfJ0Ok6EFSp qo3vNEGEL6byjxeDkKYjku//my8csgNPl13mEuHw82FKixN+IQ7TzBYIxiAcCStZNHis RGezMy+3aLvJLEmPkCvttLE0f+EhTmD21BaFLpN4hsyWcOaAJl63s3NsEkDNvMnt0q1i 7crLMjdaDkIaG1pjVaCAs0GJzhtJghfP3vytqhzPs4bs/h31tzMl/2Ec9Z0Dx9SIJXNh pOWiSZO4UT+PlDD8SED0gC3Td2dSJvU2A8tlwTbtIxnwIOyw2JPpeiihBoqHvmnkzyWA GQvQ== X-Gm-Message-State: ACgBeo29KNifVGAINXd6dwxHIohefDHd8L4EtNSgsRdG/VbP9e071PYY jZ9l4yM0bf1HEt0WgmXmXUQcNz3dqfY= X-Google-Smtp-Source: AA6agR6yTArI/QsJ7uI58I0ZlFHREDoIOWbXSI6ivH9gSeJudJvS6bo1XJwA+vPoS8WmlRVyOsj3CQ== X-Received: by 2002:a05:6638:1c0a:b0:343:5f57:9c5d with SMTP id ca10-20020a0566381c0a00b003435f579c5dmr11338847jab.112.1660735449900; Wed, 17 Aug 2022 04:24:09 -0700 (PDT) Received: from AIO.lan ([2601:448:8400:9e8:9d79:948f:6e0e:794b]) by smtp.gmail.com with ESMTPSA id y13-20020a056602048d00b006849ee78e1bsm7505269iov.34.2022.08.17.04.24.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 04:24:09 -0700 (PDT) From: Adam Ford To: u-boot@lists.denx.de Cc: jh80.chung@samsung.com, sbabic@denx.de, festevam@gmail.com, uboot-imx@nxp.com, Adam Ford Subject: [PATCH 4/4] imx: imx8mn-beacon: Configure PMIC before DDR initialization Date: Wed, 17 Aug 2022 06:24:03 -0500 Message-Id: <20220817112403.68144-4-aford173@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220817112403.68144-1-aford173@gmail.com> References: <20220817112403.68144-1-aford173@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.6 at phobos.denx.de X-Virus-Status: Clean The DDR is configured for LPDDR4 running at 1.6GHz which requires the voltage on the PMIC to rise a bit or it will be running out of spec. Signed-off-by: Adam Ford diff --git a/board/beacon/imx8mn/spl.c b/board/beacon/imx8mn/spl.c index 029f71bc99..9acd916180 100644 --- a/board/beacon/imx8mn/spl.c +++ b/board/beacon/imx8mn/spl.c @@ -74,6 +74,38 @@ static iomux_v3_cfg_t const pwm_pads[] = { IMX8MN_PAD_GPIO1_IO01__PWM1_OUT | MUX_PAD_CTRL(PWM1_PAD_CTRL), }; +static int power_init_board(void) +{ + struct udevice *dev; + int ret; + + ret = pmic_get("pmic@4b", &dev); + if (ret == -ENODEV) { + puts("No pmic\n"); + return 0; + } + + if (ret != 0) + return ret; + + /* decrease RESET key long push time from the default 10s to 10ms */ + pmic_reg_write(dev, BD718XX_PWRONCONFIG1, 0x0); + + /* unlock the PMIC regs */ + pmic_reg_write(dev, BD718XX_REGLOCK, 0x1); + + /* increase VDD_SOC to typical value 0.85v before first DRAM access */ + pmic_reg_write(dev, BD718XX_BUCK1_VOLT_RUN, 0x0f); + + /* increase VDD_DRAM to 0.975v for 3Ghz DDR */ + pmic_reg_write(dev, BD718XX_1ST_NODVS_BUCK_VOLT, 0x83); + + /* lock the PMIC regs */ + pmic_reg_write(dev, BD718XX_REGLOCK, 0x11); + + return 0; +} + int board_early_init_f(void) { /* Claiming pwm pins prevents LCD flicker during startup*/ @@ -107,6 +139,9 @@ void board_init_f(ulong dummy) enable_tzc380(); + /* LPDDR4 at 1.6GHz requires a voltage adjustment on the PMIC */ + power_init_board(); + /* DDR initialization */ spl_dram_init(); -- 2.34.1