diff options
author | Koen Kooi <koen@dominion.thruhere.net> | 2012-05-01 21:06:48 +0200 |
---|---|---|
committer | Denys Dmytriyenko <denys@ti.com> | 2012-05-03 19:09:07 -0400 |
commit | 4e18d702479ac6f835f3493d8aa81b8d323e1827 (patch) | |
tree | 11ba92d9c5a5bb84c74ee3f10b8eecaaa0510fb9 /recipes-kernel/linux/linux-mainline-3.2/micrel_zippy2/0004-ksz8851-93cx6-eeprom-access.patch | |
parent | aff1018e66b477544af17501757405283c21bef1 (diff) | |
download | meta-ti-4e18d702479ac6f835f3493d8aa81b8d323e1827.tar.gz |
linux-mainline 3.2: kernel recipe based on mainline 3.2.16 with additional patches for e.g. beagleboard on top
This patchset is managed in https://github.com/beagleboard/kernel/tree/beagleboard-3.2 by Robert Nelson and myself.
Tested on beagleboard-xM/Angstrom
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Signed-off-by: Denys Dmytriyenko <denys@ti.com>
Diffstat (limited to 'recipes-kernel/linux/linux-mainline-3.2/micrel_zippy2/0004-ksz8851-93cx6-eeprom-access.patch')
-rw-r--r-- | recipes-kernel/linux/linux-mainline-3.2/micrel_zippy2/0004-ksz8851-93cx6-eeprom-access.patch | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-mainline-3.2/micrel_zippy2/0004-ksz8851-93cx6-eeprom-access.patch b/recipes-kernel/linux/linux-mainline-3.2/micrel_zippy2/0004-ksz8851-93cx6-eeprom-access.patch new file mode 100644 index 00000000..974e1713 --- /dev/null +++ b/recipes-kernel/linux/linux-mainline-3.2/micrel_zippy2/0004-ksz8851-93cx6-eeprom-access.patch | |||
@@ -0,0 +1,130 @@ | |||
1 | From 2b458e8bc6c07d7de20eb202c8f9c895dcf5ec6b Mon Sep 17 00:00:00 2001 | ||
2 | From: Robert Nelson <robertcnelson@gmail.com> | ||
3 | Date: Thu, 29 Sep 2011 11:36:58 -0500 | ||
4 | Subject: [PATCH 04/14] ksz8851 93cx6 eeprom access | ||
5 | |||
6 | Signed-off-by: Robert Nelson <robertcnelson@gmail.com> | ||
7 | --- | ||
8 | drivers/net/ethernet/micrel/Kconfig | 1 + | ||
9 | drivers/net/ethernet/micrel/ks8851.c | 72 ++++++++++++++++++++++++++++++++++ | ||
10 | 2 files changed, 73 insertions(+), 0 deletions(-) | ||
11 | |||
12 | diff --git a/drivers/net/ethernet/micrel/Kconfig b/drivers/net/ethernet/micrel/Kconfig | ||
13 | index d10c2e1..fe42fc0 100644 | ||
14 | --- a/drivers/net/ethernet/micrel/Kconfig | ||
15 | +++ b/drivers/net/ethernet/micrel/Kconfig | ||
16 | @@ -42,6 +42,7 @@ config KS8851 | ||
17 | select NET_CORE | ||
18 | select MII | ||
19 | select CRC32 | ||
20 | + select EEPROM_93CX6 | ||
21 | ---help--- | ||
22 | SPI driver for Micrel KS8851 SPI attached network chip. | ||
23 | |||
24 | diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c | ||
25 | index da7cbea..6a7f27f 100644 | ||
26 | --- a/drivers/net/ethernet/micrel/ks8851.c | ||
27 | +++ b/drivers/net/ethernet/micrel/ks8851.c | ||
28 | @@ -22,6 +22,7 @@ | ||
29 | #include <linux/cache.h> | ||
30 | #include <linux/crc32.h> | ||
31 | #include <linux/mii.h> | ||
32 | +#include <linux/eeprom_93cx6.h> | ||
33 | |||
34 | #include <linux/spi/spi.h> | ||
35 | |||
36 | @@ -128,6 +129,8 @@ struct ks8851_net { | ||
37 | struct spi_message spi_msg2; | ||
38 | struct spi_transfer spi_xfer1; | ||
39 | struct spi_transfer spi_xfer2[2]; | ||
40 | + | ||
41 | + struct eeprom_93cx6 eeprom; | ||
42 | }; | ||
43 | |||
44 | static int msg_enable; | ||
45 | @@ -1449,6 +1452,68 @@ static int ks8851_set_eeprom(struct net_device *dev, | ||
46 | return ret_val; | ||
47 | } | ||
48 | |||
49 | +/* EEPROM support */ | ||
50 | + | ||
51 | +static void ks8851_eeprom_regread(struct eeprom_93cx6 *ee) | ||
52 | +{ | ||
53 | + struct ks8851_net *ks = ee->data; | ||
54 | + unsigned val; | ||
55 | + | ||
56 | + val = ks8851_rdreg16(ks, KS_EEPCR); | ||
57 | + | ||
58 | + ee->reg_data_out = (val & EEPCR_EESB) ? 1 : 0; | ||
59 | + ee->reg_data_clock = (val & EEPCR_EESCK) ? 1 : 0; | ||
60 | + ee->reg_chip_select = (val & EEPCR_EECS) ? 1 : 0; | ||
61 | +} | ||
62 | + | ||
63 | +static void ks8851_eeprom_regwrite(struct eeprom_93cx6 *ee) | ||
64 | +{ | ||
65 | + struct ks8851_net *ks = ee->data; | ||
66 | + unsigned val = EEPCR_EESA; /* default - eeprom access on */ | ||
67 | + | ||
68 | + if (ee->drive_data) | ||
69 | + val |= EEPCR_EESRWA; | ||
70 | + if (ee->reg_data_in) | ||
71 | + val |= EEPCR_EEDO; | ||
72 | + if (ee->reg_data_clock) | ||
73 | + val |= EEPCR_EESCK; | ||
74 | + if (ee->reg_chip_select) | ||
75 | + val |= EEPCR_EECS; | ||
76 | + | ||
77 | + printk(KERN_INFO "%s: wr %04x\n", __func__, val); | ||
78 | + ks8851_wrreg16(ks, KS_EEPCR, val); | ||
79 | +} | ||
80 | + | ||
81 | +/** | ||
82 | + * ks8851_eeprom_claim - claim device EEPROM and activate the interface | ||
83 | + * @ks: The network deice state. | ||
84 | + * | ||
85 | + * Check for the presence of an EEPROM, and then activate software access | ||
86 | + * to the device. | ||
87 | + */ | ||
88 | +static int ks8851_eeprom_claim(struct ks8851_net *ks) | ||
89 | +{ | ||
90 | + if (!(ks->rc_ccr & CCR_EEPROM)) | ||
91 | + return -ENOENT; | ||
92 | + | ||
93 | + /* start with clock low, cs high */ | ||
94 | + ks8851_wrreg16(ks, KS_EEPCR, EEPCR_EESA | EEPCR_EECS); | ||
95 | + return 0; | ||
96 | +} | ||
97 | + | ||
98 | +/** | ||
99 | + * ks8851_eeprom_release - release the EEPROM interface | ||
100 | + * @ks: The device state | ||
101 | + * | ||
102 | + * Release the software access to the device EEPROM | ||
103 | + */ | ||
104 | +static void ks8851_eeprom_release(struct ks8851_net *ks) | ||
105 | +{ | ||
106 | + unsigned val = ks8851_rdreg16(ks, KS_EEPCR); | ||
107 | + | ||
108 | + ks8851_wrreg16(ks, KS_EEPCR, val & ~EEPCR_EESA); | ||
109 | +} | ||
110 | + | ||
111 | static const struct ethtool_ops ks8851_ethtool_ops = { | ||
112 | .get_drvinfo = ks8851_get_drvinfo, | ||
113 | .get_msglevel = ks8851_get_msglevel, | ||
114 | @@ -1639,6 +1704,13 @@ static int __devinit ks8851_probe(struct spi_device *spi) | ||
115 | spi_message_add_tail(&ks->spi_xfer2[0], &ks->spi_msg2); | ||
116 | spi_message_add_tail(&ks->spi_xfer2[1], &ks->spi_msg2); | ||
117 | |||
118 | + /* setup EEPROM state */ | ||
119 | + | ||
120 | + ks->eeprom.data = ks; | ||
121 | + ks->eeprom.width = PCI_EEPROM_WIDTH_93C46; | ||
122 | + ks->eeprom.register_read = ks8851_eeprom_regread; | ||
123 | + ks->eeprom.register_write = ks8851_eeprom_regwrite; | ||
124 | + | ||
125 | /* setup mii state */ | ||
126 | ks->mii.dev = ndev; | ||
127 | ks->mii.phy_id = 1, | ||
128 | -- | ||
129 | 1.7.7.4 | ||
130 | |||