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 D70F1C0015E for ; Tue, 25 Jul 2023 22:03:37 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E437D8638E; Wed, 26 Jul 2023 00:03:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="AG0BoiPF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5157186777; Wed, 26 Jul 2023 00:03:34 +0200 (CEST) Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (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 7090984782 for ; Wed, 26 Jul 2023 00:03:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=nm@ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 36PM3S9E007592; Tue, 25 Jul 2023 17:03:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1690322608; bh=uE2Bs87d1ZKU5KK64ybG3xvAmiCueXNtJ9NdDCMtfvw=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=AG0BoiPFmBvzXVgk/zVBtf7PkARN9iYPM7JsTwy8EoOGMauRBTyyTDwjE6ra/yrWb zQseTW30B3Zivy+QJXzCfmdwHMB8cYNHZC6ZMfhf5rfXhMtWvU2QHECg/HW9hMPM/a Atm7jVmkxsKqq7hlPpKrPgZZzuoyXnadARr0zm8Y= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 36PM3SRu124644 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 25 Jul 2023 17:03:28 -0500 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 25 Jul 2023 17:03:28 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Tue, 25 Jul 2023 17:03:28 -0500 Received: from localhost (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 36PM3SJ3047566; Tue, 25 Jul 2023 17:03:28 -0500 Date: Tue, 25 Jul 2023 17:03:28 -0500 From: Nishanth Menon To: Tom Rini CC: Neha Malcom Francis , Bryan Brattlof , Praneeth Bajjuri , Andrew Davis , Robert Nelson , Vignesh R , Subject: Re: [PATCH 3/6] board: ti: am62x: Add basic initialization for usb voltage, 32k crystal, debounce Message-ID: <20230725220328.fruxsldln7o5geil@tassel> References: <20230725185253.2123433-1-nm@ti.com> <20230725185253.2123433-4-nm@ti.com> <20230725212504.GH3630934@bill-the-cat> <20230725213755.kc6qcvmkmt2yzzqz@perfected> <20230725214210.GL3630934@bill-the-cat> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20230725214210.GL3630934@bill-the-cat> X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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 17:42-20230725, Tom Rini wrote: > On Tue, Jul 25, 2023 at 04:37:55PM -0500, Nishanth Menon wrote: > > On 17:25-20230725, Tom Rini wrote: > > > On Tue, Jul 25, 2023 at 01:52:50PM -0500, Nishanth Menon wrote: > > [..] > > > > > > + /* Set USB0 PHY core voltage to 0.85V */ > > > > + val = readl(CTRLMMR_USB0_PHY_CTRL); > > > > + val &= ~(CORE_VOLTAGE); > > > > + writel(val, CTRLMMR_USB0_PHY_CTRL); > > > > + > > > > + /* Set USB1 PHY core voltage to 0.85V */ > > > > + val = readl(CTRLMMR_USB1_PHY_CTRL); > > > > + val &= ~(CORE_VOLTAGE); > > > > + writel(val, CTRLMMR_USB1_PHY_CTRL); > > > > + > > > > + /* We have 32k crystal, so lets enable it */ > > > > + val = readl(MCU_CTRL_LFXOSC_CTRL); > > > > + val &= ~(MCU_CTRL_LFXOSC_32K_DISABLE_VAL); > > > > + writel(val, MCU_CTRL_LFXOSC_CTRL); > > > > + /* Add any TRIM needed for the crystal here.. */ > > > > + /* Make sure to mux up to take the SoC 32k from the crystal */ > > > > + writel(MCU_CTRL_DEVICE_CLKOUT_LFOSC_SELECT_VAL, > > > > + MCU_CTRL_DEVICE_CLKOUT_32K_CTRL); > > > > + > > > > + /* Setup debounce conf registers - arbitrary values. Times are approx */ > > > > + /* 1.9ms debounce @ 32k */ > > > > + writel(WKUP_CTRLMMR_DBOUNCE_CFG1, 0x1); > > > > + /* 5ms debounce @ 32k */ > > > > + writel(WKUP_CTRLMMR_DBOUNCE_CFG2, 0x5); > > > > + /* 20ms debounce @ 32k */ > > > > + writel(WKUP_CTRLMMR_DBOUNCE_CFG3, 0x14); > > > > + /* 46ms debounce @ 32k */ > > > > + writel(WKUP_CTRLMMR_DBOUNCE_CFG4, 0x18); > > > > + /* 100ms debounce @ 32k */ > > > > + writel(WKUP_CTRLMMR_DBOUNCE_CFG5, 0x1c); > > > > + /* 156ms debounce @ 32k */ > > > > + writel(WKUP_CTRLMMR_DBOUNCE_CFG6, 0x1f); > > > > + > > > > video_setup(); > > > > enable_caches(); > > > > if (IS_ENABLED(CONFIG_SPL_SPLASH_SCREEN) && IS_ENABLED(CONFIG_SPL_BMP)) > > > > > > Here's a whole lot of seemingly board specific code in a function and > > > file that's supposed to support any am62 platform. Is this really what > > > we need, where we need it? > > > > * without using the correct voltage for USB, we risk damaging the IOs - > > board specific, sure. > > So what happens when we do this on the other EVM, does it have the same > values? Is there some must-always-be-safe values? Or is the answer "we > must do this board specific to be safe" and so need to re-think what can > and can't be shared between board builds. At least the ones we have currently (I am not sure about toradex, phytech etc), seem to operate the vdd_core at 0.85V .. (which is what USB is dependent upon). > > > * 32k - without using the external 32k, 32k rc-osc comes into play, > > which is accurate +-20% - board specific, sure > > OK.. > > > * Debounce configuration - I'd argue this is'nt board specific as it > > sets up different timing configurations that can be customized, but > > should be sufficient for the varied common usecases. > > So this is, or this can be re-worked to be always correct (or, correct > enough for the circumstances and limitations) values? correct enough for the known usage models (keys, card detects, hdmi hpd kind of stuff) > > > That said, i can drop this patch from the series, but I am curious how > > we'd handle this kind of stuff cleanly.. > > Well, we need to figure out how to handle this cleanly. Bit out of ideas at the moment, I should drop it from the next rev of the series? -- Regards, Nishanth Menon Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D