Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 1 | /* |
Marek Vasut | c73bad9 | 2019-06-17 19:10:05 +0200 | [diff] [blame] | 2 | * Copyright (c) 2015-2019, Renesas Electronics Corporation |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 3 | * All rights reserved. |
| 4 | * |
| 5 | * SPDX-License-Identifier: BSD-3-Clause |
| 6 | */ |
| 7 | |
| 8 | #include <stdint.h> /* for uint32_t */ |
Ambroise Vincent | ffbf32a | 2019-03-28 09:01:18 +0000 | [diff] [blame] | 9 | #include <lib/mmio.h> |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 10 | #include "pfc_init_v3m.h" |
| 11 | #include "include/rcar_def.h" |
| 12 | #include "rcar_private.h" |
Marek Vasut | c73bad9 | 2019-06-17 19:10:05 +0200 | [diff] [blame] | 13 | #include "../pfc_regs.h" |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 14 | |
| 15 | /* Pin functon bit */ |
Marek Vasut | 264fdb3 | 2019-06-17 19:16:18 +0200 | [diff] [blame] | 16 | #define GPSR0_DU_EXODDF_DU_ODDF_DISP_CDE BIT(21) |
| 17 | #define GPSR0_DU_EXVSYNC_DU_VSYNC BIT(20) |
| 18 | #define GPSR0_DU_EXHSYNC_DU_HSYNC BIT(19) |
| 19 | #define GPSR0_DU_DOTCLKOUT BIT(18) |
| 20 | #define GPSR0_DU_DB7 BIT(17) |
| 21 | #define GPSR0_DU_DB6 BIT(16) |
| 22 | #define GPSR0_DU_DB5 BIT(15) |
| 23 | #define GPSR0_DU_DB4 BIT(14) |
| 24 | #define GPSR0_DU_DB3 BIT(13) |
| 25 | #define GPSR0_DU_DB2 BIT(12) |
| 26 | #define GPSR0_DU_DG7 BIT(11) |
| 27 | #define GPSR0_DU_DG6 BIT(10) |
| 28 | #define GPSR0_DU_DG5 BIT(9) |
| 29 | #define GPSR0_DU_DG4 BIT(8) |
| 30 | #define GPSR0_DU_DG3 BIT(7) |
| 31 | #define GPSR0_DU_DG2 BIT(6) |
| 32 | #define GPSR0_DU_DR7 BIT(5) |
| 33 | #define GPSR0_DU_DR6 BIT(4) |
| 34 | #define GPSR0_DU_DR5 BIT(3) |
| 35 | #define GPSR0_DU_DR4 BIT(2) |
| 36 | #define GPSR0_DU_DR3 BIT(1) |
| 37 | #define GPSR0_DU_DR2 BIT(0) |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 38 | |
Marek Vasut | 264fdb3 | 2019-06-17 19:16:18 +0200 | [diff] [blame] | 39 | #define GPSR1_DIGRF_CLKOUT BIT(27) |
| 40 | #define GPSR1_DIGRF_CLKIN BIT(26) |
| 41 | #define GPSR1_CANFD_CLK BIT(25) |
| 42 | #define GPSR1_CANFD1_RX BIT(24) |
| 43 | #define GPSR1_CANFD1_TX BIT(23) |
| 44 | #define GPSR1_CANFD0_RX BIT(22) |
| 45 | #define GPSR1_CANFD0_TX BIT(21) |
| 46 | #define GPSR1_AVB0_AVTP_CAPTURE BIT(20) |
| 47 | #define GPSR1_AVB0_AVTP_MATCH BIT(19) |
| 48 | #define GPSR1_AVB0_LINK BIT(18) |
| 49 | #define GPSR1_AVB0_PHY_INT BIT(17) |
| 50 | #define GPSR1_AVB0_MAGIC BIT(16) |
| 51 | #define GPSR1_AVB0_MDC BIT(15) |
| 52 | #define GPSR1_AVB0_MDIO BIT(14) |
| 53 | #define GPSR1_AVB0_TXCREFCLK BIT(13) |
| 54 | #define GPSR1_AVB0_TD3 BIT(12) |
| 55 | #define GPSR1_AVB0_TD2 BIT(11) |
| 56 | #define GPSR1_AVB0_TD1 BIT(10) |
| 57 | #define GPSR1_AVB0_TD0 BIT(9) |
| 58 | #define GPSR1_AVB0_TXC BIT(8) |
| 59 | #define GPSR1_AVB0_TX_CTL BIT(7) |
| 60 | #define GPSR1_AVB0_RD3 BIT(6) |
| 61 | #define GPSR1_AVB0_RD2 BIT(5) |
| 62 | #define GPSR1_AVB0_RD1 BIT(4) |
| 63 | #define GPSR1_AVB0_RD0 BIT(3) |
| 64 | #define GPSR1_AVB0_RXC BIT(2) |
| 65 | #define GPSR1_AVB0_RX_CTL BIT(1) |
| 66 | #define GPSR1_IRQ0 BIT(0) |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 67 | |
Marek Vasut | 264fdb3 | 2019-06-17 19:16:18 +0200 | [diff] [blame] | 68 | #define GPSR2_VI0_FIELD BIT(16) |
| 69 | #define GPSR2_VI0_DATA11 BIT(15) |
| 70 | #define GPSR2_VI0_DATA10 BIT(14) |
| 71 | #define GPSR2_VI0_DATA9 BIT(13) |
| 72 | #define GPSR2_VI0_DATA8 BIT(12) |
| 73 | #define GPSR2_VI0_DATA7 BIT(11) |
| 74 | #define GPSR2_VI0_DATA6 BIT(10) |
| 75 | #define GPSR2_VI0_DATA5 BIT(9) |
| 76 | #define GPSR2_VI0_DATA4 BIT(8) |
| 77 | #define GPSR2_VI0_DATA3 BIT(7) |
| 78 | #define GPSR2_VI0_DATA2 BIT(6) |
| 79 | #define GPSR2_VI0_DATA1 BIT(5) |
| 80 | #define GPSR2_VI0_DATA0 BIT(4) |
| 81 | #define GPSR2_VI0_VSYNC_N BIT(3) |
| 82 | #define GPSR2_VI0_HSYNC_N BIT(2) |
| 83 | #define GPSR2_VI0_CLKENB BIT(1) |
| 84 | #define GPSR2_VI0_CLK BIT(0) |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 85 | |
Marek Vasut | 264fdb3 | 2019-06-17 19:16:18 +0200 | [diff] [blame] | 86 | #define GPSR3_VI1_FIELD BIT(16) |
| 87 | #define GPSR3_VI1_DATA11 BIT(15) |
| 88 | #define GPSR3_VI1_DATA10 BIT(14) |
| 89 | #define GPSR3_VI1_DATA9 BIT(13) |
| 90 | #define GPSR3_VI1_DATA8 BIT(12) |
| 91 | #define GPSR3_VI1_DATA7 BIT(11) |
| 92 | #define GPSR3_VI1_DATA6 BIT(10) |
| 93 | #define GPSR3_VI1_DATA5 BIT(9) |
| 94 | #define GPSR3_VI1_DATA4 BIT(8) |
| 95 | #define GPSR3_VI1_DATA3 BIT(7) |
| 96 | #define GPSR3_VI1_DATA2 BIT(6) |
| 97 | #define GPSR3_VI1_DATA1 BIT(5) |
| 98 | #define GPSR3_VI1_DATA0 BIT(4) |
| 99 | #define GPSR3_VI1_VSYNC_N BIT(3) |
| 100 | #define GPSR3_VI1_HSYNC_N BIT(2) |
| 101 | #define GPSR3_VI1_CLKENB BIT(1) |
| 102 | #define GPSR3_VI1_CLK BIT(0) |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 103 | |
Marek Vasut | 264fdb3 | 2019-06-17 19:16:18 +0200 | [diff] [blame] | 104 | #define GPSR4_SDA2 BIT(5) |
| 105 | #define GPSR4_SCL2 BIT(4) |
| 106 | #define GPSR4_SDA1 BIT(3) |
| 107 | #define GPSR4_SCL1 BIT(2) |
| 108 | #define GPSR4_SDA0 BIT(1) |
| 109 | #define GPSR4_SCL0 BIT(0) |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 110 | |
Marek Vasut | 264fdb3 | 2019-06-17 19:16:18 +0200 | [diff] [blame] | 111 | #define GPSR5_RPC_INT_N BIT(14) |
| 112 | #define GPSR5_RPC_WP_N BIT(13) |
| 113 | #define GPSR5_RPC_RESET_N BIT(12) |
| 114 | #define GPSR5_QSPI1_SSL BIT(11) |
| 115 | #define GPSR5_QSPI1_IO3 BIT(10) |
| 116 | #define GPSR5_QSPI1_IO2 BIT(9) |
| 117 | #define GPSR5_QSPI1_MISO_IO1 BIT(8) |
| 118 | #define GPSR5_QSPI1_MOSI_IO0 BIT(7) |
| 119 | #define GPSR5_QSPI1_SPCLK BIT(6) |
| 120 | #define GPSR5_QSPI0_SSL BIT(5) |
| 121 | #define GPSR5_QSPI0_IO3 BIT(4) |
| 122 | #define GPSR5_QSPI0_IO2 BIT(3) |
| 123 | #define GPSR5_QSPI0_MISO_IO1 BIT(2) |
| 124 | #define GPSR5_QSPI0_MOSI_IO0 BIT(1) |
| 125 | #define GPSR5_QSPI0_SPCLK BIT(0) |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 126 | |
Marek Vasut | 4dd0dfa | 2019-06-17 19:15:33 +0200 | [diff] [blame] | 127 | #define IPSR_28_FUNC(x) ((uint32_t)(x) << 28U) |
| 128 | #define IPSR_24_FUNC(x) ((uint32_t)(x) << 24U) |
| 129 | #define IPSR_20_FUNC(x) ((uint32_t)(x) << 20U) |
| 130 | #define IPSR_16_FUNC(x) ((uint32_t)(x) << 16U) |
| 131 | #define IPSR_12_FUNC(x) ((uint32_t)(x) << 12U) |
| 132 | #define IPSR_8_FUNC(x) ((uint32_t)(x) << 8U) |
| 133 | #define IPSR_4_FUNC(x) ((uint32_t)(x) << 4U) |
| 134 | #define IPSR_0_FUNC(x) ((uint32_t)(x) << 0U) |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 135 | |
Marek Vasut | 264fdb3 | 2019-06-17 19:16:18 +0200 | [diff] [blame] | 136 | #define IOCTRL30_POC_VI0_DATA5 BIT(31) |
| 137 | #define IOCTRL30_POC_VI0_DATA4 BIT(30) |
| 138 | #define IOCTRL30_POC_VI0_DATA3 BIT(29) |
| 139 | #define IOCTRL30_POC_VI0_DATA2 BIT(28) |
| 140 | #define IOCTRL30_POC_VI0_DATA1 BIT(27) |
| 141 | #define IOCTRL30_POC_VI0_DATA0 BIT(26) |
| 142 | #define IOCTRL30_POC_VI0_VSYNC_N BIT(25) |
| 143 | #define IOCTRL30_POC_VI0_HSYNC_N BIT(24) |
| 144 | #define IOCTRL30_POC_VI0_CLKENB BIT(23) |
| 145 | #define IOCTRL30_POC_VI0_CLK BIT(22) |
| 146 | #define IOCTRL30_POC_DU_EXODDF_DU_ODDF_DISP_CDE BIT(21) |
| 147 | #define IOCTRL30_POC_DU_EXVSYNC_DU_VSYNC BIT(20) |
| 148 | #define IOCTRL30_POC_DU_EXHSYNC_DU_HSYNC BIT(19) |
| 149 | #define IOCTRL30_POC_DU_DOTCLKOUT BIT(18) |
| 150 | #define IOCTRL30_POC_DU_DB7 BIT(17) |
| 151 | #define IOCTRL30_POC_DU_DB6 BIT(16) |
| 152 | #define IOCTRL30_POC_DU_DB5 BIT(15) |
| 153 | #define IOCTRL30_POC_DU_DB4 BIT(14) |
| 154 | #define IOCTRL30_POC_DU_DB3 BIT(13) |
| 155 | #define IOCTRL30_POC_DU_DB2 BIT(12) |
| 156 | #define IOCTRL30_POC_DU_DG7 BIT(11) |
| 157 | #define IOCTRL30_POC_DU_DG6 BIT(10) |
| 158 | #define IOCTRL30_POC_DU_DG5 BIT(9) |
| 159 | #define IOCTRL30_POC_DU_DG4 BIT(8) |
| 160 | #define IOCTRL30_POC_DU_DG3 BIT(7) |
| 161 | #define IOCTRL30_POC_DU_DG2 BIT(6) |
| 162 | #define IOCTRL30_POC_DU_DR7 BIT(5) |
| 163 | #define IOCTRL30_POC_DU_DR6 BIT(4) |
| 164 | #define IOCTRL30_POC_DU_DR5 BIT(3) |
| 165 | #define IOCTRL30_POC_DU_DR4 BIT(2) |
| 166 | #define IOCTRL30_POC_DU_DR3 BIT(1) |
| 167 | #define IOCTRL30_POC_DU_DR2 BIT(0) |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 168 | |
Marek Vasut | 264fdb3 | 2019-06-17 19:16:18 +0200 | [diff] [blame] | 169 | #define IOCTRL31_POC_DUMMY_31 BIT(31) |
| 170 | #define IOCTRL31_POC_DUMMY_30 BIT(30) |
| 171 | #define IOCTRL31_POC_DUMMY_29 BIT(29) |
| 172 | #define IOCTRL31_POC_DUMMY_28 BIT(28) |
| 173 | #define IOCTRL31_POC_DUMMY_27 BIT(27) |
| 174 | #define IOCTRL31_POC_DUMMY_26 BIT(26) |
| 175 | #define IOCTRL31_POC_DUMMY_25 BIT(25) |
| 176 | #define IOCTRL31_POC_DUMMY_24 BIT(24) |
| 177 | #define IOCTRL31_POC_VI1_FIELD BIT(23) |
| 178 | #define IOCTRL31_POC_VI1_DATA11 BIT(22) |
| 179 | #define IOCTRL31_POC_VI1_DATA10 BIT(21) |
| 180 | #define IOCTRL31_POC_VI1_DATA9 BIT(20) |
| 181 | #define IOCTRL31_POC_VI1_DATA8 BIT(19) |
| 182 | #define IOCTRL31_POC_VI1_DATA7 BIT(18) |
| 183 | #define IOCTRL31_POC_VI1_DATA6 BIT(17) |
| 184 | #define IOCTRL31_POC_VI1_DATA5 BIT(16) |
| 185 | #define IOCTRL31_POC_VI1_DATA4 BIT(15) |
| 186 | #define IOCTRL31_POC_VI1_DATA3 BIT(14) |
| 187 | #define IOCTRL31_POC_VI1_DATA2 BIT(13) |
| 188 | #define IOCTRL31_POC_VI1_DATA1 BIT(12) |
| 189 | #define IOCTRL31_POC_VI1_DATA0 BIT(11) |
| 190 | #define IOCTRL31_POC_VI1_VSYNC_N BIT(10) |
| 191 | #define IOCTRL31_POC_VI1_HSYNC_N BIT(9) |
| 192 | #define IOCTRL31_POC_VI1_CLKENB BIT(8) |
| 193 | #define IOCTRL31_POC_VI1_CLK BIT(7) |
| 194 | #define IOCTRL31_POC_VI0_FIELD BIT(6) |
| 195 | #define IOCTRL31_POC_VI0_DATA11 BIT(5) |
| 196 | #define IOCTRL31_POC_VI0_DATA10 BIT(4) |
| 197 | #define IOCTRL31_POC_VI0_DATA9 BIT(3) |
| 198 | #define IOCTRL31_POC_VI0_DATA8 BIT(2) |
| 199 | #define IOCTRL31_POC_VI0_DATA7 BIT(1) |
| 200 | #define IOCTRL31_POC_VI0_DATA6 BIT(0) |
| 201 | #define IOCTRL32_POC2_VREF BIT(0) |
| 202 | #define IOCTRL40_SD0TDSEL1 BIT(1) |
| 203 | #define IOCTRL40_SD0TDSEL0 BIT(0) |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 204 | |
Marek Vasut | 264fdb3 | 2019-06-17 19:16:18 +0200 | [diff] [blame] | 205 | #define PUEN0_PUEN_VI0_CLK BIT(31) |
| 206 | #define PUEN0_PUEN_TDI BIT(30) |
| 207 | #define PUEN0_PUEN_TMS BIT(29) |
| 208 | #define PUEN0_PUEN_TCK BIT(28) |
| 209 | #define PUEN0_PUEN_TRST_N BIT(27) |
| 210 | #define PUEN0_PUEN_IRQ0 BIT(26) |
| 211 | #define PUEN0_PUEN_FSCLKST_N BIT(25) |
| 212 | #define PUEN0_PUEN_EXTALR BIT(24) |
| 213 | #define PUEN0_PUEN_PRESETOUT_N BIT(23) |
| 214 | #define PUEN0_PUEN_DU_DOTCLKIN BIT(22) |
| 215 | #define PUEN0_PUEN_DU_EXODDF_DU_ODDF_DISP_CDE BIT(21) |
| 216 | #define PUEN0_PUEN_DU_EXVSYNC_DU_VSYNC BIT(20) |
| 217 | #define PUEN0_PUEN_DU_EXHSYNC_DU_HSYNC BIT(19) |
| 218 | #define PUEN0_PUEN_DU_DOTCLKOUT BIT(18) |
| 219 | #define PUEN0_PUEN_DU_DB7 BIT(17) |
| 220 | #define PUEN0_PUEN_DU_DB6 BIT(16) |
| 221 | #define PUEN0_PUEN_DU_DB5 BIT(15) |
| 222 | #define PUEN0_PUEN_DU_DB4 BIT(14) |
| 223 | #define PUEN0_PUEN_DU_DB3 BIT(13) |
| 224 | #define PUEN0_PUEN_DU_DB2 BIT(12) |
| 225 | #define PUEN0_PUEN_DU_DG7 BIT(11) |
| 226 | #define PUEN0_PUEN_DU_DG6 BIT(10) |
| 227 | #define PUEN0_PUEN_DU_DG5 BIT(9) |
| 228 | #define PUEN0_PUEN_DU_DG4 BIT(8) |
| 229 | #define PUEN0_PUEN_DU_DG3 BIT(7) |
| 230 | #define PUEN0_PUEN_DU_DG2 BIT(6) |
| 231 | #define PUEN0_PUEN_DU_DR7 BIT(5) |
| 232 | #define PUEN0_PUEN_DU_DR6 BIT(4) |
| 233 | #define PUEN0_PUEN_DU_DR5 BIT(3) |
| 234 | #define PUEN0_PUEN_DU_DR4 BIT(2) |
| 235 | #define PUEN0_PUEN_DU_DR3 BIT(1) |
| 236 | #define PUEN0_PUEN_DU_DR2 BIT(0) |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 237 | |
Marek Vasut | 264fdb3 | 2019-06-17 19:16:18 +0200 | [diff] [blame] | 238 | #define PUEN1_PUEN_VI1_DATA11 BIT(31) |
| 239 | #define PUEN1_PUEN_VI1_DATA10 BIT(30) |
| 240 | #define PUEN1_PUEN_VI1_DATA9 BIT(29) |
| 241 | #define PUEN1_PUEN_VI1_DATA8 BIT(28) |
| 242 | #define PUEN1_PUEN_VI1_DATA7 BIT(27) |
| 243 | #define PUEN1_PUEN_VI1_DATA6 BIT(26) |
| 244 | #define PUEN1_PUEN_VI1_DATA5 BIT(25) |
| 245 | #define PUEN1_PUEN_VI1_DATA4 BIT(24) |
| 246 | #define PUEN1_PUEN_VI1_DATA3 BIT(23) |
| 247 | #define PUEN1_PUEN_VI1_DATA2 BIT(22) |
| 248 | #define PUEN1_PUEN_VI1_DATA1 BIT(21) |
| 249 | #define PUEN1_PUEN_VI1_DATA0 BIT(20) |
| 250 | #define PUEN1_PUEN_VI1_VSYNC_N BIT(19) |
| 251 | #define PUEN1_PUEN_VI1_HSYNC_N BIT(18) |
| 252 | #define PUEN1_PUEN_VI1_CLKENB BIT(17) |
| 253 | #define PUEN1_PUEN_VI1_CLK BIT(16) |
| 254 | #define PUEN1_PUEN_VI0_FIELD BIT(15) |
| 255 | #define PUEN1_PUEN_VI0_DATA11 BIT(14) |
| 256 | #define PUEN1_PUEN_VI0_DATA10 BIT(13) |
| 257 | #define PUEN1_PUEN_VI0_DATA9 BIT(12) |
| 258 | #define PUEN1_PUEN_VI0_DATA8 BIT(11) |
| 259 | #define PUEN1_PUEN_VI0_DATA7 BIT(10) |
| 260 | #define PUEN1_PUEN_VI0_DATA6 BIT(9) |
| 261 | #define PUEN1_PUEN_VI0_DATA5 BIT(8) |
| 262 | #define PUEN1_PUEN_VI0_DATA4 BIT(7) |
| 263 | #define PUEN1_PUEN_VI0_DATA3 BIT(6) |
| 264 | #define PUEN1_PUEN_VI0_DATA2 BIT(5) |
| 265 | #define PUEN1_PUEN_VI0_DATA1 BIT(4) |
| 266 | #define PUEN1_PUEN_VI0_DATA0 BIT(3) |
| 267 | #define PUEN1_PUEN_VI0_VSYNC_N BIT(2) |
| 268 | #define PUEN1_PUEN_VI0_HSYNC_N BIT(1) |
| 269 | #define PUEN1_PUEN_VI0_CLKENB BIT(0) |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 270 | |
Marek Vasut | 264fdb3 | 2019-06-17 19:16:18 +0200 | [diff] [blame] | 271 | #define PUEN2_PUEN_CANFD_CLK BIT(31) |
| 272 | #define PUEN2_PUEN_CANFD1_RX BIT(30) |
| 273 | #define PUEN2_PUEN_CANFD1_TX BIT(29) |
| 274 | #define PUEN2_PUEN_CANFD0_RX BIT(28) |
| 275 | #define PUEN2_PUEN_CANFD0_TX BIT(27) |
| 276 | #define PUEN2_PUEN_AVB0_AVTP_CAPTURE BIT(26) |
| 277 | #define PUEN2_PUEN_AVB0_AVTP_MATCH BIT(25) |
| 278 | #define PUEN2_PUEN_AVB0_LINK BIT(24) |
| 279 | #define PUEN2_PUEN_AVB0_PHY_INT BIT(23) |
| 280 | #define PUEN2_PUEN_AVB0_MAGIC BIT(22) |
| 281 | #define PUEN2_PUEN_AVB0_MDC BIT(21) |
| 282 | #define PUEN2_PUEN_AVB0_MDIO BIT(20) |
| 283 | #define PUEN2_PUEN_AVB0_TXCREFCLK BIT(19) |
| 284 | #define PUEN2_PUEN_AVB0_TD3 BIT(18) |
| 285 | #define PUEN2_PUEN_AVB0_TD2 BIT(17) |
| 286 | #define PUEN2_PUEN_AVB0_TD1 BIT(16) |
| 287 | #define PUEN2_PUEN_AVB0_TD0 BIT(15) |
| 288 | #define PUEN2_PUEN_AVB0_TXC BIT(14) |
| 289 | #define PUEN2_PUEN_AVB0_TX_CTL BIT(13) |
| 290 | #define PUEN2_PUEN_AVB0_RD3 BIT(12) |
| 291 | #define PUEN2_PUEN_AVB0_RD2 BIT(11) |
| 292 | #define PUEN2_PUEN_AVB0_RD1 BIT(10) |
| 293 | #define PUEN2_PUEN_AVB0_RD0 BIT(9) |
| 294 | #define PUEN2_PUEN_AVB0_RXC BIT(8) |
| 295 | #define PUEN2_PUEN_AVB0_RX_CTL BIT(7) |
| 296 | #define PUEN2_PUEN_SDA2 BIT(6) |
| 297 | #define PUEN2_PUEN_SCL2 BIT(5) |
| 298 | #define PUEN2_PUEN_SDA1 BIT(4) |
| 299 | #define PUEN2_PUEN_SCL1 BIT(3) |
| 300 | #define PUEN2_PUEN_SDA0 BIT(2) |
| 301 | #define PUEN2_PUEN_SCL0 BIT(1) |
| 302 | #define PUEN2_PUEN_VI1_FIELD BIT(0) |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 303 | |
Marek Vasut | 264fdb3 | 2019-06-17 19:16:18 +0200 | [diff] [blame] | 304 | #define PUEN3_PUEN_DIGRF_CLKOUT BIT(16) |
| 305 | #define PUEN3_PUEN_DIGRF_CLKIN BIT(15) |
| 306 | #define PUEN3_PUEN_RPC_INT_N BIT(14) |
| 307 | #define PUEN3_PUEN_RPC_WP_N BIT(13) |
| 308 | #define PUEN3_PUEN_RPC_RESET_N BIT(12) |
| 309 | #define PUEN3_PUEN_QSPI1_SSL BIT(11) |
| 310 | #define PUEN3_PUEN_QSPI1_IO3 BIT(10) |
| 311 | #define PUEN3_PUEN_QSPI1_IO2 BIT(9) |
| 312 | #define PUEN3_PUEN_QSPI1_MISO_IO1 BIT(8) |
| 313 | #define PUEN3_PUEN_QSPI1_MOSI_IO0 BIT(7) |
| 314 | #define PUEN3_PUEN_QSPI1_SPCLK BIT(6) |
| 315 | #define PUEN3_PUEN_QSPI0_SSL BIT(5) |
| 316 | #define PUEN3_PUEN_QSPI0_IO3 BIT(4) |
| 317 | #define PUEN3_PUEN_QSPI0_IO2 BIT(3) |
| 318 | #define PUEN3_PUEN_QSPI0_MISO_IO1 BIT(2) |
| 319 | #define PUEN3_PUEN_QSPI0_MOSI_IO0 BIT(1) |
| 320 | #define PUEN3_PUEN_QSPI0_SPCLK BIT(0) |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 321 | |
Marek Vasut | 264fdb3 | 2019-06-17 19:16:18 +0200 | [diff] [blame] | 322 | #define PUD0_PUD_VI0_CLK BIT(31) |
| 323 | #define PUD0_PUD_IRQ0 BIT(26) |
| 324 | #define PUD0_PUD_FSCLKST_N BIT(25) |
| 325 | #define PUD0_PUD_PRESETOUT_N BIT(23) |
| 326 | #define PUD0_PUD_DU_EXODDF_DU_ODDF_DISP_CDE BIT(21) |
| 327 | #define PUD0_PUD_DU_EXVSYNC_DU_VSYNC BIT(20) |
| 328 | #define PUD0_PUD_DU_EXHSYNC_DU_HSYNC BIT(19) |
| 329 | #define PUD0_PUD_DU_DOTCLKOUT BIT(18) |
| 330 | #define PUD0_PUD_DU_DB7 BIT(17) |
| 331 | #define PUD0_PUD_DU_DB6 BIT(16) |
| 332 | #define PUD0_PUD_DU_DB5 BIT(15) |
| 333 | #define PUD0_PUD_DU_DB4 BIT(14) |
| 334 | #define PUD0_PUD_DU_DB3 BIT(13) |
| 335 | #define PUD0_PUD_DU_DB2 BIT(12) |
| 336 | #define PUD0_PUD_DU_DG7 BIT(11) |
| 337 | #define PUD0_PUD_DU_DG6 BIT(10) |
| 338 | #define PUD0_PUD_DU_DG5 BIT(9) |
| 339 | #define PUD0_PUD_DU_DG4 BIT(8) |
| 340 | #define PUD0_PUD_DU_DG3 BIT(7) |
| 341 | #define PUD0_PUD_DU_DG2 BIT(6) |
| 342 | #define PUD0_PUD_DU_DR7 BIT(5) |
| 343 | #define PUD0_PUD_DU_DR6 BIT(4) |
| 344 | #define PUD0_PUD_DU_DR5 BIT(3) |
| 345 | #define PUD0_PUD_DU_DR4 BIT(2) |
| 346 | #define PUD0_PUD_DU_DR3 BIT(1) |
| 347 | #define PUD0_PUD_DU_DR2 BIT(0) |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 348 | |
Marek Vasut | 264fdb3 | 2019-06-17 19:16:18 +0200 | [diff] [blame] | 349 | #define PUD1_PUD_VI1_DATA11 BIT(31) |
| 350 | #define PUD1_PUD_VI1_DATA10 BIT(30) |
| 351 | #define PUD1_PUD_VI1_DATA9 BIT(29) |
| 352 | #define PUD1_PUD_VI1_DATA8 BIT(28) |
| 353 | #define PUD1_PUD_VI1_DATA7 BIT(27) |
| 354 | #define PUD1_PUD_VI1_DATA6 BIT(26) |
| 355 | #define PUD1_PUD_VI1_DATA5 BIT(25) |
| 356 | #define PUD1_PUD_VI1_DATA4 BIT(24) |
| 357 | #define PUD1_PUD_VI1_DATA3 BIT(23) |
| 358 | #define PUD1_PUD_VI1_DATA2 BIT(22) |
| 359 | #define PUD1_PUD_VI1_DATA1 BIT(21) |
| 360 | #define PUD1_PUD_VI1_DATA0 BIT(20) |
| 361 | #define PUD1_PUD_VI1_VSYNC_N BIT(19) |
| 362 | #define PUD1_PUD_VI1_HSYNC_N BIT(18) |
| 363 | #define PUD1_PUD_VI1_CLKENB BIT(17) |
| 364 | #define PUD1_PUD_VI1_CLK BIT(16) |
| 365 | #define PUD1_PUD_VI0_FIELD BIT(15) |
| 366 | #define PUD1_PUD_VI0_DATA11 BIT(14) |
| 367 | #define PUD1_PUD_VI0_DATA10 BIT(13) |
| 368 | #define PUD1_PUD_VI0_DATA9 BIT(12) |
| 369 | #define PUD1_PUD_VI0_DATA8 BIT(11) |
| 370 | #define PUD1_PUD_VI0_DATA7 BIT(10) |
| 371 | #define PUD1_PUD_VI0_DATA6 BIT(9) |
| 372 | #define PUD1_PUD_VI0_DATA5 BIT(8) |
| 373 | #define PUD1_PUD_VI0_DATA4 BIT(7) |
| 374 | #define PUD1_PUD_VI0_DATA3 BIT(6) |
| 375 | #define PUD1_PUD_VI0_DATA2 BIT(5) |
| 376 | #define PUD1_PUD_VI0_DATA1 BIT(4) |
| 377 | #define PUD1_PUD_VI0_DATA0 BIT(3) |
| 378 | #define PUD1_PUD_VI0_VSYNC_N BIT(2) |
| 379 | #define PUD1_PUD_VI0_HSYNC_N BIT(1) |
| 380 | #define PUD1_PUD_VI0_CLKENB BIT(0) |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 381 | |
Marek Vasut | 264fdb3 | 2019-06-17 19:16:18 +0200 | [diff] [blame] | 382 | #define PUD2_PUD_CANFD_CLK BIT(31) |
| 383 | #define PUD2_PUD_CANFD1_RX BIT(30) |
| 384 | #define PUD2_PUD_CANFD1_TX BIT(29) |
| 385 | #define PUD2_PUD_CANFD0_RX BIT(28) |
| 386 | #define PUD2_PUD_CANFD0_TX BIT(27) |
| 387 | #define PUD2_PUD_AVB0_AVTP_CAPTURE BIT(26) |
| 388 | #define PUD2_PUD_AVB0_AVTP_MATCH BIT(25) |
| 389 | #define PUD2_PUD_AVB0_LINK BIT(24) |
| 390 | #define PUD2_PUD_AVB0_PHY_INT BIT(23) |
| 391 | #define PUD2_PUD_AVB0_MAGIC BIT(22) |
| 392 | #define PUD2_PUD_AVB0_MDC BIT(21) |
| 393 | #define PUD2_PUD_AVB0_MDIO BIT(20) |
| 394 | #define PUD2_PUD_AVB0_TXCREFCLK BIT(19) |
| 395 | #define PUD2_PUD_AVB0_TD3 BIT(18) |
| 396 | #define PUD2_PUD_AVB0_TD2 BIT(17) |
| 397 | #define PUD2_PUD_AVB0_TD1 BIT(16) |
| 398 | #define PUD2_PUD_AVB0_TD0 BIT(15) |
| 399 | #define PUD2_PUD_AVB0_TXC BIT(14) |
| 400 | #define PUD2_PUD_AVB0_TX_CTL BIT(13) |
| 401 | #define PUD2_PUD_AVB0_RD3 BIT(12) |
| 402 | #define PUD2_PUD_AVB0_RD2 BIT(11) |
| 403 | #define PUD2_PUD_AVB0_RD1 BIT(10) |
| 404 | #define PUD2_PUD_AVB0_RD0 BIT(9) |
| 405 | #define PUD2_PUD_AVB0_RXC BIT(8) |
| 406 | #define PUD2_PUD_AVB0_RX_CTL BIT(7) |
| 407 | #define PUD2_PUD_SDA2 BIT(6) |
| 408 | #define PUD2_PUD_SCL2 BIT(5) |
| 409 | #define PUD2_PUD_SDA1 BIT(4) |
| 410 | #define PUD2_PUD_SCL1 BIT(3) |
| 411 | #define PUD2_PUD_SDA0 BIT(2) |
| 412 | #define PUD2_PUD_SCL0 BIT(1) |
| 413 | #define PUD2_PUD_VI1_FIELD BIT(0) |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 414 | |
Marek Vasut | 264fdb3 | 2019-06-17 19:16:18 +0200 | [diff] [blame] | 415 | #define PUD3_PUD_DIGRF_CLKOUT BIT(16) |
| 416 | #define PUD3_PUD_DIGRF_CLKIN BIT(15) |
| 417 | #define PUD3_PUD_RPC_INT_N BIT(14) |
| 418 | #define PUD3_PUD_RPC_WP_N BIT(13) |
| 419 | #define PUD3_PUD_RPC_RESET_N BIT(12) |
| 420 | #define PUD3_PUD_QSPI1_SSL BIT(11) |
| 421 | #define PUD3_PUD_QSPI1_IO3 BIT(10) |
| 422 | #define PUD3_PUD_QSPI1_IO2 BIT(9) |
| 423 | #define PUD3_PUD_QSPI1_MISO_IO1 BIT(8) |
| 424 | #define PUD3_PUD_QSPI1_MOSI_IO0 BIT(7) |
| 425 | #define PUD3_PUD_QSPI1_SPCLK BIT(6) |
| 426 | #define PUD3_PUD_QSPI0_SSL BIT(5) |
| 427 | #define PUD3_PUD_QSPI0_IO3 BIT(4) |
| 428 | #define PUD3_PUD_QSPI0_IO2 BIT(3) |
| 429 | #define PUD3_PUD_QSPI0_MISO_IO1 BIT(2) |
| 430 | #define PUD3_PUD_QSPI0_MOSI_IO0 BIT(1) |
| 431 | #define PUD3_PUD_QSPI0_SPCLK BIT(0) |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 432 | |
Marek Vasut | 264fdb3 | 2019-06-17 19:16:18 +0200 | [diff] [blame] | 433 | #define MOD_SEL0_sel_hscif0 BIT(10) |
| 434 | #define MOD_SEL0_sel_scif1 BIT(9) |
| 435 | #define MOD_SEL0_sel_canfd0 BIT(8) |
| 436 | #define MOD_SEL0_sel_pwm4 BIT(7) |
| 437 | #define MOD_SEL0_sel_pwm3 BIT(6) |
| 438 | #define MOD_SEL0_sel_pwm2 BIT(5) |
| 439 | #define MOD_SEL0_sel_pwm1 BIT(4) |
| 440 | #define MOD_SEL0_sel_pwm0 BIT(3) |
| 441 | #define MOD_SEL0_sel_rfso BIT(2) |
| 442 | #define MOD_SEL0_sel_rsp BIT(1) |
| 443 | #define MOD_SEL0_sel_tmu BIT(0) |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 444 | |
| 445 | /* SCIF3 Registers for Dummy write */ |
| 446 | #define SCIF3_BASE (0xE6C50000U) |
| 447 | #define SCIF3_SCFCR (SCIF3_BASE + 0x0018U) |
| 448 | #define SCIF3_SCFDR (SCIF3_BASE + 0x001CU) |
| 449 | #define SCFCR_DATA (0x0000U) |
| 450 | |
| 451 | /* Realtime module stop control */ |
Marek Vasut | 4dd0dfa | 2019-06-17 19:15:33 +0200 | [diff] [blame] | 452 | #define CPG_BASE (0xE6150000U) |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 453 | #define CPG_MSTPSR0 (CPG_BASE + 0x0030U) |
| 454 | #define CPG_RMSTPCR0 (CPG_BASE + 0x0110U) |
| 455 | #define RMSTPCR0_RTDMAC (0x00200000U) |
| 456 | |
| 457 | /* RT-DMAC Registers */ |
| 458 | #define RTDMAC_CH (0U) /* choose 0 to 15 */ |
| 459 | |
| 460 | #define RTDMAC_BASE (0xFFC10000U) |
| 461 | #define RTDMAC_RDMOR (RTDMAC_BASE + 0x0060U) |
| 462 | #define RTDMAC_RDMCHCLR (RTDMAC_BASE + 0x0080U) |
| 463 | #define RTDMAC_RDMSAR(x) (RTDMAC_BASE + 0x8000U + (0x80U * (x))) |
| 464 | #define RTDMAC_RDMDAR(x) (RTDMAC_BASE + 0x8004U + (0x80U * (x))) |
| 465 | #define RTDMAC_RDMTCR(x) (RTDMAC_BASE + 0x8008U + (0x80U * (x))) |
| 466 | #define RTDMAC_RDMCHCR(x) (RTDMAC_BASE + 0x800CU + (0x80U * (x))) |
| 467 | #define RTDMAC_RDMCHCRB(x) (RTDMAC_BASE + 0x801CU + (0x80U * (x))) |
| 468 | #define RTDMAC_RDMDPBASE(x) (RTDMAC_BASE + 0x8050U + (0x80U * (x))) |
| 469 | #define RTDMAC_DESC_BASE (RTDMAC_BASE + 0xA000U) |
| 470 | #define RTDMAC_DESC_RDMSAR (RTDMAC_DESC_BASE + 0x0000U) |
| 471 | #define RTDMAC_DESC_RDMDAR (RTDMAC_DESC_BASE + 0x0004U) |
| 472 | #define RTDMAC_DESC_RDMTCR (RTDMAC_DESC_BASE + 0x0008U) |
| 473 | |
| 474 | #define RDMOR_DME (0x0001U) /* DMA Master Enable */ |
| 475 | #define RDMCHCR_DPM_INFINITE (0x30000000U) /* Infinite repeat mode */ |
| 476 | #define RDMCHCR_RPT_TCR (0x02000000U) /* enable to update TCR */ |
| 477 | #define RDMCHCR_TS_2 (0x00000008U) /* Word(2byte) units transfer */ |
| 478 | #define RDMCHCR_RS_AUTO (0x00000400U) /* Auto request */ |
| 479 | #define RDMCHCR_DE (0x00000001U) /* DMA Enable */ |
| 480 | #define RDMCHCRB_DRST (0x00008000U) /* Descriptor reset */ |
| 481 | #define RDMCHCRB_SLM_256 (0x00000080U) /* once in 256 clock cycle */ |
| 482 | #define RDMDPBASE_SEL_EXT (0x00000001U) /* External memory use */ |
| 483 | |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 484 | static void pfc_reg_write(uint32_t addr, uint32_t data) |
| 485 | { |
| 486 | mmio_write_32(PFC_PMMR, ~data); |
| 487 | mmio_write_32((uintptr_t)addr, data); |
| 488 | } |
| 489 | |
| 490 | static void StartRtDma0_Descriptor(void) |
| 491 | { |
| 492 | uint32_t reg; |
| 493 | |
| 494 | /* Module stop clear */ |
Marek Vasut | 4dd0dfa | 2019-06-17 19:15:33 +0200 | [diff] [blame] | 495 | while ((mmio_read_32(CPG_MSTPSR0) & RMSTPCR0_RTDMAC) != 0U) { |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 496 | reg = mmio_read_32(CPG_RMSTPCR0); |
| 497 | reg &= ~RMSTPCR0_RTDMAC; |
| 498 | cpg_write(CPG_RMSTPCR0, reg); |
| 499 | } |
| 500 | |
| 501 | /* Initialize ch0, Reset Descriptor */ |
Marek Vasut | 264fdb3 | 2019-06-17 19:16:18 +0200 | [diff] [blame] | 502 | mmio_write_32(RTDMAC_RDMCHCLR, BIT(RTDMAC_CH)); |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 503 | mmio_write_32(RTDMAC_RDMCHCRB(RTDMAC_CH), RDMCHCRB_DRST); |
| 504 | |
| 505 | /* Enable DMA */ |
| 506 | mmio_write_16(RTDMAC_RDMOR, RDMOR_DME); |
| 507 | |
| 508 | /* Set first transfer */ |
| 509 | mmio_write_32(RTDMAC_RDMSAR(RTDMAC_CH), RCAR_PRR); |
| 510 | mmio_write_32(RTDMAC_RDMDAR(RTDMAC_CH), SCIF3_SCFDR); |
| 511 | mmio_write_32(RTDMAC_RDMTCR(RTDMAC_CH), 0x00000001U); |
| 512 | |
| 513 | /* Set descriptor */ |
| 514 | mmio_write_32(RTDMAC_DESC_RDMSAR, 0x00000000U); |
| 515 | mmio_write_32(RTDMAC_DESC_RDMDAR, 0x00000000U); |
| 516 | mmio_write_32(RTDMAC_DESC_RDMTCR, 0x00200000U); |
| 517 | mmio_write_32(RTDMAC_RDMCHCRB(RTDMAC_CH), RDMCHCRB_SLM_256); |
| 518 | mmio_write_32(RTDMAC_RDMDPBASE(RTDMAC_CH), RTDMAC_DESC_BASE |
| 519 | | RDMDPBASE_SEL_EXT); |
| 520 | |
| 521 | /* Set transfer parameter, Start transfer */ |
| 522 | mmio_write_32(RTDMAC_RDMCHCR(RTDMAC_CH), RDMCHCR_DPM_INFINITE |
| 523 | | RDMCHCR_RPT_TCR |
| 524 | | RDMCHCR_TS_2 |
| 525 | | RDMCHCR_RS_AUTO |
| 526 | | RDMCHCR_DE); |
| 527 | } |
| 528 | |
| 529 | void pfc_init_v3m(void) |
| 530 | { |
| 531 | /* Work around for PFC eratta */ |
| 532 | StartRtDma0_Descriptor(); |
| 533 | |
| 534 | // pin function |
| 535 | // md[4:1]!=0000 |
| 536 | /* initialize GPIO/perihperal function select */ |
| 537 | |
| 538 | pfc_reg_write(PFC_GPSR0, 0x00000000); |
| 539 | |
| 540 | pfc_reg_write(PFC_GPSR1, GPSR1_CANFD_CLK); |
| 541 | |
| 542 | pfc_reg_write(PFC_GPSR2, 0x00000000); |
| 543 | |
| 544 | pfc_reg_write(PFC_GPSR3, 0x00000000); |
| 545 | |
| 546 | pfc_reg_write(PFC_GPSR4, GPSR4_SDA2 |
| 547 | | GPSR4_SCL2); |
| 548 | |
| 549 | pfc_reg_write(PFC_GPSR5, GPSR5_QSPI1_SSL |
| 550 | | GPSR5_QSPI1_IO3 |
| 551 | | GPSR5_QSPI1_IO2 |
| 552 | | GPSR5_QSPI1_MISO_IO1 |
| 553 | | GPSR5_QSPI1_MOSI_IO0 |
| 554 | | GPSR5_QSPI1_SPCLK |
| 555 | | GPSR5_QSPI0_SSL |
| 556 | | GPSR5_QSPI0_IO3 |
| 557 | | GPSR5_QSPI0_IO2 |
| 558 | | GPSR5_QSPI0_MISO_IO1 |
| 559 | | GPSR5_QSPI0_MOSI_IO0 |
| 560 | | GPSR5_QSPI0_SPCLK); |
| 561 | |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 562 | /* initialize peripheral function select */ |
| 563 | pfc_reg_write(PFC_IPSR0, IPSR_28_FUNC(0) |
| 564 | | IPSR_24_FUNC(0) |
| 565 | | IPSR_20_FUNC(0) |
| 566 | | IPSR_16_FUNC(0) |
| 567 | | IPSR_12_FUNC(0) |
| 568 | | IPSR_8_FUNC(0) |
| 569 | | IPSR_4_FUNC(0) |
| 570 | | IPSR_0_FUNC(0)); |
| 571 | |
| 572 | pfc_reg_write(PFC_IPSR1, IPSR_28_FUNC(0) |
| 573 | | IPSR_24_FUNC(0) |
| 574 | | IPSR_20_FUNC(0) |
| 575 | | IPSR_16_FUNC(0) |
| 576 | | IPSR_12_FUNC(0) |
| 577 | | IPSR_8_FUNC(0) |
| 578 | | IPSR_4_FUNC(0) |
| 579 | | IPSR_0_FUNC(0)); |
| 580 | |
| 581 | pfc_reg_write(PFC_IPSR2, IPSR_28_FUNC(0) |
| 582 | | IPSR_24_FUNC(0) |
| 583 | | IPSR_20_FUNC(0) |
| 584 | | IPSR_16_FUNC(0) |
| 585 | | IPSR_12_FUNC(0) |
| 586 | | IPSR_8_FUNC(0) |
| 587 | | IPSR_4_FUNC(0) |
| 588 | | IPSR_0_FUNC(0)); |
| 589 | |
| 590 | pfc_reg_write(PFC_IPSR3, IPSR_28_FUNC(0) |
| 591 | | IPSR_24_FUNC(0) |
| 592 | | IPSR_20_FUNC(0) |
| 593 | | IPSR_16_FUNC(0) |
| 594 | | IPSR_12_FUNC(0) |
| 595 | | IPSR_8_FUNC(0) |
| 596 | | IPSR_4_FUNC(0) |
| 597 | | IPSR_0_FUNC(0)); |
| 598 | |
| 599 | pfc_reg_write(PFC_IPSR4, IPSR_28_FUNC(0) |
| 600 | | IPSR_24_FUNC(0) |
| 601 | | IPSR_20_FUNC(0) |
| 602 | | IPSR_16_FUNC(0) |
| 603 | | IPSR_12_FUNC(0) |
| 604 | | IPSR_8_FUNC(0) |
| 605 | | IPSR_4_FUNC(0) |
| 606 | | IPSR_0_FUNC(0)); |
| 607 | |
| 608 | pfc_reg_write(PFC_IPSR5, IPSR_28_FUNC(0) |
| 609 | | IPSR_24_FUNC(0) |
| 610 | | IPSR_20_FUNC(0) |
| 611 | | IPSR_16_FUNC(0) |
| 612 | | IPSR_12_FUNC(0) |
| 613 | | IPSR_8_FUNC(0) |
| 614 | | IPSR_4_FUNC(0) |
| 615 | | IPSR_0_FUNC(0)); |
| 616 | |
| 617 | pfc_reg_write(PFC_IPSR6, IPSR_28_FUNC(0) |
| 618 | | IPSR_24_FUNC(0) |
| 619 | | IPSR_20_FUNC(0) |
| 620 | | IPSR_16_FUNC(0) |
| 621 | | IPSR_12_FUNC(0) |
| 622 | | IPSR_8_FUNC(0) |
| 623 | | IPSR_4_FUNC(0) |
| 624 | | IPSR_0_FUNC(0)); |
| 625 | |
| 626 | pfc_reg_write(PFC_IPSR7, IPSR_28_FUNC(0) |
| 627 | | IPSR_24_FUNC(4) |
| 628 | | IPSR_20_FUNC(4) |
| 629 | | IPSR_16_FUNC(4) |
| 630 | | IPSR_12_FUNC(4) |
| 631 | | IPSR_8_FUNC(0) |
| 632 | | IPSR_4_FUNC(0) |
| 633 | | IPSR_0_FUNC(0)); |
| 634 | |
| 635 | pfc_reg_write(PFC_IPSR8, IPSR_28_FUNC(0) |
| 636 | | IPSR_24_FUNC(0) |
| 637 | | IPSR_20_FUNC(0) |
| 638 | | IPSR_16_FUNC(4) |
| 639 | | IPSR_12_FUNC(0) |
| 640 | | IPSR_8_FUNC(0) |
| 641 | | IPSR_4_FUNC(0) |
| 642 | | IPSR_0_FUNC(0)); |
| 643 | |
| 644 | /* initialize POC Control */ |
| 645 | |
Marek Vasut | c73bad9 | 2019-06-17 19:10:05 +0200 | [diff] [blame] | 646 | pfc_reg_write(PFC_POCCTRL0, IOCTRL30_POC_VI0_DATA5 |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 647 | | IOCTRL30_POC_VI0_DATA4 |
| 648 | | IOCTRL30_POC_VI0_DATA3 |
| 649 | | IOCTRL30_POC_VI0_DATA2 |
| 650 | | IOCTRL30_POC_VI0_DATA1 |
| 651 | | IOCTRL30_POC_VI0_DATA0 |
| 652 | | IOCTRL30_POC_VI0_VSYNC_N |
| 653 | | IOCTRL30_POC_VI0_HSYNC_N |
| 654 | | IOCTRL30_POC_VI0_CLKENB |
| 655 | | IOCTRL30_POC_VI0_CLK |
| 656 | | IOCTRL30_POC_DU_EXODDF_DU_ODDF_DISP_CDE |
| 657 | | IOCTRL30_POC_DU_EXVSYNC_DU_VSYNC |
| 658 | | IOCTRL30_POC_DU_EXHSYNC_DU_HSYNC |
| 659 | | IOCTRL30_POC_DU_DOTCLKOUT |
| 660 | | IOCTRL30_POC_DU_DB7 |
| 661 | | IOCTRL30_POC_DU_DB6 |
| 662 | | IOCTRL30_POC_DU_DB5 |
| 663 | | IOCTRL30_POC_DU_DB4 |
| 664 | | IOCTRL30_POC_DU_DB3 |
| 665 | | IOCTRL30_POC_DU_DB2 |
| 666 | | IOCTRL30_POC_DU_DG7 |
| 667 | | IOCTRL30_POC_DU_DG6 |
| 668 | | IOCTRL30_POC_DU_DG5 |
| 669 | | IOCTRL30_POC_DU_DG4 |
| 670 | | IOCTRL30_POC_DU_DG3 |
| 671 | | IOCTRL30_POC_DU_DG2 |
| 672 | | IOCTRL30_POC_DU_DR7 |
| 673 | | IOCTRL30_POC_DU_DR6 |
| 674 | | IOCTRL30_POC_DU_DR5 |
| 675 | | IOCTRL30_POC_DU_DR4 |
| 676 | | IOCTRL30_POC_DU_DR3 |
| 677 | | IOCTRL30_POC_DU_DR2); |
| 678 | |
| 679 | pfc_reg_write(PFC_IOCTRL31, IOCTRL31_POC_DUMMY_31 |
| 680 | | IOCTRL31_POC_DUMMY_30 |
| 681 | | IOCTRL31_POC_DUMMY_29 |
| 682 | | IOCTRL31_POC_DUMMY_28 |
| 683 | | IOCTRL31_POC_DUMMY_27 |
| 684 | | IOCTRL31_POC_DUMMY_26 |
| 685 | | IOCTRL31_POC_DUMMY_25 |
| 686 | | IOCTRL31_POC_DUMMY_24 |
| 687 | | IOCTRL31_POC_VI1_FIELD |
| 688 | | IOCTRL31_POC_VI1_DATA11 |
| 689 | | IOCTRL31_POC_VI1_DATA10 |
| 690 | | IOCTRL31_POC_VI1_DATA9 |
| 691 | | IOCTRL31_POC_VI1_DATA8 |
| 692 | | IOCTRL31_POC_VI1_DATA7 |
| 693 | | IOCTRL31_POC_VI1_DATA6 |
| 694 | | IOCTRL31_POC_VI1_DATA5 |
| 695 | | IOCTRL31_POC_VI1_DATA4 |
| 696 | | IOCTRL31_POC_VI1_DATA3 |
| 697 | | IOCTRL31_POC_VI1_DATA2 |
| 698 | | IOCTRL31_POC_VI1_DATA1 |
| 699 | | IOCTRL31_POC_VI1_DATA0 |
| 700 | | IOCTRL31_POC_VI1_VSYNC_N |
| 701 | | IOCTRL31_POC_VI1_HSYNC_N |
| 702 | | IOCTRL31_POC_VI1_CLKENB |
| 703 | | IOCTRL31_POC_VI1_CLK |
| 704 | | IOCTRL31_POC_VI0_FIELD |
| 705 | | IOCTRL31_POC_VI0_DATA11 |
| 706 | | IOCTRL31_POC_VI0_DATA10 |
| 707 | | IOCTRL31_POC_VI0_DATA9 |
| 708 | | IOCTRL31_POC_VI0_DATA8 |
| 709 | | IOCTRL31_POC_VI0_DATA7 |
| 710 | | IOCTRL31_POC_VI0_DATA6); |
| 711 | |
Marek Vasut | c73bad9 | 2019-06-17 19:10:05 +0200 | [diff] [blame] | 712 | pfc_reg_write(PFC_POCCTRL1, 0x00000000); |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 713 | |
Marek Vasut | c73bad9 | 2019-06-17 19:10:05 +0200 | [diff] [blame] | 714 | pfc_reg_write(PFC_TDSELCTRL0, 0x00000000); |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 715 | |
| 716 | /* initialize Pull enable */ |
Marek Vasut | 4dd0dfa | 2019-06-17 19:15:33 +0200 | [diff] [blame] | 717 | pfc_reg_write(PFC_PUEN0, PUEN0_PUEN_VI0_CLK |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 718 | | PUEN0_PUEN_TDI |
| 719 | | PUEN0_PUEN_TMS |
| 720 | | PUEN0_PUEN_TCK |
| 721 | | PUEN0_PUEN_TRST_N |
| 722 | | PUEN0_PUEN_IRQ0 |
| 723 | | PUEN0_PUEN_FSCLKST_N |
| 724 | | PUEN0_PUEN_DU_EXHSYNC_DU_HSYNC |
| 725 | | PUEN0_PUEN_DU_DOTCLKOUT |
| 726 | | PUEN0_PUEN_DU_DB7 |
| 727 | | PUEN0_PUEN_DU_DB6 |
| 728 | | PUEN0_PUEN_DU_DB5 |
| 729 | | PUEN0_PUEN_DU_DB4 |
| 730 | | PUEN0_PUEN_DU_DB3 |
| 731 | | PUEN0_PUEN_DU_DB2 |
| 732 | | PUEN0_PUEN_DU_DG7 |
| 733 | | PUEN0_PUEN_DU_DG6 |
| 734 | | PUEN0_PUEN_DU_DG5 |
| 735 | | PUEN0_PUEN_DU_DG4 |
| 736 | | PUEN0_PUEN_DU_DG3 |
| 737 | | PUEN0_PUEN_DU_DG2 |
| 738 | | PUEN0_PUEN_DU_DR7 |
| 739 | | PUEN0_PUEN_DU_DR6 |
| 740 | | PUEN0_PUEN_DU_DR5 |
| 741 | | PUEN0_PUEN_DU_DR4 |
| 742 | | PUEN0_PUEN_DU_DR3 |
| 743 | | PUEN0_PUEN_DU_DR2); |
| 744 | |
Marek Vasut | 4dd0dfa | 2019-06-17 19:15:33 +0200 | [diff] [blame] | 745 | pfc_reg_write(PFC_PUEN1, PUEN1_PUEN_VI1_DATA11 |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 746 | | PUEN1_PUEN_VI1_DATA10 |
| 747 | | PUEN1_PUEN_VI1_DATA9 |
| 748 | | PUEN1_PUEN_VI1_DATA8 |
| 749 | | PUEN1_PUEN_VI1_DATA7 |
| 750 | | PUEN1_PUEN_VI1_DATA6 |
| 751 | | PUEN1_PUEN_VI1_DATA5 |
| 752 | | PUEN1_PUEN_VI1_DATA4 |
| 753 | | PUEN1_PUEN_VI1_DATA3 |
| 754 | | PUEN1_PUEN_VI1_DATA2 |
| 755 | | PUEN1_PUEN_VI1_DATA1 |
| 756 | | PUEN1_PUEN_VI1_DATA0 |
| 757 | | PUEN1_PUEN_VI1_VSYNC_N |
| 758 | | PUEN1_PUEN_VI1_HSYNC_N |
| 759 | | PUEN1_PUEN_VI1_CLKENB |
| 760 | | PUEN1_PUEN_VI1_CLK |
| 761 | | PUEN1_PUEN_VI0_DATA11 |
| 762 | | PUEN1_PUEN_VI0_DATA10 |
| 763 | | PUEN1_PUEN_VI0_DATA9 |
| 764 | | PUEN1_PUEN_VI0_DATA8 |
| 765 | | PUEN1_PUEN_VI0_DATA7 |
| 766 | | PUEN1_PUEN_VI0_DATA6 |
| 767 | | PUEN1_PUEN_VI0_DATA5 |
| 768 | | PUEN1_PUEN_VI0_DATA4 |
| 769 | | PUEN1_PUEN_VI0_DATA3 |
| 770 | | PUEN1_PUEN_VI0_DATA2 |
| 771 | | PUEN1_PUEN_VI0_DATA1); |
| 772 | |
Marek Vasut | 4dd0dfa | 2019-06-17 19:15:33 +0200 | [diff] [blame] | 773 | pfc_reg_write(PFC_PUEN2, PUEN2_PUEN_CANFD_CLK |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 774 | | PUEN2_PUEN_CANFD1_RX |
| 775 | | PUEN2_PUEN_CANFD1_TX |
| 776 | | PUEN2_PUEN_CANFD0_RX |
| 777 | | PUEN2_PUEN_CANFD0_TX |
| 778 | | PUEN2_PUEN_AVB0_AVTP_CAPTURE |
| 779 | | PUEN2_PUEN_AVB0_AVTP_MATCH |
| 780 | | PUEN2_PUEN_AVB0_LINK |
| 781 | | PUEN2_PUEN_AVB0_PHY_INT |
| 782 | | PUEN2_PUEN_AVB0_MAGIC |
| 783 | | PUEN2_PUEN_AVB0_TXCREFCLK |
| 784 | | PUEN2_PUEN_AVB0_TD3 |
| 785 | | PUEN2_PUEN_AVB0_TD2 |
| 786 | | PUEN2_PUEN_AVB0_TD1 |
| 787 | | PUEN2_PUEN_AVB0_TD0 |
| 788 | | PUEN2_PUEN_AVB0_TXC |
| 789 | | PUEN2_PUEN_AVB0_TX_CTL |
| 790 | | PUEN2_PUEN_AVB0_RD3 |
| 791 | | PUEN2_PUEN_AVB0_RD2 |
| 792 | | PUEN2_PUEN_AVB0_RD1 |
| 793 | | PUEN2_PUEN_AVB0_RD0 |
| 794 | | PUEN2_PUEN_AVB0_RXC |
| 795 | | PUEN2_PUEN_AVB0_RX_CTL |
| 796 | | PUEN2_PUEN_VI1_FIELD); |
| 797 | |
Marek Vasut | 4dd0dfa | 2019-06-17 19:15:33 +0200 | [diff] [blame] | 798 | pfc_reg_write(PFC_PUEN3, PUEN3_PUEN_DIGRF_CLKOUT |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 799 | | PUEN3_PUEN_DIGRF_CLKIN); |
| 800 | |
| 801 | /* initialize PUD Control */ |
Marek Vasut | 4dd0dfa | 2019-06-17 19:15:33 +0200 | [diff] [blame] | 802 | pfc_reg_write(PFC_PUD0, PUD0_PUD_VI0_CLK |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 803 | | PUD0_PUD_IRQ0 |
| 804 | | PUD0_PUD_FSCLKST_N |
| 805 | | PUD0_PUD_DU_EXODDF_DU_ODDF_DISP_CDE |
| 806 | | PUD0_PUD_DU_EXVSYNC_DU_VSYNC |
| 807 | | PUD0_PUD_DU_EXHSYNC_DU_HSYNC |
| 808 | | PUD0_PUD_DU_DOTCLKOUT |
| 809 | | PUD0_PUD_DU_DB7 |
| 810 | | PUD0_PUD_DU_DB6 |
| 811 | | PUD0_PUD_DU_DB5 |
| 812 | | PUD0_PUD_DU_DB4 |
| 813 | | PUD0_PUD_DU_DB3 |
| 814 | | PUD0_PUD_DU_DB2 |
| 815 | | PUD0_PUD_DU_DG7 |
| 816 | | PUD0_PUD_DU_DG6 |
| 817 | | PUD0_PUD_DU_DG5 |
| 818 | | PUD0_PUD_DU_DG4 |
| 819 | | PUD0_PUD_DU_DG3 |
| 820 | | PUD0_PUD_DU_DG2 |
| 821 | | PUD0_PUD_DU_DR7 |
| 822 | | PUD0_PUD_DU_DR6 |
| 823 | | PUD0_PUD_DU_DR5 |
| 824 | | PUD0_PUD_DU_DR4 |
| 825 | | PUD0_PUD_DU_DR3 |
| 826 | | PUD0_PUD_DU_DR2); |
| 827 | |
Marek Vasut | 4dd0dfa | 2019-06-17 19:15:33 +0200 | [diff] [blame] | 828 | pfc_reg_write(PFC_PUD1, PUD1_PUD_VI1_DATA11 |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 829 | | PUD1_PUD_VI1_DATA10 |
| 830 | | PUD1_PUD_VI1_DATA9 |
| 831 | | PUD1_PUD_VI1_DATA8 |
| 832 | | PUD1_PUD_VI1_DATA7 |
| 833 | | PUD1_PUD_VI1_DATA6 |
| 834 | | PUD1_PUD_VI1_DATA5 |
| 835 | | PUD1_PUD_VI1_DATA4 |
| 836 | | PUD1_PUD_VI1_DATA3 |
| 837 | | PUD1_PUD_VI1_DATA2 |
| 838 | | PUD1_PUD_VI1_DATA1 |
| 839 | | PUD1_PUD_VI1_DATA0 |
| 840 | | PUD1_PUD_VI1_VSYNC_N |
| 841 | | PUD1_PUD_VI1_HSYNC_N |
| 842 | | PUD1_PUD_VI1_CLKENB |
| 843 | | PUD1_PUD_VI1_CLK |
| 844 | | PUD1_PUD_VI0_DATA11 |
| 845 | | PUD1_PUD_VI0_DATA10 |
| 846 | | PUD1_PUD_VI0_DATA9 |
| 847 | | PUD1_PUD_VI0_DATA8 |
| 848 | | PUD1_PUD_VI0_DATA7 |
| 849 | | PUD1_PUD_VI0_DATA6 |
| 850 | | PUD1_PUD_VI0_DATA5 |
| 851 | | PUD1_PUD_VI0_DATA4 |
| 852 | | PUD1_PUD_VI0_DATA3 |
| 853 | | PUD1_PUD_VI0_DATA2 |
| 854 | | PUD1_PUD_VI0_DATA1 |
| 855 | | PUD1_PUD_VI0_DATA0 |
| 856 | | PUD1_PUD_VI0_VSYNC_N |
| 857 | | PUD1_PUD_VI0_HSYNC_N |
| 858 | | PUD1_PUD_VI0_CLKENB); |
| 859 | |
Marek Vasut | 4dd0dfa | 2019-06-17 19:15:33 +0200 | [diff] [blame] | 860 | pfc_reg_write(PFC_PUD2, PUD2_PUD_CANFD_CLK |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 861 | | PUD2_PUD_CANFD1_RX |
| 862 | | PUD2_PUD_CANFD1_TX |
| 863 | | PUD2_PUD_CANFD0_RX |
| 864 | | PUD2_PUD_CANFD0_TX |
| 865 | | PUD2_PUD_AVB0_AVTP_CAPTURE |
| 866 | | PUD2_PUD_VI1_FIELD); |
| 867 | |
Marek Vasut | 4dd0dfa | 2019-06-17 19:15:33 +0200 | [diff] [blame] | 868 | pfc_reg_write(PFC_PUD3, PUD3_PUD_DIGRF_CLKOUT |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 869 | | PUD3_PUD_DIGRF_CLKIN); |
| 870 | |
| 871 | /* initialize Module Select */ |
Marek Vasut | 4dd0dfa | 2019-06-17 19:15:33 +0200 | [diff] [blame] | 872 | pfc_reg_write(PFC_MOD_SEL0, 0x00000000); |
Valentine Barshak | f218414 | 2018-10-30 02:06:17 +0300 | [diff] [blame] | 873 | |
| 874 | // gpio |
| 875 | /* initialize positive/negative logic select */ |
| 876 | mmio_write_32(GPIO_POSNEG0, 0x00000000U); |
| 877 | mmio_write_32(GPIO_POSNEG1, 0x00000000U); |
| 878 | mmio_write_32(GPIO_POSNEG2, 0x00000000U); |
| 879 | mmio_write_32(GPIO_POSNEG3, 0x00000000U); |
| 880 | mmio_write_32(GPIO_POSNEG4, 0x00000000U); |
| 881 | mmio_write_32(GPIO_POSNEG5, 0x00000000U); |
| 882 | |
| 883 | /* initialize general IO/interrupt switching */ |
| 884 | mmio_write_32(GPIO_IOINTSEL0, 0x00000000U); |
| 885 | mmio_write_32(GPIO_IOINTSEL1, 0x00000000U); |
| 886 | mmio_write_32(GPIO_IOINTSEL2, 0x00000000U); |
| 887 | mmio_write_32(GPIO_IOINTSEL3, 0x00000000U); |
| 888 | mmio_write_32(GPIO_IOINTSEL4, 0x00000000U); |
| 889 | mmio_write_32(GPIO_IOINTSEL5, 0x00000000U); |
| 890 | |
| 891 | /* initialize general output register */ |
| 892 | mmio_write_32(GPIO_OUTDT0, 0x00000000U); |
| 893 | mmio_write_32(GPIO_OUTDT1, 0x00000000U); |
| 894 | mmio_write_32(GPIO_OUTDT2, 0x00000000U); |
| 895 | mmio_write_32(GPIO_OUTDT3, 0x00000000U); |
| 896 | mmio_write_32(GPIO_OUTDT4, 0x00000000U); |
| 897 | mmio_write_32(GPIO_OUTDT5, 0x00000000U); |
| 898 | |
| 899 | /* initialize general input/output switching */ |
| 900 | mmio_write_32(GPIO_INOUTSEL0, 0x00000000U); |
| 901 | mmio_write_32(GPIO_INOUTSEL1, 0x00000000U); |
| 902 | mmio_write_32(GPIO_INOUTSEL2, 0x00000000U); |
| 903 | mmio_write_32(GPIO_INOUTSEL3, 0x00000000U); |
| 904 | mmio_write_32(GPIO_INOUTSEL4, 0x00000000U); |
| 905 | mmio_write_32(GPIO_INOUTSEL5, 0x00000000U); |
| 906 | } |