omap925.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * (C) Copyright 2003
  3. * Texas Instruments <www.ti.com>
  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 <command.h>
  25. #include <arm925t.h>
  26. ushort gpioreserved;
  27. void gpioreserve(ushort mask)
  28. {
  29. gpioreserved |= mask;
  30. }
  31. void gpiosetdir(ushort mask, ushort in)
  32. {
  33. *(ushort *)GPIO_DIR_CONTROL_REG = (*(ushort *)GPIO_DIR_CONTROL_REG & ~mask) | (in & mask);
  34. }
  35. void gpiosetout(ushort mask, ushort out)
  36. {
  37. ushort *r_ptr, r_val;
  38. r_ptr = (ushort *)GPIO_DATA_OUTPUT_REG; /* set pointer */
  39. r_val = *r_ptr & ~mask; /* get previous val, clear bits we want to change */
  40. r_val |= (out & mask); /* set specified bits in value + plus origional ones */
  41. *r_ptr = r_val; /* write it out */
  42. /*
  43. * gcc screwed this one up :(.
  44. *
  45. * *(ushort *)GPIO_DATA_OUTPUT_REG = (*(ushort *)GPIO_DATA_OUTPUT_REG & ~mask) | (out & mask);
  46. */
  47. }
  48. void gpioinit(void)
  49. {
  50. }
  51. #define MIF_CONFIG_REG 0xFFFECC0C
  52. #define FLASH_GLOBAL_CTRL_NWP 1
  53. void archflashwp (void *archdata, int wp)
  54. {
  55. ulong *fgc = (ulong *) MIF_CONFIG_REG;
  56. if (wp == 1)
  57. *fgc &= ~FLASH_GLOBAL_CTRL_NWP;
  58. else
  59. *fgc |= FLASH_GLOBAL_CTRL_NWP;
  60. }