9
0
Fork 0

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>
This commit is contained in:
Juergen Beisert 2009-10-27 19:57:37 +01:00 committed by Sascha Hauer
parent 8a7f837355
commit f5194c3a3e
5 changed files with 138 additions and 40 deletions

View File

@ -14,6 +14,20 @@ config CPU_S3C2440
if ARCH_S3C24xx
menu "Board specific settings "
choice
prompt "A9M2440 baseboard"
depends on MACH_A9M2440
config MACH_A9M2410DEV
bool
prompt "A9M2410dev"
select HAS_CS8900
help
Digi's evaluation board.
endchoice
endmenu
menu "S3C24X0 Features "

View File

@ -1,3 +1,4 @@
obj-y += lowlevel_init.o
obj-y += a9m2440.o
obj-$(CONFIG_MACH_A9M2410DEV) += a9m2410dev.o

View File

@ -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;
}

View File

@ -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);

View File

@ -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