summaryrefslogtreecommitdiff
path: root/drivers/platform/sprd/io-sc8830.c
blob: a512c892ad6ba76cbc59c5f11c2f986c9864b960 (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
65
66
67
/*
 * Copyright (C) 2012 Spreadtrum Communications Inc.
 * Author: steve.zhan <steve.zhan@spreadtrum.com>
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * 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.
 */

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/bug.h>

#include <asm/io.h>
#include <asm/page.h>
#include <asm/mach/map.h>

#include <soc/sprd/hardware.h>
#include <soc/sprd/arch_misc.h>

#define SPRD_DEVICE(name) {			\
	.virtual = SPRD_##name##_BASE,		\
	.pfn = __phys_to_pfn(SPRD_##name##_PHYS),\
	.length = SPRD_##name##_SIZE,		\
	.type = MT_DEVICE_NONSHARED,		\
	}
#define SPRD_IRAM(name) {			\
	.virtual = SPRD_##name##_BASE,		\
	.pfn = __phys_to_pfn(SPRD_##name##_PHYS),\
	.length = SPRD_##name##_SIZE,		\
	.type = MT_MEMORY,			\
	}

static struct map_desc sprd_io_desc[] __initdata = {
	SPRD_DEVICE(UART0),
	SPRD_DEVICE(UART1),
	SPRD_DEVICE(UART2),
	SPRD_DEVICE(UART3),
	SPRD_DEVICE(UART4),
#ifdef CONFIG_ARCH_SCX20L
	SPRD_DEVICE(ARM7AHBRF),
#endif

	SPRD_IRAM(IRAM0),
	SPRD_IRAM(IRAM0H),
#if defined(CONFIG_ARCH_SCX30G)
        SPRD_IRAM(IRAM1),
	SPRD_DEVICE(LPDDR2_PHY),
#else
        SPRD_DEVICE(IRAM1),
#endif
#ifndef CONFIG_ARCH_SCX35L
	SPRD_DEVICE(IRAM2),
#endif
	SPRD_DEVICE(PWM),
	SPRD_DEVICE(LPDDR2),
};

void __init sci_map_io(void)
{
	iotable_init(sprd_io_desc, ARRAY_SIZE(sprd_io_desc));
}