Radio device framework
Subsystems (4)
v2 cover Radio device framework
From: Akhil Goyal <[email protected]>
RF signal path is integral part of any system that transmits/receives RF (radio frequency) signals. In these systems Data is processed/converted to IQ samples (digital representation a RF signal) and passed to a RFIC (RF PHY) which converts the digital RF signal (IQ samples) to analog and transmits over antenna.
Typically The signal path consists of multiple components:
Antenna controller <-> vector signal processors <-> RFIC <-> Antenna
Each of these components have specific functionalities:
1. Antenna controller: Framing of digital IQ data into protocol specific frames.
2. vector signal processors: For conditioning of signal.
3. RFIC : converts digital IQ data to analog signal which is transmitted/received on/from Air.
Also it is desirable to control the complete signal path, for example:
bringing the complete signal path up/down etc.
The radio device framework introduces a way to accommodate the RF signal paths. One signal path is represented as a RF device (rf0, rf1 etc), and it can contain multiple components which have their individual vendor specific drivers. The framework provides mechanism by which individual components can register with RF framework, and the framework will handle the binding of individual component devices to a RF device. RF device exports the control interfaces to user space, and this user space interface is independent of component (vendor specific) drivers.
This patch set include
1. RF Interface: Independent of phy or antenna controller.
2. AIC driver: Antenna interface Controller(AIC) of Hetrogenous SOC's like BSC9131, BSC9132
4. Device tree bindings for AIC.
5. Device tree changes for BSC9131-AIC
changes in v2:
1. incorporated comments for handling pointers in user space API structures.
2. Removed patches for AD9361 phy driver. It shall be sent once a proper driver is in place for AD9361 chip
3. Removed Device tree nodes/bindings for AD9361
4. Incorporated comments for proper handling of wait_events
5. Added Documentation for IOCTL APIs and the structures used.
6. Inserted paddings in user space structures.
7. Reorganized code for rfdev.c to remove forward declaration and broke the rf_ioctl() function to handle local structures correctly.
8. Corrected the error handling for mutex used.
Akhil Goyal (4):
drivers/misc: Support for RF interface device framework drivers/misc/rf: AIC: Freescale Antenna Interface controller driver
binding: Add device tree bindings for freescale AIC BSC9131rdb/dts: Add nodes for supporting AIC
Documentation/devicetree/bindings/rf/fsl-aic.txt | 47 + Documentation/misc-devices/rf_framework | 422 ++++++ arch/powerpc/boot/dts/bsc9131rdb.dts | 4 + arch/powerpc/boot/dts/fsl/bsc9131si-post.dtsi | 38 + drivers/misc/Kconfig | 1 + drivers/misc/Makefile | 1 + drivers/misc/rf/Kconfig | 30 + drivers/misc/rf/Makefile | 6 + drivers/misc/rf/controllers/Makefile | 1 + drivers/misc/rf/controllers/fsl_aic.c | 1560 ++++++++++++++++++++++ drivers/misc/rf/controllers/fsl_aic.h | 450 +++++++ drivers/misc/rf/core/Makefile | 2 + drivers/misc/rf/core/rf_channel.c | 211 +++ drivers/misc/rf/core/rfdev.c | 1384 +++++++++++++++++++ include/linux/rf_channel.h | 25 + include/linux/rfdev.h | 251 ++++ include/uapi/linux/rfdev.h | 367 +++++ 17 files changed, 4800 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/rf/fsl-aic.txt create mode 100644 Documentation/misc-devices/rf_framework create mode 100644 drivers/misc/rf/Kconfig create mode 100644 drivers/misc/rf/Makefile create mode 100644 drivers/misc/rf/controllers/Makefile create mode 100644 drivers/misc/rf/controllers/fsl_aic.c create mode 100644 drivers/misc/rf/controllers/fsl_aic.h create mode 100644 drivers/misc/rf/core/Makefile create mode 100644 drivers/misc/rf/core/rf_channel.c create mode 100644 drivers/misc/rf/core/rfdev.c create mode 100644 include/linux/rf_channel.h create mode 100644 include/linux/rfdev.h create mode 100644 include/uapi/linux/rfdev.h
PATCH v2 1/4 drivers/misc: Support for RF interface device framework
From: Akhil Goyal <[email protected]>
The radio device framework introduces a way to accommodate the RF(radio frequency) signal paths. One signal path is represented as a RF device (rf0, rf1 etc), and it can contain multiple components which have their individual vendor specific drivers. The framework provides mechanism by which individual components can register with RF framework, and the framework will handle the binding of individual component devices to a RF device. RF device exports the control interfaces to user space, and this user space interface is independent of component (vendor specific) drivers.
In a multimode system there can be multiple rfdev devices, depending on number of radios connected.
In this patch, the rf controller(AIC) and RFIC drivers register their respective devices with this framework. This framework does binding of RFIC device with RF controller device and exposes the combination as a logical rfdev to user space.
--- Documentation/misc-devices/rf_framework | 422 ++++++++++ drivers/misc/Kconfig | 1 + drivers/misc/Makefile | 1 + drivers/misc/rf/Kconfig | 19 + drivers/misc/rf/Makefile | 5 + drivers/misc/rf/core/Makefile | 2 + drivers/misc/rf/core/rf_channel.c | 211 +++++ drivers/misc/rf/core/rfdev.c | 1364 +++++++++++++++++++++++++++++++ include/linux/rf_channel.h | 25 + include/linux/rfdev.h | 250 ++++++ include/uapi/linux/rfdev.h | 367 +++++++++ 11 files changed, 2667 insertions(+), 0 deletions(-) create mode 100644 Documentation/misc-devices/rf_framework create mode 100644 drivers/misc/rf/Kconfig create mode 100644 drivers/misc/rf/Makefile create mode 100644 drivers/misc/rf/core/Makefile create mode 100644 drivers/misc/rf/core/rf_channel.c create mode 100644 drivers/misc/rf/core/rfdev.c create mode 100644 include/linux/rf_channel.h create mode 100644 include/linux/rfdev.h create mode 100644 include/uapi/linux/rfdev.h
Documentation/misc-devices/rf_framework new file +422 -0
@@ -0,0 +1,422 @@ + Kernel Framework for Radio devices + +This document explains the Framework for radio devices along with the APIs +provided for Phy and controller drivers and the interface for user space. + +1. Introduction: + +RF signal path is integral part of any system that transmits/receives RF +(radio frequency) signals. In these systems Data is processed/converted +to IQ samples (digital representation a RF signal) and passed to a RFIC +(RF PHY) which converts the digital RF signal (IQ samples) to analog and +transmits over antenna. + +Typically The signal path consists of multiple hardware components: + +Antenna controller <-> vector signal processors <-> RFIC <-> Antenna + +Each of these components have specific functionalities: + +1. Antenna controller: This is part of SOC. The controller has multiple IQ data + lanes. It frames the digital IQ data into protocol specific frames. The + protocol can be LTE or WCDMA. Each data lane can be programmed + separately to run two different/same protocols simultaneously. +2. vector signal processors: For conditioning of signal. +3. RFIC : converts digital IQ data to analog signal which is transmitted/ + received on/from Air. The RFIC is attached to the AIC lane with a + standard interface called JESD207 + +On the application core of SOC, Linux is run and the protocol(LTE/WCDMA) +stacks run in user space, and they interact with antenna controller and RFPHY. +Protocol stacks(LTE/WCDMA) interact with kernel drivers with the help of a +RF Interface Library. Protocol stacks need some predefined information from the +hardware. So this library fetches/sends information from/to the kernel +with the help of RF Interface IOCTLs. +The explanations for various IOCTLs are explained in the later section of this +document. + +In the Kernel space, there is a need of a subsystem which can bind the antenna +controller and the RF PHY drivers together and that can satisfy the various RF +specific IOCTLs. RF Interface framework provides an abstraction over Antenna/PHY +drivers. This helps in providing unified abstracted interface to use space +Applications (L2/L3, debug utilities, GPS). + +This also makes driver structure for Antenna controller/PHY more scalable, +because user interface won’t change if support is added for more RF PHY drivers. + +The following block diagram explains the high level architecture of framework. + __________________________ + | | + | Higher Layers L2/L3 of | + | LTE/WCDMA | + |________________________| + | + |(RF Interface) + ____________V________________ + | | + |RF interface Library(rflib)| + User Space |___________________________| + | + | + ----------------------------------|(RF Interface IOCTL)------------------- + | + Kernel Space ____________V_____________ + | | + | RF Interface Framework | + |________________________| + ____________________|___________________________ + | | + ________V____________________ ___________V_________ + | | | | + | Antenna Controller Driver | | RF PHY Driver | + |___________________________| |___________________| + | | + | |(SPI Bus) + ________V______________________ ____________V________ + | | | | + | Antenna Controller Hardware |<---JESD--->| RF PHY Hardware | + |_____________________________| |___________________| + + +The radio device framework introduces a way to accommodate the RF signal +paths. One signal path is represented as a RF device (rf0, rf1 etc), and +it can contain multiple components which have their individual vendor +specific drivers. The framework provides mechanism by which individual +components can register with RF framework, and the framework will handle the +binding of individual component devices to a RF device. RF device exports the +control interfaces to user space, and this user space interface is independent +of component (vendor specific) drivers. + +RF framework provide APIs for PHY and Controller drivers to register themselves +and exposes the radio device as a character device for configuration from user +space. + +1. PHY and Controller APIs + a) Allocate/free controller and phy device structures + The RF framework provide APIs for allocation and deallocation + of controller and phy devices. + + struct rf_ctrl_dev *allocate_rf_ctrl_dev(size_t priv_size, + unsigned long flags); + int free_rf_ctrl_dev(struct rf_ctrl_dev *rf_dev); + struct rf_phy_dev *allocate_rf_phy_dev(size_t priv_size, + unsigned long flags); + int free_rf_phy_dev(struct rf_phy_dev *phy) + + b) Register/Unregister controller and phy devices + register_rf_ctrl_dev is used to register the controller + with the rf framework. Similarly, register_rf_phy_dev is for + registering phy with the framework. Controller and Phy drivers + shall populate their structures with phy_id which is used by + the framework to bind controller to PHY. Controller and phy + can populate this information from device tree or any other + mechanism. RF framework will internally maintain a state + machine for RF device. User space and controller/phy drivers + shall use these states to allow/disallow certain control + operations. + + int register_rf_ctrl_dev(struct rf_ctrl_dev *rf_dev); + int unregister_rf_ctrl_dev(struct rf_ctrl_dev *rf_dev); + int register_rf_phy_dev(struct rf_phy_dev *phy); + int unregister_rf_phy_dev(struct rf_phy_dev *phy); + +2. User space file_operations + a) open rf node + User space can make open() calls to open a file descriptor for + RF device. + + static int rf_open(struct inode *inode, struct file *filep); + + b) release rf node + For releasing the file descriptor of rf device + + static int rf_release(struct inode *inode, struct file *filep); + + c) read from a file descriptor + User space can make read() calls to get notification for every + Transmit time Interval(TTI) which is an integral part of a + communication network. + + static ssize_t rf_read(struct file *filep, char __user *buf, + size_t size, loff_t *offset); + + d) ioctl interface + User space can interact with the RF framework and the + phy/controller drivers using various IOCTLs. Various IOCTL + numbers are defined in include/uapi/linux/rfdev.h. + User space application can include this file to interact with + the kernel controller/phy drivers. + The ioctls exposed here are independant of vendor specific + controller/phy drivers. + + static long rf_ioctl(struct file *, unsigned int cmd, + unsigned long arg); + + e) event handling + User space can register event handler to get notified of some + events which are triggered from the hardware and user space can + perform certain actions on receiving those events. + + int rf_register_event_handler(struct rf_ctrl_dev *rf_dev, + struct rf_event_listener *listener); + int rf_unregister_event_handler(struct rf_ctrl_dev *rf_dev, + enum rf_evt_del flag); + + +State Machine for rfdev framework: +1. RF_CREATED: To specify that the rf framework is created. +2. RF_PHY_ATTACHED: RF phy is detected and it is bound to a controller lane. +3. RF_STOPPED: The complete control path of framework is reset. After this state + RF PHY and controller shall be initialized. +4. RF_PHY_INITIALIZED: RF Phy is initialized in this state and this state shall be + achieved after RF_PHY_ATTACHED or RF_STOPPED. +5. RF_INITIALIZED: Antenna controller is initialized in this state and controller + shall be initialized after PF PHY is initialized. +6. RF_TIMER_SYNC_AWAITED: To denote that time sync is in progress. +7. RF_TIMER_SYNC_FAILED: To denote Time sync is failed. +8. RF_READY: Denotes that the RF control path is ready for IQ samples to be + transmitted/received. This state can be achieved only after + RF_INITIALIZED state. +9. RF_DOWN: To completely remove the RF path. +10.RF_SNIFFING: Denotes that the phy and controller are ready for network sniffing. + This can be achieved only after RF_PHY_INITIALIZED. + + +User Space IOCTLs + +1. RF_RUN_PHY_CMDS: Initializes RF PHY with a set of predefined commands in the + form of a script file which has commands like SPI_WRITE, + SPI_READ, WAIT, WAIT_CALDONE, etc. for writing/reading/waiting/ + waiting for calibration to get completed respectively. + It also change the RF state to “RF_PHY_INITIALIZED”. +Usage: +ioctl(fd, RIF_RUN_PHY_CMDS, &cmd_set); +where cmd_set denotes + +struct rf_phy_cmd_set { + struct rf_phy_cmd *cmds; /* commands as per below struct */ + __u32 count; /* number of commands to be run */ +}; + +struct rf_phy_cmd { + __u32 param1; /* generic command parameters */ + __u32 param2; + __u32 param3; + __u8 cmd; /* can be SPI_READ/SPI_WRITE/WAIT/ + WAIT_CALDONE*/ + __u8 padding[3]; +}; + +2. RF_DEV_INIT: initialize RF Controller/PHY parameters and switch the state to + RF_INITIALIZED. + +Usage: +ioctl(fd, RIF_DEV_INIT, &init_params); + +where init_params denotes +struct rf_init_params { + __u32 fq_band; /* Frequency band of operation */ + __u32 tdd_dl_ul_conf[LTE_SUBFRM_PER_FRM]; /* TDD DL-UL configuration */ + __u32 tdd_dwpts; /* TDD downlink Pilot Time slot */ + __u32 tdd_uppts; /* TDD uplink Pilot time slot */ + __u32 tdd_gp; /* TDD guard period */ + __u32 long_cp; /* To select short or long cyclic prefix */ + __u32 ants; /* number of antennas in usage */ + __u32 capture_enabled; /* To enable capturing of sniffing data */ + __u64 ul_freq_khz; /* uplink carrier frequency in kilohertz */ + __u64 dl_freq_khz; /* downlink carrier frequency in kilohertz*/ + __u16 dl_delay; /* Downlink delay */ + __u16 ul_delay; /* uplink delay */ + __u8 mode; /* network mode */ + __u8 tx_rxmode; /* transmit and receive mode: 1T1R or 2T2R */ + __u8 bw; /* Bandwidth to be used */ + __u8 padding[1]; +}; + +2. RF_SET_TIMER_SOURCE: Program RF controller to set timing source of PPS +Usage: + ioctl(fd, RIF_SET_TIMER_SOURCE, &src); +where src is denoted as +enum rf_timer_src { + RF_PPS_SRC_GPS = 1, /* time sync src as GPS signal and do correction */ + RF_PPS_SRC_RAW_GPS, /* time sync src as GPS but no clock correction */ + RF_PPS_SRC_PTP, /* time sync src as eTSEC 1588 block */ + RF_PPS_SRC_NLM, /* src is internally generated by controller */ + RF_PPS_SRC_END +}; + +4. RF_SET_TIMER_CORRECTION: Program RF PHY registers to set timer source correction +Usage: + ioctl(fd, RIF_SET_TIMER_CORRECTION, &dac_params); +where dac_params is represented as +struct rf_dac_params { + __u32 correction_type; /* correction can be coarse and fine */ + __u32 correction_value; /* value of correction for DAC registers */ +}; + +6. RF_READ_RSSI: To read RSSI(Receive Signal Strength Indicator) from the RF PHY +Usage: + ioctl(fd, RIF_READ_RSSI, &rssi); +where rssi is represented as +struct rf_rssi { + __u32 ant; /* Antenna number for which RSSI is reported */ + __u32 symbol; /* Runtime RSSI */ + __u32 preamble; /* Initial RSSI */ + __s32 multiplier; /* Multiplier to convert reported RSSI */ + __u8 duration; /* Duration to be considered for measuring */ +}; + +9. RF_START: To make the Antenna controller and the Phy to be ready for DL/UL + of signals. This will change the RF state to RF_READY. +Usage: + ioctl(fd, RIF_START, NULL); + +11. RF_STOP: To stop/reset the RF Phy and Antenna controller. +Usage: + ioctl(fd, RIF_STOP, NULL); + +12. RF_GET_DEV_INFO: To get information in the user space about the current + state and parameters of RF device framework +Usage: + ioctl(fd, RIF_GET_DEV_INFO, dev_info); +where dev_info is a structure of type +struct rf_dev_info { + __u64 sniff_carrier_freq; /* Carrier frequency for sniffing */ + __u64 dl_carrier_freq; /* down link Carrier frequency */ + __u64 ul_carrier_freq; /* up link Carrier frequency */ + __u32 sniff_enabled; /* flag for sniffing */ + __u32 ants; /* Number of antennas */ + __u32 symbol_len; /* Length of Symbol */ + __u32 long_cp; /* Flag for short/long cyclic prefix */ + __u32 cp0_len; /* length of cp0 */ + __u32 cp1_len; /* length of cp1 */ + __u32 tx_atten[MAX_NUM_ANTENNAS]; /* Tx attenuation for all antennas */ + char controller[RF_NAME_SIZE]; /* Name of RF device controller */ + char phy[RF_NAME_SIZE]; /* Name of RFIC connected to ‘controller */ + __u8 state; /* RFdev framework state */ + __u8 master_state; /* RFdev framework state of master */ + __u8 mode; /* flag for Master/Slave of rfdev */ + __u8 net_mode; /* network mode */ + __u8 tx_rxmode; /* 1T1R or 2T2R */ + __u8 bw; /* bandwidth used */ + __u8 timing_src; /* timing source used for time_sync */ + __u8 sniff_net_mode; /* network mode for sniffing */ + __u8 sniff_tx_rxmode; /* txrx_mode for sniffing */ + __u8 sniff_timing_src; /* timing source in sniffing mode */ + __u8 sniff_bw; /* bandwidth for sniffing */ +}; + +14. RF_GET_DAC_VALUE: Read RF PHY DAC values for frequency correction +Usage: + ioctl(fd, RIF_GET_DAC_VALUE, &dac_buf); +where dac_buf is structure of type +struct rf_dac_buf { + __u32 correction_type; /* Coarse or fine correction */ + __u32 buf; /* correction value */ +}; + +15. RF_SET_TX_ATTEN: Program RF PHY to set RF TX attenuation +Usage: + ioctl(fd, RIF_SET_TX_ATTEN, tx_buf); +where tx_buf is a structure of type +struct rf_tx_buf { + __u32 tx_if; /* Transmit antenna interface */ + __u32 tx_atten; /* Attenuation value from 0-255. + * value is as per LTE/WCDMA requirement */ +}; + +16. RF_EN_DIS_TX: Program RF PHY to enable/disable TX antenna +Usage: + ioctl(fd, RIF_EN_DIS_TX, tx_en_dis); +where tx_en_dis is a structure of type +struct rf_tx_en_dis { + __u32 tx_if; /* Transmit antenna interface */ + __u32 tx_cmd; /* command for enabling/disabling */ +}; + +18. RF_READ_RX_GAIN: To get the Rx gain from RF phy. It can be read after + PHY and controller are in ready state +Usage: + ioctl(fd, RIF_READ_RX_GAIN, rx_gain); +where rx_gain is structure of type +struct rf_rx_gain { + __u32 ant; /* Antenna number to read gain */ + __s32 gain_db; /* gain value in dB */ + __u32 lmt_index; /* LNA-MIXER-TIA gain index */ + __u32 lmt_gain; /* LNA-MIXER-TIA gain in dB */ + __u32 lpf_gain; /* Low pass filter gain in dB */ + __u32 digital_gain; /* Digital gain in dB */ +}; + +19. RF_CONFIG_SNIFF: Switch to “RF_SNIFFING” state, configure RF Controller/ + PHY sniff parameters, and enable sniffing procedure. +Usage: + ioctl(fd, RIF_CONFIG_SNIFF, &sniff_params); +where sniff_params is structure of type +struct rf_sniff_params { + struct rf_init_params dev_params; /* Same as explained above */ + __u64 carrier_freq; /* carrier frequency for sniffing */ + __u32 capture_duration; /* Capture duration in radio frames */ + __u8 timing_src; /* timimg source for sniffing */ +}; + +20. RF_WRITE_RX_GAIN: Program RF PHY to set RF RX gain +Usage: + ioctl(fd, RIF_WRITE_RX_GAIN, rx_gain); +rx_gain is structure of type rf_rx_gain explained above + +21. RF_SET_GAIN_CTRL_MODE: To set the gain control mode of RF PHY +Usage: + ioctl(fd, RIF_SET_GAIN_CTRL_MODE, gain_ctrl); +gain_ctrl is a stucture of type +struct rf_gain_ctrl { + __u32 ant; /* antenna for which mode shall be set */ + __u8 mode; /* mode can be Manual/ Automatic-FAST/Automatic-SLOW/ + * Hybrid */ +}; + +22. RF_INIT_SYNTH_TABLE: To initialize the Synthesizer tables for modifying + the carrier frequency on runtime. +Usage: + ioctl(fd, RIF_INIT_SYNTH_TABLE, &synth_table); +synth_table is a structure of type +struct rf_synth_table { + __u64 (*params)[NUM_SYNTH_PARAMS]; /* parameters for synthesizer */ + __u8 (*reg_vals)[NUM_SYNTH_REGS]; /* register values */ + __u32 count; /* number of rows in table */ +}; + +23. RF_CHANNEL_OPEN: To Open data channels for sniffing +Usage: + ioctl(fd, RIF_CHANNEL_OPEN, &chan_params); +chan_params is a structure of type +struct rf_channel_params { + __u32 ant; /* Antenna for which the channel will tx/rx IQ data */ + __u32 flags; /* Channel flags */ + __u32 tx_buf_size; /* Size of Tx buffer */ + __u32 rx_buf_size; /* Size of Rx buffer */ + __u32 tx_base_phys; /* Tx buffer base physical address */ + __u32 rx_base_phys; /* Rx buffer base physical address */ +}; + + +24. RF_CHANNEL_CLOSE To close data channels +Usage: + ioctl(fd, RIF_CHANNEL_CLOSE, ant); +where ant is the antenna number for which the channel shall be closed + +25. RF_REGISTER_EVENT: To register event handlers to pass information about + certain events from kernel to user space. +Usage: + ioctl(fd, RIF_REGISTER_EVENT, &listener); +listener is a structure of type +struct rf_event_listener { + __u16 evt_mask; /* mask for various events */ + __u32 signal; /* signal for notification to the user space */ +}; + + +26. RF_UNREGISTER_EVENT: To unregister the event handler +Usage: + ioctl(priv->fd, RIF_UNREGISTER_EVENT); +
drivers/misc/Kconfig +1 -0
@@ -537,4 +537,5 @@ source "drivers/misc/carma/Kconfig" source "drivers/misc/altera-stapl/Kconfig" source "drivers/misc/mei/Kconfig" source "drivers/misc/vmw_vmci/Kconfig" +source "drivers/misc/rf/Kconfig" endmenu
drivers/misc/Makefile +1 -0
@@ -53,3 +53,4 @@ obj-$(CONFIG_INTEL_MEI) += mei/ obj-$(CONFIG_VMWARE_VMCI) += vmw_vmci/ obj-$(CONFIG_LATTICE_ECP3_CONFIG) += lattice-ecp3-config.o obj-$(CONFIG_SRAM) += sram.o +obj-$(CONFIG_RFDEVICES) += rf/
drivers/misc/rf/Kconfig new file +19 -0
@@ -0,0 +1,19 @@ + +# RF (radio frequency) device configuration +# + +menuconfig RFDEVICES + default n + bool "RF interface device support" + ---help--- + Support for Radio Frequency(RF) interface devices. + In a baseband system, different radios (RF PHYs) are + connected depending on required radio technology. Higher layer + stacks need to configure the radio according to required network mode. + Adding this support will export different radios connected in system + (in case of multi mode system)as RF interface deivces 'rf0', 'rf1' etc. + Higher layer stacks (running in user space)can use rfX device to + talk to a specific radio. + + radio interface controller driver (Antenna controller) and RF PHY driver + connected to system must also be chosen.
drivers/misc/rf/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# +# Makefile for the RF interface drivers. +# + +obj-$(CONFIG_RFDEVICES) += core/
drivers/misc/rf/core/Makefile new file +2 -0
@@ -0,0 +1,2 @@ + +obj-$(CONFIG_RFDEVICES) += rfdev.o rf_channel.o
drivers/misc/rf/core/rf_channel.c new file +211 -0
211 lines not on this page · raw message
drivers/misc/rf/core/rfdev.c new file +1364 -0
1,364 lines not on this page · raw message
include/linux/rf_channel.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* RF device Data channels +* +* Author: pankaj chauhan <[email protected]> +* +* Copyright 2011-2012 Freescale Semiconductor, Inc. +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +*/ + +struct rf_frame { +int ant; +union { +void *buffer; +u32 buffer_idx; + } buf; +}; + +int rf_channel_open (struct rf_ctrl_dev *rf_dev,unsigned long arg); +int rf_channel_close (struct rf_ctrl_dev *rf_dev,int ant); +int rf_rx_frame (struct rf_ctrl_dev *rf_dev,struct rf_frame *frame); +int rf_sniff_done (struct rf_ctrl_dev *rf_dev,int ant);
include/linux/rfdev.h new file +250 -0
250 lines not on this page · raw message
include/uapi/linux/rfdev.h new file +367 -0
367 lines not on this page · raw message
Signature · 1 line
1.6.3.1
PATCH v2 2/4 drivers/misc/rf: AIC: Freescale Antenna Interface controller driver
From: Akhil Goyal <[email protected]>
AIC is the antenna interface controller found in heterogenous SOCs- BSC9131 and BSC9132. It supports NCDMA, WCDMA-FDD, LTE-FDD, LTE-TDD and SNIFF network modes.
AIC has 6 data lanes in BSC9131 and 4 in BSC9132 on which RFICs can be connected. AIC supports at max 4 RFICs working simultaneously.
The address mapping of AIC is a part of DSP side of SOC. But according to the architecture of the system, configuration of this driver shall be done from PA side.
This patch support LTE-FDD, LTE-TDD and WCDMA configurations for AIC. The data from RFIC through AIC goes directly to a hardware accelerator from where it is taken out by DSP core in bsc913x.
This patch also support sniffing of LTE-FDD networks and it can also handle the data path of the sniffing data.
--- drivers/misc/rf/Kconfig | 11 + drivers/misc/rf/Makefile | 1 + drivers/misc/rf/controllers/Makefile | 1 + drivers/misc/rf/controllers/fsl_aic.c | 1558 +++++++++++++++++++++++++++++++++ drivers/misc/rf/controllers/fsl_aic.h | 450 ++++++++++ 5 files changed, 2021 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/rf/controllers/Makefile create mode 100644 drivers/misc/rf/controllers/fsl_aic.c create mode 100644 drivers/misc/rf/controllers/fsl_aic.h
drivers/misc/rf/Kconfig +11 -0
@@ -17,3 +17,14 @@ menuconfig RFDEVICES radio interface controller driver (Antenna controller) and RF PHY driver connected to system must also be chosen. + +if RFDEVICES + +config FSL_AIC + default y + bool "Freescale Antenna Interface Controller (AIC)" + ---help--- + Freescale AIC controller (Antenna Interface Controller) is found + in bsc913x family of SOCs. AIC has six RF lanes and maximum four + RF PHYs can be connected and operated simultaneously. +endif
drivers/misc/rf/Makefile +1 -0
@@ -3,3 +3,4 @@ # obj-$(CONFIG_RFDEVICES) += core/ +obj-$(CONFIG_RFDEVICES) += controllers/
drivers/misc/rf/controllers/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_FSL_AIC) += fsl_aic.o
drivers/misc/rf/controllers/fsl_aic.c new file +1558 -0
1,558 lines not on this page · raw message
drivers/misc/rf/controllers/fsl_aic.h new file +450 -0
450 lines not on this page · raw message
Signature · 1 line
1.6.3.1
PATCH v2 3/4 binding: Add device tree bindings for freescale AIC
From: Akhil Goyal <[email protected]>
For platforms like BSC9131 and BSC9132, a Radio framework for supporting various network modes comprise of an Antenna interface controller driver and a phy driver.
A combination of AIC lane and phy is called a rf device which can be used to operate on a particular network mode.
This patch explain various device tree properties required for AIC driver
--- Documentation/devicetree/bindings/rf/fsl-aic.txt | 47 ++++++++++++++++++++++ 1 files changed, 47 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/rf/fsl-aic.txt
Documentation/devicetree/bindings/rf/fsl-aic.txt new file +47 -0
@@ -0,0 +1,47 @@ +Freescale Antenna Interface Controller + +AIC is the antenna interface controller found in bsc913x +family of SOCs. It supports NCDMA, WCDMA-FDD, LTE-FDD, LTE-TDD +and GSM-SNIFF network modes. AIC has multiple lanes on which RFICs +can be connected. And AIC supports 4 RFICs working simultaneously. + +Required Properties: +- #address-cells : should be 1 +- #size-cells : should be 1 +- compatible : should be fsl,bsc9131-aic or fsl,bsc9132-aic or both +- reg : offset and length of common register set of AIC +- interrupts : For AIC, first is capture complete interrupt + second is dsp general interrupt +aic node can have multiple sub nodes of aiclanes for each lane. +- aiclane : Required Properties + - reg : offset and length of common register set of AIC lane + - lane_id : it can be 0, 1, 2, 3, 4, 5 + - interrupts : lane specific TTI interrupt line + +For Example: + +aic@50000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "fsl,bsc9131-aic", "fsl,bsc9132-aic"; + reg = <0x50000 0x200>; + interrupts = <49 2 0 0 53 2 0 0>; + lane0: aiclane@200 { + reg = <0x200 0x200>; + lane_id = <0>; + interrupts = <45 2 0 0>; + }; + + lane1: aiclane@400 { + reg = <0x400 0x200>; + lane_id = <1>; + interrupts = <46 2 0 0>; + }; + + lane2: aiclane@600 { + reg = <0x600 0x200>; + lane_id = <2>; + interrupts = <47 2 0 0>; + }; +}; +
Signature · 1 line
1.6.3.1
PATCH v2 4/4 BSC9131rdb/dts: Add nodes for supporting AIC
From: Akhil Goyal <[email protected]>
BSC9131 is a hetrogenous system where Antenna interface controller (AIC) is a part of DSP subsystem. But its configuration is done from PA side. So a DSP node is added with appropriate CCSR address visible to PA and hence the address space for AIC will be visible to PA.
BSC9131 support 3 AIC lanes for ADI interface and 3 for MAXIM type of interface. This patch support only ADI lanes.
--- arch/powerpc/boot/dts/bsc9131rdb.dts | 4 ++ arch/powerpc/boot/dts/fsl/bsc9131si-post.dtsi | 38 +++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 0 deletions(-)
arch/powerpc/boot/dts/bsc9131rdb.dts +4 -0
@@ -28,6 +28,10 @@ board_soc: soc: soc@ff700000 { ranges = <0x0 0x0 0xff700000 0x100000>; }; + + dsp_soc: sc3850@ff600000 { + ranges = <0x0 0x0 0xff600000 0x100000>; + }; }; /include/ "bsc9131rdb.dtsi"
arch/powerpc/boot/dts/fsl/bsc9131si-post.dtsi +38 -0
@@ -191,3 +191,41 @@ global-utilities@e0000 { fsl,has-rstcr; }; }; + +&dsp_soc { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + gcr@18000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "fsl,bsc9131-gcr", "fsl,bsc9132-gcr"; + reg = <0x18000 0x200>; + }; + aic@50000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "fsl,bsc9131-aic", "fsl,bsc9132-aic"; + reg = <0x50000 0x200>; + interrupts = <49 2 0 0 53 2 0 0>; + lane0: aiclane@200 { + reg = <0x200 0x200>; + lane_id = <0>; + interrupts = <45 2 0 0>; + }; + + lane1: aiclane@400 { + reg = <0x400 0x200>; + lane_id = <1>; + interrupts = <46 2 0 0>; + }; + + lane2: aiclane@600 { + reg = <0x600 0x200>; + lane_id = <2>; + interrupts = <47 2 0 0>; + }; + }; +}; + +
Signature · 1 line
1.6.3.1
Greg KH
maintainerRe: [PATCH v2 1/4] drivers/misc: Support for RF interface device framework
In reply to [email protected]Quoted 12 lines · On Mon, Aug 12, 2013 at 12:43:50PM +0530, [email protected] wrote:
From: Akhil Goyal <[email protected]>
The radio device framework introduces a way to accommodate the RF(radio frequency) signal paths. One signal path is represented as a RF device (rf0, rf1 etc), and it can contain multiple components which have their individual vendor specific drivers. The framework provides mechanism by which individual components can register with RF framework, and the framework will handle the binding of individual component devices to a RF device. RF device exports the control interfaces to user space, and this user space interface is independent of component (vendor specific) drivers.
Quoted 7 lines
In a multimode system there can be multiple rfdev devices, depending on number of radios connected.
In this patch, the rf controller(AIC) and RFIC drivers register their respective devices with this framework. This framework does binding of RFIC device with RF controller device and exposes the combination as a logical rfdev to user space.
You are creating a bunch of character device nodes, yet there is no "device" behind it yet. Also, you do not export these to userspace at all, so no "modern" system can access these device nodes at all (hint, try this on your desktop system...)
You should really tie into the driver model properly, to get the device node creation, as well as showing to userspace exactly which devices is connected on the "rf bus" that you need to create, because you have a bunch of different devices that can be attached here, with no real way to show userspace what is going on.
Please fix up the code to do this, as it is, this is not mergable at all. And I'm finding it hard to understand how you tested it out...
thanks,
greg k-h
Re: [PATCH v2 1/4] drivers/misc: Support for RF interface device framework
Quoted 26 lines · Greg KH
Quoted 12 lines · On Mon, Aug 12, 2013 at 12:43:50PM +0530, [email protected] wrote:
From: Akhil Goyal<[email protected]>
The radio device framework introduces a way to accommodate the RF(radio frequency) signal paths. One signal path is represented as a RF device (rf0, rf1 etc), and it can contain multiple components which have their individual vendor specific drivers. The framework provides mechanism by which individual components can register with RF framework, and the framework will handle the binding of individual component devices to a RF device. RF device exports the control interfaces to user space, and this user space interface is independent of component (vendor specific) drivers.
Quoted 7 lines
In a multimode system there can be multiple rfdev devices, depending on number of radios connected.
In this patch, the rf controller(AIC) and RFIC drivers register their respective devices with this framework. This framework does binding of RFIC device with RF controller device and exposes the combination as a logical rfdev to user space.
You are creating a bunch of character device nodes, yet there is no "device" behind it yet. Also, you do not export these to userspace at all, so no "modern" system can access these device nodes at all (hint, try this on your desktop system...)
Quoted 9 lines
You should really tie into the driver model properly, to get the device node creation, as well as showing to userspace exactly which devices is connected on the "rf bus" that you need to create, because you have a bunch of different devices that can be attached here, with no real way to show userspace what is going on.
Please fix up the code to do this, as it is, this is not mergable at all. And I'm finding it hard to understand how you tested it out...
Ok I will fix this in the next version.
Thanks,
Akhil