mvsocvar.h revision 1.4 1 /* $NetBSD: mvsocvar.h,v 1.4 2013/05/29 20:47:14 rkujawa 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 #if defined(ARMADAXP)
51 extern vaddr_t misc_base;
52 #define read_miscreg(o) (*(volatile uint32_t *)(misc_base + (o)))
53 #define write_miscreg(o, v) (*(volatile uint32_t *)(misc_base + (o)) = (v))
54 #endif
55
56 #define read_mlmbreg(o) (*(volatile uint32_t *)(mlmb_base + (o)))
57 #define write_mlmbreg(o, v) (*(volatile uint32_t *)(mlmb_base + (o)) = (v))
58
59 void mvsoc_bootstrap(bus_addr_t);
60 uint16_t mvsoc_model(void);
61 uint8_t mvsoc_rev(void);
62 void *mvsoc_bridge_intr_establish(int, int, int (*)(void *), void *);
63
64 #include <dev/marvell/marvellvar.h>
65
66 enum mvsoc_tags {
67 MVSOC_TAG_INTERNALREG = MARVELL_TAG_MAX,
68
69 ORION_TAG_PEX0_MEM,
70 ORION_TAG_PEX0_IO,
71 ORION_TAG_PEX1_MEM,
72 ORION_TAG_PEX1_IO,
73 ORION_TAG_PCI_MEM,
74 ORION_TAG_PCI_IO,
75 ORION_TAG_DEVICE_CS0,
76 ORION_TAG_DEVICE_CS1,
77 ORION_TAG_DEVICE_CS2,
78 ORION_TAG_FLASH_CS,
79 ORION_TAG_DEVICE_BOOTCS,
80 ORION_TAG_CRYPT,
81
82 KIRKWOOD_TAG_PEX_MEM,
83 KIRKWOOD_TAG_PEX_IO,
84 KIRKWOOD_TAG_PEX1_MEM,
85 KIRKWOOD_TAG_PEX1_IO,
86 KIRKWOOD_TAG_NAND,
87 KIRKWOOD_TAG_SPI,
88 KIRKWOOD_TAG_BOOTROM,
89 KIRKWOOD_TAG_CRYPT,
90
91 ARMADAXP_TAG_PEX00_MEM,
92 ARMADAXP_TAG_PEX00_IO,
93 ARMADAXP_TAG_PEX01_MEM,
94 ARMADAXP_TAG_PEX01_IO,
95 ARMADAXP_TAG_PEX02_MEM,
96 ARMADAXP_TAG_PEX02_IO,
97 ARMADAXP_TAG_PEX03_MEM,
98 ARMADAXP_TAG_PEX03_IO,
99 ARMADAXP_TAG_PEX2_MEM,
100 ARMADAXP_TAG_PEX2_IO,
101 ARMADAXP_TAG_PEX3_MEM,
102 ARMADAXP_TAG_PEX3_IO,
103 };
104 int mvsoc_target(int, uint32_t *, uint32_t *, uint32_t *, uint32_t *);
105
106 void armadaxp_getclks(void);
107 void armadaxp_intr_bootstrap(void);
108
109 void orion_intr_bootstrap(void);
110 void orion_getclks(bus_addr_t);
111
112 void kirkwood_intr_bootstrap(void);
113 void kirkwood_getclks(bus_addr_t);
114
115 #endif /* _MVSOCVAR_H_ */
116