memoryOperation.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * Copyright (C) 2005 SAN People
  3. * Copyright (C) 2008 Atmel
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #include <linux/types.h>
  20. #include <linux/gpio.h>
  21. #include <linux/init.h>
  22. #include <linux/mm.h>
  23. #include <linux/module.h>
  24. #include <linux/platform_device.h>
  25. #include <linux/spi/spi.h>
  26. #include <linux/spi/at73c213.h>
  27. #include <linux/gpio_keys.h>
  28. #include <linux/input.h>
  29. #include <linux/clk.h>
  30. #include <linux/regulator/machine.h>
  31. #include <linux/regulator/fixed.h>
  32. #include <linux/regulator/consumer.h>
  33. #include <linux/platform_data/at91_adc.h>
  34. #include <mach/hardware.h>
  35. #include <asm/setup.h>
  36. #include <asm/mach-types.h>
  37. #include <asm/irq.h>
  38. #include <asm/mach/arch.h>
  39. #include <asm/mach/map.h>
  40. #include <asm/mach/irq.h>
  41. #include <mach/at91sam9_smc.h>
  42. #include <mach/system_rev.h>
  43. #include "at91_aic.h"
  44. #include "board.h"
  45. #include "sam9_smc.h"
  46. #include "generic.h"
  47. /*
  48. * board revision encoding
  49. * bit 0:
  50. * 0 => 1 sd/mmc slot
  51. * 1 => 2 sd/mmc slots connectors (board from revision C)
  52. */
  53. #define HAVE_2MMC (1 << 0)
  54. static int inline ek_have_2mmc(void)
  55. {
  56. return machine_is_at91sam9g20ek_2mmc() || (system_rev & HAVE_2MMC);
  57. }
  58. static void __init ek_init_early(void)
  59. {
  60. /* Initialize processor: 18.432 MHz crystal */
  61. at91_initialize(18432000);
  62. }
  63. /*
  64. * USB Host port
  65. */
  66. static struct at91_usbh_data __initdata ek_usbh_data = {
  67. .ports = 2,
  68. .vbus_pin = {-EINVAL, -EINVAL},
  69. .overcurrent_pin= {-EINVAL, -EINVAL},
  70. };
  71. /*
  72. * USB Device port
  73. */
  74. static struct at91_udc_data __initdata ek_udc_data = {
  75. .vbus_pin = AT91_PIN_PC5,
  76. .pullup_pin = -EINVAL, /* pull-up driven by UDC */
  77. };
  78. /*
  79. * SPI devices.
  80. */
  81. static struct spi_board_info ek_spi_devices[] = {
  82. #if !IS_ENABLED(CONFIG_MMC_ATMELMCI)
  83. { /* DataFlash chip */
  84. .modalias = "mtd_dataflash",
  85. .chip_select = 1,
  86. .max_speed_hz = 15 * 1000 * 1000,
  87. .bus_num = 0,
  88. },
  89. #if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
  90. { /* DataFlash card */
  91. .modalias = "mtd_dataflash",
  92. .chip_select = 0,
  93. .max_speed_hz = 15 * 1000 * 1000,
  94. .bus_num = 0,