public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Nishanth Menon <nm@ti.com>
Cc: Neha Malcom Francis <n-francis@ti.com>,
	Bryan Brattlof <bb@ti.com>, Praneeth Bajjuri <praneeth@ti.com>,
	Andrew Davis <afd@ti.com>,
	Robert Nelson <robertcnelson@gmail.com>,
	Vignesh R <vigneshr@ti.com>,
	u-boot@lists.denx.de
Subject: Re: [PATCH 3/6] board: ti: am62x: Add basic initialization for usb voltage, 32k crystal, debounce
Date: Tue, 25 Jul 2023 17:25:04 -0400	[thread overview]
Message-ID: <20230725212504.GH3630934@bill-the-cat> (raw)
In-Reply-To: <20230725185253.2123433-4-nm@ti.com>

[-- Attachment #1: Type: text/plain, Size: 2749 bytes --]

On Tue, Jul 25, 2023 at 01:52:50PM -0500, Nishanth Menon wrote:

> Do the basic configuration required for setting up the USB core voltage
> configuration, setup to configure the 32k clock coming from 32k crystal
> and the debounce configurations for the various pins.
> 
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
>  board/ti/am62x/evm.c | 46 ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 46 insertions(+)
> 
> diff --git a/board/ti/am62x/evm.c b/board/ti/am62x/evm.c
> index ad939088402e..87b1fe0a2f44 100644
> --- a/board/ti/am62x/evm.c
> +++ b/board/ti/am62x/evm.c
> @@ -78,8 +78,54 @@ static int video_setup(void)
>  	return 0;
>  }
>  
> +#define CTRLMMR_USB0_PHY_CTRL	0x43004008
> +#define CTRLMMR_USB1_PHY_CTRL	0x43004018
> +#define CORE_VOLTAGE		0x80000000
> +
> +#define WKUP_CTRLMMR_DBOUNCE_CFG1 0x04504084
> +#define WKUP_CTRLMMR_DBOUNCE_CFG2 0x04504088
> +#define WKUP_CTRLMMR_DBOUNCE_CFG3 0x0450408c
> +#define WKUP_CTRLMMR_DBOUNCE_CFG4 0x04504090
> +#define WKUP_CTRLMMR_DBOUNCE_CFG5 0x04504094
> +#define WKUP_CTRLMMR_DBOUNCE_CFG6 0x04504098
> +
>  void spl_board_init(void)
>  {
> +	u32 val;
> +
> +	/* 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?

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2023-07-25 21:25 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-25 18:52 [PATCH 0/6] board: ti: Add support for BeaglePlay Nishanth Menon
2023-07-25 18:52 ` [PATCH 1/6] doc: board: ti: k3: Sort the boards in alphabetical order Nishanth Menon
2023-07-25 21:23   ` Tom Rini
2023-07-25 18:52 ` [PATCH 2/6] arm: dts: k3-am625-sk-binman: Add labels for unsigned binary Nishanth Menon
2023-07-25 21:23   ` Tom Rini
2023-07-25 18:52 ` [PATCH 3/6] board: ti: am62x: Add basic initialization for usb voltage, 32k crystal, debounce Nishanth Menon
2023-07-25 21:25   ` Tom Rini [this message]
2023-07-25 21:37     ` Nishanth Menon
2023-07-25 21:42       ` Tom Rini
2023-07-25 22:03         ` Nishanth Menon
2023-07-25 22:16           ` Francesco Dolcini
2023-07-25 22:35             ` Francesco Dolcini
2023-07-26 11:10               ` Nishanth Menon
2023-07-26 13:29                 ` Francesco Dolcini
2024-01-07 10:54                 ` Jan Kiszka
2023-07-25 18:52 ` [PATCH 4/6] arm: dts: Add k3-am625-beagleplay Nishanth Menon
2023-07-25 21:25   ` Tom Rini
2023-07-25 18:52 ` [PATCH 5/6] configs: Add am62x_beagleplay_* defconfigs Nishanth Menon
2023-07-25 18:52 ` [PATCH 6/6] doc: board: ti: Add beagleplay documentation Nishanth Menon
2023-07-25 21:35   ` Tom Rini
2023-07-25 22:00     ` Nishanth Menon
2023-07-25 22:45       ` Tom Rini
2023-07-26 14:59         ` Andrew Davis
2023-07-26 16:21           ` Tom Rini
2023-07-26 16:41             ` Andrew Davis
2023-07-26 16:49               ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230725212504.GH3630934@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=afd@ti.com \
    --cc=bb@ti.com \
    --cc=n-francis@ti.com \
    --cc=nm@ti.com \
    --cc=praneeth@ti.com \
    --cc=robertcnelson@gmail.com \
    --cc=u-boot@lists.denx.de \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox