mvsocvar.h revision 1.11
1/* $NetBSD: mvsocvar.h,v 1.11 2017/01/07 16:19:28 kiyohara 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 33struct 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 42typedef int (*mvsoc_irq_handler_t)(void *); 43 44extern uint32_t mvPclk, mvSysclk, mvTclk; 45extern vaddr_t mlmb_base; 46extern int nwindow, nremap; 47extern int gpp_npins, gpp_irqbase; 48extern struct bus_space mvsoc_bs_tag; 49extern 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 54void mvsoc_bootstrap(bus_addr_t); 55uint16_t mvsoc_model(void); 56uint8_t mvsoc_rev(void); 57void *mvsoc_bridge_intr_establish(int, int, int (*)(void *), void *); 58 59#include <dev/marvell/marvellvar.h> 60 61enum 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 DOVE_TAG_PEX0_MEM, 111 DOVE_TAG_PEX0_IO, 112 DOVE_TAG_PEX1_MEM, 113 DOVE_TAG_PEX1_IO, 114 DOVE_TAG_CRYPT, 115 DOVE_TAG_SPI0, 116 DOVE_TAG_SPI1, 117 DOVE_TAG_BOOTROM, 118 DOVE_TAG_NAND, 119 DOVE_TAG_PMU, 120 121 ARMADAXP_TAG_PEX00_MEM, 122 ARMADAXP_TAG_PEX00_IO, 123 ARMADAXP_TAG_PEX01_MEM, 124 ARMADAXP_TAG_PEX01_IO, 125 ARMADAXP_TAG_PEX02_MEM, 126 ARMADAXP_TAG_PEX02_IO, 127 ARMADAXP_TAG_PEX03_MEM, 128 ARMADAXP_TAG_PEX03_IO, 129 ARMADAXP_TAG_PEX2_MEM, 130 ARMADAXP_TAG_PEX2_IO, 131 ARMADAXP_TAG_PEX3_MEM, 132 ARMADAXP_TAG_PEX3_IO, 133 ARMADAXP_TAG_CRYPT0, 134 ARMADAXP_TAG_CRYPT1, 135}; 136int mvsoc_target(int, uint32_t *, uint32_t *, uint32_t *, uint32_t *); 137int mvsoc_target_dump(struct mvsoc_softc *); 138int mvsoc_attr_dump(struct mvsoc_softc *, uint32_t, uint32_t); 139 140extern void (*mvsoc_intr_init)(void); 141extern int (*mvsoc_clkgating)(struct marvell_attach_args *); 142 143void orion_bootstrap(vaddr_t); 144void kirkwood_bootstrap(vaddr_t); 145void mv78xx0_bootstrap(vaddr_t); 146void dove_bootstrap(vaddr_t); 147void armadaxp_bootstrap(vaddr_t, bus_addr_t); 148 149#endif /* _MVSOCVAR_H_ */ 150