diff options
author | Alexandre Bounine <alexandre.bounine@idt.com> | 2011-08-25 18:59:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-08-25 19:25:34 -0400 |
commit | 284fb68d00c56e971ed01e0b4bac5ddd4d1b74ab (patch) | |
tree | 5cdfea6c179aa0ed315ba171d924b9dc513dd2e3 | |
parent | 439423f6894aa0dec22187526827456f5004baed (diff) |
rapidio: fix use of non-compatible registers
Replace/remove use of RIO v.1.2 registers/bits that are not
forward-compatible with newer versions of RapidIO specification.
RapidIO specification v.1.3 removed Write Port CSR, Doorbell CSR,
Mailbox CSR and Mailbox and Doorbell bits of the PEF CAR.
Use of removed (since RIO v.1.3) register bits affects users of
currently available 1.3 and 2.x compliant devices who may use not so
recent kernel versions.
Removing checks for unsupported bits makes corresponding routines
compatible with all versions of RapidIO specification. Therefore,
backporting makes stable kernel versions compliant with RIO v.1.3 and
later as well.
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Li Yang <leoli@freescale.com>
Cc: Thomas Moll <thomas.moll@sysgo.com>
Cc: Chul Kim <chul.kim@idt.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/net/rionet.c | 23 | ||||
-rw-r--r-- | drivers/rapidio/rio-scan.c | 3 | ||||
-rw-r--r-- | include/linux/rio_regs.h | 18 |
3 files changed, 18 insertions, 26 deletions
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c index 86ac38c96bcf..3bb131137033 100644 --- a/drivers/net/rionet.c +++ b/drivers/net/rionet.c | |||
@@ -80,13 +80,13 @@ static int rionet_capable = 1; | |||
80 | */ | 80 | */ |
81 | static struct rio_dev **rionet_active; | 81 | static struct rio_dev **rionet_active; |
82 | 82 | ||
83 | #define is_rionet_capable(pef, src_ops, dst_ops) \ | 83 | #define is_rionet_capable(src_ops, dst_ops) \ |
84 | ((pef & RIO_PEF_INB_MBOX) && \ | 84 | ((src_ops & RIO_SRC_OPS_DATA_MSG) && \ |
85 | (pef & RIO_PEF_INB_DOORBELL) && \ | 85 | (dst_ops & RIO_DST_OPS_DATA_MSG) && \ |
86 | (src_ops & RIO_SRC_OPS_DOORBELL) && \ | 86 | (src_ops & RIO_SRC_OPS_DOORBELL) && \ |
87 | (dst_ops & RIO_DST_OPS_DOORBELL)) | 87 | (dst_ops & RIO_DST_OPS_DOORBELL)) |
88 | #define dev_rionet_capable(dev) \ | 88 | #define dev_rionet_capable(dev) \ |
89 | is_rionet_capable(dev->pef, dev->src_ops, dev->dst_ops) | 89 | is_rionet_capable(dev->src_ops, dev->dst_ops) |
90 | 90 | ||
91 | #define RIONET_MAC_MATCH(x) (*(u32 *)x == 0x00010001) | 91 | #define RIONET_MAC_MATCH(x) (*(u32 *)x == 0x00010001) |
92 | #define RIONET_GET_DESTID(x) (*(u16 *)(x + 4)) | 92 | #define RIONET_GET_DESTID(x) (*(u16 *)(x + 4)) |
@@ -282,7 +282,6 @@ static int rionet_open(struct net_device *ndev) | |||
282 | { | 282 | { |
283 | int i, rc = 0; | 283 | int i, rc = 0; |
284 | struct rionet_peer *peer, *tmp; | 284 | struct rionet_peer *peer, *tmp; |
285 | u32 pwdcsr; | ||
286 | struct rionet_private *rnet = netdev_priv(ndev); | 285 | struct rionet_private *rnet = netdev_priv(ndev); |
287 | 286 | ||
288 | if (netif_msg_ifup(rnet)) | 287 | if (netif_msg_ifup(rnet)) |
@@ -332,13 +331,8 @@ static int rionet_open(struct net_device *ndev) | |||
332 | continue; | 331 | continue; |
333 | } | 332 | } |
334 | 333 | ||
335 | /* | 334 | /* Send a join message */ |
336 | * If device has initialized inbound doorbells, | 335 | rio_send_doorbell(peer->rdev, RIONET_DOORBELL_JOIN); |
337 | * send a join message | ||
338 | */ | ||
339 | rio_read_config_32(peer->rdev, RIO_WRITE_PORT_CSR, &pwdcsr); | ||
340 | if (pwdcsr & RIO_DOORBELL_AVAIL) | ||
341 | rio_send_doorbell(peer->rdev, RIONET_DOORBELL_JOIN); | ||
342 | } | 336 | } |
343 | 337 | ||
344 | out: | 338 | out: |
@@ -492,7 +486,7 @@ static int rionet_setup_netdev(struct rio_mport *mport, struct net_device *ndev) | |||
492 | static int rionet_probe(struct rio_dev *rdev, const struct rio_device_id *id) | 486 | static int rionet_probe(struct rio_dev *rdev, const struct rio_device_id *id) |
493 | { | 487 | { |
494 | int rc = -ENODEV; | 488 | int rc = -ENODEV; |
495 | u32 lpef, lsrc_ops, ldst_ops; | 489 | u32 lsrc_ops, ldst_ops; |
496 | struct rionet_peer *peer; | 490 | struct rionet_peer *peer; |
497 | struct net_device *ndev = NULL; | 491 | struct net_device *ndev = NULL; |
498 | 492 | ||
@@ -515,12 +509,11 @@ static int rionet_probe(struct rio_dev *rdev, const struct rio_device_id *id) | |||
515 | * on later probes | 509 | * on later probes |
516 | */ | 510 | */ |
517 | if (!rionet_check) { | 511 | if (!rionet_check) { |
518 | rio_local_read_config_32(rdev->net->hport, RIO_PEF_CAR, &lpef); | ||
519 | rio_local_read_config_32(rdev->net->hport, RIO_SRC_OPS_CAR, | 512 | rio_local_read_config_32(rdev->net->hport, RIO_SRC_OPS_CAR, |
520 | &lsrc_ops); | 513 | &lsrc_ops); |
521 | rio_local_read_config_32(rdev->net->hport, RIO_DST_OPS_CAR, | 514 | rio_local_read_config_32(rdev->net->hport, RIO_DST_OPS_CAR, |
522 | &ldst_ops); | 515 | &ldst_ops); |
523 | if (!is_rionet_capable(lpef, lsrc_ops, ldst_ops)) { | 516 | if (!is_rionet_capable(lsrc_ops, ldst_ops)) { |
524 | printk(KERN_ERR | 517 | printk(KERN_ERR |
525 | "%s: local device is not network capable\n", | 518 | "%s: local device is not network capable\n", |
526 | DRV_NAME); | 519 | DRV_NAME); |
diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c index ee893581d4b7..ebe77dd87daf 100644 --- a/drivers/rapidio/rio-scan.c +++ b/drivers/rapidio/rio-scan.c | |||
@@ -505,8 +505,7 @@ static struct rio_dev __devinit *rio_setup_device(struct rio_net *net, | |||
505 | rdev->dev.dma_mask = &rdev->dma_mask; | 505 | rdev->dev.dma_mask = &rdev->dma_mask; |
506 | rdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | 506 | rdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); |
507 | 507 | ||
508 | if ((rdev->pef & RIO_PEF_INB_DOORBELL) && | 508 | if (rdev->dst_ops & RIO_DST_OPS_DOORBELL) |
509 | (rdev->dst_ops & RIO_DST_OPS_DOORBELL)) | ||
510 | rio_init_dbell_res(&rdev->riores[RIO_DOORBELL_RESOURCE], | 509 | rio_init_dbell_res(&rdev->riores[RIO_DOORBELL_RESOURCE], |
511 | 0, 0xffff); | 510 | 0, 0xffff); |
512 | 511 | ||
diff --git a/include/linux/rio_regs.h b/include/linux/rio_regs.h index 9026b30238f3..218168a2b5e9 100644 --- a/include/linux/rio_regs.h +++ b/include/linux/rio_regs.h | |||
@@ -36,12 +36,12 @@ | |||
36 | #define RIO_PEF_PROCESSOR 0x20000000 /* [I] Processor */ | 36 | #define RIO_PEF_PROCESSOR 0x20000000 /* [I] Processor */ |
37 | #define RIO_PEF_SWITCH 0x10000000 /* [I] Switch */ | 37 | #define RIO_PEF_SWITCH 0x10000000 /* [I] Switch */ |
38 | #define RIO_PEF_MULTIPORT 0x08000000 /* [VI, 2.1] Multiport */ | 38 | #define RIO_PEF_MULTIPORT 0x08000000 /* [VI, 2.1] Multiport */ |
39 | #define RIO_PEF_INB_MBOX 0x00f00000 /* [II] Mailboxes */ | 39 | #define RIO_PEF_INB_MBOX 0x00f00000 /* [II, <= 1.2] Mailboxes */ |
40 | #define RIO_PEF_INB_MBOX0 0x00800000 /* [II] Mailbox 0 */ | 40 | #define RIO_PEF_INB_MBOX0 0x00800000 /* [II, <= 1.2] Mailbox 0 */ |
41 | #define RIO_PEF_INB_MBOX1 0x00400000 /* [II] Mailbox 1 */ | 41 | #define RIO_PEF_INB_MBOX1 0x00400000 /* [II, <= 1.2] Mailbox 1 */ |
42 | #define RIO_PEF_INB_MBOX2 0x00200000 /* [II] Mailbox 2 */ | 42 | #define RIO_PEF_INB_MBOX2 0x00200000 /* [II, <= 1.2] Mailbox 2 */ |
43 | #define RIO_PEF_INB_MBOX3 0x00100000 /* [II] Mailbox 3 */ | 43 | #define RIO_PEF_INB_MBOX3 0x00100000 /* [II, <= 1.2] Mailbox 3 */ |
44 | #define RIO_PEF_INB_DOORBELL 0x00080000 /* [II] Doorbells */ | 44 | #define RIO_PEF_INB_DOORBELL 0x00080000 /* [II, <= 1.2] Doorbells */ |
45 | #define RIO_PEF_EXT_RT 0x00000200 /* [III, 1.3] Extended route table support */ | 45 | #define RIO_PEF_EXT_RT 0x00000200 /* [III, 1.3] Extended route table support */ |
46 | #define RIO_PEF_STD_RT 0x00000100 /* [III, 1.3] Standard route table support */ | 46 | #define RIO_PEF_STD_RT 0x00000100 /* [III, 1.3] Standard route table support */ |
47 | #define RIO_PEF_CTLS 0x00000010 /* [III] CTLS */ | 47 | #define RIO_PEF_CTLS 0x00000010 /* [III] CTLS */ |
@@ -102,7 +102,7 @@ | |||
102 | #define RIO_SWITCH_RT_LIMIT 0x34 /* [III, 1.3] Switch Route Table Destination ID Limit CAR */ | 102 | #define RIO_SWITCH_RT_LIMIT 0x34 /* [III, 1.3] Switch Route Table Destination ID Limit CAR */ |
103 | #define RIO_RT_MAX_DESTID 0x0000ffff | 103 | #define RIO_RT_MAX_DESTID 0x0000ffff |
104 | 104 | ||
105 | #define RIO_MBOX_CSR 0x40 /* [II] Mailbox CSR */ | 105 | #define RIO_MBOX_CSR 0x40 /* [II, <= 1.2] Mailbox CSR */ |
106 | #define RIO_MBOX0_AVAIL 0x80000000 /* [II] Mbox 0 avail */ | 106 | #define RIO_MBOX0_AVAIL 0x80000000 /* [II] Mbox 0 avail */ |
107 | #define RIO_MBOX0_FULL 0x40000000 /* [II] Mbox 0 full */ | 107 | #define RIO_MBOX0_FULL 0x40000000 /* [II] Mbox 0 full */ |
108 | #define RIO_MBOX0_EMPTY 0x20000000 /* [II] Mbox 0 empty */ | 108 | #define RIO_MBOX0_EMPTY 0x20000000 /* [II] Mbox 0 empty */ |
@@ -128,8 +128,8 @@ | |||
128 | #define RIO_MBOX3_FAIL 0x00000008 /* [II] Mbox 3 fail */ | 128 | #define RIO_MBOX3_FAIL 0x00000008 /* [II] Mbox 3 fail */ |
129 | #define RIO_MBOX3_ERROR 0x00000004 /* [II] Mbox 3 error */ | 129 | #define RIO_MBOX3_ERROR 0x00000004 /* [II] Mbox 3 error */ |
130 | 130 | ||
131 | #define RIO_WRITE_PORT_CSR 0x44 /* [I] Write Port CSR */ | 131 | #define RIO_WRITE_PORT_CSR 0x44 /* [I, <= 1.2] Write Port CSR */ |
132 | #define RIO_DOORBELL_CSR 0x44 /* [II] Doorbell CSR */ | 132 | #define RIO_DOORBELL_CSR 0x44 /* [II, <= 1.2] Doorbell CSR */ |
133 | #define RIO_DOORBELL_AVAIL 0x80000000 /* [II] Doorbell avail */ | 133 | #define RIO_DOORBELL_AVAIL 0x80000000 /* [II] Doorbell avail */ |
134 | #define RIO_DOORBELL_FULL 0x40000000 /* [II] Doorbell full */ | 134 | #define RIO_DOORBELL_FULL 0x40000000 /* [II] Doorbell full */ |
135 | #define RIO_DOORBELL_EMPTY 0x20000000 /* [II] Doorbell empty */ | 135 | #define RIO_DOORBELL_EMPTY 0x20000000 /* [II] Doorbell empty */ |