Skip to contentSkip to conversation

Add support for ATMEL AT91SAM9G20EK board

PATCH New Hong Xu 6 participants 19 messages Jul 24, 2008 – Jul 28, 2008 1 message not in the archive

lore
Share & tools
lore

Hong Xu

author
#0 lore raw

PATCH 1/1 Add support for ATMEL AT91SAM9G20EK board

#1 lore raw

PATCH 1/1 Add support for ATMEL AT91SAM9G20EK board

drivers/net/macb.c static int macb_init(struct eth_device *netdev, bd_t *bd) · line 418

Quoted 10 lines · Hong Xu
drivers/net/macb.c +1 -1
index aa39284..c3dcce6 100644
@@ -415,14 +415,14 @@ static int macb_init(struct eth_device *netdev, bd_t *bd)
 	/* choose RMII or MII mode. This depends on the board */
 #ifdef CONFIG_RMII
 #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263)
+    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)

Hmm...I don't really like the direction this is going. Any chance you could have all AT91 boards define CONFIG_AT91 and check for that instead?

Alternatively, we could do it the other way around and test for CONFIG_AVR32 instead, since all AVR32 boards already define that.

In either case, this should probably be a separate cleanup; I don't have any objections to your patch.

Haavard

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

[U-Boot-Users] ??: [PATCH 1/1] Add support for ATMEL AT91SAM9G20EK board

Please don't drop the list from Cc.

Quoted 2 lines · Hong

AT91SAM9261EK board uses DM9000 Ethernet Controller, no MACB. AT91SAM9RLEK board doesn't have Ethernet interface.

What does that have to do with anything?

Haavard

#4 lore raw

PATCH 1/1 Add support for ATMEL AT91SAM9G20EK board

In reply to Hong Xu
Quoted 13 lines · Hong Xu
Quoted 1 line

From 81230b02610c06fdc8a175e635851346488e3bdb Mon Sep 17 00:00:00 2001

From: Hong Xu <[email protected]>
Date: Thu, 24 Jul 2008 14:25:05 +0800
Subject: [PATCH 1/1] Add support for ATMEL AT91SAM9G20EK board

This patch adds support for ATMEL AT91SAM9G20EK board. User manual for AT91SAM9G20EK board, see
http://www.atmel.com/dyn/resources/prod_documents/doc6413.pdf
AT91 SAM9G20 datasheet, see
http://www.atmel.com/dyn/resources/prod_documents/doc6384.pdf

Quoted 14 lines
---
 Makefile                                  |    3 +
 board/atmel/at91sam9g20ek/Makefile        |   57 +++++++
 board/atmel/at91sam9g20ek/at91sam9g20ek.c |  250 +++++++++++++++++++++++++++++
 board/atmel/at91sam9g20ek/config.mk       |    1 +
 board/atmel/at91sam9g20ek/led.c           |   64 ++++++++
 board/atmel/at91sam9g20ek/nand.c          |   79 +++++++++
 board/atmel/at91sam9g20ek/partition.c     |   40 +++++
 drivers/net/macb.c                        |    4 +-
 include/asm-arm/arch-at91sam9/hardware.h  |    2 +-
 include/configs/at91sam9g20ek.h           |  202 +++++++++++++++++++++++
 include/asm-arm/arch-at91sam9/hardware.h  |    2 +-
 include/configs/at91sam9g20ek.h           |  202 +++++++++++++++++++++++
 net/eth.c                                 |    2 +-

Please rebase your code on the branch for-1.3.5 of the u-boot-at91 tree.

Quoted 32 lines
drivers/net/macb.c +2 -2
@@ -415,14 +415,14 @@ static int macb_init(struct eth_device *netdev, bd_t *bd)
      /* choose RMII or MII mode. This depends on the board */
 #ifdef CONFIG_RMII
 #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263)
+    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
      macb_writel(macb, USRIO, MACB_BIT(RMII) | MACB_BIT(CLKEN));
 #else
      macb_writel(macb, USRIO, 0);
 #endif
 #else
 #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263)
+    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
      macb_writel(macb, USRIO, MACB_BIT(CLKEN));
 #else
      macb_writel(macb, USRIO, MACB_BIT(MII));
net/eth.c +1 -1
index 38979aa..3f50e2b 100644
@@ -287,7 +287,7 @@ int eth_initialize(bd_t *bis)
      mcdmafec_initialize(bis);
 #endif
 #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263)
+    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
      at91sam9_eth_initialize(bis);
 #endif
      at91sam9_eth_initialize(bis);
Quoted 2 lines

#endif

Same comment as Haavard,
Could please create a CONFIG_SOMETHING for each of this tree block of ifdef (not neccessarely the same CONFIG)

Best Regards,
J.

#5 lore raw

PATCH 1/1 Add support for ATMELAT91SAM9G20EK board

Quoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD

Review

Quoted 9 lines
      /* choose RMII or MII mode. This depends on the board */

#ifdef CONFIG_RMII
#if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \

(quoted diff) +1 -1
-    defined(CONFIG_AT91SAM9263)
+    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
      macb_writel(macb, USRIO, MACB_BIT(RMII) | MACB_BIT(CLKEN));
 #else
      macb_writel(macb, USRIO, 0);
 #endif
Quoted 3 lines

Same comment as Haavard,
Could please create a CONFIG_SOMETHING for each of this tree block of ifdef (not necessarily the same CONFIG)

What do you suggest for <SOMETHING> in CONFIG_SOMETHING? Surely you aren't suggesting a literal "CONFIG_SOMETHING".

The fact that you didn't easily define a meaningful <SOMETHING> suggests that there isn't one that is sufficiently meaningful and that perhaps the #if condition as written above should remain as is. Code should be written for readability, not for terseness alone. Do we have to define yet another preprocessor constant for yet another purpose? U-Boot already has too many preprocessor constants and the addition of another (perhaps) dubious one merits more debate.

Sincerely,

Ken Fuchs

#6 lore raw

PATCH 1/1 Add support for ATMELAT91SAM9G20EK board

Quoted 3 lines · On Thu, 24 Jul 2008 13:14:02 -0500 <[email protected]> wrote:

U-Boot already has too many
preprocessor constants and the addition of another (perhaps) dubious one merits more debate.

I don't completely agree. U-Boot has too many #ifdefs, which isn't necessarily the same as too many #defines. And I don't think CONFIG_AT91 is dubious at all.

But since we already have a CONFIG_AVR32 #define, we can clean up the mess in macb.c by simply reversing the logic.

Haavard

#7 lore raw

PATCH 1/1 Add support for ATMELAT91SAM9G20EK board

Quoted 5 lines
Quoted 3 lines · <[email protected]> wrote:

U-Boot already has too many
preprocessor constants and the addition of another (perhaps) dubious one merits more debate.

You omitted the context of this statement and hence most of its meaning.

Quoted 3 lines · Haavard Skinnemoen

I don't completely agree. U-Boot has too many #ifdefs, which isn't necessarily the same as too many #defines. And I don't think CONFIG_AT91 is dubious at all.

Perhaps the CONFIG_* symbols should be defined as TRUE or FALSE rather than defined or not defined.

I didn't say CONFIG_AT91 was dubious. I stated that defining CONFIG_<SOMETHING> where it isn't clear what <SOMETHING> should be is dubious. If one has to think too hard about what meaningful phrase <SOMETHING> should be, perhaps CONFIG_<SOMETHING> should not be defined at all. I'm complaining about defining new preprocessor definitions to be specific aggregations of other definitions just so a developer can type the conditions with fewer keystrokes without any improvement in code readability and maintainability. Sometimes an idiom should be left as an idiom rather than replaced by a preprocessor constant.

I have nothing against defining CONFIG_AT91 if it is useful, unique and makes code that uses it easier to understand and maintain.

Quoted 2 lines

But since we already have a CONFIG_AVR32 #define, we can clean up the mess in macb.c by simply reversing the logic.

If CONFIG_AVR32 can be used in macb.c without ofuscation, why is CONFIG_AT91 needed here? However, "simply reversing the logic" may be too much ofuscation though; we want clear rather than clever code after all.

An example of what I'd be opposed to is defining CONFIG_AT91SAM9260_OR_AT91SAM9263 where it is TRUE if either CONFIG_AT91SAM9260 or CONFIG_AT91SAM9263 are TRUE. Can you see where this might be used in the macb.c code?

Sincerely,

Ken Fuchs

#8 lore raw

PATCH 1/1 Add support for ATMELAT91SAM9G20EKboard

Quoted 42 lines
Quoted 7 lines
Quoted 3 lines · <[email protected]> wrote:

U-Boot already has too many
preprocessor constants and the addition of another (perhaps) dubious one merits more debate.

You omitted the context of this statement and hence most of its meaning.

Quoted 3 lines · Haavard Skinnemoen

I don't completely agree. U-Boot has too many #ifdefs, which isn't necessarily the same as too many #defines. And I don't think CONFIG_AT91 is dubious at all.

Perhaps the CONFIG_* symbols should be defined as TRUE or FALSE rather than defined or not defined.

I didn't say CONFIG_AT91 was dubious. I stated that defining CONFIG_<SOMETHING> where it isn't clear what <SOMETHING> should be is dubious. If one has to think too hard about what meaningful phrase <SOMETHING> should be, perhaps CONFIG_<SOMETHING> should not be defined at all. I'm complaining about defining new preprocessor definitions to be specific aggregations of other definitions just so a developer can type the conditions with fewer keystrokes without any improvement in code readability and maintainability. Sometimes an idiom should be left as an idiom rather than replaced by a preprocessor constant.

I have nothing against defining CONFIG_AT91 if it is useful, unique and makes code that uses it easier to understand and maintain.

Quoted 2 lines

But since we already have a CONFIG_AVR32 #define, we can clean up the mess in macb.c by simply reversing the logic.

If CONFIG_AVR32 can be used in macb.c without ofuscation, why is CONFIG_AT91 needed here? However, "simply reversing the logic" may be too much ofuscation though; we want clear rather than clever code after all.

Quoted 7 lines

An example of what I'd be opposed to is defining CONFIG_AT91SAM9260_OR_AT91SAM9263 where it is TRUE if either CONFIG_AT91SAM9260 or CONFIG_AT91SAM9263 are TRUE. Can you see where this might be used in the macb.c code?

Sincerely,

As I see it, CONFIG_AT91 would mean that you have a a certain class of peripherals which is developed for the AT91 range of processors (and is used by the AVR32 as well) The name is probably slightly misleading, but convenient.

Not having this definition, will soon mean that you have statements like the following:

#if defined(CONFIG_AT91RM9200) || \

defined(CONFIG_AT91SAM9260) || \
defined(CONFIG_AT91SAM9261) || \
defined(CONFIG_AT91SAM9263) || \
defined(CONFIG_AT91SAM9G10) || \
defined(CONFIG_AT91SAM9G15) || \
defined(CONFIG_AT91SAM9G20) || \
defined(CONFIG_AT91SAM9G41) || \
defined(CONFIG_AT91SAM9M10) || \
defined(CONFIG_AT91SAM9M11) || \

defined(CONFIG_AT91CAP9) || \
defined(CONFIG_AT572D940)

This statement will have to be updated every time a new MCU is released.

Having the statment
#if defined(CONFIG_AT91)

should definitely reduce the maintenance of drivers.

Best Regards
Ulf Samuelsson

#9 lore raw

PATCH 1/1 Add support for ATMELAT91SAM9G20EKboard

Quoted 23 lines
Quoted 1 line

As I see it, CONFIG_AT91 would mean that you have a a certain class of peripherals which is developed for the AT91 range of processors (and is used by the AVR32 as well) The name is probably slightly misleading, but convenient.

Not having this definition, will soon mean that you have statements like the following:

#if defined(CONFIG_AT91RM9200) || \

defined(CONFIG_AT91SAM9260) || \
defined(CONFIG_AT91SAM9261) || \
defined(CONFIG_AT91SAM9263) || \
defined(CONFIG_AT91SAM9G10) || \
defined(CONFIG_AT91SAM9G15) || \
defined(CONFIG_AT91SAM9G20) || \
defined(CONFIG_AT91SAM9G41) || \
defined(CONFIG_AT91SAM9M10) || \
defined(CONFIG_AT91SAM9M11) || \

defined(CONFIG_AT91CAP9) || \
defined(CONFIG_AT572D940)

Quoted 6 lines

This statement will have to be updated every time a new MCU is released.

Having the statment
#if defined(CONFIG_AT91)

should definitely reduce the maintenance of drivers.

I fully agree with Ulf, we need to have a better CONFIG, but I'm not sure that CONFIG_AT91 is the right one

We have actually in the tree the following CPU
CONFIG_AT91CAP9
CONFIG_AT91RM9200
CONFIG_AT91SAM9260
CONFIG_AT91SAM9261
CONFIG_AT91SAM9263
CONFIG_AT91SAM9RL

and as mention Ulf are going to have more and more

maybe we can use config related to the functionnality or the sub-class CPU
ex :
CONFIG_MACB_INCLK

Best Regards,
J.

author
#10 lore raw

PATCH 1/1 Add support for ATMELAT91SAM9G20EKboard

Quoted 40 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 23 lines
Quoted 1 line

As I see it, CONFIG_AT91 would mean that you have a a certain class of peripherals which is developed for the AT91 range of processors (and is used by the AVR32 as well) The name is probably slightly misleading, but convenient.

Not having this definition, will soon mean that you have statements like the following:

#if defined(CONFIG_AT91RM9200) || \

defined(CONFIG_AT91SAM9260) || \
defined(CONFIG_AT91SAM9261) || \
defined(CONFIG_AT91SAM9263) || \
defined(CONFIG_AT91SAM9G10) || \
defined(CONFIG_AT91SAM9G15) || \
defined(CONFIG_AT91SAM9G20) || \
defined(CONFIG_AT91SAM9G41) || \
defined(CONFIG_AT91SAM9M10) || \
defined(CONFIG_AT91SAM9M11) || \

defined(CONFIG_AT91CAP9) || \
defined(CONFIG_AT572D940)

Quoted 6 lines

This statement will have to be updated every time a new MCU is released.

Having the statment
#if defined(CONFIG_AT91)

should definitely reduce the maintenance of drivers.

I fully agree with Ulf, we need to have a better CONFIG, but I'm not sure that CONFIG_AT91 is the right one

We have actually in the tree the following CPU
CONFIG_AT91CAP9
CONFIG_AT91RM9200
CONFIG_AT91SAM9260
CONFIG_AT91SAM9261
CONFIG_AT91SAM9263
CONFIG_AT91SAM9RL

Quoted 6 lines

and as mention Ulf are going to have more and more

maybe we can use config related to the functionnality or the sub-class CPU
ex :
CONFIG_MACB_INCLK

Agree.

We can use "#if defined(CONFIG_AT91) && defined(CONFIG_MACB)" in net/eth.c and "#ifdef CONFIG_MACB_INCLK" in drivers/net/macb.c to simplify the previous *big* #ifdef.
If everyone feels comfortable, I'll rewrite these parts and re-submit the patch.

Thanks.

Quoted 14 lines

Best Regards,
J.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

#11 lore raw

PATCH 1/1 Add support for ATMELAT91SAM9G20EKboard

Quoted 11 lines · Hong Xu
Quoted 4 lines

maybe we can use config related to the functionnality or the sub-class CPU
ex :
CONFIG_MACB_INCLK

Agree.

We can use "#if defined(CONFIG_AT91) && defined(CONFIG_MACB)" in net/eth.c and "#ifdef CONFIG_MACB_INCLK" in drivers/net/macb.c to simplify the previous *big* #ifdef.
If everyone feels comfortable, I'll rewrite these parts and re-submit the patch.

What does CONFIG_MACB_INCLK mean?

Haavard

author
#12 lore raw

PATCH 1/1 Add support for ATMELAT91SAM9G20EKboard

Quoted 6 lines · Haavard Skinnemoen
Quoted 5 lines · Hong Xu
Quoted 4 lines

maybe we can use config related to the functionnality or the sub-class CPU
ex :
CONFIG_MACB_INCLK

Quoted 8 lines
Quoted 6 lines

Agree.

We can use "#if defined(CONFIG_AT91) && defined(CONFIG_MACB)" in net/eth.c and "#ifdef CONFIG_MACB_INCLK" in drivers/net/macb.c to simplify the previous *big* #ifdef.
If everyone feels comfortable, I'll rewrite these parts and re-submit the patch.

What does CONFIG_MACB_INCLK mean?

Per J's suggestion, use CONFIG_MACB_INCLK or some other thing to simplify the *big* ifdef in driver/net/macb.c
From the existing code, it seems that some boards (AT91CAP9, AT91SAM926[0,3]) need the CLKEN bit of EMAC_USRIO to be set, but others(if exist) do not need to. So in all boards that need this bit to be set, use a new CONFIG_MACB_XXX to denote this.

Quoted 3 lines

Haavard

#13 lore raw

PATCH 1/1 Add support for ATMELAT91SAM9G20EKboard

Quoted 6 lines · Hong Xu

Per J's suggestion, use CONFIG_MACB_INCLK or some other thing to simplify the *big* ifdef in driver/net/macb.c
From the existing code, it seems that some boards (AT91CAP9, AT91SAM926[0,3]) need the CLKEN bit of EMAC_USRIO to be set, but others(if exist) do not need to. So in all boards that need this bit to be set, use a new CONFIG_MACB_XXX to denote this.

The problem is that CONFIG_MACB_INCLK is a completely nonsensical name. The difference isn't _only_ the CLKEN bit, it's the MII/RMII bit polarity as well. So if we want a completely "meaningful" define, we have to use something along the lines of CONFIG_MACB_HAS_CLKEN_AND_RMII_IS_ACTIVE_HIGH.

Let's stop the overengineering already. How about the patch below?

Haavard

===============[cut here]===============

author
#14 lore raw

PATCH 1/1 Add support for ATMELAT91SAM9G20EKboard

Quoted 24 lines · Haavard Skinnemoen
Quoted 6 lines · Hong Xu

Per J's suggestion, use CONFIG_MACB_INCLK or some other thing to simplify the *big* ifdef in driver/net/macb.c
From the existing code, it seems that some boards (AT91CAP9, AT91SAM926[0,3]) need the CLKEN bit of EMAC_USRIO to be set, but others(if exist) do not need to. So in all boards that need this bit to be set, use a new CONFIG_MACB_XXX to denote this.

The problem is that CONFIG_MACB_INCLK is a completely nonsensical name. The difference isn't _only_ the CLKEN bit, it's the MII/RMII bit polarity as well. So if we want a completely "meaningful" define, we have to use something along the lines of CONFIG_MACB_HAS_CLKEN_AND_RMII_IS_ACTIVE_HIGH.

Let's stop the overengineering already. How about the patch below?

Haavard

===============[cut here]===============
From c63fe984e1a8d18c83119bbc3c575ac5175e61af Mon Sep 17 00:00:00 2001
From: Haavard Skinnemoen <[email protected]>
Date: Mon, 28 Jul 2008 11:12:33 +0200
Subject: [PATCH] macb: Simplify AT91 vs AVR32 #ifdefs

Quoted 7 lines

The AT91 and AVR32 platforms assign different meanings to the bits in USRIO. Until now, this has been handled with two big #ifdefs listing all the various AT91 variants, with the #else branch handling AVR32.

Since there's no catch-all CONFIG_AT91 define, switch the #ifdefs around and use CONFIG_AVR32 instead. The result is identical to what we already have, assuming all AT91 devices behave the same way.

The point is I'm not sure all AT91 series will behave the same way. But since AVR32 has less cases, it's a good idea to use #else to handle AT91 variants. So at least till now, this patch makes sense.

Quoted 39 lines
---
 drivers/net/macb.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)
drivers/net/macb.c +6 -9
index aa39284..49e81d9 100644
@@ -414,18 +414,16 @@ static int macb_init(struct eth_device *netdev, bd_t *bd)
 
       /* choose RMII or MII mode. This depends on the board */
 #ifdef CONFIG_RMII
-#if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263)
-       macb_writel(macb, USRIO, MACB_BIT(RMII) | MACB_BIT(CLKEN));
-#else
+#ifdef CONFIG_AVR32
       macb_writel(macb, USRIO, 0);
-#endif
 #else
-#if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263)
-       macb_writel(macb, USRIO, MACB_BIT(CLKEN));
+       macb_writel(macb, USRIO, MACB_BIT(RMII) | MACB_BIT(CLKEN));
+#endif
 #else
+#ifdef CONFIG_AVR32
       macb_writel(macb, USRIO, MACB_BIT(MII));
+#else
+       macb_writel(macb, USRIO, MACB_BIT(CLKEN));
 #endif
 #endif /* CONFIG_RMII */
 
--

1.5.6.2

#15 lore raw

PATCH 1/1 Add support for ATMELAT91SAM9G20EKboard

Quoted 3 lines · Hong Xu

The point is I'm not sure all AT91 series will behave the same way. But since AVR32 has less cases, it's a good idea to use #else to handle AT91 variants. So at least till now, this patch makes sense.

When I said "let's stop the overengineering", I meant let's not attempt to handle cases that don't exist yet :-)

If there turns out to be lots of differences within chip families, we should probably consider handling it some other way than through adding lots of #ifdefs. For example by adding a macb_set_usrio() hook in an arch/platform/chip/whatever-specific file. But until we actually _need_ that, I think we should go for the simplest solution possible.

Note that AT91 boards that don't actually have ethernet, or use some other implementation, are not interesting in this context since they shouldn't enable the macb driver in the first place.

Haavard

#16 lore raw

PATCH 1/1 Add support for ATMELAT91SAM9G20EK board

In reply to Ken.Fuchs at bench.com
Quoted 7 lines · On Fri, 25 Jul 2008 17:44:52 -0500 <[email protected]> wrote:
Quoted 2 lines

But since we already have a CONFIG_AVR32 #define, we can clean up the mess in macb.c by simply reversing the logic.

If CONFIG_AVR32 can be used in macb.c without ofuscation, why is CONFIG_AT91 needed here? However, "simply reversing the logic" may be too much ofuscation though; we want clear rather than clever code after all.

Reversing the logic wouldn't obfuscate anything. The code in question is a simple matter of "AT91 needs to do it this way, AVR32 needs to do it another way". Whether we check for AT91 or AVR32 is completely arbitrary.

Quoted 3 lines

An example of what I'd be opposed to is defining CONFIG_AT91SAM9260_OR_AT91SAM9263 where it is TRUE if either CONFIG_AT91SAM9260 or CONFIG_AT91SAM9263 are TRUE.

I completely agreee with this.

Quoted 1 line

Can you see where this might be used in the macb.c code?

Not really, no. The processors aren't _that_ different. It's a bit unfortunate that the USRIO register ended up with different behaviour on AT91 and AVR32, but fixing the silicon at this point would just make things worse, and IMO it's not a huge deal. From a CPP abuse point of view, the macb driver is IMO exceptionally clean compared to a lot of other code in u-boot.

Haavard

#17 lore raw

PATCH 1/1 Add support for ATMEL AT91SAM9G20EK board

In reply to Hong Xu

Hi Hong Xu,

Quoted 13 lines · Hong Xu
Quoted 1 line

From 81230b02610c06fdc8a175e635851346488e3bdb Mon Sep 17 00:00:00 2001

From: Hong Xu <[email protected]>
Date: Thu, 24 Jul 2008 14:25:05 +0800
Subject: [PATCH 1/1] Add support for ATMEL AT91SAM9G20EK board

This patch adds support for ATMEL AT91SAM9G20EK board. User manual for AT91SAM9G20EK board, see
http://www.atmel.com/dyn/resources/prod_documents/doc6413.pdf
AT91 SAM9G20 datasheet, see
http://www.atmel.com/dyn/resources/prod_documents/doc6384.pdf

---

<snip>

net/eth.c int eth_initialize(bd_t *bis) · line 293

Quoted 13 lines
net/eth.c +1 -1
index 38979aa..3f50e2b 100644
@@ -287,7 +287,7 @@ int eth_initialize(bd_t *bis)
       mcdmafec_initialize(bis);
 #endif
 #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263)
+    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
       at91sam9_eth_initialize(bis);
 #endif
 

Please don't touch net/eth.c. Instead, implement the following in board code:

int board_eth_init(bd_t *bis);

Please be sure to check that the weak version of board_eth_init() is overridden (the board_eth_init and __def_eth_init symbols should have different addresses in the object code). You can do something like:

$ cat System.map | grep eth_init

regards,
Ben

author
#18 lore raw

PATCH 1/1 Add support for ATMEL AT91SAM9G20EK board

Hi Ben Warren,

Quoted 17 lines · Ben Warren

Hi Hong Xu,

Quoted 13 lines · Hong Xu
Quoted 1 line

From 81230b02610c06fdc8a175e635851346488e3bdb Mon Sep 17 00:00:00 2001

From: Hong Xu <[email protected]>
Date: Thu, 24 Jul 2008 14:25:05 +0800
Subject: [PATCH 1/1] Add support for ATMEL AT91SAM9G20EK board

This patch adds support for ATMEL AT91SAM9G20EK board. User manual for AT91SAM9G20EK board, see
http://www.atmel.com/dyn/resources/prod_documents/doc6413.pdf
AT91 SAM9G20 datasheet, see
http://www.atmel.com/dyn/resources/prod_documents/doc6384.pdf

---

<snip>

Quoted 15 lines

net/eth.c int eth_initialize(bd_t *bis) · line 293

Quoted 13 lines
net/eth.c +1 -1
index 38979aa..3f50e2b 100644
@@ -287,7 +287,7 @@ int eth_initialize(bd_t *bis)
       mcdmafec_initialize(bis);
 #endif
 #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263)
+    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
       at91sam9_eth_initialize(bis);
 #endif
 

Please don't touch net/eth.c. Instead, implement the following in board code:

Actually I did NOT touch the logic in net/eth.c. I just said, "hey, since you guys have the logic, please make a call for me.". That's it. :-)
Thanks.

Quoted 12 lines

int board_eth_init(bd_t *bis);

Please be sure to check that the weak version of board_eth_init() is overridden (the board_eth_init and __def_eth_init symbols should have different addresses in the object code). You can do something like:

$ cat System.map | grep eth_init

regards,
Ben

#19 lore raw

PATCH 1/1 Add support for ATMEL AT91SAM9G20EK board

Quoted 36 lines · Hong Xu

Hi Ben Warren,

Quoted 17 lines · Ben Warren

Hi Hong Xu,

Quoted 13 lines · Hong Xu
Quoted 1 line

From 81230b02610c06fdc8a175e635851346488e3bdb Mon Sep 17 00:00:00 2001

From: Hong Xu <[email protected]>
Date: Thu, 24 Jul 2008 14:25:05 +0800
Subject: [PATCH 1/1] Add support for ATMEL AT91SAM9G20EK board

This patch adds support for ATMEL AT91SAM9G20EK board. User manual for AT91SAM9G20EK board, see
http://www.atmel.com/dyn/resources/prod_documents/doc6413.pdf
AT91 SAM9G20 datasheet, see
http://www.atmel.com/dyn/resources/prod_documents/doc6384.pdf

---

<snip>

Quoted 15 lines

net/eth.c int eth_initialize(bd_t *bis) · line 293

Quoted 13 lines
net/eth.c +1 -1
index 38979aa..3f50e2b 100644
@@ -287,7 +287,7 @@ int eth_initialize(bd_t *bis)
       mcdmafec_initialize(bis);
 #endif
 #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263)
+    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
       at91sam9_eth_initialize(bis);
 #endif
 

Please don't touch net/eth.c. Instead, implement the following in board code:

Quoted 3 lines

Actually I did NOT touch the logic in net/eth.c. I just said, "hey, since you guys have the logic, please make a call for me.". That's it. :-)

Sure. I'm saying, don't even do that. I mean don't touch the file, not don't touch the logic.

regards,
Ben