19 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
35 #define SCC_SS_MASK 0x00000007
37 #define SCC_SS_LPO 0x00000000
39 #define SCC_SS_XTAL 0x00000001
41 #define SCC_SS_PCI 0x00000002
43 #define SCC_LF 0x00000200
45 #define SCC_LP 0x00000400
47 #define SCC_FS 0x00000800
51 #define SCC_IP 0x00001000
55 #define SCC_XC 0x00002000
57 #define SCC_XP 0x00004000
59 #define SCC_CD_MASK 0xffff0000
60 #define SCC_CD_SHIFT 16
64 #define SYCC_IE 0x00000001
66 #define SYCC_AE 0x00000002
68 #define SYCC_FP 0x00000004
70 #define SYCC_AR 0x00000008
72 #define SYCC_HR 0x00000010
74 #define SYCC_CD_MASK 0xffff0000
75 #define SYCC_CD_SHIFT 16
77 #define CST4329_SPROM_OTP_SEL_MASK 0x00000003
79 #define CST4329_DEFCIS_SEL 0
81 #define CST4329_SPROM_SEL 1
83 #define CST4329_OTP_SEL 2
85 #define CST4329_OTP_PWRDN 3
87 #define CST4329_SPI_SDIO_MODE_MASK 0x00000004
88 #define CST4329_SPI_SDIO_MODE_SHIFT 2
91 #define CCTRL43224_GPIO_TOGGLE 0x8000
93 #define CCTRL_43224A0_12MA_LED_DRIVE 0x00F000F0
95 #define CCTRL_43224B0_12MA_LED_DRIVE 0xF0
98 #define CST43236_SFLASH_MASK 0x00000040
99 #define CST43236_OTP_MASK 0x00000080
100 #define CST43236_HSIC_MASK 0x00000100
101 #define CST43236_BP_CLK 0x00000200
102 #define CST43236_BOOT_MASK 0x00001800
103 #define CST43236_BOOT_SHIFT 11
104 #define CST43236_BOOT_FROM_SRAM 0
105 #define CST43236_BOOT_FROM_ROM 1
106 #define CST43236_BOOT_FROM_FLASH 2
107 #define CST43236_BOOT_FROM_INVALID 3
111 #define CCTRL4331_BT_COEXIST (1<<0)
113 #define CCTRL4331_SECI (1<<1)
115 #define CCTRL4331_EXT_LNA (1<<2)
117 #define CCTRL4331_SPROM_GPIO13_15 (1<<3)
119 #define CCTRL4331_EXTPA_EN (1<<4)
121 #define CCTRL4331_GPIOCLK_ON_SPROMCS (1<<5)
123 #define CCTRL4331_PCIE_MDIO_ON_SPROMCS (1<<6)
125 #define CCTRL4331_EXTPA_ON_GPIO2_5 (1<<7)
127 #define CCTRL4331_OVR_PIPEAUXCLKEN (1<<8)
129 #define CCTRL4331_OVR_PIPEAUXPWRDOWN (1<<9)
131 #define CCTRL4331_PCIE_AUXCLKEN (1<<10)
133 #define CCTRL4331_PCIE_PIPE_PLLDOWN (1<<11)
135 #define CCTRL4331_BT_SHD0_ON_GPIO4 (1<<16)
137 #define CCTRL4331_BT_SHD1_ON_GPIO5 (1<<17)
141 #define CST4331_XTAL_FREQ 0x00000001
142 #define CST4331_SPROM_PRESENT 0x00000002
143 #define CST4331_OTP_PRESENT 0x00000004
144 #define CST4331_LDO_RF 0x00000008
145 #define CST4331_LDO_PAR 0x00000010
148 #define CST4319_SPI_CPULESSUSB 0x00000001
149 #define CST4319_SPI_CLK_POL 0x00000002
150 #define CST4319_SPI_CLK_PH 0x00000008
152 #define CST4319_SPROM_OTP_SEL_MASK 0x000000c0
153 #define CST4319_SPROM_OTP_SEL_SHIFT 6
155 #define CST4319_DEFCIS_SEL 0x00000000
157 #define CST4319_SPROM_SEL 0x00000040
159 #define CST4319_OTP_SEL 0x00000080
161 #define CST4319_OTP_PWRDN 0x000000c0
163 #define CST4319_SDIO_USB_MODE 0x00000100
164 #define CST4319_REMAP_SEL_MASK 0x00000600
165 #define CST4319_ILPDIV_EN 0x00000800
166 #define CST4319_XTAL_PD_POL 0x00001000
167 #define CST4319_LPO_SEL 0x00002000
168 #define CST4319_RES_INIT_MODE 0x0000c000
170 #define CST4319_PALDO_EXTPNP 0x00010000
171 #define CST4319_CBUCK_MODE_MASK 0x00060000
172 #define CST4319_CBUCK_MODE_BURST 0x00020000
173 #define CST4319_CBUCK_MODE_LPBURST 0x00060000
174 #define CST4319_RCAL_VALID 0x01000000
175 #define CST4319_RCAL_VALUE_MASK 0x3e000000
176 #define CST4319_RCAL_VALUE_SHIFT 25
179 #define CST4336_SPI_MODE_MASK 0x00000001
180 #define CST4336_SPROM_PRESENT 0x00000002
181 #define CST4336_OTP_PRESENT 0x00000004
182 #define CST4336_ARMREMAP_0 0x00000008
183 #define CST4336_ILPDIV_EN_MASK 0x00000010
184 #define CST4336_ILPDIV_EN_SHIFT 4
185 #define CST4336_XTAL_PD_POL_MASK 0x00000020
186 #define CST4336_XTAL_PD_POL_SHIFT 5
187 #define CST4336_LPO_SEL_MASK 0x00000040
188 #define CST4336_LPO_SEL_SHIFT 6
189 #define CST4336_RES_INIT_MODE_MASK 0x00000180
190 #define CST4336_RES_INIT_MODE_SHIFT 7
191 #define CST4336_CBUCK_MODE_MASK 0x00000600
192 #define CST4336_CBUCK_MODE_SHIFT 9
195 #define CST4313_SPROM_PRESENT 1
196 #define CST4313_OTP_PRESENT 2
197 #define CST4313_SPROM_OTP_SEL_MASK 0x00000002
198 #define CST4313_SPROM_OTP_SEL_SHIFT 0
202 #define CCTRL_4313_12MA_LED_DRIVE 0x00000007
205 #define MFGID_ARM 0x43b
206 #define MFGID_BRCM 0x4bf
207 #define MFGID_MIPS 0x4a7
210 #define ER_EROMENTRY 0x000
211 #define ER_REMAPCONTROL 0xe00
212 #define ER_REMAPSELECT 0xe04
213 #define ER_MASTERSELECT 0xe10
214 #define ER_ITCR 0xf00
215 #define ER_ITIP 0xf04
225 #define ER_BAD 0xffffffff
228 #define CIA_MFG_MASK 0xfff00000
229 #define CIA_MFG_SHIFT 20
230 #define CIA_CID_MASK 0x000fff00
231 #define CIA_CID_SHIFT 8
232 #define CIA_CCL_MASK 0x000000f0
233 #define CIA_CCL_SHIFT 4
236 #define CIB_REV_MASK 0xff000000
237 #define CIB_REV_SHIFT 24
238 #define CIB_NSW_MASK 0x00f80000
239 #define CIB_NSW_SHIFT 19
240 #define CIB_NMW_MASK 0x0007c000
241 #define CIB_NMW_SHIFT 14
242 #define CIB_NSP_MASK 0x00003e00
243 #define CIB_NSP_SHIFT 9
244 #define CIB_NMP_MASK 0x000001f0
245 #define CIB_NMP_SHIFT 4
248 #define AD_ADDR_MASK 0xfffff000
249 #define AD_SP_MASK 0x00000f00
250 #define AD_SP_SHIFT 8
251 #define AD_ST_MASK 0x000000c0
252 #define AD_ST_SHIFT 6
253 #define AD_ST_SLAVE 0x00000000
254 #define AD_ST_BRIDGE 0x00000040
255 #define AD_ST_SWRAP 0x00000080
256 #define AD_ST_MWRAP 0x000000c0
257 #define AD_SZ_MASK 0x00000030
258 #define AD_SZ_SHIFT 4
259 #define AD_SZ_4K 0x00000000
260 #define AD_SZ_8K 0x00000010
261 #define AD_SZ_16K 0x00000020
262 #define AD_SZ_SZD 0x00000030
263 #define AD_AG32 0x00000008
264 #define AD_ADDR_ALIGN 0x00000fff
265 #define AD_SZ_BASE 0x00001000
268 #define SD_SZ_MASK 0xfffff000
269 #define SD_SG32 0x00000008
270 #define SD_SZ_ALIGN 0x00000fff
273 #define PCI_CFG_GPIO_SCS 0x10
275 #define PCI_CFG_GPIO_XTAL 0x40
277 #define PCI_CFG_GPIO_PLL 0x80
280 #define PLL_DELAY 150
281 #define FREF_DELAY 200
282 #define XTAL_ON_DELAY 1000
290 #define DEFAULT_GPIO_ONTIME 10
291 #define DEFAULT_GPIO_OFFTIME 90
294 #define SRC_START 0x80000000
295 #define SRC_BUSY 0x80000000
296 #define SRC_OPCODE 0x60000000
297 #define SRC_OP_READ 0x00000000
298 #define SRC_OP_WRITE 0x20000000
299 #define SRC_OP_WRDIS 0x40000000
300 #define SRC_OP_WREN 0x60000000
301 #define SRC_OTPSEL 0x00000010
302 #define SRC_LOCK 0x00000008
303 #define SRC_SIZE_MASK 0x00000006
304 #define SRC_SIZE_1K 0x00000000
305 #define SRC_SIZE_4K 0x00000002
306 #define SRC_SIZE_16K 0x00000004
307 #define SRC_SIZE_SHIFT 1
308 #define SRC_PRESENT 0x00000001
311 #define GPIO_CTRL_EPA_EN_MASK 0x40
313 #define DEFAULT_GPIOTIMERVAL \
314 ((DEFAULT_GPIO_ONTIME << GPIO_ONTIME_SHIFT) | DEFAULT_GPIO_OFFTIME)
316 #define BADIDX (SI_MAXCORES + 1)
318 #define IS_SIM(chippkg) \
319 ((chippkg == HDLSIM_PKG_ID) || (chippkg == HWSIM_PKG_ID))
322 #define SI_MSG(fmt, ...) pr_debug(fmt, ##__VA_ARGS__)
324 #define SI_MSG(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
327 #define GOODCOREADDR(x, b) \
328 (((x) >= (b)) && ((x) < ((b) + SI_MAXCORES * SI_CORE_SIZE)) && \
329 IS_ALIGNED((x), SI_CORE_SIZE))
453 if (cc->
bus->nr_cores == 0)
457 sii->
pub.ccrev = cc->
id.rev;
467 sii->
pub.pmucaps = bcma_read32(cc,
493 if (!ai_buscore_setup(sii, cc))
525 if (ai_doattach(sii, pbus) ==
NULL) {
556 cc = sii->
icbus->drv_cc.core;
560 bcma_maskset32(cc, regoff, ~mask, val);
563 w = bcma_read32(cc, regoff);
578 static uint ai_slowclk_freq(
struct si_pub *sih,
bool max_freq,
592 uint slowmaxfreq, pll_delay, slowclk;
593 uint pll_on_delay, fref_sel_delay;
603 slowclk = ai_slowclk_src(sih, cc);
609 ai_slowclk_freq(sih,
false, cc);
611 pll_on_delay = ((slowmaxfreq * pll_delay) + 999999) / 1000000;
612 fref_sel_delay = ((slowmaxfreq *
FREF_DELAY) + 999999) / 1000000;
614 bcma_write32(cc,
CHIPCREGOFFS(pll_on_delay), pll_on_delay);
615 bcma_write32(cc,
CHIPCREGOFFS(fref_sel_delay), fref_sel_delay);
627 cc = sii->
icbus->drv_cc.core;
635 ai_clkctl_setdelay(sih, cc);
650 if (ai_get_cccaps(sih) & CC_CAP_PMU) {
659 cc = sii->
icbus->drv_cc.core;
661 slowminfreq = ai_slowclk_freq(sih,
false, cc);
662 fpdelay = (((bcma_read32(cc,
CHIPCREGOFFS(pll_on_delay)) + 2)
663 * 1000000) + (slowminfreq - 1)) / slowminfreq;
683 cc = sii->
icbus->drv_cc.core;
715 cc = sii->
icbus->drv_cc.core;