| @@ -1,40 +1,40 @@ | | | @@ -1,40 +1,40 @@ |
1 | /* $NetBSD: gcscpcib.c,v 1.6 2008/07/20 22:57:19 martin Exp $ */ | | 1 | /* $NetBSD: gcscpcib.c,v 1.7 2009/05/04 12:41:09 cegger Exp $ */ |
2 | /* $OpenBSD: gcscpcib.c,v 1.6 2007/11/17 17:02:47 mbalmer Exp $ */ | | 2 | /* $OpenBSD: gcscpcib.c,v 1.6 2007/11/17 17:02:47 mbalmer Exp $ */ |
3 | | | 3 | |
4 | /* | | 4 | /* |
5 | * Copyright (c) 2008 Yojiro UO <yuo@nui.org> | | 5 | * Copyright (c) 2008 Yojiro UO <yuo@nui.org> |
6 | * Copyright (c) 2007 Marc Balmer <mbalmer@openbsd.org> | | 6 | * Copyright (c) 2007 Marc Balmer <mbalmer@openbsd.org> |
7 | * Copyright (c) 2007 Michael Shalayeff | | 7 | * Copyright (c) 2007 Michael Shalayeff |
8 | * All rights reserved. | | 8 | * All rights reserved. |
9 | * | | 9 | * |
10 | * Permission to use, copy, modify, and distribute this software for any | | 10 | * Permission to use, copy, modify, and distribute this software for any |
11 | * purpose with or without fee is hereby granted, provided that the above | | 11 | * purpose with or without fee is hereby granted, provided that the above |
12 | * copyright notice and this permission notice appear in all copies. | | 12 | * copyright notice and this permission notice appear in all copies. |
13 | * | | 13 | * |
14 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | | 14 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
15 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | | 15 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
16 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | | 16 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
17 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | | 17 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
18 | * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN | | 18 | * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN |
19 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT | | 19 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT |
20 | * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | | 20 | * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
21 | */ | | 21 | */ |
22 | | | 22 | |
23 | /* | | 23 | /* |
24 | * AMD CS5535/CS5536 series LPC bridge also containing timer, watchdog and GPIO. | | 24 | * AMD CS5535/CS5536 series LPC bridge also containing timer, watchdog and GPIO. |
25 | */ | | 25 | */ |
26 | #include <sys/cdefs.h> | | 26 | #include <sys/cdefs.h> |
27 | __KERNEL_RCSID(0, "$NetBSD: gcscpcib.c,v 1.6 2008/07/20 22:57:19 martin Exp $"); | | 27 | __KERNEL_RCSID(0, "$NetBSD: gcscpcib.c,v 1.7 2009/05/04 12:41:09 cegger Exp $"); |
28 | | | 28 | |
29 | #include "gpio.h" | | 29 | #include "gpio.h" |
30 | | | 30 | |
31 | #include <sys/param.h> | | 31 | #include <sys/param.h> |
32 | #include <sys/systm.h> | | 32 | #include <sys/systm.h> |
33 | #include <sys/device.h> | | 33 | #include <sys/device.h> |
34 | #include <sys/gpio.h> | | 34 | #include <sys/gpio.h> |
35 | #include <sys/sysctl.h> | | 35 | #include <sys/sysctl.h> |
36 | #include <sys/timetc.h> | | 36 | #include <sys/timetc.h> |
37 | #include <sys/wdog.h> | | 37 | #include <sys/wdog.h> |
38 | | | 38 | |
39 | #include <sys/bus.h> | | 39 | #include <sys/bus.h> |
40 | #include <machine/cpufunc.h> | | 40 | #include <machine/cpufunc.h> |
| @@ -93,49 +93,49 @@ struct gcscpcib_softc { | | | @@ -93,49 +93,49 @@ struct gcscpcib_softc { |
93 | struct gpio_chipset_tag sc_gpio_gc; | | 93 | struct gpio_chipset_tag sc_gpio_gc; |
94 | gpio_pin_t sc_gpio_pins[AMD553X_GPIO_NPINS]; | | 94 | gpio_pin_t sc_gpio_pins[AMD553X_GPIO_NPINS]; |
95 | | | 95 | |
96 | /* SMbus/i2c interface */ | | 96 | /* SMbus/i2c interface */ |
97 | #if 0 | | 97 | #if 0 |
98 | bus_space_tag_t sc_smbus_iot; | | 98 | bus_space_tag_t sc_smbus_iot; |
99 | bus_space_handle_t sc_smbus_ioh; | | 99 | bus_space_handle_t sc_smbus_ioh; |
100 | i2c_addr_t sc_smbus_slaveaddr; /* address of smbus slave */ | | 100 | i2c_addr_t sc_smbus_slaveaddr; /* address of smbus slave */ |
101 | struct i2c_controller sc_i2c; /* i2c controller info */ | | 101 | struct i2c_controller sc_i2c; /* i2c controller info */ |
102 | krwlock_t sc_smbus_rwlock; | | 102 | krwlock_t sc_smbus_rwlock; |
103 | #endif | | 103 | #endif |
104 | }; | | 104 | }; |
105 | | | 105 | |
106 | static int gcscpcib_match(device_t, struct cfdata *, void *); | | 106 | static int gcscpcib_match(device_t, cfdata_t, void *); |
107 | static void gcscpcib_attach(device_t, device_t, void *); | | 107 | static void gcscpcib_attach(device_t, device_t, void *); |
108 | | | 108 | |
109 | CFATTACH_DECL_NEW(gcscpcib, sizeof(struct gcscpcib_softc), | | 109 | CFATTACH_DECL_NEW(gcscpcib, sizeof(struct gcscpcib_softc), |
110 | gcscpcib_match, gcscpcib_attach, NULL, NULL); | | 110 | gcscpcib_match, gcscpcib_attach, NULL, NULL); |
111 | | | 111 | |
112 | static u_int gcscpcib_get_timecount(struct timecounter *tc); | | 112 | static u_int gcscpcib_get_timecount(struct timecounter *tc); |
113 | static int gscspcib_scan_mfgpt(struct gcscpcib_softc *sc); | | 113 | static int gscspcib_scan_mfgpt(struct gcscpcib_softc *sc); |
114 | static void gscspcib_wdog_update(struct gcscpcib_softc *, uint16_t); | | 114 | static void gscspcib_wdog_update(struct gcscpcib_softc *, uint16_t); |
115 | static int gcscpcib_wdog_setmode(struct sysmon_wdog *smw); | | 115 | static int gcscpcib_wdog_setmode(struct sysmon_wdog *smw); |
116 | static int gcscpcib_wdog_tickle(struct sysmon_wdog *smw); | | 116 | static int gcscpcib_wdog_tickle(struct sysmon_wdog *smw); |
117 | static void gcscpcib_wdog_enable(struct gcscpcib_softc *sc); | | 117 | static void gcscpcib_wdog_enable(struct gcscpcib_softc *sc); |
118 | static void gcscpcib_wdog_disable(struct gcscpcib_softc *sc); | | 118 | static void gcscpcib_wdog_disable(struct gcscpcib_softc *sc); |
119 | static void gcscpcib_wdog_reset(struct gcscpcib_softc *sc); | | 119 | static void gcscpcib_wdog_reset(struct gcscpcib_softc *sc); |
120 | | | 120 | |
121 | #if NGPIO > 0 | | 121 | #if NGPIO > 0 |
122 | static int gcscpcib_gpio_pin_read(void *, int); | | 122 | static int gcscpcib_gpio_pin_read(void *, int); |
123 | static void gcscpcib_gpio_pin_write(void *, int, int); | | 123 | static void gcscpcib_gpio_pin_write(void *, int, int); |
124 | static void gcscpcib_gpio_pin_ctl(void *, int, int); | | 124 | static void gcscpcib_gpio_pin_ctl(void *, int, int); |
125 | #endif | | 125 | #endif |
126 | | | 126 | |
127 | static int | | 127 | static int |
128 | gcscpcib_match(device_t parent, struct cfdata *match, void *aux) | | 128 | gcscpcib_match(device_t parent, cfdata_t match, void *aux) |
129 | { | | 129 | { |
130 | struct pci_attach_args *pa = aux; | | 130 | struct pci_attach_args *pa = aux; |
131 | | | 131 | |
132 | if (PCI_CLASS(pa->pa_class) != PCI_CLASS_BRIDGE || | | 132 | if (PCI_CLASS(pa->pa_class) != PCI_CLASS_BRIDGE || |
133 | PCI_SUBCLASS(pa->pa_class) != PCI_SUBCLASS_BRIDGE_ISA) | | 133 | PCI_SUBCLASS(pa->pa_class) != PCI_SUBCLASS_BRIDGE_ISA) |
134 | return 0; | | 134 | return 0; |
135 | | | 135 | |
136 | switch (PCI_PRODUCT(pa->pa_id)) { | | 136 | switch (PCI_PRODUCT(pa->pa_id)) { |
137 | case PCI_PRODUCT_NS_CS5535_ISA: | | 137 | case PCI_PRODUCT_NS_CS5535_ISA: |
138 | case PCI_PRODUCT_AMD_CS5536_PCIB: | | 138 | case PCI_PRODUCT_AMD_CS5536_PCIB: |
139 | return 2; /* supersede pcib(4) */ | | 139 | return 2; /* supersede pcib(4) */ |
140 | } | | 140 | } |
141 | | | 141 | |