spi.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. This module implements an interface to the SPI on the lpc22xx.
  3. Copyright (C) 2006 Embedded Artists AB (www.embeddedartists.com)
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  15. */
  16. #include <config.h>
  17. #include <common.h>
  18. #include <asm/errno.h>
  19. #include <asm/arch/hardware.h>
  20. #include <asm/arch/spi.h>
  21. unsigned long spi_flags;
  22. unsigned char spi_idle = 0x00;
  23. int spi_init(void)
  24. {
  25. unsigned long pinsel0_value;
  26. /* activate spi pins */
  27. pinsel0_value = GET32(PINSEL0);
  28. pinsel0_value &= ~(0xFFl << 8);
  29. pinsel0_value |= (0x55l << 8);
  30. PUT32(PINSEL0, pinsel0_value);
  31. return 0;
  32. }