310-gtwx5717_spi_bus.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. --- a/arch/arm/mach-ixp4xx/gtwx5715-setup.c
  2. +++ b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
  3. @@ -27,6 +27,7 @@
  4. #include <linux/serial.h>
  5. #include <linux/tty.h>
  6. #include <linux/serial_8250.h>
  7. +#include <linux/spi/spi_gpio_old.h>
  8. #include <asm/types.h>
  9. #include <asm/setup.h>
  10. #include <asm/memory.h>
  11. @@ -146,9 +147,41 @@ static struct platform_device gtwx5715_f
  12. .resource = &gtwx5715_flash_resource,
  13. };
  14. +static int gtwx5715_spi_boardinfo_setup(struct spi_board_info *bi,
  15. + struct spi_master *master, void *data)
  16. +{
  17. +
  18. + strlcpy(bi->modalias, "spi-ks8995", sizeof(bi->modalias));
  19. +
  20. + bi->max_speed_hz = 5000000 /* Hz */;
  21. + bi->bus_num = master->bus_num;
  22. + bi->mode = SPI_MODE_0;
  23. +
  24. + return 0;
  25. +}
  26. +
  27. +static struct spi_gpio_platform_data gtwx5715_spi_bus_data = {
  28. + .pin_cs = GTWX5715_KSSPI_SELECT,
  29. + .pin_clk = GTWX5715_KSSPI_CLOCK,
  30. + .pin_miso = GTWX5715_KSSPI_RXD,
  31. + .pin_mosi = GTWX5715_KSSPI_TXD,
  32. + .cs_activelow = 1,
  33. + .no_spi_delay = 1,
  34. + .boardinfo_setup = gtwx5715_spi_boardinfo_setup,
  35. +};
  36. +
  37. +static struct platform_device gtwx5715_spi_bus = {
  38. + .name = "spi-gpio",
  39. + .id = 0,
  40. + .dev = {
  41. + .platform_data = &gtwx5715_spi_bus_data,
  42. + },
  43. +};
  44. +
  45. static struct platform_device *gtwx5715_devices[] __initdata = {
  46. &gtwx5715_uart_device,
  47. &gtwx5715_flash,
  48. + &gtwx5715_spi_bus,
  49. };
  50. static void __init gtwx5715_init(void)