Deleted Added
full compact
macio.c (230398) macio.c (253825)
1/*-
2 * Copyright 2002 by Peter Grehan. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 10 unchanged lines hidden (view full) ---

19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
22 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
1/*-
2 * Copyright 2002 by Peter Grehan. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 10 unchanged lines hidden (view full) ---

19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
22 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/sys/powerpc/powermac/macio.c 230398 2012-01-20 22:24:39Z nwhitehorn $
27 * $FreeBSD: head/sys/powerpc/powermac/macio.c 253825 2013-07-31 01:13:29Z jhibbits $
28 */
29
30/*
31 * Driver for KeyLargo/Pangea, the MacPPC south bridge ASIC.
32 */
33
34#include <sys/param.h>
35#include <sys/systm.h>

--- 564 unchanged lines hidden (view full) ---

600static const struct ofw_bus_devinfo *
601macio_get_devinfo(device_t dev, device_t child)
602{
603 struct macio_devinfo *dinfo;
604
605 dinfo = device_get_ivars(child);
606 return (&dinfo->mdi_obdinfo);
607}
28 */
29
30/*
31 * Driver for KeyLargo/Pangea, the MacPPC south bridge ASIC.
32 */
33
34#include <sys/param.h>
35#include <sys/systm.h>

--- 564 unchanged lines hidden (view full) ---

600static const struct ofw_bus_devinfo *
601macio_get_devinfo(device_t dev, device_t child)
602{
603 struct macio_devinfo *dinfo;
604
605 dinfo = device_get_ivars(child);
606 return (&dinfo->mdi_obdinfo);
607}
608
609int
610macio_enable_wireless(device_t dev, bool enable)
611{
612 struct macio_softc *sc = device_get_softc(dev);
613 uint32_t x;
614
615 if (enable) {
616 x = bus_read_4(sc->sc_memr, KEYLARGO_FCR2);
617 x |= 0x4;
618 bus_write_4(sc->sc_memr, KEYLARGO_FCR2, x);
619
620 /* Enable card slot. */
621 bus_write_1(sc->sc_memr, KEYLARGO_GPIO_BASE + 0x0f, 5);
622 DELAY(1000);
623 bus_write_1(sc->sc_memr, KEYLARGO_GPIO_BASE + 0x0f, 4);
624 DELAY(1000);
625 x = bus_read_4(sc->sc_memr, KEYLARGO_FCR2);
626 x &= ~0x80000000;
627
628 bus_write_4(sc->sc_memr, KEYLARGO_FCR2, x);
629 /* out8(gpio + 0x10, 4); */
630
631 bus_write_1(sc->sc_memr, KEYLARGO_EXTINT_GPIO_REG_BASE + 0x0b, 0);
632 bus_write_1(sc->sc_memr, KEYLARGO_EXTINT_GPIO_REG_BASE + 0x0a, 0x28);
633 bus_write_1(sc->sc_memr, KEYLARGO_EXTINT_GPIO_REG_BASE + 0x0d, 0x28);
634 bus_write_1(sc->sc_memr, KEYLARGO_GPIO_BASE + 0x0d, 0x28);
635 bus_write_1(sc->sc_memr, KEYLARGO_GPIO_BASE + 0x0e, 0x28);
636 bus_write_4(sc->sc_memr, 0x1c000, 0);
637
638 /* Initialize the card. */
639 bus_write_4(sc->sc_memr, 0x1a3e0, 0x41);
640 x = bus_read_4(sc->sc_memr, KEYLARGO_FCR2);
641 x |= 0x80000000;
642 bus_write_4(sc->sc_memr, KEYLARGO_FCR2, x);
643 } else {
644 x = bus_read_4(sc->sc_memr, KEYLARGO_FCR2);
645 x &= ~0x4;
646 bus_write_4(sc->sc_memr, KEYLARGO_FCR2, x);
647 /* out8(gpio + 0x10, 0); */
648 }
649
650 return (0);
651}