Skip to contentSkip to conversation

at91: regroup IP hw init in one cpu file per soc

PATCH New Jean-Christophe PLAGNIOL-VILLARD 1 participant 1 message May 13, 2009 Arm/Microchip (AT91) SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 at91: regroup IP hw init in one cpu file per soc

---
 cpu/arm926ejs/at91/Makefile                        |   35 +---
 cpu/arm926ejs/at91/at91cap9_devices.c              |  176 +++++++++++++++++++
 cpu/arm926ejs/at91/at91cap9_macb.c                 |   54 ------
 cpu/arm926ejs/at91/at91cap9_serial.c               |   76 --------
 cpu/arm926ejs/at91/at91cap9_spi.c                  |  100 -----------
 cpu/arm926ejs/at91/at91sam9260_devices.c           |  184 ++++++++++++++++++++
 cpu/arm926ejs/at91/at91sam9260_macb.c              |   63 -------
 cpu/arm926ejs/at91/at91sam9260_serial.c            |   76 --------
 cpu/arm926ejs/at91/at91sam9260_spi.c               |   99 -----------
 .../{at91sam9261_spi.c => at91sam9261_devices.c}   |   49 +++++
 cpu/arm926ejs/at91/at91sam9261_serial.c            |   76 --------
 cpu/arm926ejs/at91/at91sam9263_devices.c           |  184 ++++++++++++++++++++
 cpu/arm926ejs/at91/at91sam9263_macb.c              |   54 ------
 cpu/arm926ejs/at91/at91sam9263_serial.c            |   76 --------
 cpu/arm926ejs/at91/at91sam9263_spi.c               |   99 -----------
 cpu/arm926ejs/at91/at91sam9263_usb.c               |   35 ----
 .../{at91sam9rl_serial.c => at91sam9rl_devices.c}  |   37 ++++
 cpu/arm926ejs/at91/at91sam9rl_spi.c                |   64 -------
 18 files changed, 636 insertions(+), 901 deletions(-)
 create mode 100644 cpu/arm926ejs/at91/at91cap9_devices.c
 delete mode 100644 cpu/arm926ejs/at91/at91cap9_macb.c
 delete mode 100644 cpu/arm926ejs/at91/at91cap9_serial.c
 delete mode 100644 cpu/arm926ejs/at91/at91cap9_spi.c
 create mode 100644 cpu/arm926ejs/at91/at91sam9260_devices.c
 delete mode 100644 cpu/arm926ejs/at91/at91sam9260_macb.c
 delete mode 100644 cpu/arm926ejs/at91/at91sam9260_serial.c
 delete mode 100644 cpu/arm926ejs/at91/at91sam9260_spi.c
 rename cpu/arm926ejs/at91/{at91sam9261_spi.c => at91sam9261_devices.c} (72%)
 delete mode 100644 cpu/arm926ejs/at91/at91sam9261_serial.c
 create mode 100644 cpu/arm926ejs/at91/at91sam9263_devices.c
 delete mode 100644 cpu/arm926ejs/at91/at91sam9263_macb.c
 delete mode 100644 cpu/arm926ejs/at91/at91sam9263_serial.c
 delete mode 100644 cpu/arm926ejs/at91/at91sam9263_spi.c
 delete mode 100644 cpu/arm926ejs/at91/at91sam9263_usb.c
 rename cpu/arm926ejs/at91/{at91sam9rl_serial.c => at91sam9rl_devices.c} (70%)
 delete mode 100644 cpu/arm926ejs/at91/at91sam9rl_spi.c
cpu/arm926ejs/at91/Makefile +6 -29
index e300d97..71acb0b 100644
@@ -25,35 +25,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
-ifdef CONFIG_AT91SAM9G20
-COBJS-$(CONFIG_MACB)		+= at91sam9260_macb.o
-COBJS-y				+= at91sam9260_serial.o
-COBJS-$(CONFIG_HAS_DATAFLASH)	+= at91sam9260_spi.o
-endif
-ifdef CONFIG_AT91SAM9261
-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
-endif
-ifdef CONFIG_AT91SAM9RL
-COBJS-y				+= at91sam9rl_serial.o
-COBJS-$(CONFIG_HAS_DATAFLASH)	+= at91sam9rl_spi.o
-endif
+COBJS-$(CONFIG_AT91CAP9)	+= at91cap9_devices.o
+COBJS-$(CONFIG_AT91SAM9260)	+= at91sam9260_devices.o
+COBJS-$(CONFIG_AT91SAM9G20)	+= at91sam9260_devices.o
+COBJS-$(CONFIG_AT91SAM9261)	+= at91sam9261_devices.o
+COBJS-$(CONFIG_AT91SAM9263)	+= at91sam9263_devices.o
+COBJS-$(CONFIG_AT91SAM9RL)	+= at91sam9rl_devices.o
 COBJS-$(CONFIG_AT91_LED)	+= led.o
 COBJS-y += clock.o
 COBJS-y += cpu.o
cpu/arm926ejs/at91/at91cap9_devices.c new file +176 -0

176 lines not on this page · raw message

cpu/arm926ejs/at91/at91cap9_macb.c deleted +0 -54

54 lines not on this page · raw message

cpu/arm926ejs/at91/at91cap9_serial.c deleted +0 -76

76 lines not on this page · raw message

cpu/arm926ejs/at91/at91cap9_spi.c deleted +0 -100

100 lines not on this page · raw message

cpu/arm926ejs/at91/at91sam9260_devices.c new file +184 -0

184 lines not on this page · raw message

cpu/arm926ejs/at91/at91sam9260_macb.c deleted +0 -63

63 lines not on this page · raw message

cpu/arm926ejs/at91/at91sam9260_serial.c deleted +0 -76

76 lines not on this page · raw message

cpu/arm926ejs/at91/at91sam9260_spi.c deleted +0 -99

99 lines not on this page · raw message

cpu/arm926ejs/at91/at91sam9261_devices.c renamed from cpu/arm926ejs/at91/at91sam9261_spi.c +49 -0

58 lines not on this page · raw message

cpu/arm926ejs/at91/at91sam9261_serial.c deleted +0 -76

76 lines not on this page · raw message

cpu/arm926ejs/at91/at91sam9263_devices.c new file +184 -0

184 lines not on this page · raw message

cpu/arm926ejs/at91/at91sam9263_macb.c deleted +0 -54

54 lines not on this page · raw message

cpu/arm926ejs/at91/at91sam9263_serial.c deleted +0 -76

76 lines not on this page · raw message

cpu/arm926ejs/at91/at91sam9263_spi.c deleted +0 -99

99 lines not on this page · raw message

cpu/arm926ejs/at91/at91sam9263_usb.c deleted +0 -35
deleted file mode 100644
index ff5593b..0000000
@@ -1,35 +0,0 @@
-/*
- * (C) Copyright 2007-2008
- * Stelian Pop <[email protected]>
- * 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/gpio.h>
-#include <asm/arch/io.h>
-
-void at91_uhp_hw_init(void)
-{
-	/* Enable VBus on UHP ports */
-	at91_set_gpio_output(AT91_PIN_PA21, 0);
-	at91_set_gpio_output(AT91_PIN_PA24, 0);
-}
cpu/arm926ejs/at91/at91sam9rl_devices.c renamed from cpu/arm926ejs/at91/at91sam9rl_serial.c +37 -0
similarity index 70%
rename from cpu/arm926ejs/at91/at91sam9rl_serial.c
rename to cpu/arm926ejs/at91/at91sam9rl_devices.c
index 99ce418..ebed193 100644
@@ -74,3 +74,40 @@ void at91_serial_hw_init(void)
 	at91_serial3_hw_init();
 #endif
 }
+
+#ifdef CONFIG_HAS_DATAFLASH
+void at91_spi0_hw_init(unsigned long cs_mask)
+{
+	at91_set_A_periph(AT91_PIN_PA25, 0);	/* SPI0_MISO */
+	at91_set_A_periph(AT91_PIN_PA26, 0);	/* SPI0_MOSI */
+	at91_set_A_periph(AT91_PIN_PA27, 0);	/* SPI0_SPCK */
+
+	/* Enable clock */
+	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9RL_ID_SPI);
+
+	if (cs_mask & (1 << 0)) {
+		at91_set_A_periph(AT91_PIN_PA28, 1);
+	}
+	if (cs_mask & (1 << 1)) {
+		at91_set_B_periph(AT91_PIN_PB7, 1);
+	}
+	if (cs_mask & (1 << 2)) {
+		at91_set_A_periph(AT91_PIN_PD8, 1);
+	}
+	if (cs_mask & (1 << 3)) {
+		at91_set_B_periph(AT91_PIN_PD9, 1);
+	}
+	if (cs_mask & (1 << 4)) {
+		at91_set_gpio_output(AT91_PIN_PA28, 1);
+	}
+	if (cs_mask & (1 << 5)) {
+		at91_set_gpio_output(AT91_PIN_PB7, 1);
+	}
+	if (cs_mask & (1 << 6)) {
+		at91_set_gpio_output(AT91_PIN_PD8, 1);
+	}
+	if (cs_mask & (1 << 7)) {
+		at91_set_gpio_output(AT91_PIN_PD9, 1);
+	}
+}
+#endif
cpu/arm926ejs/at91/at91sam9rl_spi.c deleted +0 -64

64 lines not on this page · raw message

Signature · 1 line
1.6.1.3