aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMatt Porter <mporter@kernel.crashing.org>2005-11-07 04:00:18 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:53:46 -0500
commitfa78cc51794912b7e6ee98cd823fcc84cf79d04a (patch)
tree89366fdfc1c1cd48923c72464f38d8d1e2321f6b /drivers
parenteb188d0e857c436b5d365d5ccc629da5a06ed102 (diff)
[PATCH] rapidio: core updates
Addresses issues raised with the 2.6.12-rc6-mm1 RIO support. Fix dma_mask init, shrink some code, general cleanup. Signed-off-by: Matt Porter <mporter@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/rapidio/rio-scan.c35
-rw-r--r--drivers/rapidio/rio.h3
2 files changed, 13 insertions, 25 deletions
diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c
index 20e1d8f74597..4f7ed4bd3be9 100644
--- a/drivers/rapidio/rio-scan.c
+++ b/drivers/rapidio/rio-scan.c
@@ -15,6 +15,7 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16 16
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/dma-mapping.h>
18#include <linux/init.h> 19#include <linux/init.h>
19#include <linux/rio.h> 20#include <linux/rio.h>
20#include <linux/rio_drv.h> 21#include <linux/rio_drv.h>
@@ -33,7 +34,8 @@ static LIST_HEAD(rio_switches);
33 34
34static void rio_enum_timeout(unsigned long); 35static void rio_enum_timeout(unsigned long);
35 36
36spinlock_t rio_global_list_lock = SPIN_LOCK_UNLOCKED; 37DEFINE_SPINLOCK(rio_global_list_lock);
38
37static int next_destid = 0; 39static int next_destid = 0;
38static int next_switchid = 0; 40static int next_switchid = 0;
39static int next_net = 0; 41static int next_net = 0;
@@ -55,9 +57,6 @@ static int rio_sport_phys_table[] = {
55 -1, 57 -1,
56}; 58};
57 59
58extern struct rio_route_ops __start_rio_route_ops[];
59extern struct rio_route_ops __end_rio_route_ops[];
60
61/** 60/**
62 * rio_get_device_id - Get the base/extended device id for a device 61 * rio_get_device_id - Get the base/extended device id for a device
63 * @port: RIO master port 62 * @port: RIO master port
@@ -85,8 +84,7 @@ static u16 rio_get_device_id(struct rio_mport *port, u16 destid, u8 hopcount)
85 * 84 *
86 * Writes the base/extended device id from a device. 85 * Writes the base/extended device id from a device.
87 */ 86 */
88static void 87static void rio_set_device_id(struct rio_mport *port, u16 destid, u8 hopcount, u16 did)
89rio_set_device_id(struct rio_mport *port, u16 destid, u8 hopcount, u16 did)
90{ 88{
91 rio_mport_write_config_32(port, destid, hopcount, RIO_DID_CSR, 89 rio_mport_write_config_32(port, destid, hopcount, RIO_DID_CSR,
92 RIO_SET_DID(did)); 90 RIO_SET_DID(did));
@@ -192,23 +190,9 @@ static int rio_enum_host(struct rio_mport *port)
192static int rio_device_has_destid(struct rio_mport *port, int src_ops, 190static int rio_device_has_destid(struct rio_mport *port, int src_ops,
193 int dst_ops) 191 int dst_ops)
194{ 192{
195 if (((src_ops & RIO_SRC_OPS_READ) || 193 u32 mask = RIO_OPS_READ | RIO_OPS_WRITE | RIO_OPS_ATOMIC_TST_SWP | RIO_OPS_ATOMIC_INC | RIO_OPS_ATOMIC_DEC | RIO_OPS_ATOMIC_SET | RIO_OPS_ATOMIC_CLR;
196 (src_ops & RIO_SRC_OPS_WRITE) || 194
197 (src_ops & RIO_SRC_OPS_ATOMIC_TST_SWP) || 195 return !!((src_ops | dst_ops) & mask);
198 (src_ops & RIO_SRC_OPS_ATOMIC_INC) ||
199 (src_ops & RIO_SRC_OPS_ATOMIC_DEC) ||
200 (src_ops & RIO_SRC_OPS_ATOMIC_SET) ||
201 (src_ops & RIO_SRC_OPS_ATOMIC_CLR)) &&
202 ((dst_ops & RIO_DST_OPS_READ) ||
203 (dst_ops & RIO_DST_OPS_WRITE) ||
204 (dst_ops & RIO_DST_OPS_ATOMIC_TST_SWP) ||
205 (dst_ops & RIO_DST_OPS_ATOMIC_INC) ||
206 (dst_ops & RIO_DST_OPS_ATOMIC_DEC) ||
207 (dst_ops & RIO_DST_OPS_ATOMIC_SET) ||
208 (dst_ops & RIO_DST_OPS_ATOMIC_CLR))) {
209 return 1;
210 } else
211 return 0;
212} 196}
213 197
214/** 198/**
@@ -383,8 +367,9 @@ static struct rio_dev *rio_setup_device(struct rio_net *net,
383 rdev->dev.release = rio_release_dev; 367 rdev->dev.release = rio_release_dev;
384 rio_dev_get(rdev); 368 rio_dev_get(rdev);
385 369
386 rdev->dev.dma_mask = (u64 *) 0xffffffff; 370 rdev->dma_mask = DMA_32BIT_MASK;
387 rdev->dev.coherent_dma_mask = 0xffffffffULL; 371 rdev->dev.dma_mask = &rdev->dma_mask;
372 rdev->dev.coherent_dma_mask = DMA_32BIT_MASK;
388 373
389 if ((rdev->pef & RIO_PEF_INB_DOORBELL) && 374 if ((rdev->pef & RIO_PEF_INB_DOORBELL) &&
390 (rdev->dst_ops & RIO_DST_OPS_DOORBELL)) 375 (rdev->dst_ops & RIO_DST_OPS_DOORBELL))
diff --git a/drivers/rapidio/rio.h b/drivers/rapidio/rio.h
index f865a68cd3d5..b242cee656e7 100644
--- a/drivers/rapidio/rio.h
+++ b/drivers/rapidio/rio.h
@@ -26,6 +26,9 @@ extern int rio_disc_mport(struct rio_mport *mport);
26extern struct device_attribute rio_dev_attrs[]; 26extern struct device_attribute rio_dev_attrs[];
27extern spinlock_t rio_global_list_lock; 27extern spinlock_t rio_global_list_lock;
28 28
29extern struct rio_route_ops __start_rio_route_ops[];
30extern struct rio_route_ops __end_rio_route_ops[];
31
29/* Helpers internal to the RIO core code */ 32/* Helpers internal to the RIO core code */
30#define DECLARE_RIO_ROUTE_SECTION(section, vid, did, add_hook, get_hook) \ 33#define DECLARE_RIO_ROUTE_SECTION(section, vid, did, add_hook, get_hook) \
31 static struct rio_route_ops __rio_route_ops __attribute_used__ \ 34 static struct rio_route_ops __rio_route_ops __attribute_used__ \