edminiv2.c 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Copyright (C) 2010 Albert ARIBAUD <albert.aribaud@free.fr>
  3. *
  4. * (C) Copyright 2009
  5. * Marvell Semiconductor <www.marvell.com>
  6. * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
  7. *
  8. * See file CREDITS for list of people who contributed to this
  9. * project.
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License as
  13. * published by the Free Software Foundation; either version 2 of
  14. * the License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  24. * MA 02110-1301 USA
  25. */
  26. #include <common.h>
  27. #include <miiphy.h>
  28. #include <asm/arch/orion5x.h>
  29. DECLARE_GLOBAL_DATA_PTR;
  30. /*
  31. * The ED Mini V2 is equipped with a Macronix MXLV400CB FLASH
  32. * which CFI does not properly detect, hence the LEGACY config.
  33. */
  34. #if defined(CONFIG_FLASH_CFI_LEGACY)
  35. #include <flash.h>
  36. ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
  37. {
  38. int sectsz[] = CONFIG_SYS_FLASH_SECTSZ;
  39. int sect;
  40. if (base != CONFIG_SYS_FLASH_BASE)
  41. return 0;
  42. info->size = 0;
  43. info->sector_count = CONFIG_SYS_MAX_FLASH_SECT;
  44. /* set each sector's start address and size based */
  45. for (sect = 0; sect < CONFIG_SYS_MAX_FLASH_SECT; sect++) {
  46. info->start[sect] = base+info->size;
  47. info->size += sectsz[sect];
  48. }
  49. /* This flash must be accessed in 8-bits mode, no buffer. */
  50. info->flash_id = 0x01000000;
  51. info->portwidth = FLASH_CFI_8BIT;
  52. info->chipwidth = FLASH_CFI_BY8;
  53. info->buffer_size = 0;
  54. /* timings are derived from the Macronix datasheet. */
  55. info->erase_blk_tout = 1000;
  56. info->write_tout = 10;
  57. info->buffer_write_tout = 300;
  58. /* Commands and addresses are for AMD mode 8-bit access. */
  59. info->vendor = CFI_CMDSET_AMD_LEGACY;
  60. info->cmd_reset = 0xF0;
  61. info->interface = FLASH_CFI_X8;
  62. info->legacy_unlock = 0;
  63. info->ext_addr = 0;
  64. info->addr_unlock1 = 0x00000aaa;
  65. info->addr_unlock2 = 0x00000555;
  66. /* Manufacturer Macronix, device MX29LV400CB, CFI 1.3. */
  67. info->manufacturer_id = 0x22;
  68. info->device_id = 0xBA;
  69. info->device_id2 = 0;
  70. info->cfi_version = 0x3133;
  71. info->cfi_offset = 0x0000;
  72. info->name = "MX29LV400CB";
  73. return 1;
  74. }
  75. #endif /* CONFIG_SYS_FLASH_CFI */
  76. int board_init(void)
  77. {
  78. /* arch number of board */
  79. gd->bd->bi_arch_number = MACH_TYPE_EDMINI_V2;
  80. /* boot parameter start at 256th byte of RAM base */
  81. gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100;
  82. return 0;
  83. }