Merge branch 'orion' into devel
[powerpc.git] / include / asm-arm / arch-orion / orion.h
1 /*
2  * include/asm-arm/arch-orion/orion.h
3  *
4  * Generic definitions of Orion SoC flavors:
5  *  Orion-1, Orion-NAS, Orion-VoIP, and Orion-2.
6  *
7  * Maintainer: Tzachi Perelstein <tzachi@marvell.com>
8  *
9  * This file is licensed under the terms of the GNU General Public
10  * License version 2. This program is licensed "as is" without any
11  * warranty of any kind, whether express or implied.
12  */
13
14 #ifndef __ASM_ARCH_ORION_H__
15 #define __ASM_ARCH_ORION_H__
16
17 /*******************************************************************************
18  * Orion Address Map
19  * Use the same mapping (1:1 virtual:physical) of internal registers and
20  * PCI system (PCI+PCIE) for all machines.
21  * Each machine defines the rest of its mapping (e.g. device bus flashes)
22  ******************************************************************************/
23 #define ORION_REGS_BASE         0xf1000000
24 #define ORION_REGS_SIZE         SZ_1M
25
26 #define ORION_PCI_SYS_MEM_BASE  0xe0000000
27 #define ORION_PCIE_MEM_BASE     ORION_PCI_SYS_MEM_BASE
28 #define ORION_PCIE_MEM_SIZE     SZ_128M
29 #define ORION_PCI_MEM_BASE      (ORION_PCIE_MEM_BASE + ORION_PCIE_MEM_SIZE)
30 #define ORION_PCI_MEM_SIZE      SZ_128M
31
32 #define ORION_PCI_SYS_IO_BASE   0xf2000000
33 #define ORION_PCIE_IO_BASE      ORION_PCI_SYS_IO_BASE
34 #define ORION_PCIE_IO_SIZE      SZ_1M
35 #define ORION_PCIE_IO_REMAP     (ORION_PCIE_IO_BASE - ORION_PCI_SYS_IO_BASE)
36 #define ORION_PCI_IO_BASE       (ORION_PCIE_IO_BASE + ORION_PCIE_IO_SIZE)
37 #define ORION_PCI_IO_SIZE       SZ_1M
38 #define ORION_PCI_IO_REMAP      (ORION_PCI_IO_BASE - ORION_PCI_SYS_IO_BASE)
39 /* Relevant only for Orion-NAS */
40 #define ORION_PCIE_WA_BASE      0xf0000000
41 #define ORION_PCIE_WA_SIZE      SZ_16M
42
43 /*******************************************************************************
44  * Supported Devices & Revisions
45  ******************************************************************************/
46 /* Orion-1 (88F5181) */
47 #define MV88F5181_DEV_ID        0x5181
48 #define MV88F5181_REV_B1        3
49 /* Orion-NAS (88F5182) */
50 #define MV88F5182_DEV_ID        0x5182
51 #define MV88F5182_REV_A2        2
52 /* Orion-2 (88F5281) */
53 #define MV88F5281_DEV_ID        0x5281
54 #define MV88F5281_REV_D1        5
55 #define MV88F5281_REV_D2        6
56
57 /*******************************************************************************
58  * Orion Registers Map
59  ******************************************************************************/
60 #define ORION_DDR_REG_BASE      (ORION_REGS_BASE | 0x00000)
61 #define ORION_DEV_BUS_REG_BASE  (ORION_REGS_BASE | 0x10000)
62 #define ORION_BRIDGE_REG_BASE   (ORION_REGS_BASE | 0x20000)
63 #define ORION_PCI_REG_BASE      (ORION_REGS_BASE | 0x30000)
64 #define ORION_PCIE_REG_BASE     (ORION_REGS_BASE | 0x40000)
65 #define ORION_USB0_REG_BASE     (ORION_REGS_BASE | 0x50000)
66 #define ORION_ETH_REG_BASE      (ORION_REGS_BASE | 0x70000)
67 #define ORION_SATA_REG_BASE     (ORION_REGS_BASE | 0x80000)
68 #define ORION_USB1_REG_BASE     (ORION_REGS_BASE | 0xa0000)
69
70 #define ORION_DDR_REG(x)        (ORION_DDR_REG_BASE | (x))
71 #define ORION_DEV_BUS_REG(x)    (ORION_DEV_BUS_REG_BASE | (x))
72 #define ORION_BRIDGE_REG(x)     (ORION_BRIDGE_REG_BASE | (x))
73 #define ORION_PCI_REG(x)        (ORION_PCI_REG_BASE | (x))
74 #define ORION_PCIE_REG(x)       (ORION_PCIE_REG_BASE | (x))
75 #define ORION_USB0_REG(x)       (ORION_USB0_REG_BASE | (x))
76 #define ORION_USB1_REG(x)       (ORION_USB1_REG_BASE | (x))
77 #define ORION_ETH_REG(x)        (ORION_ETH_REG_BASE | (x))
78 #define ORION_SATA_REG(x)       (ORION_SATA_REG_BASE | (x))
79
80 /*******************************************************************************
81  * Device Bus Registers
82  ******************************************************************************/
83 #define MPP_0_7_CTRL            ORION_DEV_BUS_REG(0x000)
84 #define MPP_8_15_CTRL           ORION_DEV_BUS_REG(0x004)
85 #define MPP_16_19_CTRL          ORION_DEV_BUS_REG(0x050)
86 #define MPP_DEV_CTRL            ORION_DEV_BUS_REG(0x008)
87 #define MPP_RESET_SAMPLE        ORION_DEV_BUS_REG(0x010)
88 #define GPIO_OUT                ORION_DEV_BUS_REG(0x100)
89 #define GPIO_IO_CONF            ORION_DEV_BUS_REG(0x104)
90 #define GPIO_BLINK_EN           ORION_DEV_BUS_REG(0x108)
91 #define GPIO_IN_POL             ORION_DEV_BUS_REG(0x10c)
92 #define GPIO_DATA_IN            ORION_DEV_BUS_REG(0x110)
93 #define GPIO_EDGE_CAUSE         ORION_DEV_BUS_REG(0x114)
94 #define GPIO_EDGE_MASK          ORION_DEV_BUS_REG(0x118)
95 #define GPIO_LEVEL_MASK         ORION_DEV_BUS_REG(0x11c)
96 #define DEV_BANK_0_PARAM        ORION_DEV_BUS_REG(0x45c)
97 #define DEV_BANK_1_PARAM        ORION_DEV_BUS_REG(0x460)
98 #define DEV_BANK_2_PARAM        ORION_DEV_BUS_REG(0x464)
99 #define DEV_BANK_BOOT_PARAM     ORION_DEV_BUS_REG(0x46c)
100 #define DEV_BUS_CTRL            ORION_DEV_BUS_REG(0x4c0)
101 #define DEV_BUS_INT_CAUSE       ORION_DEV_BUS_REG(0x4d0)
102 #define DEV_BUS_INT_MASK        ORION_DEV_BUS_REG(0x4d4)
103 #define I2C_BASE                ORION_DEV_BUS_REG(0x1000)
104 #define UART0_BASE              ORION_DEV_BUS_REG(0x2000)
105 #define UART1_BASE              ORION_DEV_BUS_REG(0x2100)
106 #define GPIO_MAX                32
107
108 /***************************************************************************
109  * Orion CPU Bridge Registers
110  **************************************************************************/
111 #define CPU_CONF                ORION_BRIDGE_REG(0x100)
112 #define CPU_CTRL                ORION_BRIDGE_REG(0x104)
113 #define CPU_RESET_MASK          ORION_BRIDGE_REG(0x108)
114 #define CPU_SOFT_RESET          ORION_BRIDGE_REG(0x10c)
115 #define POWER_MNG_CTRL_REG      ORION_BRIDGE_REG(0x11C)
116 #define BRIDGE_CAUSE            ORION_BRIDGE_REG(0x110)
117 #define BRIDGE_MASK             ORION_BRIDGE_REG(0x114)
118 #define MAIN_IRQ_CAUSE          ORION_BRIDGE_REG(0x200)
119 #define MAIN_IRQ_MASK           ORION_BRIDGE_REG(0x204)
120 #define TIMER_CTRL              ORION_BRIDGE_REG(0x300)
121 #define TIMER_VAL(x)            ORION_BRIDGE_REG(0x314 + ((x) * 8))
122 #define TIMER_VAL_RELOAD(x)     ORION_BRIDGE_REG(0x310 + ((x) * 8))
123
124 #ifndef __ASSEMBLY__
125
126 /*******************************************************************************
127  * Helpers to access Orion registers
128  ******************************************************************************/
129 #include <asm/types.h>
130 #include <asm/io.h>
131
132 #define orion_read(r)           __raw_readl(r)
133 #define orion_write(r, val)     __raw_writel(val, r)
134
135 /*
136  * These are not preempt safe. Locks, if needed, must be taken care by caller.
137  */
138 #define orion_setbits(r, mask)  orion_write((r), orion_read(r) | (mask))
139 #define orion_clrbits(r, mask)  orion_write((r), orion_read(r) & ~(mask))
140
141 #endif /* __ASSEMBLY__ */
142
143 #endif /* __ASM_ARCH_ORION_H__ */