All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hyungwon Hwang <human.hwang@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 3/4] odroid: make some macros common
Date: Tue, 04 Nov 2014 10:49:57 +0900	[thread overview]
Message-ID: <20141104104957.379a37e5@hwh-linux> (raw)
In-Reply-To: <20141103095125.37aa0791@amdc2363>

On Mon, 03 Nov 2014 09:51:25 +0100
Lukasz Majewski <l.majewski@samsung.com> wrote:

> Hi Hyungwon,
> 
> > Some macros are used commonly for odroid series boards. This patch
> > makes a common header file to congregate that kinds of macros. Even
> > though there are more macros which can be common, they are not become
> > common. Because they are a part of a register, the readability is
> > better when they are defined at a place.
> > 
> > Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
> > ---
> >  board/samsung/odroid/odroid.c | 1 +
> >  board/samsung/odroid/setup.h  | 8 --------
> >  2 files changed, 1 insertion(+), 8 deletions(-)
> > 
> 
> I suspect that you have not added the new file to git repository - since
> you only removed lines from board/samsung/odroid/setup.h
> 
> I also guess that odroid U3 will not build anymore. That is a very good
> use case for buildman script.

Oh. It is my mistake. I will include the common header in next version.

> 
> > diff --git a/board/samsung/odroid/odroid.c
> > b/board/samsung/odroid/odroid.c index 5edb250..ccbb3a0 100644
> > --- a/board/samsung/odroid/odroid.c
> > +++ b/board/samsung/odroid/odroid.c
> > @@ -18,6 +18,7 @@
> >  #include <usb.h>
> >  #include <usb/s3c_udc.h>
> >  #include <samsung/misc.h>
> > +#include "../setup.h"
> 
> Relative path is not a good idea IMHO.
> 
> It would be better to place it at ./include/samsung/ with a self
> explanatory name (like exynos4-pll.h or/and exynos4-{other excluded
> defines for an IP blocks}).
> 
> In this way other boards could use those defines too.

I think that your idea is better than mine.

> 
> >  #include "setup.h"
> >  
> >  DECLARE_GLOBAL_DATA_PTR;
> > diff --git a/board/samsung/odroid/setup.h
> > b/board/samsung/odroid/setup.h index 3e48dad..35f7af5 100644
> > --- a/board/samsung/odroid/setup.h
> > +++ b/board/samsung/odroid/setup.h
> > @@ -8,14 +8,6 @@
> >  #ifndef __ODROIDU3_SETUP__
> >  #define __ODROIDU3_SETUP__
> >  
> > -/* A/M PLL_CON0 */
> > -#define SDIV(x)                 ((x) & 0x7)
> > -#define PDIV(x)                 (((x) & 0x3f) << 8)
> > -#define MDIV(x)                 (((x) & 0x3ff) << 16)
> > -#define FSEL(x)                 (((x) & 0x1) << 27)
> > -#define PLL_LOCKED_BIT          (0x1 << 29)
> > -#define PLL_ENABLE(x)           (((x) & 0x1) << 31)
> > -
> 
> The above data is common for Exynos U3 and XU3, but is it the only one?
> Aren't there any more defines to be extracted?
> 
> >  /* CLK_SRC_CPU */
> >  #define MUX_APLL_SEL(x)         ((x) & 0x1)
> >  #define MUX_CORE_SEL(x)         (((x) & 0x1) << 16)
> 
> 
> 

You're right. I found some other common macros more now. I will reflect it in
next version. But I have a doubt about MUX_APLL_SEL or something
else which consist of a register with different macros in
different processors. They can be extracted to common file. But is it good to
do it? For example, MUX_APLL_SEL exists both in Exynos4 and Exynos5's
CLK_SRC_CPU.

Exynos 4412
/* CLK_SRC_CPU */
#define MUX_APLL_SEL(x)		((x) & 0x1)
#define MUX_CORE_SEL(x)		(((x) & 0x1) << 16)

Exynos 5800
/* CLK_SRC_CPU */
#define MUX_APLL_SEL(x)         ((x) & 0x1)
#define MUX_CORE_SEL(x)         (((x) & 0x1)
#define MUX_HPM_SEL(x)          (((x) & 0x1) << 20)
#define MUX_MPLL_USER_SEL_C(x)  (((x) & 0x1) << 24)

If MUX_APLL_SEL and MUX_CORE_SEL are extracted to the common file, it will be
harder to see what consist of CLK_SRC_CPU at a glance. Isn't it? This situation
is worse in the case of APLL_RATIO. (Please see the below.) I want to hear your
opinion about it.

Exynos 4412
/* CLK_DIV_CPU0 */
#define ARM_RATIO(x)           ((x) & 0x7)
#define CPUD_RATIO(x)         (((x) & 0x7) << 4)
#define ATB_RATIO(x)         (((x) & 0x7) << 16)
#define PCLK_DBG_RATIO(x)       (((x) & 0x7) << 20)
#define APLL_RATIO(x)           (((x) & 0x7) << 24)
#define ARM2_RATIO(x)         (((x) & 0x7) << 28)

Exynos 5800
/* CLK_DIV_CPU0 */
#define CORE_RATIO(x)           ((x) & 0x7)
#define COREM0_RATIO(x)         (((x) & 0x7) << 4)
#define COREM1_RATIO(x)         (((x) & 0x7) << 8)
#define PERIPH_RATIO(x)         (((x) & 0x7) << 12)
#define ATB_RATIO(x)            (((x) & 0x7) << 16)
#define PCLK_DBG_RATIO(x)       (((x) & 0x7) << 20)
#define APLL_RATIO(x)           (((x) & 0x7) << 24)
#define CORE2_RATIO(x)          (((x) & 0x7) << 28)

Thanks.

Best regards,
Hyungwon Hwang

-- 
Hyungwon Hwang
S/W Platform Team, Software Center
Samsung Electronics
human.hwang@samsung.com

  reply	other threads:[~2014-11-04  1:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-31 12:14 [U-Boot] [PATCH v2 0/4] Adds support for Exynos5422 odroid xu3 board Hyungwon Hwang
2014-10-31 12:14 ` [U-Boot] [PATCH v2 1/4] exynos5: fix GPIO information of exynos5420 Hyungwon Hwang
2014-10-31 12:14 ` [U-Boot] [PATCH v2 2/4] Exynos5800: Add support for Exynos5800 Hyungwon Hwang
2014-11-03  8:34   ` Lukasz Majewski
2014-11-04  1:26     ` Hyungwon Hwang
2014-10-31 12:14 ` [U-Boot] [PATCH v2 3/4] odroid: make some macros common Hyungwon Hwang
2014-11-03  8:51   ` Lukasz Majewski
2014-11-04  1:49     ` Hyungwon Hwang [this message]
2014-11-04  8:29       ` Lukasz Majewski
2014-11-04 10:56         ` Minkyu Kang
2014-10-31 12:14 ` [U-Boot] [PATCH v2 4/4] Odroid-XU3: Add support for Odroid-XU3 Hyungwon Hwang
2014-11-03  9:09   ` Lukasz Majewski
2014-11-04  5:07 ` [U-Boot] [PATCH v2 0/4] Adds support for Exynos5422 odroid xu3 board Jaehoon Chung

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=20141104104957.379a37e5@hwh-linux \
    --to=human.hwang@samsung.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.