summaryrefslogtreecommitdiff
path: root/include/linux/vexpress.h
blob: 6b206ba6aa0e992042293c20205305146bf58ceb (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * 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.
 *
 * Copyright (C) 2012 ARM Limited
 */

#ifndef _LINUX_VEXPRESS_H
#define _LINUX_VEXPRESS_H

#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/reboot.h>
#include <linux/regmap.h>

#define VEXPRESS_SITE_MB		0
#define VEXPRESS_SITE_DB1		1
#define VEXPRESS_SITE_DB2		2
#define VEXPRESS_SITE_MASTER		0xf

#define VEXPRESS_GPIO_MMC_CARDIN	0
#define VEXPRESS_GPIO_MMC_WPROT		1
#define VEXPRESS_GPIO_FLASH_WPn		2
#define VEXPRESS_GPIO_LED0		3
#define VEXPRESS_GPIO_LED1		4
#define VEXPRESS_GPIO_LED2		5
#define VEXPRESS_GPIO_LED3		6
#define VEXPRESS_GPIO_LED4		7
#define VEXPRESS_GPIO_LED5		8
#define VEXPRESS_GPIO_LED6		9
#define VEXPRESS_GPIO_LED7		10

#define VEXPRESS_RES_FUNC(_site, _func)	\
{					\
	.start = (_site),		\
	.end = (_func),			\
	.flags = IORESOURCE_BUS,	\
}

/* Config infrastructure */

void vexpress_config_set_master(u32 site);
u32 vexpress_config_get_master(void);

void vexpress_config_lock(void *arg);
void vexpress_config_unlock(void *arg);

int vexpress_config_get_topo(struct device_node *node, u32 *site,
		u32 *position, u32 *dcc);

/* Config bridge API */

struct vexpress_config_bridge_ops {
	struct regmap * (*regmap_init)(struct device *dev, void *context);
	void (*regmap_exit)(struct regmap *regmap, void *context);
};

struct device *vexpress_config_bridge_register(struct device *parent,
		struct vexpress_config_bridge_ops *ops, void *context);

/* Config regmap API */

struct regmap *devm_regmap_init_vexpress_config(struct device *dev);

/* Platform control */

u32 vexpress_get_procid(int site);
u32 vexpress_get_hbi(int site);
void *vexpress_get_24mhz_clock_base(void);
void vexpress_flags_set(u32 data);

void vexpress_sysreg_early_init(void __iomem *base);
void vexpress_sysreg_of_early_init(void);
int vexpress_sysreg_config_device_register(struct platform_device *pdev);

/* Clocks */

void vexpress_clk_init(void __iomem *sp810_base);

#endif