From patchwork Mon May 15 14:26:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yegor Yefremov X-Patchwork-Id: 1781426 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlemail.com header.i=@googlemail.com header.a=rsa-sha256 header.s=20221208 header.b=YXBzomiJ; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QKhXg1Pskz20KF for ; Tue, 16 May 2023 00:27:31 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AFF6B84779; Mon, 15 May 2023 16:27:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=googlemail.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=googlemail.com header.i=@googlemail.com header.b="YXBzomiJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B06CD84794; Mon, 15 May 2023 16:27:26 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) (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 83FF384663 for ; Mon, 15 May 2023 16:27:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=yegorslists@googlemail.com Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-965d2749e2eso1938374566b.1 for ; Mon, 15 May 2023 07:27:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20221208; t=1684160844; x=1686752844; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=nluNeJra4jIqx/1sgbnueC0QNe4km4vu2y+KcHG2KLY=; b=YXBzomiJTP5xNmpRrVZa70PrbIDi0Pp0bx07JiEngd0ve2HGknoyIVjqv+ltC3v7Rb bt84sGCY4UZ6Mm+qzpeYaW9uy1/mafVGhqtPcvV9l6TEZyjszFVfQTqDpxEK07QZCSrS pZu1qUnUvePn/Jir7eyEjR/Kz+ArpM+RKlpmBksQ5BHDDurIpTXR2SaELEjkIzQ18a/c YJEPTd5sF4RU/2cr8/5tgB5Z97JImni13Y/fxtWLo29tMcjirTgoXchDmm77znYrcN3e nMHlGgXV1mvijHmMkN/L6wc8URjl9vTK3flW/bg7Ge62Bvr4DnRHISvVyYR8xYNuUUqt P7SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684160844; x=1686752844; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nluNeJra4jIqx/1sgbnueC0QNe4km4vu2y+KcHG2KLY=; b=Bxbe3tJwCcL2DI48TUgxpyXw2eNcvqDNj5gDOR34fHWjyiStPfSn7nRP/U8Xhuuc3z 0JLODOeWyy21j+tnFWXiDsvDh3bh5lvPtQRKdxtP9Goj7b6ari++9EA+8ifTA1YqaVB+ Ctyx7Spfsl4PGJp7NcDgtbp1TV01BjOqWiMqy/fDW2Av9Rcfxg+kFKAVewoSf562We0u IA8yDeE5FO3OU9W6Shbi4UVi5hfgYACY43TTfWM1LKRU3Rf8LcOSslAqoHDzm5uJEFC2 5O82yY+aIAPnYsGOkufvk3KJsR3X8OZScdbZFFRmyQIkM/qcav27GBhkrrqLy7mnPUJI WycQ== X-Gm-Message-State: AC+VfDyFnrVst9hvkZPL2DOvaOWg/nqtk00gc6W3yII2y3uJcIsuxTnZ supsy5++qK0qBfvLHJJ8OK0VHZzOFzg= X-Google-Smtp-Source: ACHHUZ6S8hF2VbwZWFpdiqtObAHka31lQIGtxdCTDyv9JpYMuA9rWM9zkcVAXskuGQdytI+7U0Ku3w== X-Received: by 2002:a17:907:3faa:b0:966:17b2:5b15 with SMTP id hr42-20020a1709073faa00b0096617b25b15mr32632594ejc.7.1684160843458; Mon, 15 May 2023 07:27:23 -0700 (PDT) Received: from development2.visionsystems.de (mail.visionsystems.de. [213.209.99.202]) by smtp.gmail.com with ESMTPSA id m13-20020a17090672cd00b0096ace7ae086sm4119629ejl.174.2023.05.15.07.27.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 May 2023 07:27:22 -0700 (PDT) From: yegorslists@googlemail.com To: u-boot@lists.denx.de Cc: trini@konsulko.com, Yegor Yefremov Subject: [PATCH] arm: baltos: switch to CONFIG_DM_I2C Date: Mon, 15 May 2023 16:26:44 +0200 Message-Id: <20230515142644.2085991-1-yegorslists@googlemail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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 From: Yegor Yefremov Also use the TPS65910 driver directly. Signed-off-by: Yegor Yefremov --- board/vscom/baltos/board.c | 44 ++++++++++++++------------------- configs/am335x_baltos_defconfig | 8 +++--- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/board/vscom/baltos/board.c b/board/vscom/baltos/board.c index f335d5b4f4..8f23cda8e4 100644 --- a/board/vscom/baltos/board.c +++ b/board/vscom/baltos/board.c @@ -76,17 +76,23 @@ static int baltos_set_console(void) static int read_eeprom(BSP_VS_HWPARAM *header) { - i2c_set_bus_num(1); + int rc; + struct udevice *dev; + struct udevice *bus; + + rc = uclass_get_device_by_seq(UCLASS_I2C, 1, &bus); + if (rc) + return rc; /* Check if baseboard eeprom is available */ - if (i2c_probe(CONFIG_SYS_I2C_EEPROM_ADDR)) { + if (dm_i2c_probe(bus, CONFIG_SYS_I2C_EEPROM_ADDR, 0, &dev)) { puts("Could not probe the EEPROM; something fundamentally " "wrong on the I2C bus.\n"); return -ENODEV; } /* read the eeprom using i2c */ - if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 1, (uchar *)header, + if (dm_i2c_read(dev, 0, (uchar *)header, sizeof(BSP_VS_HWPARAM))) { puts("Could not read the EEPROM; something fundamentally" " wrong on the I2C bus.\n"); @@ -173,34 +179,28 @@ const struct dpll_params dpll_ddr_baltos = { void am33xx_spl_board_init(void) { - int mpu_vdd; - int sil_rev; + int sil_rev, mpu_vdd; + int freq; + + enable_i2c1_pin_mux(); + i2c_set_bus_num(1); - /* Get the frequency */ - dpll_mpu_opp100.m = am335x_get_efuse_mpu_max_freq(cdev); + freq = am335x_get_efuse_mpu_max_freq(cdev); /* - * The GP EVM, IDK and EVM SK use a TPS65910 PMIC. For all + * The GP EVM, IDK and EVM SK use a TPS65910 PMIC. For all * MPU frequencies we support we use a CORE voltage of - * 1.1375V. For MPU voltage we need to switch based on + * 1.1375V. For MPU voltage we need to switch based on * the frequency we are running at. */ - i2c_set_bus_num(1); - - printf("I2C speed: %d Hz\n", CONFIG_SYS_I2C_SPEED); - - if (i2c_probe(TPS65910_CTRL_I2C_ADDR)) { - puts("i2c: cannot access TPS65910\n"); + if (power_tps65910_init(1)) return; - } - /* * Depending on MPU clock and PG we will need a different * VDD to drive at that speed. */ sil_rev = readl(&cdev->deviceid) >> 28; - mpu_vdd = am335x_get_tps65910_mpu_vdd(sil_rev, - dpll_mpu_opp100.m); + mpu_vdd = am335x_get_tps65910_mpu_vdd(sil_rev, freq); /* Tell the TPS65910 to use i2c */ tps65910_set_i2c_control(); @@ -213,12 +213,6 @@ void am33xx_spl_board_init(void) if (tps65910_voltage_update(CORE, TPS65910_OP_REG_SEL_1_1_3)) return; - /* Set CORE Frequencies to OPP100 */ - do_setup_dpll(&dpll_core_regs, &dpll_core_opp100); - - /* Set MPU Frequency to what we detected now that voltages are set */ - do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100); - writel(0x000010ff, PRM_DEVICE_INST + 4); } diff --git a/configs/am335x_baltos_defconfig b/configs/am335x_baltos_defconfig index 090b902be3..6ef3c78390 100644 --- a/configs/am335x_baltos_defconfig +++ b/configs/am335x_baltos_defconfig @@ -18,7 +18,6 @@ CONFIG_OF_BOARD_SETUP=y CONFIG_DISTRO_DEFAULTS=y CONFIG_BOOTCOMMAND="run findfdt; run usbboot;run mmcboot;setenv mmcdev 1; setenv bootpart 1:2; run mmcboot;run nandboot;" CONFIG_SYS_CONSOLE_INFO_QUIET=y -CONFIG_ARCH_MISC_INIT=y CONFIG_SYS_SPL_MALLOC=y CONFIG_SYS_SPL_MALLOC_SIZE=0x800000 CONFIG_SPL_FS_EXT4=y @@ -57,10 +56,10 @@ CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_VERSION_VARIABLE=y CONFIG_NET_RETRY_COUNT=10 CONFIG_BOOTP_SEND_HOSTNAME=y +# CONFIG_TI_SYSC is not set CONFIG_BOOTCOUNT_LIMIT=y -CONFIG_SYS_I2C_LEGACY=y +CONFIG_DM_I2C=y CONFIG_SPL_SYS_I2C_LEGACY=y -CONFIG_SYS_I2C_SPEED=1000 CONFIG_SYS_I2C_EEPROM_ADDR=0x50 CONFIG_MMC_OMAP_HS=y CONFIG_MMC_OMAP_HS_ADMA=y @@ -79,6 +78,8 @@ CONFIG_PHY_SMSC=y CONFIG_DM_MDIO=y CONFIG_MII=y CONFIG_DRIVER_TI_CPSW=y +CONFIG_DM_PMIC=y +# CONFIG_PMIC_CHILDREN is not set CONFIG_SPL_POWER_TPS65910=y CONFIG_SPI=y CONFIG_DM_SPI=y @@ -94,5 +95,4 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0xbd00 CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_USB_FUNCTION_MASS_STORAGE=y CONFIG_USB_ETHER=y -CONFIG_USBNET_HOST_ADDR="de:ad:be:af:00:00" CONFIG_WDT=y