Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1304601
| From | John Garry <john.garry@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 11/23] hisi_sas: add v2 phy init code |
| Date | 2016-01-08 15:20 +0100 |
| Message-ID | <qOG3x-7SE-31@gated-at.bofh.it> (permalink) |
| References | <qOFTQ-7OQ-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Signed-off-by: John Garry <john.garry@huawei.com>
---
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 49 ++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index 6ab0503..325b287 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -288,6 +288,15 @@ static u32 hisi_sas_phy_read32(struct hisi_hba *hisi_hba,
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)
{
struct sas_identify_frame identify_frame;
@@ -562,6 +571,44 @@ static int hw_init_v2_hw(struct hisi_hba *hisi_hba)
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)
{
int rc;
@@ -570,6 +617,8 @@ static int hisi_sas_v2_init(struct hisi_hba *hisi_hba)
if (rc)
return rc;
+ phys_init_v2_hw(hisi_hba);
+
return 0;
}
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/23] HiSilicon SAS v2 hw support John Garry <john.garry@huawei.com> - 2016-01-08 15:20 +0100 [PATCH 14/23] hisi_sas: add v2 channel interrupt handler John Garry <john.garry@huawei.com> - 2016-01-08 15:20 +0100 [PATCH 18/23] hisi_sas: add v2 code to send smp command John Garry <john.garry@huawei.com> - 2016-01-08 15:20 +0100 [PATCH 06/23] hisi_sas: rename some fields in hisi_sas_itct John Garry <john.garry@huawei.com> - 2016-01-08 15:20 +0100 [PATCH 23/23] hisi_sas: update driver version to 1.1 John Garry <john.garry@huawei.com> - 2016-01-08 15:20 +0100 [PATCH 11/23] hisi_sas: add v2 phy init code John Garry <john.garry@huawei.com> - 2016-01-08 15:20 +0100 Re: [PATCH 00/23] HiSilicon SAS v2 hw support John Garry <john.garry@huawei.com> - 2016-01-08 15:40 +0100 Re: [PATCH 00/23] HiSilicon SAS v2 hw support Hannes Reinecke <hare@suse.de> - 2016-01-11 14:50 +0100
csiph-web