mvsocvar.h revision 1.10 1 /* $NetBSD: mvsocvar.h,v 1.10 2015/06/03 04:20:02 hsuenaga Exp $ */
2 /*
3 * Copyright (c) 2007, 2010 KIYOHARA Takashi
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
19 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
24 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 */
27
28 #ifndef _MVSOCVAR_H_
29 #define _MVSOCVAR_H_
30
31 #include <sys/bus.h>
32
33 struct mvsoc_softc {
34 device_t sc_dev;
35
36 bus_addr_t sc_addr;
37 bus_space_tag_t sc_iot;
38 bus_space_handle_t sc_ioh;
39 bus_dma_tag_t sc_dmat;
40 };
41
42 typedef int (*mvsoc_irq_handler_t)(void *);
43
44 extern uint32_t mvPclk, mvSysclk, mvTclk;
45 extern vaddr_t mlmb_base;
46 extern int nwindow, nremap;
47 extern int gpp_npins, gpp_irqbase;
48 extern struct bus_space mvsoc_bs_tag;
49 extern struct arm32_bus_dma_tag mvsoc_bus_dma_tag;
50
51 #define read_mlmbreg(o) (*(volatile uint32_t *)(mlmb_base + (o)))
52 #define write_mlmbreg(o, v) (*(volatile uint32_t *)(mlmb_base + (o)) = (v))
53
54 void mvsoc_bootstrap(bus_addr_t);
55 uint16_t mvsoc_model(void);
56 uint8_t mvsoc_rev(void);
57 void *mvsoc_bridge_intr_establish(int, int, int (*)(void *), void *);
58
59 #include <dev/marvell/marvellvar.h>
60
61 enum mvsoc_tags {
62 MVSOC_TAG_INTERNALREG = MARVELL_TAG_MAX,
63
64 ORION_TAG_PEX0_MEM,
65 ORION_TAG_PEX0_IO,
66 ORION_TAG_PEX1_MEM,
67 ORION_TAG_PEX1_IO,
68 ORION_TAG_PCI_MEM,
69 ORION_TAG_PCI_IO,
70 ORION_TAG_DEVICE_CS0,
71 ORION_TAG_DEVICE_CS1,
72 ORION_TAG_DEVICE_CS2,
73 ORION_TAG_FLASH_CS,
74 ORION_TAG_DEVICE_BOOTCS,
75 ORION_TAG_CRYPT,
76
77 KIRKWOOD_TAG_PEX_MEM,
78 KIRKWOOD_TAG_PEX_IO,
79 KIRKWOOD_TAG_PEX1_MEM,
80 KIRKWOOD_TAG_PEX1_IO,
81 KIRKWOOD_TAG_NAND,
82 KIRKWOOD_TAG_SPI,
83 KIRKWOOD_TAG_BOOTROM,
84 KIRKWOOD_TAG_CRYPT,
85
86 MV78XX0_TAG_DEVICE_CS0,
87 MV78XX0_TAG_DEVICE_CS1,
88 MV78XX0_TAG_DEVICE_CS2,
89 MV78XX0_TAG_DEVICE_CS3,
90 MV78XX0_TAG_DEVICE_BOOTCS,
91 MV78XX0_TAG_SPI,
92 MV78XX0_TAG_PEX0_MEM,
93 MV78XX0_TAG_PEX01_MEM,
94 MV78XX0_TAG_PEX02_MEM,
95 MV78XX0_TAG_PEX03_MEM,
96 MV78XX0_TAG_PEX0_IO,
97 MV78XX0_TAG_PEX01_IO,
98 MV78XX0_TAG_PEX02_IO,
99 MV78XX0_TAG_PEX03_IO,
100 MV78XX0_TAG_PEX1_MEM,
101 MV78XX0_TAG_PEX11_MEM,
102 MV78XX0_TAG_PEX12_MEM,
103 MV78XX0_TAG_PEX13_MEM,
104 MV78XX0_TAG_PEX1_IO,
105 MV78XX0_TAG_PEX11_IO,
106 MV78XX0_TAG_PEX12_IO,
107 MV78XX0_TAG_PEX13_IO,
108 MV78XX0_TAG_CRYPT,
109
110 ARMADAXP_TAG_PEX00_MEM,
111 ARMADAXP_TAG_PEX00_IO,
112 ARMADAXP_TAG_PEX01_MEM,
113 ARMADAXP_TAG_PEX01_IO,
114 ARMADAXP_TAG_PEX02_MEM,
115 ARMADAXP_TAG_PEX02_IO,
116 ARMADAXP_TAG_PEX03_MEM,
117 ARMADAXP_TAG_PEX03_IO,
118 ARMADAXP_TAG_PEX2_MEM,
119 ARMADAXP_TAG_PEX2_IO,
120 ARMADAXP_TAG_PEX3_MEM,
121 ARMADAXP_TAG_PEX3_IO,
122 ARMADAXP_TAG_CRYPT0,
123 ARMADAXP_TAG_CRYPT1,
124 };
125 int mvsoc_target(int, uint32_t *, uint32_t *, uint32_t *, uint32_t *);
126 int mvsoc_target_dump(struct mvsoc_softc *);
127 int mvsoc_attr_dump(struct mvsoc_softc *, uint32_t, uint32_t);
128
129 extern int (*mvsoc_clkgating)(struct marvell_attach_args *);
130
131 void orion_intr_bootstrap(void);
132 void orion_getclks(bus_addr_t);
133
134 void kirkwood_intr_bootstrap(void);
135 void kirkwood_getclks(bus_addr_t);
136 int kirkwood_clkgating(struct marvell_attach_args *);
137
138 void mv78xx0_intr_bootstrap(void);
139 void mv78xx0_getclks(bus_addr_t);
140
141 void armadaxp_intr_bootstrap(bus_addr_t);
142 void armadaxp_getclks(void);
143 void armada370_getclks(void);
144 int armadaxp_clkgating(struct marvell_attach_args *);
145
146 #endif /* _MVSOCVAR_H_ */
147