Merge branch 'master' of git://git.denx.de/u-boot-net
This commit is contained in:
		
						commit
						d8c4eb60f8
					
				|  | @ -25,6 +25,11 @@ | |||
| 		reg = <0x0 0x80000000 0x0 0x60000000>; | ||||
| 	}; | ||||
| 
 | ||||
| 	ethernet@2490000 { | ||||
| 		status = "okay"; | ||||
| 		phy-reset-gpios = <&gpio_main TEGRA_MAIN_GPIO(M, 4) GPIO_ACTIVE_LOW>; | ||||
| 	}; | ||||
| 
 | ||||
| 	i2c@3160000 { | ||||
| 		status = "okay"; | ||||
| 	}; | ||||
|  |  | |||
|  | @ -31,6 +31,26 @@ | |||
| 		#interrupt-cells = <2>; | ||||
| 	}; | ||||
| 
 | ||||
| 	ethernet@2490000 { | ||||
| 		compatible = "nvidia,tegra186-eqos", "snps,dwc-qos-ethernet-4.10"; | ||||
| 		reg = <0x0 0x02490000 0x0 0x10000>; | ||||
| 		interrupts = <GIC_SPI 194 IRQ_TYPE_LEVEL_HIGH>; | ||||
| 		clocks = <&bpmp TEGRA186_CLK_AXI_CBB>, | ||||
| 			<&bpmp TEGRA186_CLK_EQOS_AXI>, | ||||
| 			<&bpmp TEGRA186_CLK_EQOS_RX>, | ||||
| 			<&bpmp TEGRA186_CLK_EQOS_PTP_REF>, | ||||
| 			<&bpmp TEGRA186_CLK_EQOS_TX>; | ||||
| 		clock-names = "slave_bus", | ||||
| 			"master_bus", | ||||
| 			"rx", | ||||
| 			"ptp_ref", | ||||
| 			"tx"; | ||||
| 		resets = <&bpmp TEGRA186_RESET_EQOS>; | ||||
| 		reset-names = "eqos"; | ||||
| 		phy-mode = "rgmii"; | ||||
| 		status = "disabled"; | ||||
| 	}; | ||||
| 
 | ||||
| 	uarta: serial@3100000 { | ||||
| 		compatible = "nvidia,tegra186-uart", "nvidia,tegra20-uart"; | ||||
| 		reg = <0x0 0x03100000 0x0 0x10000>; | ||||
|  |  | |||
|  | @ -24,7 +24,12 @@ int board_init(void) | |||
| 	return tegra_board_init(); | ||||
| } | ||||
| 
 | ||||
| int board_late_init(void) | ||||
| __weak int tegra_soc_board_init_late(void) | ||||
| { | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| int board_late_init(void) | ||||
| { | ||||
| 	return tegra_soc_board_init_late(); | ||||
| } | ||||
|  |  | |||
|  | @ -4,5 +4,6 @@ | |||
| 
 | ||||
| obj-y += ../board186.o | ||||
| obj-y += cache.o | ||||
| obj-y += nvtboot_board.o | ||||
| obj-y += nvtboot_ll.o | ||||
| obj-y += nvtboot_mem.o | ||||
|  |  | |||
|  | @ -0,0 +1,54 @@ | |||
| /*
 | ||||
|  * Copyright (c) 2016, NVIDIA CORPORATION. | ||||
|  * | ||||
|  * SPDX-License-Identifier: GPL-2.0+ | ||||
|  */ | ||||
| 
 | ||||
| #include <common.h> | ||||
| #include <fdt_support.h> | ||||
| #include <fdtdec.h> | ||||
| #include <asm/arch/tegra.h> | ||||
| 
 | ||||
| extern unsigned long nvtboot_boot_x0; | ||||
| 
 | ||||
| /*
 | ||||
|  * Attempt to use /chosen/nvidia,ether-mac in the nvtboot DTB to U-Boot's | ||||
|  * ethaddr environment variable if possible. | ||||
|  */ | ||||
| static int set_ethaddr_from_nvtboot(void) | ||||
| { | ||||
| 	const void *nvtboot_blob = (void *)nvtboot_boot_x0; | ||||
| 	int ret, node, len; | ||||
| 	const u32 *prop; | ||||
| 
 | ||||
| 	/* Already a valid address in the environment? If so, keep it */ | ||||
| 	if (getenv("ethaddr")) | ||||
| 		return 0; | ||||
| 
 | ||||
| 	node = fdt_path_offset(nvtboot_blob, "/chosen"); | ||||
| 	if (node < 0) { | ||||
| 		printf("Can't find /chosen node in nvtboot DTB\n"); | ||||
| 		return node; | ||||
| 	} | ||||
| 	prop = fdt_getprop(nvtboot_blob, node, "nvidia,ether-mac", &len); | ||||
| 	if (!prop) { | ||||
| 		printf("Can't find nvidia,ether-mac property in nvtboot DTB\n"); | ||||
| 		return -ENOENT; | ||||
| 	} | ||||
| 
 | ||||
| 	ret = setenv("ethaddr", (void *)prop); | ||||
| 	if (ret) { | ||||
| 		printf("Failed to set ethaddr from nvtboot DTB: %d\n", ret); | ||||
| 		return ret; | ||||
| 	} | ||||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| int tegra_soc_board_init_late(void) | ||||
| { | ||||
| 	/* Ignore errors here; not all cases care about Ethernet addresses */ | ||||
| 	set_ethaddr_from_nvtboot(); | ||||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
|  | @ -30,6 +30,7 @@ CONFIG_CMD_FS_GENERIC=y | |||
| # CONFIG_BLK is not set | ||||
| CONFIG_TEGRA186_BPMP_I2C=y | ||||
| # CONFIG_DM_MMC_OPS is not set | ||||
| CONFIG_DWC_ETH_QOS=y | ||||
| CONFIG_E1000=y | ||||
| CONFIG_RTL8169=y | ||||
| CONFIG_PCI=y | ||||
|  |  | |||
|  | @ -30,6 +30,7 @@ CONFIG_CMD_FS_GENERIC=y | |||
| # CONFIG_BLK is not set | ||||
| CONFIG_TEGRA186_BPMP_I2C=y | ||||
| # CONFIG_DM_MMC_OPS is not set | ||||
| CONFIG_DWC_ETH_QOS=y | ||||
| CONFIG_E1000=y | ||||
| CONFIG_RTL8169=y | ||||
| CONFIG_PCI=y | ||||
|  |  | |||
|  | @ -0,0 +1,166 @@ | |||
| * Synopsys DWC Ethernet QoS IP version 4.10 driver (GMAC) | ||||
| 
 | ||||
| This binding supports the Synopsys Designware Ethernet QoS (Quality Of Service) | ||||
| IP block. The IP supports multiple options for bus type, clocking and reset | ||||
| structure, and feature list. Consequently, a number of properties and list | ||||
| entries in properties are marked as optional, or only required in specific HW | ||||
| configurations. | ||||
| 
 | ||||
| Required properties: | ||||
| - compatible: One of: | ||||
|   - "axis,artpec6-eqos", "snps,dwc-qos-ethernet-4.10" | ||||
|     Represents the IP core when integrated into the Axis ARTPEC-6 SoC. | ||||
|   - "nvidia,tegra186-eqos", "snps,dwc-qos-ethernet-4.10" | ||||
|     Represents the IP core when integrated into the NVIDIA Tegra186 SoC. | ||||
|   - "snps,dwc-qos-ethernet-4.10" | ||||
|     This combination is deprecated. It should be treated as equivalent to | ||||
|     "axis,artpec6-eqos", "snps,dwc-qos-ethernet-4.10". It is supported to be | ||||
|     compatible with earlier revisions of this binding. | ||||
| - reg: Address and length of the register set for the device | ||||
| - clocks: Phandle and clock specifiers for each entry in clock-names, in the | ||||
|   same order. See ../clock/clock-bindings.txt. | ||||
| - clock-names: May contain any/all of the following depending on the IP | ||||
|   configuration, in any order: | ||||
|   - "tx" | ||||
|     The EQOS transmit path clock. The HW signal name is clk_tx_i. | ||||
|     In some configurations (e.g. GMII/RGMII), this clock also drives the PHY TX | ||||
|     path. In other configurations, other clocks (such as tx_125, rmii) may | ||||
|     drive the PHY TX path. | ||||
|   - "rx" | ||||
|     The EQOS receive path clock. The HW signal name is clk_rx_i. | ||||
|     In some configurations (e.g. GMII/RGMII), this clock is derived from the | ||||
|     PHY's RX clock output. In other configurations, other clocks (such as | ||||
|     rx_125, rmii) may drive the EQOS RX path. | ||||
|     In cases where the PHY clock is directly fed into the EQOS receive path | ||||
|     without intervening logic, the DT need not represent this clock, since it | ||||
|     is assumed to be fully under the control of the PHY device/driver. In | ||||
|     cases where SoC integration adds additional logic to this path, such as a | ||||
|     SW-controlled clock gate, this clock should be represented in DT. | ||||
|   - "slave_bus" | ||||
|     The CPU/slave-bus (CSR) interface clock. This applies to any bus type; | ||||
|     APB, AHB, AXI, etc. The HW signal name is hclk_i (AHB) or clk_csr_i (other | ||||
|     buses). | ||||
|   - "master_bus" | ||||
|     The master bus interface clock. Only required in configurations that use a | ||||
|     separate clock for the master and slave bus interfaces. The HW signal name | ||||
|     is hclk_i (AHB) or aclk_i (AXI). | ||||
|   - "ptp_ref" | ||||
|     The PTP reference clock. The HW signal name is clk_ptp_ref_i. | ||||
|   - "phy_ref_clk" | ||||
|     This clock is deprecated and should not be used by new compatible values. | ||||
|     It is equivalent to "tx". | ||||
|   - "apb_pclk" | ||||
|     This clock is deprecated and should not be used by new compatible values. | ||||
|     It is equivalent to "slave_bus". | ||||
| 
 | ||||
|   Note: Support for additional IP configurations may require adding the | ||||
|   following clocks to this list in the future: clk_rx_125_i, clk_tx_125_i, | ||||
|   clk_pmarx_0_i, clk_pmarx1_i, clk_rmii_i, clk_revmii_rx_i, clk_revmii_tx_i. | ||||
|   Configurations exist where multiple similar clocks are used at once, e.g. all | ||||
|   of clk_rx_125_i, clk_pmarx_0_i, clk_pmarx1_i. For this reason it is best to | ||||
|   extend the binding with a separate clock-names entry for each of those RX | ||||
|   clocks, rather than repurposing the existing "rx" clock-names entry as a | ||||
|   generic/logical clock in a similar fashion to "master_bus" and "slave_bus". | ||||
|   This will allow easy support for configurations that support multiple PHY | ||||
|   interfaces using a mux, and hence need to have explicit control over | ||||
|   specific RX clocks. | ||||
| 
 | ||||
|   The following compatible values require the following set of clocks: | ||||
|   - "nvidia,tegra186-eqos", "snps,dwc-qos-ethernet-4.10": | ||||
|     - "slave_bus" | ||||
|     - "master_bus" | ||||
|     - "rx" | ||||
|     - "tx" | ||||
|     - "ptp_ref" | ||||
|   - "axis,artpec6-eqos", "snps,dwc-qos-ethernet-4.10": | ||||
|     - "slave_bus" | ||||
|     - "master_bus" | ||||
|     - "tx" | ||||
|     - "ptp_ref" | ||||
|   - "snps,dwc-qos-ethernet-4.10" (deprecated): | ||||
|     - "phy_ref_clk" | ||||
|     - "apb_clk" | ||||
| - interrupt-parent: Should be the phandle for the interrupt controller | ||||
|   that services interrupts for this device | ||||
| - interrupts: Should contain the core's combined interrupt signal | ||||
| - phy-mode: See ethernet.txt file in the same directory | ||||
| - resets: Phandle and reset specifiers for each entry in reset-names, in the | ||||
|   same order. See ../reset/reset.txt. | ||||
| - reset-names: May contain any/all of the following depending on the IP | ||||
|   configuration, in any order: | ||||
|   - "eqos". The reset to the entire module. The HW signal name is hreset_n | ||||
|     (AHB) or aresetn_i (AXI). | ||||
| 
 | ||||
|   The following compatible values require the following set of resets: | ||||
|   (the reset properties may be omitted if empty) | ||||
|   - "nvidia,tegra186-eqos", "snps,dwc-qos-ethernet-4.10": | ||||
|     - "eqos". | ||||
|   - "axis,artpec6-eqos", "snps,dwc-qos-ethernet-4.10": | ||||
|     - None. | ||||
|   - "snps,dwc-qos-ethernet-4.10" (deprecated): | ||||
|     - None. | ||||
| 
 | ||||
| Optional properties: | ||||
| - dma-coherent: Present if dma operations are coherent | ||||
| - mac-address: See ethernet.txt in the same directory | ||||
| - local-mac-address: See ethernet.txt in the same directory | ||||
| - phy-reset-gpios: Phandle and specifier for any GPIO used to reset the PHY. | ||||
|   See ../gpio/gpio.txt. | ||||
| - snps,en-lpi: If present it enables use of the AXI low-power interface | ||||
| - snps,write-requests: Number of write requests that the AXI port can issue. | ||||
|   It depends on the SoC configuration. | ||||
| - snps,read-requests: Number of read requests that the AXI port can issue. | ||||
|   It depends on the SoC configuration. | ||||
| - snps,burst-map: Bitmap of allowed AXI burst lengts, with the LSB | ||||
|   representing 4, then 8 etc. | ||||
| - snps,txpbl: DMA Programmable burst length for the TX DMA | ||||
| - snps,rxpbl: DMA Programmable burst length for the RX DMA | ||||
| - snps,en-tx-lpi-clockgating: Enable gating of the MAC TX clock during | ||||
|   TX low-power mode. | ||||
| - phy-handle: See ethernet.txt file in the same directory | ||||
| - mdio device tree subnode: When the GMAC has a phy connected to its local | ||||
|     mdio, there must be device tree subnode with the following | ||||
|     required properties: | ||||
|     - compatible: Must be "snps,dwc-qos-ethernet-mdio". | ||||
|     - #address-cells: Must be <1>. | ||||
|     - #size-cells: Must be <0>. | ||||
| 
 | ||||
|     For each phy on the mdio bus, there must be a node with the following | ||||
|     fields: | ||||
| 
 | ||||
|     - reg: phy id used to communicate to phy. | ||||
|     - device_type: Must be "ethernet-phy". | ||||
|     - fixed-mode device tree subnode: see fixed-link.txt in the same directory | ||||
| 
 | ||||
| Examples: | ||||
| ethernet2@40010000 { | ||||
| 	clock-names = "phy_ref_clk", "apb_pclk"; | ||||
| 	clocks = <&clkc 17>, <&clkc 15>; | ||||
| 	compatible = "snps,dwc-qos-ethernet-4.10"; | ||||
| 	interrupt-parent = <&intc>; | ||||
| 	interrupts = <0x0 0x1e 0x4>; | ||||
| 	reg = <0x40010000 0x4000>; | ||||
| 	phy-handle = <&phy2>; | ||||
| 	phy-mode = "gmii"; | ||||
| 	phy-reset-gpios = <&gpioctlr 43 GPIO_ACTIVE_LOW>; | ||||
| 
 | ||||
| 	snps,en-tx-lpi-clockgating; | ||||
| 	snps,en-lpi; | ||||
| 	snps,write-requests = <2>; | ||||
| 	snps,read-requests = <16>; | ||||
| 	snps,burst-map = <0x7>; | ||||
| 	snps,txpbl = <8>; | ||||
| 	snps,rxpbl = <2>; | ||||
| 
 | ||||
| 	dma-coherent; | ||||
| 
 | ||||
| 	mdio { | ||||
| 		#address-cells = <0x1>; | ||||
| 		#size-cells = <0x0>; | ||||
| 		phy2: phy@1 { | ||||
| 			compatible = "ethernet-phy-ieee802.3-c22"; | ||||
| 			device_type = "ethernet-phy"; | ||||
| 			reg = <0x1>; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | @ -64,6 +64,17 @@ config ALTERA_TSE | |||
| 	  Please find details on the "Triple-Speed Ethernet MegaCore Function | ||||
| 	  Resource Center" of Altera. | ||||
| 
 | ||||
| config DWC_ETH_QOS | ||||
| 	bool "Synopsys DWC Ethernet QOS device support" | ||||
| 	depends on DM_ETH | ||||
| 	select PHYLIB | ||||
| 	help | ||||
| 	  This driver supports the Synopsys Designware Ethernet QOS (Quality | ||||
| 	  Of Service) IP block. The IP supports many options for bus type, | ||||
| 	  clocking/reset structure, and feature list. This driver currently | ||||
| 	  supports the specific configuration used in NVIDIA's Tegra186 chip, | ||||
| 	  but should be extensible to other combinations quite easily. | ||||
| 
 | ||||
| config E1000 | ||||
| 	bool "Intel PRO/1000 Gigabit Ethernet support" | ||||
| 	help | ||||
|  |  | |||
|  | @ -76,3 +76,4 @@ obj-$(CONFIG_FSL_MC_ENET) += ldpaa_eth/ | |||
| obj-$(CONFIG_FSL_MEMAC) += fm/memac_phy.o | ||||
| obj-$(CONFIG_VSC9953) += vsc9953.o | ||||
| obj-$(CONFIG_PIC32_ETH) += pic32_mdio.o pic32_eth.o | ||||
| obj-$(CONFIG_DWC_ETH_QOS) += dwc_eth_qos.o | ||||
|  |  | |||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							|  | @ -177,25 +177,6 @@ static int smi_reg_write(struct mii_dev *bus, int phy_adr, int devad, | |||
| } | ||||
| #endif | ||||
| 
 | ||||
| #if defined(CONFIG_PHYLIB) | ||||
| int mvgbe_phy_read(struct mii_dev *bus, int phy_addr, int dev_addr, | ||||
| 		   int reg_addr) | ||||
| { | ||||
| 	u16 data; | ||||
| 	int ret; | ||||
| 	ret = smi_reg_read(bus->name, phy_addr, reg_addr, &data); | ||||
| 	if (ret) | ||||
| 		return ret; | ||||
| 	return data; | ||||
| } | ||||
| 
 | ||||
| int mvgbe_phy_write(struct mii_dev *bus, int phy_addr, int dev_addr, | ||||
| 		    int reg_addr, u16 data) | ||||
| { | ||||
| 	return smi_reg_write(bus->name, phy_addr, reg_addr, data); | ||||
| } | ||||
| #endif | ||||
| 
 | ||||
| /* Stop and checks all queues */ | ||||
| static void stop_queue(u32 * qreg) | ||||
| { | ||||
|  | @ -676,8 +657,8 @@ int mvgbe_phylib_init(struct eth_device *dev, int phyid) | |||
| 		printf("mdio_alloc failed\n"); | ||||
| 		return -ENOMEM; | ||||
| 	} | ||||
| 	bus->read = mvgbe_phy_read; | ||||
| 	bus->write = mvgbe_phy_write; | ||||
| 	bus->read = smi_reg_read; | ||||
| 	bus->write = smi_reg_write; | ||||
| 	strcpy(bus->name, dev->name); | ||||
| 
 | ||||
| 	ret = mdio_register(bus); | ||||
|  | @ -688,7 +669,7 @@ int mvgbe_phylib_init(struct eth_device *dev, int phyid) | |||
| 	} | ||||
| 
 | ||||
| 	/* Set phy address of the port */ | ||||
| 	mvgbe_phy_write(bus, MV_PHY_ADR_REQUEST, 0, MV_PHY_ADR_REQUEST, phyid); | ||||
| 	smi_reg_write(bus, MV_PHY_ADR_REQUEST, 0, MV_PHY_ADR_REQUEST, phyid); | ||||
| 
 | ||||
| 	phydev = phy_connect(bus, phyid, dev, PHY_INTERFACE_MODE_RGMII); | ||||
| 	if (!phydev) { | ||||
|  |  | |||
|  | @ -415,11 +415,31 @@ static int ksz9031_of_config(struct phy_device *phydev) | |||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| static int ksz9031_center_flp_timing(struct phy_device *phydev) | ||||
| { | ||||
| 	struct phy_driver *drv = phydev->drv; | ||||
| 	int ret = 0; | ||||
| 
 | ||||
| 	if (!drv || !drv->writeext) | ||||
| 		return -EOPNOTSUPP; | ||||
| 
 | ||||
| 	ret = drv->writeext(phydev, 0, 0, MII_KSZ9031_FLP_BURST_TX_LO, 0x1A80); | ||||
| 	if (ret) | ||||
| 		return ret; | ||||
| 
 | ||||
| 	ret = drv->writeext(phydev, 0, 0, MII_KSZ9031_FLP_BURST_TX_HI, 0x6); | ||||
| 	return ret; | ||||
| } | ||||
| #else | ||||
| static int ksz9031_of_config(struct phy_device *phydev) | ||||
| { | ||||
| 	return 0; | ||||
| } | ||||
| static int ksz9031_center_flp_timing(struct phy_device *phydev) | ||||
| { | ||||
| 	return 0; | ||||
| } | ||||
| #endif | ||||
| 
 | ||||
| /* Accessors to extended registers*/ | ||||
|  | @ -470,6 +490,9 @@ static int ksz9031_config(struct phy_device *phydev) | |||
| { | ||||
| 	int ret; | ||||
| 	ret = ksz9031_of_config(phydev); | ||||
| 	if (ret) | ||||
| 		return ret; | ||||
| 	ret = ksz9031_center_flp_timing(phydev); | ||||
| 	if (ret) | ||||
| 		return ret; | ||||
| 	return genphy_config(phydev); | ||||
|  |  | |||
|  | @ -20,6 +20,9 @@ | |||
| #define MII_KSZ9031_EXT_RGMII_TX_DATA_SKEW	0x6 | ||||
| #define MII_KSZ9031_EXT_RGMII_CLOCK_SKEW	0x8 | ||||
| 
 | ||||
| #define MII_KSZ9031_FLP_BURST_TX_LO		0x3 | ||||
| #define MII_KSZ9031_FLP_BURST_TX_HI		0x4 | ||||
| 
 | ||||
| /* Registers */ | ||||
| #define MMD_ACCESS_CONTROL	0xd | ||||
| #define MMD_ACCESS_REG_DATA	0xe | ||||
|  |  | |||
|  | @ -512,7 +512,8 @@ static int eth_post_probe(struct udevice *dev) | |||
| 		eth_setenv_enetaddr_by_index("eth", dev->seq, pdata->enetaddr); | ||||
| 		printf("\nWarning: %s using MAC address from ROM\n", | ||||
| 		       dev->name); | ||||
| 	} else if (is_zero_ethaddr(pdata->enetaddr)) { | ||||
| 	} else if (is_zero_ethaddr(pdata->enetaddr) || | ||||
| 		   !is_valid_ethaddr(pdata->enetaddr)) { | ||||
| #ifdef CONFIG_NET_RANDOM_ETHADDR | ||||
| 		net_random_ethaddr(pdata->enetaddr); | ||||
| 		printf("\nWarning: %s (eth%d) using random MAC address - %pM\n", | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue