blob: e3b9287466741a0dc4da71a0c724ebf4c60ce45c [file] [log] [blame]
Krishna Gudipati0a20de42010-03-05 19:34:20 -08001/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07002 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
Krishna Gudipati0a20de42010-03-05 19:34:20 -08003 * All rights reserved
4 * www.brocade.com
5 *
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License (GPL) Version 2 as
10 * published by the Free Software Foundation
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 */
17
Maggie Zhangf16a1752010-12-09 19:12:32 -080018#include "bfad_drv.h"
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070019#include "bfa_ioc.h"
Krishna Gudipati11189202011-06-13 15:50:35 -070020#include "bfi_reg.h"
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070021#include "bfa_defs.h"
Krishna Gudipati0a20de42010-03-05 19:34:20 -080022
23BFA_TRC_FILE(CNA, IOC_CB);
24
Vijaya Mohan Guvvac679b592013-05-13 02:33:26 -070025#define bfa_ioc_cb_join_pos(__ioc) ((u32) (1 << BFA_IOC_CB_JOIN_SH))
26
Krishna Gudipati0a20de42010-03-05 19:34:20 -080027/*
28 * forward declarations
29 */
Krishna Gudipati0a20de42010-03-05 19:34:20 -080030static bfa_boolean_t bfa_ioc_cb_firmware_lock(struct bfa_ioc_s *ioc);
31static void bfa_ioc_cb_firmware_unlock(struct bfa_ioc_s *ioc);
Krishna Gudipati0a20de42010-03-05 19:34:20 -080032static void bfa_ioc_cb_reg_init(struct bfa_ioc_s *ioc);
33static void bfa_ioc_cb_map_port(struct bfa_ioc_s *ioc);
34static void bfa_ioc_cb_isr_mode_set(struct bfa_ioc_s *ioc, bfa_boolean_t msix);
Krishna Gudipatif1d584d2010-12-13 16:17:11 -080035static void bfa_ioc_cb_notify_fail(struct bfa_ioc_s *ioc);
Krishna Gudipati0a20de42010-03-05 19:34:20 -080036static void bfa_ioc_cb_ownership_reset(struct bfa_ioc_s *ioc);
Jing Huang45d7f0c2011-04-13 11:45:53 -070037static bfa_boolean_t bfa_ioc_cb_sync_start(struct bfa_ioc_s *ioc);
Krishna Gudipatif1d584d2010-12-13 16:17:11 -080038static void bfa_ioc_cb_sync_join(struct bfa_ioc_s *ioc);
39static void bfa_ioc_cb_sync_leave(struct bfa_ioc_s *ioc);
40static void bfa_ioc_cb_sync_ack(struct bfa_ioc_s *ioc);
41static bfa_boolean_t bfa_ioc_cb_sync_complete(struct bfa_ioc_s *ioc);
Vijaya Mohan Guvvac679b592013-05-13 02:33:26 -070042static void bfa_ioc_cb_set_cur_ioc_fwstate(
43 struct bfa_ioc_s *ioc, enum bfi_ioc_state fwstate);
44static enum bfi_ioc_state bfa_ioc_cb_get_cur_ioc_fwstate(struct bfa_ioc_s *ioc);
45static void bfa_ioc_cb_set_alt_ioc_fwstate(
46 struct bfa_ioc_s *ioc, enum bfi_ioc_state fwstate);
47static enum bfi_ioc_state bfa_ioc_cb_get_alt_ioc_fwstate(struct bfa_ioc_s *ioc);
Krishna Gudipati0a20de42010-03-05 19:34:20 -080048
Maggie52f94b62010-11-29 18:21:32 -080049static struct bfa_ioc_hwif_s hwif_cb;
Krishna Gudipati0a20de42010-03-05 19:34:20 -080050
Jing Huang5fbe25c2010-10-18 17:17:23 -070051/*
Krishna Gudipati0a20de42010-03-05 19:34:20 -080052 * Called from bfa_ioc_attach() to map asic specific calls.
53 */
54void
55bfa_ioc_set_cb_hwif(struct bfa_ioc_s *ioc)
56{
Jing Huang293f82d2010-07-08 19:45:20 -070057 hwif_cb.ioc_pll_init = bfa_ioc_cb_pll_init;
58 hwif_cb.ioc_firmware_lock = bfa_ioc_cb_firmware_lock;
59 hwif_cb.ioc_firmware_unlock = bfa_ioc_cb_firmware_unlock;
60 hwif_cb.ioc_reg_init = bfa_ioc_cb_reg_init;
61 hwif_cb.ioc_map_port = bfa_ioc_cb_map_port;
62 hwif_cb.ioc_isr_mode_set = bfa_ioc_cb_isr_mode_set;
Krishna Gudipatif1d584d2010-12-13 16:17:11 -080063 hwif_cb.ioc_notify_fail = bfa_ioc_cb_notify_fail;
Jing Huang293f82d2010-07-08 19:45:20 -070064 hwif_cb.ioc_ownership_reset = bfa_ioc_cb_ownership_reset;
Jing Huang45d7f0c2011-04-13 11:45:53 -070065 hwif_cb.ioc_sync_start = bfa_ioc_cb_sync_start;
Krishna Gudipatif1d584d2010-12-13 16:17:11 -080066 hwif_cb.ioc_sync_join = bfa_ioc_cb_sync_join;
67 hwif_cb.ioc_sync_leave = bfa_ioc_cb_sync_leave;
68 hwif_cb.ioc_sync_ack = bfa_ioc_cb_sync_ack;
69 hwif_cb.ioc_sync_complete = bfa_ioc_cb_sync_complete;
Vijaya Mohan Guvvac679b592013-05-13 02:33:26 -070070 hwif_cb.ioc_set_fwstate = bfa_ioc_cb_set_cur_ioc_fwstate;
71 hwif_cb.ioc_get_fwstate = bfa_ioc_cb_get_cur_ioc_fwstate;
72 hwif_cb.ioc_set_alt_fwstate = bfa_ioc_cb_set_alt_ioc_fwstate;
73 hwif_cb.ioc_get_alt_fwstate = bfa_ioc_cb_get_alt_ioc_fwstate;
Jing Huang293f82d2010-07-08 19:45:20 -070074
Krishna Gudipati0a20de42010-03-05 19:34:20 -080075 ioc->ioc_hwif = &hwif_cb;
76}
77
Jing Huang8f4bfad2010-12-26 21:50:10 -080078/*
Krishna Gudipati0a20de42010-03-05 19:34:20 -080079 * Return true if firmware of current driver matches the running firmware.
80 */
81static bfa_boolean_t
82bfa_ioc_cb_firmware_lock(struct bfa_ioc_s *ioc)
83{
84 return BFA_TRUE;
85}
86
87static void
88bfa_ioc_cb_firmware_unlock(struct bfa_ioc_s *ioc)
89{
90}
91
Jing Huang5fbe25c2010-10-18 17:17:23 -070092/*
Krishna Gudipati0a20de42010-03-05 19:34:20 -080093 * Notify other functions on HB failure.
94 */
95static void
Krishna Gudipatif1d584d2010-12-13 16:17:11 -080096bfa_ioc_cb_notify_fail(struct bfa_ioc_s *ioc)
Krishna Gudipati0a20de42010-03-05 19:34:20 -080097{
Krishna Gudipati11189202011-06-13 15:50:35 -070098 writel(~0U, ioc->ioc_regs.err_set);
Jing Huang53440262010-10-18 17:12:29 -070099 readl(ioc->ioc_regs.err_set);
Krishna Gudipati0a20de42010-03-05 19:34:20 -0800100}
101
Jing Huang5fbe25c2010-10-18 17:17:23 -0700102/*
Krishna Gudipati0a20de42010-03-05 19:34:20 -0800103 * Host to LPU mailbox message addresses
104 */
Krishna Gudipatid1c61f82010-03-05 19:38:44 -0800105static struct { u32 hfn_mbox, lpu_mbox, hfn_pgn; } iocreg_fnreg[] = {
Krishna Gudipati0a20de42010-03-05 19:34:20 -0800106 { HOSTFN0_LPU_MBOX0_0, LPU_HOSTFN0_MBOX0_0, HOST_PAGE_NUM_FN0 },
107 { HOSTFN1_LPU_MBOX0_8, LPU_HOSTFN1_MBOX0_8, HOST_PAGE_NUM_FN1 }
108};
109
Jing Huang5fbe25c2010-10-18 17:17:23 -0700110/*
Krishna Gudipati0a20de42010-03-05 19:34:20 -0800111 * Host <-> LPU mailbox command/status registers
112 */
Krishna Gudipatid1c61f82010-03-05 19:38:44 -0800113static struct { u32 hfn, lpu; } iocreg_mbcmd[] = {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700114
Krishna Gudipati0a20de42010-03-05 19:34:20 -0800115 { HOSTFN0_LPU0_CMD_STAT, LPU0_HOSTFN0_CMD_STAT },
116 { HOSTFN1_LPU1_CMD_STAT, LPU1_HOSTFN1_CMD_STAT }
117};
118
119static void
120bfa_ioc_cb_reg_init(struct bfa_ioc_s *ioc)
121{
Jing Huang53440262010-10-18 17:12:29 -0700122 void __iomem *rb;
Krishna Gudipati0a20de42010-03-05 19:34:20 -0800123 int pcifn = bfa_ioc_pcifn(ioc);
124
125 rb = bfa_ioc_bar0(ioc);
126
127 ioc->ioc_regs.hfn_mbox = rb + iocreg_fnreg[pcifn].hfn_mbox;
128 ioc->ioc_regs.lpu_mbox = rb + iocreg_fnreg[pcifn].lpu_mbox;
129 ioc->ioc_regs.host_page_num_fn = rb + iocreg_fnreg[pcifn].hfn_pgn;
130
131 if (ioc->port_id == 0) {
132 ioc->ioc_regs.heartbeat = rb + BFA_IOC0_HBEAT_REG;
133 ioc->ioc_regs.ioc_fwstate = rb + BFA_IOC0_STATE_REG;
Krishna Gudipatif1d584d2010-12-13 16:17:11 -0800134 ioc->ioc_regs.alt_ioc_fwstate = rb + BFA_IOC1_STATE_REG;
Krishna Gudipati0a20de42010-03-05 19:34:20 -0800135 } else {
136 ioc->ioc_regs.heartbeat = (rb + BFA_IOC1_HBEAT_REG);
137 ioc->ioc_regs.ioc_fwstate = (rb + BFA_IOC1_STATE_REG);
Krishna Gudipatif1d584d2010-12-13 16:17:11 -0800138 ioc->ioc_regs.alt_ioc_fwstate = (rb + BFA_IOC0_STATE_REG);
Krishna Gudipati0a20de42010-03-05 19:34:20 -0800139 }
140
Jing Huang5fbe25c2010-10-18 17:17:23 -0700141 /*
Krishna Gudipati0a20de42010-03-05 19:34:20 -0800142 * Host <-> LPU mailbox command/status registers
143 */
144 ioc->ioc_regs.hfn_mbox_cmd = rb + iocreg_mbcmd[pcifn].hfn;
145 ioc->ioc_regs.lpu_mbox_cmd = rb + iocreg_mbcmd[pcifn].lpu;
146
147 /*
148 * PSS control registers
149 */
150 ioc->ioc_regs.pss_ctl_reg = (rb + PSS_CTL_REG);
Krishna Gudipati8b651b42010-03-05 19:34:44 -0800151 ioc->ioc_regs.pss_err_status_reg = (rb + PSS_ERR_STATUS_REG);
Krishna Gudipati11189202011-06-13 15:50:35 -0700152 ioc->ioc_regs.app_pll_fast_ctl_reg = (rb + APP_PLL_LCLK_CTL_REG);
153 ioc->ioc_regs.app_pll_slow_ctl_reg = (rb + APP_PLL_SCLK_CTL_REG);
Krishna Gudipati0a20de42010-03-05 19:34:20 -0800154
155 /*
156 * IOC semaphore registers and serialization
157 */
158 ioc->ioc_regs.ioc_sem_reg = (rb + HOST_SEM0_REG);
159 ioc->ioc_regs.ioc_init_sem_reg = (rb + HOST_SEM2_REG);
160
Jing Huang5fbe25c2010-10-18 17:17:23 -0700161 /*
Krishna Gudipati0a20de42010-03-05 19:34:20 -0800162 * sram memory access
163 */
164 ioc->ioc_regs.smem_page_start = (rb + PSS_SMEM_PAGE_START);
165 ioc->ioc_regs.smem_pg0 = BFI_IOC_SMEM_PG0_CB;
166
167 /*
168 * err set reg : for notification of hb failure
169 */
170 ioc->ioc_regs.err_set = (rb + ERR_SET_REG);
171}
172
Jing Huang5fbe25c2010-10-18 17:17:23 -0700173/*
Krishna Gudipati0a20de42010-03-05 19:34:20 -0800174 * Initialize IOC to port mapping.
175 */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700176
Krishna Gudipati0a20de42010-03-05 19:34:20 -0800177static void
178bfa_ioc_cb_map_port(struct bfa_ioc_s *ioc)
179{
Jing Huang5fbe25c2010-10-18 17:17:23 -0700180 /*
Krishna Gudipati0a20de42010-03-05 19:34:20 -0800181 * For crossbow, port id is same as pci function.
182 */
183 ioc->port_id = bfa_ioc_pcifn(ioc);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700184
Krishna Gudipati0a20de42010-03-05 19:34:20 -0800185 bfa_trc(ioc, ioc->port_id);
186}
187
Jing Huang5fbe25c2010-10-18 17:17:23 -0700188/*
Krishna Gudipati0a20de42010-03-05 19:34:20 -0800189 * Set interrupt mode for a function: INTX or MSIX
190 */
191static void
192bfa_ioc_cb_isr_mode_set(struct bfa_ioc_s *ioc, bfa_boolean_t msix)
193{
194}
195
Jing Huang5fbe25c2010-10-18 17:17:23 -0700196/*
Jing Huang45d7f0c2011-04-13 11:45:53 -0700197 * Synchronized IOC failure processing routines
198 */
199static bfa_boolean_t
200bfa_ioc_cb_sync_start(struct bfa_ioc_s *ioc)
201{
Vijaya Mohan Guvvac679b592013-05-13 02:33:26 -0700202 u32 ioc_fwstate = readl(ioc->ioc_regs.ioc_fwstate);
203
204 /**
205 * Driver load time. If the join bit is set,
206 * it is due to an unclean exit by the driver for this
207 * PCI fn in the previous incarnation. Whoever comes here first
208 * should clean it up, no matter which PCI fn.
209 */
210 if (ioc_fwstate & BFA_IOC_CB_JOIN_MASK) {
211 writel(BFI_IOC_UNINIT, ioc->ioc_regs.ioc_fwstate);
212 writel(BFI_IOC_UNINIT, ioc->ioc_regs.alt_ioc_fwstate);
213 return BFA_TRUE;
214 }
215
Jing Huang45d7f0c2011-04-13 11:45:53 -0700216 return bfa_ioc_cb_sync_complete(ioc);
217}
218
219/*
Krishna Gudipati0a20de42010-03-05 19:34:20 -0800220 * Cleanup hw semaphore and usecnt registers
221 */
222static void
223bfa_ioc_cb_ownership_reset(struct bfa_ioc_s *ioc)
224{
225
226 /*
227 * Read the hw sem reg to make sure that it is locked
228 * before we clear it. If it is not locked, writing 1
229 * will lock it instead of clearing it.
230 */
Jing Huang53440262010-10-18 17:12:29 -0700231 readl(ioc->ioc_regs.ioc_sem_reg);
Maggie Zhangf7f738122010-12-09 19:08:43 -0800232 writel(1, ioc->ioc_regs.ioc_sem_reg);
Krishna Gudipati0a20de42010-03-05 19:34:20 -0800233}
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700234
Jing Huang8f4bfad2010-12-26 21:50:10 -0800235/*
Krishna Gudipatif1d584d2010-12-13 16:17:11 -0800236 * Synchronized IOC failure processing routines
237 */
238static void
239bfa_ioc_cb_sync_join(struct bfa_ioc_s *ioc)
240{
Vijaya Mohan Guvvac679b592013-05-13 02:33:26 -0700241 u32 r32 = readl(ioc->ioc_regs.ioc_fwstate);
242 u32 join_pos = bfa_ioc_cb_join_pos(ioc);
243
244 writel((r32 | join_pos), ioc->ioc_regs.ioc_fwstate);
Krishna Gudipatif1d584d2010-12-13 16:17:11 -0800245}
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700246
Krishna Gudipatif1d584d2010-12-13 16:17:11 -0800247static void
248bfa_ioc_cb_sync_leave(struct bfa_ioc_s *ioc)
249{
Vijaya Mohan Guvvac679b592013-05-13 02:33:26 -0700250 u32 r32 = readl(ioc->ioc_regs.ioc_fwstate);
251 u32 join_pos = bfa_ioc_cb_join_pos(ioc);
252
253 writel((r32 & ~join_pos), ioc->ioc_regs.ioc_fwstate);
254}
255
256static void
257bfa_ioc_cb_set_cur_ioc_fwstate(struct bfa_ioc_s *ioc,
258 enum bfi_ioc_state fwstate)
259{
260 u32 r32 = readl(ioc->ioc_regs.ioc_fwstate);
261
262 writel((fwstate | (r32 & BFA_IOC_CB_JOIN_MASK)),
263 ioc->ioc_regs.ioc_fwstate);
264}
265
266static enum bfi_ioc_state
267bfa_ioc_cb_get_cur_ioc_fwstate(struct bfa_ioc_s *ioc)
268{
269 return (enum bfi_ioc_state)(readl(ioc->ioc_regs.ioc_fwstate) &
270 BFA_IOC_CB_FWSTATE_MASK);
271}
272
273static void
274bfa_ioc_cb_set_alt_ioc_fwstate(struct bfa_ioc_s *ioc,
275 enum bfi_ioc_state fwstate)
276{
277 u32 r32 = readl(ioc->ioc_regs.alt_ioc_fwstate);
278
279 writel((fwstate | (r32 & BFA_IOC_CB_JOIN_MASK)),
280 ioc->ioc_regs.alt_ioc_fwstate);
281}
282
283static enum bfi_ioc_state
284bfa_ioc_cb_get_alt_ioc_fwstate(struct bfa_ioc_s *ioc)
285{
286 return (enum bfi_ioc_state)(readl(ioc->ioc_regs.alt_ioc_fwstate) &
287 BFA_IOC_CB_FWSTATE_MASK);
Krishna Gudipatif1d584d2010-12-13 16:17:11 -0800288}
289
290static void
291bfa_ioc_cb_sync_ack(struct bfa_ioc_s *ioc)
292{
Vijaya Mohan Guvvac679b592013-05-13 02:33:26 -0700293 bfa_ioc_cb_set_cur_ioc_fwstate(ioc, BFI_IOC_FAIL);
Krishna Gudipatif1d584d2010-12-13 16:17:11 -0800294}
295
296static bfa_boolean_t
297bfa_ioc_cb_sync_complete(struct bfa_ioc_s *ioc)
298{
Vijaya Mohan Guvvac679b592013-05-13 02:33:26 -0700299 u32 fwstate, alt_fwstate;
300 fwstate = bfa_ioc_cb_get_cur_ioc_fwstate(ioc);
Krishna Gudipatif1d584d2010-12-13 16:17:11 -0800301
Jing Huang8f4bfad2010-12-26 21:50:10 -0800302 /*
Krishna Gudipatif1d584d2010-12-13 16:17:11 -0800303 * At this point, this IOC is hoding the hw sem in the
304 * start path (fwcheck) OR in the disable/enable path
305 * OR to check if the other IOC has acknowledged failure.
306 *
307 * So, this IOC can be in UNINIT, INITING, DISABLED, FAIL
308 * or in MEMTEST states. In a normal scenario, this IOC
309 * can not be in OP state when this function is called.
310 *
311 * However, this IOC could still be in OP state when
312 * the OS driver is starting up, if the OptROM code has
313 * left it in that state.
314 *
315 * If we had marked this IOC's fwstate as BFI_IOC_FAIL
316 * in the failure case and now, if the fwstate is not
317 * BFI_IOC_FAIL it implies that the other PCI fn have
318 * reinitialized the ASIC or this IOC got disabled, so
319 * return TRUE.
320 */
321 if (fwstate == BFI_IOC_UNINIT ||
322 fwstate == BFI_IOC_INITING ||
323 fwstate == BFI_IOC_DISABLED ||
324 fwstate == BFI_IOC_MEMTEST ||
325 fwstate == BFI_IOC_OP)
326 return BFA_TRUE;
327 else {
Vijaya Mohan Guvvac679b592013-05-13 02:33:26 -0700328 alt_fwstate = bfa_ioc_cb_get_alt_ioc_fwstate(ioc);
Krishna Gudipatif1d584d2010-12-13 16:17:11 -0800329 if (alt_fwstate == BFI_IOC_FAIL ||
330 alt_fwstate == BFI_IOC_DISABLED ||
331 alt_fwstate == BFI_IOC_UNINIT ||
332 alt_fwstate == BFI_IOC_INITING ||
333 alt_fwstate == BFI_IOC_MEMTEST)
334 return BFA_TRUE;
335 else
336 return BFA_FALSE;
337 }
338}
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700339
340bfa_status_t
Krishna Gudipati11189202011-06-13 15:50:35 -0700341bfa_ioc_cb_pll_init(void __iomem *rb, enum bfi_asic_mode fcmode)
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700342{
Vijaya Mohan Guvvac679b592013-05-13 02:33:26 -0700343 u32 pll_sclk, pll_fclk, join_bits;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700344
Krishna Gudipati11189202011-06-13 15:50:35 -0700345 pll_sclk = __APP_PLL_SCLK_ENABLE | __APP_PLL_SCLK_LRESETN |
346 __APP_PLL_SCLK_P0_1(3U) |
347 __APP_PLL_SCLK_JITLMT0_1(3U) |
348 __APP_PLL_SCLK_CNTLMT0_1(3U);
349 pll_fclk = __APP_PLL_LCLK_ENABLE | __APP_PLL_LCLK_LRESETN |
350 __APP_PLL_LCLK_RSEL200500 | __APP_PLL_LCLK_P0_1(3U) |
351 __APP_PLL_LCLK_JITLMT0_1(3U) |
352 __APP_PLL_LCLK_CNTLMT0_1(3U);
Vijaya Mohan Guvvac679b592013-05-13 02:33:26 -0700353 join_bits = readl(rb + BFA_IOC0_STATE_REG) &
354 BFA_IOC_CB_JOIN_MASK;
355 writel((BFI_IOC_UNINIT | join_bits), (rb + BFA_IOC0_STATE_REG));
356 join_bits = readl(rb + BFA_IOC1_STATE_REG) &
357 BFA_IOC_CB_JOIN_MASK;
358 writel((BFI_IOC_UNINIT | join_bits), (rb + BFA_IOC1_STATE_REG));
Jing Huang53440262010-10-18 17:12:29 -0700359 writel(0xffffffffU, (rb + HOSTFN0_INT_MSK));
360 writel(0xffffffffU, (rb + HOSTFN1_INT_MSK));
361 writel(0xffffffffU, (rb + HOSTFN0_INT_STATUS));
362 writel(0xffffffffU, (rb + HOSTFN1_INT_STATUS));
363 writel(0xffffffffU, (rb + HOSTFN0_INT_MSK));
364 writel(0xffffffffU, (rb + HOSTFN1_INT_MSK));
Krishna Gudipati11189202011-06-13 15:50:35 -0700365 writel(__APP_PLL_SCLK_LOGIC_SOFT_RESET, rb + APP_PLL_SCLK_CTL_REG);
366 writel(__APP_PLL_SCLK_BYPASS | __APP_PLL_SCLK_LOGIC_SOFT_RESET,
367 rb + APP_PLL_SCLK_CTL_REG);
368 writel(__APP_PLL_LCLK_LOGIC_SOFT_RESET, rb + APP_PLL_LCLK_CTL_REG);
369 writel(__APP_PLL_LCLK_BYPASS | __APP_PLL_LCLK_LOGIC_SOFT_RESET,
370 rb + APP_PLL_LCLK_CTL_REG);
Jing Huang6a18b162010-10-18 17:08:54 -0700371 udelay(2);
Krishna Gudipati11189202011-06-13 15:50:35 -0700372 writel(__APP_PLL_SCLK_LOGIC_SOFT_RESET, rb + APP_PLL_SCLK_CTL_REG);
373 writel(__APP_PLL_LCLK_LOGIC_SOFT_RESET, rb + APP_PLL_LCLK_CTL_REG);
374 writel(pll_sclk | __APP_PLL_SCLK_LOGIC_SOFT_RESET,
375 rb + APP_PLL_SCLK_CTL_REG);
376 writel(pll_fclk | __APP_PLL_LCLK_LOGIC_SOFT_RESET,
377 rb + APP_PLL_LCLK_CTL_REG);
Jing Huang6a18b162010-10-18 17:08:54 -0700378 udelay(2000);
Jing Huang53440262010-10-18 17:12:29 -0700379 writel(0xffffffffU, (rb + HOSTFN0_INT_STATUS));
380 writel(0xffffffffU, (rb + HOSTFN1_INT_STATUS));
Krishna Gudipati11189202011-06-13 15:50:35 -0700381 writel(pll_sclk, (rb + APP_PLL_SCLK_CTL_REG));
382 writel(pll_fclk, (rb + APP_PLL_LCLK_CTL_REG));
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700383
384 return BFA_STATUS_OK;
385}