synchronousMemoryDatabase.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*
  2. * arch/arm/mach-ep93xx/vision_ep9307.c
  3. * Vision Engraving Systems EP9307 SoM support.
  4. *
  5. * Copyright (C) 2008-2011 Vision Engraving Systems
  6. * H Hartley Sweeten <hsweeten@visionengravers.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or (at
  11. * your option) any later version.
  12. */
  13. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  14. #include <linux/kernel.h>
  15. #include <linux/init.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/irq.h>
  18. #include <linux/gpio.h>
  19. #include <linux/fb.h>
  20. #include <linux/io.h>
  21. #include <linux/mtd/partitions.h>
  22. #include <linux/i2c.h>
  23. #include <linux/i2c-gpio.h>
  24. #include <linux/i2c/pca953x.h>
  25. #include <linux/spi/spi.h>
  26. #include <linux/spi/flash.h>
  27. #include <linux/spi/mmc_spi.h>
  28. #include <linux/mmc/host.h>
  29. #include <mach/hardware.h>
  30. #include <linux/platform_data/video-ep93xx.h>
  31. #include <linux/platform_data/spi-ep93xx.h>
  32. #include <mach/gpio-ep93xx.h>
  33. #include <asm/hardware/vic.h>
  34. #include <asm/mach-types.h>
  35. #include <asm/mach/map.h>
  36. #include <asm/mach/arch.h>
  37. #include "soc.h"
  38. /*************************************************************************
  39. * Static I/O mappings for the FPGA
  40. *************************************************************************/
  41. #define VISION_PHYS_BASE EP93XX_CS7_PHYS_BASE
  42. #define VISION_VIRT_BASE 0xfebff000
  43. static struct map_desc vision_io_desc[] __initdata = {
  44. {
  45. .virtual = VISION_VIRT_BASE,
  46. .pfn = __phys_to_pfn(VISION_PHYS_BASE),
  47. .length = SZ_4K,
  48. .type = MT_DEVICE,
  49. },
  50. };
  51. static void __init vision_map_io(void)
  52. {
  53. ep93xx_map_io();
  54. iotable_init(vision_io_desc, ARRAY_SIZE(vision_io_desc));
  55. }
  56. /*************************************************************************
  57. * Ethernet
  58. *************************************************************************/
  59. static struct ep93xx_eth_data vision_eth_data __initdata = {
  60. .phy_id = 1,
  61. };
  62. /*************************************************************************
  63. * Framebuffer
  64. *************************************************************************/
  65. #define VISION_LCD_ENABLE EP93XX_GPIO_LINE_EGPIO1
  66. static int vision_lcd_setup(struct platform_device *pdev)
  67. {
  68. int err;
  69. err = gpio_request_one(VISION_LCD_ENABLE, GPIOF_INIT_HIGH,
  70. dev_name(&pdev->dev));
  71. if (err)
  72. return err;
  73. ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_RAS |
  74. EP93XX_SYSCON_DEVCFG_RASONP3 |
  75. EP93XX_SYSCON_DEVCFG_EXVC);
  76. return 0;
  77. }
  78. static void vision_lcd_teardown(struct platform_device *pdev)
  79. {
  80. gpio_free(VISION_LCD_ENABLE);
  81. }
  82. static void vision_lcd_blank(int blank_mode, struct fb_info *info)
  83. {
  84. if (blank_mode)
  85. gpio_set_value(VISION_LCD_ENABLE, 0);
  86. else
  87. gpio_set_value(VISION_LCD_ENABLE, 1);
  88. }
  89. static struct ep93xxfb_mach_info ep93xxfb_info __initdata = {
  90. .num_modes = EP93XXFB_USE_MODEDB,
  91. .bpp = 16,
  92. .flags = EP93XXFB_USE_SDCSN0 | EP93XXFB_PCLK_FALLING,
  93. .setup = vision_lcd_setup,
  94. .teardown = vision_lcd_teardown,
  95. .blank = vision_lcd_blank,
  96. };
  97. /*************************************************************************
  98. * GPIO Expanders
  99. *************************************************************************/
  100. #define PCA9539_74_GPIO_BASE (EP93XX_GPIO_LINE_MAX + 1)
  101. #define PCA9539_75_GPIO_BASE (PCA9539_74_GPIO_BASE + 16)
  102. #define PCA9539_76_GPIO_BASE (PCA9539_75_GPIO_BASE + 16)
  103. #define PCA9539_77_GPIO_BASE (PCA9539_76_GPIO_BASE + 16)
  104. static struct pca953x_platform_data pca953x_74_gpio_data = {
  105. .gpio_base = PCA9539_74_GPIO_BASE,
  106. .irq_base = EP93XX_BOARD_IRQ(0),
  107. };
  108. static struct pca953x_platform_data pca953x_75_gpio_data = {
  109. .gpio_base = PCA9539_75_GPIO_BASE,
  110. .irq_base = -1,
  111. };
  112. static struct pca953x_platform_data pca953x_76_gpio_data = {
  113. .gpio_base = PCA9539_76_GPIO_BASE,
  114. .irq_base = -1,
  115. };
  116. static struct pca953x_platform_data pca953x_77_gpio_data = {
  117. .gpio_base = PCA9539_77_GPIO_BASE,
  118. .irq_base = -1,
  119. };
  120. /*************************************************************************
  121. * I2C Bus