xref: /netbsd-src/sys/arch/arm/marvell/mvsocvar.h (revision a5847cc334d9a7029f6352b847e9e8d71a0f9e0c)
1 /*	$NetBSD: mvsocvar.h,v 1.2 2011/07/01 20:30:21 dyoung 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_NAND,
80 	KIRKWOOD_TAG_SPI,
81 	KIRKWOOD_TAG_BOOTROM,
82 	KIRKWOOD_TAG_CRYPT,
83 };
84 int mvsoc_target(int, uint32_t *, uint32_t *, uint32_t *, uint32_t *);
85 
86 void orion_getclks(bus_addr_t);
87 void orion_intr_bootstrap(void);
88 
89 void kirkwood_getclks(bus_addr_t);
90 void kirkwood_intr_bootstrap(void);
91 
92 #endif	/* _MVSOCVAR_H_ */
93