hisi_sas: Misc patches
Subsystems (2)
cover hisi_sas: Misc patches
This series contains some minor feature updates and general tidying:
- Some new BIST features
- Stop modifying previously unused fields in programmable link rate reg
- Stop accessing some SSP task fields for SMP tasks
- General minor tidying
Thanks!
Luo Jiaxing (6):
scsi: hisi_sas: Modify macro name for OOB phy linkrate
scsi: hisi_sas: Do not modify upper fields of PROG_PHY_LINK_RATE reg
scsi: hisi_sas: Make phy index variable name consistent
scsi: hisi_sas: Add BIST support for phy FFE
scsi: hisi_sas: Add BIST support for fixed code pattern
scsi: hisi_sas: Some very minor tidying
Xiang Chen (2):
scsi: hisi_sas: Avoid accessing to SSP task for SMP IOs
scsi: hisi_sas: Add carriage returns to some prints
drivers/scsi/hisi_sas/hisi_sas.h | 35 ++++++ drivers/scsi/hisi_sas/hisi_sas_main.c | 113 +++++++++++++++---- drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 24 ++-- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 4 +- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 146 +++++++++++++++---------- 5 files changed, 229 insertions(+), 93 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/8 scsi: hisi_sas: Avoid accessing to SSP task for SMP IOs
From: Xiang Chen <[email protected]>
In function hisi_sas_slot_task_free(), it accesses to SSP task for non-ATA task. But if it is SMP task here, it accesses to wrong structure though it may not cause any issue.
To avoid it, only access to ssp task when slot->n_elem_dif is not 0 which indicates this is SSP task.
--- drivers/scsi/hisi_sas/hisi_sas_main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_main.c +5 -4
@@ -229,17 +229,18 @@ void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba, struct sas_task *task, task->lldd_task =NULL ;if (!sas_protocol_ata (task->task_proto)) { -struct sas_ssp_task *ssp_task = &task->ssp_task; -struct scsi_cmnd *scsi_cmnd = ssp_task->cmd; -if (slot->n_elem)dma_unmap_sg (dev, task->scatter, task->num_scatter, task->data_dir); -if (slot->n_elem_dif) +if (slot->n_elem_dif) { +struct sas_ssp_task *ssp_task = &task->ssp_task; +struct scsi_cmnd *scsi_cmnd = ssp_task->cmd; +dma_unmap_sg (dev,scsi_prot_sglist (scsi_cmnd),scsi_prot_sg_count (scsi_cmnd), task->data_dir); + } } }
Signature · 1 line
2.26.2
PATCH 2/8 scsi: hisi_sas: Modify macro name for OOB phy linkrate
In reply to John GarryFrom: Luo Jiaxing <[email protected]>
The macro for OOB phy linkrate is named as CFG_PROG_PHY_LINK_RATE_*, but it's not correct. To avoid some misunderstand, we modify it to a correct naming.
--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +7 -8
@@ -191,8 +191,8 @@#define PHY_CFG_PHY_RST_OFF 3#define PHY_CFG_PHY_RST_MSK (0x1 << PHY_CFG_PHY_RST_OFF)#define PROG_PHY_LINK_RATE (PORT_BASE + 0x8) -#define CFG_PROG_PHY_LINK_RATE_OFF 8 -#define CFG_PROG_PHY_LINK_RATE_MSK (0xf << CFG_PROG_PHY_LINK_RATE_OFF) +#define CFG_PROG_OOB_PHY_LINK_RATE_OFF 8 +#define CFG_PROG_OOB_PHY_LINK_RATE_MSK (0xf << CFG_PROG_OOB_PHY_LINK_RATE_OFF)#define PHY_CTRL (PORT_BASE + 0x14)#define PHY_CTRL_RESET_OFF 0#define PHY_CTRL_RESET_MSK (0x1 << PHY_CTRL_RESET_OFF)
@@ -2998,8 +2998,8 @@ static void hisi_sas_bist_test_restore_v3_hw(struct hisi_hba *hisi_hba)/* restore the linkrate */ reg_val =hisi_sas_phy_read32 (hisi_hba, phy_id,PROG_PHY_LINK_RATE );/* init OOB link rate as 1.5 Gbits */ - reg_val &= ~CFG_PROG_PHY_LINK_RATE_MSK ; - reg_val |= (0x8 <<CFG_PROG_PHY_LINK_RATE_OFF ); + reg_val &= ~CFG_PROG_OOB_PHY_LINK_RATE_MSK ; + reg_val |= (0x8 <<CFG_PROG_OOB_PHY_LINK_RATE_OFF );hisi_sas_phy_write32 (hisi_hba, phy_id,PROG_PHY_LINK_RATE , reg_val);/* enable PHY */
@@ -3027,8 +3027,8 @@ static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable)/* set linkrate of bit test*/ reg_val =hisi_sas_phy_read32 (hisi_hba, phy_id,PROG_PHY_LINK_RATE ); - reg_val &= ~CFG_PROG_PHY_LINK_RATE_MSK ; - reg_val |= (linkrate <<CFG_PROG_PHY_LINK_RATE_OFF ); + reg_val &= ~CFG_PROG_OOB_PHY_LINK_RATE_MSK ; + reg_val |= (linkrate <<CFG_PROG_OOB_PHY_LINK_RATE_OFF );hisi_sas_phy_write32 (hisi_hba, phy_id,PROG_PHY_LINK_RATE , reg_val);
@@ -3050,8 +3050,7 @@ static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable)hisi_sas_phy_write32 (hisi_hba, phy_id,SAS_PHY_BIST_CODE ,SAS_PHY_BIST_CODE_INIT ); -hisi_sas_phy_write32 (hisi_hba, phy_id, -SAS_PHY_BIST_CODE1 , +hisi_sas_phy_write32 (hisi_hba, phy_id,SAS_PHY_BIST_CODE1 ,SAS_PHY_BIST_CODE1_INIT );mdelay (100 );
Signature · 1 line
2.26.2
PATCH 3/8 scsi: hisi_sas: Do not modify upper fields of PROG_PHY_LINK_RATE reg
In reply to John GarryFrom: Luo Jiaxing <[email protected]>
When we update register of PROG_PHY_LINK_RATE to set linkrate for a phy, we used a hard-coded initial value instead of getting the current value from register. We had assumed that this register would not be modified, but in fact it was partially modified in new version of hardware. So hard-coded value we used change default value of register to a wrong setting and make SAS controller can not change linkrate for phy at new version of hardware.
So we delete hard-coded value and always read the latest value of register before we update part of it.
--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +14 -11
@@ -191,6 +191,8 @@#define PHY_CFG_PHY_RST_OFF 3#define PHY_CFG_PHY_RST_MSK (0x1 << PHY_CFG_PHY_RST_OFF)#define PROG_PHY_LINK_RATE (PORT_BASE + 0x8) +#define CFG_PROG_PHY_LINK_RATE_OFF 0 +#define CFG_PROG_PHY_LINK_RATE_MSK (0xff << CFG_PROG_PHY_LINK_RATE_OFF)#define CFG_PROG_OOB_PHY_LINK_RATE_OFF 8#define CFG_PROG_OOB_PHY_LINK_RATE_MSK (0xf << CFG_PROG_OOB_PHY_LINK_RATE_OFF)#define PHY_CTRL (PORT_BASE + 0x14)
@@ -598,20 +600,19 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba)hisi_sas_write32 (hisi_hba,HYPER_STREAM_ID_EN_CFG ,1 );for (i =0 ; i < hisi_hba->n_phy; i++) { +enum sas_linkrate max;struct hisi_sas_phy *phy = &hisi_hba->phy[i];struct asd_sas_phy *sas_phy = &phy->sas_phy; -u32 prog_phy_link_rate =0x800 ; +u32 prog_phy_link_rate =hisi_sas_phy_read32 (hisi_hba, i, +PROG_PHY_LINK_RATE ); + prog_phy_link_rate &= ~CFG_PROG_PHY_LINK_RATE_MSK ;if (!sas_phy->phy || (sas_phy->phy->maximum_linkrate < -SAS_LINK_RATE_1_5_GBPS )) { - prog_phy_link_rate =0x855 ; - }else { -enum sas_linkrate max = sas_phy->phy->maximum_linkrate; - - prog_phy_link_rate = -hisi_sas_get_prog_phy_linkrate_mask (max) | -0x800 ; - } +SAS_LINK_RATE_1_5_GBPS )) + max =SAS_LINK_RATE_12_0_GBPS ; +else + max = sas_phy->phy->maximum_linkrate; + prog_phy_link_rate |=hisi_sas_get_prog_phy_linkrate_mask (max);hisi_sas_phy_write32 (hisi_hba, i,PROG_PHY_LINK_RATE , prog_phy_link_rate);hisi_sas_phy_write32 (hisi_hba, i,SERDES_CFG ,0xffc00 );
@@ -2501,8 +2502,10 @@ static void phy_set_linkrate_v3_hw(struct hisi_hba *hisi_hba, int phy_no, struct sas_phy_linkrates *r) {enum sas_linkrate max = r->maximum_linkrate; -u32 prog_phy_link_rate =0x800 ; +u32 prog_phy_link_rate =hisi_sas_phy_read32 (hisi_hba, phy_no, +PROG_PHY_LINK_RATE ); + prog_phy_link_rate &= ~CFG_PROG_PHY_LINK_RATE_MSK ; prog_phy_link_rate |=hisi_sas_get_prog_phy_linkrate_mask (max);hisi_sas_phy_write32 (hisi_hba, phy_no,PROG_PHY_LINK_RATE , prog_phy_link_rate);
Signature · 1 line
2.26.2
PATCH 4/8 scsi: hisi_sas: Make phy index variable name consistent
In reply to John GarryFrom: Luo Jiaxing <[email protected]>
We use "phy_id" to identify phy in the BIST code, but the rest of code always use "phy_no". So we change it for consistent coding style.
--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 50 +++++++++++++------------- 1 file changed, 25 insertions(+), 25 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +25 -25
@@ -2971,42 +2971,42 @@ static void read_iost_itct_cache_v3_hw(struct hisi_hba *hisi_hba,static void hisi_sas_bist_test_prep_v3_hw (struct hisi_hba *hisi_hba) {u32 reg_val; -int phy_id = hisi_hba->debugfs_bist_phy_no; +int phy_no = hisi_hba->debugfs_bist_phy_no;/* disable PHY */ -hisi_sas_phy_enable (hisi_hba, phy_id,0 ); +hisi_sas_phy_enable (hisi_hba, phy_no,0 );/* disable ALOS */ - reg_val =hisi_sas_phy_read32 (hisi_hba, phy_id,SERDES_CFG ); + reg_val =hisi_sas_phy_read32 (hisi_hba, phy_no,SERDES_CFG ); reg_val |=CFG_ALOS_CHK_DISABLE_MSK ; -hisi_sas_phy_write32 (hisi_hba, phy_id,SERDES_CFG , reg_val); +hisi_sas_phy_write32 (hisi_hba, phy_no,SERDES_CFG , reg_val); }static void hisi_sas_bist_test_restore_v3_hw (struct hisi_hba *hisi_hba) {u32 reg_val; -int phy_id = hisi_hba->debugfs_bist_phy_no; +int phy_no = hisi_hba->debugfs_bist_phy_no;/* disable loopback */ - reg_val =hisi_sas_phy_read32 (hisi_hba, phy_id,SAS_PHY_BIST_CTRL ); + reg_val =hisi_sas_phy_read32 (hisi_hba, phy_no,SAS_PHY_BIST_CTRL ); reg_val &= ~(CFG_RX_BIST_EN_MSK |CFG_TX_BIST_EN_MSK |CFG_BIST_TEST_MSK ); -hisi_sas_phy_write32 (hisi_hba, phy_id,SAS_PHY_BIST_CTRL , reg_val); +hisi_sas_phy_write32 (hisi_hba, phy_no,SAS_PHY_BIST_CTRL , reg_val);/* enable ALOS */ - reg_val =hisi_sas_phy_read32 (hisi_hba, phy_id,SERDES_CFG ); + reg_val =hisi_sas_phy_read32 (hisi_hba, phy_no,SERDES_CFG ); reg_val &= ~CFG_ALOS_CHK_DISABLE_MSK ; -hisi_sas_phy_write32 (hisi_hba, phy_id,SERDES_CFG , reg_val); +hisi_sas_phy_write32 (hisi_hba, phy_no,SERDES_CFG , reg_val);/* restore the linkrate */ - reg_val =hisi_sas_phy_read32 (hisi_hba, phy_id,PROG_PHY_LINK_RATE ); + reg_val =hisi_sas_phy_read32 (hisi_hba, phy_no,PROG_PHY_LINK_RATE );/* init OOB link rate as 1.5 Gbits */ reg_val &= ~CFG_PROG_OOB_PHY_LINK_RATE_MSK ; reg_val |= (0x8 <<CFG_PROG_OOB_PHY_LINK_RATE_OFF ); -hisi_sas_phy_write32 (hisi_hba, phy_id,PROG_PHY_LINK_RATE , reg_val); +hisi_sas_phy_write32 (hisi_hba, phy_no,PROG_PHY_LINK_RATE , reg_val);/* enable PHY */ -hisi_sas_phy_enable (hisi_hba, phy_id,1 ); +hisi_sas_phy_enable (hisi_hba, phy_no,1 ); }#define SAS_PHY_BIST_CODE_INIT 0x1
@@ -3015,28 +3015,28 @@ static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable) {u32 reg_val, mode_tmp;u32 linkrate = hisi_hba->debugfs_bist_linkrate; -u32 phy_id = hisi_hba->debugfs_bist_phy_no; +u32 phy_no = hisi_hba->debugfs_bist_phy_no;u32 code_mode = hisi_hba->debugfs_bist_code_mode;u32 path_mode = hisi_hba->debugfs_bist_mode;struct device *dev = hisi_hba->dev; -dev_info (dev,"BIST info:linkrate=%d phy_id=%d code_mode=%d path_mode=%d\n" , - linkrate, phy_id, code_mode, path_mode); +dev_info (dev,"BIST info:linkrate=%d phy_no=%d code_mode=%d path_mode=%d\n" , + linkrate, phy_no, code_mode, path_mode); mode_tmp = path_mode ?2 :1 ;if (enable) {/* some preparations before bist test */ hisi_sas_bist_test_prep_v3_hw (hisi_hba);/* set linkrate of bit test*/ - reg_val =hisi_sas_phy_read32 (hisi_hba, phy_id, + reg_val =hisi_sas_phy_read32 (hisi_hba, phy_no,PROG_PHY_LINK_RATE ); reg_val &= ~CFG_PROG_OOB_PHY_LINK_RATE_MSK ; reg_val |= (linkrate <<CFG_PROG_OOB_PHY_LINK_RATE_OFF ); -hisi_sas_phy_write32 (hisi_hba, phy_id, -PROG_PHY_LINK_RATE , reg_val); +hisi_sas_phy_write32 (hisi_hba, phy_no,PROG_PHY_LINK_RATE , + reg_val);/* set code mode of bit test */ - reg_val =hisi_sas_phy_read32 (hisi_hba, phy_id, + reg_val =hisi_sas_phy_read32 (hisi_hba, phy_no,SAS_PHY_BIST_CTRL ); reg_val &= ~(CFG_BIST_MODE_SEL_MSK | CFG_LOOP_TEST_MODE_MSK |
@@ -3046,28 +3046,28 @@ static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable) reg_val |= ((code_mode <<CFG_BIST_MODE_SEL_OFF ) | (mode_tmp <<CFG_LOOP_TEST_MODE_OFF ) |CFG_BIST_TEST_MSK ); -hisi_sas_phy_write32 (hisi_hba, phy_id, +hisi_sas_phy_write32 (hisi_hba, phy_no,SAS_PHY_BIST_CTRL , reg_val);/* set the bist init value */ -hisi_sas_phy_write32 (hisi_hba, phy_id, +hisi_sas_phy_write32 (hisi_hba, phy_no,SAS_PHY_BIST_CODE ,SAS_PHY_BIST_CODE_INIT ); -hisi_sas_phy_write32 (hisi_hba, phy_id,SAS_PHY_BIST_CODE1 , +hisi_sas_phy_write32 (hisi_hba, phy_no,SAS_PHY_BIST_CODE1 ,SAS_PHY_BIST_CODE1_INIT );mdelay (100 ); reg_val |= (CFG_RX_BIST_EN_MSK |CFG_TX_BIST_EN_MSK ); -hisi_sas_phy_write32 (hisi_hba, phy_id, +hisi_sas_phy_write32 (hisi_hba, phy_no,SAS_PHY_BIST_CTRL , reg_val);/* clear error bit */ mdelay (100 ); -hisi_sas_phy_read32 (hisi_hba, phy_id,SAS_BIST_ERR_CNT ); +hisi_sas_phy_read32 (hisi_hba, phy_no,SAS_BIST_ERR_CNT ); }else {/* disable bist test and recover it */ hisi_hba->debugfs_bist_cnt +=hisi_sas_phy_read32 (hisi_hba, - phy_id,SAS_BIST_ERR_CNT ); + phy_no,SAS_BIST_ERR_CNT );hisi_sas_bist_test_restore_v3_hw (hisi_hba); }
Signature · 1 line
2.26.2
PATCH 5/8 scsi: hisi_sas: Add BIST support for phy FFE
In reply to John GarryFrom: Luo Jiaxing <[email protected]>
Add BIST support for phy FFE(Feed forward equalizer) setting.
Through the new debugfs interface, the user can configure FFE if they want.
FFE are a kind of parameter which used for link layer of board. They will affect the link quality between the SAS controller and the backplane. In the BIST test, FFE parameter interface is provided to assist board tester in optimizing link parameters.
The modification of the FFE parameter will affect the test after BIST or the normal running of the board, so user should save FFE's initial value before modify it, and restore them after BIST test if necessary.
--- drivers/scsi/hisi_sas/hisi_sas.h | 13 +++++ drivers/scsi/hisi_sas/hisi_sas_main.c | 76 ++++++++++++++++++++++++++ drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 25 ++++++++- 3 files changed, 111 insertions(+), 3 deletions(-)
drivers/scsi/hisi_sas/hisi_sas.h +13 -0
@@ -273,6 +273,18 @@ enum hisi_sas_debugfs_cache_type { HISI_SAS_IOST_CACHE, }; +enum hisi_sas_debugfs_bist_ffe_cfg { +FFE_SAS_1_5_GBPS , +FFE_SAS_3_0_GBPS , +FFE_SAS_6_0_GBPS , +FFE_SAS_12_0_GBPS , +FFE_RESV , +FFE_SATA_1_5_GBPS , +FFE_SATA_3_0_GBPS , +FFE_SATA_6_0_GBPS , +FFE_CFG_MAX +}; +struct hisi_sas_hw {int (*hw_init)(struct hisi_hba *hisi_hba); void (*setup_itct)(struct hisi_hba *hisi_hba,
@@ -440,6 +452,7 @@ struct hisi_hba {int debugfs_bist_mode;u32 debugfs_bist_cnt;int debugfs_bist_enable; +u32 debugfs_bist_ffe[HISI_SAS_MAX_PHYS ][FFE_CFG_MAX ];/* debugfs memories */ /* Put Global AXI and RAS Register into register array */
drivers/scsi/hisi_sas/hisi_sas_main.c +76 -0
94 lines not on this page · raw message
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +22 -3
@@ -297,6 +297,7 @@#define DMA_RX_STATUS_BUSY_MSK (0x1 << DMA_RX_STATUS_BUSY_OFF)#define COARSETUNE_TIME (PORT_BASE + 0x304) +#define TXDEEMPH_G1 (PORT_BASE + 0x350)#define ERR_CNT_DWS_LOST (PORT_BASE + 0x380)#define ERR_CNT_RESET_PROB (PORT_BASE + 0x384)#define ERR_CNT_INVLD_DW (PORT_BASE + 0x390)
@@ -567,7 +568,7 @@ static u32 hisi_sas_phy_read32(struct hisi_hba *hisi_hba,static void init_reg_v3_hw (struct hisi_hba *hisi_hba) { -int i; +int i, j;/* Global registers init */ hisi_sas_write32(hisi_hba, DLVRY_QUEUE_ENABLE,
@@ -637,6 +638,13 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba)/* used for 12G negotiate */ hisi_sas_phy_write32 (hisi_hba, i,COARSETUNE_TIME ,0x1e );hisi_sas_phy_write32 (hisi_hba, i,AIP_LIMIT ,0x2ffff ); + +/* get default FFE configuration for BIST */ +for (j =0 ; j <FFE_CFG_MAX ; j++) { +u32 val =hisi_sas_phy_read32 (hisi_hba, i, +TXDEEMPH_G1 + (j *0x4 )); + hisi_hba->debugfs_bist_ffe[i][j] = val; + } }for (i =0 ; i < hisi_hba->queue_count; i++) {
@@ -2972,10 +2980,16 @@ static void hisi_sas_bist_test_prep_v3_hw(struct hisi_hba *hisi_hba) {u32 reg_val;int phy_no = hisi_hba->debugfs_bist_phy_no; +int i;/* disable PHY */ hisi_sas_phy_enable (hisi_hba, phy_no,0 ); +/* update FFE */ +for (i =0 ; i <FFE_CFG_MAX ; i++) +hisi_sas_phy_write32 (hisi_hba, phy_no,TXDEEMPH_G1 + (i *0x4 ), + hisi_hba->debugfs_bist_ffe[phy_no][i]); +/* disable ALOS */ reg_val =hisi_sas_phy_read32 (hisi_hba, phy_no,SERDES_CFG ); reg_val |=CFG_ALOS_CHK_DISABLE_MSK ;
@@ -3016,12 +3030,17 @@ static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable)u32 reg_val, mode_tmp;u32 linkrate = hisi_hba->debugfs_bist_linkrate;u32 phy_no = hisi_hba->debugfs_bist_phy_no; +u32 *ffe = hisi_hba->debugfs_bist_ffe[phy_no];u32 code_mode = hisi_hba->debugfs_bist_code_mode;u32 path_mode = hisi_hba->debugfs_bist_mode;struct device *dev = hisi_hba->dev; -dev_info (dev,"BIST info:linkrate=%d phy_no=%d code_mode=%d path_mode=%d\n" , - linkrate, phy_no, code_mode, path_mode); +dev_info (dev,"BIST info:phy%d link_rate=%d code_mode=%d path_mode=%d ffe={0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x}\n" , + phy_no, linkrate, code_mode, path_mode, + ffe[FFE_SAS_1_5_GBPS ], ffe[FFE_SAS_3_0_GBPS ], + ffe[FFE_SAS_6_0_GBPS ], ffe[FFE_SAS_12_0_GBPS ], + ffe[FFE_SATA_1_5_GBPS ], ffe[FFE_SATA_3_0_GBPS ], + ffe[FFE_SATA_6_0_GBPS ]); mode_tmp = path_mode ?2 :1 ;if (enable) {/* some preparations before bist test */
Signature · 1 line
2.26.2
PATCH 6/8 scsi: hisi_sas: Add BIST support for fixed code pattern
In reply to John GarryFrom: Luo Jiaxing <[email protected]>
Add BIST support for fixed code pattern.
Through the new debugfs interface, the user can select fixed code pattern if they want. We added two new interfaces fixed_code and fixed_code1 to configure fixed code pattern.
--- drivers/scsi/hisi_sas/hisi_sas.h | 22 +++++++++++++ drivers/scsi/hisi_sas/hisi_sas_main.c | 25 ++++++--------- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 43 ++++++++++++++++---------- 3 files changed, 59 insertions(+), 31 deletions(-)
drivers/scsi/hisi_sas/hisi_sas.h +22 -0
@@ -285,6 +285,27 @@ enum hisi_sas_debugfs_bist_ffe_cfg {FFE_CFG_MAX }; +enum hisi_sas_debugfs_bist_fixed_code { +FIXED_CODE , +FIXED_CODE_1 , +FIXED_CODE_MAX +}; + +enum { +HISI_SAS_BIST_CODE_MODE_PRBS7 , +HISI_SAS_BIST_CODE_MODE_PRBS23 , +HISI_SAS_BIST_CODE_MODE_PRBS31 , +HISI_SAS_BIST_CODE_MODE_JTPAT , +HISI_SAS_BIST_CODE_MODE_CJTPAT , +HISI_SAS_BIST_CODE_MODE_SCRAMBED_0 , +HISI_SAS_BIST_CODE_MODE_TRAIN , +HISI_SAS_BIST_CODE_MODE_TRAIN_DONE , +HISI_SAS_BIST_CODE_MODE_HFTP , +HISI_SAS_BIST_CODE_MODE_MFTP , +HISI_SAS_BIST_CODE_MODE_LFTP , +HISI_SAS_BIST_CODE_MODE_FIXED_DATA , +}; +struct hisi_sas_hw {int (*hw_init)(struct hisi_hba *hisi_hba); void (*setup_itct)(struct hisi_hba *hisi_hba,
@@ -453,6 +474,7 @@ struct hisi_hba {u32 debugfs_bist_cnt;int debugfs_bist_enable;u32 debugfs_bist_ffe[HISI_SAS_MAX_PHYS ][FFE_CFG_MAX ]; +u32 debugfs_bist_fixed_code[FIXED_CODE_MAX ];/* debugfs memories */ /* Put Global AXI and RAS Register into register array */
drivers/scsi/hisi_sas/hisi_sas_main.c +10 -15
@@ -3334,21 +3334,6 @@ enum { HISI_SAS_BIST_LOOPBACK_MODE_REMOTE, }; -enum { -HISI_SAS_BIST_CODE_MODE_PRBS7 =0 , -HISI_SAS_BIST_CODE_MODE_PRBS23 , -HISI_SAS_BIST_CODE_MODE_PRBS31 , -HISI_SAS_BIST_CODE_MODE_JTPAT , -HISI_SAS_BIST_CODE_MODE_CJTPAT , -HISI_SAS_BIST_CODE_MODE_SCRAMBED_0 , -HISI_SAS_BIST_CODE_MODE_TRAIN , -HISI_SAS_BIST_CODE_MODE_TRAIN_DONE , -HISI_SAS_BIST_CODE_MODE_HFTP , -HISI_SAS_BIST_CODE_MODE_MFTP , -HISI_SAS_BIST_CODE_MODE_LFTP , -HISI_SAS_BIST_CODE_MODE_FIXED_DATA , -}; - static const struct { int value; char *name;
@@ -3966,6 +3951,16 @@ static void hisi_sas_debugfs_bist_init(struct hisi_hba *hisi_hba) hisi_hba->debugfs_bist_dentry, hisi_hba, &hisi_sas_debugfs_bist_code_mode_ops); +debugfs_create_file ("fixed_code" ,0600 , + hisi_hba->debugfs_bist_dentry, + &hisi_hba->debugfs_bist_fixed_code[0 ], + &hisi_sas_debugfs_ops); + +debugfs_create_file ("fixed_code_1" ,0600 , + hisi_hba->debugfs_bist_dentry, + &hisi_hba->debugfs_bist_fixed_code[1 ], + &hisi_sas_debugfs_ops); +debugfs_create_file ("phy_id" ,0600 , hisi_hba->debugfs_bist_dentry, hisi_hba, &hisi_sas_debugfs_bist_phy_ops);
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +27 -16
69 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 7/8 scsi: hisi_sas: Add carriage returns to some prints
In reply to John GarryFrom: Xiang Chen <[email protected]>
There is no carriage return for some prints, so add carriage returns for them.
--- drivers/scsi/hisi_sas/hisi_sas_main.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 24 ++++++++++++------------ drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_main.c +1 -1
@@ -335,7 +335,7 @@ static int hisi_sas_dma_map(struct hisi_hba *hisi_hba, }if (*n_elem >HISI_SAS_SGE_PAGE_CNT ) { -dev_err (dev,"task prep: n_elem(%d) > HISI_SAS_SGE_PAGE_CNT" , +dev_err (dev,"task prep: n_elem(%d) > HISI_SAS_SGE_PAGE_CNT\n" , *n_elem); rc = -EINVAL ; goto err_out_dma_unmap;
drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +12 -12
@@ -752,7 +752,7 @@ static int hw_init_v1_hw(struct hisi_hba *hisi_hba) rc =reset_hw_v1_hw (hisi_hba);if (rc) { -dev_err (dev,"hisi_sas_reset_hw failed, rc=%d" , rc); +dev_err (dev,"hisi_sas_reset_hw failed, rc=%d\n" , rc);return rc; }
@@ -1166,7 +1166,7 @@ static void slot_err_v1_hw(struct hisi_hba *hisi_hba,case SAS_PROTOCOL_STP :case SAS_PROTOCOL_SATA |SAS_PROTOCOL_STP : { -dev_err (dev,"slot err: SATA/STP not supported" ); +dev_err (dev,"slot err: SATA/STP not supported\n" ); }break ;default :
@@ -1218,35 +1218,35 @@ static void slot_complete_v1_hw(struct hisi_hba *hisi_hba,u32 info_reg =hisi_sas_read32 (hisi_hba,HGC_INVLD_DQE_INFO );if (info_reg &HGC_INVLD_DQE_INFO_DQ_MSK ) -dev_err (dev,"slot complete: [%d:%d] has dq IPTT err" , +dev_err (dev,"slot complete: [%d:%d] has dq IPTT err\n" , slot->cmplt_queue, slot->cmplt_queue_slot);if (info_reg &HGC_INVLD_DQE_INFO_TYPE_MSK ) -dev_err (dev,"slot complete: [%d:%d] has dq type err" , +dev_err (dev,"slot complete: [%d:%d] has dq type err\n" , slot->cmplt_queue, slot->cmplt_queue_slot);if (info_reg &HGC_INVLD_DQE_INFO_FORCE_MSK ) -dev_err (dev,"slot complete: [%d:%d] has dq force phy err" , +dev_err (dev,"slot complete: [%d:%d] has dq force phy err\n" , slot->cmplt_queue, slot->cmplt_queue_slot);if (info_reg &HGC_INVLD_DQE_INFO_PHY_MSK ) -dev_err (dev,"slot complete: [%d:%d] has dq phy id err" , +dev_err (dev,"slot complete: [%d:%d] has dq phy id err\n" , slot->cmplt_queue, slot->cmplt_queue_slot);if (info_reg &HGC_INVLD_DQE_INFO_ABORT_MSK ) -dev_err (dev,"slot complete: [%d:%d] has dq abort flag err" , +dev_err (dev,"slot complete: [%d:%d] has dq abort flag err\n" , slot->cmplt_queue, slot->cmplt_queue_slot);if (info_reg &HGC_INVLD_DQE_INFO_IPTT_OF_MSK ) -dev_err (dev,"slot complete: [%d:%d] has dq IPTT or ICT err" , +dev_err (dev,"slot complete: [%d:%d] has dq IPTT or ICT err\n" , slot->cmplt_queue, slot->cmplt_queue_slot);if (info_reg &HGC_INVLD_DQE_INFO_SSP_ERR_MSK ) -dev_err (dev,"slot complete: [%d:%d] has dq SSP frame type err" , +dev_err (dev,"slot complete: [%d:%d] has dq SSP frame type err\n" , slot->cmplt_queue, slot->cmplt_queue_slot);if (info_reg &HGC_INVLD_DQE_INFO_OFL_MSK ) -dev_err (dev,"slot complete: [%d:%d] has dq order frame len err" , +dev_err (dev,"slot complete: [%d:%d] has dq order frame len err\n" , slot->cmplt_queue, slot->cmplt_queue_slot); ts->stat =SAS_OPEN_REJECT ;
@@ -1294,7 +1294,7 @@ static void slot_complete_v1_hw(struct hisi_hba *hisi_hba,case SAS_PROTOCOL_SATA :case SAS_PROTOCOL_STP :case SAS_PROTOCOL_SATA |SAS_PROTOCOL_STP : -dev_err (dev,"slot complete: SATA/STP not supported" ); +dev_err (dev,"slot complete: SATA/STP not supported\n" );break ;default :
@@ -1417,7 +1417,7 @@ static irqreturn_t int_bcast_v1_hw(int irq, void *p) irq_value =hisi_sas_phy_read32 (hisi_hba, phy_no,CHL_INT2 );if (!(irq_value &CHL_INT2_SL_RX_BC_ACK_MSK )) { -dev_err (dev,"bcast: irq_value = %x not set enable bit" , +dev_err (dev,"bcast: irq_value = %x not set enable bit\n" , irq_value); res =IRQ_NONE ; goto end;
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +1 -1
@@ -1382,7 +1382,7 @@ static int hw_init_v2_hw(struct hisi_hba *hisi_hba) rc =reset_hw_v2_hw (hisi_hba);if (rc) { -dev_err (dev,"hisi_sas_reset_hw failed, rc=%d" , rc); +dev_err (dev,"hisi_sas_reset_hw failed, rc=%d\n" , rc);return rc; }
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +1 -1
@@ -909,7 +909,7 @@ static int hw_init_v3_hw(struct hisi_hba *hisi_hba) rc =reset_hw_v3_hw (hisi_hba);if (rc) { -dev_err (dev,"hisi_sas_reset_hw failed, rc=%d" , rc); +dev_err (dev,"hisi_sas_reset_hw failed, rc=%d\n" , rc);return rc; }
Signature · 1 line
2.26.2
PATCH 8/8 scsi: hisi_sas: Some very minor tidying
In reply to John GarryFrom: Luo Jiaxing <[email protected]>
We found an extra blank line at the end of some functions, so delete them.
And add spaces around some operators.
--- drivers/scsi/hisi_sas/hisi_sas_main.c | 1 - drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 4 +--- 3 files changed, 2 insertions(+), 5 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_main.c +0 -1
@@ -1430,7 +1430,6 @@ static void hisi_sas_rescan_topology(struct hisi_hba *hisi_hba, u32 state) }else {hisi_sas_phy_down (hisi_hba, phy_no,0 ); } - } }
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +1 -1
@@ -1202,7 +1202,7 @@ static void init_reg_v2_hw(struct hisi_hba *hisi_hba)hisi_sas_write32 (hisi_hba,ENT_INT_SRC_MSK3 ,0x7ffe20fe );hisi_sas_write32 (hisi_hba,SAS_ECC_INTR_MSK ,0xfff00c30 );for (i =0 ; i < hisi_hba->queue_count; i++) -hisi_sas_write32 (hisi_hba,OQ0_INT_SRC_MSK +0x4 *i,0 ); +hisi_sas_write32 (hisi_hba,OQ0_INT_SRC_MSK +0x4 * i,0 );hisi_sas_write32 (hisi_hba,AXI_AHB_CLK_CFG ,1 );hisi_sas_write32 (hisi_hba,HYPER_STREAM_ID_EN_CFG ,1 );
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +1 -3
@@ -596,7 +596,7 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba)hisi_sas_write32 (hisi_hba,AWQOS_AWCACHE_CFG ,0xf0f0 );hisi_sas_write32 (hisi_hba,ARQOS_ARCACHE_CFG ,0xf0f0 );for (i =0 ; i < hisi_hba->queue_count; i++) -hisi_sas_write32 (hisi_hba,OQ0_INT_SRC_MSK +0x4 *i,0 ); +hisi_sas_write32 (hisi_hba,OQ0_INT_SRC_MSK +0x4 * i,0 );hisi_sas_write32 (hisi_hba,HYPER_STREAM_ID_EN_CFG ,1 );
@@ -1350,7 +1350,6 @@ static void prep_smp_v3_hw(struct hisi_hba *hisi_hba, hdr->cmd_table_addr =cpu_to_le64 (req_dma_addr); hdr->sts_buffer_addr =cpu_to_le64 (hisi_sas_status_buf_addr_dma (slot)); - } static void prep_ata_v3_hw(struct hisi_hba *hisi_hba,
@@ -1456,7 +1455,6 @@ static void prep_abort_v3_hw(struct hisi_hba *hisi_hba,/* dw7 */ hdr->dw7 =cpu_to_le32 (tag_to_abort <<CMD_HDR_ABORT_IPTT_OFF ); hdr->transfer_tags =cpu_to_le32 (slot->idx); - }static irqreturn_t phy_up_v3_hw (int phy_no,struct hisi_hba *hisi_hba)
Signature · 1 line
2.26.2
Martin K. Petersen
AppliedQuoted 9 lines · John Garry
This series contains some minor feature updates and general tidying:
- Some new BIST features
- Stop modifying previously unused fields in programmable link rate reg
- Stop accessing some SSP task fields for SMP tasks
- General minor tidyingThanks!
[...]
Applied to 5.10/scsi-queue, thanks!
[1/8] scsi: hisi_sas: Avoid accessing to SSP task for SMP I/Os
https://git.kernel.org/mkp/scsi/c/847e83552945 [2/8] scsi: hisi_sas: Modify macro name for OOB phy linkrate https://git.kernel.org/mkp/scsi/c/4b3a1f1feda6 [3/8] scsi: hisi_sas: Do not modify upper fields of PROG_PHY_LINK_RATE reg https://git.kernel.org/mkp/scsi/c/caeddc0453b9 [4/8] scsi: hisi_sas: Make phy index variable name consistent https://git.kernel.org/mkp/scsi/c/ca06f2cd01d0 [5/8] scsi: hisi_sas: Add BIST support for phy FFE https://git.kernel.org/mkp/scsi/c/2c4d582322ff [6/8] scsi: hisi_sas: Add BIST support for fixed code pattern https://git.kernel.org/mkp/scsi/c/981cc23e741a [7/8] scsi: hisi_sas: Add missing newlines https://git.kernel.org/mkp/scsi/c/b601577df68a [8/8] scsi: hisi_sas: Code style cleanup https://git.kernel.org/mkp/scsi/c/26f84f9bc3ba
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering