diff options
Diffstat (limited to 'include/linux/modem/m6718_spi')
-rw-r--r-- | include/linux/modem/m6718_spi/modem_char.h | 26 | ||||
-rw-r--r-- | include/linux/modem/m6718_spi/modem_driver.h | 165 | ||||
-rw-r--r-- | include/linux/modem/m6718_spi/modem_net.h | 50 |
3 files changed, 241 insertions, 0 deletions
diff --git a/include/linux/modem/m6718_spi/modem_char.h b/include/linux/modem/m6718_spi/modem_char.h new file mode 100644 index 00000000000..04d82eaa03c --- /dev/null +++ b/include/linux/modem/m6718_spi/modem_char.h @@ -0,0 +1,26 @@ +/* + * Copyright (C) ST-Ericsson SA 2011 + * + * Author: Chris Blair <chris.blair@stericsson.com> for ST-Ericsson + * based on shrm_driver.h + * + * License terms: GNU General Public License (GPL) version 2 + * + * Modem IPC driver char interface header. + */ +#ifndef _MODEM_CHAR_H_ +#define _MODEM_CHAR_H_ + +#include <linux/modem/m6718_spi/modem_driver.h> + +int modem_isa_init(struct modem_spi_dev *modem_spi_dev); +void modem_isa_exit(struct modem_spi_dev *modem_spi_dev); + +int modem_isa_queue_msg(struct message_queue *q, u32 size); +int modem_isa_msg_size(struct message_queue *q); +int modem_isa_unqueue_msg(struct message_queue *q); +void modem_isa_reset(struct modem_spi_dev *modem_spi_dev); +int modem_get_cdev_index(u8 l2_header); +int modem_get_cdev_l2header(u8 idx); + +#endif /* _MODEM_CHAR_H_ */ diff --git a/include/linux/modem/m6718_spi/modem_driver.h b/include/linux/modem/m6718_spi/modem_driver.h new file mode 100644 index 00000000000..f3aae4a7116 --- /dev/null +++ b/include/linux/modem/m6718_spi/modem_driver.h @@ -0,0 +1,165 @@ +/* + * Copyright (C) ST-Ericsson SA 2011 + * + * Author: Chris Blair <chris.blair@stericsson.com> for ST-Ericsson + * based on shrm_driver.h + * + * License terms: GNU General Public License (GPL) version 2 + * + * Modem IPC driver interface header. + */ +#ifndef _MODEM_DRIVER_H_ +#define _MODEM_DRIVER_H_ + +#include <linux/device.h> +#include <linux/modem/modem.h> +#include <linux/cdev.h> +#include <linux/spi/spi.h> + + +/* driver L2 mux channels */ +#ifdef CONFIG_MODEM_M6718_SPI_ENABLE_FEATURE_LOOPBACK +#define MODEM_M6718_SPI_MAX_CHANNELS (9) +#else +#define MODEM_M6718_SPI_MAX_CHANNELS (3) +#endif + +#define MODEM_M6718_SPI_CHN_ISI (0) +/*#define MODEM_M6718_SPI_CHN_RPC (1) not supported */ +#define MODEM_M6718_SPI_CHN_AUDIO (2) +/*#define MODEM_M6718_SPI_CHN_SECURITY (3) not supported */ +/* (4) not supported */ +#ifdef CONFIG_MODEM_M6718_SPI_ENABLE_FEATURE_LOOPBACK +#define MODEM_M6718_SPI_CHN_MASTER_LOOPBACK0 (5) +#define MODEM_M6718_SPI_CHN_SLAVE_LOOPBACK0 (6) +#define MODEM_M6718_SPI_CHN_MASTER_LOOPBACK1 (7) +#define MODEM_M6718_SPI_CHN_SLAVE_LOOPBACK1 (8) +#endif + +/** + * struct queue_element - information to add an element to queue + * @entry: list entry + * @offset: message offset + * @size: message size + * @no: total number of messages + */ +struct queue_element { + struct list_head entry; + u32 offset; + u32 size; + u32 no; +}; + +/** + * struct message_queue - ISI, RPC, AUDIO, SECURITY message queue information + * @channel: L2 mux channel served by this queue + * @fifo_base: pointer to the respective fifo base + * @size: size of the data to be read + * @free: free space in the queue + * @readptr: fifo read pointer + * @writeptr: fifo write pointer + * @no: total number of messages + * @update_lock: spinlock for protecting the queue read operation + * @q_rp: queue read pointer is valid + * @wq_readable: wait queue head + * @msg_list: message list + * @modem_spi_dev: pointer to modem device information structure + */ +struct message_queue { + u8 channel; + u8 *fifo_base; + u32 size; + u32 free; + u32 readptr; + u32 writeptr; + u32 no; + spinlock_t update_lock; + atomic_t q_rp; + wait_queue_head_t wq_readable; + struct list_head msg_list; + struct modem_spi_dev *modem_spi_dev; +}; + +/** + * struct isa_device_context - modem char interface device information + * @dl_queue: structre to store the queue related info + * @device_id: channel id (ISI, AUDIO, RPC, ...) + * @addr: device address + */ +struct isa_device_context { + struct message_queue dl_queue; + u8 device_id; + void *addr; +}; + +/** + * struct isa_driver_context - modem char interface driver information + * @is_open: flag to check the usage of queue + * @isadev: pointer to struct t_isadev_context + * @common_tx_lock: spinlock for protecting common channel + * @audio_tx_mutex: mutex for protecting audio channel + * @cdev: character device structre + * @modem_class: pointer to the class structure + */ +struct isa_driver_context { + atomic_t is_open[MODEM_M6718_SPI_MAX_CHANNELS]; + struct isa_device_context *isadev; + spinlock_t common_tx_lock; + struct mutex audio_tx_mutex; + struct cdev cdev; + struct class *modem_class; +}; + +/** + * struct modem_spi_dev - modem device information + * @dev pointer to device + * @ndev pointer to net_device interface + * @modem pointer to registered modem structure + * @isa_context pointer to char device interface + * @netdev_flag_up: flag to indicate up/down of network device + * @msr_flag: flag to indicate modem-silent-reset is in progress + */ +struct modem_spi_dev { + struct device *dev; + struct net_device *ndev; + struct modem *modem; + struct isa_driver_context *isa_context; + int netdev_flag_up; + bool msr_flag; +}; + +/** + * struct modem_m6718_spi_link_gpio - gpio configuration for an IPC link + * @ss_pin: pins to use for slave-select + * @ss_active: active level for slave-select pin + * @int_pin: pin to use for slave-int (ready) + * @int_active: active level for slave-int + */ +struct modem_m6718_spi_link_gpio { + int ss_pin; + int ss_active; + int int_pin; + int int_active; +}; + +/** + * struct modem_m6718_spi_link_platform_data - IPC link data + * @id: link id + * @gpio: link gpio configuration + * @name: link name (to appear in debugfs) + */ +struct modem_m6718_spi_link_platform_data { + int id; + struct modem_m6718_spi_link_gpio gpio; +#ifdef CONFIG_DEBUG_FS + const char *name; +#endif +}; + +int modem_m6718_spi_receive(struct spi_device *sdev, u8 channel, + u32 len, void *data); +int modem_m6718_spi_send(struct modem_spi_dev *modem_spi_dev, u8 channel, + u32 len, void *data); +bool modem_m6718_spi_is_boot_done(void); + +#endif /* _MODEM_DRIVER_H_ */ diff --git a/include/linux/modem/m6718_spi/modem_net.h b/include/linux/modem/m6718_spi/modem_net.h new file mode 100644 index 00000000000..521103bf006 --- /dev/null +++ b/include/linux/modem/m6718_spi/modem_net.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) ST-Ericsson SA 2011 + * + * Author: Chris Blair <chris.blair@stericsson.com> for ST-Ericsson + * based on shrm_net.h + * + * License terms: GNU General Public License (GPL) version 2 + * + * Modem IPC net device interface header. + */ +#ifndef _MODEM_NET_H_ +#define _MODEM_NET_H_ + +#include <linux/modem/m6718_spi/modem_driver.h> + +#define MODEM_HLEN (1) +#define PHONET_ALEN (1) + +#define PN_PIPE (0xD9) +#define PN_DEV_HOST (0x00) +#define PN_LINK_ADDR (0x26) +#define PN_TX_QUEUE_LEN (3) + +#define RESOURCE_ID_INDEX (3) +#define SRC_OBJ_INDEX (7) +#define MSG_ID_INDEX (9) +#define PIPE_HDL_INDEX (10) +#define NETLINK_MODEM (20) + +/** + * struct modem_spi_net_dev - modem net interface device information + * @modem_spi_dev: pointer to the modem spi device information structure + * @iface_num: flag used to indicate the up/down of netdev + */ +struct modem_spi_net_dev { + struct modem_spi_dev *modem_spi_dev; + unsigned int iface_num; +}; + +int modem_net_init(struct modem_spi_dev *modem_spi_dev); +void modem_net_exit(struct modem_spi_dev *modem_spi_dev); + +int modem_net_receive(struct net_device *dev); +int modem_net_suspend(struct net_device *dev); +int modem_net_resume(struct net_device *dev); +int modem_net_start(struct net_device *dev); +int modem_net_restart(struct net_device *dev); +int modem_net_stop(struct net_device *dev); + +#endif /* _MODEM_NET_H_ */ |