162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Marvell 88SE94xx hardware specific head file
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright 2007 Red Hat, Inc.
662306a36Sopenharmony_ci * Copyright 2008 Marvell. <kewei@marvell.com>
762306a36Sopenharmony_ci * Copyright 2009-2011 Marvell. <yuxiangl@marvell.com>
862306a36Sopenharmony_ci*/
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#ifndef _MVS94XX_REG_H_
1162306a36Sopenharmony_ci#define _MVS94XX_REG_H_
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#include <linux/types.h>
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#define MAX_LINK_RATE		SAS_LINK_RATE_6_0_GBPS
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_cienum VANIR_REVISION_ID {
1862306a36Sopenharmony_ci	VANIR_A0_REV		= 0xA0,
1962306a36Sopenharmony_ci	VANIR_B0_REV		= 0x01,
2062306a36Sopenharmony_ci	VANIR_C0_REV		= 0x02,
2162306a36Sopenharmony_ci	VANIR_C1_REV		= 0x03,
2262306a36Sopenharmony_ci	VANIR_C2_REV		= 0xC2,
2362306a36Sopenharmony_ci};
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_cienum host_registers {
2662306a36Sopenharmony_ci	MVS_HST_CHIP_CONFIG	= 0x10104,	/* chip configuration */
2762306a36Sopenharmony_ci};
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_cienum hw_registers {
3062306a36Sopenharmony_ci	MVS_GBL_CTL		= 0x04,  /* global control */
3162306a36Sopenharmony_ci	MVS_GBL_INT_STAT	= 0x00,  /* global irq status */
3262306a36Sopenharmony_ci	MVS_GBL_PI		= 0x0C,  /* ports implemented bitmask */
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci	MVS_PHY_CTL		= 0x40,  /* SOC PHY Control */
3562306a36Sopenharmony_ci	MVS_PORTS_IMP		= 0x9C,  /* SOC Port Implemented */
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci	MVS_GBL_PORT_TYPE	= 0xa0,  /* port type */
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci	MVS_CTL			= 0x100, /* SAS/SATA port configuration */
4062306a36Sopenharmony_ci	MVS_PCS			= 0x104, /* SAS/SATA port control/status */
4162306a36Sopenharmony_ci	MVS_CMD_LIST_LO		= 0x108, /* cmd list addr */
4262306a36Sopenharmony_ci	MVS_CMD_LIST_HI		= 0x10C,
4362306a36Sopenharmony_ci	MVS_RX_FIS_LO		= 0x110, /* RX FIS list addr */
4462306a36Sopenharmony_ci	MVS_RX_FIS_HI		= 0x114,
4562306a36Sopenharmony_ci	MVS_STP_REG_SET_0	= 0x118, /* STP/SATA Register Set Enable */
4662306a36Sopenharmony_ci	MVS_STP_REG_SET_1	= 0x11C,
4762306a36Sopenharmony_ci	MVS_TX_CFG		= 0x120, /* TX configuration */
4862306a36Sopenharmony_ci	MVS_TX_LO		= 0x124, /* TX (delivery) ring addr */
4962306a36Sopenharmony_ci	MVS_TX_HI		= 0x128,
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci	MVS_TX_PROD_IDX		= 0x12C, /* TX producer pointer */
5262306a36Sopenharmony_ci	MVS_TX_CONS_IDX		= 0x130, /* TX consumer pointer (RO) */
5362306a36Sopenharmony_ci	MVS_RX_CFG		= 0x134, /* RX configuration */
5462306a36Sopenharmony_ci	MVS_RX_LO		= 0x138, /* RX (completion) ring addr */
5562306a36Sopenharmony_ci	MVS_RX_HI		= 0x13C,
5662306a36Sopenharmony_ci	MVS_RX_CONS_IDX		= 0x140, /* RX consumer pointer (RO) */
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci	MVS_INT_COAL		= 0x148, /* Int coalescing config */
5962306a36Sopenharmony_ci	MVS_INT_COAL_TMOUT	= 0x14C, /* Int coalescing timeout */
6062306a36Sopenharmony_ci	MVS_INT_STAT		= 0x150, /* Central int status */
6162306a36Sopenharmony_ci	MVS_INT_MASK		= 0x154, /* Central int enable */
6262306a36Sopenharmony_ci	MVS_INT_STAT_SRS_0	= 0x158, /* SATA register set status */
6362306a36Sopenharmony_ci	MVS_INT_MASK_SRS_0	= 0x15C,
6462306a36Sopenharmony_ci	MVS_INT_STAT_SRS_1	= 0x160,
6562306a36Sopenharmony_ci	MVS_INT_MASK_SRS_1	= 0x164,
6662306a36Sopenharmony_ci	MVS_NON_NCQ_ERR_0	= 0x168, /* SRS Non-specific NCQ Error */
6762306a36Sopenharmony_ci	MVS_NON_NCQ_ERR_1	= 0x16C,
6862306a36Sopenharmony_ci	MVS_CMD_ADDR		= 0x170, /* Command register port (addr) */
6962306a36Sopenharmony_ci	MVS_CMD_DATA		= 0x174, /* Command register port (data) */
7062306a36Sopenharmony_ci	MVS_MEM_PARITY_ERR	= 0x178, /* Memory parity error */
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci					 /* ports 1-3 follow after this */
7362306a36Sopenharmony_ci	MVS_P0_INT_STAT		= 0x180, /* port0 interrupt status */
7462306a36Sopenharmony_ci	MVS_P0_INT_MASK		= 0x184, /* port0 interrupt mask */
7562306a36Sopenharmony_ci					 /* ports 5-7 follow after this */
7662306a36Sopenharmony_ci	MVS_P4_INT_STAT		= 0x1A0, /* Port4 interrupt status */
7762306a36Sopenharmony_ci	MVS_P4_INT_MASK		= 0x1A4, /* Port4 interrupt enable mask */
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci					 /* ports 1-3 follow after this */
8062306a36Sopenharmony_ci	MVS_P0_SER_CTLSTAT	= 0x1D0, /* port0 serial control/status */
8162306a36Sopenharmony_ci					 /* ports 5-7 follow after this */
8262306a36Sopenharmony_ci	MVS_P4_SER_CTLSTAT	= 0x1E0, /* port4 serial control/status */
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ci					 /* ports 1-3 follow after this */
8562306a36Sopenharmony_ci	MVS_P0_CFG_ADDR		= 0x200, /* port0 phy register address */
8662306a36Sopenharmony_ci	MVS_P0_CFG_DATA		= 0x204, /* port0 phy register data */
8762306a36Sopenharmony_ci					 /* ports 5-7 follow after this */
8862306a36Sopenharmony_ci	MVS_P4_CFG_ADDR		= 0x220, /* Port4 config address */
8962306a36Sopenharmony_ci	MVS_P4_CFG_DATA		= 0x224, /* Port4 config data */
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci					 /* phys 1-3 follow after this */
9262306a36Sopenharmony_ci	MVS_P0_VSR_ADDR		= 0x250, /* phy0 VSR address */
9362306a36Sopenharmony_ci	MVS_P0_VSR_DATA		= 0x254, /* phy0 VSR data */
9462306a36Sopenharmony_ci					 /* phys 1-3 follow after this */
9562306a36Sopenharmony_ci					 /* multiplexing */
9662306a36Sopenharmony_ci	MVS_P4_VSR_ADDR 	= 0x250, /* phy4 VSR address */
9762306a36Sopenharmony_ci	MVS_P4_VSR_DATA 	= 0x254, /* phy4 VSR data */
9862306a36Sopenharmony_ci	MVS_PA_VSR_ADDR		= 0x290, /* All port VSR addr */
9962306a36Sopenharmony_ci	MVS_PA_VSR_PORT		= 0x294, /* All port VSR data */
10062306a36Sopenharmony_ci	MVS_COMMAND_ACTIVE	= 0x300,
10162306a36Sopenharmony_ci};
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_cienum pci_cfg_registers {
10462306a36Sopenharmony_ci	PCR_PHY_CTL		= 0x40,
10562306a36Sopenharmony_ci	PCR_PHY_CTL2		= 0x90,
10662306a36Sopenharmony_ci	PCR_DEV_CTRL		= 0x78,
10762306a36Sopenharmony_ci	PCR_LINK_STAT		= 0x82,
10862306a36Sopenharmony_ci};
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ci/*  SAS/SATA Vendor Specific Port Registers */
11162306a36Sopenharmony_cienum sas_sata_vsp_regs {
11262306a36Sopenharmony_ci	VSR_PHY_STAT		= 0x00 * 4, /* Phy Interrupt Status */
11362306a36Sopenharmony_ci	VSR_PHY_MODE1		= 0x01 * 4, /* phy Interrupt Enable */
11462306a36Sopenharmony_ci	VSR_PHY_MODE2		= 0x02 * 4, /* Phy Configuration */
11562306a36Sopenharmony_ci	VSR_PHY_MODE3		= 0x03 * 4, /* Phy Status */
11662306a36Sopenharmony_ci	VSR_PHY_MODE4		= 0x04 * 4, /* Phy Counter 0 */
11762306a36Sopenharmony_ci	VSR_PHY_MODE5		= 0x05 * 4, /* Phy Counter 1 */
11862306a36Sopenharmony_ci	VSR_PHY_MODE6		= 0x06 * 4, /* Event Counter Control */
11962306a36Sopenharmony_ci	VSR_PHY_MODE7		= 0x07 * 4, /* Event Counter Select */
12062306a36Sopenharmony_ci	VSR_PHY_MODE8		= 0x08 * 4, /* Event Counter 0 */
12162306a36Sopenharmony_ci	VSR_PHY_MODE9		= 0x09 * 4, /* Event Counter 1 */
12262306a36Sopenharmony_ci	VSR_PHY_MODE10		= 0x0A * 4, /* Event Counter 2 */
12362306a36Sopenharmony_ci	VSR_PHY_MODE11		= 0x0B * 4, /* Event Counter 3 */
12462306a36Sopenharmony_ci	VSR_PHY_ACT_LED		= 0x0C * 4, /* Activity LED control */
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ci	VSR_PHY_FFE_CONTROL	= 0x10C,
12762306a36Sopenharmony_ci	VSR_PHY_DFE_UPDATE_CRTL	= 0x110,
12862306a36Sopenharmony_ci	VSR_REF_CLOCK_CRTL	= 0x1A0,
12962306a36Sopenharmony_ci};
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_cienum chip_register_bits {
13262306a36Sopenharmony_ci	PHY_MIN_SPP_PHYS_LINK_RATE_MASK = (0x7 << 8),
13362306a36Sopenharmony_ci	PHY_MAX_SPP_PHYS_LINK_RATE_MASK = (0x7 << 12),
13462306a36Sopenharmony_ci	PHY_NEG_SPP_PHYS_LINK_RATE_MASK_OFFSET = (16),
13562306a36Sopenharmony_ci	PHY_NEG_SPP_PHYS_LINK_RATE_MASK =
13662306a36Sopenharmony_ci			(0x3 << PHY_NEG_SPP_PHYS_LINK_RATE_MASK_OFFSET),
13762306a36Sopenharmony_ci};
13862306a36Sopenharmony_ci
13962306a36Sopenharmony_cienum pci_interrupt_cause {
14062306a36Sopenharmony_ci	/*  MAIN_IRQ_CAUSE (R10200) Bits*/
14162306a36Sopenharmony_ci	MVS_IRQ_COM_IN_I2O_IOP0        = (1 << 0),
14262306a36Sopenharmony_ci	MVS_IRQ_COM_IN_I2O_IOP1        = (1 << 1),
14362306a36Sopenharmony_ci	MVS_IRQ_COM_IN_I2O_IOP2        = (1 << 2),
14462306a36Sopenharmony_ci	MVS_IRQ_COM_IN_I2O_IOP3        = (1 << 3),
14562306a36Sopenharmony_ci	MVS_IRQ_COM_OUT_I2O_HOS0       = (1 << 4),
14662306a36Sopenharmony_ci	MVS_IRQ_COM_OUT_I2O_HOS1       = (1 << 5),
14762306a36Sopenharmony_ci	MVS_IRQ_COM_OUT_I2O_HOS2       = (1 << 6),
14862306a36Sopenharmony_ci	MVS_IRQ_COM_OUT_I2O_HOS3       = (1 << 7),
14962306a36Sopenharmony_ci	MVS_IRQ_PCIF_TO_CPU_DRBL0      = (1 << 8),
15062306a36Sopenharmony_ci	MVS_IRQ_PCIF_TO_CPU_DRBL1      = (1 << 9),
15162306a36Sopenharmony_ci	MVS_IRQ_PCIF_TO_CPU_DRBL2      = (1 << 10),
15262306a36Sopenharmony_ci	MVS_IRQ_PCIF_TO_CPU_DRBL3      = (1 << 11),
15362306a36Sopenharmony_ci	MVS_IRQ_PCIF_DRBL0             = (1 << 12),
15462306a36Sopenharmony_ci	MVS_IRQ_PCIF_DRBL1             = (1 << 13),
15562306a36Sopenharmony_ci	MVS_IRQ_PCIF_DRBL2             = (1 << 14),
15662306a36Sopenharmony_ci	MVS_IRQ_PCIF_DRBL3             = (1 << 15),
15762306a36Sopenharmony_ci	MVS_IRQ_XOR_A                  = (1 << 16),
15862306a36Sopenharmony_ci	MVS_IRQ_XOR_B                  = (1 << 17),
15962306a36Sopenharmony_ci	MVS_IRQ_SAS_A                  = (1 << 18),
16062306a36Sopenharmony_ci	MVS_IRQ_SAS_B                  = (1 << 19),
16162306a36Sopenharmony_ci	MVS_IRQ_CPU_CNTRL              = (1 << 20),
16262306a36Sopenharmony_ci	MVS_IRQ_GPIO                   = (1 << 21),
16362306a36Sopenharmony_ci	MVS_IRQ_UART                   = (1 << 22),
16462306a36Sopenharmony_ci	MVS_IRQ_SPI                    = (1 << 23),
16562306a36Sopenharmony_ci	MVS_IRQ_I2C                    = (1 << 24),
16662306a36Sopenharmony_ci	MVS_IRQ_SGPIO                  = (1 << 25),
16762306a36Sopenharmony_ci	MVS_IRQ_COM_ERR                = (1 << 29),
16862306a36Sopenharmony_ci	MVS_IRQ_I2O_ERR                = (1 << 30),
16962306a36Sopenharmony_ci	MVS_IRQ_PCIE_ERR               = (1 << 31),
17062306a36Sopenharmony_ci};
17162306a36Sopenharmony_ci
17262306a36Sopenharmony_ciunion reg_phy_cfg {
17362306a36Sopenharmony_ci	u32 v;
17462306a36Sopenharmony_ci	struct {
17562306a36Sopenharmony_ci		u32 phy_reset:1;
17662306a36Sopenharmony_ci		u32 sas_support:1;
17762306a36Sopenharmony_ci		u32 sata_support:1;
17862306a36Sopenharmony_ci		u32 sata_host_mode:1;
17962306a36Sopenharmony_ci		/*
18062306a36Sopenharmony_ci		 * bit 2: 6Gbps support
18162306a36Sopenharmony_ci		 * bit 1: 3Gbps support
18262306a36Sopenharmony_ci		 * bit 0: 1.5Gbps support
18362306a36Sopenharmony_ci		 */
18462306a36Sopenharmony_ci		u32 speed_support:3;
18562306a36Sopenharmony_ci		u32 snw_3_support:1;
18662306a36Sopenharmony_ci		u32 tx_lnk_parity:1;
18762306a36Sopenharmony_ci		/*
18862306a36Sopenharmony_ci		 * bit 5: G1 (1.5Gbps) Without SSC
18962306a36Sopenharmony_ci		 * bit 4: G1 (1.5Gbps) with SSC
19062306a36Sopenharmony_ci		 * bit 3: G2 (3.0Gbps) Without SSC
19162306a36Sopenharmony_ci		 * bit 2: G2 (3.0Gbps) with SSC
19262306a36Sopenharmony_ci		 * bit 1: G3 (6.0Gbps) without SSC
19362306a36Sopenharmony_ci		 * bit 0: G3 (6.0Gbps) with SSC
19462306a36Sopenharmony_ci		 */
19562306a36Sopenharmony_ci		u32 tx_spt_phs_lnk_rate:6;
19662306a36Sopenharmony_ci		/* 8h: 1.5Gbps 9h: 3Gbps Ah: 6Gbps */
19762306a36Sopenharmony_ci		u32 tx_lgcl_lnk_rate:4;
19862306a36Sopenharmony_ci		u32 tx_ssc_type:1;
19962306a36Sopenharmony_ci		u32 sata_spin_up_spt:1;
20062306a36Sopenharmony_ci		u32 sata_spin_up_en:1;
20162306a36Sopenharmony_ci		u32 bypass_oob:1;
20262306a36Sopenharmony_ci		u32 disable_phy:1;
20362306a36Sopenharmony_ci		u32 rsvd:8;
20462306a36Sopenharmony_ci	} u;
20562306a36Sopenharmony_ci};
20662306a36Sopenharmony_ci
20762306a36Sopenharmony_ci#define MAX_SG_ENTRY		255
20862306a36Sopenharmony_ci
20962306a36Sopenharmony_cistruct mvs_prd_imt {
21062306a36Sopenharmony_ci#ifndef __BIG_ENDIAN
21162306a36Sopenharmony_ci	__le32			len:22;
21262306a36Sopenharmony_ci	u8			_r_a:2;
21362306a36Sopenharmony_ci	u8			misc_ctl:4;
21462306a36Sopenharmony_ci	u8			inter_sel:4;
21562306a36Sopenharmony_ci#else
21662306a36Sopenharmony_ci	u32			inter_sel:4;
21762306a36Sopenharmony_ci	u32			misc_ctl:4;
21862306a36Sopenharmony_ci	u32			_r_a:2;
21962306a36Sopenharmony_ci	u32			len:22;
22062306a36Sopenharmony_ci#endif
22162306a36Sopenharmony_ci};
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_cistruct mvs_prd {
22462306a36Sopenharmony_ci	/* 64-bit buffer address */
22562306a36Sopenharmony_ci	__le64			addr;
22662306a36Sopenharmony_ci	/* 22-bit length */
22762306a36Sopenharmony_ci	__le32			im_len;
22862306a36Sopenharmony_ci} __attribute__ ((packed));
22962306a36Sopenharmony_ci
23062306a36Sopenharmony_cienum sgpio_registers {
23162306a36Sopenharmony_ci	MVS_SGPIO_HOST_OFFSET	= 0x100,	/* offset between hosts */
23262306a36Sopenharmony_ci
23362306a36Sopenharmony_ci	MVS_SGPIO_CFG0	= 0xc200,
23462306a36Sopenharmony_ci	MVS_SGPIO_CFG0_ENABLE	= (1 << 0),	/* enable pins */
23562306a36Sopenharmony_ci	MVS_SGPIO_CFG0_BLINKB	= (1 << 1),	/* blink generators */
23662306a36Sopenharmony_ci	MVS_SGPIO_CFG0_BLINKA	= (1 << 2),
23762306a36Sopenharmony_ci	MVS_SGPIO_CFG0_INVSCLK	= (1 << 3),	/* invert signal? */
23862306a36Sopenharmony_ci	MVS_SGPIO_CFG0_INVSLOAD	= (1 << 4),
23962306a36Sopenharmony_ci	MVS_SGPIO_CFG0_INVSDOUT	= (1 << 5),
24062306a36Sopenharmony_ci	MVS_SGPIO_CFG0_SLOAD_FALLEDGE = (1 << 6),	/* rise/fall edge? */
24162306a36Sopenharmony_ci	MVS_SGPIO_CFG0_SDOUT_FALLEDGE = (1 << 7),
24262306a36Sopenharmony_ci	MVS_SGPIO_CFG0_SDIN_RISEEDGE = (1 << 8),
24362306a36Sopenharmony_ci	MVS_SGPIO_CFG0_MAN_BITLEN_SHIFT = 18,	/* bits/frame manual mode */
24462306a36Sopenharmony_ci	MVS_SGPIO_CFG0_AUT_BITLEN_SHIFT = 24,	/* bits/frame auto mode */
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ci	MVS_SGPIO_CFG1	= 0xc204,	/* blink timing register */
24762306a36Sopenharmony_ci	MVS_SGPIO_CFG1_LOWA_SHIFT	= 0,	/* A off time */
24862306a36Sopenharmony_ci	MVS_SGPIO_CFG1_HIA_SHIFT	= 4,	/* A on time */
24962306a36Sopenharmony_ci	MVS_SGPIO_CFG1_LOWB_SHIFT	= 8,	/* B off time */
25062306a36Sopenharmony_ci	MVS_SGPIO_CFG1_HIB_SHIFT	= 12,	/* B on time */
25162306a36Sopenharmony_ci	MVS_SGPIO_CFG1_MAXACTON_SHIFT	= 16,	/* max activity on time */
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_ci		/* force activity off time */
25462306a36Sopenharmony_ci	MVS_SGPIO_CFG1_FORCEACTOFF_SHIFT	= 20,
25562306a36Sopenharmony_ci		/* stretch activity on time */
25662306a36Sopenharmony_ci	MVS_SGPIO_CFG1_STRCHACTON_SHIFT	= 24,
25762306a36Sopenharmony_ci		/* stretch activiity off time */
25862306a36Sopenharmony_ci	MVS_SGPIO_CFG1_STRCHACTOFF_SHIFT	= 28,
25962306a36Sopenharmony_ci
26062306a36Sopenharmony_ci
26162306a36Sopenharmony_ci	MVS_SGPIO_CFG2	= 0xc208,	/* clock speed register */
26262306a36Sopenharmony_ci	MVS_SGPIO_CFG2_CLK_SHIFT	= 0,
26362306a36Sopenharmony_ci	MVS_SGPIO_CFG2_BLINK_SHIFT	= 20,
26462306a36Sopenharmony_ci
26562306a36Sopenharmony_ci	MVS_SGPIO_CTRL	= 0xc20c,	/* SDOUT/SDIN mode control */
26662306a36Sopenharmony_ci	MVS_SGPIO_CTRL_SDOUT_AUTO	= 2,
26762306a36Sopenharmony_ci	MVS_SGPIO_CTRL_SDOUT_SHIFT	= 2,
26862306a36Sopenharmony_ci
26962306a36Sopenharmony_ci	MVS_SGPIO_DSRC	= 0xc220,	/* map ODn bits to drives */
27062306a36Sopenharmony_ci
27162306a36Sopenharmony_ci	MVS_SGPIO_DCTRL	= 0xc238,
27262306a36Sopenharmony_ci	MVS_SGPIO_DCTRL_ERR_SHIFT	= 0,
27362306a36Sopenharmony_ci	MVS_SGPIO_DCTRL_LOC_SHIFT	= 3,
27462306a36Sopenharmony_ci	MVS_SGPIO_DCTRL_ACT_SHIFT	= 5,
27562306a36Sopenharmony_ci};
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_cienum sgpio_led_status {
27862306a36Sopenharmony_ci	LED_OFF	= 0,
27962306a36Sopenharmony_ci	LED_ON	= 1,
28062306a36Sopenharmony_ci	LED_BLINKA	= 2,
28162306a36Sopenharmony_ci	LED_BLINKA_INV	= 3,
28262306a36Sopenharmony_ci	LED_BLINKA_SOF	= 4,
28362306a36Sopenharmony_ci	LED_BLINKA_EOF	= 5,
28462306a36Sopenharmony_ci	LED_BLINKB	= 6,
28562306a36Sopenharmony_ci	LED_BLINKB_INV	= 7,
28662306a36Sopenharmony_ci};
28762306a36Sopenharmony_ci
28862306a36Sopenharmony_ci#define DEFAULT_SGPIO_BITS ((LED_BLINKA_SOF << \
28962306a36Sopenharmony_ci				MVS_SGPIO_DCTRL_ACT_SHIFT) << (8 * 3) | \
29062306a36Sopenharmony_ci			(LED_BLINKA_SOF << \
29162306a36Sopenharmony_ci				MVS_SGPIO_DCTRL_ACT_SHIFT) << (8 * 2) | \
29262306a36Sopenharmony_ci			(LED_BLINKA_SOF << \
29362306a36Sopenharmony_ci				MVS_SGPIO_DCTRL_ACT_SHIFT) << (8 * 1) | \
29462306a36Sopenharmony_ci			(LED_BLINKA_SOF << \
29562306a36Sopenharmony_ci				MVS_SGPIO_DCTRL_ACT_SHIFT) << (8 * 0))
29662306a36Sopenharmony_ci
29762306a36Sopenharmony_ci/*
29862306a36Sopenharmony_ci * these registers are accessed through port vendor
29962306a36Sopenharmony_ci * specific address/data registers
30062306a36Sopenharmony_ci */
30162306a36Sopenharmony_cienum sas_sata_phy_regs {
30262306a36Sopenharmony_ci	GENERATION_1_SETTING		= 0x118,
30362306a36Sopenharmony_ci	GENERATION_1_2_SETTING		= 0x11C,
30462306a36Sopenharmony_ci	GENERATION_2_3_SETTING		= 0x120,
30562306a36Sopenharmony_ci	GENERATION_3_4_SETTING		= 0x124,
30662306a36Sopenharmony_ci};
30762306a36Sopenharmony_ci
30862306a36Sopenharmony_ci#define SPI_CTRL_REG_94XX           	0xc800
30962306a36Sopenharmony_ci#define SPI_ADDR_REG_94XX            	0xc804
31062306a36Sopenharmony_ci#define SPI_WR_DATA_REG_94XX         0xc808
31162306a36Sopenharmony_ci#define SPI_RD_DATA_REG_94XX         	0xc80c
31262306a36Sopenharmony_ci#define SPI_CTRL_READ_94XX         	(1U << 2)
31362306a36Sopenharmony_ci#define SPI_ADDR_VLD_94XX         	(1U << 1)
31462306a36Sopenharmony_ci#define SPI_CTRL_SpiStart_94XX     	(1U << 0)
31562306a36Sopenharmony_ci
31662306a36Sopenharmony_cistatic inline int
31762306a36Sopenharmony_cimv_ffc64(u64 v)
31862306a36Sopenharmony_ci{
31962306a36Sopenharmony_ci	u64 x = ~v;
32062306a36Sopenharmony_ci	return x ? __ffs64(x) : -1;
32162306a36Sopenharmony_ci}
32262306a36Sopenharmony_ci
32362306a36Sopenharmony_ci#define r_reg_set_enable(i) \
32462306a36Sopenharmony_ci	(((i) > 31) ? mr32(MVS_STP_REG_SET_1) : \
32562306a36Sopenharmony_ci	mr32(MVS_STP_REG_SET_0))
32662306a36Sopenharmony_ci
32762306a36Sopenharmony_ci#define w_reg_set_enable(i, tmp) \
32862306a36Sopenharmony_ci	(((i) > 31) ? mw32(MVS_STP_REG_SET_1, tmp) : \
32962306a36Sopenharmony_ci	mw32(MVS_STP_REG_SET_0, tmp))
33062306a36Sopenharmony_ci
33162306a36Sopenharmony_ciextern const struct mvs_dispatch mvs_94xx_dispatch;
33262306a36Sopenharmony_ci#endif
33362306a36Sopenharmony_ci
334