Add basic support for mini2440 board to barebox.
[barebox-mini2440.git] / arch / arm / boards / mini2440 / mini2440.c
blob93351bbcc480fff32f05fcf3dee3431203f76d3e
1 /*
2 * Copyright (C) 2010 Marek Belisko <marek.belisko@open-nandra.com>
3 *
4 * based on a9m2440.c board init
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
19 * MA 02111-1307 USA
23 /**
24 * @file
25 * @brief mini2440 Specific Board Initialization routines
29 #include <common.h>
30 #include <driver.h>
31 #include <init.h>
32 #include <asm/armlinux.h>
33 #include <asm/mach-types.h>
34 #include <partition.h>
35 #include <nand.h>
36 #include <asm/io.h>
37 #include <mach/s3c24x0-iomap.h>
38 #include <mach/s3c24x0-nand.h>
39 #include <mach/s3c24xx-generic.h>
41 #include <dm9000.h>
43 static struct memory_platform_data ram_pdata = {
44 .name = "ram0",
45 .flags = DEVFS_RDWR,
48 static struct device_d sdram_dev = {
49 .name = "mem",
50 .map_base = CS6_BASE,
51 .platform_data = &ram_pdata,
56 * dm9000 network controller onboard
59 static struct dm9000_platform_data dm9000_data = {
60 .iobase = 0x20000300,
61 .iodata = 0x20000304,
62 .buswidth = DM9000_WIDTH_16,
63 .srom = 0,
66 static struct device_d dm9000_dev = {
67 .name = "dm9000",
68 .map_base = 0x20000300,
69 .size = 8,
70 .platform_data = &dm9000_data,
76 static int mini2440_devices_init(void)
79 /* ----------- configure the access to the outer space ---------- */
80 reg = readl(BWSCON);
82 /* CS#4 to access the network controller */
83 reg &= ~0x000f0000;
84 reg |= 0x000d0000; /* 16 bit */
85 writel(0x1f4c, BANKCON4);
87 writel(reg, BWSCON);
90 /* release the reset signal to external devices */
91 reg = readl(MISCCR);
92 reg |= 0x10000;
93 writel(reg, MISCCR);
95 register_device(&sdram_dev);
96 register_device(&dm9000_dev);
98 return 0;
101 device_initcall(mini2440_devices_init);
103 static struct device_d a9m2440_serial_device = {
104 .name = "s3c24x0_serial",
105 .map_base = UART1_BASE,
106 .size = UART1_SIZE,
109 static int mini2440_console_init(void)
111 register_device(&mini2440_serial_device);
112 return 0;
115 console_initcall(mini2440_console_init);