Merge tag 'mips-pull-2018-11-30' of git://git.denx.de/u-boot-mips
[oweals/u-boot.git] / arch / arm / mach-mvebu / serdes / a38x / ctrl_pex.h
index 50327595fcce25be554332e4b08924beeb157d46..3f30b6bf972e1551c0afaac42c617fcfa120402f 100644 (file)
@@ -1,7 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Copyright (C) Marvell International Ltd. and its affiliates
- *
- * SPDX-License-Identifier:    GPL-2.0
  */
 
 #ifndef _CTRL_PEX_H
 #define MV_MISC_REGS_BASE              MISC_REGS_OFFSET
 #define SOC_CTRL_REG                   (MV_MISC_REGS_BASE + 0x4)
 
+#define PEX_IF_REGS_OFFSET(if)         ((if) > 0 ?                     \
+                                        (0x40000 + ((if) - 1) * 0x4000) : \
+                                        0x80000)
+#define PEX_IF_REGS_BASE(if)           (PEX_IF_REGS_OFFSET(if))
 #define PEX_CAPABILITIES_REG(if)       ((PEX_IF_REGS_BASE(if)) + 0x60)
 #define PEX_LINK_CTRL_STATUS2_REG(if)  ((PEX_IF_REGS_BASE(if)) + 0x90)
 #define PEX_CTRL_REG(if)               ((PEX_IF_REGS_BASE(if)) + 0x1a00)
@@ -43,6 +46,7 @@
 
 /* Controller revision info */
 #define PEX_DEVICE_AND_VENDOR_ID       0x000
+#define PEX_CFG_DIRECT_ACCESS(if, reg) (PEX_IF_REGS_BASE(if) + (reg))
 
 /* PCI Express Configuration Address Register */
 #define PXCAR_REG_NUM_OFFS             2
 #define PEX_STATUS_AND_COMMAND         0x004
 #define PXSAC_MABORT                   BIT(29) /* Recieved Master Abort */
 
-int hws_pex_config(struct serdes_map *serdes_map);
+int hws_pex_config(const struct serdes_map *serdes_map, u8 count);
 int pex_local_bus_num_set(u32 pex_if, u32 bus_num);
 int pex_local_dev_num_set(u32 pex_if, u32 dev_num);
 u32 pex_config_read(u32 pex_if, u32 bus, u32 dev, u32 func, u32 reg_off);
 
+void board_pex_config(void);
+
 #endif