You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

83 lines
3.4 KiB

  1. /***************************************************************************
  2. * Copyright (C) 2005 by Dominic Rath <Dominic.Rath@gmx.de> *
  3. * Copyright (C) 2007,2008 Øyvind Harboe <oyvind.harboe@zylin.com> *
  4. * Copyright (C) 2008 by Spencer Oliver <spen@spen-soft.co.uk> *
  5. * Copyright (C) 2009 Zachary T Welch <zw@superlucidity.net> *
  6. * *
  7. * This program is free software; you can redistribute it and/or modify *
  8. * it under the terms of the GNU General Public License as published by *
  9. * the Free Software Foundation; either version 2 of the License, or *
  10. * (at your option) any later version. *
  11. * *
  12. * This program is distributed in the hope that it will be useful, *
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  15. * GNU General Public License for more details. *
  16. * *
  17. * You should have received a copy of the GNU General Public License *
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>. *
  19. ***************************************************************************/
  20. #ifdef HAVE_CONFIG_H
  21. #include <config.h>
  22. #endif
  23. #include "core.h"
  24. #include "driver.h"
  25. /* NAND flash controller
  26. */
  27. extern struct nand_flash_controller nonce_nand_controller;
  28. extern struct nand_flash_controller davinci_nand_controller;
  29. extern struct nand_flash_controller lpc3180_nand_controller;
  30. extern struct nand_flash_controller lpc32xx_nand_controller;
  31. extern struct nand_flash_controller orion_nand_controller;
  32. extern struct nand_flash_controller s3c2410_nand_controller;
  33. extern struct nand_flash_controller s3c2412_nand_controller;
  34. extern struct nand_flash_controller s3c2440_nand_controller;
  35. extern struct nand_flash_controller s3c2443_nand_controller;
  36. extern struct nand_flash_controller s3c6400_nand_controller;
  37. extern struct nand_flash_controller mxc_nand_flash_controller;
  38. extern struct nand_flash_controller imx31_nand_flash_controller;
  39. extern struct nand_flash_controller at91sam9_nand_controller;
  40. extern struct nand_flash_controller nuc910_nand_controller;
  41. /* extern struct nand_flash_controller boundary_scan_nand_controller; */
  42. static struct nand_flash_controller *nand_flash_controllers[] = {
  43. &nonce_nand_controller,
  44. &davinci_nand_controller,
  45. &lpc3180_nand_controller,
  46. &lpc32xx_nand_controller,
  47. &orion_nand_controller,
  48. &s3c2410_nand_controller,
  49. &s3c2412_nand_controller,
  50. &s3c2440_nand_controller,
  51. &s3c2443_nand_controller,
  52. &s3c6400_nand_controller,
  53. &mxc_nand_flash_controller,
  54. &imx31_nand_flash_controller,
  55. &at91sam9_nand_controller,
  56. &nuc910_nand_controller,
  57. /* &boundary_scan_nand_controller, */
  58. NULL
  59. };
  60. struct nand_flash_controller *nand_driver_find_by_name(const char *name)
  61. {
  62. for (unsigned i = 0; nand_flash_controllers[i]; i++) {
  63. struct nand_flash_controller *controller = nand_flash_controllers[i];
  64. if (strcmp(name, controller->name) == 0)
  65. return controller;
  66. }
  67. return NULL;
  68. }
  69. int nand_driver_walk(nand_driver_walker_t f, void *x)
  70. {
  71. for (unsigned i = 0; nand_flash_controllers[i]; i++) {
  72. int retval = (*f)(nand_flash_controllers[i], x);
  73. if (ERROR_OK != retval)
  74. return retval;
  75. }
  76. return ERROR_OK;
  77. }