WAN: Port LMC driver to generic HDLC

Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
This commit is contained in:
Krzysztof Hałasa
2008-07-02 20:46:21 +02:00
parent 52e8a6a2d8
commit 64bef7630a
8 changed files with 364 additions and 652 deletions

View File

@ -425,7 +425,7 @@ lmc_ds3_set_scram (lmc_softc_t * const sc, int ie)
static int
lmc_ds3_get_link_status (lmc_softc_t * const sc)
{
u_int16_t link_status, link_status_11;
u16 link_status, link_status_11;
int ret = 1;
lmc_mii_writereg (sc, 0, 17, 7);
@ -447,7 +447,7 @@ lmc_ds3_get_link_status (lmc_softc_t * const sc)
(link_status & LMC_FRAMER_REG0_OOFS)){
ret = 0;
if(sc->last_led_err[3] != 1){
u16 r1;
u16 r1;
lmc_mii_writereg (sc, 0, 17, 01); /* Turn on Xbit error as our cisco does */
r1 = lmc_mii_readreg (sc, 0, 18);
r1 &= 0xfe;
@ -460,7 +460,7 @@ lmc_ds3_get_link_status (lmc_softc_t * const sc)
else {
lmc_led_off(sc, LMC_DS3_LED3); /* turn on red LED */
if(sc->last_led_err[3] == 1){
u16 r1;
u16 r1;
lmc_mii_writereg (sc, 0, 17, 01); /* Turn off Xbit error */
r1 = lmc_mii_readreg (sc, 0, 18);
r1 |= 0x01;
@ -538,20 +538,19 @@ lmc_ds3_watchdog (lmc_softc_t * const sc)
* SSI methods
*/
static void
lmc_ssi_init (lmc_softc_t * const sc)
static void lmc_ssi_init(lmc_softc_t * const sc)
{
u_int16_t mii17;
int cable;
u16 mii17;
int cable;
sc->ictl.cardtype = LMC_CTL_CARDTYPE_LMC1000;
sc->ictl.cardtype = LMC_CTL_CARDTYPE_LMC1000;
mii17 = lmc_mii_readreg (sc, 0, 17);
mii17 = lmc_mii_readreg(sc, 0, 17);
cable = (mii17 & LMC_MII17_SSI_CABLE_MASK) >> LMC_MII17_SSI_CABLE_SHIFT;
sc->ictl.cable_type = cable;
cable = (mii17 & LMC_MII17_SSI_CABLE_MASK) >> LMC_MII17_SSI_CABLE_SHIFT;
sc->ictl.cable_type = cable;
lmc_gpio_mkoutput (sc, LMC_GEP_SSI_TXCLOCK);
lmc_gpio_mkoutput(sc, LMC_GEP_SSI_TXCLOCK);
}
static void
@ -679,11 +678,11 @@ lmc_ssi_set_speed (lmc_softc_t * const sc, lmc_ctl_t * ctl)
static int
lmc_ssi_get_link_status (lmc_softc_t * const sc)
{
u_int16_t link_status;
u16 link_status;
u_int32_t ticks;
int ret = 1;
int hw_hdsk = 1;
/*
* missing CTS? Hmm. If we require CTS on, we may never get the
* link to come up, so omit it in this test.
@ -718,9 +717,9 @@ lmc_ssi_get_link_status (lmc_softc_t * const sc)
}
else if (ticks == 0 ) { /* no clock found ? */
ret = 0;
if(sc->last_led_err[3] != 1){
sc->stats.tx_lossOfClockCnt++;
printk(KERN_WARNING "%s: Lost Clock, Link Down\n", sc->name);
if (sc->last_led_err[3] != 1) {
sc->extra_stats.tx_lossOfClockCnt++;
printk(KERN_WARNING "%s: Lost Clock, Link Down\n", sc->name);
}
sc->last_led_err[3] = 1;
lmc_led_on (sc, LMC_MII16_LED3); /* turn ON red LED */
@ -885,19 +884,13 @@ write_av9110 (lmc_softc_t * sc, u_int32_t n, u_int32_t m, u_int32_t v,
| LMC_GEP_SSI_GENERATOR));
}
static void
lmc_ssi_watchdog (lmc_softc_t * const sc)
static void lmc_ssi_watchdog(lmc_softc_t * const sc)
{
u_int16_t mii17 = lmc_mii_readreg (sc, 0, 17);
if (((mii17 >> 3) & 7) == 7)
{
lmc_led_off (sc, LMC_MII16_LED2);
}
else
{
lmc_led_on (sc, LMC_MII16_LED2);
}
u16 mii17 = lmc_mii_readreg(sc, 0, 17);
if (((mii17 >> 3) & 7) == 7)
lmc_led_off(sc, LMC_MII16_LED2);
else
lmc_led_on(sc, LMC_MII16_LED2);
}
/*
@ -927,7 +920,7 @@ lmc_t1_read (lmc_softc_t * const sc, int a)
static void
lmc_t1_init (lmc_softc_t * const sc)
{
u_int16_t mii16;
u16 mii16;
int i;
sc->ictl.cardtype = LMC_CTL_CARDTYPE_LMC1200;
@ -1026,7 +1019,7 @@ lmc_t1_set_status (lmc_softc_t * const sc, lmc_ctl_t * ctl)
*/ static int
lmc_t1_get_link_status (lmc_softc_t * const sc)
{
u_int16_t link_status;
u16 link_status;
int ret = 1;
/* LMC5245 (DS3) & LMC1200 (DS1) LED definitions