ff66790f2cc6573d0488e713014d055e068693f5
[rpi-open-firmware.git] / hardware.h
1 /*=============================================================================
2 Copyright (C) 2016 Kristina Brooks
3 All rights reserved.
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 FILE DESCRIPTION
16 Glue code for Broadcom's register definitions as well as certain registers
17 that are missing from the release. This is also used by ARM.
18
19 =============================================================================*/
20
21 #pragma once
22
23 #define VPU_KILL_COMMAND 0xAAAAFFFF
24
25 #define VC4_PERIPH_BASE 0x7E000000
26 #define ARM_PERIPH_BASE 0x20000000
27
28 #define VC4_TO_ARM_PERIPH(addr) ((addr - VC4_PERIPH_BASE) + ARM_PERIPH_BASE)
29
30 #ifdef __arm__
31 #define HW_REGISTER_RW(addr) (*(volatile unsigned int *)(VC4_TO_ARM_PERIPH(addr)))
32 #define HW_REGISTER_RO(addr) (*(const volatile unsigned int *)(VC4_TO_ARM_PERIPH(addr)))
33 #else
34 #define HW_REGISTER_RW(addr) (*(volatile unsigned int *)(addr))
35 #define HW_REGISTER_RO(addr) (*(const volatile unsigned int *)(addr))
36 #endif
37
38 #define mmio_read32(addr) HW_REGISTER_RW(addr)
39 #define mmio_write32(addr, value) (HW_REGISTER_RW(addr) = value)
40
41 #include "hardware_vc4.h"
42
43 /*
44 * this is not included by hardware_vc4.h
45 */
46 #include "bcm2708_chip/aux_io.h"
47
48 /*
49 * LPDDR mode registers.
50 */
51 #define LPDDR2_MR_DEVICE_INFO 0
52 #define LPDDR2_MR_DEVICE_FEATURE_1 1
53 #define LPDDR2_MR_DEVICE_FEATURE_2 2
54 #define LPDDR2_MR_IO_CONFIG 3
55 #define LPDDR2_MR_MANUFACTURER_ID 5
56 #define LPDDR2_MR_REV_1 6
57 #define LPDDR2_MR_REV_2 7
58 #define LPDDR2_MR_METRICS 8
59 #define LPDDR2_MR_CALIBRATION 10
60
61 #define CM_SRC_GND 0
62 #define CM_SRC_OSC 1
63 #define CM_SRC_TESTDEBUG0 2
64 #define CM_SRC_TESTDEBUG1 3
65 #define CM_SRC_PLLA_CORE 4
66 #define CM_SRC_PLLA_PER 4
67 #define CM_SRC_PLLC_CORE0 5
68 #define CM_SRC_PLLC_PER 5
69 #define CM_SRC_PLLC_CORE1 8
70 #define CM_SRC_PLLD_CORE 6
71 #define CM_SRC_PLLD_PER 6
72 #define CM_SRC_PLLH_AUX 7
73 #define CM_SRC_PLLC_CORE1 8
74 #define CM_SRC_PLLC_CORE2 9
This page took 0.06744 seconds and 3 git commands to generate.