aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/modem_if/modem_prj.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/modem_if/modem_prj.h')
-rw-r--r--drivers/misc/modem_if/modem_prj.h514
1 files changed, 280 insertions, 234 deletions
diff --git a/drivers/misc/modem_if/modem_prj.h b/drivers/misc/modem_if/modem_prj.h
index f85596f..ccff272 100644
--- a/drivers/misc/modem_if/modem_prj.h
+++ b/drivers/misc/modem_if/modem_prj.h
@@ -1,5 +1,4 @@
/*
- * Copyright (C) 2010 Google, Inc.
* Copyright (C) 2010 Samsung Electronics.
*
* This software is licensed under the terms of the GNU General Public
@@ -19,12 +18,18 @@
#include <linux/wait.h>
#include <linux/miscdevice.h>
#include <linux/skbuff.h>
+#include <linux/interrupt.h>
#include <linux/completion.h>
#include <linux/wakelock.h>
#include <linux/rbtree.h>
#include <linux/spinlock.h>
#include <linux/cdev.h>
#include <linux/types.h>
+#include "modem.h"
+
+#ifndef CONFIG_SAMSUNG_PRODUCT_SHIP
+#define DEBUG_MODEM_IF
+#endif
#define MAX_CPINFO_SIZE 512
@@ -33,7 +38,10 @@
#define MAX_FMT_DEVS 10
#define MAX_RAW_DEVS 32
#define MAX_RFS_DEVS 10
-#define MAX_NUM_IO_DEV (MAX_FMT_DEVS + MAX_RAW_DEVS + MAX_RFS_DEVS)
+#define MAX_BOOT_DEVS 10
+#define MAX_DUMP_DEVS 10
+
+#define MAX_IOD_RXQ_LEN 2048
#define IOCTL_MODEM_ON _IO('o', 0x19)
#define IOCTL_MODEM_OFF _IO('o', 0x20)
@@ -62,22 +70,40 @@
#define IOCTL_MODEM_SWITCH_MODEM _IO('o', 0x37)
#endif
-#define IOCTL_DPRAM_SEND_BOOT _IO('o', 0x40)
-#define IOCTL_DPRAM_INIT_STATUS _IO('o', 0x43)
-
-/* ioctl command definitions. */
-#define IOCTL_DPRAM_PHONE_POWON _IO('o', 0xd0)
-#define IOCTL_DPRAM_PHONEIMG_LOAD _IO('o', 0xd1)
-#define IOCTL_DPRAM_NVDATA_LOAD _IO('o', 0xd2)
-#define IOCTL_DPRAM_PHONE_BOOTSTART _IO('o', 0xd3)
+#define IOCTL_MODEM_RAMDUMP_START _IO('o', 0xCE)
+#define IOCTL_MODEM_RAMDUMP_STOP _IO('o', 0xCF)
-#define IOCTL_DPRAM_PHONE_UPLOAD_STEP1 _IO('o', 0xde)
-#define IOCTL_DPRAM_PHONE_UPLOAD_STEP2 _IO('o', 0xdf)
+#define IOCTL_MODEM_XMIT_BOOT _IO('o', 0x40)
+#define IOCTL_DPRAM_INIT_STATUS _IO('o', 0x43)
/* ioctl command for IPC Logger */
#define IOCTL_MIF_LOG_DUMP _IO('o', 0x51)
#define IOCTL_MIF_DPRAM_DUMP _IO('o', 0x52)
+/* ioctl command definitions. */
+#define IOCTL_DPRAM_PHONE_POWON _IO('o', 0xD0)
+#define IOCTL_DPRAM_PHONEIMG_LOAD _IO('o', 0xD1)
+#define IOCTL_DPRAM_NVDATA_LOAD _IO('o', 0xD2)
+#define IOCTL_DPRAM_PHONE_BOOTSTART _IO('o', 0xD3)
+
+#define IOCTL_DPRAM_PHONE_UPLOAD_STEP1 _IO('o', 0xDE)
+#define IOCTL_DPRAM_PHONE_UPLOAD_STEP2 _IO('o', 0xDF)
+
+#define CPBOOT_DIR_MASK 0xF000
+#define CPBOOT_STAGE_MASK 0x0F00
+#define CPBOOT_CMD_MASK 0x000F
+#define CPBOOT_REQ_RESP_MASK 0x0FFF
+
+#define CPBOOT_DIR_AP2CP 0x9000
+#define CPBOOT_DIR_CP2AP 0xA000
+
+#define CPBOOT_STAGE_SHIFT 8
+
+#define CPBOOT_STAGE_START 0x0000
+#define CPBOOT_CRC_SEND 0x000C
+#define CPBOOT_STAGE_DONE 0x000D
+#define CPBOOT_STAGE_FAIL 0x000F
+
/* modem status */
#define MODEM_OFF 0
#define MODEM_CRASHED 1
@@ -93,83 +119,50 @@
#define PSD_DATA_CHID_BEGIN 0x2A
#define PSD_DATA_CHID_END 0x38
-#define PS_DATA_CH_0 10
-#define PS_DATA_CH_LAST 24
+#define PS_DATA_CH_0 10
+#define PS_DATA_CH_LAST 24
+#define RMNET0_CH_ID PS_DATA_CH_0
#define IP6VERSION 6
#define SOURCE_MAC_ADDR {0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC}
-/* loopback: CP -> AP -> CP */
-#define CP2AP_LOOPBACK_CHANNEL 30
-
-/* ip loopback */
-#define RMNET0_CH_ID 10
+/* IP loopback */
+#define DATA_DRAIN_CHANNEL 30 /* Drain channel to drop RX packets */
#define DATA_LOOPBACK_CHANNEL 31
/* Debugging features */
-#define MAX_MIF_LOG_PATH_LEN 128
-#define MAX_MIF_LOG_FILE_SIZE 0x800000 /* 8 MB */
-
-#define MAX_MIF_EVT_BUFF_SIZE 256
-#define MAX_MIF_TIME_LEN 32
-#define MAX_MIF_NAME_LEN 16
-#define MAX_MIF_STR_LEN 127
-#define MAX_MIF_LOG_LEN 128
-
-enum mif_event_id {
- MIF_IRQ_EVT = 0,
- MIF_LNK_RX_EVT,
- MIF_MUX_RX_EVT,
- MIF_IOD_RX_EVT,
- MIF_IOD_TX_EVT,
- MIF_MUX_TX_EVT,
- MIF_LNK_TX_EVT,
- MAX_MIF_EVT
-};
-
-struct dpram_queue_status {
- unsigned in;
- unsigned out;
-};
-
-struct dpram_queue_status_pair {
- struct dpram_queue_status txq;
- struct dpram_queue_status rxq;
-};
-
-struct dpram_irq_buff {
- unsigned magic;
- unsigned access;
- struct dpram_queue_status_pair qsp[MAX_IPC_DEV];
- unsigned int2ap;
- unsigned int2cp;
-};
-
-/* Not use */
-struct mif_event_buff {
- char time[MAX_MIF_TIME_LEN];
-
- struct timeval tv;
- enum mif_event_id evt;
-
- char mc[MAX_MIF_NAME_LEN];
-
- char iod[MAX_MIF_NAME_LEN];
-
- char ld[MAX_MIF_NAME_LEN];
- enum modem_link link_type;
-
- unsigned rcvd;
- unsigned len;
- union {
- u8 data[MAX_MIF_LOG_LEN];
- struct dpram_irq_buff dpram_irqb;
- };
+#define MIF_LOG_DIR "/sdcard/log"
+#define MIF_MAX_PATH_LEN 256
+#define MIF_MAX_NAME_LEN 64
+#define MIF_MAX_STR_LEN 32
+
+#define CP_CRASH_TAG "CP Crash "
+
+static const char const *dev_format_str[] = {
+ [IPC_FMT] = "FMT",
+ [IPC_RAW] = "RAW",
+ [IPC_RFS] = "RFS",
+ [IPC_MULTI_RAW] = "MULTI_RAW",
+ [IPC_CMD] = "CMD",
+ [IPC_BOOT] = "BOOT",
+ [IPC_RAMDUMP] = "RAMDUMP",
+ [IPC_DEBUG] = "DEBUG",
};
-#define MIF_LOG_DIR "/sdcard"
-#define MIF_LOG_LV_FILE "/data/.mif_log_level"
+/**
+ * get_dev_name
+ * @dev: IPC device (enum dev_format)
+ *
+ * Returns IPC device name as a string.
+ */
+static const inline char *get_dev_name(unsigned int dev)
+{
+ if (unlikely(dev >= MAX_DEV_FORMAT))
+ return "INVALID";
+ else
+ return dev_format_str[dev];
+}
/* Does modem ctl structure will use state ? or status defined below ?*/
enum modem_state {
@@ -187,6 +180,26 @@ enum modem_state {
#endif
};
+static const char const *cp_state_str[] = {
+ [STATE_OFFLINE] = "OFFLINE",
+ [STATE_CRASH_RESET] = "CRASH_RESET",
+ [STATE_CRASH_EXIT] = "CRASH_EXIT",
+ [STATE_BOOTING] = "BOOTING",
+ [STATE_ONLINE] = "ONLINE",
+ [STATE_NV_REBUILDING] = "NV_REBUILDING",
+ [STATE_LOADER_DONE] = "LOADER_DONE",
+ [STATE_SIM_ATTACH] = "SIM_ATTACH",
+ [STATE_SIM_DETACH] = "SIM_DETACH",
+#if defined(CONFIG_SEC_DUAL_MODEM_MODE)
+ [STATE_MODEM_SWITCH] = "MODEM_SWITCH",
+#endif
+};
+
+static const inline char *get_cp_state_str(int state)
+{
+ return cp_state_str[state];
+}
+
enum com_state {
COM_NONE,
COM_ONLINE,
@@ -208,6 +221,17 @@ struct sim_state {
bool changed; /* online is changed? */
};
+enum cp_boot_mode {
+ CP_BOOT_MODE_NORMAL,
+ CP_BOOT_MODE_DUMP,
+ MAX_CP_BOOT_MODE
+};
+
+struct modem_firmware {
+ char *binary;
+ u32 size;
+};
+
#define HDLC_START 0x7F
#define HDLC_END 0x7E
#define SIZE_OF_HDLC_START 1
@@ -216,8 +240,8 @@ struct sim_state {
struct header_data {
char hdr[HDLC_HEADER_MAX_SIZE];
- unsigned len;
- unsigned frag_len;
+ u32 len;
+ u32 frag_len;
char start; /*hdlc start header 0x7F*/
};
@@ -255,10 +279,14 @@ struct sipc_fmt_hdr {
#define SIPC5_EXT_FIELD_EXIST 0b00000010
#define SIPC5_CTL_FIELD_EXIST 0b00000001
-#define SIPC5_MAX_HEADER_SIZE 6
-#define SIPC5_HEADER_SIZE_WITH_EXT_LEN 6
+#define SIPC5_EXT_LENGTH_MASK SIPC5_EXT_FIELD_EXIST
+#define SIPC5_CTL_FIELD_MASK (SIPC5_EXT_FIELD_EXIST | SIPC5_CTL_FIELD_EXIST)
+
+#define SIPC5_MIN_HEADER_SIZE 4
#define SIPC5_HEADER_SIZE_WITH_CTL_FLD 5
-#define SIPC5_MIN_HEADER_SIZE 4
+#define SIPC5_HEADER_SIZE_WITH_EXT_LEN 6
+#define SIPC5_MAX_HEADER_SIZE SIPC5_HEADER_SIZE_WITH_EXT_LEN
+
#define SIPC5_CONFIG_SIZE 1
#define SIPC5_CH_ID_SIZE 1
@@ -267,13 +295,18 @@ struct sipc_fmt_hdr {
#define SIPC5_LEN_OFFSET 2
#define SIPC5_CTL_OFFSET 4
-#define SIPC5_CH_ID_RAW_0 0
#define SIPC5_CH_ID_PDP_0 10
#define SIPC5_CH_ID_PDP_LAST 24
+#define SIPC5_CH_ID_BOOT0 215
+#define SIPC5_CH_ID_DUMP0 225
#define SIPC5_CH_ID_FMT_0 235
#define SIPC5_CH_ID_RFS_0 245
#define SIPC5_CH_ID_MAX 255
+#define SIPC5_CH_ID_FLOW_CTRL 255
+#define FLOW_CTRL_SUSPEND ((u8)(0xCA))
+#define FLOW_CTRL_RESUME ((u8)(0xCB))
+
/* If iod->id is 0, do not need to store to `iodevs_tree_fmt' in SIPC4 */
#define sipc4_is_not_reserved_channel(ch) ((ch) != 0)
@@ -295,20 +328,6 @@ struct sipc5_link_hdr {
} __packed;
struct sipc5_frame_data {
- /* Config octet */
- u8 config;
-
- /* Channel ID */
- u8 ch_id;
-
- /* Control for multiple FMT frame */
- u8 control;
-
- /* Frame configuration set by header analysis */
- bool padding;
- bool ctl_fld;
- bool ext_len;
-
/* Frame length calculated from the length fields */
unsigned len;
@@ -318,11 +337,17 @@ struct sipc5_frame_data {
/* The length of received header */
unsigned hdr_rcvd;
- /* The length of data payload */
- unsigned data_len;
+ /* The length of link layer payload */
+ unsigned pay_len;
/* The length of received data */
- unsigned data_rcvd;
+ unsigned pay_rcvd;
+
+ /* The length of link layer padding */
+ unsigned pad_len;
+
+ /* The length of received padding */
+ unsigned pad_rcvd;
/* Header buffer */
u8 hdr[SIPC5_MAX_HEADER_SIZE];
@@ -349,8 +374,9 @@ struct skbuff_private {
struct io_device *iod;
struct link_device *ld;
struct io_device *real_iod; /* for rx multipdp */
- u8 ch_id;
- u8 control;
+
+ /* for indicating that thers is only one IPC frame in an skb */
+ bool single_frame;
} __packed;
static inline struct skbuff_private *skbpriv(struct sk_buff *skb)
@@ -359,6 +385,35 @@ static inline struct skbuff_private *skbpriv(struct sk_buff *skb)
return (struct skbuff_private *)&skb->cb;
}
+enum iod_rx_state {
+ IOD_RX_ON_STANDBY = 0,
+ IOD_RX_HEADER,
+ IOD_RX_PAYLOAD,
+ IOD_RX_PADDING,
+ MAX_IOD_RX_STATE
+};
+
+static const char const *rx_state_str[] = {
+ [IOD_RX_ON_STANDBY] = "RX_ON_STANDBY",
+ [IOD_RX_HEADER] = "RX_HEADER",
+ [IOD_RX_PAYLOAD] = "RX_PAYLOAD",
+ [IOD_RX_PADDING] = "RX_PADDING",
+};
+
+/**
+ * get_dev_name
+ * @dev: IPC device (enum dev_format)
+ *
+ * Returns IPC device name as a string.
+ */
+static const inline char *get_rx_state_str(unsigned int state)
+{
+ if (unlikely(state >= MAX_IOD_RX_STATE))
+ return "INVALID_STATE";
+ else
+ return rx_state_str[state];
+}
+
struct io_device {
/* rb_tree node for an io device */
struct rb_node node_chan;
@@ -367,6 +422,7 @@ struct io_device {
/* Name of the IO device */
char *name;
+ /* Reference count */
atomic_t opened;
/* Wait queue for the IO device */
@@ -383,7 +439,11 @@ struct io_device {
enum modem_io io_typ;
enum modem_network net_typ;
- bool use_handover; /* handover 2+ link devices */
+ /* The name of the application that will use this IO device */
+ char *app;
+
+ /* Whether or not handover among 2+ link devices */
+ bool use_handover;
/* SIPC version */
enum sipc_ver ipc_version;
@@ -391,6 +451,10 @@ struct io_device {
/* Rx queue of sk_buff */
struct sk_buff_head sk_rx_q;
+ /* RX state used in RX FSM */
+ enum iod_rx_state curr_rx_state;
+ enum iod_rx_state next_rx_state;
+
/*
** work for each io device, when delayed work needed
** use this for private io device rx action
@@ -447,6 +511,9 @@ struct link_device {
/* SIPC version */
enum sipc_ver ipc_version;
+ /* Maximum IPC device = the last IPC device (e.g. IPC_RFS) + 1 */
+ int max_ipc_dev;
+
/* Modem data */
struct modem_data *mdm_data;
@@ -459,6 +526,12 @@ struct link_device {
/* Operation mode of the link device */
enum link_mode mode;
+ /* completion for waiting for link initialization */
+ struct completion init_cmpl;
+
+ /* completion for waiting for PIF initialization in a CP */
+ struct completion pif_cmpl;
+
struct io_device *fmt_iods[4];
/* TX queue of socket buffers */
@@ -468,13 +541,30 @@ struct link_device {
struct sk_buff_head *skb_txq[MAX_IPC_DEV];
+ /* RX queue of socket buffers */
+ struct sk_buff_head sk_fmt_rx_q;
+ struct sk_buff_head sk_raw_rx_q;
+ struct sk_buff_head sk_rfs_rx_q;
+
+ struct sk_buff_head *skb_rxq[MAX_IPC_DEV];
+
bool raw_tx_suspended; /* for misc dev */
struct completion raw_tx_resumed_by_cp;
+ /**
+ * This flag is for TX flow control on network interface.
+ * This must be set and clear only by a flow control command from CP.
+ */
+ bool suspend_netif_tx;
+
struct workqueue_struct *tx_wq;
struct work_struct tx_work;
struct delayed_work tx_delayed_work;
- struct delayed_work tx_dwork;
+
+ struct delayed_work *tx_dwork[MAX_IPC_DEV];
+ struct delayed_work fmt_tx_dwork;
+ struct delayed_work raw_tx_dwork;
+ struct delayed_work rfs_tx_dwork;
struct workqueue_struct *rx_wq;
struct work_struct rx_work;
@@ -495,20 +585,26 @@ struct link_device {
int (*send)(struct link_device *ld, struct io_device *iod,
struct sk_buff *skb);
- int (*udl_start)(struct link_device *ld, struct io_device *iod);
-
- int (*force_dump)(struct link_device *ld, struct io_device *iod);
-
- int (*dump_start)(struct link_device *ld, struct io_device *iod);
+ /* method for CP booting */
+ int (*xmit_boot)(struct link_device *ld, struct io_device *iod,
+ unsigned long arg);
- int (*modem_update)(struct link_device *ld, struct io_device *iod,
+ /* methods for CP firmware upgrade */
+ int (*dload_start)(struct link_device *ld, struct io_device *iod);
+ int (*firm_update)(struct link_device *ld, struct io_device *iod,
unsigned long arg);
+ /* methods for CP crash dump */
+ int (*force_dump)(struct link_device *ld, struct io_device *iod);
+ int (*dump_start)(struct link_device *ld, struct io_device *iod);
int (*dump_update)(struct link_device *ld, struct io_device *iod,
unsigned long arg);
+ int (*dump_finish)(struct link_device *ld, struct io_device *iod,
+ unsigned long arg);
+ /* IOCTL extension */
int (*ioctl)(struct link_device *ld, struct io_device *iod,
- unsigned cmd, unsigned long _arg);
+ unsigned cmd, unsigned long arg);
};
/** rx_alloc_skb - allocate an skbuff and set skb's iod, ld
@@ -567,6 +663,9 @@ struct modem_shared {
struct mif_storage storage;
spinlock_t lock;
+ /* CP crash information */
+ char cp_crash_info[530];
+
/* loopbacked IP address
* default is 0.0.0.0 (disabled)
* after you setted this, you can use IP packet loopback using this IP.
@@ -586,35 +685,52 @@ struct modem_ctl {
struct sim_state sim_state;
unsigned gpio_cp_on;
+ unsigned gpio_cp_off;
unsigned gpio_reset_req_n;
unsigned gpio_cp_reset;
+
+ /* for broadcasting AP's PM state (active or sleep) */
unsigned gpio_pda_active;
+
+ /* for checking aliveness of CP */
unsigned gpio_phone_active;
+ int irq_phone_active;
+
+ /* for AP-CP power management (PM) handshaking */
+ unsigned gpio_ap_wakeup;
+ int irq_ap_wakeup;
+ unsigned gpio_ap_status;
+ unsigned gpio_cp_wakeup;
+ unsigned gpio_cp_status;
+ int irq_cp_status;
+
+ /* for USB/HSIC PM */
+ unsigned gpio_host_wakeup;
+ int irq_host_wakeup;
+ unsigned gpio_host_active;
+ unsigned gpio_slave_wakeup;
+
+#ifdef CONFIG_EXYNOS4_CPUFREQ
+ /* cpu/bus frequency lock */
+ unsigned gpio_cpufreq_lock;
+ struct delayed_work work_cpu_lock;
+ struct delayed_work work_cpu_unlock;
+#endif
+
unsigned gpio_cp_dump_int;
unsigned gpio_ap_dump_int;
unsigned gpio_flm_uart_sel;
+ unsigned gpio_cp_warm_reset;
#if defined(CONFIG_MACH_M0_CTC)
unsigned gpio_flm_uart_sel_rev06;
#endif
- unsigned gpio_cp_warm_reset;
- unsigned gpio_cp_off;
- unsigned gpio_sim_detect;
- unsigned gpio_dynamic_switching;
- int irq_phone_active;
+ unsigned gpio_sim_detect;
int irq_sim_detect;
-#ifdef CONFIG_LTE_MODEM_CMC221
- const struct attribute_group *group;
- unsigned gpio_slave_wakeup;
- unsigned gpio_host_wakeup;
- unsigned gpio_host_active;
- int irq_host_wakeup;
-
- struct delayed_work dwork;
-#endif /*CONFIG_LTE_MODEM_CMC221*/
-
- struct work_struct work;
+#ifdef CONFIG_LINK_DEVICE_PLD
+ unsigned gpio_fpga_cs_n;
+#endif
#if defined(CONFIG_MACH_U1_KOR_LGT)
unsigned gpio_cp_reset_msm;
@@ -635,9 +751,13 @@ struct modem_ctl {
unsigned gpio_cp_ctrl2;
#endif
-#ifdef CONFIG_LINK_DEVICE_PLD
- unsigned gpio_fpga_cs_n;
-#endif
+ /* Switch with 2 links in a modem */
+ unsigned gpio_link_switch;
+
+ const struct attribute_group *group;
+
+ struct delayed_work dwork;
+ struct work_struct work;
struct modemctl_ops ops;
struct io_device *iod;
@@ -651,119 +771,45 @@ struct modem_ctl {
bool need_switch_to_usb;
bool sim_polarity;
+
+ bool sim_shutdown_req;
+ void (*modem_complete)(struct modem_ctl *mc);
};
int sipc4_init_io_device(struct io_device *iod);
int sipc5_init_io_device(struct io_device *iod);
-/**
- * sipc5_start_valid
- * @cfg: configuration field of an SIPC5 link frame
- *
- * Returns TRUE if the start (configuration field) of an SIPC5 link frame
- * is valid or returns FALSE if it is not valid.
- *
- */
-static inline int sipc5_start_valid(u8 cfg)
-{
- return (cfg & SIPC5_START_MASK) == SIPC5_START_MASK;
-}
-
-/**
- * sipc5_get_hdr_len
- * @cfg: configuration field of an SIPC5 link frame
- *
- * Returns the length of SIPC5 link layer header in an SIPC5 link frame
- *
- */
-static inline unsigned sipc5_get_hdr_len(u8 cfg)
-{
- if (cfg & SIPC5_EXT_FIELD_EXIST) {
- if (cfg & SIPC5_CTL_FIELD_EXIST)
- return SIPC5_HEADER_SIZE_WITH_CTL_FLD;
- else
- return SIPC5_HEADER_SIZE_WITH_EXT_LEN;
- } else {
- return SIPC5_MIN_HEADER_SIZE;
- }
-}
-
-/**
- * sipc5_get_ch_id
- * @frm: pointer to an SIPC5 frame
- *
- * Returns the channel ID in an SIPC5 link frame
- *
- */
-static inline u8 sipc5_get_ch_id(u8 *frm)
-{
- return *(frm + SIPC5_CH_ID_OFFSET);
-}
-
-/**
- * sipc5_get_frame_sz16
- * @frm: pointer to an SIPC5 link frame
- *
- * Returns the length of an SIPC5 link frame without the extended length field
- *
- */
-static inline unsigned sipc5_get_frame_sz16(u8 *frm)
-{
- return *((u16 *)(frm + SIPC5_LEN_OFFSET));
-}
-
-/**
- * sipc5_get_frame_sz32
- * @frm: pointer to an SIPC5 frame
- *
- * Returns the length of an SIPC5 link frame with the extended length field
- *
- */
-static inline unsigned sipc5_get_frame_sz32(u8 *frm)
-{
- return *((u32 *)(frm + SIPC5_LEN_OFFSET));
-}
-
-/**
- * sipc5_calc_padding_size
- * @len: length of an SIPC5 link frame
- *
- * Returns the padding size for an SIPC5 link frame
- *
- */
-static inline unsigned sipc5_calc_padding_size(unsigned len)
-{
- unsigned residue = len & 0x3;
- return residue ? (4 - residue) : 0;
-}
-
-extern void set_sromc_access(bool access);
+bool sipc5_start_valid(u8 *frm);
+bool sipc5_padding_exist(u8 *frm);
+bool sipc5_multi_frame(u8 *frm);
+bool sipc5_ext_len(u8 *frm);
+int sipc5_get_hdr_len(u8 *frm);
+u8 sipc5_get_ch_id(u8 *frm);
+u8 sipc5_get_ctrl_field(u8 *frm);
+int sipc5_get_frame_len(u8 *frm);
+int sipc5_calc_padding_size(int len);
+int sipc5_get_total_len(u8 *frm);
+
+u8 sipc5_build_config(struct io_device *iod, struct link_device *ld, u32 count);
+void sipc5_build_header(struct io_device *iod, struct link_device *ld,
+ u8 *buff, u8 cfg, u8 ctrl, u32 count);
#if defined(CONFIG_TDSCDMA_MODEM_SPRD8803) && defined(CONFIG_LINK_DEVICE_SPI)
extern int spi_sema_init(void);
extern int sprd_boot_done;
-struct ipc_spi {
- struct class *class;
- struct device *dev;
- struct cdev cdev;
- dev_t devid;
-
- wait_queue_head_t waitq;
- struct fasync_struct *async_queue;
- u32 mailbox;
-
- unsigned long base;
- unsigned long size;
- void __iomem *mmio;
+#endif
- int irq;
+#define STD_UDL_STEP_MASK 0x0000000F
+#define STD_UDL_SEND 0x1
+#define STD_UDL_CRC 0xC
- struct completion comp;
- atomic_t ref_sem;
- unsigned long flags;
+struct std_dload_info {
+ u32 size;
+ u32 mtu;
+ u32 num_frames;
+} __packed;
- const struct attribute_group *group;
-};
-#endif
+u32 std_udl_get_cmd(u8 *frm);
+bool std_udl_with_payload(u32 cmd);
#endif