diff options
author | Sathya Perla <sathya.perla@emulex.com> | 2011-08-02 15:57:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-08-03 06:23:30 -0400 |
commit | 306f13487c9f7d6e3303a547e01e22958a04c666 (patch) | |
tree | 0fe7f2870abbc3db97501b28f1eaecb41c2c2cdd /drivers/net/benet/be_cmds.c | |
parent | 5b8821b787495273ba4fb333a3561c6da382a9a7 (diff) |
be2net: add support for flashing Teranetics PHY firmware
Support for flashing RJ45 PHY (from Teranetics) on a 10GBaseT BE3 card.
Signed-off-by: Naresh G <bgottumukkala@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet/be_cmds.c')
-rw-r--r-- | drivers/net/benet/be_cmds.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index f138fbb2e4a8..7292be64632b 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c | |||
@@ -2186,11 +2186,13 @@ err: | |||
2186 | return status; | 2186 | return status; |
2187 | } | 2187 | } |
2188 | 2188 | ||
2189 | int be_cmd_get_phy_info(struct be_adapter *adapter, struct be_dma_mem *cmd) | 2189 | int be_cmd_get_phy_info(struct be_adapter *adapter, |
2190 | struct be_phy_info *phy_info) | ||
2190 | { | 2191 | { |
2191 | struct be_mcc_wrb *wrb; | 2192 | struct be_mcc_wrb *wrb; |
2192 | struct be_cmd_req_get_phy_info *req; | 2193 | struct be_cmd_req_get_phy_info *req; |
2193 | struct be_sge *sge; | 2194 | struct be_sge *sge; |
2195 | struct be_dma_mem cmd; | ||
2194 | int status; | 2196 | int status; |
2195 | 2197 | ||
2196 | spin_lock_bh(&adapter->mcc_lock); | 2198 | spin_lock_bh(&adapter->mcc_lock); |
@@ -2200,8 +2202,16 @@ int be_cmd_get_phy_info(struct be_adapter *adapter, struct be_dma_mem *cmd) | |||
2200 | status = -EBUSY; | 2202 | status = -EBUSY; |
2201 | goto err; | 2203 | goto err; |
2202 | } | 2204 | } |
2205 | cmd.size = sizeof(struct be_cmd_req_get_phy_info); | ||
2206 | cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size, | ||
2207 | &cmd.dma); | ||
2208 | if (!cmd.va) { | ||
2209 | dev_err(&adapter->pdev->dev, "Memory alloc failure\n"); | ||
2210 | status = -ENOMEM; | ||
2211 | goto err; | ||
2212 | } | ||
2203 | 2213 | ||
2204 | req = cmd->va; | 2214 | req = cmd.va; |
2205 | sge = nonembedded_sgl(wrb); | 2215 | sge = nonembedded_sgl(wrb); |
2206 | 2216 | ||
2207 | be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1, | 2217 | be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1, |
@@ -2211,11 +2221,20 @@ int be_cmd_get_phy_info(struct be_adapter *adapter, struct be_dma_mem *cmd) | |||
2211 | OPCODE_COMMON_GET_PHY_DETAILS, | 2221 | OPCODE_COMMON_GET_PHY_DETAILS, |
2212 | sizeof(*req)); | 2222 | sizeof(*req)); |
2213 | 2223 | ||
2214 | sge->pa_hi = cpu_to_le32(upper_32_bits(cmd->dma)); | 2224 | sge->pa_hi = cpu_to_le32(upper_32_bits(cmd.dma)); |
2215 | sge->pa_lo = cpu_to_le32(cmd->dma & 0xFFFFFFFF); | 2225 | sge->pa_lo = cpu_to_le32(cmd.dma & 0xFFFFFFFF); |
2216 | sge->len = cpu_to_le32(cmd->size); | 2226 | sge->len = cpu_to_le32(cmd.size); |
2217 | 2227 | ||
2218 | status = be_mcc_notify_wait(adapter); | 2228 | status = be_mcc_notify_wait(adapter); |
2229 | if (!status) { | ||
2230 | struct be_phy_info *resp_phy_info = | ||
2231 | cmd.va + sizeof(struct be_cmd_req_hdr); | ||
2232 | phy_info->phy_type = le16_to_cpu(resp_phy_info->phy_type); | ||
2233 | phy_info->interface_type = | ||
2234 | le16_to_cpu(resp_phy_info->interface_type); | ||
2235 | } | ||
2236 | pci_free_consistent(adapter->pdev, cmd.size, | ||
2237 | cmd.va, cmd.dma); | ||
2219 | err: | 2238 | err: |
2220 | spin_unlock_bh(&adapter->mcc_lock); | 2239 | spin_unlock_bh(&adapter->mcc_lock); |
2221 | return status; | 2240 | return status; |