3 #include <linux/kernel.h>
4 #include <linux/string.h>
6 #include <linux/ptrace.h>
7 #include <linux/errno.h>
11 #include <linux/if_arp.h>
12 #include <linux/netdevice.h>
16 #include <linux/bitops.h>
18 #include <asm/processor.h>
22 #include <asm/uaccess.h>
29 #define CONFIG_LMC_IGNORE_HARDWARE_HANDSHAKE 1
57 static void lmc_ds3_set_100ft (
lmc_softc_t *
const,
int);
58 static int lmc_ds3_get_link_status (
lmc_softc_t *
const);
59 static void lmc_ds3_set_crc_length (
lmc_softc_t *
const,
int);
60 static void lmc_ds3_set_scram (
lmc_softc_t *
const,
int);
66 static void lmc_hssi_set_clock (
lmc_softc_t *
const,
int);
67 static int lmc_hssi_get_link_status (
lmc_softc_t *
const);
68 static void lmc_hssi_set_link_status (
lmc_softc_t *
const,
int);
69 static void lmc_hssi_set_crc_length (
lmc_softc_t *
const,
int);
70 static void lmc_hssi_watchdog (
lmc_softc_t *
const);
75 static void lmc_ssi_set_clock (
lmc_softc_t *
const,
int);
77 static int lmc_ssi_get_link_status (
lmc_softc_t *
const);
78 static void lmc_ssi_set_link_status (
lmc_softc_t *
const,
int);
79 static void lmc_ssi_set_crc_length (
lmc_softc_t *
const,
int);
85 static int lmc_t1_get_link_status (
lmc_softc_t *
const);
86 static void lmc_t1_set_circuit_type (
lmc_softc_t *
const,
int);
87 static void lmc_t1_set_crc_length (
lmc_softc_t *
const,
int);
88 static void lmc_t1_set_clock (
lmc_softc_t *
const,
int);
91 static void lmc_dummy_set_1 (
lmc_softc_t *
const,
int);
94 static inline void write_av9110_bit (
lmc_softc_t *,
int);
105 lmc_ds3_get_link_status,
107 lmc_ds3_set_crc_length,
120 lmc_hssi_get_link_status,
121 lmc_hssi_set_link_status,
122 lmc_hssi_set_crc_length,
134 lmc_ssi_get_link_status,
135 lmc_ssi_set_link_status,
136 lmc_ssi_set_crc_length,
149 lmc_t1_get_link_status,
151 lmc_t1_set_crc_length,
152 lmc_t1_set_circuit_type,
198 lmc_set_protocol (sc,
NULL);
217 lmc_set_protocol (sc, ctl);
224 lmc_hssi_set_clock (
lmc_softc_t *
const sc,
int ie)
257 return lmc_ssi_get_link_status(sc);
275 lmc_hssi_set_crc_length (
lmc_softc_t *
const sc,
int state)
344 lmc_set_protocol (sc,
NULL);
365 lmc_set_protocol (sc, ctl);
376 for (i = 0; i < 21; i++)
393 for (i = 0; i < 21; i++)
510 lmc_ds3_set_crc_length (
lmc_softc_t *
const sc,
int state)
581 lmc_set_protocol (sc,
NULL);
605 lmc_set_protocol (sc, ctl);
657 write_av9110 (sc, av->
n, av->
m, av->
v, av->
x, av->
r);
669 write_av9110 (sc, av->
n, av->
m, av->
v, av->
x, av->
r);
708 ticks = 0x0000ffff - (ticks & 0x0000ffff);
716 else if (ticks == 0 ) {
737 #ifdef CONFIG_LMC_IGNORE_HARDWARE_HANDSHAKE
765 lmc_ssi_set_link_status (
lmc_softc_t *
const sc,
int state)
786 lmc_ssi_set_crc_length (
lmc_softc_t *
const sc,
int state)
862 for (i = 0; i < 7; i++)
863 write_av9110_bit (sc, n >> i);
864 for (i = 0; i < 7; i++)
865 write_av9110_bit (sc, m >> i);
866 for (i = 0; i < 1; i++)
867 write_av9110_bit (sc, v >> i);
868 for (i = 0; i < 2; i++)
869 write_av9110_bit (sc, x >> i);
870 for (i = 0; i < 2; i++)
871 write_av9110_bit (sc, r >> i);
872 for (i = 0; i < 5; i++)
873 write_av9110_bit (sc, 0x17 >> i);
883 static void lmc_ssi_watchdog(
lmc_softc_t *
const sc)
886 if (((mii17 >> 3) & 7) == 7)
935 lmc_t1_write (sc, 0x01, 0x1B);
936 lmc_t1_write (sc, 0x02, 0x42);
937 lmc_t1_write (sc, 0x14, 0x00);
938 lmc_t1_write (sc, 0x15, 0x00);
939 lmc_t1_write (sc, 0x18, 0xFF);
940 lmc_t1_write (sc, 0x19, 0x30);
941 lmc_t1_write (sc, 0x1A, 0x0F);
942 lmc_t1_write (sc, 0x20, 0x41);
943 lmc_t1_write (sc, 0x22, 0x76);
944 lmc_t1_write (sc, 0x40, 0x03);
945 lmc_t1_write (sc, 0x45, 0x00);
946 lmc_t1_write (sc, 0x46, 0x05);
947 lmc_t1_write (sc, 0x68, 0x40);
948 lmc_t1_write (sc, 0x70, 0x0D);
949 lmc_t1_write (sc, 0x71, 0x05);
950 lmc_t1_write (sc, 0x72, 0x0B);
951 lmc_t1_write (sc, 0x73, 0x00);
952 lmc_t1_write (sc, 0x74, 0x00);
953 lmc_t1_write (sc, 0x75, 0x00);
954 lmc_t1_write (sc, 0x76, 0x00);
955 lmc_t1_write (sc, 0x77, 0x00);
956 lmc_t1_write (sc, 0x90, 0x05);
957 lmc_t1_write (sc, 0x91, 0x05);
958 lmc_t1_write (sc, 0xA6, 0x00);
959 lmc_t1_write (sc, 0xB1, 0x00);
960 lmc_t1_write (sc, 0xD0, 0x47);
961 lmc_t1_write (sc, 0xD1, 0x70);
962 lmc_t1_write (sc, 0xD4, 0x30);
963 for (i = 0; i < 32; i++)
965 lmc_t1_write (sc, 0x0E0 + i, 0x00);
966 lmc_t1_write (sc, 0x100 + i, 0x00);
967 lmc_t1_write (sc, 0x180 + i, 0x00);
969 for (i = 1; i < 25; i++)
971 lmc_t1_write (sc, 0x0E0 + i, 0x0D);
997 lmc_set_protocol (sc,
NULL);
1010 lmc_set_protocol (sc, ctl);
1114 if( ! (link_status & T1F_RLOF))
1134 lmc_t1_set_circuit_type (
lmc_softc_t *
const sc,
int ie)
1154 lmc_t1_set_crc_length (
lmc_softc_t *
const sc,
int state)