Пример #1
0
static void ft_fixup_port(void *blob, struct fm_eth_info *info, char *prop)
{
    int off;
    uint32_t ph;
    phys_addr_t paddr = CONFIG_SYS_CCSRBAR_PHYS + info->compat_offset;
    u64 dtsec1_addr = (u64)CONFIG_SYS_CCSRBAR_PHYS +
                      CONFIG_SYS_FSL_FM1_DTSEC1_OFFSET;

    off = fdt_node_offset_by_compat_reg(blob, prop, paddr);

    if (info->enabled) {
        fdt_fixup_phy_connection(blob, off, info->enet_if);
        board_ft_fman_fixup_port(blob, prop, paddr, info->port, off);
        return ;
    }

#ifdef CONFIG_SYS_FMAN_V3
    /*
     * Physically FM1_DTSEC9 and FM1_10GEC1 use the same dual-role MAC, when
     * FM1_10GEC1 is enabled and  FM1_DTSEC9 is disabled, ensure that the
     * dual-role MAC is not disabled, ditto for other dual-role MACs.
     */
    if (((info->port == FM1_DTSEC9) && (PORT_IS_ENABLED(FM1_10GEC1)))	||
            ((info->port == FM1_DTSEC10) && (PORT_IS_ENABLED(FM1_10GEC2)))	||
            ((info->port == FM1_10GEC1) && (PORT_IS_ENABLED(FM1_DTSEC9)))	||
            ((info->port == FM1_10GEC2) && (PORT_IS_ENABLED(FM1_DTSEC10)))
#if (CONFIG_SYS_NUM_FMAN == 2)
            ||
            ((info->port == FM2_DTSEC9) && (PORT_IS_ENABLED(FM2_10GEC1)))	||
            ((info->port == FM2_DTSEC10) && (PORT_IS_ENABLED(FM2_10GEC2)))	||
            ((info->port == FM2_10GEC1) && (PORT_IS_ENABLED(FM2_DTSEC9)))	||
            ((info->port == FM2_10GEC2) && (PORT_IS_ENABLED(FM2_DTSEC10)))
#endif
       )
        return;
#endif
    /* board code might have caused offset to change */
    off = fdt_node_offset_by_compat_reg(blob, prop, paddr);

    /* Don't disable FM1-DTSEC1 MAC as its used for MDIO */
    if (paddr != dtsec1_addr)
        fdt_status_disabled(blob, off); /* disable the MAC node */

    /* disable the fsl,dpa-ethernet node that points to the MAC */
    ph = fdt_get_phandle(blob, off);
    do_fixup_by_prop(blob, "fsl,fman-mac", &ph, sizeof(ph),
                     "status", "disabled", strlen("disabled") + 1, 1);
}
Пример #2
0
static void __ft_tsec_fixup(void *blob, bd_t *bd, const char *alias,
			    int phy_addr)
{
	const u32 *ph;
	int off;
	int err;

	off = fdt_path_offset(blob, alias);
	if (off < 0) {
		printf("WARNING: could not find %s alias: %s.\n", alias,
			fdt_strerror(off));
		return;
	}

	err = fdt_fixup_phy_connection(blob, off, SGMII);

	if (err) {
		printf("WARNING: could not set phy-connection-type for %s: "
			"%s.\n", alias, fdt_strerror(err));
		return;
	}

	ph = (u32 *)fdt_getprop(blob, off, "phy-handle", 0);
	if (!ph) {
		printf("WARNING: could not get phy-handle for %s.\n",
			alias);
		return;
	}

	off = fdt_node_offset_by_phandle(blob, *ph);
	if (off < 0) {
		printf("WARNING: could not get phy node for %s: %s\n", alias,
			fdt_strerror(off));
		return;
	}

	phy_addr = cpu_to_fdt32(phy_addr);
	err = fdt_setprop(blob, off, "reg", &phy_addr, sizeof(phy_addr));
	if (err < 0) {
		printf("WARNING: could not set phy node's reg for %s: "
			"%s.\n", alias, fdt_strerror(err));
		return;
	}
}
Пример #3
0
void ft_board_setup(void *blob, bd_t *bd)
{
#if defined(CONFIG_SYS_UCC_RMII_MODE)
	int nodeoff, off, err;
	unsigned int val;
	const u32 *ph;
	const u32 *index;

	/* fixup device tree for supporting rmii mode */
	nodeoff = -1;
	while ((nodeoff = fdt_node_offset_by_compatible(blob, nodeoff,
				"ucc_geth")) >= 0) {
		err = fdt_setprop_string(blob, nodeoff, "tx-clock-name",
						"clk16");
		if (err < 0) {
			printf("WARNING: could not set tx-clock-name %s.\n",
				fdt_strerror(err));
			break;
		}

		err = fdt_fixup_phy_connection(blob, nodeoff,
				PHY_INTERFACE_MODE_RMII);

		if (err < 0) {
			printf("WARNING: could not set phy-connection-type "
				"%s.\n", fdt_strerror(err));
			break;
		}

		index = fdt_getprop(blob, nodeoff, "cell-index", 0);
		if (index == NULL) {
			printf("WARNING: could not get cell-index of ucc\n");
			break;
		}

		ph = fdt_getprop(blob, nodeoff, "phy-handle", 0);
		if (ph == NULL) {
			printf("WARNING: could not get phy-handle of ucc\n");
			break;
		}

		off = fdt_node_offset_by_phandle(blob, *ph);
		if (off < 0) {
			printf("WARNING: could not get phy node	%s.\n",
				fdt_strerror(err));
			break;
		}

		val = 0x7 + *index; /* RMII phy address starts from 0x8 */

		err = fdt_setprop(blob, off, "reg", &val, sizeof(u32));
		if (err < 0) {
			printf("WARNING: could not set reg for phy-handle "
				"%s.\n", fdt_strerror(err));
			break;
		}
	}
#endif
	ft_cpu_setup(blob, bd);

	FT_FSL_PCI_SETUP;

	fdt_board_fixup_esdhc(blob, bd);
	fdt_board_fixup_qe_uart(blob, bd);
	fdt_board_fixup_qe_usb(blob, bd);
}