]> git.ipfire.org Git - people/ms/u-boot.git/blame - include/mvmfp.h
NAND: rearrange ONFI revision checking, add ONFI 2.3
[people/ms/u-boot.git] / include / mvmfp.h
CommitLineData
e5f495d1
PW
1/*
2 * (C) Copyright 2010
3 * Marvell Semiconductor <www.marvell.com>
4 * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
5 *
6 * See file CREDITS for list of people who contributed to this
7 * project.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22 * MA 02110-1301 USA
23 */
24
25#ifndef __MVMFP_H
26#define __MVMFP_H
27
28/*
29 * Header file for MultiFunctionPin (MFP) Configururation framework
30 *
31 * Processors Supported:
32 * 1. Marvell ARMADA100 Processors
33 *
34 * processor to be supported should be added here
35 */
36
37/*
38 * MFP configuration is represented by a 32-bit unsigned integer
39 */
40#define MFP(_off, _pull, _pF, _drv, _dF, _edge, _eF, _afn, _aF) ( \
41 /* bits 31..16 - MFP Register Offset */ (((_off) & 0xffff) << 16) | \
42 /* bits 15..13 - Run Mode Pull State */ (((_pull) & 0x7) << 13) | \
43 /* bit 12 - Unused */ \
44 /* bits 11..10 - Driver Strength */ (((_drv) & 0x3) << 10) | \
45 /* bit 09 - Pull State flag */ (((_pF) & 0x1) << 9) | \
46 /* bit 08 - Drv-strength flag */ (((_dF) & 0x1) << 8) | \
47 /* bit 07 - Edge-det flag */ (((_eF) & 0x1) << 7) | \
48 /* bits 06..04 - Edge Detection */ (((_edge) & 0x7) << 4) | \
49 /* bits 03..00 - Alt-fun flag */ (((_aF) & 0x1) << 3) | \
50 /* bits Alternate-fun select */ ((_afn) & 0x7))
51
52/*
53 * to facilitate the definition, the following macros are provided
54 *
55 * offset, pull,pF, drv,dF, edge,eF ,afn,aF
56 */
57#define MFP_OFFSET_MASK MFP(0xffff, 0,0, 0,0, 0,0, 0,0)
58#define MFP_REG(x) MFP(x, 0,0, 0,0, 0,0, 0,0)
59#define MFP_REG_GET_OFFSET(x) ((x & MFP_OFFSET_MASK) >> 16)
60
61#define MFP_AF_FLAG MFP(0x0000, 0,0, 0,0, 0,0, 0,1)
62#define MFP_DRIVE_FLAG MFP(0x0000, 0,0, 0,1, 0,0, 0,0)
63#define MFP_EDGE_FLAG MFP(0x0000, 0,0, 0,0, 0,1, 0,0)
64#define MFP_PULL_FLAG MFP(0x0000, 0,1, 0,0, 0,0, 0,0)
65
66#define MFP_AF0 MFP(0x0000, 0,0, 0,0, 0,0, 0,1)
67#define MFP_AF1 MFP(0x0000, 0,0, 0,0, 0,0, 1,1)
68#define MFP_AF2 MFP(0x0000, 0,0, 0,0, 0,0, 2,1)
69#define MFP_AF3 MFP(0x0000, 0,0, 0,0, 0,0, 3,1)
70#define MFP_AF4 MFP(0x0000, 0,0, 0,0, 0,0, 4,1)
71#define MFP_AF5 MFP(0x0000, 0,0, 0,0, 0,0, 5,1)
72#define MFP_AF6 MFP(0x0000, 0,0, 0,0, 0,0, 6,1)
73#define MFP_AF7 MFP(0x0000, 0,0, 0,0, 0,0, 7,1)
74#define MFP_AF_MASK MFP(0x0000, 0,0, 0,0, 0,0, 7,0)
75
76#define MFP_LPM_EDGE_NONE MFP(0x0000, 0,0, 0,0, 0,1, 0,0)
77#define MFP_LPM_EDGE_RISE MFP(0x0000, 0,0, 0,0, 1,1, 0,0)
78#define MFP_LPM_EDGE_FALL MFP(0x0000, 0,0, 0,0, 2,1, 0,0)
79#define MFP_LPM_EDGE_BOTH MFP(0x0000, 0,0, 0,0, 3,1, 0,0)
80#define MFP_LPM_EDGE_MASK MFP(0x0000, 0,0, 0,0, 3,0, 0,0)
81
82#define MFP_DRIVE_VERY_SLOW MFP(0x0000, 0,0, 0,1, 0,0, 0,0)
83#define MFP_DRIVE_SLOW MFP(0x0000, 0,0, 1,1, 0,0, 0,0)
84#define MFP_DRIVE_MEDIUM MFP(0x0000, 0,0, 2,1, 0,0, 0,0)
85#define MFP_DRIVE_FAST MFP(0x0000, 0,0, 3,1, 0,0, 0,0)
86#define MFP_DRIVE_MASK MFP(0x0000, 0,0, 3,0, 0,0, 0,0)
87
88#define MFP_PULL_NONE MFP(0x0000, 0,1, 0,0, 0,0, 0,0)
89#define MFP_PULL_LOW MFP(0x0000, 1,1, 0,0, 0,0, 0,0)
90#define MFP_PULL_HIGH MFP(0x0000, 2,1, 0,0, 0,0, 0,0)
91#define MFP_PULL_BOTH MFP(0x0000, 3,1, 0,0, 0,0, 0,0)
92#define MFP_PULL_FLOAT MFP(0x0000, 4,1, 0,0, 0,0, 0,0)
93#define MFP_PULL_MASK MFP(0x0000, 7,0, 0,0, 0,0, 0,0)
94
95#define MFP_EOC 0xffffffff /* indicates end-of-conf */
96
97/* Functions */
98void mfp_config(u32 *mfp_cfgs);
99
100#endif /* __MVMFP_H */