aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/uwb/i1480/dfu/dfu.c102
-rw-r--r--drivers/uwb/i1480/dfu/i1480-dfu.h3
2 files changed, 4 insertions, 101 deletions
diff --git a/drivers/uwb/i1480/dfu/dfu.c b/drivers/uwb/i1480/dfu/dfu.c
index ebffaf542153..aec4146757da 100644
--- a/drivers/uwb/i1480/dfu/dfu.c
+++ b/drivers/uwb/i1480/dfu/dfu.c
@@ -127,98 +127,6 @@ error:
127EXPORT_SYMBOL_GPL(i1480_cmd); 127EXPORT_SYMBOL_GPL(i1480_cmd);
128 128
129 129
130/**
131 * Get information about the MAC and PHY
132 *
133 * @wa: Wired adaptor
134 * @neh: Notification/event handler
135 * @reply: Pointer to the reply event buffer
136 * @returns: 0 if ok, < 0 errno code on error.
137 */
138static
139int i1480_cmd_get_mac_phy_info(struct i1480 *i1480)
140{
141 int result;
142 struct uwb_rccb *cmd = i1480->cmd_buf;
143 struct i1480_evt_confirm_GMPI *reply = i1480->evt_buf;
144
145 cmd->bCommandType = i1480_CET_VS1;
146 cmd->wCommand = cpu_to_le16(i1480_CMD_GET_MAC_PHY_INFO);
147 reply->rceb.bEventType = i1480_CET_VS1;
148 reply->rceb.wEvent = i1480_EVT_GET_MAC_PHY_INFO;
149 result = i1480_cmd(i1480, "GET_MAC_PHY_INFO", sizeof(*cmd),
150 sizeof(*reply));
151 if (result < 0)
152 goto out;
153 if (le16_to_cpu(reply->status) != 0x00) {
154 dev_err(i1480->dev,
155 "GET_MAC_PHY_INFO: command execution failed: %d\n",
156 reply->status);
157 result = -EIO;
158 }
159out:
160 return result;
161}
162
163
164/**
165 * Get i1480's info and print it
166 *
167 * @wa: Wire Adapter
168 * @neh: Notification/event handler
169 * @returns: 0 if ok, < 0 errno code on error.
170 */
171static
172int i1480_check_info(struct i1480 *i1480)
173{
174 struct i1480_evt_confirm_GMPI *reply = i1480->evt_buf;
175 int result;
176 unsigned mac_fw_rev;
177#if i1480_FW <= 0x00000302
178 unsigned phy_fw_rev;
179#endif
180 if (i1480->quirk_no_check_info) {
181 dev_err(i1480->dev, "firmware info check disabled\n");
182 return 0;
183 }
184
185 result = i1480_cmd_get_mac_phy_info(i1480);
186 if (result < 0) {
187 dev_err(i1480->dev, "Cannot get MAC & PHY information: %d\n",
188 result);
189 goto out;
190 }
191 mac_fw_rev = le16_to_cpu(reply->mac_fw_rev);
192#if i1480_FW > 0x00000302
193 dev_info(i1480->dev,
194 "HW v%02hx "
195 "MAC FW v%02hx.%02hx caps %04hx "
196 "PHY type %02hx v%02hx caps %02hx %02hx %02hx\n",
197 reply->hw_rev, mac_fw_rev >> 8, mac_fw_rev & 0xff,
198 le16_to_cpu(reply->mac_caps),
199 reply->phy_vendor, reply->phy_rev,
200 reply->phy_caps[0], reply->phy_caps[1], reply->phy_caps[2]);
201#else
202 phy_fw_rev = le16_to_cpu(reply->phy_fw_rev);
203 dev_info(i1480->dev, "MAC FW v%02hx.%02hx caps %04hx "
204 " PHY FW v%02hx.%02hx caps %04hx\n",
205 mac_fw_rev >> 8, mac_fw_rev & 0xff,
206 le16_to_cpu(reply->mac_caps),
207 phy_fw_rev >> 8, phy_fw_rev & 0xff,
208 le16_to_cpu(reply->phy_caps));
209#endif
210 dev_dbg(i1480->dev,
211 "key-stores:%hu mcast-addr-stores:%hu sec-modes:%hu\n",
212 (unsigned short) reply->key_stores,
213 le16_to_cpu(reply->mcast_addr_stores),
214 (unsigned short) reply->sec_mode_supported);
215 /* FIXME: complain if fw version too low -- pending for
216 * numbering to stabilize */
217out:
218 return result;
219}
220
221
222static 130static
223int i1480_print_state(struct i1480 *i1480) 131int i1480_print_state(struct i1480 *i1480)
224{ 132{
@@ -264,12 +172,10 @@ int i1480_fw_upload(struct i1480 *i1480)
264 i1480_print_state(i1480); 172 i1480_print_state(i1480);
265 goto error_rc_release; 173 goto error_rc_release;
266 } 174 }
267 result = i1480_check_info(i1480); 175 /*
268 if (result < 0) { 176 * FIXME: find some reliable way to check whether firmware is running
269 dev_warn(i1480->dev, "Warning! Cannot check firmware info: %d\n", 177 * properly. Maybe use some standard request that has no side effects?
270 result); 178 */
271 result = 0;
272 }
273 dev_info(i1480->dev, "firmware uploaded successfully\n"); 179 dev_info(i1480->dev, "firmware uploaded successfully\n");
274error_rc_release: 180error_rc_release:
275 if (i1480->rc_release) 181 if (i1480->rc_release)
diff --git a/drivers/uwb/i1480/dfu/i1480-dfu.h b/drivers/uwb/i1480/dfu/i1480-dfu.h
index 4103b287ac71..8035418de132 100644
--- a/drivers/uwb/i1480/dfu/i1480-dfu.h
+++ b/drivers/uwb/i1480/dfu/i1480-dfu.h
@@ -56,7 +56,6 @@
56 * request_firmware() 56 * request_firmware()
57 * i1480_mpi_write() 57 * i1480_mpi_write()
58 * i1480->cmd() [i1480_{usb,pci}_cmd()] 58 * i1480->cmd() [i1480_{usb,pci}_cmd()]
59 * i1480_check_info()
60 * 59 *
61 * Once the probe function enumerates the device and uploads the 60 * Once the probe function enumerates the device and uploads the
62 * firmware, we just exit with -ENODEV, as we don't really want to 61 * firmware, we just exit with -ENODEV, as we don't really want to
@@ -130,8 +129,6 @@ struct i1480 {
130 void *evt_buf, *cmd_buf; 129 void *evt_buf, *cmd_buf;
131 ssize_t evt_result; 130 ssize_t evt_result;
132 struct completion evt_complete; 131 struct completion evt_complete;
133
134 u8 quirk_no_check_info:1;
135}; 132};
136 133
137static inline 134static inline