From owner-svn-src-head@freebsd.org Sun Sep 25 23:48:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FE20BE9B32; Sun, 25 Sep 2016 23:48:17 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC055B51; Sun, 25 Sep 2016 23:48:16 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8PNmFwm065919; Sun, 25 Sep 2016 23:48:15 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8PNmFxH065918; Sun, 25 Sep 2016 23:48:15 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201609252348.u8PNmFxH065918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sun, 25 Sep 2016 23:48:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r306328 - head/sys/arm/nvidia X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2016 23:48:17 -0000 Author: gonzo Date: Sun Sep 25 23:48:15 2016 New Revision: 306328 URL: https://svnweb.freebsd.org/changeset/base/306328 Log: Update PCI driver to match new dts tree In new dts tree phy is a property of port, not the controller node, also the name was changed from "pcie" to "pcie-0" Modified: head/sys/arm/nvidia/tegra_pcie.c Modified: head/sys/arm/nvidia/tegra_pcie.c ============================================================================== --- head/sys/arm/nvidia/tegra_pcie.c Sun Sep 25 23:45:49 2016 (r306327) +++ head/sys/arm/nvidia/tegra_pcie.c Sun Sep 25 23:48:15 2016 (r306328) @@ -266,6 +266,7 @@ struct tegra_pcib_port { int port_idx; /* chip port index */ int num_lanes; /* number of lanes */ bus_size_t afi_pex_ctrl; /* offset of afi_pex_ctrl */ + phy_t phy; /* port phy */ /* Config space properties. */ bus_addr_t rp_base_addr; /* PA of config window */ @@ -291,7 +292,6 @@ struct tegra_pcib_softc { struct ofw_pci_range pref_mem_range; struct ofw_pci_range io_range; - phy_t phy; clk_t clk_pex; clk_t clk_afi; clk_t clk_pll_e; @@ -963,6 +963,15 @@ tegra_pcib_parse_port(struct tegra_pcib_ port->afi_pex_ctrl = tegra_pcib_pex_ctrl(sc, port->port_idx); sc->lanes_cfg |= port->num_lanes << (4 * port->port_idx); + /* Phy. */ + rv = phy_get_by_ofw_name(sc->dev, node, "pcie-0", &port->phy); + if (rv != 0) { + device_printf(sc->dev, + "Cannot get 'pcie-0' phy for port %d\n", + port->port_idx); + goto fail; + } + return (port); fail: free(port, M_DEVBUF); @@ -1067,13 +1076,6 @@ tegra_pcib_parse_fdt_resources(struct te return (ENXIO); } - /* Phy. */ - rv = phy_get_by_ofw_name(sc->dev, 0, "pcie", &sc->phy); - if (rv != 0) { - device_printf(sc->dev, "Cannot get 'pcie' phy\n"); - return (ENXIO); - } - /* Ports */ sc->num_ports = 0; for (child = OF_child(node); child != 0; child = OF_peer(child)) { @@ -1306,13 +1308,19 @@ tegra_pcib_enable(struct tegra_pcib_soft reg &= ~AFI_FUSE_PCIE_T0_GEN2_DIS; AFI_WR4(sc, AFI_FUSE, reg); - /* Enable PCIe phy. */ - rv = phy_enable(sc->dev, sc->phy); - if (rv != 0) { - device_printf(sc->dev, "Cannot enable phy\n"); - return (rv); + for (i = 0; i < TEGRA_PCIB_MAX_PORTS; i++) { + if (sc->ports[i] != NULL) { + rv = phy_enable(sc->dev, sc->ports[i]->phy); + if (rv != 0) { + device_printf(sc->dev, + "Cannot enable phy for port %d\n", + sc->ports[i]->port_idx); + return (rv); + } + } } + rv = hwreset_deassert(sc->hwreset_pcie_x); if (rv != 0) { device_printf(sc->dev, "Cannot unreset 'pci_x' reset\n");