Release 4.7 drivers/staging/vt6656/firmware.c
/*
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* File: baseband.c
*
* Purpose: Implement functions to access baseband
*
* Author: Yiching Chen
*
* Date: May 20, 2004
*
* Functions:
*
* Revision History:
*
*/
#include <linux/compiler.h>
#include "firmware.h"
#include "usbpipe.h"
#define FIRMWARE_VERSION 0x133
/* version 1.51 */
#define FIRMWARE_NAME "vntwusb.fw"
#define FIRMWARE_CHUNK_SIZE 0x400
int vnt_download_firmware(struct vnt_private *priv)
{
struct device *dev = &priv->usb->dev;
const struct firmware *fw;
int status;
void *buffer = NULL;
bool result = false;
u16 length;
int ii, rc;
dev_dbg(dev, "---->Download firmware\n");
rc = request_firmware(&fw, FIRMWARE_NAME, dev);
if (rc) {
dev_err(dev, "firmware file %s request failed (%d)\n",
FIRMWARE_NAME, rc);
goto out;
}
buffer = kmalloc(FIRMWARE_CHUNK_SIZE, GFP_KERNEL);
if (!buffer)
goto free_fw;
for (ii = 0; ii < fw->size; ii += FIRMWARE_CHUNK_SIZE) {
length = min_t(int, fw->size - ii, FIRMWARE_CHUNK_SIZE);
memcpy(buffer, fw->data + ii, length);
status = vnt_control_out(priv,
0,
0x1200+ii,
0x0000,
length,
buffer);
dev_dbg(dev, "Download firmware...%d %zu\n", ii, fw->size);
if (status != STATUS_SUCCESS)
goto free_fw;
}
result = true;
free_fw:
release_firmware(fw);
out:
kfree(buffer);
return result;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
forest bond | forest bond | 81 | 37.85% | 1 | 7.14% |
ben hutchings | ben hutchings | 79 | 36.92% | 1 | 7.14% |
malcolm priestley | malcolm priestley | 48 | 22.43% | 6 | 42.86% |
andres more | andres more | 4 | 1.87% | 4 | 28.57% |
randy dunlap | randy dunlap | 1 | 0.47% | 1 | 7.14% |
christian engelmayer | christian engelmayer | 1 | 0.47% | 1 | 7.14% |
| Total | 214 | 100.00% | 14 | 100.00% |
MODULE_FIRMWARE(FIRMWARE_NAME);
int vnt_firmware_branch_to_sram(struct vnt_private *priv)
{
int status;
dev_dbg(&priv->usb->dev, "---->Branch to Sram\n");
status = vnt_control_out(priv,
1,
0x1200,
0x0000,
0,
NULL);
return status == STATUS_SUCCESS;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
forest bond | forest bond | 26 | 55.32% | 1 | 12.50% |
malcolm priestley | malcolm priestley | 18 | 38.30% | 5 | 62.50% |
tapasweni pathak | tapasweni pathak | 2 | 4.26% | 1 | 12.50% |
andres more | andres more | 1 | 2.13% | 1 | 12.50% |
| Total | 47 | 100.00% | 8 | 100.00% |
int vnt_check_firmware_version(struct vnt_private *priv)
{
int status;
status = vnt_control_in(priv,
MESSAGE_TYPE_READ,
0,
MESSAGE_REQUEST_VERSION,
2,
(u8 *)&priv->firmware_version);
dev_dbg(&priv->usb->dev, "Firmware Version [%04x]\n",
priv->firmware_version);
if (status != STATUS_SUCCESS) {
dev_dbg(&priv->usb->dev, "Firmware Invalid.\n");
return false;
}
if (priv->firmware_version == 0xFFFF) {
dev_dbg(&priv->usb->dev, "In Loader.\n");
return false;
}
dev_dbg(&priv->usb->dev, "Firmware Version [%04x]\n",
priv->firmware_version);
if (priv->firmware_version < FIRMWARE_VERSION) {
/* branch to loader for download new firmware */
vnt_firmware_branch_to_sram(priv);
return false;
}
return true;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
forest bond | forest bond | 79 | 56.83% | 1 | 7.14% |
malcolm priestley | malcolm priestley | 51 | 36.69% | 7 | 50.00% |
andres more | andres more | 7 | 5.04% | 4 | 28.57% |
ben hutchings | ben hutchings | 1 | 0.72% | 1 | 7.14% |
nandini hanumanthagowda | nandini hanumanthagowda | 1 | 0.72% | 1 | 7.14% |
| Total | 139 | 100.00% | 14 | 100.00% |
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
forest bond | forest bond | 194 | 45.33% | 1 | 3.70% |
malcolm priestley | malcolm priestley | 118 | 27.57% | 13 | 48.15% |
ben hutchings | ben hutchings | 95 | 22.20% | 1 | 3.70% |
andres more | andres more | 12 | 2.80% | 6 | 22.22% |
cedric cabessa | cedric cabessa | 3 | 0.70% | 1 | 3.70% |
tapasweni pathak | tapasweni pathak | 2 | 0.47% | 1 | 3.70% |
nandini hanumanthagowda | nandini hanumanthagowda | 1 | 0.23% | 1 | 3.70% |
othmar pasteka | othmar pasteka | 1 | 0.23% | 1 | 3.70% |
randy dunlap | randy dunlap | 1 | 0.23% | 1 | 3.70% |
christian engelmayer | christian engelmayer | 1 | 0.23% | 1 | 3.70% |
| Total | 428 | 100.00% | 27 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.