Lines Matching +full:freeze +full:- +full:bridge +full:- +full:controller

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
31 * Driver for KeyLargo/Pangea, the MacPPC south bridge ASIC.
158 { 0x0017106b, "Paddington I/O Controller" },
159 { 0x0022106b, "KeyLargo I/O Controller" },
160 { 0x0025106b, "Pangea I/O Controller" },
161 { 0x003e106b, "Intrepid I/O Controller" },
162 { 0x0041106b, "K2 KeyLargo I/O Controller" },
163 { 0x004f106b, "Shasta I/O Controller" },
181 { "escc-legacy", MACIO_QUIRK_IGNORE },
194 for (mqe = macio_quirks; mqe->mq_name != NULL; mqe++) in macio_get_quirks()
195 if (strcmp(name, mqe->mq_name) == 0) in macio_get_quirks()
196 return (mqe->mq_quirks); in macio_get_quirks()
211 if (dinfo->mdi_ninterrupts >= 6) { in macio_add_intr()
218 if (nintr == -1) { in macio_add_intr()
221 if (nintr == -1) in macio_add_intr()
225 if (intr[0] == -1) in macio_add_intr()
228 if (OF_getprop(devnode, "interrupt-parent", &iparent, sizeof(iparent)) in macio_add_intr()
232 if (OF_getprop(OF_node_from_xref(iparent), "#interrupt-cells", &icells, in macio_add_intr()
239 resource_list_add(&dinfo->mdi_resources, SYS_RES_IRQ, in macio_add_intr()
240 dinfo->mdi_ninterrupts, irq, irq, 1); in macio_add_intr()
242 dinfo->mdi_interrupts[dinfo->mdi_ninterrupts] = irq; in macio_add_intr()
243 dinfo->mdi_ninterrupts++; in macio_add_intr()
256 if (nreg == -1) in macio_add_reg()
260 * Some G5's have broken properties in the i2s-a area. If so we try in macio_add_reg()
262 * sound layout-id 36 and the other one for sound layout-id 76. in macio_add_reg()
277 res = OF_getprop(child, "layout-id", &layout_id, in macio_add_reg()
290 resource_list_add(&dinfo->mdi_resources, SYS_RES_MEMORY, i, in macio_add_reg()
334 root = sc->sc_node = ofw_bus_get_node(dev); in macio_attach()
339 if (OF_getprop(root, "assigned-addresses", in macio_attach()
347 sc->sc_base = reg[2]; in macio_attach()
348 sc->sc_size = MACIO_REG_SIZE; in macio_attach()
350 sc->sc_memrid = PCIR_BAR(0); in macio_attach()
351 sc->sc_memr = bus_alloc_resource_any(dev, SYS_RES_MEMORY, in macio_attach()
352 &sc->sc_memrid, RF_ACTIVE); in macio_attach()
354 sc->sc_mem_rman.rm_type = RMAN_ARRAY; in macio_attach()
355 sc->sc_mem_rman.rm_descr = "MacIO Device Memory"; in macio_attach()
356 error = rman_init(&sc->sc_mem_rman); in macio_attach()
361 error = rman_manage_region(&sc->sc_mem_rman, 0, sc->sc_size); in macio_attach()
369 * Iterate through the sub-devices in macio_attach()
373 if (ofw_bus_gen_setup_devinfo(&dinfo->mdi_obdinfo, child) != in macio_attach()
378 quirks = macio_get_quirks(dinfo->mdi_obdinfo.obd_name); in macio_attach()
380 ofw_bus_gen_destroy_devinfo(&dinfo->mdi_obdinfo); in macio_attach()
384 resource_list_init(&dinfo->mdi_resources); in macio_attach()
385 dinfo->mdi_ninterrupts = 0; in macio_attach()
398 dinfo->mdi_obdinfo.obd_name); in macio_attach()
399 resource_list_free(&dinfo->mdi_resources); in macio_attach()
400 ofw_bus_gen_destroy_devinfo(&dinfo->mdi_obdinfo); in macio_attach()
407 if (sc->sc_memr == NULL) in macio_attach()
415 fcr = bus_read_4(sc->sc_memr, HEATHROW_FCR); in macio_attach()
418 bus_write_4(sc->sc_memr, HEATHROW_FCR, fcr); in macio_attach()
421 bus_write_4(sc->sc_memr, HEATHROW_FCR, fcr); in macio_attach()
424 bus_write_4(sc->sc_memr, HEATHROW_FCR, fcr); in macio_attach()
427 bus_write_4(sc->sc_memr, HEATHROW_FCR, fcr); in macio_attach()
435 (strcmp(compat, "K2-Keylargo") == 0)) { in macio_attach()
438 fcr1 = bus_read_4(sc->sc_memr, KEYLARGO_FCR1); in macio_attach()
440 bus_write_4(sc->sc_memr, KEYLARGO_FCR1, fcr1); in macio_attach()
448 * On SMP G4, timebase freeze is via a GPIO on macio. in macio_attach()
451 * perform timebase freeze/unfreeze on behalf of the platform. in macio_attach()
453 if ((child = OF_finddevice("/cpus/PowerPC,G4@0")) != -1 && in macio_attach()
454 OF_peer(child) != -1) { in macio_attach()
455 if (OF_getprop(child, "timebase-enable", &sc->sc_timebase, in macio_attach()
456 sizeof(sc->sc_timebase)) <= 0) in macio_attach()
457 sc->sc_timebase = KEYLARGO_GPIO_BASE + 0x09; in macio_attach()
460 sc->sc_timebase); in macio_attach()
476 rl = &dinfo->mdi_resources; in macio_print_child()
497 rl = &dinfo->mdi_resources; in macio_probe_nomatch()
517 return (&sc->sc_mem_rman); in macio_get_rman()
537 rle = resource_list_find(&dinfo->mdi_resources, SYS_RES_MEMORY, in macio_alloc_resource()
545 if (start < rle->start) in macio_alloc_resource()
546 adjstart = rle->start; in macio_alloc_resource()
547 else if (start > rle->end) in macio_alloc_resource()
548 adjstart = rle->end; in macio_alloc_resource()
552 if (end < rle->start) in macio_alloc_resource()
553 adjend = rle->start; in macio_alloc_resource()
554 else if (end > rle->end) in macio_alloc_resource()
555 adjend = rle->end; in macio_alloc_resource()
559 adjcount = adjend - adjstart; in macio_alloc_resource()
570 rle = resource_list_find(&dinfo->mdi_resources, SYS_RES_IRQ, in macio_alloc_resource()
573 if (dinfo->mdi_ninterrupts >= 6) { in macio_alloc_resource()
579 resource_list_add(&dinfo->mdi_resources, SYS_RES_IRQ, in macio_alloc_resource()
580 dinfo->mdi_ninterrupts, start, start, 1); in macio_alloc_resource()
582 dinfo->mdi_interrupts[dinfo->mdi_ninterrupts] = start; in macio_alloc_resource()
583 dinfo->mdi_ninterrupts++; in macio_alloc_resource()
586 return (resource_list_alloc(&dinfo->mdi_resources, bus, child, in macio_alloc_resource()
686 map->r_vaddr = pmap_mapdev_attr((vm_paddr_t)start + sc->sc_base, in macio_map_resource()
688 if (map->r_vaddr == NULL) in macio_map_resource()
690 map->r_size = length; in macio_map_resource()
691 map->r_bustag = &bs_le_tag; in macio_map_resource()
692 map->r_bushandle = (bus_space_handle_t)map->r_vaddr; in macio_map_resource()
706 pmap_unmapdev(map->r_vaddr, map->r_size); in macio_unmap_resource()
720 return (&dinfo->mdi_resources); in macio_get_resource_list()
729 return (&dinfo->mdi_obdinfo); in macio_get_devinfo()
739 x = bus_read_4(sc->sc_memr, KEYLARGO_FCR2); in macio_enable_wireless()
741 bus_write_4(sc->sc_memr, KEYLARGO_FCR2, x); in macio_enable_wireless()
744 bus_write_1(sc->sc_memr, KEYLARGO_GPIO_BASE + 0x0f, 5); in macio_enable_wireless()
746 bus_write_1(sc->sc_memr, KEYLARGO_GPIO_BASE + 0x0f, 4); in macio_enable_wireless()
748 x = bus_read_4(sc->sc_memr, KEYLARGO_FCR2); in macio_enable_wireless()
751 bus_write_4(sc->sc_memr, KEYLARGO_FCR2, x); in macio_enable_wireless()
754 bus_write_1(sc->sc_memr, KEYLARGO_EXTINT_GPIO_REG_BASE + 0x0b, 0); in macio_enable_wireless()
755 bus_write_1(sc->sc_memr, KEYLARGO_EXTINT_GPIO_REG_BASE + 0x0a, 0x28); in macio_enable_wireless()
756 bus_write_1(sc->sc_memr, KEYLARGO_EXTINT_GPIO_REG_BASE + 0x0d, 0x28); in macio_enable_wireless()
757 bus_write_1(sc->sc_memr, KEYLARGO_GPIO_BASE + 0x0d, 0x28); in macio_enable_wireless()
758 bus_write_1(sc->sc_memr, KEYLARGO_GPIO_BASE + 0x0e, 0x28); in macio_enable_wireless()
759 bus_write_4(sc->sc_memr, 0x1c000, 0); in macio_enable_wireless()
762 bus_write_4(sc->sc_memr, 0x1a3e0, 0x41); in macio_enable_wireless()
763 x = bus_read_4(sc->sc_memr, KEYLARGO_FCR2); in macio_enable_wireless()
765 bus_write_4(sc->sc_memr, KEYLARGO_FCR2, x); in macio_enable_wireless()
767 x = bus_read_4(sc->sc_memr, KEYLARGO_FCR2); in macio_enable_wireless()
769 bus_write_4(sc->sc_memr, KEYLARGO_FCR2, x); in macio_enable_wireless()
778 macio_freeze_timebase(device_t dev, bool freeze) in macio_freeze_timebase() argument
782 if (freeze) { in macio_freeze_timebase()
783 bus_write_1(sc->sc_memr, sc->sc_timebase, 4); in macio_freeze_timebase()
785 bus_write_1(sc->sc_memr, sc->sc_timebase, 0); in macio_freeze_timebase()
787 bus_read_1(sc->sc_memr, sc->sc_timebase); in macio_freeze_timebase()