Release 4.11 drivers/staging/rtl8192u/r8180_93cx6.c
/*
* This files contains card eeprom (93c46 or 93c56) programming routines,
* memory is addressed by 16 bits words.
*
* This is part of rtl8180 OpenSource driver.
* Copyright (C) Andrea Merello 2004 <andrea.merello@gmail.com>
* Released under the terms of GPL (General Public Licence)
*
* Parts of this driver are based on the GPL part of the
* official realtek driver.
*
* Parts of this driver are based on the rtl8180 driver skeleton
* from Patric Schenke & Andres Salomon.
*
* Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver.
*
* We want to thank the Authors of those projects and the Ndiswrapper
* project Authors.
*/
#include "r8180_93cx6.h"
static void eprom_cs(struct net_device *dev, short bit)
{
u8 cmdreg;
int err;
err = read_nic_byte_E(dev, EPROM_CMD, &cmdreg);
if (err)
return;
if (bit)
/* enable EPROM */
write_nic_byte_E(dev, EPROM_CMD, cmdreg | EPROM_CS_BIT);
else
/* disable EPROM */
write_nic_byte_E(dev, EPROM_CMD, cmdreg & ~EPROM_CS_BIT);
force_pci_posting(dev);
udelay(EPROM_DELAY);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jerry Chuang | 47 | 61.04% | 1 | 25.00% |
Xenia Ragiadakou | 19 | 24.68% | 1 | 25.00% |
Salah Triki | 10 | 12.99% | 1 | 25.00% |
Ana Rey Botello | 1 | 1.30% | 1 | 25.00% |
Total | 77 | 100.00% | 4 | 100.00% |
static void eprom_ck_cycle(struct net_device *dev)
{
u8 cmdreg;
int err;
err = read_nic_byte_E(dev, EPROM_CMD, &cmdreg);
if (err)
return;
write_nic_byte_E(dev, EPROM_CMD, cmdreg | EPROM_CK_BIT);
force_pci_posting(dev);
udelay(EPROM_DELAY);
read_nic_byte_E(dev, EPROM_CMD, &cmdreg);
write_nic_byte_E(dev, EPROM_CMD, cmdreg & ~EPROM_CK_BIT);
force_pci_posting(dev);
udelay(EPROM_DELAY);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jerry Chuang | 54 | 62.07% | 1 | 25.00% |
Xenia Ragiadakou | 22 | 25.29% | 1 | 25.00% |
Salah Triki | 10 | 11.49% | 1 | 25.00% |
Ana Rey Botello | 1 | 1.15% | 1 | 25.00% |
Total | 87 | 100.00% | 4 | 100.00% |
static void eprom_w(struct net_device *dev, short bit)
{
u8 cmdreg;
int err;
err = read_nic_byte_E(dev, EPROM_CMD, &cmdreg);
if (err)
return;
if (bit)
write_nic_byte_E(dev, EPROM_CMD, cmdreg | EPROM_W_BIT);
else
write_nic_byte_E(dev, EPROM_CMD, cmdreg & ~EPROM_W_BIT);
force_pci_posting(dev);
udelay(EPROM_DELAY);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jerry Chuang | 47 | 62.67% | 1 | 25.00% |
Xenia Ragiadakou | 17 | 22.67% | 1 | 25.00% |
Salah Triki | 10 | 13.33% | 1 | 25.00% |
Ana Rey Botello | 1 | 1.33% | 1 | 25.00% |
Total | 75 | 100.00% | 4 | 100.00% |
static short eprom_r(struct net_device *dev)
{
u8 bit;
int err;
err = read_nic_byte_E(dev, EPROM_CMD, &bit);
if (err)
return err;
udelay(EPROM_DELAY);
if (bit & EPROM_R_BIT)
return 1;
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jerry Chuang | 34 | 64.15% | 1 | 25.00% |
Salah Triki | 12 | 22.64% | 1 | 25.00% |
Xenia Ragiadakou | 6 | 11.32% | 1 | 25.00% |
Ana Rey Botello | 1 | 1.89% | 1 | 25.00% |
Total | 53 | 100.00% | 4 | 100.00% |
static void eprom_send_bits_string(struct net_device *dev, short b[], int len)
{
int i;
for (i = 0; i < len; i++) {
eprom_w(dev, b[i]);
eprom_ck_cycle(dev);
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jerry Chuang | 50 | 98.04% | 1 | 50.00% |
Ana Rey Botello | 1 | 1.96% | 1 | 50.00% |
Total | 51 | 100.00% | 2 | 100.00% |
int eprom_read(struct net_device *dev, u32 addr)
{
struct r8192_priv *priv = ieee80211_priv(dev);
short read_cmd[] = {1, 1, 0};
short addr_str[8];
int i;
int addr_len;
u32 ret;
int err;
ret = 0;
/* enable EPROM programming */
write_nic_byte_E(dev, EPROM_CMD,
(EPROM_CMD_PROGRAM<<EPROM_CMD_OPERATING_MODE_SHIFT));
force_pci_posting(dev);
udelay(EPROM_DELAY);
if (priv->epromtype == EPROM_93c56) {
addr_str[7] = addr & 1;
addr_str[6] = addr & (1<<1);
addr_str[5] = addr & (1<<2);
addr_str[4] = addr & (1<<3);
addr_str[3] = addr & (1<<4);
addr_str[2] = addr & (1<<5);
addr_str[1] = addr & (1<<6);
addr_str[0] = addr & (1<<7);
addr_len = 8;
} else {
addr_str[5] = addr & 1;
addr_str[4] = addr & (1<<1);
addr_str[3] = addr & (1<<2);
addr_str[2] = addr & (1<<3);
addr_str[1] = addr & (1<<4);
addr_str[0] = addr & (1<<5);
addr_len = 6;
}
eprom_cs(dev, 1);
eprom_ck_cycle(dev);
eprom_send_bits_string(dev, read_cmd, 3);
eprom_send_bits_string(dev, addr_str, addr_len);
/*
* keep chip pin D to low state while reading.
* I'm unsure if it is necessary, but anyway shouldn't hurt
*/
eprom_w(dev, 0);
for (i = 0; i < 16; i++) {
/* eeprom needs a clk cycle between writing opcode&adr
* and reading data. (eeprom outs a dummy 0)
*/
eprom_ck_cycle(dev);
err = eprom_r(dev);
if (err < 0)
return err;
ret |= err<<(15-i);
}
eprom_cs(dev, 0);
eprom_ck_cycle(dev);
/* disable EPROM programming */
write_nic_byte_E(dev, EPROM_CMD,
(EPROM_CMD_NORMAL<<EPROM_CMD_OPERATING_MODE_SHIFT));
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jerry Chuang | 367 | 94.10% | 1 | 33.33% |
Salah Triki | 19 | 4.87% | 1 | 33.33% |
Sanjeev Sharma | 4 | 1.03% | 1 | 33.33% |
Total | 390 | 100.00% | 3 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jerry Chuang | 602 | 81.68% | 1 | 14.29% |
Xenia Ragiadakou | 64 | 8.68% | 1 | 14.29% |
Salah Triki | 61 | 8.28% | 2 | 28.57% |
Ana Rey Botello | 5 | 0.68% | 1 | 14.29% |
Sanjeev Sharma | 4 | 0.54% | 1 | 14.29% |
Derek Robson | 1 | 0.14% | 1 | 14.29% |
Total | 737 | 100.00% | 7 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.