30 static void mvs_64xx_detect_porttype(
struct mvs_info *mvi,
int i)
67 mvs_write_port_vsr_data(mvi, i, 0x2F0);
72 for (i = 0; i < mvi->
chip->n_phy; i++) {
74 mvs_write_port_vsr_data(mvi, i, 0x90000000);
76 mvs_write_port_vsr_data(mvi, i, 0x50f2);
78 mvs_write_port_vsr_data(mvi, i, 0x0e);
83 static void mvs_64xx_stp_reset(
struct mvs_info *mvi,
u32 phy_id)
120 static void mvs_64xx_phy_reset(
struct mvs_info *mvi,
u32 phy_id,
int hard)
123 tmp = mvs_read_port_irq_stat(mvi, phy_id);
125 mvs_write_port_irq_stat(mvi, phy_id, tmp);
126 tmp = mvs_read_phy_ctl(mvi, phy_id);
131 mvs_write_phy_ctl(mvi, phy_id, tmp);
134 tmp = mvs_read_phy_ctl(mvi, phy_id);
151 if (tmp & (1 << (reg_set % 32))) {
189 if (!(tmp & HBA_RST)) {
203 dev_printk(
KERN_ERR, mvi->
dev,
"HBA reset failed\n");
209 static void mvs_64xx_phy_disable(
struct mvs_info *mvi,
u32 phy_id)
221 pci_read_config_dword(mvi->
pdev, offs, &tmp);
223 pci_write_config_dword(mvi->
pdev, offs, tmp);
231 static void mvs_64xx_phy_enable(
struct mvs_info *mvi,
u32 phy_id)
243 pci_read_config_dword(mvi->
pdev, offs, &tmp);
245 pci_write_config_dword(mvi->
pdev, offs, tmp);
259 if (mvi->
pdev && mvi->
pdev->revision == 0)
262 mvs_show_pcie_usage(mvi);
263 tmp = mvs_64xx_chip_reset(mvi);
313 mvs_64xx_phy_hacks(mvi);
337 for (i = 0; i < mvi->
chip->n_phy; i++) {
343 mvs_64xx_enable_xmt(mvi, i);
347 mvs_64xx_detect_porttype(mvi, i);
351 writel(0x0E008000, regs + 0x000);
352 writel(0x59000008, regs + 0x004);
353 writel(0x20, regs + 0x008);
354 writel(0x20, regs + 0x00c);
355 writel(0x20, regs + 0x010);
356 writel(0x20, regs + 0x014);
357 writel(0x20, regs + 0x018);
358 writel(0x20, regs + 0x01c);
360 for (i = 0; i < mvi->
chip->n_phy; i++) {
362 tmp = mvs_read_port_irq_stat(mvi, i);
364 mvs_write_port_irq_stat(mvi, i, tmp);
370 mvs_write_port_irq_mask(mvi, i, tmp);
422 static int mvs_64xx_ioremap(
struct mvs_info *mvi)
429 static void mvs_64xx_iounmap(
struct mvs_info *mvi)
435 static void mvs_64xx_interrupt_enable(
struct mvs_info *mvi)
444 static void mvs_64xx_interrupt_disable(
struct mvs_info *mvi)
453 static u32 mvs_64xx_isr_status(
struct mvs_info *mvi,
int irq)
461 if (stat == 0 || stat == 0xffffffff)
475 spin_lock(&mvi->
lock);
477 spin_unlock(&mvi->
lock);
482 static void mvs_64xx_command_active(
struct mvs_info *mvi,
u32 slot_idx)
485 mvs_cw32(mvi, 0x40 + (slot_idx >> 3), 1 << (slot_idx % 32));
486 mvs_cw32(mvi, 0x00 + (slot_idx >> 3), 1 << (slot_idx % 32));
488 tmp = mvs_cr32(mvi, 0x00 + (slot_idx >> 3));
489 }
while (tmp & 1 << (slot_idx % 32));
491 tmp = mvs_cr32(mvi, 0x40 + (slot_idx >> 3));
492 }
while (tmp & 1 << (slot_idx % 32));
510 static void mvs_64xx_free_reg_set(
struct mvs_info *mvi,
u8 *tfs)
535 static u8 mvs_64xx_assign_reg_set(
struct mvs_info *mvi,
u8 *tfs)
546 for (i = 0; i < mvi->
chip->srs_sz; i++) {
578 static int mvs_64xx_oob_done(
struct mvs_info *mvi,
int i)
581 mvs_write_port_cfg_addr(mvi, i,
583 phy_st = mvs_read_port_cfg_data(mvi, i);
589 static void mvs_64xx_fix_phy_info(
struct mvs_info *mvi,
int i,
590 struct sas_identify_frame *
id)
608 phy->
dev_info = mvs_read_port_cfg_data(mvi, i);
615 (
u64) mvs_read_port_cfg_data(mvi, i) << 32;
621 static void mvs_64xx_phy_work_around(
struct mvs_info *mvi,
int i)
626 tmp = mvs_read_port_vsr_data(mvi, i);
633 mvs_write_port_vsr_data(mvi, i, tmp);
639 u32 lrmin = 0, lrmax = 0;
642 tmp = mvs_read_phy_ctl(mvi, phy_id);
654 mvs_write_phy_ctl(mvi, phy_id, tmp);
658 static void mvs_64xx_clear_active_cmds(
struct mvs_info *mvi)
694 dwTmp = ((
u32)cmd << 24) | ((
u32)length << 19);
700 dwTmp |= (addr & 0x0003FFFF);
713 for (retry = 0; retry < 1; retry++) {
728 for (i = 0; i < timeout; i++) {
739 int buf_len,
int from,
void *prd)
770 tmp = 0x10000 |
time;
783 mvs_64xx_interrupt_enable,
784 mvs_64xx_interrupt_disable,
787 mvs_read_port_cfg_data,
788 mvs_write_port_cfg_data,
789 mvs_write_port_cfg_addr,
790 mvs_read_port_vsr_data,
791 mvs_write_port_vsr_data,
792 mvs_write_port_vsr_addr,
793 mvs_read_port_irq_stat,
794 mvs_write_port_irq_stat,
795 mvs_read_port_irq_mask,
796 mvs_write_port_irq_mask,
797 mvs_64xx_command_active,
803 mvs_64xx_assign_reg_set,
804 mvs_64xx_free_reg_set,
808 mvs_64xx_detect_porttype,
810 mvs_64xx_fix_phy_info,
811 mvs_64xx_phy_work_around,
813 mvs_hw_max_link_rate,
814 mvs_64xx_phy_disable,
818 mvs_64xx_clear_active_cmds,
825 mvs_64xx_tune_interrupt,