Lines Matching refs:port
39 #define PCIE_RC_PHY_BASE(port) (0x84000 + (port) * 0x4000) argument
101 #define LREAD4(sc, port, reg) \ argument
102 (bus_space_read_4((sc)->sc_iot, (sc)->sc_phy_ioh[port], (reg)))
103 #define LWRITE4(sc, port, reg, val) \ argument
104 bus_space_write_4((sc)->sc_iot, (sc)->sc_phy_ioh[port], (reg), (val))
105 #define LSET4(sc, port, reg, bits) \ argument
106 LWRITE4((sc), (port), (reg), LREAD4((sc), (port), (reg)) | (bits))
107 #define LCLR4(sc, port, reg, bits) \ argument
108 LWRITE4((sc), (port), (reg), LREAD4((sc), (port), (reg)) & ~(bits))
110 #define PREAD4(sc, port, reg) \ argument
111 (bus_space_read_4((sc)->sc_iot, (sc)->sc_port_ioh[(port)], (reg)))
112 #define PWRITE4(sc, port, reg, val) \ argument
113 bus_space_write_4((sc)->sc_iot, (sc)->sc_port_ioh[(port)], (reg), (val))
114 #define PSET4(sc, port, reg, bits) \ argument
115 PWRITE4((sc), (port), (reg), PREAD4((sc), (port), (reg)) | (bits))
116 #define PCLR4(sc, port, reg, bits) \ argument
117 PWRITE4((sc), (port), (reg), PREAD4((sc), (port), (reg)) & ~(bits))
222 int idx, node, port; in aplpcie_attach() local
242 for (port = 0; port < APLPCIE_MAX_PORTS; port++) { in aplpcie_attach()
243 snprintf(name, sizeof(name), "port%d", port); in aplpcie_attach()
249 faa->fa_reg[idx].size, 0, &sc->sc_port_ioh[port])) { in aplpcie_attach()
253 sc->sc_port_ios[port] = faa->fa_reg[idx].size; in aplpcie_attach()
255 snprintf(name, sizeof(name), "phy%d", port); in aplpcie_attach()
259 PCIE_RC_PHY_BASE(port), PCIE_RC_PHY_SIZE, in aplpcie_attach()
260 &sc->sc_phy_ioh[port]); in aplpcie_attach()
265 faa->fa_reg[idx].size, 0, &sc->sc_phy_ioh[port])) { in aplpcie_attach()
269 sc->sc_phy_ios[port] = faa->fa_reg[idx].size; in aplpcie_attach()
449 int idx, port, timo; in aplpcie_init_port() local
458 port = reg[0] >> 11; in aplpcie_init_port()
459 if (port >= APLPCIE_MAX_PORTS || sc->sc_port_ios[port] == 0) in aplpcie_init_port()
471 PWRITE4(sc, port, PCIE_PORT_MSI_CTRL, in aplpcie_init_port()
473 PWRITE4(sc, port, PCIE_PORT_MSI_REMAP, 0); in aplpcie_init_port()
474 PWRITE4(sc, port, PCIE_PORT_MSI_DOORBELL, sc->sc_msi_doorbell); in aplpcie_init_port()
480 PWRITE4(sc, port, PCIE_PORT_RID2SID(idx), 0); in aplpcie_init_port()
483 stat = PREAD4(sc, port, PCIE_PORT_LINK_STAT); in aplpcie_init_port()
487 PSET4(sc, port, PCIE_PORT_APPCLK, PCIE_PORT_APPCLK_EN); in aplpcie_init_port()
506 LSET4(sc, port, PCIE_PHY_LANE_CTRL, PCIE_PHY_LANE_CTRL_CFGACC); in aplpcie_init_port()
507 LSET4(sc, port, PCIE_PHY_LANE_CONF, PCIE_PHY_LANE_CONF_REFCLK0REQ); in aplpcie_init_port()
509 stat = LREAD4(sc, port, PCIE_PHY_LANE_CONF); in aplpcie_init_port()
514 LSET4(sc, port, PCIE_PHY_LANE_CONF, PCIE_PHY_LANE_CONF_REFCLK1REQ); in aplpcie_init_port()
516 stat = LREAD4(sc, port, PCIE_PHY_LANE_CONF); in aplpcie_init_port()
521 LCLR4(sc, port, PCIE_PHY_LANE_CTRL, PCIE_PHY_LANE_CTRL_CFGACC); in aplpcie_init_port()
522 LSET4(sc, port, PCIE_PHY_LANE_CONF, in aplpcie_init_port()
524 PSET4(sc, port, PCIE_PORT_REFCLK, PCIE_PORT_REFCLK_EN); in aplpcie_init_port()
537 PSET4(sc, port, PCIE_PORT_PERST, PCIE_PORT_PERST_DIS); in aplpcie_init_port()
542 stat = PREAD4(sc, port, PCIE_PORT_STAT); in aplpcie_init_port()
550 PCLR4(sc, port, PCIE_PORT_REFCLK, PCIE_PORT_REFCLK_CGDIS); in aplpcie_init_port()
551 PCLR4(sc, port, PCIE_PORT_APPCLK, PCIE_PORT_APPCLK_CGDIS); in aplpcie_init_port()
554 PWRITE4(sc, port, PCIE_PORT_LTSSM_CTRL, PCIE_PORT_LTSSM_CTRL_START); in aplpcie_init_port()
556 stat = PREAD4(sc, port, PCIE_PORT_LINK_STAT); in aplpcie_init_port()
572 int idx, msi, port, timo; in aplpcie_t6020_init_port() local
581 port = reg[0] >> 11; in aplpcie_t6020_init_port()
582 if (port >= APLPCIE_MAX_PORTS || sc->sc_port_ios[port] == 0) in aplpcie_t6020_init_port()
594 PWRITE4(sc, port, PCIE_PORT_MSI_CTRL, PCIE_PORT_MSI_CTRL_ENABLE); in aplpcie_t6020_init_port()
596 PWRITE4(sc, port, PCIE_T6020_PORT_MSI_MAP(msi), in aplpcie_t6020_init_port()
598 PWRITE4(sc, port, PCIE_T6020_PORT_MSI_DOORBELL_LO, in aplpcie_t6020_init_port()
600 PWRITE4(sc, port, PCIE_T6020_PORT_MSI_DOORBELL_HI, in aplpcie_t6020_init_port()
607 PWRITE4(sc, port, PCIE_T6020_PORT_RID2SID(idx), 0); in aplpcie_t6020_init_port()
610 stat = PREAD4(sc, port, PCIE_PORT_LINK_STAT); in aplpcie_t6020_init_port()
614 PSET4(sc, port, PCIE_PORT_APPCLK, PCIE_PORT_APPCLK_EN); in aplpcie_t6020_init_port()
633 LSET4(sc, port, PCIE_PHY_LANE_CONF, PCIE_PHY_LANE_CONF_REFCLK0REQ); in aplpcie_t6020_init_port()
635 stat = LREAD4(sc, port, PCIE_PHY_LANE_CONF); in aplpcie_t6020_init_port()
640 LSET4(sc, port, PCIE_PHY_LANE_CONF, PCIE_PHY_LANE_CONF_REFCLK1REQ); in aplpcie_t6020_init_port()
642 stat = LREAD4(sc, port, PCIE_PHY_LANE_CONF); in aplpcie_t6020_init_port()
647 LSET4(sc, port, PCIE_PHY_LANE_CONF, in aplpcie_t6020_init_port()
661 PSET4(sc, port, PCIE_T6020_PORT_PERST, PCIE_PORT_PERST_DIS); in aplpcie_t6020_init_port()
666 stat = PREAD4(sc, port, PCIE_PORT_STAT); in aplpcie_t6020_init_port()
674 LSET4(sc, port, PCIE_PHY_LANE_CONF, in aplpcie_t6020_init_port()
676 PCLR4(sc, port, PCIE_PORT_APPCLK, PCIE_PORT_APPCLK_CGDIS); in aplpcie_t6020_init_port()
679 PWRITE4(sc, port, PCIE_PORT_LTSSM_CTRL, PCIE_PORT_LTSSM_CTRL_START); in aplpcie_t6020_init_port()
681 stat = PREAD4(sc, port, PCIE_PORT_LINK_STAT); in aplpcie_t6020_init_port()
796 aplpcie_map_rid(struct aplpcie_softc *sc, int port, uint16_t rid, uint32_t sid) in aplpcie_map_rid() argument
802 reg = PREAD4(sc, port, PCIE_PORT_RID2SID(idx)); in aplpcie_map_rid()
815 PWRITE4(sc, port, PCIE_PORT_RID2SID(idx), reg); in aplpcie_map_rid()
818 if (PREAD4(sc, port, PCIE_PORT_RID2SID(idx)) != reg) in aplpcie_map_rid()
827 aplpcie_t6020_map_rid(struct aplpcie_softc *sc, int port, uint16_t rid, in aplpcie_t6020_map_rid() argument
834 reg = PREAD4(sc, port, PCIE_T6020_PORT_RID2SID(idx)); in aplpcie_t6020_map_rid()
847 PWRITE4(sc, port, PCIE_T6020_PORT_RID2SID(idx), reg); in aplpcie_t6020_map_rid()
850 if (PREAD4(sc, port, PCIE_T6020_PORT_RID2SID(idx)) != reg) in aplpcie_t6020_map_rid()
864 int error, port; in aplpcie_probe_device_hook() local
879 port = aplpcie_find_port(sc, pa->pa_bus); in aplpcie_probe_device_hook()
880 if (port == -1) in aplpcie_probe_device_hook()
884 error = aplpcie_t6020_map_rid(sc, port, rid, sid); in aplpcie_probe_device_hook()
886 error = aplpcie_map_rid(sc, port, rid, sid); in aplpcie_probe_device_hook()