mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: <jejb@linux.vnet.ibm.com>, <martin.petersen@oracle.com>
Cc: <linuxarm@huawei.com>, <john.garry2@mail.dcu.ie>,
	<linux-scsi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<zhangfei.gao@linaro.org>, John Garry <john.garry@huawei.com>,
	Xiang Chen <chenxiang66@hisilicon.com>
Subject: [PATCH 03/23] scsi: hisi_sas: move PHY init to hisi_sas_scan_start()
Date: Thu, 23 Mar 2017 01:25:19 +0800	[thread overview]
Message-ID: <1490203539-228029-4-git-send-email-john.garry@huawei.com> (raw)
In-Reply-To: <1490203539-228029-1-git-send-email-john.garry@huawei.com>

Relocate the PHY init code from LLDD hw init path
to hisi_sas_scan_start().

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
---
 drivers/scsi/hisi_sas/hisi_sas.h       | 2 +-
 drivers/scsi/hisi_sas/hisi_sas_main.c  | 9 +++------
 drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 3 +--
 drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 3 +--
 4 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h
index fd76a02..2135de9 100644
--- a/drivers/scsi/hisi_sas/hisi_sas.h
+++ b/drivers/scsi/hisi_sas/hisi_sas.h
@@ -167,6 +167,7 @@ struct hisi_sas_hw {
 			  int device_id, int abort_flag, int tag_to_abort);
 	int (*slot_complete)(struct hisi_hba *hisi_hba,
 			     struct hisi_sas_slot *slot, int abort);
+	void (*phys_init)(struct hisi_hba *hisi_hba);
 	void (*phy_enable)(struct hisi_hba *hisi_hba, int phy_no);
 	void (*phy_disable)(struct hisi_hba *hisi_hba, int phy_no);
 	void (*phy_hard_reset)(struct hisi_hba *hisi_hba, int phy_no);
@@ -195,7 +196,6 @@ struct hisi_hba {
 	u8 sas_addr[SAS_ADDR_SIZE];
 
 	int n_phy;
-	int scan_finished;
 	spinlock_t lock;
 
 	struct timer_list timer;
diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index cbaef90..b86a228 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -493,12 +493,8 @@ static int hisi_sas_slave_configure(struct scsi_device *sdev)
 static void hisi_sas_scan_start(struct Scsi_Host *shost)
 {
 	struct hisi_hba *hisi_hba = shost_priv(shost);
-	int i;
-
-	for (i = 0; i < hisi_hba->n_phy; ++i)
-		hisi_sas_bytes_dmaed(hisi_hba, i);
 
-	hisi_hba->scan_finished = 1;
+	hisi_hba->hw->phys_init(hisi_hba);
 }
 
 static int hisi_sas_scan_finished(struct Scsi_Host *shost, unsigned long time)
@@ -506,7 +502,8 @@ static int hisi_sas_scan_finished(struct Scsi_Host *shost, unsigned long time)
 	struct hisi_hba *hisi_hba = shost_priv(shost);
 	struct sas_ha_struct *sha = &hisi_hba->sha;
 
-	if (hisi_hba->scan_finished == 0)
+	/* Wait for PHY up interrupt to occur */
+	if (time < HZ)
 		return 0;
 
 	sas_drain_work(sha);
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
index 022ad10..43988eb 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
@@ -1847,8 +1847,6 @@ static int hisi_sas_v1_init(struct hisi_hba *hisi_hba)
 	if (rc)
 		return rc;
 
-	phys_init_v1_hw(hisi_hba);
-
 	return 0;
 }
 
@@ -1862,6 +1860,7 @@ static int hisi_sas_v1_init(struct hisi_hba *hisi_hba)
 	.get_free_slot = get_free_slot_v1_hw,
 	.start_delivery = start_delivery_v1_hw,
 	.slot_complete = slot_complete_v1_hw,
+	.phys_init = phys_init_v1_hw,
 	.phy_enable = enable_phy_v1_hw,
 	.phy_disable = disable_phy_v1_hw,
 	.phy_hard_reset = phy_hard_reset_v1_hw,
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index 53651cf..73e4f66 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -2864,8 +2864,6 @@ static int hisi_sas_v2_init(struct hisi_hba *hisi_hba)
 	if (rc)
 		return rc;
 
-	phys_init_v2_hw(hisi_hba);
-
 	return 0;
 }
 
@@ -2965,6 +2963,7 @@ static int soft_reset_v2_hw(struct hisi_hba *hisi_hba)
 	.get_free_slot = get_free_slot_v2_hw,
 	.start_delivery = start_delivery_v2_hw,
 	.slot_complete = slot_complete_v2_hw,
+	.phys_init = phys_init_v2_hw,
 	.phy_enable = enable_phy_v2_hw,
 	.phy_disable = disable_phy_v2_hw,
 	.phy_hard_reset = phy_hard_reset_v2_hw,
-- 
1.9.1

  parent reply	other threads:[~2017-03-22 17:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-22 17:25 [PATCH 00/23] hisi_sas: error handling and other misc fixes and improvements John Garry
2017-03-22 17:25 ` [PATCH 01/23] scsi: hisi_sas: add to_hisi_sas_port() John Garry
2017-03-22 17:25 ` [PATCH 02/23] scsi: hisi_sas: add controller reset John Garry
2017-03-22 17:25 ` John Garry [this message]
2017-03-22 17:25 ` [PATCH 04/23] scsi: hisi_sas: add softreset function for SATA disk John Garry
2017-03-22 17:25 ` [PATCH 05/23] scsi: hisi_sas: remove hisi_sas_port_deformed() John Garry
2017-03-22 17:25 ` [PATCH 06/23] scsi: hisi_sas: error hisi_sas_task_prep() when port down John Garry
2017-03-22 17:25 ` [PATCH 07/23] scsi: hisi_sas: only reset link for PHY_FUNC_LINK_RESET John Garry
2017-03-22 17:25 ` [PATCH 08/23] scsi: hisi_sas: modify error handling for v2 hw John Garry
2017-03-22 17:25 ` [PATCH 09/23] scsi: hisi_sas: modify hisi_sas_abort_task() for SSP John Garry
2017-03-22 17:25 ` [PATCH 10/23] scsi: hisi_sas: hardreset for SATA disk in LU reset John Garry
2017-03-22 17:25 ` [PATCH 11/23] scsi: hisi_sas: check for SAS_TASK_STATE_ABORTED in slot complete John Garry
2017-03-22 17:25 ` [PATCH 12/23] scsi: hisi_sas: free slots after hardreset John Garry
2017-03-22 17:25 ` [PATCH 13/23] scsi: hisi_sas: fix some sas_task.task_state_lock locking John Garry
2017-03-22 17:25 ` [PATCH 14/23] scsi: hisi_sas: remove task free'ing for timeouts John Garry
2017-03-22 17:25 ` [PATCH 15/23] scsi: hisi_sas: process error codes according to their priority John Garry
2017-03-22 17:25 ` [PATCH 16/23] scsi: hisi_sas: some modifications to v2 hw reg init values John Garry
2017-03-22 17:25 ` [PATCH 17/23] scsi: hisi_sas: handle PHY UP+DOWN simultaneous irq John Garry
2017-03-22 17:25 ` [PATCH 18/23] scsi: hisi_sas: rename hisi_sas_link_timeout_{enable, disable}_link John Garry
2017-03-22 17:25 ` [PATCH 19/23] scsi: hisi_sas: add hisi_sas_clear_nexus_ha() John Garry
2017-03-22 17:25 ` [PATCH 20/23] scsi: hisi_sas: release SMP slot in lldd_abort_task John Garry
2017-03-22 17:25 ` [PATCH 21/23] scsi: hisi_sas: check hisi_sas_lu_reset() error message John Garry
2017-03-22 17:25 ` [PATCH 22/23] scsi: hisi_sas: use dev_is_sata to identify SATA or SAS disk John Garry
2017-03-22 17:25 ` [PATCH 23/23] scsi: hisi_sas: add is_sata_phy_v2_hw() John Garry
2017-03-23 15:12 ` [PATCH 00/23] hisi_sas: error handling and other misc fixes and improvements Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1490203539-228029-4-git-send-email-john.garry@huawei.com \
    --to=john.garry@huawei.com \
    --cc=chenxiang66@hisilicon.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=john.garry2@mail.dcu.ie \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=martin.petersen@oracle.com \
    --cc=zhangfei.gao@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®