linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] MIPS: Xtalk: Updates/clean-ups
@ 2017-02-07  5:57 Joshua Kinard
  2017-02-07  5:57 ` [PATCH 1/3] MIPS: Xtalk: Replace several IRIX-era typedefs Joshua Kinard
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Joshua Kinard @ 2017-02-07  5:57 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Linux/MIPS

From: Joshua Kinard <kumba@gentoo.org>

This series performs a number of clean-ups on the Crosstalk (Xtalk)
code in the kernel.  Notable changes include:

- Remove IRIX-era typedefs and replace with standard types.
- Clean-up a few hex mask values and add whitespace to a few macros.
- Rewrite and document Xtalk access structures.
- Add platform data hooks to be used later in IP27 and IP30.

Joshua Kinard (3):
  MIPS: Xtalk: Replace several IRIX-era typedefs
  MIPS: Xtalk: Clean-up xtalk.h macros
  MIPS: Xtalk: Rewrite access structs in xwidget.h

 arch/mips/include/asm/sn/hub.h        |   4 +-
 arch/mips/include/asm/xtalk/xtalk.h   |  43 +---
 arch/mips/include/asm/xtalk/xwidget.h | 310 ++++++++++++++++++++----
 arch/mips/sgi-ip27/ip27-hubio.c       |   2 +-
 arch/mips/sgi-ip27/ip27-xtalk.c       |   4 +-
 5 files changed, 278 insertions(+), 85 deletions(-)

-- 
2.11.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] MIPS: Xtalk: Replace several IRIX-era typedefs
  2017-02-07  5:57 [PATCH 0/3] MIPS: Xtalk: Updates/clean-ups Joshua Kinard
@ 2017-02-07  5:57 ` Joshua Kinard
  2017-02-07  5:57 ` [PATCH 2/3] MIPS: Xtalk: Clean-up xtalk.h macros Joshua Kinard
  2017-02-07  5:57 ` [PATCH 3/3] MIPS: Xtalk: Rewrite access structs in xwidget.h Joshua Kinard
  2 siblings, 0 replies; 6+ messages in thread
From: Joshua Kinard @ 2017-02-07  5:57 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Linux/MIPS

From: Joshua Kinard <kumba@gentoo.org>

The following IRIX-era typedefs are replaced with standard types:
 - xwidgetnum_t       --> s8
 - xwidget_part_num_t --> s32
 - xwidget_rev_num_t  --> s32
 - xwidget_mfg_num_t  --> s32

Remove the following typedefs:
 - xtalk_piomap_t (unsued anywhere)

Other fixes made as detected by checkpatch.

Signed-off-by: Joshua Kinard <kumba@gentoo.org>
---
 arch/mips/include/asm/sn/hub.h        |  4 ++--
 arch/mips/include/asm/xtalk/xtalk.h   | 22 +++----------------
 arch/mips/include/asm/xtalk/xwidget.h | 28 ++++++++++++-------------
 arch/mips/sgi-ip27/ip27-hubio.c       |  2 +-
 arch/mips/sgi-ip27/ip27-xtalk.c       |  4 ++--
 5 files changed, 22 insertions(+), 38 deletions(-)

diff --git a/arch/mips/include/asm/sn/hub.h b/arch/mips/include/asm/sn/hub.h
index 1992d9254a08..41166e4f3e8b 100644
--- a/arch/mips/include/asm/sn/hub.h
+++ b/arch/mips/include/asm/sn/hub.h
@@ -9,8 +9,8 @@
 #include <asm/xtalk/xtalk.h>
 
 /* ip27-hubio.c */
-extern unsigned long hub_pio_map(cnodeid_t cnode, xwidgetnum_t widget,
-			  unsigned long xtalk_addr, size_t size);
+extern unsigned long hub_pio_map(cnodeid_t cnode, s8 widget,
+				 unsigned long xtalk_addr, size_t size);
 extern void hub_pio_init(cnodeid_t cnode);
 
 #endif /* __ASM_SN_HUB_H */
diff --git a/arch/mips/include/asm/xtalk/xtalk.h b/arch/mips/include/asm/xtalk/xtalk.h
index 26d2ed1fa917..9125bd85514d 100644
--- a/arch/mips/include/asm/xtalk/xtalk.h
+++ b/arch/mips/include/asm/xtalk/xtalk.h
@@ -13,30 +13,14 @@
 #define _ASM_XTALK_XTALK_H
 
 #ifndef __ASSEMBLY__
-/*
- * User-level device driver visible types
- */
-typedef char		xwidgetnum_t;	/* xtalk widget number	(0..15) */
 
+/* Xtalk "none" values. */
 #define XWIDGET_NONE		-1
-
-typedef int xwidget_part_num_t; /* xtalk widget part number */
-
 #define XWIDGET_PART_NUM_NONE	-1
-
-typedef int		xwidget_rev_num_t;	/* xtalk widget revision number */
-
 #define XWIDGET_REV_NUM_NONE	-1
-
-typedef int xwidget_mfg_num_t;	/* xtalk widget manufacturing ID */
-
 #define XWIDGET_MFG_NUM_NONE	-1
 
-typedef struct xtalk_piomap_s *xtalk_piomap_t;
-
-/* It is often convenient to fold the XIO target port
- * number into the XIO address.
- */
+/* It is often convenient to fold the XIO target port */
 #define XIO_NOWHERE	(0xFFFFFFFFFFFFFFFFull)
 #define XIO_ADDR_BITS	(0x0000FFFFFFFFFFFFull)
 #define XIO_PORT_BITS	(0xF000000000000000ull)
@@ -44,7 +28,7 @@ typedef struct xtalk_piomap_s *xtalk_piomap_t;
 
 #define XIO_PACKED(x)	(((x)&XIO_PORT_BITS) != 0)
 #define XIO_ADDR(x)	((x)&XIO_ADDR_BITS)
-#define XIO_PORT(x)	((xwidgetnum_t)(((x)&XIO_PORT_BITS) >> XIO_PORT_SHIFT))
+#define XIO_PORT(x)	((s8)(((x)&XIO_PORT_BITS) >> XIO_PORT_SHIFT))
 #define XIO_PACK(p, o)	((((uint64_t)(p))<<XIO_PORT_SHIFT) | ((o)&XIO_ADDR_BITS))
 
 #ifdef CONFIG_PCI
diff --git a/arch/mips/include/asm/xtalk/xwidget.h b/arch/mips/include/asm/xtalk/xwidget.h
index 24f121da6a1d..9f71148f9ff4 100644
--- a/arch/mips/include/asm/xtalk/xwidget.h
+++ b/arch/mips/include/asm/xtalk/xwidget.h
@@ -233,17 +233,17 @@ typedef volatile struct widget_cfg {
 } widget_cfg_t;
 
 typedef struct {
-	unsigned	didn:4;
-	unsigned	sidn:4;
-	unsigned	pactyp:4;
-	unsigned	tnum:5;
-	unsigned	ct:1;
-	unsigned	ds:2;
-	unsigned	gbr:1;
-	unsigned	vbpm:1;
-	unsigned	error:1;
-	unsigned	bo:1;
-	unsigned	other:8;
+	unsigned int	didn:4;
+	unsigned int	sidn:4;
+	unsigned int	pactyp:4;
+	unsigned int	tnum:5;
+	unsigned int	ct:1;
+	unsigned int	ds:2;
+	unsigned int	gbr:1;
+	unsigned int	vbpm:1;
+	unsigned int	error:1;
+	unsigned int	bo:1;
+	unsigned int	other:8;
 } w_err_cmd_word_f;
 
 typedef union {
@@ -257,9 +257,9 @@ typedef struct xwidget_info_s *xwidget_info_t;
  * Crosstalk Widget Hardware Identification, as defined in the Crosstalk spec.
  */
 typedef struct xwidget_hwid_s {
-	xwidget_part_num_t	part_num;
-	xwidget_rev_num_t	rev_num;
-	xwidget_mfg_num_t	mfg_num;
+	s32	part_num;
+	s32	rev_num;
+	s32	mfg_num;
 } *xwidget_hwid_t;
 
 
diff --git a/arch/mips/sgi-ip27/ip27-hubio.c b/arch/mips/sgi-ip27/ip27-hubio.c
index 2abe016a0ffc..36485dcf7af0 100644
--- a/arch/mips/sgi-ip27/ip27-hubio.c
+++ b/arch/mips/sgi-ip27/ip27-hubio.c
@@ -25,7 +25,7 @@ static int force_fire_and_forget = 1;
  * @size:	size of the PIO mapping
  *
  **/
-unsigned long hub_pio_map(cnodeid_t cnode, xwidgetnum_t widget,
+unsigned long hub_pio_map(cnodeid_t cnode, s8 widget,
 			  unsigned long xtalk_addr, size_t size)
 {
 	nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode);
diff --git a/arch/mips/sgi-ip27/ip27-xtalk.c b/arch/mips/sgi-ip27/ip27-xtalk.c
index 4fe5678ba74d..cd522a45a781 100644
--- a/arch/mips/sgi-ip27/ip27-xtalk.c
+++ b/arch/mips/sgi-ip27/ip27-xtalk.c
@@ -25,7 +25,7 @@ extern int bridge_probe(nasid_t nasid, int widget, int masterwid);
 static int probe_one_port(nasid_t nasid, int widget, int masterwid)
 {
 	widgetreg_t		widget_id;
-	xwidget_part_num_t	partnum;
+	s32			partnum;
 
 	widget_id = *(volatile widgetreg_t *)
 		(RAW_NODE_SWIN_BASE(nasid, widget) + WIDGET_ID);
@@ -103,7 +103,7 @@ void xtalk_probe_node(cnodeid_t nid)
 {
 	volatile u64		hubreg;
 	nasid_t			nasid;
-	xwidget_part_num_t	partnum;
+	s32			partnum;
 	widgetreg_t		widget_id;
 
 	nasid = COMPACT_TO_NASID_NODEID(nid);
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] MIPS: Xtalk: Clean-up xtalk.h macros
  2017-02-07  5:57 [PATCH 0/3] MIPS: Xtalk: Updates/clean-ups Joshua Kinard
  2017-02-07  5:57 ` [PATCH 1/3] MIPS: Xtalk: Replace several IRIX-era typedefs Joshua Kinard
@ 2017-02-07  5:57 ` Joshua Kinard
  2017-02-14 13:16   ` James Hogan
  2017-02-07  5:57 ` [PATCH 3/3] MIPS: Xtalk: Rewrite access structs in xwidget.h Joshua Kinard
  2 siblings, 1 reply; 6+ messages in thread
From: Joshua Kinard @ 2017-02-07  5:57 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Linux/MIPS

From: Joshua Kinard <kumba@gentoo.org>

Clean-up several macros in arch/mips/include/asm/xtalk/xtalk.h:
 - Hex addresses are lowercased.
 - Added whitespace around several operators.
 - Removed bridge_probe declaration.

Signed-off-by: Joshua Kinard <kumba@gentoo.org>
---
 arch/mips/include/asm/xtalk/xtalk.h | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/arch/mips/include/asm/xtalk/xtalk.h b/arch/mips/include/asm/xtalk/xtalk.h
index 9125bd85514d..627ed91b2880 100644
--- a/arch/mips/include/asm/xtalk/xtalk.h
+++ b/arch/mips/include/asm/xtalk/xtalk.h
@@ -21,24 +21,15 @@
 #define XWIDGET_MFG_NUM_NONE	-1
 
 /* It is often convenient to fold the XIO target port */
-#define XIO_NOWHERE	(0xFFFFFFFFFFFFFFFFull)
-#define XIO_ADDR_BITS	(0x0000FFFFFFFFFFFFull)
-#define XIO_PORT_BITS	(0xF000000000000000ull)
+#define XIO_NOWHERE	(0xffffffffffffffffULL)
+#define XIO_ADDR_BITS	(0x0000ffffffffffffULL)
+#define XIO_PORT_BITS	(0xf000000000000000ULL)
 #define XIO_PORT_SHIFT	(60)
 
-#define XIO_PACKED(x)	(((x)&XIO_PORT_BITS) != 0)
-#define XIO_ADDR(x)	((x)&XIO_ADDR_BITS)
-#define XIO_PORT(x)	((s8)(((x)&XIO_PORT_BITS) >> XIO_PORT_SHIFT))
-#define XIO_PACK(p, o)	((((uint64_t)(p))<<XIO_PORT_SHIFT) | ((o)&XIO_ADDR_BITS))
-
-#ifdef CONFIG_PCI
-extern int bridge_probe(nasid_t nasid, int widget, int masterwid);
-#else
-static inline int bridge_probe(nasid_t nasid, int widget, int masterwid)
-{
-	return 0;
-}
-#endif
+#define XIO_PACKED(x)	(((x) & XIO_PORT_BITS) != 0)
+#define XIO_ADDR(x)	((x) & XIO_ADDR_BITS)
+#define XIO_PORT(x)	((s8)(((x) & XIO_PORT_BITS) >> XIO_PORT_SHIFT))
+#define XIO_PACK(p, o)	((((u64)(p)) << XIO_PORT_SHIFT) | ((o) & XIO_ADDR_BITS))
 
 #endif /* !__ASSEMBLY__ */
 
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] MIPS: Xtalk: Rewrite access structs in xwidget.h
  2017-02-07  5:57 [PATCH 0/3] MIPS: Xtalk: Updates/clean-ups Joshua Kinard
  2017-02-07  5:57 ` [PATCH 1/3] MIPS: Xtalk: Replace several IRIX-era typedefs Joshua Kinard
  2017-02-07  5:57 ` [PATCH 2/3] MIPS: Xtalk: Clean-up xtalk.h macros Joshua Kinard
@ 2017-02-07  5:57 ` Joshua Kinard
  2 siblings, 0 replies; 6+ messages in thread
From: Joshua Kinard @ 2017-02-07  5:57 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Linux/MIPS

From: Joshua Kinard <kumba@gentoo.org>

Rewrite the structs used to access xtalk widgets and document the new
access structs using kernel-doc.  A struct for xwidget platform_data
is also added for later use by updated BRIDGE code.

The following new structs or unions were added:
 - struct xwidget_platform_data
 - union xbow_reg
 - struct xwidget_cmn_regs
 - struct xwidget_link_regs
 - struct xwidget_regs

The following structs were removed:
 - volatile struct widget_cfg

Signed-off-by: Joshua Kinard <kumba@gentoo.org>
---
 arch/mips/include/asm/xtalk/xwidget.h | 282 +++++++++++++++++++++---
 1 file changed, 250 insertions(+), 32 deletions(-)

diff --git a/arch/mips/include/asm/xtalk/xwidget.h b/arch/mips/include/asm/xtalk/xwidget.h
index 9f71148f9ff4..cb0bf300b437 100644
--- a/arch/mips/include/asm/xtalk/xwidget.h
+++ b/arch/mips/include/asm/xtalk/xwidget.h
@@ -196,41 +196,257 @@ static const struct widget_ident __initconst widget_idents[] = {
 	}
 };
 
-/*
- * according to the crosstalk spec, only 32-bits access to the widget
- * configuration registers is allowed.	some widgets may allow 64-bits
- * access but software should not depend on it.	 registers beyond the
- * widget target flush register are widget dependent thus will not be
- * defined here
+/* Common widget bits */
+#define XTALK_NODEV		0xffffffff
+
+/* Common Xbow bits */
+#define XBOW_REG_LINK_STAT_0	0x114
+#define XBOW_REG_LINK_BLK_SIZE	0x40
+#define XBOW_REG_LINK_ALIVE	0x80000000
+
+/**
+ * xwidget_platform_data - platform data for xtalk widgets.
+ * @nasid: signed short for the NUMA node ID.
+ * @masterwid: master xtalk widget for this xwidget (HUB, HEART, BEDROCK)
+ * @bridge_pdata: pointer to struct bridge_platform_data.
  */
+struct xwidget_platform_data {
+	s16 nasid;
+	s8 masterwid;
+	struct bridge_platform_data *bridge_pdata;
+};
+
 #ifndef __ASSEMBLY__
-typedef u32 widgetreg_t;
 
-/* widget configuration registers */
-typedef volatile struct widget_cfg {
-	widgetreg_t		w_pad_0;		/* 0x00 */
-	widgetreg_t		w_id;			/* 0x04 */
-	widgetreg_t		w_pad_1;		/* 0x08 */
-	widgetreg_t		w_status;		/* 0x0c */
-	widgetreg_t		w_pad_2;		/* 0x10 */
-	widgetreg_t		w_err_upper_addr;	/* 0x14 */
-	widgetreg_t		w_pad_3;		/* 0x18 */
-	widgetreg_t		w_err_lower_addr;	/* 0x1c */
-	widgetreg_t		w_pad_4;		/* 0x20 */
-	widgetreg_t		w_control;		/* 0x24 */
-	widgetreg_t		w_pad_5;		/* 0x28 */
-	widgetreg_t		w_req_timeout;		/* 0x2c */
-	widgetreg_t		w_pad_6;		/* 0x30 */
-	widgetreg_t		w_intdest_upper_addr;	/* 0x34 */
-	widgetreg_t		w_pad_7;		/* 0x38 */
-	widgetreg_t		w_intdest_lower_addr;	/* 0x3c */
-	widgetreg_t		w_pad_8;		/* 0x40 */
-	widgetreg_t		w_err_cmd_word;		/* 0x44 */
-	widgetreg_t		w_pad_9;		/* 0x48 */
-	widgetreg_t		w_llp_cfg;		/* 0x4c */
-	widgetreg_t		w_pad_10;		/* 0x50 */
-	widgetreg_t		w_tflush;		/* 0x54 */
-} widget_cfg_t;
+/* ----------------------------------------------------------------------- */
+
+
+/**
+ * union xbow_reg - 64-bit/32-bit access to Crossbow/XBOW registers.
+ * @q: 64-bit register access; uncommon, but may exist on certain widgets.
+ * @l.__pad: upper 32-bits of padding.
+ * @l.data: lower 32-bits of register data.
+ *
+ * Per the Crosstalk specification, all registers are 32-bits or less in size
+ * and are aligned to a 64-bit boundary.  Register data begins at bits 31:0
+ * and can only be accessed by a Crosstalk double-word packet type.
+ *
+ * However, some Crosstalk widgets may allow for 64-bit register access, so
+ * this union provides for a u64 data type specifically for these rare
+ * instances.
+ */
+union xbow_reg {
+	u64 q;			/* 64-bit access */
+	struct {
+		u32 __pad;	/* upper 32-bits padding */
+		u32 data;	/* lower 32-bits data */
+	} l;
+};
+
+
+/**
+ * struct xwidget_cmn_regs - Crosstalk common widget config registers.
+ * @id: widget ID.
+ * @status: widget 0 status (read-only).
+ * @err_upper: upper 32-bits of error address.
+ * @err_lower: lower 32-bits of error address.
+ * @wid_ctrl: widget 0 control.
+ * @pkt_timo: packet timeout.
+ * @int_upper: upper 32-bits of interrupt destination address.
+ * @int_lower: lower 32-bits of interrupt destination address.
+ * @err_cmdword: error command
+ * @llp_ctrl: Link Level Protocol (LLP) control.
+ * @stat_clr: widget 0 status (read & clear).
+ * @arb_reload: arbitration reload.
+ * @perf_ctr_a: perf counter A.
+ * @perf_ctr_b: perf counter B.
+ * @nic: Number-In-a-Can (NIC).
+ *
+ * Crossbow registers beyond the 'stat_clr' register are widget-dependent and
+ * were originally not specified.  However, this struct defines all registers
+ * up to offset 0x78.  Widget-specific code will need to rename the 'stat_clr'
+ * widget and beyond to whatever purpose it serves.  See asm/pci/bridge.h for
+ * example macros after the definition of 'struct bridge_regs'.
+ */
+struct xwidget_cmn_regs {
+	union xbow_reg id;		/* 0x00000000 */
+	union xbow_reg status;		/*	 +008 */
+	union xbow_reg err_upper;	/*	 +010 */
+	union xbow_reg err_lower;	/*	 +018 */
+	union xbow_reg wid_ctrl;	/*	 +020 */
+	union xbow_reg pkt_timo;	/*	 +028 */
+	union xbow_reg int_upper;	/*	 +030 */
+	union xbow_reg int_lower;	/*	 +038 */
+	union xbow_reg err_cmdword;	/*	 +040 */
+	union xbow_reg llp_ctrl;	/*	 +048 */
+	union xbow_reg stat_clr;	/*	 +050 */
+	union xbow_reg arb_reload;	/*	 +058 */
+	union xbow_reg perf_ctr_a;	/*	 +060 */
+	union xbow_reg perf_ctr_b;	/*	 +068 */
+	union xbow_reg nic;		/*	 +070 */
+};
+
+
+/**
+ * struct xwidget_link_regs - Crosstalk per-link widget registers.
+ * @ibuf_flush: link input buffer flush.
+ * @ctrl: link control.
+ * @status: link status (read-only).
+ * @arb_upper: upper 32-bits of link arbitration address.
+ * @arb_lower: lower 32-bits of link arbitration address.
+ * @stat_clr: link status (read & clear).
+ * @reset: link reset.
+ * @aux_stat: link auxiliary control.
+ *
+ * There are eight sets of these registers, starting at offset +0x100 in
+ * crosstalk address space.  Each set of registers is 0x40 in size.  They
+ * are labeled in hex as 'link 8' to 'link f', representing the eight
+ * possible crosstalk widgets per XBOW ASIC.
+ */
+struct xwidget_link_regs {
+	union xbow_reg ibuf_flush;	/* 0x0000 */
+	union xbow_reg ctrl;		/*    +08 */
+	union xbow_reg status;		/*    +10 */
+	union xbow_reg arb_upper;	/*    +18 */
+	union xbow_reg arb_lower;	/*    +20 */
+	union xbow_reg stat_clr;	/*    +28 */
+	union xbow_reg reset;		/*    +30 */
+	union xbow_reg aux_stat;	/*    +38 */
+};
+
+
+/**
+ * struct xwidget_regs - Crosstalk widget register access.
+ * @common: common widget registers.
+ * @link_8: link-specific widget registers for widget 0x8.
+ * @link_9: ... widget 0x9.
+ * @link_a: ... widget 0xa.
+ * @link_b: ... widget 0xb.
+ * @link_c: ... widget 0xc.
+ * @link_d: ... widget 0xd.
+ * @link_e: ... widget 0xe.
+ * @link_f: ... widget 0xf.
+ * @rsvd: reserved address space from 0x00000300 to 0x00ffffff.
+ */
+struct xwidget_regs {
+	struct xwidget_cmn_regs		common;	/* 0x00000000 */
+	struct xwidget_link_regs	link_8;	/* 0x00000100 */
+	struct xwidget_link_regs	link_9;	/* 0x00000140 */
+	struct xwidget_link_regs	link_a;	/* 0x00000180 */
+	struct xwidget_link_regs	link_b;	/* 0x000001c0 */
+	struct xwidget_link_regs	link_c;	/* 0x00000200 */
+	struct xwidget_link_regs	link_d;	/* 0x00000240 */
+	struct xwidget_link_regs	link_e;	/* 0x00000280 */
+	struct xwidget_link_regs	link_f;	/* 0x000002c0 */
+	u64 rsvd[0x1fffa0];			/* 0x00000300 */
+};
+
+/*
+ * Shortcut macros to access bits 31:0 of each Crosstalk common config
+ * registers.  They cannot be used by themselves, but must be accessed off of
+ * a defined 'struct xwidget_regs' variable.  64-bit access should access
+ * the 'q' member directly if needed.  Some known widgets (e.g. BRIDGE) use
+ * parts of this structure for its own widget register accesses.
+ */
+#define xw_id			common.id.l.data		/* ro */
+#define xw_status		common.status.l.data		/* ro */
+#define xw_err_upper		common.err_upper.l.data		/* ro */
+#define xw_err_lower		common.err_lower.l.data		/* ro */
+#define xw_wid_ctrl		common.wid_ctrl.l.data		/* rw */
+#define xw_pkt_timo		common.pkt_timo.l.data		/* rw */
+#define xw_int_upper		common.int_upper.l.data		/* rw */
+#define xw_int_lower		common.int_lower.l.data		/* rw */
+#define xw_err_cmdword		common.err_cmdword.l.data	/* rw */
+#define xw_llp_ctrl		common.llp_ctrl.l.data		/* rw */
+#define xw_stat_clr		common.stat_clr.l.data		/* ro/clr */
+#define xw_arb_reload		common.arb_reload.l.data	/* rw */
+#define xw_perf_ctr_a		common.perf_ctr_a.l.data	/* rw */
+#define xw_perf_ctr_b		common.perf_ctr_b.l.data	/* rw */
+#define xw_nic			common.nic.l.data		/* rw */
+
+/*
+ * Shortcut macros to access bits 31:0 of each Crosstalk link-specific config
+ * register.  They cannot be used by themselves, but must be accessed off of
+ * a defined 'struct xwidget_regs' variable.
+ */
+#define xw_link_8_ibuf_flush	link_8.ibuf_flush.l.data	/* ro */
+#define xw_link_8_ctrl		link_8.ctrl.l.data		/* rw */
+#define xw_link_8_status	link_8.status.l.data		/* ro */
+#define xw_link_8_arb_upper	link_8.arb_upper.l.data		/* rw */
+#define xw_link_8_arb_lower	link_8.arb_lower.l.data		/* rw */
+#define xw_link_8_stat_clr	link_8.stat_clr.l.data		/* ro/clr */
+#define xw_link_8_reset		link_8.reset.l.data		/* wo */
+#define xw_link_8_aux_stat	link_8.aux_stat.l.data		/* ro */
+
+#define xw_link_9_ibuf_flush	link_9.ibuf_flush.l.data	/* ro */
+#define xw_link_9_ctrl		link_9.ctrl.l.data		/* rw */
+#define xw_link_9_status	link_9.status.l.data		/* ro */
+#define xw_link_9_arb_upper	link_9.arb_upper.l.data		/* rw */
+#define xw_link_9_arb_lower	link_9.arb_lower.l.data		/* rw */
+#define xw_link_9_stat_clr	link_9.stat_clr.l.data		/* ro/clr */
+#define xw_link_9_reset		link_9.reset.l.data		/* wo */
+#define xw_link_9_aux_stat	link_9.aux_stat.l.data		/* ro */
+
+#define xw_link_a_ibuf_flush	link_a.ibuf_flush.l.data	/* ro */
+#define xw_link_a_ctrl		link_a.ctrl.l.data		/* rw */
+#define xw_link_a_status	link_a.status.l.data		/* ro */
+#define xw_link_a_arb_upper	link_a.arb_upper.l.data		/* rw */
+#define xw_link_a_arb_lower	link_a.arb_lower.l.data		/* rw */
+#define xw_link_a_stat_clr	link_a.stat_clr.l.data		/* ro/clr */
+#define xw_link_a_reset		link_a.reset.l.data		/* wo */
+#define xw_link_a_aux_stat	link_a.aux_stat.l.data		/* ro */
+
+#define xw_link_b_ibuf_flush	link_b.ibuf_flush.l.data	/* ro */
+#define xw_link_b_ctrl		link_b.ctrl.l.data		/* rw */
+#define xw_link_b_status	link_b.status.l.data		/* ro */
+#define xw_link_b_arb_upper	link_b.arb_upper.l.data		/* rw */
+#define xw_link_b_arb_lower	link_b.arb_lower.l.data		/* rw */
+#define xw_link_b_stat_clr	link_b.stat_clr.l.data		/* ro/clr */
+#define xw_link_b_reset		link_b.reset.l.data		/* wo */
+#define xw_link_b_aux_stat	link_b.aux_stat.l.data		/* ro */
+
+#define xw_link_c_ibuf_flush	link_c.ibuf_flush.l.data	/* ro */
+#define xw_link_c_ctrl		link_c.ctrl.l.data		/* rw */
+#define xw_link_c_status	link_c.status.l.data		/* ro */
+#define xw_link_c_arb_upper	link_c.arb_upper.l.data		/* rw */
+#define xw_link_c_arb_lower	link_c.arb_lower.l.data		/* rw */
+#define xw_link_c_stat_clr	link_c.stat_clr.l.data		/* ro/clr */
+#define xw_link_c_reset		link_c.reset.l.data		/* wo */
+#define xw_link_c_aux_stat	link_c.aux_stat.l.data		/* ro */
+
+#define xw_link_d_ibuf_flush	link_d.ibuf_flush.l.data	/* ro */
+#define xw_link_d_ctrl		link_d.ctrl.l.data		/* rw */
+#define xw_link_d_status	link_d.status.l.data		/* ro */
+#define xw_link_d_arb_upper	link_d.arb_upper.l.data		/* rw */
+#define xw_link_d_arb_lower	link_d.arb_lower.l.data		/* rw */
+#define xw_link_d_stat_clr	link_d.stat_clr.l.data		/* ro/clr */
+#define xw_link_d_reset		link_d.reset.l.data		/* wo */
+#define xw_link_d_aux_stat	link_d.aux_stat.l.data		/* ro */
+
+#define xw_link_e_ibuf_flush	link_e.ibuf_flush.l.data	/* ro */
+#define xw_link_e_ctrl		link_e.ctrl.l.data		/* rw */
+#define xw_link_e_status	link_e.status.l.data		/* ro */
+#define xw_link_e_arb_upper	link_e.arb_upper.l.data		/* rw */
+#define xw_link_e_arb_lower	link_e.arb_lower.l.data		/* rw */
+#define xw_link_e_stat_clr	link_e.stat_clr.l.data		/* ro/clr */
+#define xw_link_e_reset		link_e.reset.l.data		/* wo */
+#define xw_link_e_aux_stat	link_e.aux_stat.l.data		/* ro */
+
+#define xw_link_f_ibuf_flush	link_f.ibuf_flush.l.data	/* ro */
+#define xw_link_f_ctrl		link_f.ctrl.l.data		/* rw */
+#define xw_link_f_status	link_f.status.l.data		/* ro */
+#define xw_link_f_arb_upper	link_f.arb_upper.l.data		/* rw */
+#define xw_link_f_arb_lower	link_f.arb_lower.l.data		/* rw */
+#define xw_link_f_stat_clr	link_f.stat_clr.l.data		/* ro/clr */
+#define xw_link_f_reset		link_f.reset.l.data		/* wo */
+#define xw_link_f_aux_stat	link_f.aux_stat.l.data		/* ro */
+
+
+
+/* ----------------------------------------------------------------------- */
+/* XXX: Old/pre-existing Crosstalk data types.  Keep/rewrite later. */
+
+typedef u32 widgetreg_t;
 
 typedef struct {
 	unsigned int	didn:4;
@@ -274,6 +490,8 @@ typedef struct xwidget_hwid_s {
 	((hwid2)->mfg_num == XWIDGET_MFG_NUM_NONE) || \
 	((hwid1)->mfg_num == (hwid2)->mfg_num)))
 
+/* ----------------------------------------------------------------------- */
+
 #endif /* !__ASSEMBLY__ */
 
 #endif /* _ASM_XTALK_XWIDGET_H */
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3] MIPS: Xtalk: Clean-up xtalk.h macros
  2017-02-07  5:57 ` [PATCH 2/3] MIPS: Xtalk: Clean-up xtalk.h macros Joshua Kinard
@ 2017-02-14 13:16   ` James Hogan
  2017-02-14 19:46     ` Joshua Kinard
  0 siblings, 1 reply; 6+ messages in thread
From: James Hogan @ 2017-02-14 13:16 UTC (permalink / raw)
  To: Joshua Kinard; +Cc: Ralf Baechle, Linux/MIPS

[-- Attachment #1: Type: text/plain, Size: 2051 bytes --]

Hi Joshua,

On Tue, Feb 07, 2017 at 12:57:50AM -0500, Joshua Kinard wrote:
> From: Joshua Kinard <kumba@gentoo.org>
> 
> Clean-up several macros in arch/mips/include/asm/xtalk/xtalk.h:
>  - Hex addresses are lowercased.
>  - Added whitespace around several operators.
>  - Removed bridge_probe declaration.
> 
> Signed-off-by: Joshua Kinard <kumba@gentoo.org>
> ---
>  arch/mips/include/asm/xtalk/xtalk.h | 23 +++++++----------------
>  1 file changed, 7 insertions(+), 16 deletions(-)
> 
> diff --git a/arch/mips/include/asm/xtalk/xtalk.h b/arch/mips/include/asm/xtalk/xtalk.h
> index 9125bd85514d..627ed91b2880 100644
> --- a/arch/mips/include/asm/xtalk/xtalk.h
> +++ b/arch/mips/include/asm/xtalk/xtalk.h
> @@ -21,24 +21,15 @@
>  #define XWIDGET_MFG_NUM_NONE	-1
>  
>  /* It is often convenient to fold the XIO target port */
> -#define XIO_NOWHERE	(0xFFFFFFFFFFFFFFFFull)
> -#define XIO_ADDR_BITS	(0x0000FFFFFFFFFFFFull)
> -#define XIO_PORT_BITS	(0xF000000000000000ull)
> +#define XIO_NOWHERE	(0xffffffffffffffffULL)
> +#define XIO_ADDR_BITS	(0x0000ffffffffffffULL)
> +#define XIO_PORT_BITS	(0xf000000000000000ULL)
>  #define XIO_PORT_SHIFT	(60)
>  
> -#define XIO_PACKED(x)	(((x)&XIO_PORT_BITS) != 0)
> -#define XIO_ADDR(x)	((x)&XIO_ADDR_BITS)
> -#define XIO_PORT(x)	((s8)(((x)&XIO_PORT_BITS) >> XIO_PORT_SHIFT))
> -#define XIO_PACK(p, o)	((((uint64_t)(p))<<XIO_PORT_SHIFT) | ((o)&XIO_ADDR_BITS))
> -
> -#ifdef CONFIG_PCI
> -extern int bridge_probe(nasid_t nasid, int widget, int masterwid);
> -#else
> -static inline int bridge_probe(nasid_t nasid, int widget, int masterwid)
> -{
> -	return 0;
> -}
> -#endif

Won't this break the build when CONFIG_PCI=n?

Cheers
James

> +#define XIO_PACKED(x)	(((x) & XIO_PORT_BITS) != 0)
> +#define XIO_ADDR(x)	((x) & XIO_ADDR_BITS)
> +#define XIO_PORT(x)	((s8)(((x) & XIO_PORT_BITS) >> XIO_PORT_SHIFT))
> +#define XIO_PACK(p, o)	((((u64)(p)) << XIO_PORT_SHIFT) | ((o) & XIO_ADDR_BITS))
>  
>  #endif /* !__ASSEMBLY__ */
>  
> -- 
> 2.11.1
> 
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3] MIPS: Xtalk: Clean-up xtalk.h macros
  2017-02-14 13:16   ` James Hogan
@ 2017-02-14 19:46     ` Joshua Kinard
  0 siblings, 0 replies; 6+ messages in thread
From: Joshua Kinard @ 2017-02-14 19:46 UTC (permalink / raw)
  To: James Hogan; +Cc: Ralf Baechle, Linux/MIPS

On 02/14/2017 08:16, James Hogan wrote:
> Hi Joshua,
> 
> On Tue, Feb 07, 2017 at 12:57:50AM -0500, Joshua Kinard wrote:
>> From: Joshua Kinard <kumba@gentoo.org>
>>
>> Clean-up several macros in arch/mips/include/asm/xtalk/xtalk.h:
>>  - Hex addresses are lowercased.
>>  - Added whitespace around several operators.
>>  - Removed bridge_probe declaration.
>>
>> Signed-off-by: Joshua Kinard <kumba@gentoo.org>
>> ---
>>  arch/mips/include/asm/xtalk/xtalk.h | 23 +++++++----------------
>>  1 file changed, 7 insertions(+), 16 deletions(-)
>>
>> diff --git a/arch/mips/include/asm/xtalk/xtalk.h b/arch/mips/include/asm/xtalk/xtalk.h
>> index 9125bd85514d..627ed91b2880 100644
>> --- a/arch/mips/include/asm/xtalk/xtalk.h
>> +++ b/arch/mips/include/asm/xtalk/xtalk.h
>> @@ -21,24 +21,15 @@
>>  #define XWIDGET_MFG_NUM_NONE	-1
>>  
>>  /* It is often convenient to fold the XIO target port */
>> -#define XIO_NOWHERE	(0xFFFFFFFFFFFFFFFFull)
>> -#define XIO_ADDR_BITS	(0x0000FFFFFFFFFFFFull)
>> -#define XIO_PORT_BITS	(0xF000000000000000ull)
>> +#define XIO_NOWHERE	(0xffffffffffffffffULL)
>> +#define XIO_ADDR_BITS	(0x0000ffffffffffffULL)
>> +#define XIO_PORT_BITS	(0xf000000000000000ULL)
>>  #define XIO_PORT_SHIFT	(60)
>>  
>> -#define XIO_PACKED(x)	(((x)&XIO_PORT_BITS) != 0)
>> -#define XIO_ADDR(x)	((x)&XIO_ADDR_BITS)
>> -#define XIO_PORT(x)	((s8)(((x)&XIO_PORT_BITS) >> XIO_PORT_SHIFT))
>> -#define XIO_PACK(p, o)	((((uint64_t)(p))<<XIO_PORT_SHIFT) | ((o)&XIO_ADDR_BITS))
>> -
>> -#ifdef CONFIG_PCI
>> -extern int bridge_probe(nasid_t nasid, int widget, int masterwid);
>> -#else
>> -static inline int bridge_probe(nasid_t nasid, int widget, int masterwid)
>> -{
>> -	return 0;
>> -}
>> -#endif
> 
> Won't this break the build when CONFIG_PCI=n?
> 
> Cheers
> James

It might, though I believe my BRIDGE updates addressed that.  Though, these
machines are pretty unusable without PCI anyways.

Hold on these patches for now (same for the BRIDGE series).  I need to re-spin
them once I tackle fixing the PCI Bridge window bits this weekend.  I think
I'll make the window selection a platform_data parameter and have a built-in
default for small windows, since those are usually fixed by hardware, with each
BRIDGE-capable platform passing in its own big window range.

Then, IP27 is going to require porting additional code from Linux-2.5.70/IA64
to get its big windows to work...

--J

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-02-14 19:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-07  5:57 [PATCH 0/3] MIPS: Xtalk: Updates/clean-ups Joshua Kinard
2017-02-07  5:57 ` [PATCH 1/3] MIPS: Xtalk: Replace several IRIX-era typedefs Joshua Kinard
2017-02-07  5:57 ` [PATCH 2/3] MIPS: Xtalk: Clean-up xtalk.h macros Joshua Kinard
2017-02-14 13:16   ` James Hogan
2017-02-14 19:46     ` Joshua Kinard
2017-02-07  5:57 ` [PATCH 3/3] MIPS: Xtalk: Rewrite access structs in xwidget.h Joshua Kinard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).