summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/qualcomm/qca_7k_common.h
diff options
context:
space:
mode:
authorStefan Wahren <stefan.wahren@i2se.com>2017-05-29 13:57:19 +0200
committerDavid S. Miller <davem@davemloft.net>2017-05-30 13:57:30 -0400
commit60d6702464b9d667312035eb3bd9d390af9626dd (patch)
tree83741bcd9a1371592442a2bb5ee3afe0079425a7 /drivers/net/ethernet/qualcomm/qca_7k_common.h
parentf1789286e0200f6a40fc20b05ee0e5e62d044a9e (diff)
downloadlinux-60d6702464b9d667312035eb3bd9d390af9626dd.tar.bz2
net: qualcomm: prepare frame decoding for UART driver
Unfortunately the frame format is not exactly identical between SPI and UART. In case of SPI there is an additional HW length at the beginning. So store the initial state to make the decoding state machine more flexible and easy to extend for UART support. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/qualcomm/qca_7k_common.h')
-rw-r--r--drivers/net/ethernet/qualcomm/qca_7k_common.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/ethernet/qualcomm/qca_7k_common.h b/drivers/net/ethernet/qualcomm/qca_7k_common.h
index 5df7c65d887c..07bdd6c4f728 100644
--- a/drivers/net/ethernet/qualcomm/qca_7k_common.h
+++ b/drivers/net/ethernet/qualcomm/qca_7k_common.h
@@ -61,6 +61,7 @@
#define QCAFRM_ERR_BASE -1000
enum qcafrm_state {
+ /* HW length is only available on SPI */
QCAFRM_HW_LEN0 = 0x8000,
QCAFRM_HW_LEN1 = QCAFRM_HW_LEN0 - 1,
QCAFRM_HW_LEN2 = QCAFRM_HW_LEN1 - 1,
@@ -101,6 +102,8 @@ enum qcafrm_state {
struct qcafrm_handle {
/* Current decoding state */
enum qcafrm_state state;
+ /* Initial state depends on connection type */
+ enum qcafrm_state init;
/* Offset in buffer (borrowed for length too) */
u16 offset;
@@ -113,9 +116,10 @@ u16 qcafrm_create_header(u8 *buf, u16 len);
u16 qcafrm_create_footer(u8 *buf);
-static inline void qcafrm_fsm_init(struct qcafrm_handle *handle)
+static inline void qcafrm_fsm_init_spi(struct qcafrm_handle *handle)
{
- handle->state = QCAFRM_HW_LEN0;
+ handle->init = QCAFRM_HW_LEN0;
+ handle->state = handle->init;
}
/* Gather received bytes and try to extract a full Ethernet frame