hardware.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * include/asm-arm/arch-at91rm9200/hardware.h
  3. *
  4. * Copyright (C) 2003 SAN People
  5. * Copyright (C) 2003 ATMEL
  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. */
  13. #ifndef __ASM_ARCH_HARDWARE_H
  14. #define __ASM_ARCH_HARDWARE_H
  15. #include <asm/sizes.h>
  16. #if defined(CONFIG_ARCH_AT91RM9200)
  17. #include <asm/arch/at91rm9200.h>
  18. #elif defined(CONFIG_ARCH_AT91SAM9260)
  19. #include <asm/arch/at91sam9260.h>
  20. #elif defined(CONFIG_ARCH_AT91SAM9261)
  21. #include <asm/arch/at91sam9261.h>
  22. #else
  23. #error "Unsupported AT91 processor"
  24. #endif
  25. /*
  26. * Remap the peripherals from address 0xFFFA0000 .. 0xFFFFFFFF
  27. * to 0xFEFA0000 .. 0xFF000000. (384Kb)
  28. */
  29. #define AT91_IO_PHYS_BASE 0xFFFA0000
  30. #define AT91_IO_SIZE (0xFFFFFFFF - AT91_IO_PHYS_BASE + 1)
  31. #define AT91_IO_VIRT_BASE (0xFF000000 - AT91_IO_SIZE)
  32. /* Convert a physical IO address to virtual IO address */
  33. #define AT91_IO_P2V(x) ((x) - AT91_IO_PHYS_BASE + AT91_IO_VIRT_BASE)
  34. /*
  35. * Virtual to Physical Address mapping for IO devices.
  36. */
  37. #define AT91_VA_BASE_SYS AT91_IO_P2V(AT91_BASE_SYS)
  38. #define AT91_VA_BASE_EMAC AT91_IO_P2V(AT91RM9200_BASE_EMAC)
  39. /* Internal SRAM is mapped below the IO devices */
  40. #define AT91_SRAM_MAX SZ_1M
  41. #define AT91_VIRT_BASE (AT91_IO_VIRT_BASE - AT91_SRAM_MAX)
  42. /* Serial ports */
  43. #define ATMEL_MAX_UART 7 /* 6 USART3's and one DBGU port (SAM9260) */
  44. /* External Memory Map */
  45. #define AT91_CHIPSELECT_0 0x10000000
  46. #define AT91_CHIPSELECT_1 0x20000000
  47. #define AT91_CHIPSELECT_2 0x30000000
  48. #define AT91_CHIPSELECT_3 0x40000000
  49. #define AT91_CHIPSELECT_4 0x50000000
  50. #define AT91_CHIPSELECT_5 0x60000000
  51. #define AT91_CHIPSELECT_6 0x70000000
  52. #define AT91_CHIPSELECT_7 0x80000000
  53. /* SDRAM */
  54. #define AT91_SDRAM_BASE AT91_CHIPSELECT_1
  55. /* Clocks */
  56. #define AT91_SLOW_CLOCK 32768 /* slow clock */
  57. #ifndef __ASSEMBLY__
  58. #include <asm/io.h>
  59. static inline unsigned int at91_sys_read(unsigned int reg_offset)
  60. {
  61. void __iomem *addr = (void __iomem *)AT91_VA_BASE_SYS;
  62. return __raw_readl(addr + reg_offset);
  63. }
  64. static inline void at91_sys_write(unsigned int reg_offset, unsigned long value)
  65. {
  66. void __iomem *addr = (void __iomem *)AT91_VA_BASE_SYS;
  67. __raw_writel(value, addr + reg_offset);
  68. }
  69. #endif
  70. #endif