summaryrefslogtreecommitdiff
path: root/src/soc/marvell/mvmap2315/include/soc/pinmux.h
blob: 9a1f8071f78ea16063c327b94808fa6eae9bc55f (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 file is part of the coreboot project.
 *
 * Copyright (C) 2016 Marvell, Inc.
 *
 * 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; version 2 of the License.
 *
 * 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.
 */

#ifndef __SOC_MARVELL_MVMAP2315_PINMUX_H__
#define __SOC_MARVELL_MVMAP2315_PINMUX_H__

#include <stdint.h>

#include <soc/addressmap.h>
#include <types.h>

#define PINMUX(a, b, c, d, e, f) ((struct mvmap2315_pinmux) {		\
				     .pad = a,				\
				     .fun_sel = b,			\
				     .raw_sel = c,			\
				     .dgtb_sel = d,			\
				     .slew = e,				\
				     .pull_sel = f})

#define MVMAP2315_PADWRAP_FUNC_SEL	(BIT(0) | BIT(1) | BIT(2))
#define MVMAP2315_PADWRAP_RAW_SEL	BIT(3)
#define MVMAP2315_PADWRAP_DGTB_SEL	(BIT(4) | BIT(5) | BIT(6) | BIT(7))
#define MVMAP2315_PADWRAP_SLEW		(BIT(11) | BIT(12))
#define MVMAP2315_PADWRAP_PD_EN		BIT(13)
#define MVMAP2315_PADWRAP_PU_EN		BIT(14)

#define MVMAP2315_PADWRAP_FUNC_SEL_SHIFT	0
#define MVMAP2315_PADWRAP_RAW_SEL_SHIFT		3
#define MVMAP2315_PADWRAP_DGTB_SEL_SHIFT	4
#define MVMAP2315_PADWRAP_SLEW_SHIFT		11
struct mvmap2315_pinmux_regs {
	 u32 io_pad_piocfg[72];
	 u8 _reserved0[0xee0];
	 u32 pc_pwrdwn_g29_pwrdn;
	 u32 pc_v18en_lvl_g29;
	 u32 vdd3p3_1p8_g29_reg_pwrdn;
	 u32 pc_pwrdwn_g30_pwrdn;
	 u32 pc_v18en_lvl_g30;
	 u32 vdd3p3_1p8_g30_reg_pwrdn;
	 u32 pc_pwrdwn_g31_pwrdn;
	 u32 pc_v18en_lvl_g31;
	 u32 vdd3p3_1p8_g31_reg_pwrdn;
	 u32 pc_pwrdwn_g32_pwrdn;
	 u32 pc_v18en_lvl_g32;
	 u32 vdd3p3_1p8_g32_reg_pwrdn;
	 u32 pc_pwrdwn_g33_pwrdn;
	 u32 pc_v18en_lvl_g33;
	 u32 vdd3p3_1p8_g33_reg_pwrdn;
};

check_member(mvmap2315_pinmux_regs, vdd3p3_1p8_g33_reg_pwrdn, 0x1038);
static struct mvmap2315_pinmux_regs * const mvmap2315_pinmux
					= (void *)MVMAP2315_PINMUX_BASE;

struct mvmap2315_pinmux {
	u32 pad;
	u32 fun_sel;
	u32 raw_sel;
	u32 dgtb_sel;
	u32 slew;
	u32 pull_sel;
};

check_member(mvmap2315_pinmux, pull_sel, 0x14);

enum {
	PULLNONE = 0,
	PULLDOWN = 1,
	PULLUP = 2
};

void set_pinmux(struct mvmap2315_pinmux pinmux);

#endif /* __SOC_MARVELL_MVMAP2315_PINMUX_H__ */