Add support for Faraday RTC IP FTRTC
PATCH 1/1 Add support for Faraday RTC IP FTRTC
Dear Wolfgang Denk,
I am a newbie and I have not realized all the rules, so I have some questions.
Quoted 4 lines · you
Quoted 1 line
+static unsigned int rtc =
CONFIG_SYS_RTC_BASE;Please use a proper C structure to describe the RTC; do not use base address plus offsets.
Do you mean U-Boot prefers to use structure to describe registers? What if there were large gaps between registers?
For example, in our ethernet IP FTMAC100, there is nothing in 0x34 - 0x84, 0xa0 - 0xc0. Should I use structure to describe it?
I thought that placing a lot of paddings in a structure is ulgy. How do you think? Is there a guideline about this?
Also in drivers/rtc/pl031.c, the RTC_WRITE_REG and RTC_READ_REG use base + offset.
Quoted 2 lines
outl()is not portable across architectures?inl()is not portable across architectures?
Sorry I don't understand.
There are outl() and inl() in most architectures except blackfin, i386 and sparc. And the outl() and the inl() I use are arm ones.
Which macros should I use?
Quoted 3 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ debug("rtc_get(): record register: %x\n", inl(rtc + FTRTC_OFFSET_RECORD));Line too long.
Sorry, this is my fault. I will fix them.
Best Regards,
Po-Yu Chuang (???)
=== Faraday Technology Corporation, Headquarters TW === = ??????????
= Dept.: CTD/SD/SSD
= Tel : 886-3-578-7888 Ext:8818
= Fax : 886-3-666-3958
= Email: ratbert at faraday-tech.com
= WWW : www.faraday-tech.com
=======================================================
********************* Confidentiality Notice ************************ This electronic message and any attachments may contain confidential and legally privileged information or information which is otherwise protected from disclosure. If you are not the intended recipient,please do not disclose the contents, either in whole or in part, to anyone,and immediately delete the message and any attachments from your computer system and destroy all hard copies.
Thank you for your cooperation.
***********************************************************************
PATCH 1/1 Add support for Faraday RTC IP FTRTC
Hi Chuang,
Quoted 11 lines
I am a newbie and I have not realized all the rules, so I have some questions.
Quoted 4 lines · you
Quoted 1 line
+static unsigned int rtc =
CONFIG_SYS_RTC_BASE;Please use a proper C structure to describe the RTC; do not use base address plus offsets.
Do you mean U-Boot prefers to use structure to describe registers?
Yes, we prefer to have this, as we then also let the compiler do for example type checking.
Quoted 1 line
What if there were large gaps between registers?
Use dummy variables.
Quoted 3 lines
For example, in our ethernet IP FTMAC100, there is nothing in
0x34-0x84,0xa0-0xc0. Should I use structure to describe it?
Yes please, use for example u32 dummy1[20] for the first gap and u32 dummy2[8] for the second.
Quoted 2 lines
I thought that placing a lot of paddings in a structure is ulgy. How do you think? Is there a guideline about this?
We are our own guideline ;)
No, seriously, we try to use structures wherever possible as a means to get more information to the compiler. It also helps preventing stupid errors like having one incorrect offset in a list of 40 defines which are *very* hard to catch.
Quoted 6 lines
Also in
drivers/rtc/pl031.c, theRTC_WRITE_REGandRTC_READ_REGuse base + offset.Quoted 2 lines
outl()is not portable across architectures?inl()is not portable across architectures?
Quoted 6 lines
Sorry I don't understand.
There are
outl()andinl()in most architectures except blackfin, i386 and sparc. And theoutl()and theinl()I use are arm ones.Which macros should I use?
We should really use macros specifying the expected-byteorder, i.e. in_be32, or out_le32, and so on. Using these macros, we can write drivers even being agnostic on the cpu byte ordering if the device stays the same. (Ok, ok, outl also infers a byte-ordering, but we like more expliciteness).
Quoted 5 lines
Quoted 3 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ debug("rtc_get(): record register: %x\n", inl(rtc + FTRTC_OFFSET_RECORD));Line too long.
Sorry, this is my fault. I will fix them.
Thanks!
Detlev
Signature · 7 lines
I just found out that the brain is like a computer. If that's true, then there really aren't any stupid people. Just people running Windows. -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
PATCH 1/1 Add support for Faraday RTC IP FTRTC
Hi Detlev Zundel,
Thanks for your kindly help.
I will fix my code and submit again next time.
Thank you!
regards,
Po-Yu Chuang
2009/4/2 Detlev Zundel <[email protected]>:
Quoted 80 lines
Hi Chuang,
Quoted 11 lines
I am a newbie and I have not realized all the rules, so I have some questions.
Quoted 4 lines · you
Quoted 1 line
+static unsigned int ? ? ? rtc ? ? =
CONFIG_SYS_RTC_BASE;Please use a proper C structure to describe the RTC; do not use base address plus offsets.
Do you mean U-Boot prefers to use structure to describe registers?
Yes, we prefer to have this, as we then also let the compiler do for example type checking.
Quoted 1 line
What if there were large gaps between registers?
Use dummy variables.
Quoted 3 lines
For example, in our ethernet IP FTMAC100, ?there is nothing in
0x34-0x84,0xa0-0xc0. Should I use structure to describe it?Yes please, use for example u32 dummy1[20] for the first gap and u32 dummy2[8] for the second.
Quoted 2 lines
I thought that placing a lot of paddings in a structure is ulgy. How do you think? Is there a guideline about this?
We are our own guideline ;)
No, seriously, we try to use structures wherever possible as a means to get more information to the compiler. ?It also helps preventing stupid errors like having one incorrect offset in a list of 40 defines which are *very* hard to catch.
Quoted 6 lines
Also in
drivers/rtc/pl031.c, theRTC_WRITE_REGandRTC_READ_REGuse base + offset.Quoted 2 lines
outl()is not portable across architectures?inl()is not portable across architectures?Quoted 6 lines
Sorry I don't understand.
There are
outl()andinl()in most architectures except blackfin, i386 and sparc. And theoutl()and theinl()I use are arm ones.Which macros should I use?
We should really use macros specifying the expected-byteorder, i.e.
in_be32, orout_le32, and so on. ?Using these macros, we can write drivers even being agnostic on the cpu byte ordering if the device stays the same. ?(Ok, ok, outl also infers a byte-ordering, but we like more expliciteness).Quoted 5 lines
Quoted 3 lines
Quoted 1 line
+ ?debug("rtc_get(): record register: %x\n",
inl(rtc + FTRTC_OFFSET_RECORD));Line too long.
Sorry, this is my fault. I will fix them.
Thanks!
?Detlev--
I just found out that the brain is like a computer.
If that's true, then there really aren't any stupid people. Just people running Windows.
--
DENX Software Engineering GmbH, ? ? ?MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, ?Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot