aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-06-23 01:11:30 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-23 01:11:30 -0400
commit45c091bb2d453ce4a8b06cf19872ec7a77fc4799 (patch)
tree06fb2e05518ebfba163f8424e028e7faf5672d66 /drivers
parentd588fcbe5a7ba8bba2cebf7799ab2d573717a806 (diff)
parent2191fe3e39159e3375f4b7ec1420df149f154101 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (139 commits) [POWERPC] re-enable OProfile for iSeries, using timer interrupt [POWERPC] support ibm,extended-*-frequency properties [POWERPC] Extra sanity check in EEH code [POWERPC] Dont look for class-code in pci children [POWERPC] Fix mdelay badness on shared processor partitions [POWERPC] disable floating point exceptions for init [POWERPC] Unify ppc syscall tables [POWERPC] mpic: add support for serial mode interrupts [POWERPC] pseries: Print PCI slot location code on failure [POWERPC] spufs: one more fix for 64k pages [POWERPC] spufs: fail spu_create with invalid flags [POWERPC] spufs: clear class2 interrupt status before wakeup [POWERPC] spufs: fix Makefile for "make clean" [POWERPC] spufs: remove stop_code from struct spu [POWERPC] spufs: fix spu irq affinity setting [POWERPC] spufs: further abstract priv1 register access [POWERPC] spufs: split the Cell BE support into generic and platform dependant parts [POWERPC] spufs: dont try to access SPE channel 1 count [POWERPC] spufs: use kzalloc in create_spu [POWERPC] spufs: fix initial state of wbox file ... Manually resolved conflicts in: drivers/net/phy/Makefile include/asm-powerpc/spu.h
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/viodasd.c2
-rw-r--r--drivers/cdrom/viocd.c2
-rw-r--r--drivers/char/hvc_console.c4
-rw-r--r--drivers/char/hvc_rtas.c37
-rw-r--r--drivers/char/hvsi.c2
-rw-r--r--drivers/char/viotape.c2
-rw-r--r--drivers/i2c/busses/Kconfig4
-rw-r--r--drivers/macintosh/via-pmu.c4
-rw-r--r--drivers/net/Kconfig8
-rw-r--r--drivers/net/ibmveth.c2
-rw-r--r--drivers/net/iseries_veth.c27
-rw-r--r--drivers/net/phy/Kconfig5
-rw-r--r--drivers/net/phy/Makefile1
-rw-r--r--drivers/net/phy/vitesse.c112
14 files changed, 166 insertions, 46 deletions
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c
index f63e07bd9f9c..b0df4f5ab97a 100644
--- a/drivers/block/viodasd.c
+++ b/drivers/block/viodasd.c
@@ -747,7 +747,7 @@ static int viodasd_remove(struct vio_dev *vdev)
747 * support. 747 * support.
748 */ 748 */
749static struct vio_device_id viodasd_device_table[] __devinitdata = { 749static struct vio_device_id viodasd_device_table[] __devinitdata = {
750 { "viodasd", "" }, 750 { "block", "IBM,iSeries-viodasd" },
751 { "", "" } 751 { "", "" }
752}; 752};
753MODULE_DEVICE_TABLE(vio, viodasd_device_table); 753MODULE_DEVICE_TABLE(vio, viodasd_device_table);
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c
index c0f817ba7adb..af6b3bfd169b 100644
--- a/drivers/cdrom/viocd.c
+++ b/drivers/cdrom/viocd.c
@@ -731,7 +731,7 @@ static int viocd_remove(struct vio_dev *vdev)
731 * support. 731 * support.
732 */ 732 */
733static struct vio_device_id viocd_device_table[] __devinitdata = { 733static struct vio_device_id viocd_device_table[] __devinitdata = {
734 { "viocd", "" }, 734 { "block", "IBM,iSeries-viocd" },
735 { "", "" } 735 { "", "" }
736}; 736};
737MODULE_DEVICE_TABLE(vio, viocd_device_table); 737MODULE_DEVICE_TABLE(vio, viocd_device_table);
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index 2b6a56b2bf35..a5c6a9d7ff08 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -553,7 +553,6 @@ static int hvc_chars_in_buffer(struct tty_struct *tty)
553 553
554#define HVC_POLL_READ 0x00000001 554#define HVC_POLL_READ 0x00000001
555#define HVC_POLL_WRITE 0x00000002 555#define HVC_POLL_WRITE 0x00000002
556#define HVC_POLL_QUICK 0x00000004
557 556
558static int hvc_poll(struct hvc_struct *hp) 557static int hvc_poll(struct hvc_struct *hp)
559{ 558{
@@ -568,6 +567,7 @@ static int hvc_poll(struct hvc_struct *hp)
568 /* Push pending writes */ 567 /* Push pending writes */
569 if (hp->n_outbuf > 0) 568 if (hp->n_outbuf > 0)
570 hvc_push(hp); 569 hvc_push(hp);
570
571 /* Reschedule us if still some write pending */ 571 /* Reschedule us if still some write pending */
572 if (hp->n_outbuf > 0) 572 if (hp->n_outbuf > 0)
573 poll_mask |= HVC_POLL_WRITE; 573 poll_mask |= HVC_POLL_WRITE;
@@ -680,7 +680,7 @@ int khvcd(void *unused)
680 poll_mask |= HVC_POLL_READ; 680 poll_mask |= HVC_POLL_READ;
681 if (hvc_kicked) 681 if (hvc_kicked)
682 continue; 682 continue;
683 if (poll_mask & HVC_POLL_QUICK) { 683 if (poll_mask & HVC_POLL_WRITE) {
684 yield(); 684 yield();
685 continue; 685 continue;
686 } 686 }
diff --git a/drivers/char/hvc_rtas.c b/drivers/char/hvc_rtas.c
index 83364ea63cba..57106e02fd2e 100644
--- a/drivers/char/hvc_rtas.c
+++ b/drivers/char/hvc_rtas.c
@@ -41,37 +41,28 @@
41#define hvc_rtas_cookie 0x67781e15 41#define hvc_rtas_cookie 0x67781e15
42struct hvc_struct *hvc_rtas_dev; 42struct hvc_struct *hvc_rtas_dev;
43 43
44#define RTASCONS_PUT_ATTEMPTS 16
45
46static int rtascons_put_char_token = RTAS_UNKNOWN_SERVICE; 44static int rtascons_put_char_token = RTAS_UNKNOWN_SERVICE;
47static int rtascons_get_char_token = RTAS_UNKNOWN_SERVICE; 45static int rtascons_get_char_token = RTAS_UNKNOWN_SERVICE;
48static int rtascons_put_delay = 100;
49module_param_named(put_delay, rtascons_put_delay, int, 0644);
50 46
51static inline int hvc_rtas_write_console(uint32_t vtermno, const char *buf, int count) 47static inline int hvc_rtas_write_console(uint32_t vtermno, const char *buf,
48 int count)
52{ 49{
53 int done; 50 int i;
54 51
55 /* if there is more than one character to be displayed, wait a bit */ 52 for (i = 0; i < count; i++) {
56 for (done = 0; done < count; done++) { 53 if (rtas_call(rtascons_put_char_token, 1, 1, NULL, buf[i]))
57 int result;
58 result = rtas_call(rtascons_put_char_token, 1, 1, NULL, buf[done]);
59 if (result)
60 break; 54 break;
61 } 55 }
62 /* the calling routine expects to receive the number of bytes sent */ 56
63 return done; 57 return i;
64} 58}
65 59
66static int hvc_rtas_read_console(uint32_t vtermno, char *buf, int count) 60static int hvc_rtas_read_console(uint32_t vtermno, char *buf, int count)
67{ 61{
68 int i; 62 int i, c;
69 63
70 for (i = 0; i < count; i++) { 64 for (i = 0; i < count; i++) {
71 int c, err; 65 if (rtas_call(rtascons_get_char_token, 0, 2, &c))
72
73 err = rtas_call(rtascons_get_char_token, 0, 2, &c);
74 if (err)
75 break; 66 break;
76 67
77 buf[i] = c; 68 buf[i] = c;
@@ -106,7 +97,9 @@ static int hvc_rtas_init(void)
106 hp = hvc_alloc(hvc_rtas_cookie, NO_IRQ, &hvc_rtas_get_put_ops); 97 hp = hvc_alloc(hvc_rtas_cookie, NO_IRQ, &hvc_rtas_get_put_ops);
107 if (IS_ERR(hp)) 98 if (IS_ERR(hp))
108 return PTR_ERR(hp); 99 return PTR_ERR(hp);
100
109 hvc_rtas_dev = hp; 101 hvc_rtas_dev = hp;
102
110 return 0; 103 return 0;
111} 104}
112module_init(hvc_rtas_init); 105module_init(hvc_rtas_init);
@@ -114,8 +107,8 @@ module_init(hvc_rtas_init);
114/* This will tear down the tty portion of the driver */ 107/* This will tear down the tty portion of the driver */
115static void __exit hvc_rtas_exit(void) 108static void __exit hvc_rtas_exit(void)
116{ 109{
117 /* Really the fun isn't over until the worker thread breaks down and the 110 /* Really the fun isn't over until the worker thread breaks down and
118 * tty cleans up */ 111 * the tty cleans up */
119 if (hvc_rtas_dev) 112 if (hvc_rtas_dev)
120 hvc_remove(hvc_rtas_dev); 113 hvc_remove(hvc_rtas_dev);
121} 114}
@@ -127,12 +120,14 @@ static int hvc_rtas_console_init(void)
127 rtascons_put_char_token = rtas_token("put-term-char"); 120 rtascons_put_char_token = rtas_token("put-term-char");
128 if (rtascons_put_char_token == RTAS_UNKNOWN_SERVICE) 121 if (rtascons_put_char_token == RTAS_UNKNOWN_SERVICE)
129 return -EIO; 122 return -EIO;
123
130 rtascons_get_char_token = rtas_token("get-term-char"); 124 rtascons_get_char_token = rtas_token("get-term-char");
131 if (rtascons_get_char_token == RTAS_UNKNOWN_SERVICE) 125 if (rtascons_get_char_token == RTAS_UNKNOWN_SERVICE)
132 return -EIO; 126 return -EIO;
133 127
134 hvc_instantiate(hvc_rtas_cookie, 0, &hvc_rtas_get_put_ops ); 128 hvc_instantiate(hvc_rtas_cookie, 0, &hvc_rtas_get_put_ops);
135 add_preferred_console("hvc", 0, NULL); 129 add_preferred_console("hvc", 0, NULL);
130
136 return 0; 131 return 0;
137} 132}
138console_initcall(hvc_rtas_console_init); 133console_initcall(hvc_rtas_console_init);
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c
index a9522189fc9e..a0370ed752ce 100644
--- a/drivers/char/hvsi.c
+++ b/drivers/char/hvsi.c
@@ -1179,7 +1179,7 @@ static int __init hvsi_init(void)
1179 if (tty_register_driver(hvsi_driver)) 1179 if (tty_register_driver(hvsi_driver))
1180 panic("Couldn't register hvsi console driver\n"); 1180 panic("Couldn't register hvsi console driver\n");
1181 1181
1182 printk(KERN_INFO "HVSI: registered %i devices\n", hvsi_count); 1182 printk(KERN_DEBUG "HVSI: registered %i devices\n", hvsi_count);
1183 1183
1184 return 0; 1184 return 0;
1185} 1185}
diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c
index 60aabdb4a046..11c7e9de5958 100644
--- a/drivers/char/viotape.c
+++ b/drivers/char/viotape.c
@@ -989,7 +989,7 @@ static int viotape_remove(struct vio_dev *vdev)
989 * support. 989 * support.
990 */ 990 */
991static struct vio_device_id viotape_device_table[] __devinitdata = { 991static struct vio_device_id viotape_device_table[] __devinitdata = {
992 { "viotape", "" }, 992 { "byte", "IBM,iSeries-viotape" },
993 { "", "" } 993 { "", "" }
994}; 994};
995MODULE_DEVICE_TABLE(vio, viotape_device_table); 995MODULE_DEVICE_TABLE(vio, viotape_device_table);
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index f7af7e9bb7d9..884320e70403 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -255,12 +255,12 @@ config I2C_POWERMAC
255 will be called i2c-powermac. 255 will be called i2c-powermac.
256 256
257config I2C_MPC 257config I2C_MPC
258 tristate "MPC107/824x/85xx/52xx" 258 tristate "MPC107/824x/85xx/52xx/86xx"
259 depends on I2C && PPC32 259 depends on I2C && PPC32
260 help 260 help
261 If you say yes to this option, support will be included for the 261 If you say yes to this option, support will be included for the
262 built-in I2C interface on the MPC107/Tsi107/MPC8240/MPC8245 and 262 built-in I2C interface on the MPC107/Tsi107/MPC8240/MPC8245 and
263 MPC85xx family processors. The driver may also work on 52xx 263 MPC85xx/MPC8641 family processors. The driver may also work on 52xx
264 family processors, though interrupts are known not to work. 264 family processors, though interrupts are known not to work.
265 265
266 This driver can also be built as a module. If so, the module 266 This driver can also be built as a module. If so, the module
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 0b5ff553e39a..c63d4e7984be 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -2268,7 +2268,7 @@ static int powerbook_sleep_grackle(void)
2268 _set_L2CR(save_l2cr); 2268 _set_L2CR(save_l2cr);
2269 2269
2270 /* Restore userland MMU context */ 2270 /* Restore userland MMU context */
2271 set_context(current->active_mm->context, current->active_mm->pgd); 2271 set_context(current->active_mm->context.id, current->active_mm->pgd);
2272 2272
2273 /* Power things up */ 2273 /* Power things up */
2274 pmu_unlock(); 2274 pmu_unlock();
@@ -2366,7 +2366,7 @@ powerbook_sleep_Core99(void)
2366 _set_L3CR(save_l3cr); 2366 _set_L3CR(save_l3cr);
2367 2367
2368 /* Restore userland MMU context */ 2368 /* Restore userland MMU context */
2369 set_context(current->active_mm->context, current->active_mm->pgd); 2369 set_context(current->active_mm->context.id, current->active_mm->pgd);
2370 2370
2371 /* Tell PMU we are ready */ 2371 /* Tell PMU we are ready */
2372 pmu_unlock(); 2372 pmu_unlock();
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 0c6b45a11d15..c3c1a8d5f7a3 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2190,7 +2190,7 @@ config BNX2
2190 2190
2191config SPIDER_NET 2191config SPIDER_NET
2192 tristate "Spider Gigabit Ethernet driver" 2192 tristate "Spider Gigabit Ethernet driver"
2193 depends on PCI && PPC_CELL 2193 depends on PCI && PPC_IBM_CELL_BLADE
2194 select FW_LOADER 2194 select FW_LOADER
2195 help 2195 help
2196 This driver supports the Gigabit Ethernet chips present on the 2196 This driver supports the Gigabit Ethernet chips present on the
@@ -2198,11 +2198,11 @@ config SPIDER_NET
2198 2198
2199config GIANFAR 2199config GIANFAR
2200 tristate "Gianfar Ethernet" 2200 tristate "Gianfar Ethernet"
2201 depends on 85xx || 83xx 2201 depends on 85xx || 83xx || PPC_86xx
2202 select PHYLIB 2202 select PHYLIB
2203 help 2203 help
2204 This driver supports the Gigabit TSEC on the MPC85xx 2204 This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx,
2205 family of chips, and the FEC on the 8540 2205 and MPC86xx family of chips, and the FEC on the 8540.
2206 2206
2207config GFAR_NAPI 2207config GFAR_NAPI
2208 bool "NAPI Support" 2208 bool "NAPI Support"
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index 666346f6469e..4c2e7279ba34 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -61,7 +61,7 @@
61#undef DEBUG 61#undef DEBUG
62 62
63#define ibmveth_printk(fmt, args...) \ 63#define ibmveth_printk(fmt, args...) \
64 printk(KERN_INFO "%s: " fmt, __FILE__, ## args) 64 printk(KERN_DEBUG "%s: " fmt, __FILE__, ## args)
65 65
66#define ibmveth_error_printk(fmt, args...) \ 66#define ibmveth_error_printk(fmt, args...) \
67 printk(KERN_ERR "(%s:%3.3d ua:%x) ERROR: " fmt, __FILE__, __LINE__ , adapter->vdev->unit_address, ## args) 67 printk(KERN_ERR "(%s:%3.3d ua:%x) ERROR: " fmt, __FILE__, __LINE__ , adapter->vdev->unit_address, ## args)
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c
index f0f04be989d6..93394d76587a 100644
--- a/drivers/net/iseries_veth.c
+++ b/drivers/net/iseries_veth.c
@@ -69,6 +69,7 @@
69#include <linux/delay.h> 69#include <linux/delay.h>
70#include <linux/mm.h> 70#include <linux/mm.h>
71#include <linux/ethtool.h> 71#include <linux/ethtool.h>
72#include <linux/if_ether.h>
72 73
73#include <asm/abs_addr.h> 74#include <asm/abs_addr.h>
74#include <asm/iseries/mf.h> 75#include <asm/iseries/mf.h>
@@ -1035,11 +1036,22 @@ static struct ethtool_ops ops = {
1035 .get_link = veth_get_link, 1036 .get_link = veth_get_link,
1036}; 1037};
1037 1038
1038static struct net_device * __init veth_probe_one(int vlan, struct device *vdev) 1039static struct net_device * __init veth_probe_one(int vlan,
1040 struct vio_dev *vio_dev)
1039{ 1041{
1040 struct net_device *dev; 1042 struct net_device *dev;
1041 struct veth_port *port; 1043 struct veth_port *port;
1044 struct device *vdev = &vio_dev->dev;
1042 int i, rc; 1045 int i, rc;
1046 const unsigned char *mac_addr;
1047
1048 mac_addr = vio_get_attribute(vio_dev, "local-mac-address", NULL);
1049 if (mac_addr == NULL)
1050 mac_addr = vio_get_attribute(vio_dev, "mac-address", NULL);
1051 if (mac_addr == NULL) {
1052 veth_error("Unable to fetch MAC address from device tree.\n");
1053 return NULL;
1054 }
1043 1055
1044 dev = alloc_etherdev(sizeof (struct veth_port)); 1056 dev = alloc_etherdev(sizeof (struct veth_port));
1045 if (! dev) { 1057 if (! dev) {
@@ -1064,16 +1076,11 @@ static struct net_device * __init veth_probe_one(int vlan, struct device *vdev)
1064 } 1076 }
1065 port->dev = vdev; 1077 port->dev = vdev;
1066 1078
1067 dev->dev_addr[0] = 0x02; 1079 memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
1068 dev->dev_addr[1] = 0x01;
1069 dev->dev_addr[2] = 0xff;
1070 dev->dev_addr[3] = vlan;
1071 dev->dev_addr[4] = 0xff;
1072 dev->dev_addr[5] = this_lp;
1073 1080
1074 dev->mtu = VETH_MAX_MTU; 1081 dev->mtu = VETH_MAX_MTU;
1075 1082
1076 memcpy(&port->mac_addr, dev->dev_addr, 6); 1083 memcpy(&port->mac_addr, mac_addr, ETH_ALEN);
1077 1084
1078 dev->open = veth_open; 1085 dev->open = veth_open;
1079 dev->hard_start_xmit = veth_start_xmit; 1086 dev->hard_start_xmit = veth_start_xmit;
@@ -1608,7 +1615,7 @@ static int veth_probe(struct vio_dev *vdev, const struct vio_device_id *id)
1608 struct net_device *dev; 1615 struct net_device *dev;
1609 struct veth_port *port; 1616 struct veth_port *port;
1610 1617
1611 dev = veth_probe_one(i, &vdev->dev); 1618 dev = veth_probe_one(i, vdev);
1612 if (dev == NULL) { 1619 if (dev == NULL) {
1613 veth_remove(vdev); 1620 veth_remove(vdev);
1614 return 1; 1621 return 1;
@@ -1641,7 +1648,7 @@ static int veth_probe(struct vio_dev *vdev, const struct vio_device_id *id)
1641 * support. 1648 * support.
1642 */ 1649 */
1643static struct vio_device_id veth_device_table[] __devinitdata = { 1650static struct vio_device_id veth_device_table[] __devinitdata = {
1644 { "vlan", "" }, 1651 { "network", "IBM,iSeries-l-lan" },
1645 { "", "" } 1652 { "", "" }
1646}; 1653};
1647MODULE_DEVICE_TABLE(vio, veth_device_table); 1654MODULE_DEVICE_TABLE(vio, veth_device_table);
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index cda3e53d6917..2ba6d3a40e2e 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -44,6 +44,11 @@ config CICADA_PHY
44 depends on PHYLIB 44 depends on PHYLIB
45 ---help--- 45 ---help---
46 Currently supports the cis8204 46 Currently supports the cis8204
47config VITESSE_PHY
48 tristate "Drivers for the Vitesse PHYs"
49 depends on PHYLIB
50 ---help---
51 Currently supports the vsc8244
47 52
48config SMSC_PHY 53config SMSC_PHY
49 tristate "Drivers for SMSC PHYs" 54 tristate "Drivers for SMSC PHYs"
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index d9614134cc06..a00e61942525 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -9,3 +9,4 @@ obj-$(CONFIG_CICADA_PHY) += cicada.o
9obj-$(CONFIG_LXT_PHY) += lxt.o 9obj-$(CONFIG_LXT_PHY) += lxt.o
10obj-$(CONFIG_QSEMI_PHY) += qsemi.o 10obj-$(CONFIG_QSEMI_PHY) += qsemi.o
11obj-$(CONFIG_SMSC_PHY) += smsc.o 11obj-$(CONFIG_SMSC_PHY) += smsc.o
12obj-$(CONFIG_VITESSE_PHY) += vitesse.o
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c
new file mode 100644
index 000000000000..ffd215d9a9be
--- /dev/null
+++ b/drivers/net/phy/vitesse.c
@@ -0,0 +1,112 @@
1/*
2 * Driver for Vitesse PHYs
3 *
4 * Author: Kriston Carson
5 *
6 * Copyright (c) 2005 Freescale Semiconductor, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#include <linux/config.h>
16#include <linux/kernel.h>
17#include <linux/module.h>
18#include <linux/mii.h>
19#include <linux/ethtool.h>
20#include <linux/phy.h>
21
22/* Vitesse Extended Control Register 1 */
23#define MII_VSC8244_EXT_CON1 0x17
24#define MII_VSC8244_EXTCON1_INIT 0x0000
25
26/* Vitesse Interrupt Mask Register */
27#define MII_VSC8244_IMASK 0x19
28#define MII_VSC8244_IMASK_IEN 0x8000
29#define MII_VSC8244_IMASK_SPEED 0x4000
30#define MII_VSC8244_IMASK_LINK 0x2000
31#define MII_VSC8244_IMASK_DUPLEX 0x1000
32#define MII_VSC8244_IMASK_MASK 0xf000
33
34/* Vitesse Interrupt Status Register */
35#define MII_VSC8244_ISTAT 0x1a
36#define MII_VSC8244_ISTAT_STATUS 0x8000
37#define MII_VSC8244_ISTAT_SPEED 0x4000
38#define MII_VSC8244_ISTAT_LINK 0x2000
39#define MII_VSC8244_ISTAT_DUPLEX 0x1000
40
41/* Vitesse Auxiliary Control/Status Register */
42#define MII_VSC8244_AUX_CONSTAT 0x1c
43#define MII_VSC8244_AUXCONSTAT_INIT 0x0004
44#define MII_VSC8244_AUXCONSTAT_DUPLEX 0x0020
45#define MII_VSC8244_AUXCONSTAT_SPEED 0x0018
46#define MII_VSC8244_AUXCONSTAT_GBIT 0x0010
47#define MII_VSC8244_AUXCONSTAT_100 0x0008
48
49MODULE_DESCRIPTION("Vitesse PHY driver");
50MODULE_AUTHOR("Kriston Carson");
51MODULE_LICENSE("GPL");
52
53static int vsc824x_config_init(struct phy_device *phydev)
54{
55 int err;
56
57 err = phy_write(phydev, MII_VSC8244_AUX_CONSTAT,
58 MII_VSC8244_AUXCONSTAT_INIT);
59 if (err < 0)
60 return err;
61
62 err = phy_write(phydev, MII_VSC8244_EXT_CON1,
63 MII_VSC8244_EXTCON1_INIT);
64 return err;
65}
66
67static int vsc824x_ack_interrupt(struct phy_device *phydev)
68{
69 int err = phy_read(phydev, MII_VSC8244_ISTAT);
70
71 return (err < 0) ? err : 0;
72}
73
74static int vsc824x_config_intr(struct phy_device *phydev)
75{
76 int err;
77
78 if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
79 err = phy_write(phydev, MII_VSC8244_IMASK,
80 MII_VSC8244_IMASK_MASK);
81 else
82 err = phy_write(phydev, MII_VSC8244_IMASK, 0);
83 return err;
84}
85
86/* Vitesse 824x */
87static struct phy_driver vsc8244_driver = {
88 .phy_id = 0x000fc6c2,
89 .name = "Vitesse VSC8244",
90 .phy_id_mask = 0x000fffc0,
91 .features = PHY_GBIT_FEATURES,
92 .flags = PHY_HAS_INTERRUPT,
93 .config_init = &vsc824x_config_init,
94 .config_aneg = &genphy_config_aneg,
95 .read_status = &genphy_read_status,
96 .ack_interrupt = &vsc824x_ack_interrupt,
97 .config_intr = &vsc824x_config_intr,
98 .driver = { .owner = THIS_MODULE,},
99};
100
101static int __init vsc8244_init(void)
102{
103 return phy_driver_register(&vsc8244_driver);
104}
105
106static void __exit vsc8244_exit(void)
107{
108 phy_driver_unregister(&vsc8244_driver);
109}
110
111module_init(vsc8244_init);
112module_exit(vsc8244_exit);