public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v9 1/2] Odroid-XU3: Add support for Odroid-XU3
Date: Fri, 28 Nov 2014 09:14:31 +0100	[thread overview]
Message-ID: <1417162471.4422.9.camel@collabora.co.uk> (raw)
In-Reply-To: <20141128111325.20dbc729@hwh-ubuntu>

On Fri, 2014-11-28 at 11:13 +0900, Hyungwon Hwang wrote:
> On Thu, 27 Nov 2014 22:45:18 +0100
> Sjoerd Simons <sjoerd.simons@collabora.co.uk> wrote:
> 
> > On Thu, 2014-11-27 at 22:21 +0900, Hyungwon Hwang wrote:
> > > This patch adds support for Odroid-XU3.
> > 
> > I can't seem to access the EMMC with this patch, is that expected?
> > 
> 
> Yes. EMMC is not supported yet. Actually even I did not test whether it
> works or not. EMMC support will be done soon.
> 
> > 
> > > --- /dev/null
> > > +++ b/board/samsung/odroid-xu3/Kconfig
> > > @@ -0,0 +1,12 @@
> > > +if TARGET_ODROID_XU3
> > > +
> > > +config SYS_BOARD
> > > +	default "odroid-xu3"
> > > +
> > > +config SYS_VENDOR
> > > +	default "samsung"
> > > +
> > > +config SYS_CONFIG_NAME
> > > +	default "odroid_xu3"
> > > +
> > > +endif
> > 
> > I was studying the different between the peach-pi and the XU3 hardware
> > enablement a bit. I was wondering whta's the rationale for the XU3
> > having it's own board file and reconfiguring various clocks? Does the
> > hardkernel SPL/bl2 not setup things correctly?
> > 
> 
> Hmm. It is my first time to make codes to add support for new board, and
> I am not sure what is right. Is it needless to set clocks for the cases
> when SPL/BL2 is expected to set clocks already?

That is my impresssion indeed. If you look at the enablement for the
SMDK5420 board and the peach pi/pit boards they don't do any setup of
these clocks, the only time that's done is in
exynos5420_system_clock_init (from clock_init_exynos5.c) which only gets
executed on SPL builds. 

I did a quick test changing SYS_BOARD to smdk5420 and that worked
without any problems. So in principle you should be able to drop the
odroid-xu3 board directory and simply add your Kconfig snippet to
board/samsung/smdk5420/Kconfig as is done for the Peach boards

> > > diff --git a/board/samsung/odroid-xu3/odroid-xu3.c
> > > b/board/samsung/odroid-xu3/odroid-xu3.c new file mode 100644
> > > index 0000000..8c54842
> > > --- /dev/null
> > > +++ b/board/samsung/odroid-xu3/odroid-xu3.c
> > > @@ -0,0 +1,122 @@
> > > +/*
> > > + * Copyright (C) 2014 Samsung Electronics
> > > + * Hyungwon Hwang <human.hwang@samsung.com>
> > > + *
> > > + * SPDX-License-Identifier:	GPL-2.0+
> > > + */
> > > +
> > > +#include <common.h>
> > > +#include <asm/arch/clock.h>
> > > +#include "setup.h"
> > > +
> > > +DECLARE_GLOBAL_DATA_PTR;
> > > +
> > > +unsigned int get_board_rev(void)
> > > +{
> > > +	return 0;
> > > +}
> > > +
> > > +int exynos_init(void)
> > > +{
> > > +	return 0;
> > > +}
> > > +
> > > +#ifdef CONFIG_BOARD_EARLY_INIT_F
> > > +static int board_clock_init(void)
> > > +{
> > > +	unsigned int set, clr, clr_src_cpu, clr_pll_con0;
> > > +	struct exynos5420_clock *clk = (struct exynos5420_clock *)
> > > +
> > > samsung_get_base_clock();
> > > +	/*
> > > +	 * CMU_CPU clocks src to MPLL
> > > +	 * Bit values:                 0  ; 1
> > > +	 * MUX_APLL_SEL:        FIN_PLL   ; FOUT_APLL
> > > +	 * MUX_CORE_SEL:        MOUT_APLL ; SCLK_MPLL
> > > +	 * MUX_HPM_SEL:         MOUT_APLL ; SCLK_MPLL_USER_C
> > > +	 * MUX_MPLL_USER_SEL_C: FIN_PLL   ; SCLK_MPLL
> > > +	*/
> > > +
> > > +	/* Set CMU_CPU clocks src to OSCCLK */
> > > +	clr_src_cpu = MUX_APLL_SEL(1) | MUX_CORE_SEL(1);
> > > +	set = MUX_APLL_SEL(0) | MUX_CORE_SEL(1);
> > > +
> > > +	clrsetbits_le32(&clk->src_cpu, clr_src_cpu, set);
> > > +
> > > +	while (MUX_STAT_CPU_CHANGING(readl(&clk->mux_stat_cpu)))
> > > +		continue;
> > > +
> > > +	/* Set APLL to 1200MHz */
> > > +	clr_pll_con0 = SDIV(7) | PDIV(63) | MDIV(1023) | FSEL(1) |
> > > +			PLL_ENABLE(1);
> > > +	set = SDIV(0) | PDIV(2) | MDIV(100) | PLL_ENABLE(1);
> > > +
> > > +	clrsetbits_le32(&clk->apll_con0, clr_pll_con0, set);
> > > +
> > > +	while (!(readl(&clk->apll_con0) & PLL_LOCKED_BIT))
> > > +		continue;
> > > +
> > > +	/* Set CMU_CPU clocks src to APLL */
> > > +	set = MUX_APLL_SEL(1) | MUX_CORE_SEL(0);
> > > +	clrsetbits_le32(&clk->src_cpu, clr_src_cpu, set);
> > > +
> > > +	while (MUX_STAT_CPU_CHANGING(readl(&clk->mux_stat_cpu)))
> > > +		continue;
> > > +
> > > +	clr = ARM_RATIO(7) | CPUD_RATIO(7) | ATB_RATIO(7) |
> > > +	      PCLK_DBG_RATIO(7) | APLL_RATIO(7) | ARM2_RATIO(7);
> > > +	set = ARM_RATIO(0) | CPUD_RATIO(2) | ATB_RATIO(5) |
> > > +	      PCLK_DBG_RATIO(5) | APLL_RATIO(0) | ARM2_RATIO(0);
> > > +
> > > +	clrsetbits_le32(&clk->div_cpu0, clr, set);
> > > +
> > > +	while (readl(&clk->div_stat_cpu0) & DIV_STAT_CPU0_CHANGING)
> > > +		continue;
> > > +
> > > +	/* Set MPLL to 800MHz */
> > > +	set = SDIV(1) | PDIV(3) | MDIV(200) | PLL_ENABLE(1);
> > > +
> > > +	clrsetbits_le32(&clk->mpll_con0, clr_pll_con0, set);
> > > +
> > > +	while (!(readl(&clk->mpll_con0) & PLL_LOCKED_BIT))
> > > +		continue;
> > > +
> > > +	/* Set CLKMUX_UART src to MPLL */
> > > +	clr = UART0_SEL(7) | UART1_SEL(7) | UART2_SEL(7) |
> > > UART3_SEL(7);
> > > +	set = UART0_SEL(3) | UART1_SEL(3) | UART2_SEL(3) |
> > > UART3_SEL(3); +
> > > +	clrsetbits_le32(&clk->src_peric0, clr, set);
> > > +
> > > +	/* Set SCLK_UART to 400 MHz (MPLL / 2) */
> > > +	clr = UART0_RATIO(15) | UART1_RATIO(15) | UART2_RATIO(15) |
> > > +	      UART3_RATIO(15);
> > > +	set = UART0_RATIO(1) | UART1_RATIO(1) | UART2_RATIO(1) |
> > > +	      UART3_RATIO(1);
> > > +
> > > +	clrsetbits_le32(&clk->div_peric0, clr, set);
> > > +
> > > +	while (readl(&clk->div_stat_peric0) &
> > > DIV_STAT_PERIC0_CHANGING)
> > > +		continue;
> > > +
> > > +	/* Set CLKMUX_MMC src to MPLL */
> > > +	clr = MUX_MMC0_SEL(7) | MUX_MMC1_SEL(7) | MUX_MMC2_SEL(7);
> > > +	set = MUX_MMC0_SEL(3) | MUX_MMC1_SEL(3) | MUX_MMC2_SEL(3);
> > > +
> > > +	clrsetbits_le32(&clk->src_fsys, clr, set);
> > > +
> > > +	clr = MMC0_RATIO(0x3ff) | MMC1_RATIO(0x3ff) |
> > > MMC2_RATIO(0x3ff);
> > > +	set = MMC0_RATIO(0) | MMC1_RATIO(0) | MMC2_RATIO(0);
> > > +
> > > +	clrsetbits_le32(&clk->div_fsys1, clr, set);
> > > +
> > > +	/* Wait for divider ready status */
> > > +	while (readl(&clk->div_stat_fsys1) &
> > > DIV_STAT_FSYS1_CHANGING)
> > > +		continue;
> > > +
> > > +	return 0;
> > > +}
> > > +
> > > +int exynos_early_init_f(void)
> > > +{
> > > +	return board_clock_init();
> > > +}
> > > +#endif
> > 
> > 
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6170 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141128/b71ffda8/attachment.bin>

  reply	other threads:[~2014-11-28  8:14 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-27 13:21 [U-Boot] [PATCH v9 0/3] Adds support for Exynos5422 odroid xu3 board Hyungwon Hwang
2014-11-27 13:21 ` [U-Boot] [PATCH v9 1/2] Odroid-XU3: Add support for Odroid-XU3 Hyungwon Hwang
2014-11-27 15:16   ` Jaehoon Chung
2014-11-28  1:44     ` Hyungwon Hwang
2014-11-27 16:35   ` Sjoerd Simons
2014-11-28  5:00     ` Hyungwon Hwang
2014-11-28  7:44       ` Sjoerd Simons
2014-11-27 21:45   ` Sjoerd Simons
2014-11-28  2:13     ` Hyungwon Hwang
2014-11-28  8:14       ` Sjoerd Simons [this message]
2014-11-28  8:54       ` Jaehoon Chung
2014-12-03 11:34         ` Sjoerd Simons
2014-12-01 17:30   ` Simon Glass
2014-12-02  1:38     ` Hyungwon Hwang
2014-11-27 13:21 ` [U-Boot] [PATCH v9 2/2] Odroid-XU3: Add documentation " Hyungwon Hwang
2014-11-27 14:33   ` Sjoerd Simons
2014-11-28  4:45     ` Hyungwon Hwang
2014-11-28  8:00       ` Sjoerd Simons
2014-11-28  8:39         ` Lukasz Majewski
2014-11-28 10:19           ` Sjoerd Simons
2014-11-28 12:47             ` Lukasz Majewski
2014-11-28 13:31               ` Sjoerd Simons
2014-11-28 11:44           ` Javier Martinez Canillas
2014-11-28 13:46             ` Lukasz Majewski
2014-11-28 15:06               ` Sjoerd Simons
2014-11-29 17:12                 ` Lukasz Majewski
2014-12-01 22:30               ` Simon Glass
2014-12-02 22:29                 ` Lukasz Majewski
2014-12-02 23:26                   ` Suriyan Ramasami
2014-12-08 17:58                   ` Kevin Hilman
2014-12-08 22:31                     ` Simon Glass
2014-12-09  1:27                       ` Kevin Hilman
2014-12-09 13:15                         ` Simon Glass
2014-12-10  0:03                           ` Kevin Hilman
2014-12-10  0:11                             ` Simon Glass
2014-12-10 19:20                               ` Kevin Hilman
2014-12-11  1:13                                 ` Hyungwon Hwang
2014-12-09 10:05                     ` Lukasz Majewski
2014-11-27 15:20   ` Jaehoon Chung
2014-12-01 12:34 ` [U-Boot] [PATCH 0/4] Odroid XU3 support additions Sjoerd Simons
2014-12-01 12:34   ` [U-Boot] [PATCH 1/4] Odroid-XU3: Drop redundant fields Sjoerd Simons
2014-12-01 12:34   ` [U-Boot] [PATCH 2/4] Odroid-XU3: Add entry for DTS EHCI GPIO Sjoerd Simons
2014-12-01 12:34   ` [U-Boot] [PATCH 3/4] ODROID-XU3: Make odroid-xu3 an smdk5420 variant Sjoerd Simons
2014-12-01 12:34   ` [U-Boot] [PATCH 4/4] ODROID-XU3: drop overriding the boot environment Sjoerd Simons
2014-12-02  1:56   ` [U-Boot] [PATCH 0/4] Odroid XU3 support additions Hyungwon Hwang
2015-01-07  8:31     ` Joonyoung Shim
2015-01-07  9:25       ` Sjoerd Simons
2015-01-07 11:49         ` Joonyoung Shim

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=1417162471.4422.9.camel@collabora.co.uk \
    --to=sjoerd.simons@collabora.co.uk \
    --cc=u-boot@lists.denx.de \
    /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