r0p7734.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Copyright (C) 2011 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
  3. * Copyright (C) 2011 Renesas Solutions Corp.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #include <asm/io.h>
  25. #include <asm/processor.h>
  26. #include <netdev.h>
  27. #include <i2c.h>
  28. DECLARE_GLOBAL_DATA_PTR;
  29. #define MODEMR (0xFFCC0020)
  30. #define MODEMR_MASK (0x6)
  31. #define MODEMR_533MHZ (0x2)
  32. int checkboard(void)
  33. {
  34. u32 r = readl(MODEMR);
  35. if ((r & MODEMR_MASK) & MODEMR_533MHZ)
  36. puts("CPU Clock: 533MHz\n");
  37. else
  38. puts("CPU Clock: 400MHz\n");
  39. puts("BOARD: Renesas Technology Corp. R0P7734C00000RZ\n");
  40. return 0;
  41. }
  42. #define MSTPSR1 (0xFFC80044)
  43. #define MSTPCR1 (0xFFC80034)
  44. #define MSTPSR1_GETHER (1 << 14)
  45. int board_init(void)
  46. {
  47. #if defined(CONFIG_SH_ETHER)
  48. u32 r = readl(MSTPSR1);
  49. if (r & MSTPSR1_GETHER)
  50. writel((r & ~MSTPSR1_GETHER), MSTPCR1);
  51. #endif
  52. return 0;
  53. }
  54. int board_late_init(void)
  55. {
  56. u8 mac[6];
  57. /* Read Mac Address and set*/
  58. i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
  59. i2c_set_bus_num(CONFIG_SYS_I2C_MODULE);
  60. /* Read MAC address */
  61. i2c_read(0x50, 0x10, 0, mac, 6);
  62. if (is_valid_ether_addr(mac))
  63. eth_setenv_enetaddr("ethaddr", mac);
  64. return 0;
  65. }
  66. int dram_init(void)
  67. {
  68. gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
  69. gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
  70. printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
  71. return 0;
  72. }
  73. #ifdef CONFIG_SMC911X
  74. int board_eth_init(bd_t *bis)
  75. {
  76. int rc = 0;
  77. rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
  78. return rc;
  79. }
  80. #endif