[U-Boot] [Question] bardrate both in gd_t and bd_t

Simon Glass sjg at chromium.org
Thu Apr 3 22:08:36 CEST 2014


Hi,

On 3 April 2014 14:01, Tom Rini <trini at ti.com> wrote:

> On Wed, Apr 02, 2014 at 04:12:24PM +0900, Masahiro Yamada wrote:
> > Hi.
> >
> > I notice bardrate parameter bd_t as well as gd_t.
> >
> >
> > In include/asm-generic/global_data.h
> >
> > typedef struct global_data {
> >       bd_t *bd;
> >       unsigned long flags;
> >       unsigned int baudrate;
> >
> > We have "baudrate" here.
> >
> >
> >
> >
> > E.g. arch/arm/include/asm/u-boot.h
> >
> > typedef struct bd_info {
> >       unsigned int    bi_baudrate;    /* serial console baudrate */
> >
> > We have "bi_baudrate".
> >
> >
> >
> > My question is what's the difference
> > between gd->baudrate and bd->bi_baudrate.
> > Why do we need both?
> >
> > Since baudrate is a common paramter for all architectures,
> > bd->bi_baudrate looks weird to me.
>
> I think the answer is sadly just duplicated datastructures.  Simon do
> you recall why we didn't drop this duplication before?  Thanks!
>

The duplication existed before generic board (i.e. each arch had its own
baudrate in global_data). I believe the reason for it being in bd_t is that
it can be passed to the kernel in that structure on some archs. So removing
it there may break some boards.

I suspect the reason it is in global_data is that the bd_t  structure
doesn't exist until some time after the console is started up, so it
wouldn't be possible to do serial output otherwise.

Regards,
Simon


More information about the U-Boot mailing list