diff options
author | Juergen Beisert <juergen@kreuzholzen.de> | 2009-10-27 19:57:37 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2009-10-28 09:44:42 +0100 |
commit | f5194c3a3ef1f2ace56a7e5feff92ed63b76ae91 (patch) | |
tree | 18d7b8fd2af2c54da888b5342df838f4e7060fcd /board | |
parent | 8a7f83735549d4edd49f608c922780e03cadc062 (diff) | |
download | barebox-f5194c3a3ef1f2ace56a7e5feff92ed63b76ae91.tar.gz barebox-f5194c3a3ef1f2ace56a7e5feff92ed63b76ae91.tar.xz |
A9M2440: Be able to configure things baseboard dependent
There is no really generic way to configure the S3C2440 CPU with fits to all
possible baseboards. This patch separates things into the CPU card related and
baseboard related things. This ensures to be able to configure things for
each possible baseboard without modifying/patching the main card source.
Signed-off-by: Juergen Beisert <juergen@kreuzholzen.de>
Diffstat (limited to 'board')
-rw-r--r-- | board/a9m2440/Makefile | 1 | ||||
-rw-r--r-- | board/a9m2440/a9m2410dev.c | 93 | ||||
-rw-r--r-- | board/a9m2440/a9m2440.c | 47 | ||||
-rw-r--r-- | board/a9m2440/baseboards.h | 23 |
4 files changed, 124 insertions, 40 deletions
diff --git a/board/a9m2440/Makefile b/board/a9m2440/Makefile index 53c890b849..779e83dc03 100644 --- a/board/a9m2440/Makefile +++ b/board/a9m2440/Makefile @@ -1,3 +1,4 @@ obj-y += lowlevel_init.o obj-y += a9m2440.o +obj-$(CONFIG_MACH_A9M2410DEV) += a9m2410dev.o diff --git a/board/a9m2440/a9m2410dev.c b/board/a9m2440/a9m2410dev.c new file mode 100644 index 0000000000..139d177366 --- /dev/null +++ b/board/a9m2440/a9m2410dev.c @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2009 Juergen Beisert + * + * 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 + * + */ + +/** + * @file + * @brief a9m2410dev Baseboad specific initialization routines + * + */ + +#include <common.h> +#include <driver.h> +#include <init.h> +#include <asm/io.h> +#include <asm/arch/s3c24x0-iomap.h> + +/** + * Initialize the CPU to be able to work with the a9m2410dev evaluation board + */ +int a9m2410dev_devices_init(void) +{ + /* ---------- configure the GPIOs ------------- */ + writel(0x007FFFFF, GPACON); + writel(0x00000000, GPCCON); + writel(0x00000000, GPCUP); + writel(0x00000000, GPDCON); + writel(0x00000000, GPDUP); + writel(0xAAAAAAAA, GPECON); + writel(0x0000E03F, GPEUP); + writel(0x00000000, GPBCON); /* all inputs */ + writel(0x00000007, GPBUP); /* pullup disabled for GPB0..3 */ + writel(0x00009000, GPFCON); /* GPF7 CLK_INT#, GPF6 Debug-LED */ + writel(0x000000FF, GPFUP); + writel(readl(GPGDAT) | 0x1010, GPGDAT); /* switch off IDLE_SW#, switch off LCD backlight */ + writel(0x0100A93A, GPGCON); /* switch on USB device */ + writel(0x0000F000, GPGUP); + writel(0x0029FAAA, GPHCON); + + writel((1 << 12) | (0 << 11), GPJDAT); + writel(0x0016aaaa, GPJCON); + writel(~((0<<12)| (1<<11)), GPJUP); + + writel((0 << 12) | (0 << 11), GPJDAT); + writel(0x0016aaaa, GPJCON); + writel(0x00001fff, GPJUP); + + writel(0x00000000, DSC0); + writel(0x00000000, DSC1); + + /* + * USB port1 normal, USB port0 normal, USB1 pads for device + * PCLK output on CLKOUT0, UPLL CLK output on CLKOUT1, + */ + writel((readl(MISCCR) & ~0xFFFF) | 0x0140, MISCCR); + + /* ----------- configure the access to the outer space ---------- */ + reg = readl(BWSCON); + + /* CS#1 to access the network controller */ + reg &= ~0xf0; + reg |= 0xe0; + writel(0x1350, BANKCON1); + + /* CS#2 to the dual 16550 UART */ + reg &= ~0xf00; + reg |= 0x400; + writel(0x0d50, BANKCON2); + + writel(reg, BWSCON); + + /* release the reset signal to the network and UART device */ + reg = readl(MISCCR); + reg |= 0x10000; + writel(reg, MISCCR); + + return 0; +} diff --git a/board/a9m2440/a9m2440.c b/board/a9m2440/a9m2440.c index 1156b198f9..228fbde9f3 100644 --- a/board/a9m2440/a9m2440.c +++ b/board/a9m2440/a9m2440.c @@ -36,6 +36,8 @@ #include <asm/arch/s3c24x0-nand.h> #include <asm/arch/s3c24xx-generic.h> +#include "baseboards.h" + static struct memory_platform_data ram_pdata = { .name = "ram0", .flags = DEVFS_RDWR, @@ -133,40 +135,6 @@ static int a9m2440_devices_init(void) sdram_dev.size = s3c24x0_get_memory_size(); - /* ---------- configure the GPIOs ------------- */ - writel(0x007FFFFF, GPACON); - writel(0x00000000, GPCCON); - writel(0x00000000, GPCUP); - writel(0x00000000, GPDCON); - writel(0x00000000, GPDUP); - writel(0xAAAAAAAA, GPECON); - writel(0x0000E03F, GPEUP); - writel(0x00000000, GPBCON); /* all inputs */ - writel(0x00000007, GPBUP); /* pullup disabled for GPB0..3 */ - writel(0x00009000, GPFCON); /* GPF7 CLK_INT#, GPF6 Debug-LED */ - writel(0x000000FF, GPFUP); - writel(readl(GPGDAT) | 0x1010, GPGDAT); /* switch off IDLE_SW#, switch off LCD backlight */ - writel(0x0100A93A, GPGCON); /* switch on USB device */ - writel(0x0000F000, GPGUP); - writel(0x0029FAAA, GPHCON); - - writel((1 << 12) | (0 << 11), GPJDAT); - writel(0x0016aaaa, GPJCON); - writel(~((0<<12)| (1<<11)), GPJUP); - - writel((0 << 12) | (0 << 11), GPJDAT); - writel(0x0016aaaa, GPJCON); - writel(0x00001fff, GPJUP); - - writel(0x00000000, DSC0); - writel(0x00000000, DSC1); - - /* - * USB port1 normal, USB port0 normal, USB1 pads for device - * PCLK output on CLKOUT0, UPLL CLK output on CLKOUT1, - */ - writel(0x00140, MISCCR); - /* ----------- configure the access to the outer space ---------- */ reg = readl(BWSCON); @@ -175,14 +143,13 @@ static int a9m2440_devices_init(void) reg |= 0x00d00000; /* 16 bit */ writel(0x1f4c, BANKCON5); - /* CS#2 to the dual 16550 UART */ - reg &= ~0xf00; - reg |= 0x400; - writel(0x0d50, BANKCON2); - writel(reg, BWSCON); - /* release the reset signal to the network and UART device */ +#ifdef CONFIG_MACH_A9M2410DEV + a9m2410dev_devices_init(); +#endif + + /* release the reset signal to external devices */ reg = readl(MISCCR); reg |= 0x10000; writel(reg, MISCCR); diff --git a/board/a9m2440/baseboards.h b/board/a9m2440/baseboards.h new file mode 100644 index 0000000000..ec80312b69 --- /dev/null +++ b/board/a9m2440/baseboards.h @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2009 Juergen Beisert + * + * 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 + * + */ + +#ifdef CONFIG_MACH_A9M2410DEV +extern int a9m2410dev_devices_init(void); +#endif |