132 lines
6.5 KiB
C
132 lines
6.5 KiB
C
|
#ifndef INV_SWPS_H
|
||
|
#define INV_SWPS_H
|
||
|
|
||
|
#include "transceiver.h"
|
||
|
#include "io_expander.h"
|
||
|
|
||
|
/* Module settings */
|
||
|
#define SWP_CLS_NAME "swps"
|
||
|
#define SWP_DEV_PORT "port"
|
||
|
#define SWP_AUTOCONFIG_ENABLE (1)
|
||
|
|
||
|
/* Module information */
|
||
|
#define SWP_AUTHOR "Neil <liao.neil@inventec.com>"
|
||
|
#define SWP_DESC "Inventec port and transceiver driver"
|
||
|
#define SWP_VERSION "4.2.3"
|
||
|
#define SWP_LICENSE "GPL"
|
||
|
|
||
|
/* Module status define */
|
||
|
#define SWP_STATE_NORMAL (0)
|
||
|
#define SWP_STATE_I2C_DIE (-91)
|
||
|
|
||
|
/* [Note]:
|
||
|
* Functions and mechanism for auto-detect platform type is ready,
|
||
|
* But HW and BIOS not ready! We need to wait them.
|
||
|
* So, please do not use PLATFORM_TYPE_AUTO until they are ready.
|
||
|
* (2016.06.13)
|
||
|
*/
|
||
|
#define PLATFORM_TYPE_REDWOOD (121)
|
||
|
/* Current running platfrom */
|
||
|
#define PLATFORM_SETTINGS PLATFORM_TYPE_REDWOOD
|
||
|
|
||
|
/* Define platform flag and kernel version */
|
||
|
#if (PLATFORM_SETTINGS == PLATFORM_TYPE_REDWOOD)
|
||
|
#define SWPS_KERN_VER_BF_3_8 (1)
|
||
|
#endif
|
||
|
|
||
|
struct inv_platform_s {
|
||
|
int id;
|
||
|
char name[64];
|
||
|
};
|
||
|
|
||
|
struct inv_ioexp_layout_s {
|
||
|
int ioexp_id;
|
||
|
int ioexp_type;
|
||
|
struct ioexp_addr_s addr[4];
|
||
|
};
|
||
|
|
||
|
struct inv_port_layout_s {
|
||
|
int port_id;
|
||
|
int chan_id;
|
||
|
int ioexp_id;
|
||
|
int ioexp_offset;
|
||
|
int transvr_type;
|
||
|
int chipset_type;
|
||
|
int lane_id[8];
|
||
|
};
|
||
|
|
||
|
/* ==========================================
|
||
|
* Inventec Platform Settings
|
||
|
* ==========================================
|
||
|
*/
|
||
|
struct inv_platform_s platform_map = {PLATFORM_TYPE_REDWOOD, "D7032Q28B" };
|
||
|
|
||
|
/* ==========================================
|
||
|
* Redwood Layout configuration
|
||
|
* ==========================================
|
||
|
*/
|
||
|
struct inv_ioexp_layout_s redwood_ioexp_layout[] = {
|
||
|
/* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */
|
||
|
{0, IOEXP_TYPE_REDWOOD_P01P08, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */
|
||
|
{4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */
|
||
|
{0, 0x25, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */
|
||
|
},
|
||
|
{1, IOEXP_TYPE_REDWOOD_P09P16, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */
|
||
|
{5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */
|
||
|
{0, 0x25, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */
|
||
|
},
|
||
|
{2, IOEXP_TYPE_REDWOOD_P01P08, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */
|
||
|
{2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */
|
||
|
{0, 0x24, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */
|
||
|
},
|
||
|
{3, IOEXP_TYPE_REDWOOD_P09P16, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */
|
||
|
{3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */
|
||
|
{0, 0x24, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */
|
||
|
},
|
||
|
};
|
||
|
|
||
|
struct inv_port_layout_s redwood_port_layout[] = {
|
||
|
/* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */
|
||
|
{ 0, 22, 0, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 1, 2, 3, 4} },
|
||
|
{ 1, 23, 0, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 5, 6, 7, 8} },
|
||
|
{ 2, 24, 0, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 9, 10, 11, 12} },
|
||
|
{ 3, 25, 0, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 13, 14, 15, 16} },
|
||
|
{ 4, 26, 0, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 17, 18, 19, 20} },
|
||
|
{ 5, 27, 0, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 21, 22, 23, 24} },
|
||
|
{ 6, 28, 0, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 25, 26, 27, 28} },
|
||
|
{ 7, 29, 0, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 29, 30, 31, 32} },
|
||
|
{ 8, 30, 1, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 33, 34, 35, 36} },
|
||
|
{ 9, 31, 1, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 37, 38, 39, 40} },
|
||
|
{10, 32, 1, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 41, 42, 43, 44} },
|
||
|
{11, 33, 1, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 45, 46, 47, 48} },
|
||
|
{12, 34, 1, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 49, 50, 51, 52} },
|
||
|
{13, 35, 1, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 53, 54, 55, 56} },
|
||
|
{14, 36, 1, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 57, 58, 59, 60} },
|
||
|
{15, 37, 1, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 61, 62, 63, 64} },
|
||
|
{16, 6, 2, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 65, 66, 67, 68} },
|
||
|
{17, 7, 2, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 69, 70, 71, 72} },
|
||
|
{18, 8, 2, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 73, 74, 75, 76} },
|
||
|
{19, 9, 2, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 77, 78, 79, 80} },
|
||
|
{20, 10, 2, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 81, 82, 83, 84} },
|
||
|
{21, 11, 2, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} },
|
||
|
{22, 12, 2, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 89, 90, 91, 92} },
|
||
|
{23, 13, 2, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 93, 94, 95, 96} },
|
||
|
{24, 14, 3, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99,100} },
|
||
|
{25, 15, 3, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101,102,103,104} },
|
||
|
{26, 16, 3, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105,106,107,108} },
|
||
|
{27, 17, 3, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109,110,111,112} },
|
||
|
{28, 18, 3, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {113,114,115,116} },
|
||
|
{29, 19, 3, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {117,118,119,120} },
|
||
|
{30, 20, 3, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {121,122,123,124} },
|
||
|
{31, 21, 3, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {125,126,127,128} },
|
||
|
};
|
||
|
|
||
|
#endif /* INV_SWPS_H */
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|