aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/phy.c
diff options
context:
space:
mode:
authorDave Jiang <dave.jiang@intel.com>2011-03-02 15:31:24 -0500
committerDan Williams <dan.j.williams@intel.com>2011-07-03 06:55:29 -0400
commit4d07f7f367f2c2d5547684893e61a7a796c1547f (patch)
treeffcd0f706f0f4729bb84fd75f906578b66148948 /drivers/scsi/isci/phy.c
parentc658b109d3a9444293700471a278a741a1e5033d (diff)
isci: Adding support for phy enable and disable
Adding support for PHY_FUNC_LINK_RESET and PHY_FUNC_DISABLE. This allow the sysfs knob enable (both 0 and 1) and link_reset to work properly. Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/phy.c')
-rw-r--r--drivers/scsi/isci/phy.c59
1 files changed, 34 insertions, 25 deletions
diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c
index 1eefaaeb1141..decc0c05a3dd 100644
--- a/drivers/scsi/isci/phy.c
+++ b/drivers/scsi/isci/phy.c
@@ -58,6 +58,9 @@
58#include "scic_port.h" 58#include "scic_port.h"
59#include "scic_config_parameters.h" 59#include "scic_config_parameters.h"
60 60
61struct scic_sds_phy;
62extern enum sci_status scic_sds_phy_start(struct scic_sds_phy *sci_phy);
63extern enum sci_status scic_sds_phy_stop(struct scic_sds_phy *sci_phy);
61 64
62/** 65/**
63 * isci_phy_init() - This function is called by the probe function to 66 * isci_phy_init() - This function is called by the probe function to
@@ -127,42 +130,48 @@ void isci_phy_init(
127 * 130 *
128 * status, zero indicates success. 131 * status, zero indicates success.
129 */ 132 */
130int isci_phy_control( 133int isci_phy_control(struct asd_sas_phy *sas_phy,
131 struct asd_sas_phy *phy, 134 enum phy_func func,
132 enum phy_func func, 135 void *buf)
133 void *buf)
134{ 136{
135 int ret = TMF_RESP_FUNC_COMPLETE; 137 int ret = 0;
136 struct isci_phy *isci_phy_ptr = (struct isci_phy *)phy->lldd_phy; 138 struct isci_phy *iphy = sas_phy->lldd_phy;
137 struct isci_port *isci_port_ptr = NULL; 139 struct isci_port *iport = iphy->isci_port;
138 140 struct isci_host *ihost = sas_phy->ha->lldd_ha;
139 if (isci_phy_ptr != NULL) 141 unsigned long flags;
140 isci_port_ptr = isci_phy_ptr->isci_port;
141
142 if ((isci_phy_ptr == NULL) || (isci_port_ptr == NULL)) {
143 pr_err("%s: asd_sas_phy %p: lldd_phy %p or "
144 "isci_port %p == NULL!\n",
145 __func__, phy, isci_phy_ptr, isci_port_ptr);
146 return TMF_RESP_FUNC_FAILED;
147 }
148 142
149 pr_debug("%s: phy %p; func %d; buf %p; isci phy %p, port %p\n", 143 dev_dbg(&ihost->pdev->dev,
150 __func__, phy, func, buf, isci_phy_ptr, isci_port_ptr); 144 "%s: phy %p; func %d; buf %p; isci phy %p, port %p\n",
145 __func__, sas_phy, func, buf, iphy, iport);
151 146
152 switch (func) { 147 switch (func) {
153 case PHY_FUNC_HARD_RESET: 148 case PHY_FUNC_DISABLE:
149 spin_lock_irqsave(&ihost->scic_lock, flags);
150 scic_sds_phy_stop(iphy->sci_phy_handle);
151 spin_unlock_irqrestore(&ihost->scic_lock, flags);
152 break;
153
154 case PHY_FUNC_LINK_RESET: 154 case PHY_FUNC_LINK_RESET:
155 spin_lock_irqsave(&ihost->scic_lock, flags);
156 scic_sds_phy_stop(iphy->sci_phy_handle);
157 scic_sds_phy_start(iphy->sci_phy_handle);
158 spin_unlock_irqrestore(&ihost->scic_lock, flags);
159 break;
160
161 case PHY_FUNC_HARD_RESET:
162 if (!iport)
163 return -ENODEV;
155 164
156 /* Perform the port reset. */ 165 /* Perform the port reset. */
157 ret = isci_port_perform_hard_reset(isci_port_ptr, isci_phy_ptr); 166 ret = isci_port_perform_hard_reset(iport, iphy);
158 167
159 break; 168 break;
160 169
161 case PHY_FUNC_DISABLE:
162 default: 170 default:
163 pr_debug("%s: phy %p; func %d NOT IMPLEMENTED!\n", 171 dev_dbg(&ihost->pdev->dev,
164 __func__, phy, func); 172 "%s: phy %p; func %d NOT IMPLEMENTED!\n",
165 ret = TMF_RESP_FUNC_FAILED; 173 __func__, sas_phy, func);
174 ret = -ENOSYS;
166 break; 175 break;
167 } 176 }
168 return ret; 177 return ret;