]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - include/mvmfp.h
karo: tx48: only print message about cpu_clk, if it was actually changed
[karo-tx-uboot.git] / include / mvmfp.h
1 /*
2  * (C) Copyright 2010
3  * Marvell Semiconductor <www.marvell.com>
4  * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
5  *
6  * SPDX-License-Identifier:     GPL-2.0+
7  */
8
9 #ifndef __MVMFP_H
10 #define __MVMFP_H
11
12 /*
13  * Header file for MultiFunctionPin (MFP) Configururation framework
14  *
15  * Processors Supported:
16  * 1. Marvell ARMADA100 Processors
17  *
18  * processor to be supported should be added here
19  */
20
21 /*
22  * MFP configuration is represented by a 32-bit unsigned integer
23  */
24 #define MFP(_off, _pull, _pF, _drv, _dF, _edge, _eF, _afn, _aF) ( \
25         /* bits 31..16 - MFP Register Offset */ (((_off) & 0xffff) << 16) | \
26         /* bits 15..13 - Run Mode Pull State */ (((_pull) & 0x7) << 13) | \
27         /* bit  12     - Unused */ \
28         /* bits 11..10 - Driver Strength */     (((_drv) & 0x3) << 10) | \
29         /* bit  09     - Pull State flag */     (((_pF) & 0x1) << 9) | \
30         /* bit  08     - Drv-strength flag */   (((_dF) & 0x1) << 8) | \
31         /* bit  07     - Edge-det flag */       (((_eF) & 0x1) << 7) | \
32         /* bits 06..04 - Edge Detection */      (((_edge) & 0x7) << 4) | \
33         /* bits 03..00 - Alt-fun flag */        (((_aF) & 0x1) << 3) | \
34         /* bits Alternate-fun select */         ((_afn) & 0x7))
35
36 /*
37  * to facilitate the definition, the following macros are provided
38  *
39  *                                  offset, pull,pF, drv,dF, edge,eF ,afn,aF
40  */
41 #define MFP_OFFSET_MASK         MFP(0xffff,    0,0,    0,0,     0,0,   0,0)
42 #define MFP_REG(x)              MFP(x,         0,0,    0,0,     0,0,   0,0)
43 #define MFP_REG_GET_OFFSET(x)   ((x & MFP_OFFSET_MASK) >> 16)
44
45 #define MFP_AF_FLAG             MFP(0x0000,    0,0,    0,0,     0,0,   0,1)
46 #define MFP_DRIVE_FLAG          MFP(0x0000,    0,0,    0,1,     0,0,   0,0)
47 #define MFP_EDGE_FLAG           MFP(0x0000,    0,0,    0,0,     0,1,   0,0)
48 #define MFP_PULL_FLAG           MFP(0x0000,    0,1,    0,0,     0,0,   0,0)
49
50 #define MFP_AF0                 MFP(0x0000,    0,0,    0,0,     0,0,   0,1)
51 #define MFP_AF1                 MFP(0x0000,    0,0,    0,0,     0,0,   1,1)
52 #define MFP_AF2                 MFP(0x0000,    0,0,    0,0,     0,0,   2,1)
53 #define MFP_AF3                 MFP(0x0000,    0,0,    0,0,     0,0,   3,1)
54 #define MFP_AF4                 MFP(0x0000,    0,0,    0,0,     0,0,   4,1)
55 #define MFP_AF5                 MFP(0x0000,    0,0,    0,0,     0,0,   5,1)
56 #define MFP_AF6                 MFP(0x0000,    0,0,    0,0,     0,0,   6,1)
57 #define MFP_AF7                 MFP(0x0000,    0,0,    0,0,     0,0,   7,1)
58 #define MFP_AF_MASK             MFP(0x0000,    0,0,    0,0,     0,0,   7,0)
59
60 #define MFP_LPM_EDGE_NONE       MFP(0x0000,    0,0,    0,0,     0,1,   0,0)
61 #define MFP_LPM_EDGE_RISE       MFP(0x0000,    0,0,    0,0,     1,1,   0,0)
62 #define MFP_LPM_EDGE_FALL       MFP(0x0000,    0,0,    0,0,     2,1,   0,0)
63 #define MFP_LPM_EDGE_BOTH       MFP(0x0000,    0,0,    0,0,     3,1,   0,0)
64 #define MFP_LPM_EDGE_MASK       MFP(0x0000,    0,0,    0,0,     3,0,   0,0)
65
66 #define MFP_DRIVE_VERY_SLOW     MFP(0x0000,    0,0,    0,1,     0,0,   0,0)
67 #define MFP_DRIVE_SLOW          MFP(0x0000,    0,0,    1,1,     0,0,   0,0)
68 #define MFP_DRIVE_MEDIUM        MFP(0x0000,    0,0,    2,1,     0,0,   0,0)
69 #define MFP_DRIVE_FAST          MFP(0x0000,    0,0,    3,1,     0,0,   0,0)
70 #define MFP_DRIVE_MASK          MFP(0x0000,    0,0,    3,0,     0,0,   0,0)
71
72 #define MFP_PULL_NONE           MFP(0x0000,    0,1,    0,0,     0,0,   0,0)
73 #define MFP_PULL_LOW            MFP(0x0000,    1,1,    0,0,     0,0,   0,0)
74 #define MFP_PULL_HIGH           MFP(0x0000,    2,1,    0,0,     0,0,   0,0)
75 #define MFP_PULL_BOTH           MFP(0x0000,    3,1,    0,0,     0,0,   0,0)
76 #define MFP_PULL_FLOAT          MFP(0x0000,    4,1,    0,0,     0,0,   0,0)
77 #define MFP_PULL_MASK           MFP(0x0000,    7,0,    0,0,     0,0,   0,0)
78
79 #define MFP_EOC                 0xffffffff      /* indicates end-of-conf */
80
81 /* Functions */
82 void mfp_config(u32 *mfp_cfgs);
83
84 #endif /* __MVMFP_H */