public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] i.MX28: Fix ref_cpu clock setup
Date: Fri, 3 Feb 2012 15:09:03 +0100	[thread overview]
Message-ID: <201202031509.03620.marek.vasut@gmail.com> (raw)
In-Reply-To: <6EA3E0BCC03CC34B89B01BD57ECBC718F579C2@POBOX.postoffice.danego.net>

> > Awesome. So after reading your replies, let's just rename mx28_reg to
> > mx28_reg_32 and introduce mx28_reg_8 for this particular problem.
> 
> You were probably already foreseeing this when you made your
> suggestion to use accessors, but now I'm working it I see introducing
> mx28_reg_8 may get too messy. The 4 byte-parts (name, name_set,
> name_clr and name_tog) of one register-set (cpu) are interleaved with
> the next set (emi), like this:
>         uint8_t hw_clkctrl_frac0_cpu;
>         uint8_t hw_clkctrl_frac0_emi;
>         uint8_t hw_clkctrl_frac0_io1;
>         uint8_t hw_clkctrl_frac0_io0;
>         uint8_t hw_clkctrl_frac0_cpu_set;
>         uint8_t hw_clkctrl_frac0_emi_set;
>         uint8_t hw_clkctrl_frac0_io1_set;
>         uint8_t hw_clkctrl_frac0_io0_set;
>         uint8_t hw_clkctrl_frac0_cpu_clr;
>         uint8_t hw_clkctrl_frac0_emi_clr;
>         uint8_t hw_clkctrl_frac0_io1_clr;
>         uint8_t hw_clkctrl_frac0_io0_clr;
>         uint8_t hw_clkctrl_frac0_cpu_tog;
>         uint8_t hw_clkctrl_frac0_emi_tog;
>         uint8_t hw_clkctrl_frac0_io1_tog;
>         uint8_t hw_clkctrl_frac0_io0_tog;
> 
> So this won't work due to overlap:
> #define __mx28_reg_8(name)              \
>         uint8_t name;                   \
>         uint8_t name##_set;             \
>         uint8_t name##_clr;             \
>         uint8_t name##_tog;
> 
> Instead I'd have to drop the byte-part names (cpu, emi, io1 and io0)
> and replace them with more generic names like b0 and b1 for byte 0
> and 1, and declare them all at once, like this:
> #define __mx28_reg_8(name)              \
>         uint8_t name##_b0;              \
>         uint8_t name##_b1;              \
>         uint8_t name##_b2;              \
>         uint8_t name##_b3;              \
>         uint8_t name##_b0_set;          \
>         uint8_t name##_b1_set;          \
>         uint8_t name##_b2_set;          \
>         uint8_t name##_b3_set;          \
>         uint8_t name##_b0_clr;          \
>         uint8_t name##_b1_clr;          \
>         uint8_t name##_b2_clr;          \
>         uint8_t name##_b3_clr;          \
>         uint8_t name##_b0_tog;          \
>         uint8_t name##_b1_tog;          \
>         uint8_t name##_b2_tog;          \
>         uint8_t name##_b3_tog;
> Besides b0 and b1 being confusing in endianity context, it's not a
> pretty solution.

Make it an array?

M
> 
> I'm going to try a couple of different things now, to find the least-
> ugly solution if I can't find a pretty one.

  reply	other threads:[~2012-02-03 14:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <6EA3E0BCC03CC34B89B01BD57ECBC718F529B9@POBOX.postoffice.danego.net>
2012-02-02 16:58 ` [U-Boot] [PATCH 1/2] i.MX28: Fix ref_cpu clock setup Fabio Estevam
2012-02-02 17:09   ` Fabio Estevam
2012-02-02 17:21     ` Robert Deliën
2012-02-02 19:03       ` Fabio Estevam
2012-02-03 10:38         ` Robert Deliën
2012-02-03 10:32   ` Robert Deliën
2012-02-02 19:19 ` Marek Vasut
2012-02-03 10:42   ` Robert Deliën
2012-02-03 12:27     ` Marek Vasut
2012-02-03 14:00       ` Robert Deliën
2012-02-03 14:09         ` Marek Vasut [this message]
2012-02-03 14:18           ` Robert Deliën
2012-02-03 14:28             ` Marek Vasut
2012-02-03  7:23 ` Marek Vasut
2012-02-03 11:13   ` Robert Deliën

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=201202031509.03620.marek.vasut@gmail.com \
    --to=marek.vasut@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox