diff options
author | Adrian Bunk <bunk@stusta.de> | 2005-11-05 14:01:47 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2005-11-07 21:50:00 -0500 |
commit | 48888cc6120ff945675ef79a3ba2955afa0f5124 (patch) | |
tree | f204efafbe99dab92fe25896e98862922aa408d5 | |
parent | 8e3babcd69ec0fde874838e276eb0b211c6a5647 (diff) |
[PATCH] kill include/linux/eeprom.h
This patch kills include/linux/eeprom.h .
Rationale:
- it was only used by one single driver
- even this driver didn't do anything useful with it
- most of this file are non-inline and non-static functions (sic)
This removes include/linux/eeprom.h and cleans drivers/net/ns83820.c up.
If you think eeprom.h should be used more extensively, please consider:
- the code has to be moved from the header file to a .c file
- the currently empty write function has to be implemented
- ns83820.c or any other driver should actually use it
Noone did any of these during the more than 3 years eeprom.h already
exists...
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/ns83820.c | 13 | ||||
-rw-r--r-- | include/linux/eeprom.h | 136 |
2 files changed, 2 insertions, 147 deletions
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c index a3c3fc9c0d8a..f857ae94d261 100644 --- a/drivers/net/ns83820.c +++ b/drivers/net/ns83820.c | |||
@@ -110,7 +110,6 @@ | |||
110 | #include <linux/init.h> | 110 | #include <linux/init.h> |
111 | #include <linux/ip.h> /* for iph */ | 111 | #include <linux/ip.h> /* for iph */ |
112 | #include <linux/in.h> /* for IPPROTO_... */ | 112 | #include <linux/in.h> /* for IPPROTO_... */ |
113 | #include <linux/eeprom.h> | ||
114 | #include <linux/compiler.h> | 113 | #include <linux/compiler.h> |
115 | #include <linux/prefetch.h> | 114 | #include <linux/prefetch.h> |
116 | #include <linux/ethtool.h> | 115 | #include <linux/ethtool.h> |
@@ -445,7 +444,6 @@ struct ns83820 { | |||
445 | 444 | ||
446 | u32 MEAR_cache; | 445 | u32 MEAR_cache; |
447 | u32 IMR_cache; | 446 | u32 IMR_cache; |
448 | struct eeprom ee; | ||
449 | 447 | ||
450 | unsigned linkstate; | 448 | unsigned linkstate; |
451 | 449 | ||
@@ -1558,15 +1556,13 @@ static void ns83820_getmac(struct ns83820 *dev, u8 *mac) | |||
1558 | unsigned i; | 1556 | unsigned i; |
1559 | for (i=0; i<3; i++) { | 1557 | for (i=0; i<3; i++) { |
1560 | u32 data; | 1558 | u32 data; |
1561 | #if 0 /* I've left this in as an example of how to use eeprom.h */ | 1559 | |
1562 | data = eeprom_readw(&dev->ee, 0xa + 2 - i); | ||
1563 | #else | ||
1564 | /* Read from the perfect match memory: this is loaded by | 1560 | /* Read from the perfect match memory: this is loaded by |
1565 | * the chip from the EEPROM via the EELOAD self test. | 1561 | * the chip from the EEPROM via the EELOAD self test. |
1566 | */ | 1562 | */ |
1567 | writel(i*2, dev->base + RFCR); | 1563 | writel(i*2, dev->base + RFCR); |
1568 | data = readl(dev->base + RFDR); | 1564 | data = readl(dev->base + RFDR); |
1569 | #endif | 1565 | |
1570 | *mac++ = data; | 1566 | *mac++ = data; |
1571 | *mac++ = data >> 8; | 1567 | *mac++ = data >> 8; |
1572 | } | 1568 | } |
@@ -1851,8 +1847,6 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_ | |||
1851 | spin_lock_init(&dev->misc_lock); | 1847 | spin_lock_init(&dev->misc_lock); |
1852 | dev->pci_dev = pci_dev; | 1848 | dev->pci_dev = pci_dev; |
1853 | 1849 | ||
1854 | dev->ee.cache = &dev->MEAR_cache; | ||
1855 | dev->ee.lock = &dev->misc_lock; | ||
1856 | SET_MODULE_OWNER(ndev); | 1850 | SET_MODULE_OWNER(ndev); |
1857 | SET_NETDEV_DEV(ndev, &pci_dev->dev); | 1851 | SET_NETDEV_DEV(ndev, &pci_dev->dev); |
1858 | 1852 | ||
@@ -1887,9 +1881,6 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_ | |||
1887 | 1881 | ||
1888 | dev->IMR_cache = 0; | 1882 | dev->IMR_cache = 0; |
1889 | 1883 | ||
1890 | setup_ee_mem_bitbanger(&dev->ee, dev->base + MEAR, 3, 2, 1, 0, | ||
1891 | 0); | ||
1892 | |||
1893 | err = request_irq(pci_dev->irq, ns83820_irq, SA_SHIRQ, | 1884 | err = request_irq(pci_dev->irq, ns83820_irq, SA_SHIRQ, |
1894 | DRV_NAME, ndev); | 1885 | DRV_NAME, ndev); |
1895 | if (err) { | 1886 | if (err) { |
diff --git a/include/linux/eeprom.h b/include/linux/eeprom.h deleted file mode 100644 index 38afd9da1dfe..000000000000 --- a/include/linux/eeprom.h +++ /dev/null | |||
@@ -1,136 +0,0 @@ | |||
1 | /* credit winbond-840.c | ||
2 | */ | ||
3 | #include <asm/io.h> | ||
4 | struct eeprom_ops { | ||
5 | void (*set_cs)(void *ee); | ||
6 | void (*clear_cs)(void *ee); | ||
7 | }; | ||
8 | |||
9 | #define EEPOL_EEDI 0x01 | ||
10 | #define EEPOL_EEDO 0x02 | ||
11 | #define EEPOL_EECLK 0x04 | ||
12 | #define EEPOL_EESEL 0x08 | ||
13 | |||
14 | struct eeprom { | ||
15 | void *dev; | ||
16 | struct eeprom_ops *ops; | ||
17 | |||
18 | void __iomem * addr; | ||
19 | |||
20 | unsigned ee_addr_bits; | ||
21 | |||
22 | unsigned eesel; | ||
23 | unsigned eeclk; | ||
24 | unsigned eedo; | ||
25 | unsigned eedi; | ||
26 | unsigned polarity; | ||
27 | unsigned ee_state; | ||
28 | |||
29 | spinlock_t *lock; | ||
30 | u32 *cache; | ||
31 | }; | ||
32 | |||
33 | |||
34 | u8 eeprom_readb(struct eeprom *ee, unsigned address); | ||
35 | void eeprom_read(struct eeprom *ee, unsigned address, u8 *bytes, | ||
36 | unsigned count); | ||
37 | void eeprom_writeb(struct eeprom *ee, unsigned address, u8 data); | ||
38 | void eeprom_write(struct eeprom *ee, unsigned address, u8 *bytes, | ||
39 | unsigned count); | ||
40 | |||
41 | /* The EEPROM commands include the alway-set leading bit. */ | ||
42 | enum EEPROM_Cmds { | ||
43 | EE_WriteCmd=(5 << 6), EE_ReadCmd=(6 << 6), EE_EraseCmd=(7 << 6), | ||
44 | }; | ||
45 | |||
46 | void setup_ee_mem_bitbanger(struct eeprom *ee, void __iomem *memaddr, int eesel_bit, int eeclk_bit, int eedo_bit, int eedi_bit, unsigned polarity) | ||
47 | { | ||
48 | ee->addr = memaddr; | ||
49 | ee->eesel = 1 << eesel_bit; | ||
50 | ee->eeclk = 1 << eeclk_bit; | ||
51 | ee->eedo = 1 << eedo_bit; | ||
52 | ee->eedi = 1 << eedi_bit; | ||
53 | |||
54 | ee->polarity = polarity; | ||
55 | |||
56 | *ee->cache = readl(ee->addr); | ||
57 | } | ||
58 | |||
59 | /* foo. put this in a .c file */ | ||
60 | static inline void eeprom_update(struct eeprom *ee, u32 mask, int pol) | ||
61 | { | ||
62 | unsigned long flags; | ||
63 | u32 data; | ||
64 | |||
65 | spin_lock_irqsave(ee->lock, flags); | ||
66 | data = *ee->cache; | ||
67 | |||
68 | data &= ~mask; | ||
69 | if (pol) | ||
70 | data |= mask; | ||
71 | |||
72 | *ee->cache = data; | ||
73 | //printk("update: %08x\n", data); | ||
74 | writel(data, ee->addr); | ||
75 | spin_unlock_irqrestore(ee->lock, flags); | ||
76 | } | ||
77 | |||
78 | void eeprom_clk_lo(struct eeprom *ee) | ||
79 | { | ||
80 | int pol = !!(ee->polarity & EEPOL_EECLK); | ||
81 | |||
82 | eeprom_update(ee, ee->eeclk, pol); | ||
83 | udelay(2); | ||
84 | } | ||
85 | |||
86 | void eeprom_clk_hi(struct eeprom *ee) | ||
87 | { | ||
88 | int pol = !!(ee->polarity & EEPOL_EECLK); | ||
89 | |||
90 | eeprom_update(ee, ee->eeclk, !pol); | ||
91 | udelay(2); | ||
92 | } | ||
93 | |||
94 | void eeprom_send_addr(struct eeprom *ee, unsigned address) | ||
95 | { | ||
96 | int pol = !!(ee->polarity & EEPOL_EEDI); | ||
97 | unsigned i; | ||
98 | address |= 6 << 6; | ||
99 | |||
100 | /* Shift the read command bits out. */ | ||
101 | for (i=0; i<11; i++) { | ||
102 | eeprom_update(ee, ee->eedi, ((address >> 10) & 1) ^ pol); | ||
103 | address <<= 1; | ||
104 | eeprom_clk_hi(ee); | ||
105 | eeprom_clk_lo(ee); | ||
106 | } | ||
107 | eeprom_update(ee, ee->eedi, pol); | ||
108 | } | ||
109 | |||
110 | u16 eeprom_readw(struct eeprom *ee, unsigned address) | ||
111 | { | ||
112 | unsigned i; | ||
113 | u16 res = 0; | ||
114 | |||
115 | eeprom_clk_lo(ee); | ||
116 | eeprom_update(ee, ee->eesel, 1 ^ !!(ee->polarity & EEPOL_EESEL)); | ||
117 | eeprom_send_addr(ee, address); | ||
118 | |||
119 | for (i=0; i<16; i++) { | ||
120 | u32 data; | ||
121 | eeprom_clk_hi(ee); | ||
122 | res <<= 1; | ||
123 | data = readl(ee->addr); | ||
124 | //printk("eeprom_readw: %08x\n", data); | ||
125 | res |= !!(data & ee->eedo) ^ !!(ee->polarity & EEPOL_EEDO); | ||
126 | eeprom_clk_lo(ee); | ||
127 | } | ||
128 | eeprom_update(ee, ee->eesel, 0 ^ !!(ee->polarity & EEPOL_EESEL)); | ||
129 | |||
130 | return res; | ||
131 | } | ||
132 | |||
133 | |||
134 | void eeprom_writeb(struct eeprom *ee, unsigned address, u8 data) | ||
135 | { | ||
136 | } | ||