hisi_sas: add v2 phy init code
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
806bb768a2
commit
29a2042863
1 changed files with 49 additions and 0 deletions
|
@ -288,6 +288,15 @@ static u32 hisi_sas_phy_read32(struct hisi_hba *hisi_hba,
|
||||||
return readl(regs);
|
return readl(regs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void config_phy_opt_mode_v2_hw(struct hisi_hba *hisi_hba, int phy_no)
|
||||||
|
{
|
||||||
|
u32 cfg = hisi_sas_phy_read32(hisi_hba, phy_no, PHY_CFG);
|
||||||
|
|
||||||
|
cfg &= ~PHY_CFG_DC_OPT_MSK;
|
||||||
|
cfg |= 1 << PHY_CFG_DC_OPT_OFF;
|
||||||
|
hisi_sas_phy_write32(hisi_hba, phy_no, PHY_CFG, cfg);
|
||||||
|
}
|
||||||
|
|
||||||
static void config_id_frame_v2_hw(struct hisi_hba *hisi_hba, int phy_no)
|
static void config_id_frame_v2_hw(struct hisi_hba *hisi_hba, int phy_no)
|
||||||
{
|
{
|
||||||
struct sas_identify_frame identify_frame;
|
struct sas_identify_frame identify_frame;
|
||||||
|
@ -563,6 +572,44 @@ static int hw_init_v2_hw(struct hisi_hba *hisi_hba)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void enable_phy_v2_hw(struct hisi_hba *hisi_hba, int phy_no)
|
||||||
|
{
|
||||||
|
u32 cfg = hisi_sas_phy_read32(hisi_hba, phy_no, PHY_CFG);
|
||||||
|
|
||||||
|
cfg |= PHY_CFG_ENA_MSK;
|
||||||
|
hisi_sas_phy_write32(hisi_hba, phy_no, PHY_CFG, cfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void start_phy_v2_hw(struct hisi_hba *hisi_hba, int phy_no)
|
||||||
|
{
|
||||||
|
config_id_frame_v2_hw(hisi_hba, phy_no);
|
||||||
|
config_phy_opt_mode_v2_hw(hisi_hba, phy_no);
|
||||||
|
enable_phy_v2_hw(hisi_hba, phy_no);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void start_phys_v2_hw(unsigned long data)
|
||||||
|
{
|
||||||
|
struct hisi_hba *hisi_hba = (struct hisi_hba *)data;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < hisi_hba->n_phy; i++)
|
||||||
|
start_phy_v2_hw(hisi_hba, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void phys_init_v2_hw(struct hisi_hba *hisi_hba)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
struct timer_list *timer = &hisi_hba->timer;
|
||||||
|
|
||||||
|
for (i = 0; i < hisi_hba->n_phy; i++) {
|
||||||
|
hisi_sas_phy_write32(hisi_hba, i, CHL_INT2_MSK, 0x6a);
|
||||||
|
hisi_sas_phy_read32(hisi_hba, i, CHL_INT2_MSK);
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_timer(timer, start_phys_v2_hw, (unsigned long)hisi_hba);
|
||||||
|
mod_timer(timer, jiffies + HZ);
|
||||||
|
}
|
||||||
|
|
||||||
static int hisi_sas_v2_init(struct hisi_hba *hisi_hba)
|
static int hisi_sas_v2_init(struct hisi_hba *hisi_hba)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -571,6 +618,8 @@ static int hisi_sas_v2_init(struct hisi_hba *hisi_hba)
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
phys_init_v2_hw(hisi_hba);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue