thunderbolt: Move nfc_credits field to struct tb_path_hop
[linux-2.6-microblaze.git] / drivers / thunderbolt / tb.h
index 9790e9f..b4bc25b 100644 (file)
@@ -20,6 +20,7 @@
 
 #define NVM_MIN_SIZE           SZ_32K
 #define NVM_MAX_SIZE           SZ_512K
+#define NVM_DATA_DWORDS                16
 
 /* Intel specific NVM offsets */
 #define NVM_DEVID              0x05
@@ -255,6 +256,8 @@ struct tb_retimer {
  * @next_hop_index: HopID of the packet when it is routed out from @out_port
  * @initial_credits: Number of initial flow control credits allocated for
  *                  the path
+ * @nfc_credits: Number of non-flow controlled buffers allocated for the
+ *              @in_port.
  *
  * Hop configuration is always done on the IN port of a switch.
  * in_port and out_port have to be on the same switch. Packets arriving on
@@ -274,6 +277,7 @@ struct tb_path_hop {
        int in_counter_index;
        int next_hop_index;
        unsigned int initial_credits;
+       unsigned int nfc_credits;
 };
 
 /**
@@ -296,7 +300,6 @@ enum tb_path_port {
  * struct tb_path - a unidirectional path between two ports
  * @tb: Pointer to the domain structure
  * @name: Name of the path (used for debugging)
- * @nfc_credits: Number of non flow controlled credits allocated for the path
  * @ingress_shared_buffer: Shared buffering used for ingress ports on the path
  * @egress_shared_buffer: Shared buffering used for egress ports on the path
  * @ingress_fc_enable: Flow control for ingress ports on the path
@@ -317,7 +320,6 @@ enum tb_path_port {
 struct tb_path {
        struct tb *tb;
        const char *name;
-       int nfc_credits;
        enum tb_path_port ingress_shared_buffer;
        enum tb_path_port egress_shared_buffer;
        enum tb_path_port ingress_fc_enable;
@@ -346,6 +348,7 @@ struct tb_path {
 #define TB_WAKE_ON_USB4                BIT(2)
 #define TB_WAKE_ON_USB3                BIT(3)
 #define TB_WAKE_ON_PCIE                BIT(4)
+#define TB_WAKE_ON_DP          BIT(5)
 
 /**
  * struct tb_cm_ops - Connection manager specific operations vector
@@ -674,6 +677,16 @@ int tb_nvm_add_non_active(struct tb_nvm *nvm, size_t size,
 void tb_nvm_free(struct tb_nvm *nvm);
 void tb_nvm_exit(void);
 
+typedef int (*read_block_fn)(void *, unsigned int, void *, size_t);
+typedef int (*write_block_fn)(void *, unsigned int, const void *, size_t);
+
+int tb_nvm_read_data(unsigned int address, void *buf, size_t size,
+                    unsigned int retries, read_block_fn read_block,
+                    void *read_block_data);
+int tb_nvm_write_data(unsigned int address, const void *buf, size_t size,
+                     unsigned int retries, write_block_fn write_next_block,
+                     void *write_block_data);
+
 struct tb_switch *tb_switch_alloc(struct tb *tb, struct device *parent,
                                  u64 route);
 struct tb_switch *tb_switch_alloc_safe_mode(struct tb *tb,