shmin.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. int checkboard(void)
  31. {
  32. puts("BOARD: T-SH7706LAN ");
  33. if(readb(0xb0008006) == 0xab)
  34. puts("v2\n");
  35. else
  36. puts("v1\n");
  37. return 0;
  38. }
  39. int board_init(void)
  40. {
  41. writew(0x2980, BCR2);
  42. return 0;
  43. }
  44. int dram_init(void)
  45. {
  46. DECLARE_GLOBAL_DATA_PTR;
  47. gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
  48. gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
  49. printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
  50. return 0;
  51. }
  52. void led_set_state(unsigned short value)
  53. {
  54. }
  55. #if defined(CONFIG_FLASH_CFI_LEGACY)
  56. #include <flash.h>
  57. ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
  58. {
  59. int sect[] = CONFIG_SYS_ATMEL_SECT;
  60. int sectsz[] = CONFIG_SYS_ATMEL_SECTSZ;
  61. int i, j, k;
  62. if (base != CONFIG_SYS_ATMEL_BASE)
  63. return 0;
  64. info->flash_id = 0x01000000;
  65. info->portwidth = 1;
  66. info->chipwidth = 1;
  67. info->buffer_size = 1;
  68. info->erase_blk_tout = 16384;
  69. info->write_tout = 2;
  70. info->buffer_write_tout = 5;
  71. info->vendor = 0xFFF0; /* CFI_CMDSET_AMD_LEGACY */
  72. info->cmd_reset = 0x00F0;
  73. info->interface = FLASH_CFI_X8;
  74. info->legacy_unlock = 0;
  75. info->manufacturer_id = (u16) ATM_MANUFACT;
  76. info->device_id = ATM_ID_LV040;
  77. info->device_id2 = 0;
  78. info->ext_addr = 0;
  79. info->cfi_version = 0x3133;
  80. info->cfi_offset = 0x0000;
  81. info->addr_unlock1 = 0x00000555;
  82. info->addr_unlock2 = 0x000002AA;
  83. info->name = "CFI conformant";
  84. info->size = 0;
  85. info->sector_count = CONFIG_SYS_ATMEL_TOTALSECT;
  86. info->start[0] = base;
  87. for (k = 0, i = 0; i < CONFIG_SYS_ATMEL_REGION; i++) {
  88. info->size += sect[i] * sectsz[i];
  89. for (j = 0; j < sect[i]; j++, k++) {
  90. info->start[k + 1] = info->start[k] + sectsz[i];
  91. info->protect[k] = 0;
  92. }
  93. }
  94. return 1;
  95. }
  96. #endif /* CONFIG_FLASH_CFI_LEGACY */