[U-Boot] [PATCH 1/2] arm/dcc: use static support to allow to use it at anytime
Wolfgang Denk
wd at denx.de
Sat May 2 21:26:50 CEST 2009
Dear Jean-Christophe PLAGNIOL-VILLARD,
In message <1241284125-5414-1-git-send-email-plagnioj at jcrosoft.com> you wrote:
> the dcc can be use at the start of the cpu
Can you please explain in a little more detail what exactly you are
doing here? Your short description
"use static support to allow to use it at anytime"
does not make any sense to me, and the next line "the dcc can be use
at the start of the cpu" does not help my understanding, either.
Sorry...
I don't even understand what "static support" means in this context.
> -#define read_core_id(x) do { \
> - __asm__ ("mrc p15, 0, %0, c0, c0, 0\n" : "=r" (x)); \
> - x = (x >> 4) & 0xFFF; \
> - } while (0);
> -
> +#if defined(CONFIG_CPU_V6)
> /*
> - * ARM9
> + * ARMV6
> */
> -#define write_arm9_dcc(x) \
> - __asm__ volatile ("mcr p14, 0, %0, c1, c0, 0\n" : : "r" (x))
> +#define DCC_RBIT (1 << 30)
> +#define DCC_WBIT (1 << 29)
>
> -#define read_arm9_dcc(x) \
> - __asm__ volatile ("mrc p14, 0, %0, c1, c0, 0\n" : "=r" (x))
This changes from "p15" (old) into "p14" (new). I guess this is
intentional?
> +#define can_write_dcc(x) do { \
> + status_dcc(x); \
> + x &= DCC_WBIT; \
> + x = (x == 0); \
> } while (0);
Indentation wrong (here and elsewhere).
> @@ -103,15 +84,6 @@ void serial_setbrg(void) {}
>
> int arm_dcc_init(void)
> {
> - register unsigned int id;
> -
> - read_core_id(id);
> -
> - if (id >= 0xb00)
> - arm_type = arm11_and_later;
> - else
> - arm_type = arm9_and_earlier;
> -
> return 0;
> }
If the function returns 0 unconditionally, we should delete the whole
function.
> @@ -120,22 +92,10 @@ int arm_dcc_getc(void)
> int ch;
> register unsigned int reg;
>
> - switch (arm_type) {
> - case arm11_and_later:
> - do {
> - can_read_arm11_dcc(reg);
> - } while (!reg);
> - read_arm11_dcc(ch);
> - break;
> -
> - case arm9_and_earlier:
> - default:
> - do {
> - can_read_arm9_dcc(reg);
> - } while (!reg);
> - read_arm9_dcc(ch);
> - break;
> - }
> + do {
> + can_read_dcc(reg);
> + } while (!reg);
> + read_dcc(ch);
No timeout here? Is there a risk that this might permanently hang the
system?
> + while (--timeout_count) {
> + can_write_dcc(reg);
> + if (reg)
> + break;
> }
> + if (timeout_count == 0)
> + return;
> + else
> + write_dcc(ch);
> }
No error messages in case of timeout?
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The universe contains any amount of horrible ways to be woken up,
such as the noise of the mob breaking down the front door, the scream
of fire engines, or the realization that today is the Monday which on
Friday night was a comfortably long way off.
- Terry Pratchett, _Moving Pictures_
More information about the U-Boot
mailing list