shmin.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * Copyright (C) 2007 - 2010
  3. * Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
  4. * (C) Copyright 2000-2003
  5. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  6. * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
  7. *
  8. * board/shmin/shmin.c
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  23. * MA 02111-1307 USA
  24. *
  25. * Copy board_flash_get_legacy() from board/freescale/m54455evb/m54455evb.c
  26. */
  27. #include <common.h>
  28. #include <asm/io.h>
  29. #include <asm/processor.h>
  30. #include <netdev.h>
  31. int checkboard(void)
  32. {
  33. puts("BOARD: T-SH7706LAN ");
  34. if(readb(0xb0008006) == 0xab)
  35. puts("v2\n");
  36. else
  37. puts("v1\n");
  38. return 0;
  39. }
  40. int board_init(void)
  41. {
  42. writew(0x2980, BCR2);
  43. return 0;
  44. }
  45. int dram_init(void)
  46. {
  47. DECLARE_GLOBAL_DATA_PTR;
  48. gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
  49. gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
  50. printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
  51. return 0;
  52. }
  53. int board_eth_init(bd_t *bis)
  54. {
  55. return ne2k_register();
  56. }
  57. void led_set_state(unsigned short value)
  58. {
  59. }
  60. #if defined(CONFIG_FLASH_CFI_LEGACY)
  61. #include <flash.h>
  62. ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
  63. {
  64. int sect[] = CONFIG_SYS_ATMEL_SECT;
  65. int sectsz[] = CONFIG_SYS_ATMEL_SECTSZ;
  66. int i, j, k;
  67. if (base != CONFIG_SYS_ATMEL_BASE)
  68. return 0;
  69. info->flash_id = 0x01000000;
  70. info->portwidth = 1;
  71. info->chipwidth = 1;
  72. info->buffer_size = 1;
  73. info->erase_blk_tout = 16384;
  74. info->write_tout = 2;
  75. info->buffer_write_tout = 5;
  76. info->vendor = 0xFFF0; /* CFI_CMDSET_AMD_LEGACY */
  77. info->cmd_reset = 0x00F0;
  78. info->interface = FLASH_CFI_X8;
  79. info->legacy_unlock = 0;
  80. info->manufacturer_id = (u16) ATM_MANUFACT;
  81. info->device_id = ATM_ID_LV040;
  82. info->device_id2 = 0;
  83. info->ext_addr = 0;
  84. info->cfi_version = 0x3133;
  85. info->cfi_offset = 0x0000;
  86. info->addr_unlock1 = 0x00000555;
  87. info->addr_unlock2 = 0x000002AA;
  88. info->name = "CFI conformant";
  89. info->size = 0;
  90. info->sector_count = CONFIG_SYS_ATMEL_TOTALSECT;
  91. info->start[0] = base;
  92. for (k = 0, i = 0; i < CONFIG_SYS_ATMEL_REGION; i++) {
  93. info->size += sect[i] * sectsz[i];
  94. for (j = 0; j < sect[i]; j++, k++) {
  95. info->start[k + 1] = info->start[k] + sectsz[i];
  96. info->protect[k] = 0;
  97. }
  98. }
  99. return 1;
  100. }
  101. #endif /* CONFIG_FLASH_CFI_LEGACY */