Network AT91 AVR32: generic way of addressing USRIO register layout
PATCH 1/1 Network AT91 AVR32: generic way of addressing USRIO register layout
The MACB IP used by AVR32 & AT91 have two different layout for USRIO register. We have to differentiate this in the driver code. No more cpu specific #ifdefs in driver: we manage a configuration variable.
--- drivers/net/macb.c | 6 ++---- drivers/net/macb.h | 7 +++++++ 2 files changed, 9 insertions(+), 4 deletions(-)
drivers/net/macb.c +2 -4
@@ -446,15 +446,13 @@ 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_AT91SAM9G20 ) +#if defined(CONFIG_MACB_USRIO_CFG1 )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_AT91SAM9G20 ) +#if defined(CONFIG_MACB_USRIO_CFG1 )macb_writel (macb,USRIO ,MACB_BIT (CLKEN ));#else macb_writel (macb,USRIO ,MACB_BIT (MII ));
drivers/net/macb.h +7 -0
@@ -212,6 +212,13 @@#define MACB_SOF_OFFSET 30#define MACB_SOF_SIZE 2 +/* MACB IP used by AVR32 & AT91 have two +* different layout for USRIO register. */ +#if !defined(CONFIG_AVR32 ) +/* Use AT91 USRIO layout */ +#define CONFIG_MACB_USRIO_CFG1 1 +#endif +/* Bitfields in USRIO */ #define MACB_MII_OFFSET 0#define MACB_MII_SIZE 1
Signature · 1 line
1.5.3.7
PATCH 1/1 Network AT91 AVR32: generic way of addressing USRIO register layout
Quoted 6 lines · Nicolas Ferre
The MACB IP used by AVR32 & AT91 have two different layout for USRIO register. We have to differentiate this in the driver code. No more cpu specific #ifdefs in driver: we manage a configuration variable.
Signed-off-by Nicolas Ferre <[email protected]>
Haavard is ok for you too?
Best Regards,
J.
PATCH 1/1 Network AT91 AVR32: generic way of addressing USRIO register layout
Quoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines · Nicolas Ferre
The MACB IP used by AVR32 & AT91 have two different layout for USRIO register. We have to differentiate this in the driver code. No more cpu specific #ifdefs in driver: we manage a configuration variable.
Signed-off-by Nicolas Ferre <[email protected]>Haavard is ok for you too?
Sure.
PATCH 1/1 Network AT91 AVR32: generic way of addressing USRIO register layout
Quoted 7 lines · Haavard Skinnemoen
Quoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Nicolas Ferre
The MACB IP used by AVR32 & AT91 have two different layout for USRIO register. We have to differentiate this in the driver code. No more cpu specific #ifdefs in driver: we manage a configuration variable.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Nicolas Ferre <[email protected]>Haavard is ok for you too?
Sure.
Ben is ok for you?
Best Regards,
J.
PATCH 1/1 Network AT91 AVR32: generic way of addressing USRIO register layout
Quoted 15 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 13 lines · Haavard Skinnemoen
Quoted 11 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 7 lines · Nicolas Ferre
The MACB IP used by AVR32 & AT91 have two different layout for USRIO register. We have to differentiate this in the driver code. No more cpu specific #ifdefs in driver: we manage a configuration variable.
Signed-off-by Nicolas Ferre <[email protected]>
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Haavard is ok for you too?
Sure.
Ben is ok for you?
It's definitely an improvement, although I'm not fond of placing the conditional macro in the header file. Overall OK, though. I'll pick it up.
regards,
Ben