Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From b948e594ca42d3d8c3d070abeb1744f7e1fbf1fc Mon Sep 17 00:00:00 2001
- From: Daniel Hilst SellI <danielhilst@gmail.com>
- Date: Fri, 8 Aug 2014 16:12:02 -0300
- Subject: [PATCH] nRF24L01P board setup code for raspberry pi
- ---
- arch/arm/mach-bcm2708/bcm2708.c | 41 +++++++++++++++++++++--------------------
- include/linux/spi/nRF24L01P.h | 11 +++++++++++
- 2 files changed, 32 insertions(+), 20 deletions(-)
- create mode 100644 include/linux/spi/nRF24L01P.h
- diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c
- index 50f4f0a..8e9db7f 100644
- --- a/arch/arm/mach-bcm2708/bcm2708.c
- +++ b/arch/arm/mach-bcm2708/bcm2708.c
- @@ -33,6 +33,8 @@
- #include <linux/module.h>
- #include <linux/spi/spi.h>
- #include <linux/w1-gpio.h>
- +#include <linux/spi/nRF24L01P.h>
- +#include <linux/gpio.h>
- #include <linux/version.h>
- #include <linux/clkdev.h>
- @@ -586,23 +588,24 @@ static struct platform_device bcm2708_spi_device = {
- .resource = bcm2708_spi_resources,
- };
- -#ifdef CONFIG_BCM2708_SPIDEV
- -static struct spi_board_info bcm2708_spi_devices[] = {
- - {
- - .modalias = "spidev",
- - .max_speed_hz = 500000,
- - .bus_num = 0,
- - .chip_select = 0,
- - .mode = SPI_MODE_0,
- - }, {
- - .modalias = "spidev",
- - .max_speed_hz = 500000,
- - .bus_num = 0,
- - .chip_select = 1,
- - .mode = SPI_MODE_0,
- - }
- +#define NRF24L01P_IRQ_GPIO 24
- +#define NRF24L01P_CE_GPIO 25
- +
- +static struct nRF24L01P_platform_data rf24_config = {
- + .gpio_ce = NRF24L01P_CE_GPIO,
- + .gpio_irq = NRF24L01P_IRQ_GPIO,
- +};
- +
- +static struct spi_board_info bcm2708_spi_rf24[] __initdata = {
- + {
- + .modalias = "nRF24L01P", /* nRF24L01+ */
- + .max_speed_hz = 8000000,
- + .bus_num = 0,
- + .chip_select = 0,
- + .platform_data = &rf24_config,
- + .mode = SPI_MODE_0,
- + },
- };
- -#endif
- static struct resource bcm2708_bsc0_resources[] = {
- {
- @@ -787,10 +790,8 @@ void __init bcm2708_init(void)
- system_rev = boardrev;
- system_serial_low = serial;
- -#ifdef CONFIG_BCM2708_SPIDEV
- - spi_register_board_info(bcm2708_spi_devices,
- - ARRAY_SIZE(bcm2708_spi_devices));
- -#endif
- + spi_register_board_info(bcm2708_spi_rf24,
- + ARRAY_SIZE(bcm2708_spi_rf24));
- }
- #define TIMER_PERIOD DIV_ROUND_CLOSEST(STC_FREQ_HZ, HZ)
- diff --git a/include/linux/spi/nRF24L01P.h b/include/linux/spi/nRF24L01P.h
- new file mode 100644
- index 0000000..3be5a9d
- --- /dev/null
- +++ b/include/linux/spi/nRF24L01P.h
- @@ -0,0 +1,11 @@
- +#ifndef __LINUX_SPI_NRF24L01P_H
- +#define __LINUX_SPI_NRF24L01P_H
- +
- +/* linux/spi/nRF24L01P */
- +
- +struct nRF24L01P_platform_data {
- + unsigned int gpio_irq;
- + unsigned int gpio_ce; /* Chip Enable */
- +};
- +
- +#endif
- --
- 2.0.3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement