int vrc4172pci_mcr700_intr(void *arg) { struct vrc4172pci_softc *sc = arg; hpcio_intr_clear(sc->sc_iochip, sc->sc_ih); printf("USB port %s\n", hpcio_portread(sc->sc_iochip, 1) ? "ON" : "OFF"); hpcio_portwrite(sc->sc_iochip, 45, hpcio_portread(sc->sc_iochip, 1)); return (0); }
int hpcout_hook(void *arg, int type, long id, void *msg) { struct hpcout_softc *sc = arg; printf("%s: port %d: %s\n", __func__, sc->sc_port, (int)msg ? "on" : "off"); hpcio_portwrite(sc->sc_hc, sc->sc_port, (int)msg ? sc->sc_on : sc->sc_off); return (0); }
void hpcout_attach(device_t parent, device_t self, void *aux) { struct hpcioman_attach_args *hma = aux; struct hpcout_softc *sc = device_private(self); sc->sc_hma = *hma; /* structure assignment */ if (hma->hma_hc == NULL || hma->hma_type == HPCIOMANCF_EVTYPE_DEFAULT || hma->hma_id == HPCIOMANCF_ID_DEFAULT || hma->hma_port == HPCIOMANCF_PORT_DEFAULT) { printf(": ignored\n"); return; } printf("\n"); if (hma->hma_initvalue != -1) hpcio_portwrite(sc->sc_hc, sc->sc_port, hma->hma_initvalue); config_hook(sc->sc_type, sc->sc_id, CONFIG_HOOK_SHARE, hpcout_hook, sc); }
static void vrc4172pci_attach(struct device *parent, struct device *self, void *aux) { struct vrc4172pci_softc *sc = (struct vrc4172pci_softc *)self; pci_chipset_tag_t pc = &sc->sc_pc; struct vrip_attach_args *va = aux; #if NPCI > 0 struct pcibus_attach_args pba; #endif sc->sc_iot = va->va_iot; if (bus_space_map(sc->sc_iot, va->va_addr, va->va_size, 0, &sc->sc_ioh)) { printf(": couldn't map io space\n"); return; } printf("\n"); #ifdef VRC4172PCI_MCR700_SUPPORT if (platid_match(&platid, &platid_mask_MACH_NEC_MCR_700) || platid_match(&platid, &platid_mask_MACH_NEC_MCR_700A) || platid_match(&platid, &platid_mask_MACH_NEC_MCR_730) || platid_match(&platid, &platid_mask_MACH_NEC_MCR_730A)) { /* power USB controller on MC-R700 */ sc->sc_iochip = va->va_gpio_chips[VRIP_IOCHIP_VRGIU]; hpcio_portwrite(sc->sc_iochip, 45, 1); sc->sc_fake_baseaddr = 0x0afe0000; #if 0 sc->sc_ih = hpcio_intr_establish(sc->sc_iochip, 1, HPCIO_INTR_EDGE|HPCIO_INTR_HOLD, vrc4172pci_mcr700_intr, sc); #endif } #endif /* VRC4172PCI_MCR700_SUPPORT */ pc->pc_dev = &sc->sc_dev; pc->pc_attach_hook = vrc4172pci_attach_hook; pc->pc_bus_maxdevs = vrc4172pci_bus_maxdevs; pc->pc_bus_devorder = vrc4172pci_bus_devorder; pc->pc_make_tag = vrc4172pci_make_tag; pc->pc_decompose_tag = vrc4172pci_decompose_tag; pc->pc_conf_read = vrc4172pci_conf_read; pc->pc_conf_write = vrc4172pci_conf_write; pc->pc_intr_map = vrc4172pci_intr_map; pc->pc_intr_string = vrc4172pci_intr_string; pc->pc_intr_evcnt = vrc4172pci_intr_evcnt; pc->pc_intr_establish = vrc4172pci_intr_establish; pc->pc_intr_disestablish = vrc4172pci_intr_disestablish; #if 0 { int i; for (i = 0; i < 2; i++) printf("%s: ID_REG(0, 0, %d) = 0x%08x\n", sc->sc_dev.dv_xname, i, pci_conf_read(pc, pci_make_tag(pc, 0, 0, i), PCI_ID_REG)); } #endif #if NPCI > 0 memset(&pba, 0, sizeof(pba)); pba.pba_iot = sc->sc_iot; pba.pba_memt = sc->sc_iot; pba.pba_dmat = &hpcmips_default_bus_dma_tag.bdt; pba.pba_dmat64 = NULL; pba.pba_bus = 0; pba.pba_bridgetag = NULL; pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED | PCI_FLAGS_MRL_OKAY; pba.pba_pc = pc; config_found_ia(self, "pcibus", &pba, pcibusprint); #endif }