diff options
author | Krishna Gudipati <kgudipat@brocade.com> | 2011-06-24 23:23:38 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-06-29 17:59:59 -0400 |
commit | 10a07379247078448c076690657a076076bf89aa (patch) | |
tree | 9d1a18ccf937203a0e9f0bb24ed601391c80b1e8 | |
parent | a714134a857d3984250ee52fda7850b61bf8a94e (diff) |
[SCSI] bfa: Brocade-1860 Fabric Adapter PLL init fixes.
- If flash controller is halted unconditionally, this results in
illegal write access to flash controller register domain. Since
flash controller registers are only accessible once s_clk is started
- added logic to check for WGN status and halt flash controller only
if it is already running.
- Added check to wait for flash controller halt to be completed before
proceeding with s_clk/l_clk initializations.
- Removed unnecessary reset logic for PMM 1T memory and moved memory
initialization after flash access enable.
- Disable Brocade-1860 asic MBOX interrupt before PLL initialization.
- Remove reset enable for S_CLK/L_CLK after both PLL initializations
are complete.
Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | drivers/scsi/bfa/bfa_core.c | 43 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_hw_cb.c | 2 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_ioc.c | 42 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_ioc.h | 3 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_ioc_ct.c | 180 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad.c | 15 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfi.h | 2 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfi_ms.h | 3 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfi_reg.h | 11 |
9 files changed, 169 insertions, 132 deletions
diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c index 4befbf9fd888..f949844aa110 100644 --- a/drivers/scsi/bfa/bfa_core.c +++ b/drivers/scsi/bfa/bfa_core.c | |||
@@ -251,7 +251,39 @@ bfa_isr_reqq(struct bfa_s *bfa, int qid) | |||
251 | void | 251 | void |
252 | bfa_msix_all(struct bfa_s *bfa, int vec) | 252 | bfa_msix_all(struct bfa_s *bfa, int vec) |
253 | { | 253 | { |
254 | bfa_intx(bfa); | 254 | u32 intr, qintr; |
255 | int queue; | ||
256 | |||
257 | intr = readl(bfa->iocfc.bfa_regs.intr_status); | ||
258 | if (!intr) | ||
259 | return; | ||
260 | |||
261 | /* | ||
262 | * RME completion queue interrupt | ||
263 | */ | ||
264 | qintr = intr & __HFN_INT_RME_MASK; | ||
265 | if (qintr && bfa->queue_process) { | ||
266 | for (queue = 0; queue < BFI_IOC_MAX_CQS; queue++) | ||
267 | bfa_isr_rspq(bfa, queue); | ||
268 | } | ||
269 | |||
270 | intr &= ~qintr; | ||
271 | if (!intr) | ||
272 | return; | ||
273 | |||
274 | /* | ||
275 | * CPE completion queue interrupt | ||
276 | */ | ||
277 | qintr = intr & __HFN_INT_CPE_MASK; | ||
278 | if (qintr && bfa->queue_process) { | ||
279 | for (queue = 0; queue < BFI_IOC_MAX_CQS; queue++) | ||
280 | bfa_isr_reqq(bfa, queue); | ||
281 | } | ||
282 | intr &= ~qintr; | ||
283 | if (!intr) | ||
284 | return; | ||
285 | |||
286 | bfa_msix_lpu_err(bfa, intr); | ||
255 | } | 287 | } |
256 | 288 | ||
257 | bfa_boolean_t | 289 | bfa_boolean_t |
@@ -469,6 +501,9 @@ bfa_iocfc_send_cfg(void *bfa_arg) | |||
469 | /* | 501 | /* |
470 | * initialize IOC configuration info | 502 | * initialize IOC configuration info |
471 | */ | 503 | */ |
504 | cfg_info->single_msix_vec = 0; | ||
505 | if (bfa->msix.nvecs == 1) | ||
506 | cfg_info->single_msix_vec = 1; | ||
472 | cfg_info->endian_sig = BFI_IOC_ENDIAN_SIG; | 507 | cfg_info->endian_sig = BFI_IOC_ENDIAN_SIG; |
473 | cfg_info->num_cqs = cfg->fwcfg.num_cqs; | 508 | cfg_info->num_cqs = cfg->fwcfg.num_cqs; |
474 | cfg_info->num_ioim_reqs = cpu_to_be16(cfg->fwcfg.num_ioim_reqs); | 509 | cfg_info->num_ioim_reqs = cpu_to_be16(cfg->fwcfg.num_ioim_reqs); |
@@ -1080,12 +1115,6 @@ bfa_iocfc_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
1080 | ioc->trcmod = bfa->trcmod; | 1115 | ioc->trcmod = bfa->trcmod; |
1081 | bfa_ioc_attach(&bfa->ioc, bfa, &bfa_iocfc_cbfn, &bfa->timer_mod); | 1116 | bfa_ioc_attach(&bfa->ioc, bfa, &bfa_iocfc_cbfn, &bfa->timer_mod); |
1082 | 1117 | ||
1083 | /* | ||
1084 | * Set FC mode for BFA_PCI_DEVICE_ID_CT_FC. | ||
1085 | */ | ||
1086 | if (pcidev->device_id == BFA_PCI_DEVICE_ID_CT_FC) | ||
1087 | bfa_ioc_set_fcmode(&bfa->ioc); | ||
1088 | |||
1089 | bfa_ioc_pci_init(&bfa->ioc, pcidev, BFI_PCIFN_CLASS_FC); | 1118 | bfa_ioc_pci_init(&bfa->ioc, pcidev, BFI_PCIFN_CLASS_FC); |
1090 | bfa_ioc_mbox_register(&bfa->ioc, bfa_mbox_isrs); | 1119 | bfa_ioc_mbox_register(&bfa->ioc, bfa_mbox_isrs); |
1091 | 1120 | ||
diff --git a/drivers/scsi/bfa/bfa_hw_cb.c b/drivers/scsi/bfa/bfa_hw_cb.c index 15fbb13df96c..694ebf1b0bd1 100644 --- a/drivers/scsi/bfa/bfa_hw_cb.c +++ b/drivers/scsi/bfa/bfa_hw_cb.c | |||
@@ -114,7 +114,7 @@ bfa_hwcb_msix_ctrl_install(struct bfa_s *bfa) | |||
114 | return; | 114 | return; |
115 | 115 | ||
116 | if (bfa->msix.nvecs == 1) { | 116 | if (bfa->msix.nvecs == 1) { |
117 | for (i = BFI_MSIX_RME_QMAX_CB+1; i < BFI_MSIX_CB_MAX; i++) | 117 | for (i = BFI_MSIX_CPE_QMIN_CB; i < BFI_MSIX_CB_MAX; i++) |
118 | bfa->msix.handler[i] = bfa_msix_all; | 118 | bfa->msix.handler[i] = bfa_msix_all; |
119 | return; | 119 | return; |
120 | } | 120 | } |
diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c index 7b4a567ca22a..bfe3a87c0b6f 100644 --- a/drivers/scsi/bfa/bfa_ioc.c +++ b/drivers/scsi/bfa/bfa_ioc.c | |||
@@ -2399,12 +2399,6 @@ bfa_ioc_error_isr(struct bfa_ioc_s *ioc) | |||
2399 | bfa_fsm_send_event(ioc, IOC_E_HWERROR); | 2399 | bfa_fsm_send_event(ioc, IOC_E_HWERROR); |
2400 | } | 2400 | } |
2401 | 2401 | ||
2402 | void | ||
2403 | bfa_ioc_set_fcmode(struct bfa_ioc_s *ioc) | ||
2404 | { | ||
2405 | ioc->fcmode = BFA_TRUE; | ||
2406 | } | ||
2407 | |||
2408 | /* | 2402 | /* |
2409 | * return true if IOC is disabled | 2403 | * return true if IOC is disabled |
2410 | */ | 2404 | */ |
@@ -2592,35 +2586,7 @@ bfa_ioc_get_adapter_model(struct bfa_ioc_s *ioc, char *model) | |||
2592 | 2586 | ||
2593 | ioc_attr = ioc->attr; | 2587 | ioc_attr = ioc->attr; |
2594 | 2588 | ||
2595 | /* | 2589 | snprintf(model, BFA_ADAPTER_MODEL_NAME_LEN, "%s-%u", |
2596 | * model name | ||
2597 | */ | ||
2598 | if (ioc->asic_gen == BFI_ASIC_GEN_CT2) { | ||
2599 | int np = bfa_ioc_get_nports(ioc); | ||
2600 | char c; | ||
2601 | switch (ioc_attr->card_type) { | ||
2602 | case BFA_MFG_TYPE_PROWLER_F: | ||
2603 | case BFA_MFG_TYPE_PROWLER_N: | ||
2604 | case BFA_MFG_TYPE_PROWLER_C: | ||
2605 | snprintf(model, BFA_ADAPTER_MODEL_NAME_LEN, | ||
2606 | "%s-%u-%u", | ||
2607 | BFA_MFG_NAME, ioc_attr->card_type, np); | ||
2608 | break; | ||
2609 | case BFA_MFG_TYPE_PROWLER_D: | ||
2610 | if (ioc_attr->ic == BFA_MFG_IC_FC) | ||
2611 | c = 'F'; | ||
2612 | else | ||
2613 | c = 'P'; | ||
2614 | |||
2615 | snprintf(model, BFA_ADAPTER_MODEL_NAME_LEN, | ||
2616 | "%s-%u-%u%c", | ||
2617 | BFA_MFG_NAME, ioc_attr->card_type, np, c); | ||
2618 | break; | ||
2619 | default: | ||
2620 | break; | ||
2621 | } | ||
2622 | } else | ||
2623 | snprintf(model, BFA_ADAPTER_MODEL_NAME_LEN, "%s-%u", | ||
2624 | BFA_MFG_NAME, ioc_attr->card_type); | 2590 | BFA_MFG_NAME, ioc_attr->card_type); |
2625 | } | 2591 | } |
2626 | 2592 | ||
@@ -2711,12 +2677,6 @@ bfa_ioc_get_mfg_mac(struct bfa_ioc_s *ioc) | |||
2711 | return m; | 2677 | return m; |
2712 | } | 2678 | } |
2713 | 2679 | ||
2714 | bfa_boolean_t | ||
2715 | bfa_ioc_get_fcmode(struct bfa_ioc_s *ioc) | ||
2716 | { | ||
2717 | return ioc->fcmode || bfa_asic_id_cb(ioc->pcidev.device_id); | ||
2718 | } | ||
2719 | |||
2720 | /* | 2680 | /* |
2721 | * Retrieve saved firmware trace from a prior IOC failure. | 2681 | * Retrieve saved firmware trace from a prior IOC failure. |
2722 | */ | 2682 | */ |
diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h index 78e9606217ea..1055ca9f6043 100644 --- a/drivers/scsi/bfa/bfa_ioc.h +++ b/drivers/scsi/bfa/bfa_ioc.h | |||
@@ -362,6 +362,7 @@ bfa_status_t bfa_ioc_ct2_pll_init(void __iomem *rb, enum bfi_asic_mode mode); | |||
362 | } while (0) | 362 | } while (0) |
363 | #define bfa_ioc_ownership_reset(__ioc) \ | 363 | #define bfa_ioc_ownership_reset(__ioc) \ |
364 | ((__ioc)->ioc_hwif->ioc_ownership_reset(__ioc)) | 364 | ((__ioc)->ioc_hwif->ioc_ownership_reset(__ioc)) |
365 | #define bfa_ioc_get_fcmode(__ioc) ((__ioc)->fcmode) | ||
365 | #define bfa_ioc_lpu_read_stat(__ioc) do { \ | 366 | #define bfa_ioc_lpu_read_stat(__ioc) do { \ |
366 | if ((__ioc)->ioc_hwif->ioc_lpu_read_stat) \ | 367 | if ((__ioc)->ioc_hwif->ioc_lpu_read_stat) \ |
367 | ((__ioc)->ioc_hwif->ioc_lpu_read_stat(__ioc)); \ | 368 | ((__ioc)->ioc_hwif->ioc_lpu_read_stat(__ioc)); \ |
@@ -414,8 +415,6 @@ bfa_status_t bfa_ioc_debug_fwtrc(struct bfa_ioc_s *ioc, void *trcdata, | |||
414 | int *trclen); | 415 | int *trclen); |
415 | bfa_status_t bfa_ioc_debug_fwcore(struct bfa_ioc_s *ioc, void *buf, | 416 | bfa_status_t bfa_ioc_debug_fwcore(struct bfa_ioc_s *ioc, void *buf, |
416 | u32 *offset, int *buflen); | 417 | u32 *offset, int *buflen); |
417 | void bfa_ioc_set_fcmode(struct bfa_ioc_s *ioc); | ||
418 | bfa_boolean_t bfa_ioc_get_fcmode(struct bfa_ioc_s *ioc); | ||
419 | bfa_boolean_t bfa_ioc_sem_get(void __iomem *sem_reg); | 418 | bfa_boolean_t bfa_ioc_sem_get(void __iomem *sem_reg); |
420 | void bfa_ioc_fwver_get(struct bfa_ioc_s *ioc, | 419 | void bfa_ioc_fwver_get(struct bfa_ioc_s *ioc, |
421 | struct bfi_ioc_image_hdr_s *fwhdr); | 420 | struct bfi_ioc_image_hdr_s *fwhdr); |
diff --git a/drivers/scsi/bfa/bfa_ioc_ct.c b/drivers/scsi/bfa/bfa_ioc_ct.c index 216016c50d11..77f2b4470a69 100644 --- a/drivers/scsi/bfa/bfa_ioc_ct.c +++ b/drivers/scsi/bfa/bfa_ioc_ct.c | |||
@@ -564,10 +564,12 @@ bfa_ioc_set_ct2_hwif(struct bfa_ioc_s *ioc) | |||
564 | * Temporary workaround for MSI-X resource allocation for catapult-2. | 564 | * Temporary workaround for MSI-X resource allocation for catapult-2. |
565 | */ | 565 | */ |
566 | #define HOSTFN_MSIX_DEFAULT 16 | 566 | #define HOSTFN_MSIX_DEFAULT 16 |
567 | #define HOSTFN_MSIX_VT_INDEX_MBOX_ERR 0x30138 | ||
567 | #define HOSTFN_MSIX_VT_OFST_NUMVT 0x3013c | 568 | #define HOSTFN_MSIX_VT_OFST_NUMVT 0x3013c |
568 | #define __MSIX_VT_NUMVT__MK 0x003ff800 | 569 | #define __MSIX_VT_NUMVT__MK 0x003ff800 |
569 | #define __MSIX_VT_NUMVT__SH 11 | 570 | #define __MSIX_VT_NUMVT__SH 11 |
570 | #define __MSIX_VT_NUMVT_(_v) ((_v) << __MSIX_VT_NUMVT__SH) | 571 | #define __MSIX_VT_NUMVT_(_v) ((_v) << __MSIX_VT_NUMVT__SH) |
572 | #define __MSIX_VT_OFST_ 0x000007ff | ||
571 | void | 573 | void |
572 | bfa_ioc_ct2_poweron(struct bfa_ioc_s *ioc) | 574 | bfa_ioc_ct2_poweron(struct bfa_ioc_s *ioc) |
573 | { | 575 | { |
@@ -575,12 +577,17 @@ bfa_ioc_ct2_poweron(struct bfa_ioc_s *ioc) | |||
575 | u32 r32; | 577 | u32 r32; |
576 | 578 | ||
577 | r32 = readl(rb + HOSTFN_MSIX_VT_OFST_NUMVT); | 579 | r32 = readl(rb + HOSTFN_MSIX_VT_OFST_NUMVT); |
578 | if (r32 & __MSIX_VT_NUMVT__MK) | 580 | if (r32 & __MSIX_VT_NUMVT__MK) { |
581 | writel(r32 & __MSIX_VT_OFST_, | ||
582 | rb + HOSTFN_MSIX_VT_INDEX_MBOX_ERR); | ||
579 | return; | 583 | return; |
584 | } | ||
580 | 585 | ||
581 | writel(__MSIX_VT_NUMVT_(HOSTFN_MSIX_DEFAULT - 1) | | 586 | writel(__MSIX_VT_NUMVT_(HOSTFN_MSIX_DEFAULT - 1) | |
582 | HOSTFN_MSIX_DEFAULT * bfa_ioc_pcifn(ioc), | 587 | HOSTFN_MSIX_DEFAULT * bfa_ioc_pcifn(ioc), |
583 | rb + HOSTFN_MSIX_VT_OFST_NUMVT); | 588 | rb + HOSTFN_MSIX_VT_OFST_NUMVT); |
589 | writel(HOSTFN_MSIX_DEFAULT * bfa_ioc_pcifn(ioc), | ||
590 | rb + HOSTFN_MSIX_VT_INDEX_MBOX_ERR); | ||
584 | } | 591 | } |
585 | 592 | ||
586 | bfa_status_t | 593 | bfa_status_t |
@@ -649,17 +656,8 @@ bfa_ioc_ct_pll_init(void __iomem *rb, enum bfi_asic_mode mode) | |||
649 | return BFA_STATUS_OK; | 656 | return BFA_STATUS_OK; |
650 | } | 657 | } |
651 | 658 | ||
652 | static struct { u32 sclk, speed, half_speed; } ct2_pll[] = { | ||
653 | {0}, /* unused */ | ||
654 | {__APP_PLL_SCLK_CLK_DIV2, 0, 0}, /* FC 8G */ | ||
655 | {0, 0, 0}, /* FC 16G */ | ||
656 | {__APP_PLL_SCLK_REFCLK_SEL | __APP_PLL_SCLK_CLK_DIV2, 0, /* ETH */ | ||
657 | __APP_LPUCLK_HALFSPEED}, | ||
658 | {0, 0, 0}, /* COMBO */ | ||
659 | }; | ||
660 | |||
661 | static void | 659 | static void |
662 | bfa_ioc_ct2_sclk_init(void __iomem *rb, enum bfi_asic_mode mode) | 660 | bfa_ioc_ct2_sclk_init(void __iomem *rb) |
663 | { | 661 | { |
664 | u32 r32; | 662 | u32 r32; |
665 | 663 | ||
@@ -673,11 +671,12 @@ bfa_ioc_ct2_sclk_init(void __iomem *rb, enum bfi_asic_mode mode) | |||
673 | writel(r32, (rb + CT2_APP_PLL_SCLK_CTL_REG)); | 671 | writel(r32, (rb + CT2_APP_PLL_SCLK_CTL_REG)); |
674 | 672 | ||
675 | /* | 673 | /* |
676 | * select clock speed based on mode | 674 | * Ignore mode and program for the max clock (which is FC16) |
675 | * Firmware/NFC will do the PLL init appropiately | ||
677 | */ | 676 | */ |
678 | r32 = readl((rb + CT2_APP_PLL_SCLK_CTL_REG)); | 677 | r32 = readl((rb + CT2_APP_PLL_SCLK_CTL_REG)); |
679 | r32 &= ~(__APP_PLL_SCLK_REFCLK_SEL | __APP_PLL_SCLK_CLK_DIV2); | 678 | r32 &= ~(__APP_PLL_SCLK_REFCLK_SEL | __APP_PLL_SCLK_CLK_DIV2); |
680 | writel(r32 | ct2_pll[mode].sclk, (rb + CT2_APP_PLL_SCLK_CTL_REG)); | 679 | writel(r32, (rb + CT2_APP_PLL_SCLK_CTL_REG)); |
681 | 680 | ||
682 | /* | 681 | /* |
683 | * while doing PLL init dont clock gate ethernet subsystem | 682 | * while doing PLL init dont clock gate ethernet subsystem |
@@ -700,30 +699,10 @@ bfa_ioc_ct2_sclk_init(void __iomem *rb, enum bfi_asic_mode mode) | |||
700 | * poll for s_clk lock or delay 1ms | 699 | * poll for s_clk lock or delay 1ms |
701 | */ | 700 | */ |
702 | udelay(1000); | 701 | udelay(1000); |
703 | |||
704 | /* | ||
705 | * release soft reset on s_clk & l_clk | ||
706 | */ | ||
707 | r32 = readl((rb + CT2_APP_PLL_SCLK_CTL_REG)); | ||
708 | writel(r32 & ~__APP_PLL_SCLK_LOGIC_SOFT_RESET, | ||
709 | (rb + CT2_APP_PLL_SCLK_CTL_REG)); | ||
710 | |||
711 | /* | ||
712 | * clock gating for ethernet subsystem if not in ethernet mode | ||
713 | */ | ||
714 | if (mode != BFI_ASIC_MODE_ETH) { | ||
715 | r32 = readl((rb + CT2_CHIP_MISC_PRG)); | ||
716 | writel(r32 & ~__ETH_CLK_ENABLE_PORT0, | ||
717 | (rb + CT2_CHIP_MISC_PRG)); | ||
718 | |||
719 | r32 = readl((rb + CT2_PCIE_MISC_REG)); | ||
720 | writel(r32 & ~__ETH_CLK_ENABLE_PORT1, | ||
721 | (rb + CT2_PCIE_MISC_REG)); | ||
722 | } | ||
723 | } | 702 | } |
724 | 703 | ||
725 | static void | 704 | static void |
726 | bfa_ioc_ct2_lclk_init(void __iomem *rb, enum bfi_asic_mode mode) | 705 | bfa_ioc_ct2_lclk_init(void __iomem *rb) |
727 | { | 706 | { |
728 | u32 r32; | 707 | u32 r32; |
729 | 708 | ||
@@ -737,97 +716,144 @@ bfa_ioc_ct2_lclk_init(void __iomem *rb, enum bfi_asic_mode mode) | |||
737 | writel(r32, (rb + CT2_APP_PLL_LCLK_CTL_REG)); | 716 | writel(r32, (rb + CT2_APP_PLL_LCLK_CTL_REG)); |
738 | 717 | ||
739 | /* | 718 | /* |
740 | * set LPU speed | 719 | * set LPU speed (set for FC16 which will work for other modes) |
741 | */ | 720 | */ |
742 | r32 = readl((rb + CT2_CHIP_MISC_PRG)); | 721 | r32 = readl((rb + CT2_CHIP_MISC_PRG)); |
743 | writel(r32 | ct2_pll[mode].speed, | 722 | writel(r32, (rb + CT2_CHIP_MISC_PRG)); |
744 | (rb + CT2_CHIP_MISC_PRG)); | ||
745 | 723 | ||
746 | /* | 724 | /* |
747 | * set LPU half speed | 725 | * set LPU half speed (set for FC16 which will work for other modes) |
748 | */ | 726 | */ |
749 | r32 = readl((rb + CT2_APP_PLL_LCLK_CTL_REG)); | 727 | r32 = readl((rb + CT2_APP_PLL_LCLK_CTL_REG)); |
750 | writel(r32 | ct2_pll[mode].half_speed, | 728 | writel(r32, (rb + CT2_APP_PLL_LCLK_CTL_REG)); |
751 | (rb + CT2_APP_PLL_LCLK_CTL_REG)); | ||
752 | 729 | ||
753 | /* | 730 | /* |
754 | * set lclk for mode | 731 | * set lclk for mode (set for FC16) |
755 | */ | 732 | */ |
756 | r32 = readl((rb + CT2_APP_PLL_LCLK_CTL_REG)); | 733 | r32 = readl((rb + CT2_APP_PLL_LCLK_CTL_REG)); |
757 | r32 &= (__P_LCLK_PLL_LOCK | __APP_LPUCLK_HALFSPEED); | 734 | r32 &= (__P_LCLK_PLL_LOCK | __APP_LPUCLK_HALFSPEED); |
758 | if (mode == BFI_ASIC_MODE_FC || mode == BFI_ASIC_MODE_FC16 || | 735 | r32 |= 0x20c1731b; |
759 | mode == BFI_ASIC_MODE_ETH) | ||
760 | r32 |= 0x20c1731b; | ||
761 | else | ||
762 | r32 |= 0x2081731b; | ||
763 | writel(r32, (rb + CT2_APP_PLL_LCLK_CTL_REG)); | 736 | writel(r32, (rb + CT2_APP_PLL_LCLK_CTL_REG)); |
764 | 737 | ||
765 | /* | 738 | /* |
766 | * poll for s_clk lock or delay 1ms | 739 | * poll for s_clk lock or delay 1ms |
767 | */ | 740 | */ |
768 | udelay(1000); | 741 | udelay(1000); |
769 | |||
770 | /* | ||
771 | * release soft reset on s_clk & l_clk | ||
772 | */ | ||
773 | r32 = readl((rb + CT2_APP_PLL_LCLK_CTL_REG)); | ||
774 | writel(r32 & ~__APP_PLL_LCLK_LOGIC_SOFT_RESET, | ||
775 | (rb + CT2_APP_PLL_LCLK_CTL_REG)); | ||
776 | } | 742 | } |
777 | 743 | ||
778 | static void | 744 | static void |
779 | bfa_ioc_ct2_mem_init(void __iomem *rb, enum bfi_asic_mode mode) | 745 | bfa_ioc_ct2_mem_init(void __iomem *rb) |
780 | { | 746 | { |
781 | bfa_boolean_t fcmode; | ||
782 | u32 r32; | 747 | u32 r32; |
783 | 748 | ||
784 | fcmode = (mode == BFI_ASIC_MODE_FC) || (mode == BFI_ASIC_MODE_FC16); | ||
785 | if (!fcmode) { | ||
786 | writel(__PMM_1T_PNDB_P | __PMM_1T_RESET_P, | ||
787 | (rb + CT2_PMM_1T_CONTROL_REG_P0)); | ||
788 | writel(__PMM_1T_PNDB_P | __PMM_1T_RESET_P, | ||
789 | (rb + CT2_PMM_1T_CONTROL_REG_P1)); | ||
790 | } | ||
791 | |||
792 | r32 = readl((rb + PSS_CTL_REG)); | 749 | r32 = readl((rb + PSS_CTL_REG)); |
793 | r32 &= ~__PSS_LMEM_RESET; | 750 | r32 &= ~__PSS_LMEM_RESET; |
794 | writel(r32, (rb + PSS_CTL_REG)); | 751 | writel(r32, (rb + PSS_CTL_REG)); |
795 | udelay(1000); | 752 | udelay(1000); |
796 | 753 | ||
797 | if (!fcmode) { | ||
798 | writel(__PMM_1T_PNDB_P, (rb + CT2_PMM_1T_CONTROL_REG_P0)); | ||
799 | writel(__PMM_1T_PNDB_P, (rb + CT2_PMM_1T_CONTROL_REG_P1)); | ||
800 | } | ||
801 | |||
802 | writel(__EDRAM_BISTR_START, (rb + CT2_MBIST_CTL_REG)); | 754 | writel(__EDRAM_BISTR_START, (rb + CT2_MBIST_CTL_REG)); |
803 | udelay(1000); | 755 | udelay(1000); |
804 | writel(0, (rb + CT2_MBIST_CTL_REG)); | 756 | writel(0, (rb + CT2_MBIST_CTL_REG)); |
805 | } | 757 | } |
806 | 758 | ||
759 | void | ||
760 | bfa_ioc_ct2_mac_reset(void __iomem *rb) | ||
761 | { | ||
762 | u32 r32; | ||
763 | |||
764 | bfa_ioc_ct2_sclk_init(rb); | ||
765 | bfa_ioc_ct2_lclk_init(rb); | ||
766 | |||
767 | /* | ||
768 | * release soft reset on s_clk & l_clk | ||
769 | */ | ||
770 | r32 = readl((rb + CT2_APP_PLL_SCLK_CTL_REG)); | ||
771 | writel(r32 & ~__APP_PLL_SCLK_LOGIC_SOFT_RESET, | ||
772 | (rb + CT2_APP_PLL_SCLK_CTL_REG)); | ||
773 | |||
774 | /* | ||
775 | * release soft reset on s_clk & l_clk | ||
776 | */ | ||
777 | r32 = readl((rb + CT2_APP_PLL_LCLK_CTL_REG)); | ||
778 | writel(r32 & ~__APP_PLL_LCLK_LOGIC_SOFT_RESET, | ||
779 | (rb + CT2_APP_PLL_LCLK_CTL_REG)); | ||
780 | |||
781 | /* put port0, port1 MAC & AHB in reset */ | ||
782 | writel((__CSI_MAC_RESET | __CSI_MAC_AHB_RESET), | ||
783 | rb + CT2_CSI_MAC_CONTROL_REG(0)); | ||
784 | writel((__CSI_MAC_RESET | __CSI_MAC_AHB_RESET), | ||
785 | rb + CT2_CSI_MAC_CONTROL_REG(1)); | ||
786 | } | ||
787 | |||
788 | #define CT2_NFC_MAX_DELAY 1000 | ||
807 | bfa_status_t | 789 | bfa_status_t |
808 | bfa_ioc_ct2_pll_init(void __iomem *rb, enum bfi_asic_mode mode) | 790 | bfa_ioc_ct2_pll_init(void __iomem *rb, enum bfi_asic_mode mode) |
809 | { | 791 | { |
810 | u32 r32; | 792 | u32 wgn, r32; |
793 | int i; | ||
811 | 794 | ||
812 | /* | 795 | /* |
813 | * Initialize PLL if not already done by NFC | 796 | * Initialize PLL if not already done by NFC |
814 | */ | 797 | */ |
815 | r32 = readl((rb + CT2_WGN_STATUS)); | 798 | wgn = readl(rb + CT2_WGN_STATUS); |
799 | if (!(wgn & __GLBL_PF_VF_CFG_RDY)) { | ||
800 | writel(__HALT_NFC_CONTROLLER, rb + CT2_NFC_CSR_SET_REG); | ||
801 | for (i = 0; i < CT2_NFC_MAX_DELAY; i++) { | ||
802 | r32 = readl(rb + CT2_NFC_CSR_SET_REG); | ||
803 | if (r32 & __NFC_CONTROLLER_HALTED) | ||
804 | break; | ||
805 | udelay(1000); | ||
806 | } | ||
807 | } | ||
816 | 808 | ||
817 | writel(__HALT_NFC_CONTROLLER, (rb + CT2_NFC_CSR_SET_REG)); | 809 | /* |
810 | * Mask the interrupts and clear any | ||
811 | * pending interrupts. | ||
812 | */ | ||
813 | writel(1, (rb + CT2_LPU0_HOSTFN_MBOX0_MSK)); | ||
814 | writel(1, (rb + CT2_LPU1_HOSTFN_MBOX0_MSK)); | ||
818 | 815 | ||
819 | bfa_ioc_ct2_sclk_init(rb, mode); | 816 | r32 = readl((rb + CT2_LPU0_HOSTFN_CMD_STAT)); |
820 | bfa_ioc_ct2_lclk_init(rb, mode); | 817 | if (r32 == 1) { |
821 | bfa_ioc_ct2_mem_init(rb, mode); | 818 | writel(1, (rb + CT2_LPU0_HOSTFN_CMD_STAT)); |
819 | readl((rb + CT2_LPU0_HOSTFN_CMD_STAT)); | ||
820 | } | ||
821 | r32 = readl((rb + CT2_LPU1_HOSTFN_CMD_STAT)); | ||
822 | if (r32 == 1) { | ||
823 | writel(1, (rb + CT2_LPU1_HOSTFN_CMD_STAT)); | ||
824 | readl((rb + CT2_LPU1_HOSTFN_CMD_STAT)); | ||
825 | } | ||
826 | |||
827 | bfa_ioc_ct2_mac_reset(rb); | ||
828 | bfa_ioc_ct2_sclk_init(rb); | ||
829 | bfa_ioc_ct2_lclk_init(rb); | ||
830 | |||
831 | /* | ||
832 | * release soft reset on s_clk & l_clk | ||
833 | */ | ||
834 | r32 = readl((rb + CT2_APP_PLL_SCLK_CTL_REG)); | ||
835 | writel(r32 & ~__APP_PLL_SCLK_LOGIC_SOFT_RESET, | ||
836 | (rb + CT2_APP_PLL_SCLK_CTL_REG)); | ||
837 | |||
838 | /* | ||
839 | * release soft reset on s_clk & l_clk | ||
840 | */ | ||
841 | r32 = readl((rb + CT2_APP_PLL_LCLK_CTL_REG)); | ||
842 | writel(r32 & ~__APP_PLL_LCLK_LOGIC_SOFT_RESET, | ||
843 | (rb + CT2_APP_PLL_LCLK_CTL_REG)); | ||
822 | 844 | ||
823 | /* | 845 | /* |
824 | * Announce flash device presence, if flash was corrupted. | 846 | * Announce flash device presence, if flash was corrupted. |
825 | */ | 847 | */ |
826 | if (r32 == (__WGN_READY | __GLBL_PF_VF_CFG_RDY)) { | 848 | if (wgn == (__WGN_READY | __GLBL_PF_VF_CFG_RDY)) { |
827 | writel(0, (rb + PSS_GPIO_OUT_REG)); | 849 | r32 = readl((rb + PSS_GPIO_OUT_REG)); |
828 | writel(1, (rb + PSS_GPIO_OE_REG)); | 850 | writel(r32 & ~1, (rb + PSS_GPIO_OUT_REG)); |
851 | r32 = readl((rb + PSS_GPIO_OE_REG)); | ||
852 | writel(r32 | 1, (rb + PSS_GPIO_OE_REG)); | ||
829 | } | 853 | } |
830 | 854 | ||
855 | bfa_ioc_ct2_mem_init(rb); | ||
856 | |||
831 | writel(BFI_IOC_UNINIT, (rb + CT2_BFA_IOC0_STATE_REG)); | 857 | writel(BFI_IOC_UNINIT, (rb + CT2_BFA_IOC0_STATE_REG)); |
832 | writel(BFI_IOC_UNINIT, (rb + CT2_BFA_IOC1_STATE_REG)); | 858 | writel(BFI_IOC_UNINIT, (rb + CT2_BFA_IOC1_STATE_REG)); |
833 | return BFA_STATUS_OK; | 859 | return BFA_STATUS_OK; |
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index 4fa3988ccb32..76af7ac02fd0 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c | |||
@@ -784,11 +784,14 @@ bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad) | |||
784 | pci_set_master(pdev); | 784 | pci_set_master(pdev); |
785 | 785 | ||
786 | 786 | ||
787 | if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) != 0) | 787 | if ((pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) != 0) || |
788 | if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) { | 788 | (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)) != 0)) { |
789 | if ((pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) || | ||
790 | (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)) != 0)) { | ||
789 | printk(KERN_ERR "pci_set_dma_mask fail %p\n", pdev); | 791 | printk(KERN_ERR "pci_set_dma_mask fail %p\n", pdev); |
790 | goto out_release_region; | 792 | goto out_release_region; |
791 | } | 793 | } |
794 | } | ||
792 | 795 | ||
793 | bfad->pci_bar0_kva = pci_iomap(pdev, 0, pci_resource_len(pdev, 0)); | 796 | bfad->pci_bar0_kva = pci_iomap(pdev, 0, pci_resource_len(pdev, 0)); |
794 | bfad->pci_bar2_kva = pci_iomap(pdev, 2, pci_resource_len(pdev, 2)); | 797 | bfad->pci_bar2_kva = pci_iomap(pdev, 2, pci_resource_len(pdev, 2)); |
@@ -1291,6 +1294,7 @@ bfad_setup_intr(struct bfad_s *bfad) | |||
1291 | u32 mask = 0, i, num_bit = 0, max_bit = 0; | 1294 | u32 mask = 0, i, num_bit = 0, max_bit = 0; |
1292 | struct msix_entry msix_entries[MAX_MSIX_ENTRY]; | 1295 | struct msix_entry msix_entries[MAX_MSIX_ENTRY]; |
1293 | struct pci_dev *pdev = bfad->pcidev; | 1296 | struct pci_dev *pdev = bfad->pcidev; |
1297 | u16 reg; | ||
1294 | 1298 | ||
1295 | /* Call BFA to get the msix map for this PCI function. */ | 1299 | /* Call BFA to get the msix map for this PCI function. */ |
1296 | bfa_msix_getvecs(&bfad->bfa, &mask, &num_bit, &max_bit); | 1300 | bfa_msix_getvecs(&bfad->bfa, &mask, &num_bit, &max_bit); |
@@ -1320,6 +1324,13 @@ bfad_setup_intr(struct bfad_s *bfad) | |||
1320 | goto line_based; | 1324 | goto line_based; |
1321 | } | 1325 | } |
1322 | 1326 | ||
1327 | /* Disable INTX in MSI-X mode */ | ||
1328 | pci_read_config_word(pdev, PCI_COMMAND, ®); | ||
1329 | |||
1330 | if (!(reg & PCI_COMMAND_INTX_DISABLE)) | ||
1331 | pci_write_config_word(pdev, PCI_COMMAND, | ||
1332 | reg | PCI_COMMAND_INTX_DISABLE); | ||
1333 | |||
1323 | /* Save the vectors */ | 1334 | /* Save the vectors */ |
1324 | for (i = 0; i < bfad->nvec; i++) { | 1335 | for (i = 0; i < bfad->nvec; i++) { |
1325 | bfa_trc(bfad, msix_entries[i].vector); | 1336 | bfa_trc(bfad, msix_entries[i].vector); |
diff --git a/drivers/scsi/bfa/bfi.h b/drivers/scsi/bfa/bfi.h index d8f1a7105139..3fb2e8315323 100644 --- a/drivers/scsi/bfa/bfi.h +++ b/drivers/scsi/bfa/bfi.h | |||
@@ -253,7 +253,7 @@ struct bfi_ioc_attr_s { | |||
253 | u32 adapter_prop; /* adapter properties */ | 253 | u32 adapter_prop; /* adapter properties */ |
254 | u16 maxfrsize; /* max receive frame size */ | 254 | u16 maxfrsize; /* max receive frame size */ |
255 | char asic_rev; | 255 | char asic_rev; |
256 | u8 ic; /* initial capability */ | 256 | u8 rsvd_d; |
257 | char fw_version[BFA_VERSION_LEN]; | 257 | char fw_version[BFA_VERSION_LEN]; |
258 | char optrom_version[BFA_VERSION_LEN]; | 258 | char optrom_version[BFA_VERSION_LEN]; |
259 | struct bfa_mfg_vpd_s vpd; | 259 | struct bfa_mfg_vpd_s vpd; |
diff --git a/drivers/scsi/bfa/bfi_ms.h b/drivers/scsi/bfa/bfi_ms.h index c665a800c41d..8c1973456410 100644 --- a/drivers/scsi/bfa/bfi_ms.h +++ b/drivers/scsi/bfa/bfi_ms.h | |||
@@ -48,7 +48,8 @@ struct bfi_iocfc_cfg_s { | |||
48 | u32 endian_sig; /* endian signature of host */ | 48 | u32 endian_sig; /* endian signature of host */ |
49 | __be16 num_ioim_reqs; | 49 | __be16 num_ioim_reqs; |
50 | __be16 num_fwtio_reqs; | 50 | __be16 num_fwtio_reqs; |
51 | u8 rsvd[4]; | 51 | u8 single_msix_vec; |
52 | u8 rsvd[3]; | ||
52 | 53 | ||
53 | /* | 54 | /* |
54 | * Request and response circular queue base addresses, size and | 55 | * Request and response circular queue base addresses, size and |
diff --git a/drivers/scsi/bfa/bfi_reg.h b/drivers/scsi/bfa/bfi_reg.h index d20d2b30ed30..d892064b64a8 100644 --- a/drivers/scsi/bfa/bfi_reg.h +++ b/drivers/scsi/bfa/bfi_reg.h | |||
@@ -277,6 +277,8 @@ enum { | |||
277 | #define CT2_LPU1_HOSTFN_CMD_STAT (CT2_PCI_CPQ_BASE + 0x8c) | 277 | #define CT2_LPU1_HOSTFN_CMD_STAT (CT2_PCI_CPQ_BASE + 0x8c) |
278 | #define CT2_HOSTFN_LPU0_READ_STAT (CT2_PCI_CPQ_BASE + 0x90) | 278 | #define CT2_HOSTFN_LPU0_READ_STAT (CT2_PCI_CPQ_BASE + 0x90) |
279 | #define CT2_HOSTFN_LPU1_READ_STAT (CT2_PCI_CPQ_BASE + 0x94) | 279 | #define CT2_HOSTFN_LPU1_READ_STAT (CT2_PCI_CPQ_BASE + 0x94) |
280 | #define CT2_LPU0_HOSTFN_MBOX0_MSK (CT2_PCI_CPQ_BASE + 0x98) | ||
281 | #define CT2_LPU1_HOSTFN_MBOX0_MSK (CT2_PCI_CPQ_BASE + 0x9C) | ||
280 | #define CT2_HOST_SEM0_REG 0x000148f0 | 282 | #define CT2_HOST_SEM0_REG 0x000148f0 |
281 | #define CT2_HOST_SEM1_REG 0x000148f4 | 283 | #define CT2_HOST_SEM1_REG 0x000148f4 |
282 | #define CT2_HOST_SEM2_REG 0x000148f8 | 284 | #define CT2_HOST_SEM2_REG 0x000148f8 |
@@ -337,6 +339,15 @@ enum { | |||
337 | #define __GLBL_PF_VF_CFG_RDY 0x00000200 | 339 | #define __GLBL_PF_VF_CFG_RDY 0x00000200 |
338 | #define CT2_NFC_CSR_SET_REG 0x00027424 | 340 | #define CT2_NFC_CSR_SET_REG 0x00027424 |
339 | #define __HALT_NFC_CONTROLLER 0x00000002 | 341 | #define __HALT_NFC_CONTROLLER 0x00000002 |
342 | #define __NFC_CONTROLLER_HALTED 0x00001000 | ||
343 | |||
344 | #define CT2_CSI_MAC0_CONTROL_REG 0x000270d0 | ||
345 | #define __CSI_MAC_RESET 0x00000010 | ||
346 | #define __CSI_MAC_AHB_RESET 0x00000008 | ||
347 | #define CT2_CSI_MAC1_CONTROL_REG 0x000270d4 | ||
348 | #define CT2_CSI_MAC_CONTROL_REG(__n) \ | ||
349 | (CT2_CSI_MAC0_CONTROL_REG + \ | ||
350 | (__n) * (CT2_CSI_MAC1_CONTROL_REG - CT2_CSI_MAC0_CONTROL_REG)) | ||
340 | 351 | ||
341 | /* | 352 | /* |
342 | * Name semaphore registers based on usage | 353 | * Name semaphore registers based on usage |