Add Broadcom / Netgear changes from RAXE 1.0.0.48
[project/bcm63xx/u-boot.git] / drivers / net / bcmbca / lport / lport_intr.h
diff --git a/drivers/net/bcmbca/lport/lport_intr.h b/drivers/net/bcmbca/lport/lport_intr.h
new file mode 100644 (file)
index 0000000..d6bf12b
--- /dev/null
@@ -0,0 +1,66 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+   Copyright (c) 2015 Broadcom Corporation
+   All Rights Reserved
+
+    
+*/
+/*
+ *  lport_intr.h
+ *
+ *  LPORT interrupt layer
+ * 
+ *  Created on: Dec 2015
+ *  Author: Kosta Sopov kosta@broadcom.com
+ */
+
+#ifndef SHARED_OPENSOURCE_DRV_LPORT_LPORT_INT_H_
+#define SHARED_OPENSOURCE_DRV_LPORT_LPORT_INT_H_
+
+typedef enum 
+{
+    LPORT_MDIO_DONE,
+    LPORT_MDIO_READ_ERROR,
+    LPORT_PORT_LINK,
+    LPORT_REMOTE_FAULT,
+    LPORT_TIMESYNC_FIFO,
+    LPORT_INTR_LAST
+} LPORT_INTR_ID;
+
+typedef struct 
+{
+    int intr_id;
+
+    /* Entity Id:
+        PORT(0-7), SERDES(0-3), QGPHY(0-3) or XMLAC(0-1), 
+        depends on intr_id that was requested
+    */
+    uint32_t entity_id; 
+
+    /* Status: 
+        LPORT_PORT_LINK: 0 - link off, 1 - link on
+        LPORT_SERDER_SIGNAL: 0 - signal off, 1 - signal on
+        LPORT_QGPHY_ENERGY: 0 - no energy detected, 1 - energy detected
+        LPORT_XLMAC: event as described in XLMAC_INTR_STATUS in XLMAC spec
+        LPORT_UBUS_ERROR, LPORT_MDIO_DONE, LPORT_MDIO_READ_ERROR: ignore, always 0
+    */
+    int status;
+} lport_intr_info_s;
+
+typedef void(*lport_intr_cb_t)(const lport_intr_info_s *info, void *priv);
+
+int lport_intr_init(void);
+
+/* Note: interrupt must be enabled using lport_intr_enable in order to start getting interrupts */
+int lport_intr_register(LPORT_INTR_ID intr_id, uint32_t entity_id, lport_intr_cb_t cb, void *priv);
+
+void lport_intr_unregister(LPORT_INTR_ID intr_id, uint32_t entity_id);
+void lport_intr_enable(LPORT_INTR_ID intr_id, uint32_t entity_id, int enable);
+void lport_intr_clear(LPORT_INTR_ID intr_id, uint32_t entity_id);
+
+#define lport_mdio_intr_register(intr_id, cb, cb_priv) lport_intr_register(intr_id, 0, cb, cb_priv)
+#define lport_mdio_intr_unregister(intr_id) lport_intr_unregister(intr_id, 0)
+#define lport_mdio_intr_enable(intr_id,enable) lport_intr_enable(intr_id, 0, enable)
+#define lport_mdio_intr_clear(intr_id) lport_intr_clear(intr_id, 0)
+
+#endif