25 |
25 |
#include <asm/arch/mmc_host_def.h>
|
26 |
26 |
#include <asm/arch/sys_proto.h>
|
27 |
27 |
#include <asm/arch/mem.h>
|
|
28 |
#include <asm/omap_common.h>
|
28 |
29 |
#include <asm/io.h>
|
29 |
30 |
#include <asm/emif.h>
|
30 |
31 |
#include <asm/gpio.h>
|
... | ... | |
1420 |
1421 |
|
1421 |
1422 |
gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
|
1422 |
|
gpmc_init();
|
|
1423 |
//gpmc_init();
|
1423 |
1424 |
|
1424 |
1425 |
return 0;
|
1425 |
1426 |
}
|
... | ... | |
1447 |
1448 |
///////////
|
1448 |
1449 |
/// Don't change this. Just change phy_addr from 2 to 3 for 2nd slave
|
1449 |
1450 |
static struct cpsw_slave_data cpsw_slaves[] = {
|
1450 |
1451 |
{
|
1451 |
|
.slave_reg_ofs = 0x208,
|
1452 |
|
.sliver_reg_ofs = 0xd80,
|
1453 |
|
#ifdef CONFIG_SPL_USBETH_SUPPORT
|
1454 |
|
.phy_addr = 1,
|
1455 |
|
#else
|
1456 |
|
.phy_addr = 2,
|
1457 |
|
#endif
|
1458 |
|
},
|
|
1452 |
.slave_reg_ofs = 0x200,
|
|
1453 |
.sliver_reg_ofs = 0xd80,
|
|
1454 |
.phy_addr = 3,
|
|
1455 |
},
|
1459 |
1456 |
{
|
1460 |
|
.slave_reg_ofs = 0x308,
|
1461 |
|
.sliver_reg_ofs = 0xdc0,
|
1462 |
|
#ifdef CONFIG_SPL_USBETH_SUPPORT
|
1463 |
|
.phy_addr = 2,
|
1464 |
|
#else
|
1465 |
|
.phy_addr = 1,
|
1466 |
|
#endif
|
1467 |
|
},
|
|
1457 |
.slave_reg_ofs = 0x308,
|
|
1458 |
.sliver_reg_ofs = 0xdc0,
|
|
1459 |
.phy_addr = 1,
|
|
1460 |
},
|
1468 |
1461 |
};
|
1469 |
1462 |
///////////
|
1470 |
1463 |
/// Don't change this, just make sure CONFIG_ETH_PORT is set to 2
|
1471 |
1464 |
static struct cpsw_platform_data cpsw_data = {
|
1472 |
|
.mdio_base = CPSW_MDIO_BASE,
|
1473 |
|
.cpsw_base = CPSW_BASE,
|
1474 |
|
.mdio_div = 0xff,
|
1475 |
|
.channels = 8,
|
1476 |
|
.cpdma_reg_ofs = 0x800,
|
1477 |
|
.slaves = 2,
|
1478 |
|
.slave_data = cpsw_slaves,
|
1479 |
|
.ale_reg_ofs = 0xd00,
|
1480 |
|
.ale_entries = 1024,
|
1481 |
|
.host_port_reg_ofs = 0x108,
|
1482 |
|
.hw_stats_reg_ofs = 0x900,
|
1483 |
|
.bd_ram_ofs = 0x2000,
|
1484 |
|
.mac_control = (1 << 5) /* MIIEN */ ,
|
1485 |
|
.control = cpsw_control,
|
1486 |
|
.host_port_num = 0,
|
1487 |
|
.version = CPSW_CTRL_VERSION_2,
|
1488 |
|
.active_slave = CONFIG_ETH_PORT - 1,
|
|
1465 |
.mdio_base = CPSW_MDIO_BASE,
|
|
1466 |
.cpsw_base = CPSW_BASE,
|
|
1467 |
.mdio_div = 0xff,
|
|
1468 |
.channels = 8,
|
|
1469 |
.cpdma_reg_ofs = 0x800,
|
|
1470 |
.slaves = 1,
|
|
1471 |
.slave_data = cpsw_slaves,
|
|
1472 |
.ale_reg_ofs = 0xd00,
|
|
1473 |
.ale_entries = 1024,
|
|
1474 |
.host_port_reg_ofs = 0x108,
|
|
1475 |
.hw_stats_reg_ofs = 0x900,
|
|
1476 |
.bd_ram_ofs = 0x2000,
|
|
1477 |
.mac_control = (1 << 5),
|
|
1478 |
.control = cpsw_control,
|
|
1479 |
.host_port_num = 0,
|
|
1480 |
.version = CPSW_CTRL_VERSION_2,
|
1489 |
1481 |
};
|
1490 |
1482 |
#endif /* !CONFIG_SPL_BUILD */
|
1491 |
1483 |
|
... | ... | |
1501 |
1493 |
#ifdef CONFIG_MITYSOM_MAKER
|
1502 |
1494 |
env_set("disable_giga", "1");
|
1503 |
1495 |
#endif
|
1504 |
|
|
|
1496 |
|
|
1497 |
printf("Resetting PHY\n");
|
1505 |
1498 |
gpio_request(GPIO_PHY_RESET_N, "gpio3_10");
|
1506 |
1499 |
// Pull into reset
|
1507 |
1500 |
gpio_direction_output(GPIO_PHY_RESET_N, 0);
|
... | ... | |
1527 |
1520 |
|
1528 |
1521 |
debug("<ethaddr> not set. Reading from E-fuse\n");
|
1529 |
1522 |
/* try reading mac address from efuse */
|
1530 |
1523 |
///////////
|
1531 |
1524 |
/// Don't change this, just make sure CONFIG_ETH_PORT is set to 2
|
1532 |
|
#if (CONFIG_ETH_PORT == 1)
|
1533 |
|
mac_lo = readl(&cdev->macid0l);
|
1534 |
|
mac_hi = readl(&cdev->macid0h);
|
1535 |
|
#else
|
1536 |
|
mac_lo = readl(&cdev->macid1l);
|
1537 |
|
mac_hi = readl(&cdev->macid1h);
|
1538 |
|
#endif
|
|
1525 |
/* try reading mac address from efuse */
|
|
1526 |
printf("\r\nHARDIK->: func:%s : file: %s line:%d ", __func__ ,__FILE__, __LINE__);
|
|
1527 |
|
|
1528 |
mac_lo = readl(&cdev->macid0l);
|
|
1529 |
mac_hi = readl(&cdev->macid0h);
|
1539 |
1530 |
mac_addr[0] = mac_hi & 0xFF;
|
1540 |
1531 |
mac_addr[1] = (mac_hi & 0xFF00) >> 8;
|
1541 |
1532 |
mac_addr[2] = (mac_hi & 0xFF0000) >> 16;
|
... | ... | |
1562 |
1553 |
///////////
|
1563 |
1554 |
/// Whether RGMII_INT_DELAY needs to be set or not will need to be played with. This is the same as going between "rgmii" and "rgmii-id" in the dts.
|
1564 |
1555 |
#if !defined(CONFIG_SPL_BUILD)
|
1565 |
1556 |
if (valid_mac)
|
1566 |
1557 |
{
|
1567 |
|
writel(RGMII_MODE_ENABLE, &cdev->miisel);
|
|
1558 |
printf("\r\nHARDIK->: func:%s : file: %s line:%d ", __func__ ,__FILE__, __LINE__);
|
|
1559 |
writel((RGMII_MODE_ENABLE | RGMII_INT_DELAY), &cdev->miisel);
|
1568 |
1560 |
cpsw_slaves[0].phy_if = cpsw_slaves[1].phy_if =
|
1569 |
1561 |
PHY_INTERFACE_MODE_RGMII;
|
1570 |
1562 |
}
|
... | ... | |
1576 |
1568 |
printf("Error %d registering CPSW switch\n", rv);
|
1577 |
1569 |
else
|
1578 |
1570 |
n += rv;
|
1579 |
1571 |
///////////
|
1580 |
1572 |
/// I assume this is trying to set the skew delays in the phy? These may need to be played with.
|
1581 |
1573 |
/// Note you can play with these registers directly using "mdio write" from u-boot shell
|
|
1574 |
printf("\r\nHARDIK->: func:%s : file: %s line:%d ", __func__ ,__FILE__, __LINE__);
|
|
1575 |
const char *devname;
|
|
1576 |
int i,data;
|
|
1577 |
devname = miiphy_get_current_dev();
|
|
1578 |
printf("\r\nHARDIK->: get current dev name device:%s ", devname);
|
|
1579 |
|
|
1580 |
miiphy_write(devname, 0x3,11, 0x8104);
|
|
1581 |
miiphy_write(devname, 0x3, 12, 0xf0f0);
|
|
1582 |
|
|
1583 |
miiphy_write(devname, 0x3,11, 0x8105);
|
|
1584 |
miiphy_write(devname, 0x3, 12, 0x0000);
|
|
1585 |
/*miiphy_write(devname, 0x3,11, 0x8106);*/
|
|
1586 |
/*miiphy_write(devname, 0x3, 12, 0x0000);*/
|
|
1587 |
miiphy_write(devname, 0x3, 9, 0x0100);
|
|
1588 |
printf("\r\nHARDIK->: func:%s : file: %s line:%d ", __func__ ,__FILE__, __LINE__);
|
|
1589 |
|
1582 |
1590 |
#endif
|
1583 |
1591 |
#endif /* !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_USBETH_SUPPORT) */
|
1584 |
1592 |
return n;
|
... | ... | |
1831 |
1839 |
}
|
1832 |
1840 |
#endif /* CONFIG_OF_LIBFDT && CONFIG_OF_SYSTEM_SETUP */
|
1833 |
1841 |
///////////
|
1834 |
1842 |
/// I'm not sure this is a good idea. Should probably be left alone.
|
1835 |
|
#ifndef CONFIG_SPL_BUILD
|
1836 |
|
|
|
1843 |
//#ifndef CONFIG_SPL_BUILD
|
|
1844 |
#if 0
|
1837 |
1845 |
#ifdef CONFIG_BOARD_LATE_INIT
|
1838 |
1846 |
int board_late_init(void)
|
1839 |
1847 |
{
|
... | ... | |
1862 |
1870 |
return 0;
|
1863 |
1871 |
}
|
1864 |
1872 |
#endif /* CONFIG_BOARD_LATE_INIT */
|
|
1873 |
#endif
|
|
1874 |
#ifdef CONFIG_BOARD_LATE_INIT
|
|
1875 |
int board_late_init(void)
|
|
1876 |
{
|
|
1877 |
|
|
1878 |
static bool prueth_is_mii = true;
|
|
1879 |
#if !defined(CONFIG_SPL_BUILD)
|
|
1880 |
uint8_t mac_addr[6];
|
|
1881 |
uint32_t mac_hi, mac_lo;
|
|
1882 |
#endif
|
|
1883 |
printf("\r\nHARDIK->: func:%s : file: %s line:%d ", __func__ ,__FILE__, __LINE__);
|
|
1884 |
|
|
1885 |
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
|
|
1886 |
char *name = NULL;
|
|
1887 |
#if 0
|
|
1888 |
if (board_is_bone_lt()) {
|
|
1889 |
/* BeagleBoard.org BeagleBone Black Wireless: */
|
|
1890 |
if (!strncmp(board_ti_get_rev(), "BWA", 3)) {
|
|
1891 |
name = "BBBW";
|
|
1892 |
}
|
|
1893 |
/* SeeedStudio BeagleBone Green Wireless */
|
|
1894 |
if (!strncmp(board_ti_get_rev(), "GW1", 3)) {
|
|
1895 |
name = "BBGW";
|
|
1896 |
}
|
|
1897 |
/* BeagleBoard.org BeagleBone Blue */
|
|
1898 |
if (!strncmp(board_ti_get_rev(), "BLA", 3)) {
|
|
1899 |
name = "BBBL";
|
|
1900 |
}
|
|
1901 |
}
|
|
1902 |
|
|
1903 |
if (board_is_bbg1())
|
|
1904 |
name = "BBG1";
|
|
1905 |
#endif
|
|
1906 |
// name = "A335X_SK";
|
|
1907 |
//set_board_info_env(name);
|
|
1908 |
env_set("board_name", "MitySOM335x");
|
|
1909 |
|
|
1910 |
/*
|
|
1911 |
* Default FIT boot on HS devices. Non FIT images are not allowed
|
|
1912 |
* on HS devices.
|
|
1913 |
*/
|
|
1914 |
if (get_device_type() == HS_DEVICE)
|
|
1915 |
env_set("boot_fit", "1");
|
|
1916 |
#endif
|
|
1917 |
#if !defined(CONFIG_SPL_BUILD)
|
|
1918 |
/* try reading mac address from efuse */
|
|
1919 |
printf("\r\nHARDIK->: func:%s : file: %s line:%d ", __func__ ,__FILE__, __LINE__);
|
|
1920 |
|
|
1921 |
mac_lo = readl(&cdev->macid0l);
|
|
1922 |
mac_hi = readl(&cdev->macid0h);
|
|
1923 |
mac_addr[0] = mac_hi & 0xFF;
|
|
1924 |
mac_addr[1] = (mac_hi & 0xFF00) >> 8;
|
|
1925 |
mac_addr[2] = (mac_hi & 0xFF0000) >> 16;
|
|
1926 |
mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
|
|
1927 |
mac_addr[4] = mac_lo & 0xFF;
|
|
1928 |
mac_addr[5] = (mac_lo & 0xFF00) >> 8;
|
|
1929 |
|
|
1930 |
if (!env_get("ethaddr")) {
|
|
1931 |
printf("<ethaddr> not set. Validating first E-fuse MAC\n");
|
|
1932 |
printf("\r\nHARDIK->: func:%s : file: %s line:%d ", __func__ ,__FILE__, __LINE__);
|
|
1933 |
if (is_valid_ethaddr(mac_addr))
|
|
1934 |
eth_env_set_enetaddr("ethaddr", mac_addr);
|
|
1935 |
}
|
|
1936 |
printf("\r\nHARDIK->: func:%s : file: %s line:%d ", __func__ ,__FILE__, __LINE__);
|
|
1937 |
mac_lo = readl(&cdev->macid1l);
|
|
1938 |
mac_hi = readl(&cdev->macid1h);
|
|
1939 |
mac_addr[0] = mac_hi & 0xFF;
|
|
1940 |
mac_addr[1] = (mac_hi & 0xFF00) >> 8;
|
|
1941 |
mac_addr[2] = (mac_hi & 0xFF0000) >> 16;
|
|
1942 |
mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
|
|
1943 |
mac_addr[4] = mac_lo & 0xFF;
|
|
1944 |
mac_addr[5] = (mac_lo & 0xFF00) >> 8;
|
|
1945 |
|
|
1946 |
if (!env_get("eth1addr")) {
|
|
1947 |
printf("\r\nHARDIK->: func:%s : file: %s line:%d ", __func__ ,__FILE__, __LINE__);
|
|
1948 |
if (is_valid_ethaddr(mac_addr))
|
|
1949 |
{
|
|
1950 |
printf("\r\nHARDIK->: func:%s : file: %s line:%d ", __func__ ,__FILE__, __LINE__);
|
|
1951 |
eth_env_set_enetaddr("eth1addr", mac_addr);
|
|
1952 |
}
|
|
1953 |
}
|
|
1954 |
|
|
1955 |
printf("\r\nHARDIK->: func:%s : file: %s line:%d ", __func__ ,__FILE__, __LINE__);
|
|
1956 |
env_set("ice_mii", prueth_is_mii ? "mii" : "rmii");
|
|
1957 |
#endif
|
|
1958 |
printf("\r\nHARDIK->: func:%s : file: %s line:%d ", __func__ ,__FILE__, __LINE__);
|
|
1959 |
return 0;
|
|
1960 |
}
|
|
1961 |
//#endif
|
|
1962 |
|
|
1963 |
//#endif
|
|
1964 |
|
|
1965 |
|
1865 |
1966 |
#endif /* CONFIG_SPL_BUILD */
|