aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Losure <blosure@americas.sgi.com>2005-09-02 16:16:35 -0400
committerTony Luck <tony.luck@intel.com>2005-09-06 17:16:01 -0400
commit25732ad493b22b7d9f0d250c5a9ad17219f96a47 (patch)
tree6d2c753c248977fdca4b5d423b65d7fbf2f70186
parent4706df3d3c42af802597d82c8b1542c3d52eab23 (diff)
[IA64] Altix patch for fpga reset
1) workaround a h/w reset issue 2) to improve the determination of FPGA-based h/w in the arch/ia64/sn/kernel/tiocx code. Signed-off-by: Bruce Losure <blosure@sgi.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
-rw-r--r--arch/ia64/sn/kernel/tiocx.c62
-rw-r--r--include/asm-ia64/sn/l1.h12
-rw-r--r--include/asm-ia64/sn/sn_sal.h43
-rw-r--r--include/asm-ia64/sn/tiocx.h3
4 files changed, 90 insertions, 30 deletions
diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c
index 254fe15c064b..d8664715764b 100644
--- a/arch/ia64/sn/kernel/tiocx.c
+++ b/arch/ia64/sn/kernel/tiocx.c
@@ -183,11 +183,12 @@ int cx_driver_unregister(struct cx_drv *cx_driver)
183 * @part_num: device's part number 183 * @part_num: device's part number
184 * @mfg_num: device's manufacturer number 184 * @mfg_num: device's manufacturer number
185 * @hubdev: hub info associated with this device 185 * @hubdev: hub info associated with this device
186 * @bt: board type of the device
186 * 187 *
187 */ 188 */
188int 189int
189cx_device_register(nasid_t nasid, int part_num, int mfg_num, 190cx_device_register(nasid_t nasid, int part_num, int mfg_num,
190 struct hubdev_info *hubdev) 191 struct hubdev_info *hubdev, int bt)
191{ 192{
192 struct cx_dev *cx_dev; 193 struct cx_dev *cx_dev;
193 194
@@ -200,6 +201,7 @@ cx_device_register(nasid_t nasid, int part_num, int mfg_num,
200 cx_dev->cx_id.mfg_num = mfg_num; 201 cx_dev->cx_id.mfg_num = mfg_num;
201 cx_dev->cx_id.nasid = nasid; 202 cx_dev->cx_id.nasid = nasid;
202 cx_dev->hubdev = hubdev; 203 cx_dev->hubdev = hubdev;
204 cx_dev->bt = bt;
203 205
204 cx_dev->dev.parent = NULL; 206 cx_dev->dev.parent = NULL;
205 cx_dev->dev.bus = &tiocx_bus_type; 207 cx_dev->dev.bus = &tiocx_bus_type;
@@ -238,7 +240,8 @@ static int cx_device_reload(struct cx_dev *cx_dev)
238{ 240{
239 cx_device_unregister(cx_dev); 241 cx_device_unregister(cx_dev);
240 return cx_device_register(cx_dev->cx_id.nasid, cx_dev->cx_id.part_num, 242 return cx_device_register(cx_dev->cx_id.nasid, cx_dev->cx_id.part_num,
241 cx_dev->cx_id.mfg_num, cx_dev->hubdev); 243 cx_dev->cx_id.mfg_num, cx_dev->hubdev,
244 cx_dev->bt);
242} 245}
243 246
244static inline uint64_t tiocx_intr_alloc(nasid_t nasid, int widget, 247static inline uint64_t tiocx_intr_alloc(nasid_t nasid, int widget,
@@ -365,26 +368,20 @@ static void tio_corelet_reset(nasid_t nasid, int corelet)
365 udelay(2000); 368 udelay(2000);
366} 369}
367 370
368static int tiocx_btchar_get(int nasid) 371static int is_fpga_tio(int nasid, int *bt)
369{ 372{
370 moduleid_t module_id; 373 int ioboard_type;
371 geoid_t geoid;
372 int cnodeid;
373
374 cnodeid = nasid_to_cnodeid(nasid);
375 geoid = cnodeid_get_geoid(cnodeid);
376 module_id = geo_module(geoid);
377 return MODULE_GET_BTCHAR(module_id);
378}
379 374
380static int is_fpga_brick(int nasid) 375 ioboard_type = ia64_sn_sysctl_ioboard_get(nasid);
381{ 376
382 switch (tiocx_btchar_get(nasid)) { 377 switch (ioboard_type) {
383 case L1_BRICKTYPE_SA: 378 case L1_BRICKTYPE_SA:
384 case L1_BRICKTYPE_ATHENA: 379 case L1_BRICKTYPE_ATHENA:
385 case L1_BRICKTYPE_DAYTONA: 380 case L1_BOARDTYPE_DAYTONA:
381 *bt = ioboard_type;
386 return 1; 382 return 1;
387 } 383 }
384
388 return 0; 385 return 0;
389} 386}
390 387
@@ -407,16 +404,22 @@ static int tiocx_reload(struct cx_dev *cx_dev)
407 404
408 if (bitstream_loaded(nasid)) { 405 if (bitstream_loaded(nasid)) {
409 uint64_t cx_id; 406 uint64_t cx_id;
410 407 int rv;
411 cx_id = 408
412 *(volatile uint64_t *)(TIO_SWIN_BASE(nasid, TIOCX_CORELET) + 409 rv = ia64_sn_sysctl_tio_clock_reset(nasid);
410 if (rv) {
411 printk(KERN_ALERT "CX port JTAG reset failed.\n");
412 } else {
413 cx_id = *(volatile uint64_t *)
414 (TIO_SWIN_BASE(nasid, TIOCX_CORELET) +
413 WIDGET_ID); 415 WIDGET_ID);
414 part_num = XWIDGET_PART_NUM(cx_id); 416 part_num = XWIDGET_PART_NUM(cx_id);
415 mfg_num = XWIDGET_MFG_NUM(cx_id); 417 mfg_num = XWIDGET_MFG_NUM(cx_id);
416 DBG("part= 0x%x, mfg= 0x%x\n", part_num, mfg_num); 418 DBG("part= 0x%x, mfg= 0x%x\n", part_num, mfg_num);
417 /* just ignore it if it's a CE */ 419 /* just ignore it if it's a CE */
418 if (part_num == TIO_CE_ASIC_PARTNUM) 420 if (part_num == TIO_CE_ASIC_PARTNUM)
419 return 0; 421 return 0;
422 }
420 } 423 }
421 424
422 cx_dev->cx_id.part_num = part_num; 425 cx_dev->cx_id.part_num = part_num;
@@ -436,10 +439,10 @@ static ssize_t show_cxdev_control(struct device *dev, struct device_attribute *a
436{ 439{
437 struct cx_dev *cx_dev = to_cx_dev(dev); 440 struct cx_dev *cx_dev = to_cx_dev(dev);
438 441
439 return sprintf(buf, "0x%x 0x%x 0x%x %d\n", 442 return sprintf(buf, "0x%x 0x%x 0x%x 0x%x\n",
440 cx_dev->cx_id.nasid, 443 cx_dev->cx_id.nasid,
441 cx_dev->cx_id.part_num, cx_dev->cx_id.mfg_num, 444 cx_dev->cx_id.part_num, cx_dev->cx_id.mfg_num,
442 tiocx_btchar_get(cx_dev->cx_id.nasid)); 445 cx_dev->bt);
443} 446}
444 447
445static ssize_t store_cxdev_control(struct device *dev, struct device_attribute *attr, const char *buf, 448static ssize_t store_cxdev_control(struct device *dev, struct device_attribute *attr, const char *buf,
@@ -488,11 +491,12 @@ static int __init tiocx_init(void)
488 491
489 for (cnodeid = 0; cnodeid < MAX_COMPACT_NODES; cnodeid++) { 492 for (cnodeid = 0; cnodeid < MAX_COMPACT_NODES; cnodeid++) {
490 nasid_t nasid; 493 nasid_t nasid;
494 int bt;
491 495
492 if ((nasid = cnodeid_to_nasid(cnodeid)) < 0) 496 if ((nasid = cnodeid_to_nasid(cnodeid)) < 0)
493 break; /* No more nasids .. bail out of loop */ 497 break; /* No more nasids .. bail out of loop */
494 498
495 if ((nasid & 0x1) && is_fpga_brick(nasid)) { 499 if ((nasid & 0x1) && is_fpga_tio(nasid, &bt)) {
496 struct hubdev_info *hubdev; 500 struct hubdev_info *hubdev;
497 struct xwidget_info *widgetp; 501 struct xwidget_info *widgetp;
498 502
@@ -512,7 +516,7 @@ static int __init tiocx_init(void)
512 516
513 if (cx_device_register 517 if (cx_device_register
514 (nasid, widgetp->xwi_hwid.part_num, 518 (nasid, widgetp->xwi_hwid.part_num,
515 widgetp->xwi_hwid.mfg_num, hubdev) < 0) 519 widgetp->xwi_hwid.mfg_num, hubdev, bt) < 0)
516 return -ENXIO; 520 return -ENXIO;
517 else 521 else
518 found_tiocx_device++; 522 found_tiocx_device++;
diff --git a/include/asm-ia64/sn/l1.h b/include/asm-ia64/sn/l1.h
index 2e5f0aa38889..e3b819110d47 100644
--- a/include/asm-ia64/sn/l1.h
+++ b/include/asm-ia64/sn/l1.h
@@ -35,4 +35,16 @@
35#define L1_BRICKTYPE_ATHENA 0x2b /* + */ 35#define L1_BRICKTYPE_ATHENA 0x2b /* + */
36#define L1_BRICKTYPE_DAYTONA 0x7a /* z */ 36#define L1_BRICKTYPE_DAYTONA 0x7a /* z */
37 37
38/* board type response codes */
39#define L1_BOARDTYPE_IP69 0x0100 /* CA */
40#define L1_BOARDTYPE_IP63 0x0200 /* CB */
41#define L1_BOARDTYPE_BASEIO 0x0300 /* IB */
42#define L1_BOARDTYPE_PCIE2SLOT 0x0400 /* IC */
43#define L1_BOARDTYPE_PCIX3SLOT 0x0500 /* ID */
44#define L1_BOARDTYPE_PCIXPCIE4SLOT 0x0600 /* IE */
45#define L1_BOARDTYPE_ABACUS 0x0700 /* AB */
46#define L1_BOARDTYPE_DAYTONA 0x0800 /* AD */
47#define L1_BOARDTYPE_INVAL (-1) /* invalid brick type */
48
49
38#endif /* _ASM_IA64_SN_L1_H */ 50#endif /* _ASM_IA64_SN_L1_H */
diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h
index e67825ad1930..6f96ae8b4fbe 100644
--- a/include/asm-ia64/sn/sn_sal.h
+++ b/include/asm-ia64/sn/sn_sal.h
@@ -47,6 +47,7 @@
47#define SN_SAL_CONSOLE_PUTB 0x02000028 47#define SN_SAL_CONSOLE_PUTB 0x02000028
48#define SN_SAL_CONSOLE_XMIT_CHARS 0x0200002a 48#define SN_SAL_CONSOLE_XMIT_CHARS 0x0200002a
49#define SN_SAL_CONSOLE_READC 0x0200002b 49#define SN_SAL_CONSOLE_READC 0x0200002b
50#define SN_SAL_SYSCTL_OP 0x02000030
50#define SN_SAL_SYSCTL_MODID_GET 0x02000031 51#define SN_SAL_SYSCTL_MODID_GET 0x02000031
51#define SN_SAL_SYSCTL_GET 0x02000032 52#define SN_SAL_SYSCTL_GET 0x02000032
52#define SN_SAL_SYSCTL_IOBRICK_MODULE_GET 0x02000033 53#define SN_SAL_SYSCTL_IOBRICK_MODULE_GET 0x02000033
@@ -98,6 +99,13 @@
98#define SAL_INTR_FREE 2 99#define SAL_INTR_FREE 2
99 100
100/* 101/*
102 * operations available on the generic SN_SAL_SYSCTL_OP
103 * runtime service
104 */
105#define SAL_SYSCTL_OP_IOBOARD 0x0001 /* retrieve board type */
106#define SAL_SYSCTL_OP_TIO_JLCK_RST 0x0002 /* issue TIO clock reset */
107
108/*
101 * IRouter (i.e. generalized system controller) operations 109 * IRouter (i.e. generalized system controller) operations
102 */ 110 */
103#define SAL_IROUTER_OPEN 0 /* open a subchannel */ 111#define SAL_IROUTER_OPEN 0 /* open a subchannel */
@@ -876,6 +884,41 @@ ia64_sn_sysctl_event_init(nasid_t nasid)
876 return (int) rv.v0; 884 return (int) rv.v0;
877} 885}
878 886
887/*
888 * Ask the system controller on the specified nasid to reset
889 * the CX corelet clock. Only valid on TIO nodes.
890 */
891static inline int
892ia64_sn_sysctl_tio_clock_reset(nasid_t nasid)
893{
894 struct ia64_sal_retval rv;
895 SAL_CALL_REENTRANT(rv, SN_SAL_SYSCTL_OP, SAL_SYSCTL_OP_TIO_JLCK_RST,
896 nasid, 0, 0, 0, 0, 0);
897 if (rv.status != 0)
898 return (int)rv.status;
899 if (rv.v0 != 0)
900 return (int)rv.v0;
901
902 return 0;
903}
904
905/*
906 * Get the associated ioboard type for a given nasid.
907 */
908static inline int
909ia64_sn_sysctl_ioboard_get(nasid_t nasid)
910{
911 struct ia64_sal_retval rv;
912 SAL_CALL_REENTRANT(rv, SN_SAL_SYSCTL_OP, SAL_SYSCTL_OP_IOBOARD,
913 nasid, 0, 0, 0, 0, 0);
914 if (rv.v0 != 0)
915 return (int)rv.v0;
916 if (rv.v1 != 0)
917 return (int)rv.v1;
918
919 return 0;
920}
921
879/** 922/**
880 * ia64_sn_get_fit_compt - read a FIT entry from the PROM header 923 * ia64_sn_get_fit_compt - read a FIT entry from the PROM header
881 * @nasid: NASID of node to read 924 * @nasid: NASID of node to read
diff --git a/include/asm-ia64/sn/tiocx.h b/include/asm-ia64/sn/tiocx.h
index c5447a504509..5699e75e5024 100644
--- a/include/asm-ia64/sn/tiocx.h
+++ b/include/asm-ia64/sn/tiocx.h
@@ -19,6 +19,7 @@ struct cx_id_s {
19 19
20struct cx_dev { 20struct cx_dev {
21 struct cx_id_s cx_id; 21 struct cx_id_s cx_id;
22 int bt; /* board/blade type */
22 void *soft; /* driver specific */ 23 void *soft; /* driver specific */
23 struct hubdev_info *hubdev; 24 struct hubdev_info *hubdev;
24 struct device dev; 25 struct device dev;
@@ -59,7 +60,7 @@ struct cx_drv {
59extern struct sn_irq_info *tiocx_irq_alloc(nasid_t, int, int, nasid_t, int); 60extern struct sn_irq_info *tiocx_irq_alloc(nasid_t, int, int, nasid_t, int);
60extern void tiocx_irq_free(struct sn_irq_info *); 61extern void tiocx_irq_free(struct sn_irq_info *);
61extern int cx_device_unregister(struct cx_dev *); 62extern int cx_device_unregister(struct cx_dev *);
62extern int cx_device_register(nasid_t, int, int, struct hubdev_info *); 63extern int cx_device_register(nasid_t, int, int, struct hubdev_info *, int);
63extern int cx_driver_unregister(struct cx_drv *); 64extern int cx_driver_unregister(struct cx_drv *);
64extern int cx_driver_register(struct cx_drv *); 65extern int cx_driver_register(struct cx_drv *);
65extern uint64_t tiocx_dma_addr(uint64_t addr); 66extern uint64_t tiocx_dma_addr(uint64_t addr);