net2big_v2.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * Copyright (C) 2011 Simon Guinot <sguinot@lacie.com>
  3. *
  4. * Based on Kirkwood support:
  5. * (C) Copyright 2009
  6. * Marvell Semiconductor <www.marvell.com>
  7. * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
  8. *
  9. * See file CREDITS for list of people who contributed to this
  10. * project.
  11. *
  12. * This program is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU General Public License as
  14. * published by the Free Software Foundation; either version 2 of
  15. * the License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. */
  22. #include <common.h>
  23. #include <command.h>
  24. #include <asm/arch/cpu.h>
  25. #include <asm/arch/kirkwood.h>
  26. #include <asm/arch/mpp.h>
  27. #include <asm/arch/gpio.h>
  28. #include "net2big_v2.h"
  29. #include "../common/common.h"
  30. DECLARE_GLOBAL_DATA_PTR;
  31. int board_early_init_f(void)
  32. {
  33. /* GPIO configuration */
  34. kw_config_gpio(NET2BIG_V2_OE_VAL_LOW, NET2BIG_V2_OE_VAL_HIGH,
  35. NET2BIG_V2_OE_LOW, NET2BIG_V2_OE_HIGH);
  36. /* Multi-Purpose Pins Functionality configuration */
  37. u32 kwmpp_config[] = {
  38. MPP0_SPI_SCn,
  39. MPP1_SPI_MOSI,
  40. MPP2_SPI_SCK,
  41. MPP3_SPI_MISO,
  42. MPP6_SYSRST_OUTn,
  43. MPP7_GPO, /* Request power-off */
  44. MPP8_TW_SDA,
  45. MPP9_TW_SCK,
  46. MPP10_UART0_TXD,
  47. MPP11_UART0_RXD,
  48. MPP13_GPIO, /* Rear power switch (on|auto) */
  49. MPP14_GPIO, /* USB fuse alarm */
  50. MPP15_GPIO, /* Rear power switch (auto|off) */
  51. MPP16_GPIO, /* SATA HDD1 power */
  52. MPP17_GPIO, /* SATA HDD2 power */
  53. MPP20_SATA1_ACTn,
  54. MPP21_SATA0_ACTn,
  55. MPP24_GPIO, /* USB mode select */
  56. MPP26_GPIO, /* USB device vbus */
  57. MPP28_GPIO, /* USB enable host vbus */
  58. MPP29_GPIO, /* GPIO extension ALE */
  59. MPP34_GPIO, /* Rear Push button 0=on 1=off */
  60. MPP35_GPIO, /* Inhibit switch power-off */
  61. MPP36_GPIO, /* SATA HDD1 presence */
  62. MPP37_GPIO, /* SATA HDD2 presence */
  63. MPP40_GPIO, /* eSATA presence */
  64. MPP44_GPIO, /* GPIO extension (data 0) */
  65. MPP45_GPIO, /* GPIO extension (data 1) */
  66. MPP46_GPIO, /* GPIO extension (data 2) */
  67. MPP47_GPIO, /* GPIO extension (addr 0) */
  68. MPP48_GPIO, /* GPIO extension (addr 1) */
  69. MPP49_GPIO, /* GPIO extension (addr 2) */
  70. 0
  71. };
  72. kirkwood_mpp_conf(kwmpp_config, NULL);
  73. return 0;
  74. }
  75. int board_init(void)
  76. {
  77. /* Machine number */
  78. gd->bd->bi_arch_number = MACH_TYPE_NET2BIG_V2;
  79. /* Boot parameters address */
  80. gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
  81. return 0;
  82. }
  83. #if defined(CONFIG_MISC_INIT_R)
  84. int misc_init_r(void)
  85. {
  86. #if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)
  87. if (!getenv("ethaddr")) {
  88. uchar mac[6];
  89. if (lacie_read_mac_address(mac) == 0)
  90. eth_setenv_enetaddr("ethaddr", mac);
  91. }
  92. #endif
  93. return 0;
  94. }
  95. #endif
  96. #if defined(CONFIG_CMD_NET) && defined(CONFIG_RESET_PHY_R)
  97. /* Configure and initialize PHY */
  98. void reset_phy(void)
  99. {
  100. mv_phy_88e1116_init("egiga0", 8);
  101. }
  102. #endif
  103. #if defined(CONFIG_KIRKWOOD_GPIO)
  104. /* Return GPIO push button status */
  105. static int
  106. do_read_push_button(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  107. {
  108. return !kw_gpio_get_value(NET2BIG_V2_GPIO_PUSH_BUTTON);
  109. }
  110. U_BOOT_CMD(button, 1, 1, do_read_push_button,
  111. "Return GPIO push button status 0=off 1=on", "");
  112. #endif