upload tizen1.0 source
[kernel/linux-2.6.36.git] / drivers / net / wireless / bcm4330 / src / include / sbchipc.h
1 /*
2  * SiliconBackplane Chipcommon core hardware definitions.
3  *
4  * The chipcommon core provides chip identification, SB control,
5  * JTAG, 0/1/2 UARTs, clock frequency control, a watchdog interrupt timer,
6  * GPIO interface, extbus, and support for serial and parallel flashes.
7  *
8  * $Id: sbchipc.h,v 13.169.2.11 2011-01-07 02:37:37 $
9  *
10  * Copyright (C) 1999-2011, Broadcom Corporation
11  * 
12  *         Unless you and Broadcom execute a separate written software license
13  * agreement governing use of this software, this software is licensed to you
14  * under the terms of the GNU General Public License version 2 (the "GPL"),
15  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
16  * following added to such license:
17  * 
18  *      As a special exception, the copyright holders of this software give you
19  * permission to link this software with independent modules, and to copy and
20  * distribute the resulting executable under terms of your choice, provided that
21  * you also meet, for each linked independent module, the terms and conditions of
22  * the license of that module.  An independent module is a module which is not
23  * derived from this software.  The special exception does not apply to any
24  * modifications of the software.
25  * 
26  *      Notwithstanding the above, under no circumstances may you combine this
27  * software in any way with any other Broadcom software provided under a license
28  * other than the GPL, without Broadcom's express prior written consent.
29  */
30
31 #ifndef _SBCHIPC_H
32 #define _SBCHIPC_H
33
34 #ifndef _LANGUAGE_ASSEMBLY
35
36 /* cpp contortions to concatenate w/arg prescan */
37 #ifndef PAD
38 #define _PADLINE(line)  pad ## line
39 #define _XSTR(line)     _PADLINE(line)
40 #define PAD             _XSTR(__LINE__)
41 #endif  /* PAD */
42
43 typedef struct eci_prerev35 {
44         uint32  eci_output;
45         uint32  eci_control;
46         uint32  eci_inputlo;
47         uint32  eci_inputmi;
48         uint32  eci_inputhi;
49         uint32  eci_inputintpolaritylo;
50         uint32  eci_inputintpolaritymi;
51         uint32  eci_inputintpolarityhi;
52         uint32  eci_intmasklo;
53         uint32  eci_intmaskmi;
54         uint32  eci_intmaskhi;
55         uint32  eci_eventlo;
56         uint32  eci_eventmi;
57         uint32  eci_eventhi;
58         uint32  eci_eventmasklo;
59         uint32  eci_eventmaskmi;
60         uint32  eci_eventmaskhi;
61         uint32  PAD[3];
62 } eci_prerev35_t;
63
64 typedef struct eci_rev35 {
65         uint32  eci_outputlo;
66         uint32  eci_outputhi;
67         uint32  eci_controllo;
68         uint32  eci_controlhi;
69         uint32  eci_inputlo;
70         uint32  eci_inputhi;
71         uint32  eci_inputintpolaritylo;
72         uint32  eci_inputintpolarityhi;
73         uint32  eci_intmasklo;
74         uint32  eci_intmaskhi;
75         uint32  eci_eventlo;
76         uint32  eci_eventhi;
77         uint32  eci_eventmasklo;
78         uint32  eci_eventmaskhi;
79         uint32  eci_auxtx;
80         uint32  eci_auxrx;
81         uint32  eci_datatag;
82         uint32  eci_uartescvalue;
83         uint32  eci_autobaudctr;
84         uint32  eci_uartfifolevel;
85 } eci_rev35_t;
86
87 typedef volatile struct {
88         uint32  chipid;                 /* 0x0 */
89         uint32  capabilities;
90         uint32  corecontrol;            /* corerev >= 1 */
91         uint32  bist;
92
93         /* OTP */
94         uint32  otpstatus;              /* 0x10, corerev >= 10 */
95         uint32  otpcontrol;
96         uint32  otpprog;
97         uint32  otplayout;              /* corerev >= 23 */
98
99         /* Interrupt control */
100         uint32  intstatus;              /* 0x20 */
101         uint32  intmask;
102
103         /* Chip specific regs */
104         uint32  chipcontrol;            /* 0x28, rev >= 11 */
105         uint32  chipstatus;             /* 0x2c, rev >= 11 */
106
107         /* Jtag Master */
108         uint32  jtagcmd;                /* 0x30, rev >= 10 */
109         uint32  jtagir;
110         uint32  jtagdr;
111         uint32  jtagctrl;
112
113         /* serial flash interface registers */
114         uint32  flashcontrol;           /* 0x40 */
115         uint32  flashaddress;
116         uint32  flashdata;
117         uint32  PAD[1];
118
119         /* Silicon backplane configuration broadcast control */
120         uint32  broadcastaddress;       /* 0x50 */
121         uint32  broadcastdata;
122
123         /* gpio - cleared only by power-on-reset */
124         uint32  gpiopullup;             /* 0x58, corerev >= 20 */
125         uint32  gpiopulldown;           /* 0x5c, corerev >= 20 */
126         uint32  gpioin;                 /* 0x60 */
127         uint32  gpioout;                /* 0x64 */
128         uint32  gpioouten;              /* 0x68 */
129         uint32  gpiocontrol;            /* 0x6C */
130         uint32  gpiointpolarity;        /* 0x70 */
131         uint32  gpiointmask;            /* 0x74 */
132
133         /* GPIO events corerev >= 11 */
134         uint32  gpioevent;
135         uint32  gpioeventintmask;
136
137         /* Watchdog timer */
138         uint32  watchdog;               /* 0x80 */
139
140         /* GPIO events corerev >= 11 */
141         uint32  gpioeventintpolarity;
142
143         /* GPIO based LED powersave registers corerev >= 16 */
144         uint32  gpiotimerval;           /* 0x88 */
145         uint32  gpiotimeroutmask;
146
147         /* clock control */
148         uint32  clockcontrol_n;         /* 0x90 */
149         uint32  clockcontrol_sb;        /* aka m0 */
150         uint32  clockcontrol_pci;       /* aka m1 */
151         uint32  clockcontrol_m2;        /* mii/uart/mipsref */
152         uint32  clockcontrol_m3;        /* cpu */
153         uint32  clkdiv;                 /* corerev >= 3 */
154         uint32  gpiodebugsel;           /* corerev >= 28 */
155         uint32  capabilities_ext;                       /* 0xac  */
156
157         /* pll delay registers (corerev >= 4) */
158         uint32  pll_on_delay;           /* 0xb0 */
159         uint32  fref_sel_delay;
160         uint32  slow_clk_ctl;           /* 5 < corerev < 10 */
161         uint32  PAD;
162
163         /* Instaclock registers (corerev >= 10) */
164         uint32  system_clk_ctl;         /* 0xc0 */
165         uint32  clkstatestretch;
166         uint32  PAD[2];
167
168         /* Indirect backplane access (corerev >= 22) */
169         uint32  bp_addrlow;             /* 0xd0 */
170         uint32  bp_addrhigh;
171         uint32  bp_data;
172         uint32  PAD;
173         uint32  bp_indaccess;
174         /* SPI registers, corerev >= 37 */
175         uint32  gsioctrl;
176         uint32  gsioaddress;
177         uint32  gsiodata;
178
179         /* More clock dividers (corerev >= 32) */
180         uint32  clkdiv2;
181         uint32  PAD[2];
182
183         /* In AI chips, pointer to erom */
184         uint32  eromptr;                /* 0xfc */
185
186         /* ExtBus control registers (corerev >= 3) */
187         uint32  pcmcia_config;          /* 0x100 */
188         uint32  pcmcia_memwait;
189         uint32  pcmcia_attrwait;
190         uint32  pcmcia_iowait;
191         uint32  ide_config;
192         uint32  ide_memwait;
193         uint32  ide_attrwait;
194         uint32  ide_iowait;
195         uint32  prog_config;
196         uint32  prog_waitcount;
197         uint32  flash_config;
198         uint32  flash_waitcount;
199         uint32  SECI_config;            /* 0x130 SECI configuration */
200         uint32  SECI_status;
201         uint32  SECI_statusmask;
202         uint32  SECI_rxnibchanged;
203
204         uint32  PAD[20];
205
206         /* SROM interface (corerev >= 32) */
207         uint32  sromcontrol;            /* 0x190 */
208         uint32  sromaddress;
209         uint32  sromdata;
210         uint32  PAD[9];         /* 0x19C - 0x1BC */
211         uint32  seci_uart_data;         /* 0x1C0 */
212         uint32  seci_uart_bauddiv;
213         uint32  seci_uart_fcr;
214         uint32  seci_uart_lcr;
215         uint32  seci_uart_mcr;
216         uint32  seci_uart_lsr;
217         uint32  seci_uart_msr;
218         uint32  seci_uart_baudadj;
219         /* Clock control and hardware workarounds (corerev >= 20) */
220         uint32  clk_ctl_st;             /* 0x1e0 */
221         uint32  hw_war;
222         uint32  PAD[70];
223
224         /* UARTs */
225         uint8   uart0data;              /* 0x300 */
226         uint8   uart0imr;
227         uint8   uart0fcr;
228         uint8   uart0lcr;
229         uint8   uart0mcr;
230         uint8   uart0lsr;
231         uint8   uart0msr;
232         uint8   uart0scratch;
233         uint8   PAD[248];               /* corerev >= 1 */
234
235         uint8   uart1data;              /* 0x400 */
236         uint8   uart1imr;
237         uint8   uart1fcr;
238         uint8   uart1lcr;
239         uint8   uart1mcr;
240         uint8   uart1lsr;
241         uint8   uart1msr;
242         uint8   uart1scratch;
243         uint32  PAD[126];
244
245         /* PMU registers (corerev >= 20) */
246         /* Note: all timers driven by ILP clock are updated asynchronously to HT/ALP.
247          * The CPU must read them twice, compare, and retry if different.
248          */
249         uint32  pmucontrol;             /* 0x600 */
250         uint32  pmucapabilities;
251         uint32  pmustatus;
252         uint32  res_state;
253         uint32  res_pending;
254         uint32  pmutimer;
255         uint32  min_res_mask;
256         uint32  max_res_mask;
257         uint32  res_table_sel;
258         uint32  res_dep_mask;
259         uint32  res_updn_timer;
260         uint32  res_timer;
261         uint32  clkstretch;
262         uint32  pmuwatchdog;
263         uint32  gpiosel;                /* 0x638, rev >= 1 */
264         uint32  gpioenable;             /* 0x63c, rev >= 1 */
265         uint32  res_req_timer_sel;
266         uint32  res_req_timer;
267         uint32  res_req_mask;
268         uint32  PAD;
269         uint32  chipcontrol_addr;       /* 0x650 */
270         uint32  chipcontrol_data;       /* 0x654 */
271         uint32  regcontrol_addr;
272         uint32  regcontrol_data;
273         uint32  pllcontrol_addr;
274         uint32  pllcontrol_data;
275         uint32  pmustrapopt;            /* 0x668, corerev >= 28 */
276         uint32  pmu_xtalfreq;           /* 0x66C, pmurev >= 10 */
277         uint32  PAD[100];
278         uint16  sromotp[768];
279 } chipcregs_t;
280
281 #endif /* _LANGUAGE_ASSEMBLY */
282
283
284 #define CC_CHIPID               0
285 #define CC_CAPABILITIES         4
286 #define CC_CHIPST               0x2c
287 #define CC_EROMPTR              0xfc
288
289
290 #define CC_OTPST                0x10
291 #define CC_JTAGCMD              0x30
292 #define CC_JTAGIR               0x34
293 #define CC_JTAGDR               0x38
294 #define CC_JTAGCTRL             0x3c
295 #define CC_GPIOPU               0x58
296 #define CC_GPIOPD               0x5c
297 #define CC_GPIOIN               0x60
298 #define CC_GPIOOUT              0x64
299 #define CC_GPIOOUTEN            0x68
300 #define CC_GPIOCTRL             0x6c
301 #define CC_GPIOPOL              0x70
302 #define CC_GPIOINTM             0x74
303 #define CC_WATCHDOG             0x80
304 #define CC_CLKC_N               0x90
305 #define CC_CLKC_M0              0x94
306 #define CC_CLKC_M1              0x98
307 #define CC_CLKC_M2              0x9c
308 #define CC_CLKC_M3              0xa0
309 #define CC_CLKDIV               0xa4
310 #define CC_SYS_CLK_CTL          0xc0
311 #define CC_CLK_CTL_ST           SI_CLK_CTL_ST
312 #define PMU_CTL                 0x600
313 #define PMU_CAP                 0x604
314 #define PMU_ST                  0x608
315 #define PMU_RES_STATE           0x60c
316 #define PMU_TIMER               0x614
317 #define PMU_MIN_RES_MASK        0x618
318 #define PMU_MAX_RES_MASK        0x61c
319 #define CC_CHIPCTL_ADDR         0x650
320 #define CC_CHIPCTL_DATA         0x654
321 #define PMU_REG_CONTROL_ADDR    0x658
322 #define PMU_REG_CONTROL_DATA    0x65C
323 #define PMU_PLL_CONTROL_ADDR    0x660
324 #define PMU_PLL_CONTROL_DATA    0x664
325 #define CC_SROM_OTP             0x800           /* SROM/OTP address space */
326
327 /* chipid */
328 #define CID_ID_MASK             0x0000ffff      /* Chip Id mask */
329 #define CID_REV_MASK            0x000f0000      /* Chip Revision mask */
330 #define CID_REV_SHIFT           16              /* Chip Revision shift */
331 #define CID_PKG_MASK            0x00f00000      /* Package Option mask */
332 #define CID_PKG_SHIFT           20              /* Package Option shift */
333 #define CID_CC_MASK             0x0f000000      /* CoreCount (corerev >= 4) */
334 #define CID_CC_SHIFT            24
335 #define CID_TYPE_MASK           0xf0000000      /* Chip Type */
336 #define CID_TYPE_SHIFT          28
337
338 /* capabilities */
339 #define CC_CAP_UARTS_MASK       0x00000003      /* Number of UARTs */
340 #define CC_CAP_MIPSEB           0x00000004      /* MIPS is in big-endian mode */
341 #define CC_CAP_UCLKSEL          0x00000018      /* UARTs clock select */
342 #define CC_CAP_UINTCLK          0x00000008      /* UARTs are driven by internal divided clock */
343 #define CC_CAP_UARTGPIO         0x00000020      /* UARTs own GPIOs 15:12 */
344 #define CC_CAP_EXTBUS_MASK      0x000000c0      /* External bus mask */
345 #define CC_CAP_EXTBUS_NONE      0x00000000      /* No ExtBus present */
346 #define CC_CAP_EXTBUS_FULL      0x00000040      /* ExtBus: PCMCIA, IDE & Prog */
347 #define CC_CAP_EXTBUS_PROG      0x00000080      /* ExtBus: ProgIf only */
348 #define CC_CAP_FLASH_MASK       0x00000700      /* Type of flash */
349 #define CC_CAP_PLL_MASK         0x00038000      /* Type of PLL */
350 #define CC_CAP_PWR_CTL          0x00040000      /* Power control */
351 #define CC_CAP_OTPSIZE          0x00380000      /* OTP Size (0 = none) */
352 #define CC_CAP_OTPSIZE_SHIFT    19              /* OTP Size shift */
353 #define CC_CAP_OTPSIZE_BASE     5               /* OTP Size base */
354 #define CC_CAP_JTAGP            0x00400000      /* JTAG Master Present */
355 #define CC_CAP_ROM              0x00800000      /* Internal boot rom active */
356 #define CC_CAP_BKPLN64          0x08000000      /* 64-bit backplane */
357 #define CC_CAP_PMU              0x10000000      /* PMU Present, rev >= 20 */
358 #define CC_CAP_ECI              0x20000000      /* ECI Present, rev >= 21 */
359 #define CC_CAP_SROM             0x40000000      /* Srom Present, rev >= 32 */
360 #define CC_CAP_NFLASH           0x80000000      /* Nand flash present, rev >= 35 */
361
362 #define CC_CAP2_SECI            0x00000001      /* SECI Present, rev >= 36 */
363 #define CC_CAP2_GSIO            0x00000002      /* GSIO (spi/i2c) present, rev >= 37 */
364
365 /* capabilities extension */
366 #define CC_CAP_EXT_SECI_PRESENT   0x00000001    /* SECI present */
367
368 /* PLL type */
369 #define PLL_NONE                0x00000000
370 #define PLL_TYPE1               0x00010000      /* 48MHz base, 3 dividers */
371 #define PLL_TYPE2               0x00020000      /* 48MHz, 4 dividers */
372 #define PLL_TYPE3               0x00030000      /* 25MHz, 2 dividers */
373 #define PLL_TYPE4               0x00008000      /* 48MHz, 4 dividers */
374 #define PLL_TYPE5               0x00018000      /* 25MHz, 4 dividers */
375 #define PLL_TYPE6               0x00028000      /* 100/200 or 120/240 only */
376 #define PLL_TYPE7               0x00038000      /* 25MHz, 4 dividers */
377
378 /* ILP clock */
379 #define ILP_CLOCK               32000
380
381 /* ALP clock on pre-PMU chips */
382 #define ALP_CLOCK               20000000
383
384 /* HT clock */
385 #define HT_CLOCK                80000000
386
387 /* corecontrol */
388 #define CC_UARTCLKO             0x00000001      /* Drive UART with internal clock */
389 #define CC_SE                   0x00000002      /* sync clk out enable (corerev >= 3) */
390 #define CC_UARTCLKEN            0x00000008      /* enable UART Clock (corerev > = 21 */
391
392 /* chipcontrol */
393 #define CHIPCTRL_4321A0_DEFAULT 0x3a4
394 #define CHIPCTRL_4321A1_DEFAULT 0x0a4
395 #define CHIPCTRL_4321_PLL_DOWN  0x800000        /* serdes PLL down override */
396
397 /* Fields in the otpstatus register in rev >= 21 */
398 #define OTPS_OL_MASK            0x000000ff
399 #define OTPS_OL_MFG             0x00000001      /* manuf row is locked */
400 #define OTPS_OL_OR1             0x00000002      /* otp redundancy row 1 is locked */
401 #define OTPS_OL_OR2             0x00000004      /* otp redundancy row 2 is locked */
402 #define OTPS_OL_GU              0x00000008      /* general use region is locked */
403 #define OTPS_GUP_MASK           0x00000f00
404 #define OTPS_GUP_SHIFT          8
405 #define OTPS_GUP_HW             0x00000100      /* h/w subregion is programmed */
406 #define OTPS_GUP_SW             0x00000200      /* s/w subregion is programmed */
407 #define OTPS_GUP_CI             0x00000400      /* chipid/pkgopt subregion is programmed */
408 #define OTPS_GUP_FUSE           0x00000800      /* fuse subregion is programmed */
409 #define OTPS_READY              0x00001000
410 #define OTPS_RV(x)              (1 << (16 + (x)))       /* redundancy entry valid */
411 #define OTPS_RV_MASK            0x0fff0000
412
413 /* Fields in the otpcontrol register in rev >= 21 */
414 #define OTPC_PROGSEL            0x00000001
415 #define OTPC_PCOUNT_MASK        0x0000000e
416 #define OTPC_PCOUNT_SHIFT       1
417 #define OTPC_VSEL_MASK          0x000000f0
418 #define OTPC_VSEL_SHIFT         4
419 #define OTPC_TMM_MASK           0x00000700
420 #define OTPC_TMM_SHIFT          8
421 #define OTPC_ODM                0x00000800
422 #define OTPC_PROGEN             0x80000000
423
424 /* Fields in otpprog in rev >= 21 and HND OTP */
425 #define OTPP_COL_MASK           0x000000ff
426 #define OTPP_COL_SHIFT          0
427 #define OTPP_ROW_MASK           0x0000ff00
428 #define OTPP_ROW_SHIFT          8
429 #define OTPP_OC_MASK            0x0f000000
430 #define OTPP_OC_SHIFT           24
431 #define OTPP_READERR            0x10000000
432 #define OTPP_VALUE_MASK         0x20000000
433 #define OTPP_VALUE_SHIFT        29
434 #define OTPP_START_BUSY         0x80000000
435 #define OTPP_READ               0x40000000      /* HND OTP */
436
437 /* otplayout reg corerev >= 36 */
438 #define OTP_CISFORMAT_NEW       0x80000000
439
440 /* Opcodes for OTPP_OC field */
441 #define OTPPOC_READ             0
442 #define OTPPOC_BIT_PROG         1
443 #define OTPPOC_VERIFY           3
444 #define OTPPOC_INIT             4
445 #define OTPPOC_SET              5
446 #define OTPPOC_RESET            6
447 #define OTPPOC_OCST             7
448 #define OTPPOC_ROW_LOCK         8
449 #define OTPPOC_PRESCN_TEST      9
450
451
452 /* Jtagm characteristics that appeared at a given corerev */
453 #define JTAGM_CREV_OLD          10      /* Old command set, 16bit max IR */
454 #define JTAGM_CREV_IRP          22      /* Able to do pause-ir */
455 #define JTAGM_CREV_RTI          28      /* Able to do return-to-idle */
456
457 /* jtagcmd */
458 #define JCMD_START              0x80000000
459 #define JCMD_BUSY               0x80000000
460 #define JCMD_STATE_MASK         0x60000000
461 #define JCMD_STATE_TLR          0x00000000      /* Test-logic-reset */
462 #define JCMD_STATE_PIR          0x20000000      /* Pause IR */
463 #define JCMD_STATE_PDR          0x40000000      /* Pause DR */
464 #define JCMD_STATE_RTI          0x60000000      /* Run-test-idle */
465 #define JCMD0_ACC_MASK          0x0000f000
466 #define JCMD0_ACC_IRDR          0x00000000
467 #define JCMD0_ACC_DR            0x00001000
468 #define JCMD0_ACC_IR            0x00002000
469 #define JCMD0_ACC_RESET         0x00003000
470 #define JCMD0_ACC_IRPDR         0x00004000
471 #define JCMD0_ACC_PDR           0x00005000
472 #define JCMD0_IRW_MASK          0x00000f00
473 #define JCMD_ACC_MASK           0x000f0000      /* Changes for corerev 11 */
474 #define JCMD_ACC_IRDR           0x00000000
475 #define JCMD_ACC_DR             0x00010000
476 #define JCMD_ACC_IR             0x00020000
477 #define JCMD_ACC_RESET          0x00030000
478 #define JCMD_ACC_IRPDR          0x00040000
479 #define JCMD_ACC_PDR            0x00050000
480 #define JCMD_ACC_PIR            0x00060000
481 #define JCMD_ACC_IRDR_I         0x00070000      /* rev 28: return to run-test-idle */
482 #define JCMD_ACC_DR_I           0x00080000      /* rev 28: return to run-test-idle */
483 #define JCMD_IRW_MASK           0x00001f00
484 #define JCMD_IRW_SHIFT          8
485 #define JCMD_DRW_MASK           0x0000003f
486
487 /* jtagctrl */
488 #define JCTRL_FORCE_CLK         4               /* Force clock */
489 #define JCTRL_EXT_EN            2               /* Enable external targets */
490 #define JCTRL_EN                1               /* Enable Jtag master */
491
492 /* Fields in clkdiv */
493 #define CLKD_SFLASH             0x0f000000
494 #define CLKD_SFLASH_SHIFT       24
495 #define CLKD_OTP                0x000f0000
496 #define CLKD_OTP_SHIFT          16
497 #define CLKD_JTAG               0x00000f00
498 #define CLKD_JTAG_SHIFT         8
499 #define CLKD_UART               0x000000ff
500
501 #define CLKD2_SROM              0x00000003
502
503 /* intstatus/intmask */
504 #define CI_GPIO                 0x00000001      /* gpio intr */
505 #define CI_EI                   0x00000002      /* extif intr (corerev >= 3) */
506 #define CI_TEMP                 0x00000004      /* temp. ctrl intr (corerev >= 15) */
507 #define CI_SIRQ                 0x00000008      /* serial IRQ intr (corerev >= 15) */
508 #define CI_ECI                  0x00000010      /* eci intr (corerev >= 21) */
509 #define CI_PMU                  0x00000020      /* pmu intr (corerev >= 21) */
510 #define CI_UART                 0x00000040      /* uart intr (corerev >= 21) */
511 #define CI_WDRESET              0x80000000      /* watchdog reset occurred */
512
513 /* slow_clk_ctl */
514 #define SCC_SS_MASK             0x00000007      /* slow clock source mask */
515 #define SCC_SS_LPO              0x00000000      /* source of slow clock is LPO */
516 #define SCC_SS_XTAL             0x00000001      /* source of slow clock is crystal */
517 #define SCC_SS_PCI              0x00000002      /* source of slow clock is PCI */
518 #define SCC_LF                  0x00000200      /* LPOFreqSel, 1: 160Khz, 0: 32KHz */
519 #define SCC_LP                  0x00000400      /* LPOPowerDown, 1: LPO is disabled,
520                                                  * 0: LPO is enabled
521                                                  */
522 #define SCC_FS                  0x00000800      /* ForceSlowClk, 1: sb/cores running on slow clock,
523                                                  * 0: power logic control
524                                                  */
525 #define SCC_IP                  0x00001000      /* IgnorePllOffReq, 1/0: power logic ignores/honors
526                                                  * PLL clock disable requests from core
527                                                  */
528 #define SCC_XC                  0x00002000      /* XtalControlEn, 1/0: power logic does/doesn't
529                                                  * disable crystal when appropriate
530                                                  */
531 #define SCC_XP                  0x00004000      /* XtalPU (RO), 1/0: crystal running/disabled */
532 #define SCC_CD_MASK             0xffff0000      /* ClockDivider (SlowClk = 1/(4+divisor)) */
533 #define SCC_CD_SHIFT            16
534
535 /* system_clk_ctl */
536 #define SYCC_IE                 0x00000001      /* ILPen: Enable Idle Low Power */
537 #define SYCC_AE                 0x00000002      /* ALPen: Enable Active Low Power */
538 #define SYCC_FP                 0x00000004      /* ForcePLLOn */
539 #define SYCC_AR                 0x00000008      /* Force ALP (or HT if ALPen is not set */
540 #define SYCC_HR                 0x00000010      /* Force HT */
541 #define SYCC_CD_MASK            0xffff0000      /* ClkDiv  (ILP = 1/(4 * (divisor + 1)) */
542 #define SYCC_CD_SHIFT           16
543
544 /* Indirect backplane access */
545 #define BPIA_BYTEEN             0x0000000f
546 #define BPIA_SZ1                0x00000001
547 #define BPIA_SZ2                0x00000003
548 #define BPIA_SZ4                0x00000007
549 #define BPIA_SZ8                0x0000000f
550 #define BPIA_WRITE              0x00000100
551 #define BPIA_START              0x00000200
552 #define BPIA_BUSY               0x00000200
553 #define BPIA_ERROR              0x00000400
554
555 /* pcmcia/prog/flash_config */
556 #define CF_EN                   0x00000001      /* enable */
557 #define CF_EM_MASK              0x0000000e      /* mode */
558 #define CF_EM_SHIFT             1
559 #define CF_EM_FLASH             0               /* flash/asynchronous mode */
560 #define CF_EM_SYNC              2               /* synchronous mode */
561 #define CF_EM_PCMCIA            4               /* pcmcia mode */
562 #define CF_DS                   0x00000010      /* destsize:  0=8bit, 1=16bit */
563 #define CF_BS                   0x00000020      /* byteswap */
564 #define CF_CD_MASK              0x000000c0      /* clock divider */
565 #define CF_CD_SHIFT             6
566 #define CF_CD_DIV2              0x00000000      /* backplane/2 */
567 #define CF_CD_DIV3              0x00000040      /* backplane/3 */
568 #define CF_CD_DIV4              0x00000080      /* backplane/4 */
569 #define CF_CE                   0x00000100      /* clock enable */
570 #define CF_SB                   0x00000200      /* size/bytestrobe (synch only) */
571
572 /* pcmcia_memwait */
573 #define PM_W0_MASK              0x0000003f      /* waitcount0 */
574 #define PM_W1_MASK              0x00001f00      /* waitcount1 */
575 #define PM_W1_SHIFT             8
576 #define PM_W2_MASK              0x001f0000      /* waitcount2 */
577 #define PM_W2_SHIFT             16
578 #define PM_W3_MASK              0x1f000000      /* waitcount3 */
579 #define PM_W3_SHIFT             24
580
581 /* pcmcia_attrwait */
582 #define PA_W0_MASK              0x0000003f      /* waitcount0 */
583 #define PA_W1_MASK              0x00001f00      /* waitcount1 */
584 #define PA_W1_SHIFT             8
585 #define PA_W2_MASK              0x001f0000      /* waitcount2 */
586 #define PA_W2_SHIFT             16
587 #define PA_W3_MASK              0x1f000000      /* waitcount3 */
588 #define PA_W3_SHIFT             24
589
590 /* pcmcia_iowait */
591 #define PI_W0_MASK              0x0000003f      /* waitcount0 */
592 #define PI_W1_MASK              0x00001f00      /* waitcount1 */
593 #define PI_W1_SHIFT             8
594 #define PI_W2_MASK              0x001f0000      /* waitcount2 */
595 #define PI_W2_SHIFT             16
596 #define PI_W3_MASK              0x1f000000      /* waitcount3 */
597 #define PI_W3_SHIFT             24
598
599 /* prog_waitcount */
600 #define PW_W0_MASK              0x0000001f      /* waitcount0 */
601 #define PW_W1_MASK              0x00001f00      /* waitcount1 */
602 #define PW_W1_SHIFT             8
603 #define PW_W2_MASK              0x001f0000      /* waitcount2 */
604 #define PW_W2_SHIFT             16
605 #define PW_W3_MASK              0x1f000000      /* waitcount3 */
606 #define PW_W3_SHIFT             24
607
608 #define PW_W0                   0x0000000c
609 #define PW_W1                   0x00000a00
610 #define PW_W2                   0x00020000
611 #define PW_W3                   0x01000000
612
613 /* flash_waitcount */
614 #define FW_W0_MASK              0x0000003f      /* waitcount0 */
615 #define FW_W1_MASK              0x00001f00      /* waitcount1 */
616 #define FW_W1_SHIFT             8
617 #define FW_W2_MASK              0x001f0000      /* waitcount2 */
618 #define FW_W2_SHIFT             16
619 #define FW_W3_MASK              0x1f000000      /* waitcount3 */
620 #define FW_W3_SHIFT             24
621
622 /* When Srom support present, fields in sromcontrol */
623 #define SRC_START               0x80000000
624 #define SRC_BUSY                0x80000000
625 #define SRC_OPCODE              0x60000000
626 #define SRC_OP_READ             0x00000000
627 #define SRC_OP_WRITE            0x20000000
628 #define SRC_OP_WRDIS            0x40000000
629 #define SRC_OP_WREN             0x60000000
630 #define SRC_OTPSEL              0x00000010
631 #define SRC_LOCK                0x00000008
632 #define SRC_SIZE_MASK           0x00000006
633 #define SRC_SIZE_1K             0x00000000
634 #define SRC_SIZE_4K             0x00000002
635 #define SRC_SIZE_16K            0x00000004
636 #define SRC_SIZE_SHIFT          1
637 #define SRC_PRESENT             0x00000001
638
639 /* Fields in pmucontrol */
640 #define PCTL_ILP_DIV_MASK       0xffff0000
641 #define PCTL_ILP_DIV_SHIFT      16
642 #define PCTL_PLL_PLLCTL_UPD     0x00000400      /* rev 2 */
643 #define PCTL_NOILP_ON_WAIT      0x00000200      /* rev 1 */
644 #define PCTL_HT_REQ_EN          0x00000100
645 #define PCTL_ALP_REQ_EN         0x00000080
646 #define PCTL_XTALFREQ_MASK      0x0000007c
647 #define PCTL_XTALFREQ_SHIFT     2
648 #define PCTL_ILP_DIV_EN         0x00000002
649 #define PCTL_LPO_SEL            0x00000001
650
651 /* Fields in clkstretch */
652 #define CSTRETCH_HT             0xffff0000
653 #define CSTRETCH_ALP            0x0000ffff
654
655 /* gpiotimerval */
656 #define GPIO_ONTIME_SHIFT       16
657
658 /* clockcontrol_n */
659 #define CN_N1_MASK              0x3f            /* n1 control */
660 #define CN_N2_MASK              0x3f00          /* n2 control */
661 #define CN_N2_SHIFT             8
662 #define CN_PLLC_MASK            0xf0000         /* pll control */
663 #define CN_PLLC_SHIFT           16
664
665 /* clockcontrol_sb/pci/uart */
666 #define CC_M1_MASK              0x3f            /* m1 control */
667 #define CC_M2_MASK              0x3f00          /* m2 control */
668 #define CC_M2_SHIFT             8
669 #define CC_M3_MASK              0x3f0000        /* m3 control */
670 #define CC_M3_SHIFT             16
671 #define CC_MC_MASK              0x1f000000      /* mux control */
672 #define CC_MC_SHIFT             24
673
674 /* N3M Clock control magic field values */
675 #define CC_F6_2                 0x02            /* A factor of 2 in */
676 #define CC_F6_3                 0x03            /* 6-bit fields like */
677 #define CC_F6_4                 0x05            /* N1, M1 or M3 */
678 #define CC_F6_5                 0x09
679 #define CC_F6_6                 0x11
680 #define CC_F6_7                 0x21
681
682 #define CC_F5_BIAS              5               /* 5-bit fields get this added */
683
684 #define CC_MC_BYPASS            0x08
685 #define CC_MC_M1                0x04
686 #define CC_MC_M1M2              0x02
687 #define CC_MC_M1M2M3            0x01
688 #define CC_MC_M1M3              0x11
689
690 /* Type 2 Clock control magic field values */
691 #define CC_T2_BIAS              2               /* n1, n2, m1 & m3 bias */
692 #define CC_T2M2_BIAS            3               /* m2 bias */
693
694 #define CC_T2MC_M1BYP           1
695 #define CC_T2MC_M2BYP           2
696 #define CC_T2MC_M3BYP           4
697
698 /* Type 6 Clock control magic field values */
699 #define CC_T6_MMASK             1               /* bits of interest in m */
700 #define CC_T6_M0                120000000       /* sb clock for m = 0 */
701 #define CC_T6_M1                100000000       /* sb clock for m = 1 */
702 #define SB2MIPS_T6(sb)          (2 * (sb))
703
704 /* Common clock base */
705 #define CC_CLOCK_BASE1          24000000        /* Half the clock freq */
706 #define CC_CLOCK_BASE2          12500000        /* Alternate crystal on some PLLs */
707
708 /* Clock control values for 200MHz in 5350 */
709 #define CLKC_5350_N             0x0311
710 #define CLKC_5350_M             0x04020009
711
712 /* Flash types in the chipcommon capabilities register */
713 #define FLASH_NONE              0x000           /* No flash */
714 #define SFLASH_ST               0x100           /* ST serial flash */
715 #define SFLASH_AT               0x200           /* Atmel serial flash */
716 #define PFLASH                  0x700           /* Parallel flash */
717
718 /* Bits in the ExtBus config registers */
719 #define CC_CFG_EN               0x0001          /* Enable */
720 #define CC_CFG_EM_MASK          0x000e          /* Extif Mode */
721 #define CC_CFG_EM_ASYNC         0x0000          /*   Async/Parallel flash */
722 #define CC_CFG_EM_SYNC          0x0002          /*   Synchronous */
723 #define CC_CFG_EM_PCMCIA        0x0004          /*   PCMCIA */
724 #define CC_CFG_EM_IDE           0x0006          /*   IDE */
725 #define CC_CFG_DS               0x0010          /* Data size, 0=8bit, 1=16bit */
726 #define CC_CFG_CD_MASK          0x00e0          /* Sync: Clock divisor, rev >= 20 */
727 #define CC_CFG_CE               0x0100          /* Sync: Clock enable, rev >= 20 */
728 #define CC_CFG_SB               0x0200          /* Sync: Size/Bytestrobe, rev >= 20 */
729 #define CC_CFG_IS               0x0400          /* Extif Sync Clk Select, rev >= 20 */
730
731 /* ExtBus address space */
732 #define CC_EB_BASE              0x1a000000      /* Chipc ExtBus base address */
733 #define CC_EB_PCMCIA_MEM        0x1a000000      /* PCMCIA 0 memory base address */
734 #define CC_EB_PCMCIA_IO         0x1a200000      /* PCMCIA 0 I/O base address */
735 #define CC_EB_PCMCIA_CFG        0x1a400000      /* PCMCIA 0 config base address */
736 #define CC_EB_IDE               0x1a800000      /* IDE memory base */
737 #define CC_EB_PCMCIA1_MEM       0x1a800000      /* PCMCIA 1 memory base address */
738 #define CC_EB_PCMCIA1_IO        0x1aa00000      /* PCMCIA 1 I/O base address */
739 #define CC_EB_PCMCIA1_CFG       0x1ac00000      /* PCMCIA 1 config base address */
740 #define CC_EB_PROGIF            0x1b000000      /* ProgIF Async/Sync base address */
741
742
743 /* Start/busy bit in flashcontrol */
744 #define SFLASH_OPCODE           0x000000ff
745 #define SFLASH_ACTION           0x00000700
746 #define SFLASH_CS_ACTIVE        0x00001000      /* Chip Select Active, rev >= 20 */
747 #define SFLASH_START            0x80000000
748 #define SFLASH_BUSY             SFLASH_START
749
750 /* flashcontrol action codes */
751 #define SFLASH_ACT_OPONLY       0x0000          /* Issue opcode only */
752 #define SFLASH_ACT_OP1D         0x0100          /* opcode + 1 data byte */
753 #define SFLASH_ACT_OP3A         0x0200          /* opcode + 3 addr bytes */
754 #define SFLASH_ACT_OP3A1D       0x0300          /* opcode + 3 addr & 1 data bytes */
755 #define SFLASH_ACT_OP3A4D       0x0400          /* opcode + 3 addr & 4 data bytes */
756 #define SFLASH_ACT_OP3A4X4D     0x0500          /* opcode + 3 addr, 4 don't care & 4 data bytes */
757 #define SFLASH_ACT_OP3A1X4D     0x0700          /* opcode + 3 addr, 1 don't care & 4 data bytes */
758
759 /* flashcontrol action+opcodes for ST flashes */
760 #define SFLASH_ST_WREN          0x0006          /* Write Enable */
761 #define SFLASH_ST_WRDIS         0x0004          /* Write Disable */
762 #define SFLASH_ST_RDSR          0x0105          /* Read Status Register */
763 #define SFLASH_ST_WRSR          0x0101          /* Write Status Register */
764 #define SFLASH_ST_READ          0x0303          /* Read Data Bytes */
765 #define SFLASH_ST_PP            0x0302          /* Page Program */
766 #define SFLASH_ST_SE            0x02d8          /* Sector Erase */
767 #define SFLASH_ST_BE            0x00c7          /* Bulk Erase */
768 #define SFLASH_ST_DP            0x00b9          /* Deep Power-down */
769 #define SFLASH_ST_RES           0x03ab          /* Read Electronic Signature */
770 #define SFLASH_ST_CSA           0x1000          /* Keep chip select asserted */
771 #define SFLASH_ST_SSE           0x0220          /* Sub-sector Erase */
772
773 /* Status register bits for ST flashes */
774 #define SFLASH_ST_WIP           0x01            /* Write In Progress */
775 #define SFLASH_ST_WEL           0x02            /* Write Enable Latch */
776 #define SFLASH_ST_BP_MASK       0x1c            /* Block Protect */
777 #define SFLASH_ST_BP_SHIFT      2
778 #define SFLASH_ST_SRWD          0x80            /* Status Register Write Disable */
779
780 /* flashcontrol action+opcodes for Atmel flashes */
781 #define SFLASH_AT_READ                          0x07e8
782 #define SFLASH_AT_PAGE_READ                     0x07d2
783 #define SFLASH_AT_BUF1_READ
784 #define SFLASH_AT_BUF2_READ
785 #define SFLASH_AT_STATUS                        0x01d7
786 #define SFLASH_AT_BUF1_WRITE                    0x0384
787 #define SFLASH_AT_BUF2_WRITE                    0x0387
788 #define SFLASH_AT_BUF1_ERASE_PROGRAM            0x0283
789 #define SFLASH_AT_BUF2_ERASE_PROGRAM            0x0286
790 #define SFLASH_AT_BUF1_PROGRAM                  0x0288
791 #define SFLASH_AT_BUF2_PROGRAM                  0x0289
792 #define SFLASH_AT_PAGE_ERASE                    0x0281
793 #define SFLASH_AT_BLOCK_ERASE                   0x0250
794 #define SFLASH_AT_BUF1_WRITE_ERASE_PROGRAM      0x0382
795 #define SFLASH_AT_BUF2_WRITE_ERASE_PROGRAM      0x0385
796 #define SFLASH_AT_BUF1_LOAD                     0x0253
797 #define SFLASH_AT_BUF2_LOAD                     0x0255
798 #define SFLASH_AT_BUF1_COMPARE                  0x0260
799 #define SFLASH_AT_BUF2_COMPARE                  0x0261
800 #define SFLASH_AT_BUF1_REPROGRAM                0x0258
801 #define SFLASH_AT_BUF2_REPROGRAM                0x0259
802
803 /* Status register bits for Atmel flashes */
804 #define SFLASH_AT_READY                         0x80
805 #define SFLASH_AT_MISMATCH                      0x40
806 #define SFLASH_AT_ID_MASK                       0x38
807 #define SFLASH_AT_ID_SHIFT                      3
808
809 /* SPI register bits, corerev >= 37 */
810 #define GSIO_START                      0x80000000
811 #define GSIO_BUSY                       GSIO_START
812
813 /* 
814  * These are the UART port assignments, expressed as offsets from the base
815  * register.  These assignments should hold for any serial port based on
816  * a 8250, 16450, or 16550(A).
817  */
818
819 #define UART_RX         0       /* In:  Receive buffer (DLAB=0) */
820 #define UART_TX         0       /* Out: Transmit buffer (DLAB=0) */
821 #define UART_DLL        0       /* Out: Divisor Latch Low (DLAB=1) */
822 #define UART_IER        1       /* In/Out: Interrupt Enable Register (DLAB=0) */
823 #define UART_DLM        1       /* Out: Divisor Latch High (DLAB=1) */
824 #define UART_IIR        2       /* In: Interrupt Identity Register  */
825 #define UART_FCR        2       /* Out: FIFO Control Register */
826 #define UART_LCR        3       /* Out: Line Control Register */
827 #define UART_MCR        4       /* Out: Modem Control Register */
828 #define UART_LSR        5       /* In:  Line Status Register */
829 #define UART_MSR        6       /* In:  Modem Status Register */
830 #define UART_SCR        7       /* I/O: Scratch Register */
831 #define UART_LCR_DLAB   0x80    /* Divisor latch access bit */
832 #define UART_LCR_WLEN8  0x03    /* Word length: 8 bits */
833 #define UART_MCR_OUT2   0x08    /* MCR GPIO out 2 */
834 #define UART_MCR_LOOP   0x10    /* Enable loopback test mode */
835 #define UART_LSR_RX_FIFO        0x80    /* Receive FIFO error */
836 #define UART_LSR_TDHR           0x40    /* Data-hold-register empty */
837 #define UART_LSR_THRE           0x20    /* Transmit-hold-register empty */
838 #define UART_LSR_BREAK          0x10    /* Break interrupt */
839 #define UART_LSR_FRAMING        0x08    /* Framing error */
840 #define UART_LSR_PARITY         0x04    /* Parity error */
841 #define UART_LSR_OVERRUN        0x02    /* Overrun error */
842 #define UART_LSR_RXRDY          0x01    /* Receiver ready */
843 #define UART_FCR_FIFO_ENABLE 1  /* FIFO control register bit controlling FIFO enable/disable */
844
845 /* Interrupt Identity Register (IIR) bits */
846 #define UART_IIR_FIFO_MASK      0xc0    /* IIR FIFO disable/enabled mask */
847 #define UART_IIR_INT_MASK       0xf     /* IIR interrupt ID source */
848 #define UART_IIR_MDM_CHG        0x0     /* Modem status changed */
849 #define UART_IIR_NOINT          0x1     /* No interrupt pending */
850 #define UART_IIR_THRE           0x2     /* THR empty */
851 #define UART_IIR_RCVD_DATA      0x4     /* Received data available */
852 #define UART_IIR_RCVR_STATUS    0x6     /* Receiver status */
853 #define UART_IIR_CHAR_TIME      0xc     /* Character time */
854
855 /* Interrupt Enable Register (IER) bits */
856 #define UART_IER_EDSSI  8       /* enable modem status interrupt */
857 #define UART_IER_ELSI   4       /* enable receiver line status interrupt */
858 #define UART_IER_ETBEI  2       /* enable transmitter holding register empty interrupt */
859 #define UART_IER_ERBFI  1       /* enable data available interrupt */
860
861 /* pmustatus */
862 #define PST_EXTLPOAVAIL 0x0100
863 #define PST_WDRESET     0x0080
864 #define PST_INTPEND     0x0040
865 #define PST_SBCLKST     0x0030
866 #define PST_SBCLKST_ILP 0x0010
867 #define PST_SBCLKST_ALP 0x0020
868 #define PST_SBCLKST_HT  0x0030
869 #define PST_ALPAVAIL    0x0008
870 #define PST_HTAVAIL     0x0004
871 #define PST_RESINIT     0x0003
872
873 /* pmucapabilities */
874 #define PCAP_REV_MASK   0x000000ff
875 #define PCAP_RC_MASK    0x00001f00
876 #define PCAP_RC_SHIFT   8
877 #define PCAP_TC_MASK    0x0001e000
878 #define PCAP_TC_SHIFT   13
879 #define PCAP_PC_MASK    0x001e0000
880 #define PCAP_PC_SHIFT   17
881 #define PCAP_VC_MASK    0x01e00000
882 #define PCAP_VC_SHIFT   21
883 #define PCAP_CC_MASK    0x1e000000
884 #define PCAP_CC_SHIFT   25
885 #define PCAP5_PC_MASK   0x003e0000      /* PMU corerev >= 5 */
886 #define PCAP5_PC_SHIFT  17
887 #define PCAP5_VC_MASK   0x07c00000
888 #define PCAP5_VC_SHIFT  22
889 #define PCAP5_CC_MASK   0xf8000000
890 #define PCAP5_CC_SHIFT  27
891
892 /* PMU Resource Request Timer registers */
893 /* This is based on PmuRev0 */
894 #define PRRT_TIME_MASK  0x03ff
895 #define PRRT_INTEN      0x0400
896 #define PRRT_REQ_ACTIVE 0x0800
897 #define PRRT_ALP_REQ    0x1000
898 #define PRRT_HT_REQ     0x2000
899
900 /* PMU resource bit position */
901 #define PMURES_BIT(bit) (1 << (bit))
902
903 /* PMU resource number limit */
904 #define PMURES_MAX_RESNUM       30
905
906 /* PMU chip control0 register */
907 #define PMU_CHIPCTL0            0
908
909 /* PMU chip control1 register */
910 #define PMU_CHIPCTL1                    1
911 #define PMU_CC1_RXC_DLL_BYPASS          0x00010000
912
913 #define PMU_CC1_IF_TYPE_MASK            0x00000030
914 #define PMU_CC1_IF_TYPE_RMII            0x00000000
915 #define PMU_CC1_IF_TYPE_MII             0x00000010
916 #define PMU_CC1_IF_TYPE_RGMII           0x00000020
917
918 #define PMU_CC1_SW_TYPE_MASK            0x000000c0
919 #define PMU_CC1_SW_TYPE_EPHY            0x00000000
920 #define PMU_CC1_SW_TYPE_EPHYMII         0x00000040
921 #define PMU_CC1_SW_TYPE_EPHYRMII        0x00000080
922 #define PMU_CC1_SW_TYPE_RGMII           0x000000c0
923
924
925 /* PMU corerev and chip specific PLL controls.
926  * PMU<rev>_PLL<num>_XX where <rev> is PMU corerev and <num> is an arbitrary number
927  * to differentiate different PLLs controlled by the same PMU rev.
928  */
929 /* pllcontrol registers */
930 /* PDIV, div_phy, div_arm, div_adc, dith_sel, ioff, kpd_scale, lsb_sel, mash_sel, lf_c & lf_r */
931 #define PMU0_PLL0_PLLCTL0               0
932 #define PMU0_PLL0_PC0_PDIV_MASK         1
933 #define PMU0_PLL0_PC0_PDIV_FREQ         25000
934 #define PMU0_PLL0_PC0_DIV_ARM_MASK      0x00000038
935 #define PMU0_PLL0_PC0_DIV_ARM_SHIFT     3
936 #define PMU0_PLL0_PC0_DIV_ARM_BASE      8
937
938 /* PC0_DIV_ARM for PLLOUT_ARM */
939 #define PMU0_PLL0_PC0_DIV_ARM_110MHZ    0
940 #define PMU0_PLL0_PC0_DIV_ARM_97_7MHZ   1
941 #define PMU0_PLL0_PC0_DIV_ARM_88MHZ     2
942 #define PMU0_PLL0_PC0_DIV_ARM_80MHZ     3 /* Default */
943 #define PMU0_PLL0_PC0_DIV_ARM_73_3MHZ   4
944 #define PMU0_PLL0_PC0_DIV_ARM_67_7MHZ   5
945 #define PMU0_PLL0_PC0_DIV_ARM_62_9MHZ   6
946 #define PMU0_PLL0_PC0_DIV_ARM_58_6MHZ   7
947
948 /* Wildcard base, stop_mod, en_lf_tp, en_cal & lf_r2 */
949 #define PMU0_PLL0_PLLCTL1               1
950 #define PMU0_PLL0_PC1_WILD_INT_MASK     0xf0000000
951 #define PMU0_PLL0_PC1_WILD_INT_SHIFT    28
952 #define PMU0_PLL0_PC1_WILD_FRAC_MASK    0x0fffff00
953 #define PMU0_PLL0_PC1_WILD_FRAC_SHIFT   8
954 #define PMU0_PLL0_PC1_STOP_MOD          0x00000040
955
956 /* Wildcard base, vco_calvar, vco_swc, vco_var_selref, vso_ical & vco_sel_avdd */
957 #define PMU0_PLL0_PLLCTL2               2
958 #define PMU0_PLL0_PC2_WILD_INT_MASK     0xf
959 #define PMU0_PLL0_PC2_WILD_INT_SHIFT    4
960
961 /* pllcontrol registers */
962 /* ndiv_pwrdn, pwrdn_ch<x>, refcomp_pwrdn, dly_ch<x>, p1div, p2div, _bypass_sdmod */
963 #define PMU1_PLL0_PLLCTL0               0
964 #define PMU1_PLL0_PC0_P1DIV_MASK        0x00f00000
965 #define PMU1_PLL0_PC0_P1DIV_SHIFT       20
966 #define PMU1_PLL0_PC0_P2DIV_MASK        0x0f000000
967 #define PMU1_PLL0_PC0_P2DIV_SHIFT       24
968
969 /* m<x>div */
970 #define PMU1_PLL0_PLLCTL1               1
971 #define PMU1_PLL0_PC1_M1DIV_MASK        0x000000ff
972 #define PMU1_PLL0_PC1_M1DIV_SHIFT       0
973 #define PMU1_PLL0_PC1_M2DIV_MASK        0x0000ff00
974 #define PMU1_PLL0_PC1_M2DIV_SHIFT       8
975 #define PMU1_PLL0_PC1_M3DIV_MASK        0x00ff0000
976 #define PMU1_PLL0_PC1_M3DIV_SHIFT       16
977 #define PMU1_PLL0_PC1_M4DIV_MASK        0xff000000
978 #define PMU1_PLL0_PC1_M4DIV_SHIFT       24
979 #define PMU1_PLL0_PC1_M4DIV_BY_9        9
980 #define PMU1_PLL0_PC1_M4DIV_BY_18       0x12
981 #define PMU1_PLL0_PC1_M4DIV_BY_36       0x24
982
983 #define DOT11MAC_880MHZ_CLK_DIVISOR_SHIFT 8
984 #define DOT11MAC_880MHZ_CLK_DIVISOR_MASK (0xFF << DOT11MAC_880MHZ_CLK_DIVISOR_SHIFT)
985 #define DOT11MAC_880MHZ_CLK_DIVISOR_VAL  (0xE << DOT11MAC_880MHZ_CLK_DIVISOR_SHIFT)
986
987 /* m<x>div, ndiv_dither_mfb, ndiv_mode, ndiv_int */
988 #define PMU1_PLL0_PLLCTL2               2
989 #define PMU1_PLL0_PC2_M5DIV_MASK        0x000000ff
990 #define PMU1_PLL0_PC2_M5DIV_SHIFT       0
991 #define PMU1_PLL0_PC2_M5DIV_BY_12       0xc
992 #define PMU1_PLL0_PC2_M5DIV_BY_18       0x12
993 #define PMU1_PLL0_PC2_M5DIV_BY_36       0x24
994 #define PMU1_PLL0_PC2_M6DIV_MASK        0x0000ff00
995 #define PMU1_PLL0_PC2_M6DIV_SHIFT       8
996 #define PMU1_PLL0_PC2_M6DIV_BY_18       0x12
997 #define PMU1_PLL0_PC2_M6DIV_BY_36       0x24
998 #define PMU1_PLL0_PC2_NDIV_MODE_MASK    0x000e0000
999 #define PMU1_PLL0_PC2_NDIV_MODE_SHIFT   17
1000 #define PMU1_PLL0_PC2_NDIV_MODE_MASH    1
1001 #define PMU1_PLL0_PC2_NDIV_MODE_MFB     2       /* recommended for 4319 */
1002 #define PMU1_PLL0_PC2_NDIV_INT_MASK     0x1ff00000
1003 #define PMU1_PLL0_PC2_NDIV_INT_SHIFT    20
1004
1005 /* ndiv_frac */
1006 #define PMU1_PLL0_PLLCTL3               3
1007 #define PMU1_PLL0_PC3_NDIV_FRAC_MASK    0x00ffffff
1008 #define PMU1_PLL0_PC3_NDIV_FRAC_SHIFT   0
1009
1010 /* pll_ctrl */
1011 #define PMU1_PLL0_PLLCTL4               4
1012
1013 /* pll_ctrl, vco_rng, clkdrive_ch<x> */
1014 #define PMU1_PLL0_PLLCTL5               5
1015 #define PMU1_PLL0_PC5_CLK_DRV_MASK 0xffffff00
1016 #define PMU1_PLL0_PC5_CLK_DRV_SHIFT 8
1017
1018 /* PMU rev 2 control words */
1019 #define PMU2_PHY_PLL_PLLCTL             4
1020 #define PMU2_SI_PLL_PLLCTL              10
1021
1022 /* PMU rev 2 */
1023 /* pllcontrol registers */
1024 /* ndiv_pwrdn, pwrdn_ch<x>, refcomp_pwrdn, dly_ch<x>, p1div, p2div, _bypass_sdmod */
1025 #define PMU2_PLL_PLLCTL0                0
1026 #define PMU2_PLL_PC0_P1DIV_MASK         0x00f00000
1027 #define PMU2_PLL_PC0_P1DIV_SHIFT        20
1028 #define PMU2_PLL_PC0_P2DIV_MASK         0x0f000000
1029 #define PMU2_PLL_PC0_P2DIV_SHIFT        24
1030
1031 /* m<x>div */
1032 #define PMU2_PLL_PLLCTL1                1
1033 #define PMU2_PLL_PC1_M1DIV_MASK         0x000000ff
1034 #define PMU2_PLL_PC1_M1DIV_SHIFT        0
1035 #define PMU2_PLL_PC1_M2DIV_MASK         0x0000ff00
1036 #define PMU2_PLL_PC1_M2DIV_SHIFT        8
1037 #define PMU2_PLL_PC1_M3DIV_MASK         0x00ff0000
1038 #define PMU2_PLL_PC1_M3DIV_SHIFT        16
1039 #define PMU2_PLL_PC1_M4DIV_MASK         0xff000000
1040 #define PMU2_PLL_PC1_M4DIV_SHIFT        24
1041
1042 /* m<x>div, ndiv_dither_mfb, ndiv_mode, ndiv_int */
1043 #define PMU2_PLL_PLLCTL2                2
1044 #define PMU2_PLL_PC2_M5DIV_MASK         0x000000ff
1045 #define PMU2_PLL_PC2_M5DIV_SHIFT        0
1046 #define PMU2_PLL_PC2_M6DIV_MASK         0x0000ff00
1047 #define PMU2_PLL_PC2_M6DIV_SHIFT        8
1048 #define PMU2_PLL_PC2_NDIV_MODE_MASK     0x000e0000
1049 #define PMU2_PLL_PC2_NDIV_MODE_SHIFT    17
1050 #define PMU2_PLL_PC2_NDIV_INT_MASK      0x1ff00000
1051 #define PMU2_PLL_PC2_NDIV_INT_SHIFT     20
1052
1053 /* ndiv_frac */
1054 #define PMU2_PLL_PLLCTL3                3
1055 #define PMU2_PLL_PC3_NDIV_FRAC_MASK     0x00ffffff
1056 #define PMU2_PLL_PC3_NDIV_FRAC_SHIFT    0
1057
1058 /* pll_ctrl */
1059 #define PMU2_PLL_PLLCTL4                4
1060
1061 /* pll_ctrl, vco_rng, clkdrive_ch<x> */
1062 #define PMU2_PLL_PLLCTL5                5
1063 #define PMU2_PLL_PC5_CLKDRIVE_CH1_MASK  0x00000f00
1064 #define PMU2_PLL_PC5_CLKDRIVE_CH1_SHIFT 8
1065 #define PMU2_PLL_PC5_CLKDRIVE_CH2_MASK  0x0000f000
1066 #define PMU2_PLL_PC5_CLKDRIVE_CH2_SHIFT 12
1067 #define PMU2_PLL_PC5_CLKDRIVE_CH3_MASK  0x000f0000
1068 #define PMU2_PLL_PC5_CLKDRIVE_CH3_SHIFT 16
1069 #define PMU2_PLL_PC5_CLKDRIVE_CH4_MASK  0x00f00000
1070 #define PMU2_PLL_PC5_CLKDRIVE_CH4_SHIFT 20
1071 #define PMU2_PLL_PC5_CLKDRIVE_CH5_MASK  0x0f000000
1072 #define PMU2_PLL_PC5_CLKDRIVE_CH5_SHIFT 24
1073 #define PMU2_PLL_PC5_CLKDRIVE_CH6_MASK  0xf0000000
1074 #define PMU2_PLL_PC5_CLKDRIVE_CH6_SHIFT 28
1075
1076 /* PMU rev 5 (& 6) */
1077 #define PMU5_PLL_P1P2_OFF               0
1078 #define PMU5_PLL_P1_MASK                0x0f000000
1079 #define PMU5_PLL_P1_SHIFT               24
1080 #define PMU5_PLL_P2_MASK                0x00f00000
1081 #define PMU5_PLL_P2_SHIFT               20
1082 #define PMU5_PLL_M14_OFF                1
1083 #define PMU5_PLL_MDIV_MASK              0x000000ff
1084 #define PMU5_PLL_MDIV_WIDTH             8
1085 #define PMU5_PLL_NM5_OFF                2
1086 #define PMU5_PLL_NDIV_MASK              0xfff00000
1087 #define PMU5_PLL_NDIV_SHIFT             20
1088 #define PMU5_PLL_NDIV_MODE_MASK         0x000e0000
1089 #define PMU5_PLL_NDIV_MODE_SHIFT        17
1090 #define PMU5_PLL_FMAB_OFF               3
1091 #define PMU5_PLL_MRAT_MASK              0xf0000000
1092 #define PMU5_PLL_MRAT_SHIFT             28
1093 #define PMU5_PLL_ABRAT_MASK             0x08000000
1094 #define PMU5_PLL_ABRAT_SHIFT            27
1095 #define PMU5_PLL_FDIV_MASK              0x07ffffff
1096 #define PMU5_PLL_PLLCTL_OFF             4
1097 #define PMU5_PLL_PCHI_OFF               5
1098 #define PMU5_PLL_PCHI_MASK              0x0000003f
1099
1100 /* pmu XtalFreqRatio */
1101 #define PMU_XTALFREQ_REG_ILPCTR_MASK    0x00001FFF
1102 #define PMU_XTALFREQ_REG_MEASURE_MASK   0x80000000
1103 #define PMU_XTALFREQ_REG_MEASURE_SHIFT  31
1104
1105 /* Divider allocation in 4716/47162/5356/5357 */
1106 #define PMU5_MAINPLL_CPU                1
1107 #define PMU5_MAINPLL_MEM                2
1108 #define PMU5_MAINPLL_SI                 3
1109
1110 #define PMU7_PLL_PLLCTL7                7
1111 #define PMU7_PLL_CTL7_M4DIV_MASK        0xff000000
1112 #define PMU7_PLL_CTL7_M4DIV_SHIFT       24
1113 #define PMU7_PLL_CTL7_M4DIV_BY_6        6
1114 #define PMU7_PLL_CTL7_M4DIV_BY_12       0xc
1115 #define PMU7_PLL_CTL7_M4DIV_BY_24       0x18
1116 #define PMU7_PLL_PLLCTL8                8
1117 #define PMU7_PLL_CTL8_M5DIV_MASK        0x000000ff
1118 #define PMU7_PLL_CTL8_M5DIV_SHIFT       0
1119 #define PMU7_PLL_CTL8_M5DIV_BY_8        8
1120 #define PMU7_PLL_CTL8_M5DIV_BY_12       0xc
1121 #define PMU7_PLL_CTL8_M5DIV_BY_24       0x18
1122 #define PMU7_PLL_CTL8_M6DIV_MASK        0x0000ff00
1123 #define PMU7_PLL_CTL8_M6DIV_SHIFT       8
1124 #define PMU7_PLL_CTL8_M6DIV_BY_12       0xc
1125 #define PMU7_PLL_CTL8_M6DIV_BY_24       0x18
1126 #define PMU7_PLL_PLLCTL11               11
1127 #define PMU7_PLL_PLLCTL11_MASK          0xffffff00
1128 #define PMU7_PLL_PLLCTL11_VAL           0x22222200
1129
1130 /* PLL usage in 4716/47162 */
1131 #define PMU4716_MAINPLL_PLL0            12
1132
1133 /* PLL usage in 5356/5357 */
1134 #define PMU5356_MAINPLL_PLL0            0
1135 #define PMU5357_MAINPLL_PLL0            0
1136
1137 /* 4716/47162 resources */
1138 #define RES4716_PROC_PLL_ON             0x00000040
1139 #define RES4716_PROC_HT_AVAIL           0x00000080
1140
1141 /* 4716/4717/4718 Chip specific ChipControl register bits */
1142 #define CCTRL_471X_I2S_PINS_ENABLE      0x0080 /* I2S pins off by default, shared w/ pflash */
1143
1144 /* 5357 Chip specific ChipControl register bits */
1145 /* 2nd - 32-bit reg */
1146 #define CCTRL_5357_I2S_PINS_ENABLE      0x00040000 /* I2S pins enable */
1147 #define CCTRL_5357_I2CSPI_PINS_ENABLE   0x00080000 /* I2C/SPI pins enable */
1148
1149 /* 5354 resources */
1150 #define RES5354_EXT_SWITCHER_PWM        0       /* 0x00001 */
1151 #define RES5354_BB_SWITCHER_PWM         1       /* 0x00002 */
1152 #define RES5354_BB_SWITCHER_BURST       2       /* 0x00004 */
1153 #define RES5354_BB_EXT_SWITCHER_BURST   3       /* 0x00008 */
1154 #define RES5354_ILP_REQUEST             4       /* 0x00010 */
1155 #define RES5354_RADIO_SWITCHER_PWM      5       /* 0x00020 */
1156 #define RES5354_RADIO_SWITCHER_BURST    6       /* 0x00040 */
1157 #define RES5354_ROM_SWITCH              7       /* 0x00080 */
1158 #define RES5354_PA_REF_LDO              8       /* 0x00100 */
1159 #define RES5354_RADIO_LDO               9       /* 0x00200 */
1160 #define RES5354_AFE_LDO                 10      /* 0x00400 */
1161 #define RES5354_PLL_LDO                 11      /* 0x00800 */
1162 #define RES5354_BG_FILTBYP              12      /* 0x01000 */
1163 #define RES5354_TX_FILTBYP              13      /* 0x02000 */
1164 #define RES5354_RX_FILTBYP              14      /* 0x04000 */
1165 #define RES5354_XTAL_PU                 15      /* 0x08000 */
1166 #define RES5354_XTAL_EN                 16      /* 0x10000 */
1167 #define RES5354_BB_PLL_FILTBYP          17      /* 0x20000 */
1168 #define RES5354_RF_PLL_FILTBYP          18      /* 0x40000 */
1169 #define RES5354_BB_PLL_PU               19      /* 0x80000 */
1170
1171 /* 5357 Chip specific ChipControl register bits */
1172 #define CCTRL5357_EXTPA                 (1<<14) /* extPA in ChipControl 1, bit 14 */ 
1173 #define CCTRL5357_ANT_MUX_2o3           (1<<15) /* 2o3 in ChipControl 1, bit 15 */ 
1174
1175 /* 4328 resources */
1176 #define RES4328_EXT_SWITCHER_PWM        0       /* 0x00001 */
1177 #define RES4328_BB_SWITCHER_PWM         1       /* 0x00002 */
1178 #define RES4328_BB_SWITCHER_BURST       2       /* 0x00004 */
1179 #define RES4328_BB_EXT_SWITCHER_BURST   3       /* 0x00008 */
1180 #define RES4328_ILP_REQUEST             4       /* 0x00010 */
1181 #define RES4328_RADIO_SWITCHER_PWM      5       /* 0x00020 */
1182 #define RES4328_RADIO_SWITCHER_BURST    6       /* 0x00040 */
1183 #define RES4328_ROM_SWITCH              7       /* 0x00080 */
1184 #define RES4328_PA_REF_LDO              8       /* 0x00100 */
1185 #define RES4328_RADIO_LDO               9       /* 0x00200 */
1186 #define RES4328_AFE_LDO                 10      /* 0x00400 */
1187 #define RES4328_PLL_LDO                 11      /* 0x00800 */
1188 #define RES4328_BG_FILTBYP              12      /* 0x01000 */
1189 #define RES4328_TX_FILTBYP              13      /* 0x02000 */
1190 #define RES4328_RX_FILTBYP              14      /* 0x04000 */
1191 #define RES4328_XTAL_PU                 15      /* 0x08000 */
1192 #define RES4328_XTAL_EN                 16      /* 0x10000 */
1193 #define RES4328_BB_PLL_FILTBYP          17      /* 0x20000 */
1194 #define RES4328_RF_PLL_FILTBYP          18      /* 0x40000 */
1195 #define RES4328_BB_PLL_PU               19      /* 0x80000 */
1196
1197 /* 4325 A0/A1 resources */
1198 #define RES4325_BUCK_BOOST_BURST        0       /* 0x00000001 */
1199 #define RES4325_CBUCK_BURST             1       /* 0x00000002 */
1200 #define RES4325_CBUCK_PWM               2       /* 0x00000004 */
1201 #define RES4325_CLDO_CBUCK_BURST        3       /* 0x00000008 */
1202 #define RES4325_CLDO_CBUCK_PWM          4       /* 0x00000010 */
1203 #define RES4325_BUCK_BOOST_PWM          5       /* 0x00000020 */
1204 #define RES4325_ILP_REQUEST             6       /* 0x00000040 */
1205 #define RES4325_ABUCK_BURST             7       /* 0x00000080 */
1206 #define RES4325_ABUCK_PWM               8       /* 0x00000100 */
1207 #define RES4325_LNLDO1_PU               9       /* 0x00000200 */
1208 #define RES4325_OTP_PU                  10      /* 0x00000400 */
1209 #define RES4325_LNLDO3_PU               11      /* 0x00000800 */
1210 #define RES4325_LNLDO4_PU               12      /* 0x00001000 */
1211 #define RES4325_XTAL_PU                 13      /* 0x00002000 */
1212 #define RES4325_ALP_AVAIL               14      /* 0x00004000 */
1213 #define RES4325_RX_PWRSW_PU             15      /* 0x00008000 */
1214 #define RES4325_TX_PWRSW_PU             16      /* 0x00010000 */
1215 #define RES4325_RFPLL_PWRSW_PU          17      /* 0x00020000 */
1216 #define RES4325_LOGEN_PWRSW_PU          18      /* 0x00040000 */
1217 #define RES4325_AFE_PWRSW_PU            19      /* 0x00080000 */
1218 #define RES4325_BBPLL_PWRSW_PU          20      /* 0x00100000 */
1219 #define RES4325_HT_AVAIL                21      /* 0x00200000 */
1220
1221 /* 4325 B0/C0 resources */
1222 #define RES4325B0_CBUCK_LPOM            1       /* 0x00000002 */
1223 #define RES4325B0_CBUCK_BURST           2       /* 0x00000004 */
1224 #define RES4325B0_CBUCK_PWM             3       /* 0x00000008 */
1225 #define RES4325B0_CLDO_PU               4       /* 0x00000010 */
1226
1227 /* 4325 C1 resources */
1228 #define RES4325C1_LNLDO2_PU             12      /* 0x00001000 */
1229
1230 /* 4325 chip-specific ChipStatus register bits */
1231 #define CST4325_SPROM_OTP_SEL_MASK      0x00000003
1232 #define CST4325_DEFCIS_SEL              0       /* OTP is powered up, use def. CIS, no SPROM */
1233 #define CST4325_SPROM_SEL               1       /* OTP is powered up, SPROM is present */
1234 #define CST4325_OTP_SEL                 2       /* OTP is powered up, no SPROM */
1235 #define CST4325_OTP_PWRDN               3       /* OTP is powered down, SPROM is present */
1236 #define CST4325_SDIO_USB_MODE_MASK      0x00000004
1237 #define CST4325_SDIO_USB_MODE_SHIFT     2
1238 #define CST4325_RCAL_VALID_MASK         0x00000008
1239 #define CST4325_RCAL_VALID_SHIFT        3
1240 #define CST4325_RCAL_VALUE_MASK         0x000001f0
1241 #define CST4325_RCAL_VALUE_SHIFT        4
1242 #define CST4325_PMUTOP_2B_MASK          0x00000200      /* 1 for 2b, 0 for to 2a */
1243 #define CST4325_PMUTOP_2B_SHIFT         9
1244
1245 #define RES4329_RESERVED0               0       /* 0x00000001 */
1246 #define RES4329_CBUCK_LPOM              1       /* 0x00000002 */
1247 #define RES4329_CBUCK_BURST             2       /* 0x00000004 */
1248 #define RES4329_CBUCK_PWM               3       /* 0x00000008 */
1249 #define RES4329_CLDO_PU                 4       /* 0x00000010 */
1250 #define RES4329_PALDO_PU                5       /* 0x00000020 */
1251 #define RES4329_ILP_REQUEST             6       /* 0x00000040 */
1252 #define RES4329_RESERVED7               7       /* 0x00000080 */
1253 #define RES4329_RESERVED8               8       /* 0x00000100 */
1254 #define RES4329_LNLDO1_PU               9       /* 0x00000200 */
1255 #define RES4329_OTP_PU                  10      /* 0x00000400 */
1256 #define RES4329_RESERVED11              11      /* 0x00000800 */
1257 #define RES4329_LNLDO2_PU               12      /* 0x00001000 */
1258 #define RES4329_XTAL_PU                 13      /* 0x00002000 */
1259 #define RES4329_ALP_AVAIL               14      /* 0x00004000 */
1260 #define RES4329_RX_PWRSW_PU             15      /* 0x00008000 */
1261 #define RES4329_TX_PWRSW_PU             16      /* 0x00010000 */
1262 #define RES4329_RFPLL_PWRSW_PU          17      /* 0x00020000 */
1263 #define RES4329_LOGEN_PWRSW_PU          18      /* 0x00040000 */
1264 #define RES4329_AFE_PWRSW_PU            19      /* 0x00080000 */
1265 #define RES4329_BBPLL_PWRSW_PU          20      /* 0x00100000 */
1266 #define RES4329_HT_AVAIL                21      /* 0x00200000 */
1267
1268 #define CST4329_SPROM_OTP_SEL_MASK      0x00000003
1269 #define CST4329_DEFCIS_SEL              0       /* OTP is powered up, use def. CIS, no SPROM */
1270 #define CST4329_SPROM_SEL               1       /* OTP is powered up, SPROM is present */
1271 #define CST4329_OTP_SEL                 2       /* OTP is powered up, no SPROM */
1272 #define CST4329_OTP_PWRDN               3       /* OTP is powered down, SPROM is present */
1273 #define CST4329_SPI_SDIO_MODE_MASK      0x00000004
1274 #define CST4329_SPI_SDIO_MODE_SHIFT     2
1275
1276 /* 4312 chip-specific ChipStatus register bits */
1277 #define CST4312_SPROM_OTP_SEL_MASK      0x00000003
1278 #define CST4312_DEFCIS_SEL              0       /* OTP is powered up, use def. CIS, no SPROM */
1279 #define CST4312_SPROM_SEL               1       /* OTP is powered up, SPROM is present */
1280 #define CST4312_OTP_SEL                 2       /* OTP is powered up, no SPROM */
1281 #define CST4312_OTP_BAD                 3       /* OTP is broken, SPROM is present */
1282
1283 /* 4312 resources (all PMU chips with little memory constraint) */
1284 #define RES4312_SWITCHER_BURST          0       /* 0x00000001 */
1285 #define RES4312_SWITCHER_PWM            1       /* 0x00000002 */
1286 #define RES4312_PA_REF_LDO              2       /* 0x00000004 */
1287 #define RES4312_CORE_LDO_BURST          3       /* 0x00000008 */
1288 #define RES4312_CORE_LDO_PWM            4       /* 0x00000010 */
1289 #define RES4312_RADIO_LDO               5       /* 0x00000020 */
1290 #define RES4312_ILP_REQUEST             6       /* 0x00000040 */
1291 #define RES4312_BG_FILTBYP              7       /* 0x00000080 */
1292 #define RES4312_TX_FILTBYP              8       /* 0x00000100 */
1293 #define RES4312_RX_FILTBYP              9       /* 0x00000200 */
1294 #define RES4312_XTAL_PU                 10      /* 0x00000400 */
1295 #define RES4312_ALP_AVAIL               11      /* 0x00000800 */
1296 #define RES4312_BB_PLL_FILTBYP          12      /* 0x00001000 */
1297 #define RES4312_RF_PLL_FILTBYP          13      /* 0x00002000 */
1298 #define RES4312_HT_AVAIL                14      /* 0x00004000 */
1299
1300 /* 4322 resources */
1301 #define RES4322_RF_LDO                  0
1302 #define RES4322_ILP_REQUEST             1
1303 #define RES4322_XTAL_PU                 2
1304 #define RES4322_ALP_AVAIL               3
1305 #define RES4322_SI_PLL_ON               4
1306 #define RES4322_HT_SI_AVAIL             5
1307 #define RES4322_PHY_PLL_ON              6
1308 #define RES4322_HT_PHY_AVAIL            7
1309 #define RES4322_OTP_PU                  8
1310
1311 /* 4322 chip-specific ChipStatus register bits */
1312 #define CST4322_XTAL_FREQ_20_40MHZ      0x00000020
1313 #define CST4322_SPROM_OTP_SEL_MASK      0x000000c0
1314 #define CST4322_SPROM_OTP_SEL_SHIFT     6
1315 #define CST4322_NO_SPROM_OTP            0       /* no OTP, no SPROM */
1316 #define CST4322_SPROM_PRESENT           1       /* SPROM is present */
1317 #define CST4322_OTP_PRESENT             2       /* OTP is present */
1318 #define CST4322_PCI_OR_USB              0x00000100
1319 #define CST4322_BOOT_MASK               0x00000600
1320 #define CST4322_BOOT_SHIFT              9
1321 #define CST4322_BOOT_FROM_SRAM          0       /* boot from SRAM, ARM in reset */
1322 #define CST4322_BOOT_FROM_ROM           1       /* boot from ROM */
1323 #define CST4322_BOOT_FROM_FLASH         2       /* boot from FLASH */
1324 #define CST4322_BOOT_FROM_INVALID       3
1325 #define CST4322_ILP_DIV_EN              0x00000800
1326 #define CST4322_FLASH_TYPE_MASK         0x00001000
1327 #define CST4322_FLASH_TYPE_SHIFT        12
1328 #define CST4322_FLASH_TYPE_SHIFT_ST     0       /* ST serial FLASH */
1329 #define CST4322_FLASH_TYPE_SHIFT_ATMEL  1       /* ATMEL flash */
1330 #define CST4322_ARM_TAP_SEL             0x00002000
1331 #define CST4322_RES_INIT_MODE_MASK      0x0000c000
1332 #define CST4322_RES_INIT_MODE_SHIFT     14
1333 #define CST4322_RES_INIT_MODE_ILPAVAIL  0       /* resinitmode: ILP available */
1334 #define CST4322_RES_INIT_MODE_ILPREQ    1       /* resinitmode: ILP request */
1335 #define CST4322_RES_INIT_MODE_ALPAVAIL  2       /* resinitmode: ALP available */
1336 #define CST4322_RES_INIT_MODE_HTAVAIL   3       /* resinitmode: HT available */
1337 #define CST4322_PCIPLLCLK_GATING        0x00010000
1338 #define CST4322_CLK_SWITCH_PCI_TO_ALP   0x00020000
1339 #define CST4322_PCI_CARDBUS_MODE        0x00040000
1340
1341 /* 43224 chip-specific ChipControl register bits */
1342 #define CCTRL43224_GPIO_TOGGLE          0x8000 /* gpio[3:0] pins as btcoex or s/w gpio */
1343 #define CCTRL_43224A0_12MA_LED_DRIVE    0x00F000F0 /* 12 mA drive strength */
1344 #define CCTRL_43224B0_12MA_LED_DRIVE    0xF0    /* 12 mA drive strength for later 43224s */
1345
1346 /* 43236 resources */
1347 #define RES43236_REGULATOR              0
1348 #define RES43236_ILP_REQUEST            1
1349 #define RES43236_XTAL_PU                2
1350 #define RES43236_ALP_AVAIL              3
1351 #define RES43236_SI_PLL_ON              4
1352 #define RES43236_HT_SI_AVAIL            5
1353
1354 /* 43236 chip-specific ChipControl register bits */
1355 #define CCTRL43236_BT_COEXIST           (1<<0)  /* 0 disable */
1356 #define CCTRL43236_SECI                 (1<<1)  /* 0 SECI is disabled (JATG functional) */
1357 #define CCTRL43236_EXT_LNA              (1<<2)  /* 0 disable */
1358 #define CCTRL43236_ANT_MUX_2o3          (1<<3)  /* 2o3 mux, chipcontrol bit 3 */
1359 #define CCTRL43236_GSIO                 (1<<4)  /* 0 disable */
1360
1361 /* 43236 Chip specific ChipStatus register bits */
1362 #define CST43236_SFLASH_MASK            0x00000040
1363 #define CST43236_OTP_SEL_MASK           0x00000080
1364 #define CST43236_OTP_SEL_SHIFT          7
1365 #define CST43236_HSIC_MASK              0x00000100      /* USB/HSIC */
1366 #define CST43236_BP_CLK                 0x00000200      /* 120/96Mbps */
1367 #define CST43236_BOOT_MASK              0x00001800
1368 #define CST43236_BOOT_SHIFT             11
1369 #define CST43236_BOOT_FROM_SRAM         0       /* boot from SRAM, ARM in reset */
1370 #define CST43236_BOOT_FROM_ROM          1       /* boot from ROM */
1371 #define CST43236_BOOT_FROM_FLASH        2       /* boot from FLASH */
1372 #define CST43236_BOOT_FROM_INVALID      3
1373
1374 /* 43237 resources */
1375 #define RES43237_REGULATOR              0
1376 #define RES43237_ILP_REQUEST            1
1377 #define RES43237_XTAL_PU                2
1378 #define RES43237_ALP_AVAIL              3
1379 #define RES43237_SI_PLL_ON              4
1380 #define RES43237_HT_SI_AVAIL            5
1381
1382 /* 43237 chip-specific ChipControl register bits */
1383 #define CCTRL43237_BT_COEXIST           (1<<0)  /* 0 disable */
1384 #define CCTRL43237_SECI                 (1<<1)  /* 0 SECI is disabled (JATG functional) */
1385 #define CCTRL43237_EXT_LNA              (1<<2)  /* 0 disable */
1386 #define CCTRL43237_ANT_MUX_2o3          (1<<3)  /* 2o3 mux, chipcontrol bit 3 */
1387 #define CCTRL43237_GSIO                 (1<<4)  /* 0 disable */
1388
1389 /* 43237 Chip specific ChipStatus register bits */
1390 #define CST43237_SFLASH_MASK            0x00000040
1391 #define CST43237_OTP_SEL_MASK           0x00000080
1392 #define CST43237_OTP_SEL_SHIFT          7
1393 #define CST43237_HSIC_MASK              0x00000100      /* USB/HSIC */
1394 #define CST43237_BP_CLK                 0x00000200      /* 120/96Mbps */
1395 #define CST43237_BOOT_MASK              0x00001800
1396 #define CST43237_BOOT_SHIFT             11
1397 #define CST43237_BOOT_FROM_SRAM         0       /* boot from SRAM, ARM in reset */
1398 #define CST43237_BOOT_FROM_ROM          1       /* boot from ROM */
1399 #define CST43237_BOOT_FROM_FLASH        2       /* boot from FLASH */
1400 #define CST43237_BOOT_FROM_INVALID      3
1401
1402 /* 43239 resources */
1403 #define RES43239_OTP_PU                 9
1404 #define RES43239_MACPHY_CLKAVAIL        23
1405 #define RES43239_HT_AVAIL               24
1406
1407 /* 43239 Chip specific ChipStatus register bits */
1408 #define CST43239_SPROM_MASK                     0x00000002
1409 #define CST43239_SFLASH_MASK            0x00000004
1410 #define CST43239_RES_INIT_MODE_SHIFT    7
1411 #define CST43239_RES_INIT_MODE_MASK             0x000001f0
1412 #define CST43239_CHIPMODE_SDIOD(cs)     ((cs) & (1 << 15))      /* SDIO || gSPI */
1413 #define CST43239_CHIPMODE_USB20D(cs)    ((cs) & !(1 << 15))     /* USB || USBDA */
1414 #define CST43239_CHIPMODE_SDIO(cs)      (((cs) & (1 << 0)) == 0)        /* SDIO */
1415 #define CST43239_CHIPMODE_GSPI(cs)      (((cs) & (1 << 0)) == (1 << 0)) /* gSPI */
1416
1417 /* 4331 resources */
1418 #define RES4331_REGULATOR               0
1419 #define RES4331_ILP_REQUEST             1
1420 #define RES4331_XTAL_PU                 2
1421 #define RES4331_ALP_AVAIL               3
1422 #define RES4331_SI_PLL_ON               4
1423 #define RES4331_HT_SI_AVAIL             5
1424
1425 /* 4331 chip-specific ChipControl register bits */
1426 #define CCTRL4331_BT_COEXIST            (1<<0)  /* 0 disable */
1427 #define CCTRL4331_SECI                  (1<<1)  /* 0 SECI is disabled (JATG functional) */
1428 #define CCTRL4331_EXT_LNA               (1<<2)  /* 0 disable */
1429 #define CCTRL4331_SPROM_GPIO13_15       (1<<3)  /* sprom/gpio13-15 mux */
1430 #define CCTRL4331_EXTPA_EN              (1<<4)  /* 0 ext pa disable, 1 ext pa enabled */
1431 #define CCTRL4331_GPIOCLK_ON_SPROMCS    <1<<5)  /* set drive out GPIO_CLK on sprom_cs pin */
1432 #define CCTRL4331_PCIE_MDIO_ON_SPROMCS  (1<<6)  /* use sprom_cs pin as PCIE mdio interface */
1433 #define CCTRL4331_EXTPA_ON_GPIO2_5      (1<<7)  /* aband extpa will be at gpio2/5 and sprom_dout */
1434 #define CCTRL4331_OVR_PIPEAUXCLKEN      (1<<8)  /* override core control on pipe_AuxClkEnable */
1435 #define CCTRL4331_OVR_PIPEAUXPWRDOWN    (1<<9)  /* override core control on pipe_AuxPowerDown */
1436 #define CCTRL4331_PCIE_AUXCLKEN         <1<<10) /* pcie_auxclkenable */
1437 #define CCTRL4331_PCIE_PIPE_PLLDOWN     <1<<11) /* pcie_pipe_pllpowerdown */
1438 #define CCTRL4331_EXTPA_EN2             (1<<12) /* 0 ext pa disable, 1 ext pa enabled */
1439 #define CCTRL4331_BT_SHD0_ON_GPIO4      <1<<16) /* enable bt_shd0 at gpio4 */
1440 #define CCTRL4331_BT_SHD1_ON_GPIO5      <1<<17) /* enable bt_shd1 at gpio5 */
1441
1442 /* 4331 Chip specific ChipStatus register bits */
1443 #define CST4331_XTAL_FREQ               0x00000001      /* crystal frequency 20/40Mhz */
1444 #define CST4331_SPROM_OTP_SEL_MASK      0x00000006
1445 #define CST4331_SPROM_OTP_SEL_SHIFT     1
1446 #define CST4331_SPROM_PRESENT           0x00000002
1447 #define CST4331_OTP_PRESENT             0x00000004
1448 #define CST4331_LDO_RF                  0x00000008
1449 #define CST4331_LDO_PAR                 0x00000010
1450
1451 /* 4315 resource */
1452 #define RES4315_CBUCK_LPOM              1       /* 0x00000002 */
1453 #define RES4315_CBUCK_BURST             2       /* 0x00000004 */
1454 #define RES4315_CBUCK_PWM               3       /* 0x00000008 */
1455 #define RES4315_CLDO_PU                 4       /* 0x00000010 */
1456 #define RES4315_PALDO_PU                5       /* 0x00000020 */
1457 #define RES4315_ILP_REQUEST             6       /* 0x00000040 */
1458 #define RES4315_LNLDO1_PU               9       /* 0x00000200 */
1459 #define RES4315_OTP_PU                  10      /* 0x00000400 */
1460 #define RES4315_LNLDO2_PU               12      /* 0x00001000 */
1461 #define RES4315_XTAL_PU                 13      /* 0x00002000 */
1462 #define RES4315_ALP_AVAIL               14      /* 0x00004000 */
1463 #define RES4315_RX_PWRSW_PU             15      /* 0x00008000 */
1464 #define RES4315_TX_PWRSW_PU             16      /* 0x00010000 */
1465 #define RES4315_RFPLL_PWRSW_PU          17      /* 0x00020000 */
1466 #define RES4315_LOGEN_PWRSW_PU          18      /* 0x00040000 */
1467 #define RES4315_AFE_PWRSW_PU            19      /* 0x00080000 */
1468 #define RES4315_BBPLL_PWRSW_PU          20      /* 0x00100000 */
1469 #define RES4315_HT_AVAIL                21      /* 0x00200000 */
1470
1471 /* 4315 chip-specific ChipStatus register bits */
1472 #define CST4315_SPROM_OTP_SEL_MASK      0x00000003      /* gpio [7:6], SDIO CIS selection */
1473 #define CST4315_DEFCIS_SEL              0x00000000      /* use default CIS, OTP is powered up */
1474 #define CST4315_SPROM_SEL               0x00000001      /* use SPROM, OTP is powered up */
1475 #define CST4315_OTP_SEL                 0x00000002      /* use OTP, OTP is powered up */
1476 #define CST4315_OTP_PWRDN               0x00000003      /* use SPROM, OTP is powered down */
1477 #define CST4315_SDIO_MODE               0x00000004      /* gpio [8], sdio/usb mode */
1478 #define CST4315_RCAL_VALID              0x00000008
1479 #define CST4315_RCAL_VALUE_MASK         0x000001f0
1480 #define CST4315_RCAL_VALUE_SHIFT        4
1481 #define CST4315_PALDO_EXTPNP            0x00000200      /* PALDO is configured with external PNP */
1482 #define CST4315_CBUCK_MODE_MASK         0x00000c00
1483 #define CST4315_CBUCK_MODE_BURST        0x00000400
1484 #define CST4315_CBUCK_MODE_LPBURST      0x00000c00
1485
1486 /* 4319 resources */
1487 #define RES4319_CBUCK_LPOM              1       /* 0x00000002 */
1488 #define RES4319_CBUCK_BURST             2       /* 0x00000004 */
1489 #define RES4319_CBUCK_PWM               3       /* 0x00000008 */
1490 #define RES4319_CLDO_PU                 4       /* 0x00000010 */
1491 #define RES4319_PALDO_PU                5       /* 0x00000020 */
1492 #define RES4319_ILP_REQUEST             6       /* 0x00000040 */
1493 #define RES4319_LNLDO1_PU               9       /* 0x00000200 */
1494 #define RES4319_OTP_PU                  10      /* 0x00000400 */
1495 #define RES4319_LNLDO2_PU               12      /* 0x00001000 */
1496 #define RES4319_XTAL_PU                 13      /* 0x00002000 */
1497 #define RES4319_ALP_AVAIL               14      /* 0x00004000 */
1498 #define RES4319_RX_PWRSW_PU             15      /* 0x00008000 */
1499 #define RES4319_TX_PWRSW_PU             16      /* 0x00010000 */
1500 #define RES4319_RFPLL_PWRSW_PU          17      /* 0x00020000 */
1501 #define RES4319_LOGEN_PWRSW_PU          18      /* 0x00040000 */
1502 #define RES4319_AFE_PWRSW_PU            19      /* 0x00080000 */
1503 #define RES4319_BBPLL_PWRSW_PU          20      /* 0x00100000 */
1504 #define RES4319_HT_AVAIL                21      /* 0x00200000 */
1505
1506 /* 4319 chip-specific ChipStatus register bits */
1507 #define CST4319_SPI_CPULESSUSB          0x00000001
1508 #define CST4319_SPI_CLK_POL             0x00000002
1509 #define CST4319_SPI_CLK_PH              0x00000008
1510 #define CST4319_SPROM_OTP_SEL_MASK      0x000000c0      /* gpio [7:6], SDIO CIS selection */
1511 #define CST4319_SPROM_OTP_SEL_SHIFT     6
1512 #define CST4319_DEFCIS_SEL              0x00000000      /* use default CIS, OTP is powered up */
1513 #define CST4319_SPROM_SEL               0x00000040      /* use SPROM, OTP is powered up */
1514 #define CST4319_OTP_SEL                 0x00000080      /* use OTP, OTP is powered up */
1515 #define CST4319_OTP_PWRDN               0x000000c0      /* use SPROM, OTP is powered down */
1516 #define CST4319_SDIO_USB_MODE           0x00000100      /* gpio [8], sdio/usb mode */
1517 #define CST4319_REMAP_SEL_MASK          0x00000600
1518 #define CST4319_ILPDIV_EN               0x00000800
1519 #define CST4319_XTAL_PD_POL             0x00001000
1520 #define CST4319_LPO_SEL                 0x00002000
1521 #define CST4319_RES_INIT_MODE           0x0000c000
1522 #define CST4319_PALDO_EXTPNP            0x00010000      /* PALDO is configured with external PNP */
1523 #define CST4319_CBUCK_MODE_MASK         0x00060000
1524 #define CST4319_CBUCK_MODE_BURST        0x00020000
1525 #define CST4319_CBUCK_MODE_LPBURST      0x00060000
1526 #define CST4319_RCAL_VALID              0x01000000
1527 #define CST4319_RCAL_VALUE_MASK         0x3e000000
1528 #define CST4319_RCAL_VALUE_SHIFT        25
1529
1530 #define PMU1_PLL0_CHIPCTL0              0
1531 #define PMU1_PLL0_CHIPCTL1              1
1532 #define PMU1_PLL0_CHIPCTL2              2
1533 #define CCTL_4319USB_XTAL_SEL_MASK      0x00180000
1534 #define CCTL_4319USB_XTAL_SEL_SHIFT     19
1535 #define CCTL_4319USB_48MHZ_PLL_SEL      1
1536 #define CCTL_4319USB_24MHZ_PLL_SEL      2
1537
1538 /* PMU resources for 4336 */
1539 #define RES4336_CBUCK_LPOM              0
1540 #define RES4336_CBUCK_BURST             1
1541 #define RES4336_CBUCK_LP_PWM            2
1542 #define RES4336_CBUCK_PWM               3
1543 #define RES4336_CLDO_PU                 4
1544 #define RES4336_DIS_INT_RESET_PD        5
1545 #define RES4336_ILP_REQUEST             6
1546 #define RES4336_LNLDO_PU                7
1547 #define RES4336_LDO3P3_PU               8
1548 #define RES4336_OTP_PU                  9
1549 #define RES4336_XTAL_PU                 10
1550 #define RES4336_ALP_AVAIL               11
1551 #define RES4336_RADIO_PU                12
1552 #define RES4336_BG_PU                   13
1553 #define RES4336_VREG1p4_PU_PU           14
1554 #define RES4336_AFE_PWRSW_PU            15
1555 #define RES4336_RX_PWRSW_PU             16
1556 #define RES4336_TX_PWRSW_PU             17
1557 #define RES4336_BB_PWRSW_PU             18
1558 #define RES4336_SYNTH_PWRSW_PU          19
1559 #define RES4336_MISC_PWRSW_PU           20
1560 #define RES4336_LOGEN_PWRSW_PU          21
1561 #define RES4336_BBPLL_PWRSW_PU          22
1562 #define RES4336_MACPHY_CLKAVAIL         23
1563 #define RES4336_HT_AVAIL                24
1564 #define RES4336_RSVD                    25
1565
1566 /* 4336 chip-specific ChipStatus register bits */
1567 #define CST4336_SPI_MODE_MASK           0x00000001
1568 #define CST4336_SPROM_PRESENT           0x00000002
1569 #define CST4336_OTP_PRESENT             0x00000004
1570 #define CST4336_ARMREMAP_0              0x00000008
1571 #define CST4336_ILPDIV_EN_MASK          0x00000010
1572 #define CST4336_ILPDIV_EN_SHIFT         4
1573 #define CST4336_XTAL_PD_POL_MASK        0x00000020
1574 #define CST4336_XTAL_PD_POL_SHIFT       5
1575 #define CST4336_LPO_SEL_MASK            0x00000040
1576 #define CST4336_LPO_SEL_SHIFT           6
1577 #define CST4336_RES_INIT_MODE_MASK      0x00000180
1578 #define CST4336_RES_INIT_MODE_SHIFT     7
1579 #define CST4336_CBUCK_MODE_MASK         0x00000600
1580 #define CST4336_CBUCK_MODE_SHIFT        9
1581
1582 /* 4336 Chip specific PMU ChipControl register bits */
1583 #define PCTL_4336_SERIAL_ENAB   (1  << 24)
1584
1585 /* 4330 resources */
1586 #define RES4330_CBUCK_LPOM              0
1587 #define RES4330_CBUCK_BURST             1
1588 #define RES4330_CBUCK_LP_PWM            2
1589 #define RES4330_CBUCK_PWM               3
1590 #define RES4330_CLDO_PU                 4
1591 #define RES4330_DIS_INT_RESET_PD        5
1592 #define RES4330_ILP_REQUEST             6
1593 #define RES4330_LNLDO_PU                7
1594 #define RES4330_LDO3P3_PU               8
1595 #define RES4330_OTP_PU                  9
1596 #define RES4330_XTAL_PU                 10
1597 #define RES4330_ALP_AVAIL               11
1598 #define RES4330_RADIO_PU                12
1599 #define RES4330_BG_PU                   13
1600 #define RES4330_VREG1p4_PU_PU           14
1601 #define RES4330_AFE_PWRSW_PU            15
1602 #define RES4330_RX_PWRSW_PU             16
1603 #define RES4330_TX_PWRSW_PU             17
1604 #define RES4330_BB_PWRSW_PU             18
1605 #define RES4330_SYNTH_PWRSW_PU          19
1606 #define RES4330_MISC_PWRSW_PU           20
1607 #define RES4330_LOGEN_PWRSW_PU          21
1608 #define RES4330_BBPLL_PWRSW_PU          22
1609 #define RES4330_MACPHY_CLKAVAIL         23
1610 #define RES4330_HT_AVAIL                24
1611 #define RES4330_5gRX_PWRSW_PU           25
1612 #define RES4330_5gTX_PWRSW_PU           26
1613 #define RES4330_5g_LOGEN_PWRSW_PU       27
1614
1615 /* 4330 chip-specific ChipStatus register bits */
1616 #define CST4330_CHIPMODE_SDIOD(cs)      (((cs) & 0x7) < 6)      /* SDIO || gSPI */
1617 #define CST4330_CHIPMODE_USB20D(cs)     (((cs) & 0x7) >= 6)     /* USB || USBDA */
1618 #define CST4330_CHIPMODE_SDIO(cs)       (((cs) & 0x4) == 0)     /* SDIO */
1619 #define CST4330_CHIPMODE_GSPI(cs)       (((cs) & 0x6) == 4)     /* gSPI */
1620 #define CST4330_CHIPMODE_USB(cs)        (((cs) & 0x7) == 6)     /* USB packet-oriented */
1621 #define CST4330_CHIPMODE_USBDA(cs)      (((cs) & 0x7) == 7)     /* USB Direct Access */
1622 #define CST4330_OTP_PRESENT             0x00000010
1623 #define CST4330_LPO_AUTODET_EN          0x00000020
1624 #define CST4330_ARMREMAP_0              0x00000040
1625 #define CST4330_SPROM_PRESENT           0x00000080      /* takes priority over OTP if both set */
1626 #define CST4330_ILPDIV_EN               0x00000100
1627 #define CST4330_LPO_SEL                 0x00000200
1628 #define CST4330_RES_INIT_MODE_SHIFT     10
1629 #define CST4330_RES_INIT_MODE_MASK      0x00000c00
1630 #define CST4330_CBUCK_MODE_SHIFT        12
1631 #define CST4330_CBUCK_MODE_MASK         0x00003000
1632 #define CST4330_CBUCK_POWER_OK          0x00004000
1633 #define CST4330_BB_PLL_LOCKED           0x00008000
1634 #define SOCDEVRAM_4330_BP_ADDR          0x1E000000
1635 #define SOCDEVRAM_4330_ARM_ADDR         0x00800000
1636
1637 /* 4330 Chip specific PMU ChipControl register bits */
1638 #define PCTL_4330_SERIAL_ENAB   (1  << 24)
1639
1640 /* 4313 resources */
1641 #define RES4313_BB_PU_RSRC              0
1642 #define RES4313_ILP_REQ_RSRC            1
1643 #define RES4313_XTAL_PU_RSRC            2
1644 #define RES4313_ALP_AVAIL_RSRC          3
1645 #define RES4313_RADIO_PU_RSRC           4
1646 #define RES4313_BG_PU_RSRC              5
1647 #define RES4313_VREG1P4_PU_RSRC         6
1648 #define RES4313_AFE_PWRSW_RSRC          7
1649 #define RES4313_RX_PWRSW_RSRC           8
1650 #define RES4313_TX_PWRSW_RSRC           9
1651 #define RES4313_BB_PWRSW_RSRC           10
1652 #define RES4313_SYNTH_PWRSW_RSRC        11
1653 #define RES4313_MISC_PWRSW_RSRC         12
1654 #define RES4313_BB_PLL_PWRSW_RSRC       13
1655 #define RES4313_HT_AVAIL_RSRC           14
1656 #define RES4313_MACPHY_CLK_AVAIL_RSRC   15
1657
1658 /* 4313 chip-specific ChipStatus register bits */
1659 #define CST4313_SPROM_PRESENT                   1
1660 #define CST4313_OTP_PRESENT                     2
1661 #define CST4313_SPROM_OTP_SEL_MASK              0x00000002
1662 #define CST4313_SPROM_OTP_SEL_SHIFT             0
1663
1664 /* 4313 Chip specific ChipControl register bits */
1665 #define CCTRL_4313_12MA_LED_DRIVE    0x00000007    /* 12 mA drive strengh for later 4313 */
1666
1667 /* 43228 resources */
1668 #define RES43228_NOT_USED               0
1669 #define RES43228_ILP_REQUEST            1
1670 #define RES43228_XTAL_PU                2
1671 #define RES43228_ALP_AVAIL              3
1672 #define RES43228_PLL_EN                 4
1673 #define RES43228_HT_PHY_AVAIL           5
1674
1675 /* 43228 chipstatus  reg bits */
1676 #define CST43228_ILP_DIV_EN             0x1
1677 #define CST43228_OTP_PRESENT            0x2
1678 #define CST43228_SERDES_REFCLK_PADSEL   0x4
1679 #define CST43228_SDIO_MODE              0x8
1680 #define CST43228_SDIO_OTP_PRESENT       0x10
1681 #define CST43228_SDIO_RESET             0x20
1682
1683 /*
1684 * Maximum delay for the PMU state transition in us.
1685 * This is an upper bound intended for spinwaits etc.
1686 */
1687 #define PMU_MAX_TRANSITION_DLY  15000
1688
1689 /* PMU resource up transition time in ILP cycles */
1690 #define PMURES_UP_TRANSITION    2
1691
1692
1693 /* SECI configuration */
1694 #define SECI_MODE_UART                  0x0
1695 #define SECI_MODE_SECI                  0x1
1696 #define SECI_MODE_LEGACY_3WIRE_BT       0x2
1697 #define SECI_MODE_LEGACY_3WIRE_WLAN     0x3
1698 #define SECI_MODE_HALF_SECI             0x4
1699
1700 #define SECI_RESET              (1 << 0)
1701 #define SECI_RESET_BAR_UART     (1 << 1)
1702 #define SECI_ENAB_SECI_ECI      (1 << 2)
1703 #define SECI_ENAB_SECIOUT_DIS   (1 << 3)
1704 #define SECI_MODE_MASK          0x7
1705 #define SECI_MODE_SHIFT         4 /* (bits 5, 6, 7) */
1706 #define SECI_UPD_SECI           (1 << 7)
1707
1708 /* seci clk_ctl_st bits */
1709 #define CLKCTL_STS_SECI_CLK_REQ         (1 << 8)
1710 #define CLKCTL_STS_SECI_CLK_AVAIL       (1 << 24)
1711
1712 #define SECI_UART_MSR_CTS_STATE         (1 << 0)
1713 #define SECI_UART_MSR_RTS_STATE         (1 << 1)
1714 #define SECI_UART_SECI_IN_STATE         (1 << 2)
1715 #define SECI_UART_SECI_IN2_STATE        (1 << 3)
1716
1717 /* SECI UART LCR/MCR register bits */
1718 #define SECI_UART_LCR_STOP_BITS         (1 << 0) /* 0 - 1bit, 1 - 2bits */
1719 #define SECI_UART_LCR_PARITY_EN         (1 << 1)
1720 #define SECI_UART_LCR_PARITY            (1 << 2) /* 0 - odd, 1 - even */
1721 #define SECI_UART_LCR_RX_EN             (1 << 3)
1722 #define SECI_UART_LCR_LBRK_CTRL         (1 << 4) /* 1 => SECI_OUT held low */
1723 #define SECI_UART_LCR_TXO_EN            (1 << 5)
1724 #define SECI_UART_LCR_RTSO_EN           (1 << 6)
1725 #define SECI_UART_LCR_SLIPMODE_EN       (1 << 7)
1726 #define SECI_UART_LCR_RXCRC_CHK         (1 << 8)
1727 #define SECI_UART_LCR_TXCRC_INV         (1 << 9)
1728 #define SECI_UART_LCR_TXCRC_LSBF        (1 << 10)
1729 #define SECI_UART_LCR_TXCRC_EN          (1 << 11)
1730
1731 #define SECI_UART_MCR_TX_EN             (1 << 0)
1732 #define SECI_UART_MCR_PRTS              (1 << 1)
1733 #define SECI_UART_MCR_SWFLCTRL_EN       (1 << 2)
1734 #define SECI_UART_MCR_HIGHRATE_EN       (1 << 3)
1735 #define SECI_UART_MCR_LOOPBK_EN         (1 << 4)
1736 #define SECI_UART_MCR_AUTO_RTS          (1 << 5)
1737 #define SECI_UART_MCR_AUTO_TX_DIS       (1 << 6)
1738 #define SECI_UART_MCR_BAUD_ADJ_EN       (1 << 7)
1739 #define SECI_UART_MCR_XONOFF_RPT        (1 << 9)
1740
1741 /* WLAN channel numbers - used from wifi.h */
1742
1743 /* WLAN BW */
1744 #define ECI_BW_20   0x0
1745 #define ECI_BW_25   0x1
1746 #define ECI_BW_30   0x2
1747 #define ECI_BW_35   0x3
1748 #define ECI_BW_40   0x4
1749 #define ECI_BW_45   0x5
1750 #define ECI_BW_50   0x6
1751 #define ECI_BW_ALL  0x7
1752
1753 /* WLAN - number of antenna */
1754 #define WLAN_NUM_ANT1 TXANT_0
1755 #define WLAN_NUM_ANT2 TXANT_1
1756
1757 #endif  /* _SBCHIPC_H */