fsi: Move various master definitions to a common header
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Sun, 10 Jun 2018 06:25:25 +0000 (16:25 +1000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 12 Jul 2018 02:06:02 +0000 (12:06 +1000)
This moves the definitions for various protocol details
(message & response codes, delays etc...) out of
fsi-master-gpio.c to fsi-master.h in order to share them
with other master implementations.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Joel Stanley <joel@jms.id.au>
drivers/fsi/fsi-master-gpio.c
drivers/fsi/fsi-master.h

index c4a06210ddce549e0b6156a2e520c970ec5cbbab..4eb3a766fd4a1fafeb8b55718ddd545a17845322 100644 (file)
 #include "fsi-master.h"
 
 #define        FSI_GPIO_STD_DLY        1       /* Standard pin delay in nS */
-#define        FSI_ECHO_DELAY_CLOCKS   16      /* Number clocks for echo delay */
-#define        FSI_SEND_DELAY_CLOCKS   16      /* Number clocks for send delay */
-#define        FSI_PRE_BREAK_CLOCKS    50      /* Number clocks to prep for break */
-#define        FSI_BREAK_CLOCKS        256     /* Number of clocks to issue break */
-#define        FSI_POST_BREAK_CLOCKS   16000   /* Number clocks to set up cfam */
-#define        FSI_INIT_CLOCKS         5000    /* Clock out any old data */
-#define        FSI_MASTER_DPOLL_CLOCKS 50      /* < 21 will cause slave to hang */
-#define        FSI_MASTER_EPOLL_CLOCKS 50      /* Number of clocks for E_POLL retry */
-
-#define FSI_CRC_ERR_RETRIES    10
-
-#define        FSI_CMD_DPOLL           0x2
-#define        FSI_CMD_EPOLL           0x3
-#define        FSI_CMD_TERM            0x3f
-#define FSI_CMD_ABS_AR         0x4
-#define FSI_CMD_REL_AR         0x5
-#define FSI_CMD_SAME_AR                0x3     /* but only a 2-bit opcode... */
-
-/* Slave responses */
-#define        FSI_RESP_ACK            0       /* Success */
-#define        FSI_RESP_BUSY           1       /* Slave busy */
-#define        FSI_RESP_ERRA           2       /* Any (misc) Error */
-#define        FSI_RESP_ERRC           3       /* Slave reports master CRC error */
-
-#define        FSI_MASTER_MAX_BUSY     200
-
-#define        FSI_MASTER_MTOE_COUNT   1000
-#define        FSI_CRC_SIZE            4
-
 #define LAST_ADDR_INVALID              0x1
 
 struct fsi_master_gpio {
index 7d619c68ab9b59e307e0f3897ff8d615983668b1..f653f75da7be175d1115317dfd31a398b6090f58 100644 (file)
 
 #include <linux/device.h>
 
+/* Various protocol delays */
+#define        FSI_ECHO_DELAY_CLOCKS   16      /* Number clocks for echo delay */
+#define        FSI_SEND_DELAY_CLOCKS   16      /* Number clocks for send delay */
+#define        FSI_PRE_BREAK_CLOCKS    50      /* Number clocks to prep for break */
+#define        FSI_BREAK_CLOCKS        256     /* Number of clocks to issue break */
+#define        FSI_POST_BREAK_CLOCKS   16000   /* Number clocks to set up cfam */
+#define        FSI_INIT_CLOCKS         5000    /* Clock out any old data */
+#define        FSI_MASTER_DPOLL_CLOCKS 50      /* < 21 will cause slave to hang */
+#define        FSI_MASTER_EPOLL_CLOCKS 50      /* Number of clocks for E_POLL retry */
+
+/* Various retry maximums */
+#define FSI_CRC_ERR_RETRIES    10
+#define        FSI_MASTER_MAX_BUSY     200
+#define        FSI_MASTER_MTOE_COUNT   1000
+
+/* Command encodings */
+#define        FSI_CMD_DPOLL           0x2
+#define        FSI_CMD_EPOLL           0x3
+#define        FSI_CMD_TERM            0x3f
+#define FSI_CMD_ABS_AR         0x4
+#define FSI_CMD_REL_AR         0x5
+#define FSI_CMD_SAME_AR                0x3     /* but only a 2-bit opcode... */
+
+/* Slave responses */
+#define        FSI_RESP_ACK            0       /* Success */
+#define        FSI_RESP_BUSY           1       /* Slave busy */
+#define        FSI_RESP_ERRA           2       /* Any (misc) Error */
+#define        FSI_RESP_ERRC           3       /* Slave reports master CRC error */
+
+/* Misc */
+#define        FSI_CRC_SIZE            4
+
+/* fsi-master definition and flags */
 #define FSI_MASTER_FLAG_SWCLOCK                0x1
 
 struct fsi_master {