| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: elan520.c,v 1.42 2009/04/29 23:50:53 dyoung Exp $ */ | | 1 | /* $NetBSD: elan520.c,v 1.43 2009/09/17 20:21:54 dyoung Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2002 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2002 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe. | | 8 | * by Jason R. Thorpe. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -30,27 +30,27 @@ | | | @@ -30,27 +30,27 @@ |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | /* | | 32 | /* |
33 | * Device driver for the AMD Elan SC520 System Controller. This attaches | | 33 | * Device driver for the AMD Elan SC520 System Controller. This attaches |
34 | * where the "pchb" driver might normally attach, and provides support for | | 34 | * where the "pchb" driver might normally attach, and provides support for |
35 | * extra features on the SC520, such as the watchdog timer and GPIO. | | 35 | * extra features on the SC520, such as the watchdog timer and GPIO. |
36 | * | | 36 | * |
37 | * Information about the GP bus echo bug work-around is from code posted | | 37 | * Information about the GP bus echo bug work-around is from code posted |
38 | * to the "soekris-tech" mailing list by Jasper Wallace. | | 38 | * to the "soekris-tech" mailing list by Jasper Wallace. |
39 | */ | | 39 | */ |
40 | | | 40 | |
41 | #include <sys/cdefs.h> | | 41 | #include <sys/cdefs.h> |
42 | | | 42 | |
43 | __KERNEL_RCSID(0, "$NetBSD: elan520.c,v 1.42 2009/04/29 23:50:53 dyoung Exp $"); | | 43 | __KERNEL_RCSID(0, "$NetBSD: elan520.c,v 1.43 2009/09/17 20:21:54 dyoung Exp $"); |
44 | | | 44 | |
45 | #include <sys/param.h> | | 45 | #include <sys/param.h> |
46 | #include <sys/systm.h> | | 46 | #include <sys/systm.h> |
47 | #include <sys/time.h> | | 47 | #include <sys/time.h> |
48 | #include <sys/device.h> | | 48 | #include <sys/device.h> |
49 | #include <sys/gpio.h> | | 49 | #include <sys/gpio.h> |
50 | #include <sys/mutex.h> | | 50 | #include <sys/mutex.h> |
51 | #include <sys/wdog.h> | | 51 | #include <sys/wdog.h> |
52 | #include <sys/reboot.h> | | 52 | #include <sys/reboot.h> |
53 | | | 53 | |
54 | #include <uvm/uvm_extern.h> | | 54 | #include <uvm/uvm_extern.h> |
55 | | | 55 | |
56 | #include <machine/bus.h> | | 56 | #include <machine/bus.h> |
| @@ -1252,27 +1252,26 @@ elanpar_detach(device_t self, int flags) | | | @@ -1252,27 +1252,26 @@ elanpar_detach(device_t self, int flags) |
1252 | elanpar_intr_disestablish(sc); | | 1252 | elanpar_intr_disestablish(sc); |
1253 | | | 1253 | |
1254 | return 0; | | 1254 | return 0; |
1255 | } | | 1255 | } |
1256 | | | 1256 | |
1257 | static void | | 1257 | static void |
1258 | elansc_attach(device_t parent, device_t self, void *aux) | | 1258 | elansc_attach(device_t parent, device_t self, void *aux) |
1259 | { | | 1259 | { |
1260 | struct elansc_softc *sc = device_private(self); | | 1260 | struct elansc_softc *sc = device_private(self); |
1261 | struct pcibus_attach_args *pba = aux; | | 1261 | struct pcibus_attach_args *pba = aux; |
1262 | uint16_t rev; | | 1262 | uint16_t rev; |
1263 | uint8_t cpuctl, picicr, ressta; | | 1263 | uint8_t cpuctl, picicr, ressta; |
1264 | #if NGPIO > 0 | | 1264 | #if NGPIO > 0 |
1265 | struct gpiobus_attach_args gba; | | | |
1266 | int pin, reg, shift; | | 1265 | int pin, reg, shift; |
1267 | uint16_t data; | | 1266 | uint16_t data; |
1268 | #endif | | 1267 | #endif |
1269 | | | 1268 | |
1270 | sc->sc_dev = self; | | 1269 | sc->sc_dev = self; |
1271 | | | 1270 | |
1272 | sc->sc_pc = pba->pba_pc; | | 1271 | sc->sc_pc = pba->pba_pc; |
1273 | sc->sc_pciflags = pba->pba_flags; | | 1272 | sc->sc_pciflags = pba->pba_flags; |
1274 | sc->sc_dmat = pba->pba_dmat; | | 1273 | sc->sc_dmat = pba->pba_dmat; |
1275 | sc->sc_dmat64 = pba->pba_dmat64; | | 1274 | sc->sc_dmat64 = pba->pba_dmat64; |
1276 | sc->sc_tag = pci_make_tag(sc->sc_pc, 0, 0, 0); | | 1275 | sc->sc_tag = pci_make_tag(sc->sc_pc, 0, 0, 0); |
1277 | | | 1276 | |
1278 | aprint_naive(": System Controller\n"); | | 1277 | aprint_naive(": System Controller\n"); |
| @@ -1377,30 +1376,26 @@ elansc_attach(device_t parent, device_t | | | @@ -1377,30 +1376,26 @@ elansc_attach(device_t parent, device_t |
1377 | sc->sc_gpio_pins[pin].pin_flags = GPIO_PIN_OUTPUT; | | 1376 | sc->sc_gpio_pins[pin].pin_flags = GPIO_PIN_OUTPUT; |
1378 | if (elansc_gpio_pin_read(sc, pin) == 0) | | 1377 | if (elansc_gpio_pin_read(sc, pin) == 0) |
1379 | sc->sc_gpio_pins[pin].pin_state = GPIO_PIN_LOW; | | 1378 | sc->sc_gpio_pins[pin].pin_state = GPIO_PIN_LOW; |
1380 | else | | 1379 | else |
1381 | sc->sc_gpio_pins[pin].pin_state = GPIO_PIN_HIGH; | | 1380 | sc->sc_gpio_pins[pin].pin_state = GPIO_PIN_HIGH; |
1382 | } | | 1381 | } |
1383 | | | 1382 | |
1384 | /* Create controller tag */ | | 1383 | /* Create controller tag */ |
1385 | sc->sc_gpio_gc.gp_cookie = sc; | | 1384 | sc->sc_gpio_gc.gp_cookie = sc; |
1386 | sc->sc_gpio_gc.gp_pin_read = elansc_gpio_pin_read; | | 1385 | sc->sc_gpio_gc.gp_pin_read = elansc_gpio_pin_read; |
1387 | sc->sc_gpio_gc.gp_pin_write = elansc_gpio_pin_write; | | 1386 | sc->sc_gpio_gc.gp_pin_write = elansc_gpio_pin_write; |
1388 | sc->sc_gpio_gc.gp_pin_ctl = elansc_gpio_pin_ctl; | | 1387 | sc->sc_gpio_gc.gp_pin_ctl = elansc_gpio_pin_ctl; |
1389 | | | 1388 | |
1390 | gba.gba_gc = &sc->sc_gpio_gc; | | | |
1391 | gba.gba_pins = sc->sc_gpio_pins; | | | |
1392 | gba.gba_npins = ELANSC_PIO_NPINS; | | | |
1393 | | | | |
1394 | #endif /* NGPIO */ | | 1389 | #endif /* NGPIO */ |
1395 | | | 1390 | |
1396 | elansc_rescan(sc->sc_dev, "elanparbus", NULL); | | 1391 | elansc_rescan(sc->sc_dev, "elanparbus", NULL); |
1397 | elansc_rescan(sc->sc_dev, "elanpexbus", NULL); | | 1392 | elansc_rescan(sc->sc_dev, "elanpexbus", NULL); |
1398 | elansc_rescan(sc->sc_dev, "gpiobus", NULL); | | 1393 | elansc_rescan(sc->sc_dev, "gpiobus", NULL); |
1399 | | | 1394 | |
1400 | /* | | 1395 | /* |
1401 | * Hook up the watchdog timer. | | 1396 | * Hook up the watchdog timer. |
1402 | */ | | 1397 | */ |
1403 | sc->sc_smw.smw_name = device_xname(sc->sc_dev); | | 1398 | sc->sc_smw.smw_name = device_xname(sc->sc_dev); |
1404 | sc->sc_smw.smw_cookie = sc; | | 1399 | sc->sc_smw.smw_cookie = sc; |
1405 | sc->sc_smw.smw_setmode = elansc_wdog_setmode; | | 1400 | sc->sc_smw.smw_setmode = elansc_wdog_setmode; |
1406 | sc->sc_smw.smw_tickle = elansc_wdog_tickle; | | 1401 | sc->sc_smw.smw_tickle = elansc_wdog_tickle; |