Skip to contentSkip to conversation

bardrate both in gd_t and bd_t

U-Boot Masahiro Yamada 4 participants 7 messages Apr 2, 2014 – Apr 4, 2014

lore
Share & tools
lore
#0 lore raw

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.

Best Regards
Masahiro Yamada

#1 lore raw
Quoted 26 lines · Masahiro Yamada

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".

Quoted 6 lines

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!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140403/67126e53/attachment.pgp>
#2 lore raw

Hi,

Quoted 31 lines · Tom Rini
Quoted 30 lines · Masahiro Yamada

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?

Quoted 6 lines
Quoted 2 lines

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

#3 lore raw

Dear Simon,

Quoted 5 lines · In message <CAPnjgZ2PrHue3hTW__MaYBRMA3OFZ3p1k9D49rZatur9G5x--g@mail.gmail.com>…

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.

Correct. In some (really old) kernel versions this was the way to pass this information to the kernel, so we neede dit there.

Quoted 3 lines

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.

Also correct.

Thanks!

Wolfgang Denk

Signature · 5 lines
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
Always borrow money from a pessimist; they don't expect  to  be  paid
back.
#4 lore raw

Hi Simon, Wolfgang,

Quoted 9 lines · On Thu, 03 Apr 2014 23:51:35 +0200 Wolfgang Denk <[email protected]> wrote:

Dear Simon,

Quoted 5 lines · In message <CAPnjgZ2PrHue3hTW__MaYBRMA3OFZ3p1k9D49rZatur9G5x--g@mail.gmail.com>…

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.

Quoted 9 lines

Correct. In some (really old) kernel versions this was the way to pass this information to the kernel, so we neede dit there.

Quoted 3 lines

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.

Also correct.

Thanks.
Sadly, it looks like we should keep both of the two.

Best Regards
Masahiro Yamada

#5 lore raw

Dear Masahiro,

Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 8 lines

Correct. In some (really old) kernel versions this was the way to pass this information to the kernel, so we neede dit there.

Quoted 3 lines

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.

Quoted 5 lines
Quoted 2 lines

Also correct.

Thanks.
Sadly, it looks like we should keep both of the two.

I'm not so sure. As mentioned, this was used in really old kernel versions only. I remember it for the Power archtecture, where only the pre-devicetree kernel versions (i. e. 2.4.x) used this. OK, I know of a number of projeects which are still using such old kernbel versions, but these are also using ancient U-Boot versions.

I don't think we have to keep support for ancient kernels in current U-Boot. Eventually we may drop it.

Best regards,

Wolfgang Denk

Signature · 4 lines
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
"Why should we subsidize intellectual curiosity?" - Ronald Reagan
#6 lore raw

Hi Wolfgang,

Quoted 17 lines · On Fri, 04 Apr 2014 11:22:17 +0200 Wolfgang Denk <[email protected]> wrote:

Dear Masahiro,

Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 8 lines

Correct. In some (really old) kernel versions this was the way to pass this information to the kernel, so we neede dit there.

Quoted 3 lines

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.

Quoted 5 lines
Quoted 2 lines

Also correct.

Thanks.
Sadly, it looks like we should keep both of the two.

Quoted 8 lines

I'm not so sure. As mentioned, this was used in really old kernel versions only. I remember it for the Power archtecture, where only the pre-devicetree kernel versions (i. e. 2.4.x) used this. OK, I know of a number of projeects which are still using such old kernbel versions, but these are also using ancient U-Boot versions.

I don't think we have to keep support for ancient kernels in current U-Boot. Eventually we may drop it.

As a matter of fact, I had prepared a patch when I got replies from you guys.
I've post it as RFC, just in case.
(I confirmed no boards broken at least build test.)

I am not sure if it can be dropped either.
Anyway, I follow Tom's decesion.

Best Regards
Masahiro Yamada