]> git.sur5r.net Git - u-boot/commitdiff
at91sam9/at91cap: move common macb initialisation to cpu
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Sat, 21 Mar 2009 20:08:00 +0000 (21:08 +0100)
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Sun, 22 Mar 2009 12:22:14 +0000 (13:22 +0100)
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
board/afeb9260/afeb9260.c
board/atmel/at91cap9adk/at91cap9adk.c
board/atmel/at91sam9260ek/at91sam9260ek.c
board/atmel/at91sam9263ek/at91sam9263ek.c
cpu/arm926ejs/at91/Makefile
cpu/arm926ejs/at91/at91cap9_macb.c [new file with mode: 0644]
cpu/arm926ejs/at91/at91sam9260_macb.c [new file with mode: 0644]
cpu/arm926ejs/at91/at91sam9263_macb.c [new file with mode: 0644]
include/asm-arm/arch-at91/at91_common.h

index 0f9c50486a953cb7c5b9745c333c54718714ad2b..ba60861f1eae8095cb52d9efa3a245707faf9554 100644 (file)
@@ -127,28 +127,7 @@ static void afeb9260_macb_hw_init(void)
               pin_to_mask(AT91_PIN_PA28),
               pin_to_controller(AT91_PIN_PA0) + PIO_PUER);
 
-       at91_set_A_periph(AT91_PIN_PA19, 0);    /* ETXCK_EREFCK */
-       at91_set_A_periph(AT91_PIN_PA17, 0);    /* ERXDV */
-       at91_set_A_periph(AT91_PIN_PA14, 0);    /* ERX0 */
-       at91_set_A_periph(AT91_PIN_PA15, 0);    /* ERX1 */
-       at91_set_A_periph(AT91_PIN_PA18, 0);    /* ERXER */
-       at91_set_A_periph(AT91_PIN_PA16, 0);    /* ETXEN */
-       at91_set_A_periph(AT91_PIN_PA12, 0);    /* ETX0 */
-       at91_set_A_periph(AT91_PIN_PA13, 0);    /* ETX1 */
-       at91_set_A_periph(AT91_PIN_PA21, 0);    /* EMDIO */
-       at91_set_A_periph(AT91_PIN_PA20, 0);    /* EMDC */
-
-#ifndef CONFIG_RMII
-       at91_set_B_periph(AT91_PIN_PA28, 0);    /* ECRS */
-       at91_set_B_periph(AT91_PIN_PA29, 0);    /* ECOL */
-       at91_set_B_periph(AT91_PIN_PA25, 0);    /* ERX2 */
-       at91_set_B_periph(AT91_PIN_PA26, 0);    /* ERX3 */
-       at91_set_B_periph(AT91_PIN_PA27, 0);    /* ERXCK */
-       at91_set_B_periph(AT91_PIN_PA10, 0);    /* ETX2 */
-       at91_set_B_periph(AT91_PIN_PA11, 0);    /* ETX3 */
-       at91_set_B_periph(AT91_PIN_PA22, 0);    /* ETXER */
-#endif
-
+       at91_macb_hw_init();
 }
 #endif
 
index b1e9c62b29afcfabe372eb9ef64dfc928d180d32..46a4fce5d2cc45dc7f1b754f1bfa7e3c7a7d2a0d 100644 (file)
@@ -177,27 +177,8 @@ static void at91cap9_macb_hw_init(void)
               pin_to_mask(AT91_PIN_PB26),
               pin_to_controller(AT91_PIN_PA0) + PIO_PUER);
 
-       at91_set_A_periph(AT91_PIN_PB21, 0);    /* ETXCK_EREFCK */
-       at91_set_A_periph(AT91_PIN_PB22, 0);    /* ERXDV */
-       at91_set_A_periph(AT91_PIN_PB25, 0);    /* ERX0 */
-       at91_set_A_periph(AT91_PIN_PB26, 0);    /* ERX1 */
-       at91_set_A_periph(AT91_PIN_PB27, 0);    /* ERXER */
-       at91_set_A_periph(AT91_PIN_PB28, 0);    /* ETXEN */
-       at91_set_A_periph(AT91_PIN_PB23, 0);    /* ETX0 */
-       at91_set_A_periph(AT91_PIN_PB24, 0);    /* ETX1 */
-       at91_set_A_periph(AT91_PIN_PB30, 0);    /* EMDIO */
-       at91_set_A_periph(AT91_PIN_PB29, 0);    /* EMDC */
-
-#ifndef CONFIG_RMII
-       at91_set_B_periph(AT91_PIN_PC25, 0);    /* ECRS */
-       at91_set_B_periph(AT91_PIN_PC26, 0);    /* ECOL */
-       at91_set_B_periph(AT91_PIN_PC22, 0);    /* ERX2 */
-       at91_set_B_periph(AT91_PIN_PC23, 0);    /* ERX3 */
-       at91_set_B_periph(AT91_PIN_PC27, 0);    /* ERXCK */
-       at91_set_B_periph(AT91_PIN_PC20, 0);    /* ETX2 */
-       at91_set_B_periph(AT91_PIN_PC21, 0);    /* ETX3 */
-       at91_set_B_periph(AT91_PIN_PC24, 0);    /* ETXER */
-#endif
+       at91_macb_hw_init();
+
        /* Unlock EMAC, 3 0 2 1 sequence */
 #define MP_MAC_KEY0    0x5969cb2a
 #define MP_MAC_KEY1    0xb4a1872e
index ad9dfeb288da775b8a5945856ffcd84bba9523bf..d89f2475c6d1151798e800c1c63458fd570fe2af 100644 (file)
@@ -132,37 +132,7 @@ static void at91sam9260ek_macb_hw_init(void)
               pin_to_mask(AT91_PIN_PA28),
               pin_to_controller(AT91_PIN_PA0) + PIO_PUER);
 
-       at91_set_A_periph(AT91_PIN_PA19, 0);    /* ETXCK_EREFCK */
-       at91_set_A_periph(AT91_PIN_PA17, 0);    /* ERXDV */
-       at91_set_A_periph(AT91_PIN_PA14, 0);    /* ERX0 */
-       at91_set_A_periph(AT91_PIN_PA15, 0);    /* ERX1 */
-       at91_set_A_periph(AT91_PIN_PA18, 0);    /* ERXER */
-       at91_set_A_periph(AT91_PIN_PA16, 0);    /* ETXEN */
-       at91_set_A_periph(AT91_PIN_PA12, 0);    /* ETX0 */
-       at91_set_A_periph(AT91_PIN_PA13, 0);    /* ETX1 */
-       at91_set_A_periph(AT91_PIN_PA21, 0);    /* EMDIO */
-       at91_set_A_periph(AT91_PIN_PA20, 0);    /* EMDC */
-
-#ifndef CONFIG_RMII
-       at91_set_B_periph(AT91_PIN_PA28, 0);    /* ECRS */
-       at91_set_B_periph(AT91_PIN_PA29, 0);    /* ECOL */
-       at91_set_B_periph(AT91_PIN_PA25, 0);    /* ERX2 */
-       at91_set_B_periph(AT91_PIN_PA26, 0);    /* ERX3 */
-       at91_set_B_periph(AT91_PIN_PA27, 0);    /* ERXCK */
-#if defined(CONFIG_AT91SAM9260EK)
-       /*
-        * use PA10, PA11 for ETX2, ETX3.
-        * PA23 and PA24 are for TWI EEPROM
-        */
-       at91_set_B_periph(AT91_PIN_PA10, 0);    /* ETX2 */
-       at91_set_B_periph(AT91_PIN_PA11, 0);    /* ETX3 */
-#else
-       at91_set_B_periph(AT91_PIN_PA23, 0);    /* ETX2 */
-       at91_set_B_periph(AT91_PIN_PA24, 0);    /* ETX3 */
-#endif
-       at91_set_B_periph(AT91_PIN_PA22, 0);    /* ETXER */
-#endif
-
+       at91_macb_hw_init();
 }
 #endif
 
index 59ace177cb85e672112071a0eef43f40732142fc..9110e9e6ac2d9fceb28fc16b6bb0762fbddfba68 100644 (file)
@@ -129,28 +129,7 @@ static void at91sam9263ek_macb_hw_init(void)
               pin_to_mask(AT91_PIN_PE26),
               pin_to_controller(AT91_PIN_PE0) + PIO_PUER);
 
-       at91_set_A_periph(AT91_PIN_PE21, 0);    /* ETXCK_EREFCK */
-       at91_set_B_periph(AT91_PIN_PC25, 0);    /* ERXDV */
-       at91_set_A_periph(AT91_PIN_PE25, 0);    /* ERX0 */
-       at91_set_A_periph(AT91_PIN_PE26, 0);    /* ERX1 */
-       at91_set_A_periph(AT91_PIN_PE27, 0);    /* ERXER */
-       at91_set_A_periph(AT91_PIN_PE28, 0);    /* ETXEN */
-       at91_set_A_periph(AT91_PIN_PE23, 0);    /* ETX0 */
-       at91_set_A_periph(AT91_PIN_PE24, 0);    /* ETX1 */
-       at91_set_A_periph(AT91_PIN_PE30, 0);    /* EMDIO */
-       at91_set_A_periph(AT91_PIN_PE29, 0);    /* EMDC */
-
-#ifndef CONFIG_RMII
-       at91_set_A_periph(AT91_PIN_PE22, 0);    /* ECRS */
-       at91_set_B_periph(AT91_PIN_PC26, 0);    /* ECOL */
-       at91_set_B_periph(AT91_PIN_PC22, 0);    /* ERX2 */
-       at91_set_B_periph(AT91_PIN_PC23, 0);    /* ERX3 */
-       at91_set_B_periph(AT91_PIN_PC27, 0);    /* ERXCK */
-       at91_set_B_periph(AT91_PIN_PC20, 0);    /* ETX2 */
-       at91_set_B_periph(AT91_PIN_PC21, 0);    /* ETX3 */
-       at91_set_B_periph(AT91_PIN_PC24, 0);    /* ETXER */
-#endif
-
+       at91_macb_hw_init();
 }
 #endif
 
index 15231999c05fb3e47c325aecf9e21e2f48b9d3ac..db79c40d82aaaca87c27a1ff9fd2291fc401d7f8 100644 (file)
@@ -26,10 +26,12 @@ include $(TOPDIR)/config.mk
 LIB    = $(obj)lib$(SOC).a
 
 ifdef CONFIG_AT91CAP9
+COBJS-$(CONFIG_MACB)           += at91cap9_macb.o
 COBJS-y                                += at91cap9_serial.o
 COBJS-$(CONFIG_HAS_DATAFLASH)  += at91cap9_spi.o
 endif
 ifdef CONFIG_AT91SAM9260
+COBJS-$(CONFIG_MACB)           += at91sam9260_macb.o
 COBJS-y                                += at91sam9260_serial.o
 COBJS-$(CONFIG_HAS_DATAFLASH)  += at91sam9260_spi.o
 endif
@@ -38,6 +40,7 @@ COBJS-y                               += at91sam9261_serial.o
 COBJS-$(CONFIG_HAS_DATAFLASH)  += at91sam9261_spi.o
 endif
 ifdef CONFIG_AT91SAM9263
+COBJS-$(CONFIG_MACB)           += at91sam9263_macb.o
 COBJS-y                                += at91sam9263_serial.o
 COBJS-$(CONFIG_HAS_DATAFLASH)  += at91sam9263_spi.o
 COBJS-$(CONFIG_USB_OHCI_NEW)   += at91sam9263_usb.o
diff --git a/cpu/arm926ejs/at91/at91cap9_macb.c b/cpu/arm926ejs/at91/at91cap9_macb.c
new file mode 100644 (file)
index 0000000..5095d8d
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/arch/at91_common.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
+
+void at91_macb_hw_init(void)
+{
+       at91_set_A_periph(AT91_PIN_PB21, 0);    /* ETXCK_EREFCK */
+       at91_set_A_periph(AT91_PIN_PB22, 0);    /* ERXDV */
+       at91_set_A_periph(AT91_PIN_PB25, 0);    /* ERX0 */
+       at91_set_A_periph(AT91_PIN_PB26, 0);    /* ERX1 */
+       at91_set_A_periph(AT91_PIN_PB27, 0);    /* ERXER */
+       at91_set_A_periph(AT91_PIN_PB28, 0);    /* ETXEN */
+       at91_set_A_periph(AT91_PIN_PB23, 0);    /* ETX0 */
+       at91_set_A_periph(AT91_PIN_PB24, 0);    /* ETX1 */
+       at91_set_A_periph(AT91_PIN_PB30, 0);    /* EMDIO */
+       at91_set_A_periph(AT91_PIN_PB29, 0);    /* EMDC */
+
+#ifndef CONFIG_RMII
+       at91_set_B_periph(AT91_PIN_PC25, 0);    /* ECRS */
+       at91_set_B_periph(AT91_PIN_PC26, 0);    /* ECOL */
+       at91_set_B_periph(AT91_PIN_PC22, 0);    /* ERX2 */
+       at91_set_B_periph(AT91_PIN_PC23, 0);    /* ERX3 */
+       at91_set_B_periph(AT91_PIN_PC27, 0);    /* ERXCK */
+       at91_set_B_periph(AT91_PIN_PC20, 0);    /* ETX2 */
+       at91_set_B_periph(AT91_PIN_PC21, 0);    /* ETX3 */
+       at91_set_B_periph(AT91_PIN_PC24, 0);    /* ETXER */
+#endif
+}
diff --git a/cpu/arm926ejs/at91/at91sam9260_macb.c b/cpu/arm926ejs/at91/at91sam9260_macb.c
new file mode 100644 (file)
index 0000000..ab60fb7
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/arch/at91_common.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
+
+void at91_macb_hw_init(void)
+{
+       at91_set_A_periph(AT91_PIN_PA19, 0);    /* ETXCK_EREFCK */
+       at91_set_A_periph(AT91_PIN_PA17, 0);    /* ERXDV */
+       at91_set_A_periph(AT91_PIN_PA14, 0);    /* ERX0 */
+       at91_set_A_periph(AT91_PIN_PA15, 0);    /* ERX1 */
+       at91_set_A_periph(AT91_PIN_PA18, 0);    /* ERXER */
+       at91_set_A_periph(AT91_PIN_PA16, 0);    /* ETXEN */
+       at91_set_A_periph(AT91_PIN_PA12, 0);    /* ETX0 */
+       at91_set_A_periph(AT91_PIN_PA13, 0);    /* ETX1 */
+       at91_set_A_periph(AT91_PIN_PA21, 0);    /* EMDIO */
+       at91_set_A_periph(AT91_PIN_PA20, 0);    /* EMDC */
+
+#ifndef CONFIG_RMII
+       at91_set_B_periph(AT91_PIN_PA28, 0);    /* ECRS */
+       at91_set_B_periph(AT91_PIN_PA29, 0);    /* ECOL */
+       at91_set_B_periph(AT91_PIN_PA25, 0);    /* ERX2 */
+       at91_set_B_periph(AT91_PIN_PA26, 0);    /* ERX3 */
+       at91_set_B_periph(AT91_PIN_PA27, 0);    /* ERXCK */
+#if defined(CONFIG_AT91SAM9260EK)
+       /*
+        * use PA10, PA11 for ETX2, ETX3.
+        * PA23 and PA24 are for TWI EEPROM
+        */
+       at91_set_B_periph(AT91_PIN_PA10, 0);    /* ETX2 */
+       at91_set_B_periph(AT91_PIN_PA11, 0);    /* ETX3 */
+#else
+       at91_set_B_periph(AT91_PIN_PA23, 0);    /* ETX2 */
+       at91_set_B_periph(AT91_PIN_PA24, 0);    /* ETX3 */
+#endif
+       at91_set_B_periph(AT91_PIN_PA22, 0);    /* ETXER */
+#endif
+}
diff --git a/cpu/arm926ejs/at91/at91sam9263_macb.c b/cpu/arm926ejs/at91/at91sam9263_macb.c
new file mode 100644 (file)
index 0000000..4223d37
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/arch/at91_common.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
+
+void at91_macb_hw_init(void)
+{
+       at91_set_A_periph(AT91_PIN_PE21, 0);    /* ETXCK_EREFCK */
+       at91_set_B_periph(AT91_PIN_PC25, 0);    /* ERXDV */
+       at91_set_A_periph(AT91_PIN_PE25, 0);    /* ERX0 */
+       at91_set_A_periph(AT91_PIN_PE26, 0);    /* ERX1 */
+       at91_set_A_periph(AT91_PIN_PE27, 0);    /* ERXER */
+       at91_set_A_periph(AT91_PIN_PE28, 0);    /* ETXEN */
+       at91_set_A_periph(AT91_PIN_PE23, 0);    /* ETX0 */
+       at91_set_A_periph(AT91_PIN_PE24, 0);    /* ETX1 */
+       at91_set_A_periph(AT91_PIN_PE30, 0);    /* EMDIO */
+       at91_set_A_periph(AT91_PIN_PE29, 0);    /* EMDC */
+
+#ifndef CONFIG_RMII
+       at91_set_A_periph(AT91_PIN_PE22, 0);    /* ECRS */
+       at91_set_B_periph(AT91_PIN_PC26, 0);    /* ECOL */
+       at91_set_B_periph(AT91_PIN_PC22, 0);    /* ERX2 */
+       at91_set_B_periph(AT91_PIN_PC23, 0);    /* ERX3 */
+       at91_set_B_periph(AT91_PIN_PC27, 0);    /* ERXCK */
+       at91_set_B_periph(AT91_PIN_PC20, 0);    /* ETX2 */
+       at91_set_B_periph(AT91_PIN_PC21, 0);    /* ETX3 */
+       at91_set_B_periph(AT91_PIN_PC24, 0);    /* ETXER */
+#endif
+}
index 797854b19a8d940a015b426cab50d93c28f2ffcf..9c4e0197155232285e24aaac3c47fd133a41f4d0 100644 (file)
@@ -25,6 +25,7 @@
 #ifndef AT91_COMMON_H
 #define AT91_COMMON_H
 
+void at91_macb_hw_init(void);
 void at91_serial_hw_init(void);
 void at91_serial0_hw_init(void);
 void at91_serial1_hw_init(void);