Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 30c30
- < * GPIO driver for AR71xx
- ---
- > * GPIO driver for AR724x
- 34c34
- < __FBSDID("$FreeBSD: head/sys/mips/atheros/ar71xx_gpio.c 221518 2011-05-06 02:45:02Z adrian $");
- ---
- > __FBSDID("$FreeBSD$");
- 49a50
- > #include <mips/atheros/ar724xreg.h>
- 51c52
- < #include <mips/atheros/ar71xx_gpiovar.h>
- ---
- > #include <mips/atheros/ar724x_gpiovar.h>
- 58,70d58
- < struct ar71xx_gpio_pin {
- < const char *name;
- < int pin;
- < int flags;
- < };
- < static struct ar71xx_gpio_pin ar71xx_gpio_pins[] = {
- < { "RFled", 2, GPIO_PIN_OUTPUT},
- < { "SW4", 8, GPIO_PIN_INPUT},
- < { NULL, 0, 0},
- < };
- < */
- <
- < /*
- 73c61,62
- < static void ar71xx_gpio_function_enable(struct ar71xx_gpio_softc *sc,
- ---
- > #if 0
- > static void ar724x_gpio_function_enable(struct ar724x_gpio_softc *sc,
- 75c64
- < static void ar71xx_gpio_function_disable(struct ar71xx_gpio_softc *sc,
- ---
- > static void ar724x_gpio_function_disable(struct ar724x_gpio_softc *sc,
- 77c66,67
- < static void ar71xx_gpio_pin_configure(struct ar71xx_gpio_softc *sc,
- ---
- > #endif
- > static void ar724x_gpio_pin_configure(struct ar724x_gpio_softc *sc,
- 83,87c73,77
- < static int ar71xx_gpio_probe(device_t dev);
- < static int ar71xx_gpio_attach(device_t dev);
- < static int ar71xx_gpio_detach(device_t dev);
- < static int ar71xx_gpio_filter(void *arg);
- < static void ar71xx_gpio_intr(void *arg);
- ---
- > static int ar724x_gpio_probe(device_t dev);
- > static int ar724x_gpio_attach(device_t dev);
- > static int ar724x_gpio_detach(device_t dev);
- > static int ar724x_gpio_filter(void *arg);
- > static void ar724x_gpio_intr(void *arg);
- 92,94c82,84
- < static int ar71xx_gpio_pin_max(device_t dev, int *maxpin);
- < static int ar71xx_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps);
- < static int ar71xx_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t
- ---
- > static int ar724x_gpio_pin_max(device_t dev, int *maxpin);
- > static int ar724x_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps);
- > static int ar724x_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t
- 96,100c86,90
- < static int ar71xx_gpio_pin_getname(device_t dev, uint32_t pin, char *name);
- < static int ar71xx_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags);
- < static int ar71xx_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value);
- < static int ar71xx_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val);
- < static int ar71xx_gpio_pin_toggle(device_t dev, uint32_t pin);
- ---
- > static int ar724x_gpio_pin_getname(device_t dev, uint32_t pin, char *name);
- > static int ar724x_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags);
- > static int ar724x_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value);
- > static int ar724x_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val);
- > static int ar724x_gpio_pin_toggle(device_t dev, uint32_t pin);
- 101a92
- > #if 0
- 103c94
- < ar71xx_gpio_function_enable(struct ar71xx_gpio_softc *sc, uint32_t mask)
- ---
- > ar724x_gpio_function_enable(struct ar724x_gpio_softc *sc, uint32_t mask)
- 111c102
- < ar71xx_gpio_function_disable(struct ar71xx_gpio_softc *sc, uint32_t mask)
- ---
- > ar724x_gpio_function_disable(struct ar724x_gpio_softc *sc, uint32_t mask)
- 116a108
- > #endif
- 119c111
- < ar71xx_gpio_pin_configure(struct ar71xx_gpio_softc *sc, struct gpio_pin *pin,
- ---
- > ar724x_gpio_pin_configure(struct ar724x_gpio_softc *sc, struct gpio_pin *pin,
- 146c138
- < ar71xx_gpio_pin_max(device_t dev, int *maxpin)
- ---
- > ar724x_gpio_pin_max(device_t dev, int *maxpin)
- 149,161c141
- < switch (ar71xx_soc) {
- < case AR71XX_SOC_AR9130:
- < case AR71XX_SOC_AR9132:
- < *maxpin = AR91XX_GPIO_PINS - 1;
- < break;
- < case AR71XX_SOC_AR7240:
- < case AR71XX_SOC_AR7241:
- < case AR71XX_SOC_AR7242:
- < *maxpin = AR724X_GPIO_PINS - 1;
- < break;
- < default:
- < *maxpin = AR71XX_GPIO_PINS - 1;
- < }
- ---
- > *maxpin = AR724X_GPIO_PINS - 1;
- 166c146
- < ar71xx_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps)
- ---
- > ar724x_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps)
- 168c148
- < struct ar71xx_gpio_softc *sc = device_get_softc(dev);
- ---
- > struct ar724x_gpio_softc *sc = device_get_softc(dev);
- 187c167
- < ar71xx_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags)
- ---
- > ar724x_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags)
- 189c169
- < struct ar71xx_gpio_softc *sc = device_get_softc(dev);
- ---
- > struct ar724x_gpio_softc *sc = device_get_softc(dev);
- 208c188
- < ar71xx_gpio_pin_getname(device_t dev, uint32_t pin, char *name)
- ---
- > ar724x_gpio_pin_getname(device_t dev, uint32_t pin, char *name)
- 210c190
- < struct ar71xx_gpio_softc *sc = device_get_softc(dev);
- ---
- > struct ar724x_gpio_softc *sc = device_get_softc(dev);
- 229c209
- < ar71xx_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
- ---
- > ar724x_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
- 232c212
- < struct ar71xx_gpio_softc *sc = device_get_softc(dev);
- ---
- > struct ar724x_gpio_softc *sc = device_get_softc(dev);
- 251c231
- < ar71xx_gpio_pin_configure(sc, &sc->gpio_pins[i], flags);
- ---
- > ar724x_gpio_pin_configure(sc, &sc->gpio_pins[i], flags);
- 256c236
- < ar71xx_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
- ---
- > ar724x_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
- 258c238
- < struct ar71xx_gpio_softc *sc = device_get_softc(dev);
- ---
- > struct ar724x_gpio_softc *sc = device_get_softc(dev);
- 280c260
- < ar71xx_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val)
- ---
- > ar724x_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val)
- 282c262
- < struct ar71xx_gpio_softc *sc = device_get_softc(dev);
- ---
- > struct ar724x_gpio_softc *sc = device_get_softc(dev);
- 301c281
- < ar71xx_gpio_pin_toggle(device_t dev, uint32_t pin)
- ---
- > ar724x_gpio_pin_toggle(device_t dev, uint32_t pin)
- 304c284
- < struct ar71xx_gpio_softc *sc = device_get_softc(dev);
- ---
- > struct ar724x_gpio_softc *sc = device_get_softc(dev);
- 326c306
- < ar71xx_gpio_filter(void *arg)
- ---
- > ar724x_gpio_filter(void *arg)
- 336c316
- < ar71xx_gpio_intr(void *arg)
- ---
- > ar724x_gpio_intr(void *arg)
- 338c318
- < struct ar71xx_gpio_softc *sc = arg;
- ---
- > struct ar724x_gpio_softc *sc = arg;
- 345c325
- < ar71xx_gpio_probe(device_t dev)
- ---
- > ar724x_gpio_probe(device_t dev)
- 352c332,333
- < return (ENXIO);
- ---
- > device_set_desc(dev, "Atheros AR724X GPIO driver");
- > return (0);
- 357,358c338
- < device_set_desc(dev, "Atheros AR71XX GPIO driver");
- < return (0);
- ---
- > return (ENXIO);
- 362c342
- < ar71xx_gpio_attach(device_t dev)
- ---
- > ar724x_gpio_attach(device_t dev)
- 364c344
- < struct ar71xx_gpio_softc *sc = device_get_softc(dev);
- ---
- > struct ar724x_gpio_softc *sc = device_get_softc(dev);
- 366d345
- < // struct ar71xx_gpio_pin *pinp;
- 367a347
- > uint32_t reg;
- 370c350
- < ("ar71xx_gpio: Only one gpio module supported"));
- ---
- > ("ar724x_gpio: Only one gpio module supported"));
- 383c363
- < ar71xx_gpio_detach(dev);
- ---
- > ar724x_gpio_detach(dev);
- 394c374
- < ar71xx_gpio_filter, ar71xx_gpio_intr, sc, &sc->gpio_ih))) {
- ---
- > ar724x_gpio_filter, ar724x_gpio_intr, sc, &sc->gpio_ih))) {
- 401,404c381,393
- < if (0) {
- < ar71xx_gpio_function_enable(sc, GPIO_FUNC_SPI_CS1_EN);
- < ar71xx_gpio_function_enable(sc, GPIO_FUNC_SPI_CS2_EN);
- < }
- ---
- >
- > /* XXX: use something like hints for it */
- > reg = GPIO_READ(sc, AR71XX_GPIO_FUNCTION);
- > device_printf(dev, "GPIO Functions reg old value = 0x%08x\n", reg);
- >
- > /* Disable JTAG on GPIO and enable GE0 MII clock */
- > //AR724X_GPIO_FUNC_GE0_MII_CLK_EN |
- > reg |= AR724X_GPIO_FUNC_JTAG_DISABLE;
- > GPIO_WRITE(sc, AR71XX_GPIO_FUNCTION, reg);
- >
- > device_printf(dev, "GPIO Functions reg new value = 0x%08x\n",
- > GPIO_READ(sc, AR71XX_GPIO_FUNCTION));
- >
- 408c397
- < ar71xx_gpio_pin_max(dev, &maxpin);
- ---
- > ar724x_gpio_pin_max(dev, &maxpin);
- 411d399
- < // strncpy(sc->gpio_pins[i].gp_name, pinp->name, GPIOMAXNAME);
- 415,417d402
- < // ar71xx_gpio_pin_configure(sc, &sc->gpio_pins[i], pinp->flags);
- < // pinp++;
- < // i++;
- 422d406
- < //device_add_child(dev, "gpioc", device_get_unit(dev));
- 428c412
- < ar71xx_gpio_detach(device_t dev)
- ---
- > ar724x_gpio_detach(device_t dev)
- 430c414
- < struct ar71xx_gpio_softc *sc = device_get_softc(dev);
- ---
- > struct ar724x_gpio_softc *sc = device_get_softc(dev);
- 434,435d417
- < ar71xx_gpio_function_disable(sc, GPIO_FUNC_SPI_CS1_EN);
- < ar71xx_gpio_function_disable(sc, GPIO_FUNC_SPI_CS2_EN);
- 447,450c429,432
- < static device_method_t ar71xx_gpio_methods[] = {
- < DEVMETHOD(device_probe, ar71xx_gpio_probe),
- < DEVMETHOD(device_attach, ar71xx_gpio_attach),
- < DEVMETHOD(device_detach, ar71xx_gpio_detach),
- ---
- > static device_method_t ar724x_gpio_methods[] = {
- > DEVMETHOD(device_probe, ar724x_gpio_probe),
- > DEVMETHOD(device_attach, ar724x_gpio_attach),
- > DEVMETHOD(device_detach, ar724x_gpio_detach),
- 453,460c435,442
- < DEVMETHOD(gpio_pin_max, ar71xx_gpio_pin_max),
- < DEVMETHOD(gpio_pin_getname, ar71xx_gpio_pin_getname),
- < DEVMETHOD(gpio_pin_getflags, ar71xx_gpio_pin_getflags),
- < DEVMETHOD(gpio_pin_getcaps, ar71xx_gpio_pin_getcaps),
- < DEVMETHOD(gpio_pin_setflags, ar71xx_gpio_pin_setflags),
- < DEVMETHOD(gpio_pin_get, ar71xx_gpio_pin_get),
- < DEVMETHOD(gpio_pin_set, ar71xx_gpio_pin_set),
- < DEVMETHOD(gpio_pin_toggle, ar71xx_gpio_pin_toggle),
- ---
- > DEVMETHOD(gpio_pin_max, ar724x_gpio_pin_max),
- > DEVMETHOD(gpio_pin_getname, ar724x_gpio_pin_getname),
- > DEVMETHOD(gpio_pin_getflags, ar724x_gpio_pin_getflags),
- > DEVMETHOD(gpio_pin_getcaps, ar724x_gpio_pin_getcaps),
- > DEVMETHOD(gpio_pin_setflags, ar724x_gpio_pin_setflags),
- > DEVMETHOD(gpio_pin_get, ar724x_gpio_pin_get),
- > DEVMETHOD(gpio_pin_set, ar724x_gpio_pin_set),
- > DEVMETHOD(gpio_pin_toggle, ar724x_gpio_pin_toggle),
- 464c446
- < static driver_t ar71xx_gpio_driver = {
- ---
- > static driver_t ar724x_gpio_driver = {
- 466,467c448,449
- < ar71xx_gpio_methods,
- < sizeof(struct ar71xx_gpio_softc),
- ---
- > ar724x_gpio_methods,
- > sizeof(struct ar724x_gpio_softc),
- 469c451
- < static devclass_t ar71xx_gpio_devclass;
- ---
- > static devclass_t ar724x_gpio_devclass;
- 471c453
- < DRIVER_MODULE(ar71xx_gpio, apb, ar71xx_gpio_driver, ar71xx_gpio_devclass, 0, 0);
- ---
- > DRIVER_MODULE(ar724x_gpio, apb, ar724x_gpio_driver, ar724x_gpio_devclass, 0, 0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement