xref: /freebsd/sys/dev/bhnd/cores/chipc/chipc.h (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2015-2016 Landon Fuller <landon@landonf.org>
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer,
12  *    without modification.
13  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
14  *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
15  *    redistribution must be conditioned upon including a substantially
16  *    similar Disclaimer requirement for further binary redistribution.
17  *
18  * NO WARRANTY
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
22  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
23  * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
24  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
27  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29  * THE POSSIBILITY OF SUCH DAMAGES.
30  *
31  */
32 
33 #ifndef _BHND_CORES_CHIPC_CHIPC_H_
34 #define _BHND_CORES_CHIPC_CHIPC_H_
35 
36 #include <dev/bhnd/bhnd.h>
37 #include <dev/bhnd/nvram/bhnd_nvram.h>
38 
39 #include "bhnd_chipc_if.h"
40 
41 /**
42  * Supported ChipCommon flash types.
43  */
44 typedef enum {
45 	CHIPC_FLASH_NONE	= 0,	/**< No flash, or a type unrecognized
46 					     by the ChipCommon driver */
47 	CHIPC_PFLASH_CFI	= 1,	/**< CFI-compatible parallel flash */
48 	CHIPC_SFLASH_ST		= 2,	/**< ST serial flash */
49 	CHIPC_SFLASH_AT		= 3,	/**< Atmel serial flash */
50 	CHIPC_QSFLASH_ST	= 4,	/**< ST quad-SPI flash */
51 	CHIPC_QSFLASH_AT	= 5,	/**< Atmel quad-SPI flash */
52 	CHIPC_NFLASH		= 6,	/**< NAND flash */
53 	CHIPC_NFLASH_4706	= 7	/**< BCM4706 NAND flash */
54 } chipc_flash;
55 
56 /**
57  * ChipCommon capability flags;
58  */
59 struct chipc_caps {
60 	uint8_t		num_uarts;	/**< Number of attached UARTS (1-3) */
61 	bool		mipseb;		/**< MIPS is big-endian */
62 	uint8_t		uart_clock;	/**< UART clock source (see CHIPC_CAP_UCLKSEL_*) */
63 	uint8_t		uart_gpio;	/**< UARTs own GPIO pins 12-15 */
64 
65 	uint8_t		extbus_type;	/**< ExtBus type (CHIPC_CAP_EXTBUS_*) */
66 
67 	chipc_flash 	flash_type;	/**< flash type */
68 	uint8_t		cfi_width;	/**< CFI bus width, 0 if unknown or CFI
69 					     not present */
70 
71 	bhnd_nvram_src	nvram_src;	/**< identified NVRAM source */
72 	bus_size_t	sprom_offset;	/**< Offset to SPROM data within
73 					     SPROM/OTP, 0 if unknown or not
74 					     present */
75 	uint8_t		otp_size;	/**< OTP (row?) size, 0 if not present */
76 
77 	uint8_t		pll_type;	/**< PLL type */
78 	bool		pwr_ctrl;	/**< Power/clock control available */
79 	bool		jtag_master;	/**< JTAG Master present */
80 	bool		boot_rom;	/**< Internal boot ROM is active */
81 	uint8_t		backplane_64;	/**< Backplane supports 64-bit addressing.
82 					     Note that this does not gaurantee
83 					     the CPU itself supports 64-bit
84 					     addressing. */
85 	bool		pmu;		/**< PMU is present. */
86 	bool		eci;		/**< ECI (enhanced coexistence inteface) is present. */
87 	bool		seci;		/**< SECI (serial ECI) is present */
88 	bool		sprom;		/**< SPROM is present */
89 	bool		gsio;		/**< GSIO (SPI/I2C) present */
90 	bool		aob;		/**< AOB (always on bus) present.
91 					     If set, PMU and GCI registers are
92 					     not accessible via ChipCommon,
93 					     and are instead accessible via
94 					     dedicated cores on the bhnd bus */
95 };
96 
97 #endif /* _BHND_CORES_CHIPC_CHIPC_H_ */
98