]> git.sur5r.net Git - u-boot/blobdiff - board/renesas/porter/porter.c
ARM: rmobile: Contain CONFIG_ARCH_RMOBILE_BOARD_STRING
[u-boot] / board / renesas / porter / porter.c
index 86dea8bfa7a3bf85c437bffde313df9faa3de3f2..fcf4ff90f02c694193b027c7a22e8045021babd5 100644 (file)
@@ -11,6 +11,7 @@
 #include <malloc.h>
 #include <dm.h>
 #include <dm/platform_data/serial_sh.h>
+#include <environment.h>
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
@@ -65,11 +66,19 @@ int board_early_init_f(void)
        return 0;
 }
 
+#define ETHERNET_PHY_RESET     176     /* GPIO 5 22 */
+
 int board_init(void)
 {
        /* adress of boot parameters */
        gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
 
+       /* Force ethernet PHY out of reset */
+       gpio_request(ETHERNET_PHY_RESET, "phy_reset");
+       gpio_direction_output(ETHERNET_PHY_RESET, 0);
+       mdelay(10);
+       gpio_direction_output(ETHERNET_PHY_RESET, 1);
+
        return 0;
 }
 
@@ -102,16 +111,40 @@ int board_phy_config(struct phy_device *phydev)
        return 0;
 }
 
-const struct rmobile_sysinfo sysinfo = {
-       CONFIG_ARCH_RMOBILE_BOARD_STRING
-};
-
 void reset_cpu(ulong addr)
 {
-       u8 val;
+       struct udevice *dev;
+       const u8 pmic_bus = 6;
+       const u8 pmic_addr = 0x5a;
+       u8 data;
+       int ret;
+
+       ret = i2c_get_chip_for_busnum(pmic_bus, pmic_addr, 1, &dev);
+       if (ret)
+               hang();
+
+       ret = dm_i2c_read(dev, 0x13, &data, 1);
+       if (ret)
+               hang();
+
+       data |= BIT(1);
+
+       ret = dm_i2c_write(dev, 0x13, &data, 1);
+       if (ret)
+               hang();
+}
+
+enum env_location env_get_location(enum env_operation op, int prio)
+{
+       const u32 load_magic = 0xb33fc0de;
+
+       /* Block environment access if loaded using JTAG */
+       if ((readl(CONFIG_SPL_TEXT_BASE + 0x24) == load_magic) &&
+           (op != ENVOP_INIT))
+               return ENVL_UNKNOWN;
+
+       if (prio)
+               return ENVL_UNKNOWN;
 
-       i2c_set_bus_num(2); /* PowerIC connected to ch2 */
-       i2c_read(CONFIG_SYS_I2C_POWERIC_ADDR, 0x13, 1, &val, 1);
-       val |= 0x02;
-       i2c_write(CONFIG_SYS_I2C_POWERIC_ADDR, 0x13, 1, &val, 1);
+       return ENVL_SPI_FLASH;
 }