Advertisement
danielhilst

0001-pharos-server-nrf24-board-setup-code.patch

Apr 24th, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.80 KB | None | 0 0
  1. Index: linux-csi-mx6/arch/arm/mach-mx6/board-mx6q_var_som.c
  2. ===================================================================
  3. --- linux-csi-mx6.orig/arch/arm/mach-mx6/board-mx6q_var_som.c
  4. +++ linux-csi-mx6/arch/arm/mach-mx6/board-mx6q_var_som.c
  5. @@ -31,6 +31,7 @@
  6.  #include <linux/fsl_devices.h>
  7.  #include <linux/spi/spi.h>
  8.  #include <linux/spi/ads7846.h>
  9. +#include <linux/spi/nrf24.h>
  10.  #include <linux/i2c.h>
  11.  #include <linux/i2c/pca953x.h>
  12.  #include <linux/ata.h>
  13. @@ -85,6 +86,7 @@
  14.   */
  15.  //#define ANDROID_NAND_RECOVERY
  16.  
  17. +#define VAR_SOM_ECSPI1_CS1      IMX_GPIO_NR(4, 10)
  18.  #define VAR_SOM_ECSPI3_CS0      IMX_GPIO_NR(4, 24)
  19.  #define VAR_SOM_ADS7846_INT     IMX_GPIO_NR(4, 25)
  20.  #define VAR_SOM_ADS7846_PD      IMX_GPIO_NR(4, 25)
  21. @@ -111,6 +113,10 @@
  22.  
  23.  #define VAR_SOM_TSC_CTW6120_IRQ_GPIO IMX_GPIO_NR(3, 7)
  24.  
  25. +/* Needed by nRF2424L01P module */
  26. +#define VAR_SOM_NRF24L01P_IRQ_GPIO IMX_GPIO_NR(5, 14)
  27. +#define VAR_SOM_NRF24L01P_CE_GPIO  IMX_GPIO_NR(4, 9)
  28. +
  29.  static struct clk *sata_clk;
  30.  static struct clk *clko;
  31.  static int enable_lcd_ldb;
  32. @@ -368,10 +374,19 @@ static struct fec_platform_data fec_data
  33.     .phy = PHY_INTERFACE_MODE_RGMII,
  34.  };
  35.  
  36. +static int mx6q_var_som_ecspi1_cs[] = {
  37. +   VAR_SOM_ECSPI1_CS1,
  38. +};
  39. +
  40.  static int mx6q_var_som_spi_cs[] = {
  41.     VAR_SOM_ECSPI3_CS0,
  42.  };
  43.  
  44. +static const struct spi_imx_master mx6q_var_som_ecspi1_data __initconst = {
  45. +   .chipselect     = mx6q_var_som_ecspi1_cs,
  46. +   .num_chipselect = ARRAY_SIZE(mx6q_var_som_ecspi1_cs),
  47. +};
  48. +
  49.  static const struct spi_imx_master mx6q_var_som_spi_data __initconst = {
  50.     .chipselect     = mx6q_var_som_spi_cs,
  51.     .num_chipselect = ARRAY_SIZE(mx6q_var_som_spi_cs),
  52. @@ -404,12 +419,31 @@ static struct spi_board_info mx6_var_som
  53.     },
  54.  };
  55.  
  56. +static struct nrf24_platform_data nrf24_config = {
  57. +        .gpio_ce  = VAR_SOM_NRF24L01P_CE_GPIO,
  58. +        .gpio_irq = VAR_SOM_NRF24L01P_IRQ_GPIO,
  59. +};
  60. +
  61. +static struct spi_board_info mx6_var_som_spi_nrf24[] __initdata = {
  62. +        {
  63. +                .modalias = "nrf24", /* nRF24L01+ */
  64. +                .max_speed_hz = 8000000,
  65. +                .bus_num = 0,
  66. +                .chip_select = 1,
  67. +                .platform_data = &nrf24_config,
  68. +                .mode = SPI_MODE_0,
  69. +        },
  70. +};
  71. +
  72.  static void spi_device_init(void)
  73.  {
  74.     if (var_lcd_index != VAR_LCD_CTW6120) {
  75.         spi_register_board_info(mx6_var_som_spi_ts_device,
  76.                 ARRAY_SIZE(mx6_var_som_spi_ts_device));
  77.     }
  78. +
  79. +        spi_register_board_info(mx6_var_som_spi_nrf24,
  80. +                               ARRAY_SIZE(mx6_var_som_spi_nrf24));
  81.  }
  82.  
  83.  /* Audio
  84. @@ -1150,6 +1184,7 @@ static void __init mx6_var_som_board_ini
  85.     gpio_direction_output(VAR_SOM_BACKLIGHT_EN, 1);
  86.  
  87.     /* SPI */
  88. +   imx6q_add_ecspi(0, &mx6q_var_som_ecspi1_data);
  89.     imx6q_add_ecspi(2, &mx6q_var_som_spi_data);
  90.     spi_device_init();
  91.  
  92. Index: linux-csi-mx6/arch/arm/mach-mx6/board-mx6q_var_som.h
  93. ===================================================================
  94. --- linux-csi-mx6.orig/arch/arm/mach-mx6/board-mx6q_var_som.h
  95. +++ linux-csi-mx6/arch/arm/mach-mx6/board-mx6q_var_som.h
  96. @@ -58,6 +58,15 @@ static iomux_v3_cfg_t mx6q_var_som_pads[
  97.     MX6Q_PAD_CSI0_DAT6__AUDMUX_AUD3_TXFS,
  98.     MX6Q_PAD_CSI0_DAT7__AUDMUX_AUD3_RXD,
  99.  
  100. +        /* SPI1 (nRF24L01P) */
  101. +        MX6Q_PAD_KEY_COL1__ECSPI1_MISO,
  102. +        MX6Q_PAD_KEY_ROW0__ECSPI1_MOSI,
  103. +        MX6Q_PAD_KEY_COL0__ECSPI1_SCLK,
  104. +
  105. +        MX6Q_PAD_KEY_ROW1__GPIO_4_9, /* nRF24L01P CE */
  106. +        MX6Q_PAD_KEY_COL2__GPIO_4_10, /* nRF24L01P SS  */
  107. +        MX6Q_PAD_DISP0_DAT20__GPIO_5_14, /* nRF24L01P IRQ */
  108. +
  109.     /* SPI3 (ads7846) */
  110.     MX6Q_PAD_DISP0_DAT2__ECSPI3_MISO,
  111.     MX6Q_PAD_DISP0_DAT1__ECSPI3_MOSI,
  112. @@ -125,8 +134,8 @@ static iomux_v3_cfg_t mx6q_var_som_pads[
  113.     MX6Q_PAD_GPIO_17__GPIO_7_12,
  114.  
  115.     /* I2C1 */
  116. -   MX6Q_PAD_CSI0_DAT8__I2C1_SDA,
  117. -   MX6Q_PAD_CSI0_DAT9__I2C1_SCL,
  118. +   /* MX6Q_PAD_CSI0_DAT8__I2C1_SDA, */
  119. +   /* MX6Q_PAD_CSI0_DAT9__I2C1_SCL, */
  120.  
  121.     /* I2C2 */
  122.     MX6Q_PAD_KEY_COL3__I2C2_SCL,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement