setup-spi.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* linux/arch/arm/mach-s5p64x0/setup-spi.c
  2. *
  3. * Copyright (C) 2011 Samsung Electronics Ltd.
  4. * http://www.samsung.com/
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/gpio.h>
  11. #include <linux/platform_device.h>
  12. #include <linux/io.h>
  13. #include <plat/gpio-cfg.h>
  14. #include <plat/cpu.h>
  15. #include <plat/s3c64xx-spi.h>
  16. #ifdef CONFIG_S3C64XX_DEV_SPI0
  17. struct s3c64xx_spi_info s3c64xx_spi0_pdata __initdata = {
  18. .fifo_lvl_mask = 0x1ff,
  19. .rx_lvl_offset = 15,
  20. .tx_st_done = 25,
  21. };
  22. int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
  23. {
  24. if (soc_is_s5p6450())
  25. s3c_gpio_cfgall_range(S5P6450_GPC(0), 3,
  26. S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
  27. else
  28. s3c_gpio_cfgall_range(S5P6440_GPC(0), 3,
  29. S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
  30. return 0;
  31. }
  32. #endif
  33. #ifdef CONFIG_S3C64XX_DEV_SPI1
  34. struct s3c64xx_spi_info s3c64xx_spi1_pdata __initdata = {
  35. .fifo_lvl_mask = 0x7f,
  36. .rx_lvl_offset = 15,
  37. .tx_st_done = 25,
  38. };
  39. int s3c64xx_spi1_cfg_gpio(struct platform_device *dev)
  40. {
  41. if (soc_is_s5p6450())
  42. s3c_gpio_cfgall_range(S5P6450_GPC(4), 3,
  43. S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
  44. else
  45. s3c_gpio_cfgall_range(S5P6440_GPC(4), 3,
  46. S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
  47. return 0;
  48. }
  49. #endif