summaryrefslogtreecommitdiffstats
path: root/arch/arm/boards/clep7212/clep7212.c
blob: a32337fafec1cb4be2fd6615251f8be8d82dc06d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 * Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru>
 *
 * 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.
 */

#include <common.h>
#include <driver.h>
#include <init.h>
#include <partition.h>
#include <io.h>
#include <sizes.h>
#include <asm/armlinux.h>
#include <generated/mach-types.h>

#include <mach/clps711x.h>
#include <mach/devices.h>

static int clps711x_mem_init(void)
{
	ulong memsize = get_ram_size((ulong *)SDRAM0_BASE, SZ_32M);

	arm_add_mem_device("ram0", SDRAM0_BASE, memsize);

	return 0;
}
mem_initcall(clps711x_mem_init);

static int clps711x_devices_init(void)
{
	u32 serial_h = 0, serial_l = readl(UNIQID);

	/* Setup Chipselects */
	clps711x_setup_memcfg(0, MEMCFG_WAITSTATE_6_1 | MEMCFG_BUS_WIDTH_16);
	clps711x_setup_memcfg(1, MEMCFG_WAITSTATE_6_1 | MEMCFG_BUS_WIDTH_8);
	clps711x_setup_memcfg(2, MEMCFG_WAITSTATE_8_3 | MEMCFG_BUS_WIDTH_16 |
			      MEMCFG_CLKENB);
	clps711x_setup_memcfg(3, MEMCFG_WAITSTATE_6_1 | MEMCFG_BUS_WIDTH_32);

	add_cfi_flash_device(0, CS0_BASE, SZ_32M, 0);

	devfs_add_partition("nor0", 0x00000, SZ_256K, DEVFS_PARTITION_FIXED,
			    "self0");
	devfs_add_partition("nor0", SZ_256K, SZ_256K, DEVFS_PARTITION_FIXED,
			    "env0");

	armlinux_set_bootparams((void *)SDRAM0_BASE + 0x100);
	armlinux_set_architecture(MACH_TYPE_CLEP7212);
	armlinux_set_serial(((u64)serial_h << 32) | serial_l);

	return 0;
}
device_initcall(clps711x_devices_init);

static int clps711x_console_init(void)
{
	clps711x_add_uart(0);

	return 0;
}
console_initcall(clps711x_console_init);