aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-08 13:04:20 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-08 13:04:20 -0500
commit21eb4fa1700112d1420d72e1de708af671a251c8 (patch)
tree3afd9f526da50108c27e05ac69826be5e7c2ad6e /drivers
parent0c0e8caf9fd6c9a49fb9fbdba14a8b7b4239adde (diff)
parentd003e7a1a569501cbe9a5ca14748177498c4893a (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/paulus/powerpc
* master.kernel.org:/pub/scm/linux/kernel/git/paulus/powerpc: (116 commits) [POWERPC] Add export of vgacon_remap_base [POWERPC] Remove bogus comment about page_is_ram [POWERPC] windfarm: don't die on suspend thread signal [POWERPC] Fix comment in kernel/irq.c [POWERPC] ppc: Fix booke watchdog initialization [POWERPC] PPC: Use ARRAY_SIZE macro when appropriate [POWERPC] Use ARRAY_SIZE macro when appropriate [POWERPC] Fix ppc64's writing to struct file_operations [POWERPC] ppc: use syslog macro for the printk log level [POWERPC] ppc: cs4218_tdm remove extra brace [POWERPC] Add mpc52xx/lite5200 PCI support [POWERPC] Only use H_BULK_REMOVE if the firmware supports it [POWERPC] Fixup error handling when emulating a floating point instruction [POWERPC] Enable interrupts if we are doing fp math emulation [POWERPC] Added kprobes support to ppc32 [POWERPC] Make pSeries use the H_BULK_REMOVE hypervisor call [POWERPC] Clear RI bit in MSR before restoring r13 when returning to userspace [POWERPC] Fix performance monitor exception [POWERPC] Compile fixes for arch/powerpc dcr code [POWERPC] Maple: use mmio nvram ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/Kconfig7
-rw-r--r--drivers/char/Makefile1
-rw-r--r--drivers/char/hvc_beat.c134
-rw-r--r--drivers/char/watchdog/booke_wdt.c20
-rw-r--r--drivers/macintosh/windfarm_core.c6
-rw-r--r--drivers/net/fs_enet/fs_enet.h1
-rw-r--r--drivers/net/gianfar_ethtool.c2
-rw-r--r--drivers/ps3/Makefile1
-rw-r--r--drivers/ps3/system-bus.c362
-rw-r--r--drivers/ps3/vuart.c4
-rw-r--r--drivers/ps3/vuart.h38
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_cpm1.c15
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_cpm1.h3
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_cpm2.h3
14 files changed, 167 insertions, 430 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 9e43e39dc35c..d08bb4ee1307 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -610,6 +610,13 @@ config HVC_RTAS
610 help 610 help
611 IBM Console device driver which makes use of RTAS 611 IBM Console device driver which makes use of RTAS
612 612
613config HVC_BEAT
614 bool "Toshiba's Beat Hypervisor Console support"
615 depends on PPC_CELLEB
616 select HVC_DRIVER
617 help
618 Toshiba's Cell Reference Set Beat Console device driver
619
613config HVCS 620config HVCS
614 tristate "IBM Hypervisor Virtual Console Server support" 621 tristate "IBM Hypervisor Virtual Console Server support"
615 depends on PPC_PSERIES 622 depends on PPC_PSERIES
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index fc110637ced6..0326ca1a848a 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -45,6 +45,7 @@ obj-$(CONFIG_RIO) += rio/ generic_serial.o
45obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o 45obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o
46obj-$(CONFIG_HVC_ISERIES) += hvc_iseries.o 46obj-$(CONFIG_HVC_ISERIES) += hvc_iseries.o
47obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o 47obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o
48obj-$(CONFIG_HVC_BEAT) += hvc_beat.o
48obj-$(CONFIG_HVC_DRIVER) += hvc_console.o 49obj-$(CONFIG_HVC_DRIVER) += hvc_console.o
49obj-$(CONFIG_RAW_DRIVER) += raw.o 50obj-$(CONFIG_RAW_DRIVER) += raw.o
50obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o 51obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o
diff --git a/drivers/char/hvc_beat.c b/drivers/char/hvc_beat.c
new file mode 100644
index 000000000000..6f019f19be71
--- /dev/null
+++ b/drivers/char/hvc_beat.c
@@ -0,0 +1,134 @@
1/*
2 * Beat hypervisor console driver
3 *
4 * (C) Copyright 2006 TOSHIBA CORPORATION
5 *
6 * This code is based on drivers/char/hvc_rtas.c:
7 * (C) Copyright IBM Corporation 2001-2005
8 * (C) Copyright Red Hat, Inc. 2005
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 */
24
25#include <linux/module.h>
26#include <linux/init.h>
27#include <linux/err.h>
28#include <linux/string.h>
29#include <linux/console.h>
30#include <asm/prom.h>
31#include <asm/hvconsole.h>
32#include <asm/firmware.h>
33
34#include "hvc_console.h"
35
36extern int64_t beat_get_term_char(uint64_t, uint64_t *, uint64_t *, uint64_t *);
37extern int64_t beat_put_term_char(uint64_t, uint64_t, uint64_t, uint64_t);
38
39struct hvc_struct *hvc_beat_dev = NULL;
40
41/* bug: only one queue is available regardless of vtermno */
42static int hvc_beat_get_chars(uint32_t vtermno, char *buf, int cnt)
43{
44 static unsigned char q[sizeof(unsigned long) * 2]
45 __attribute__((aligned(sizeof(unsigned long))));
46 static int qlen = 0;
47 unsigned long got;
48
49again:
50 if (qlen) {
51 if (qlen > cnt) {
52 memcpy(buf, q, cnt);
53 qlen -= cnt;
54 memmove(q + cnt, q, qlen);
55 return cnt;
56 } else { /* qlen <= cnt */
57 int r;
58
59 memcpy(buf, q, qlen);
60 r = qlen;
61 qlen = 0;
62 return r;
63 }
64 }
65 if (beat_get_term_char(vtermno, &got,
66 ((unsigned long *)q), ((unsigned long *)q) + 1) == 0) {
67 qlen = got;
68 goto again;
69 }
70 return 0;
71}
72
73static int hvc_beat_put_chars(uint32_t vtermno, const char *buf, int cnt)
74{
75 unsigned long kb[2];
76 int rest, nlen;
77
78 for (rest = cnt; rest > 0; rest -= nlen) {
79 nlen = (rest > 16) ? 16 : rest;
80 memcpy(kb, buf, nlen);
81 beat_put_term_char(vtermno, rest, kb[0], kb[1]);
82 rest -= nlen;
83 }
84 return cnt;
85}
86
87static struct hv_ops hvc_beat_get_put_ops = {
88 .get_chars = hvc_beat_get_chars,
89 .put_chars = hvc_beat_put_chars,
90};
91
92static int hvc_beat_useit = 1;
93
94static int hvc_beat_config(char *p)
95{
96 hvc_beat_useit = simple_strtoul(p, NULL, 0);
97 return 0;
98}
99
100static int hvc_beat_console_init(void)
101{
102 if (hvc_beat_useit && machine_is_compatible("Beat")) {
103 hvc_instantiate(0, 0, &hvc_beat_get_put_ops);
104 }
105 return 0;
106}
107
108/* temp */
109static int hvc_beat_init(void)
110{
111 struct hvc_struct *hp;
112
113 if (!firmware_has_feature(FW_FEATURE_BEAT))
114 return -ENODEV;
115
116 hp = hvc_alloc(0, NO_IRQ, &hvc_beat_get_put_ops, 16);
117 if (IS_ERR(hp))
118 return PTR_ERR(hp);
119 hvc_beat_dev = hp;
120 return 0;
121}
122
123static void __exit hvc_beat_exit(void)
124{
125 if (hvc_beat_dev)
126 hvc_remove(hvc_beat_dev);
127}
128
129module_init(hvc_beat_init);
130module_exit(hvc_beat_exit);
131
132__setup("hvc_beat=", hvc_beat_config);
133
134console_initcall(hvc_beat_console_init);
diff --git a/drivers/char/watchdog/booke_wdt.c b/drivers/char/watchdog/booke_wdt.c
index 488902231cc2..0e23f29f71ab 100644
--- a/drivers/char/watchdog/booke_wdt.c
+++ b/drivers/char/watchdog/booke_wdt.c
@@ -35,7 +35,7 @@
35#ifdef CONFIG_FSL_BOOKE 35#ifdef CONFIG_FSL_BOOKE
36#define WDT_PERIOD_DEFAULT 63 /* Ex. wdt_period=28 bus=333Mhz , reset=~40sec */ 36#define WDT_PERIOD_DEFAULT 63 /* Ex. wdt_period=28 bus=333Mhz , reset=~40sec */
37#else 37#else
38#define WDT_PERIOD_DEFAULT 4 /* Refer to the PPC40x and PPC4xx manuals */ 38#define WDT_PERIOD_DEFAULT 3 /* Refer to the PPC40x and PPC4xx manuals */
39#endif /* for timing information */ 39#endif /* for timing information */
40 40
41u32 booke_wdt_enabled = 0; 41u32 booke_wdt_enabled = 0;
@@ -48,12 +48,22 @@ u32 booke_wdt_period = WDT_PERIOD_DEFAULT;
48#endif 48#endif
49 49
50/* 50/*
51 * booke_wdt_ping:
52 */
53static __inline__ void booke_wdt_ping(void)
54{
55 mtspr(SPRN_TSR, TSR_ENW|TSR_WIS);
56}
57
58/*
51 * booke_wdt_enable: 59 * booke_wdt_enable:
52 */ 60 */
53static __inline__ void booke_wdt_enable(void) 61static __inline__ void booke_wdt_enable(void)
54{ 62{
55 u32 val; 63 u32 val;
56 64
65 /* clear status before enabling watchdog */
66 booke_wdt_ping();
57 val = mfspr(SPRN_TCR); 67 val = mfspr(SPRN_TCR);
58 val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period)); 68 val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period));
59 69
@@ -61,14 +71,6 @@ static __inline__ void booke_wdt_enable(void)
61} 71}
62 72
63/* 73/*
64 * booke_wdt_ping:
65 */
66static __inline__ void booke_wdt_ping(void)
67{
68 mtspr(SPRN_TSR, TSR_ENW|TSR_WIS);
69}
70
71/*
72 * booke_wdt_write: 74 * booke_wdt_write:
73 */ 75 */
74static ssize_t booke_wdt_write (struct file *file, const char __user *buf, 76static ssize_t booke_wdt_write (struct file *file, const char __user *buf,
diff --git a/drivers/macintosh/windfarm_core.c b/drivers/macintosh/windfarm_core.c
index e947af982f93..94c117ef20c1 100644
--- a/drivers/macintosh/windfarm_core.c
+++ b/drivers/macintosh/windfarm_core.c
@@ -94,8 +94,6 @@ static int wf_thread_func(void *data)
94 DBG("wf: thread started\n"); 94 DBG("wf: thread started\n");
95 95
96 while(!kthread_should_stop()) { 96 while(!kthread_should_stop()) {
97 try_to_freeze();
98
99 if (time_after_eq(jiffies, next)) { 97 if (time_after_eq(jiffies, next)) {
100 wf_notify(WF_EVENT_TICK, NULL); 98 wf_notify(WF_EVENT_TICK, NULL);
101 if (wf_overtemp) { 99 if (wf_overtemp) {
@@ -118,8 +116,8 @@ static int wf_thread_func(void *data)
118 if (delay <= HZ) 116 if (delay <= HZ)
119 schedule_timeout_interruptible(delay); 117 schedule_timeout_interruptible(delay);
120 118
121 /* there should be no signal, but oh well */ 119 /* there should be no non-suspend signal, but oh well */
122 if (signal_pending(current)) { 120 if (signal_pending(current) && !try_to_freeze()) {
123 printk(KERN_WARNING "windfarm: thread got sigl !\n"); 121 printk(KERN_WARNING "windfarm: thread got sigl !\n");
124 break; 122 break;
125 } 123 }
diff --git a/drivers/net/fs_enet/fs_enet.h b/drivers/net/fs_enet/fs_enet.h
index 92590d8fc24b..569be225cd05 100644
--- a/drivers/net/fs_enet/fs_enet.h
+++ b/drivers/net/fs_enet/fs_enet.h
@@ -9,6 +9,7 @@
9#include <linux/dma-mapping.h> 9#include <linux/dma-mapping.h>
10 10
11#include <linux/fs_enet_pd.h> 11#include <linux/fs_enet_pd.h>
12#include <asm/fs_pd.h>
12 13
13#ifdef CONFIG_CPM1 14#ifdef CONFIG_CPM1
14#include <asm/commproc.h> 15#include <asm/commproc.h>
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
index 6d71bea5e900..0d6943d67096 100644
--- a/drivers/net/gianfar_ethtool.c
+++ b/drivers/net/gianfar_ethtool.c
@@ -42,8 +42,6 @@
42 42
43#include "gianfar.h" 43#include "gianfar.h"
44 44
45#define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0))
46
47extern void gfar_start(struct net_device *dev); 45extern void gfar_start(struct net_device *dev);
48extern int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit); 46extern int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit);
49 47
diff --git a/drivers/ps3/Makefile b/drivers/ps3/Makefile
index 8433eb7562cb..d547cf50ca9d 100644
--- a/drivers/ps3/Makefile
+++ b/drivers/ps3/Makefile
@@ -1,2 +1 @@
1obj-y += system-bus.o
2obj-$(CONFIG_PS3_VUART) += vuart.o obj-$(CONFIG_PS3_VUART) += vuart.o
diff --git a/drivers/ps3/system-bus.c b/drivers/ps3/system-bus.c
deleted file mode 100644
index d79f949bcb2a..000000000000
--- a/drivers/ps3/system-bus.c
+++ /dev/null
@@ -1,362 +0,0 @@
1/*
2 * PS3 system bus driver.
3 *
4 * Copyright (C) 2006 Sony Computer Entertainment Inc.
5 * Copyright 2006 Sony Corp.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/module.h>
24#include <linux/dma-mapping.h>
25#include <linux/err.h>
26
27#include <asm/udbg.h>
28#include <asm/ps3.h>
29#include <asm/lv1call.h>
30#include <asm/firmware.h>
31
32#define dump_mmio_region(_a) _dump_mmio_region(_a, __func__, __LINE__)
33static void _dump_mmio_region(const struct ps3_mmio_region* r,
34 const char* func, int line)
35{
36 pr_debug("%s:%d: dev %u:%u\n", func, line, r->did.bus_id,
37 r->did.dev_id);
38 pr_debug("%s:%d: bus_addr %lxh\n", func, line, r->bus_addr);
39 pr_debug("%s:%d: len %lxh\n", func, line, r->len);
40 pr_debug("%s:%d: lpar_addr %lxh\n", func, line, r->lpar_addr);
41}
42
43int ps3_mmio_region_create(struct ps3_mmio_region *r)
44{
45 int result;
46
47 result = lv1_map_device_mmio_region(r->did.bus_id, r->did.dev_id,
48 r->bus_addr, r->len, r->page_size, &r->lpar_addr);
49
50 if (result) {
51 pr_debug("%s:%d: lv1_map_device_mmio_region failed: %s\n",
52 __func__, __LINE__, ps3_result(result));
53 r->lpar_addr = r->len = r->bus_addr = 0;
54 }
55
56 dump_mmio_region(r);
57 return result;
58}
59
60int ps3_free_mmio_region(struct ps3_mmio_region *r)
61{
62 int result;
63
64 result = lv1_unmap_device_mmio_region(r->did.bus_id, r->did.dev_id,
65 r->bus_addr);
66
67 if (result)
68 pr_debug("%s:%d: lv1_unmap_device_mmio_region failed: %s\n",
69 __func__, __LINE__, ps3_result(result));
70
71 r->lpar_addr = r->len = r->bus_addr = 0;
72 return result;
73}
74
75static int ps3_system_bus_match(struct device *_dev,
76 struct device_driver *_drv)
77{
78 int result;
79 struct ps3_system_bus_driver *drv = to_ps3_system_bus_driver(_drv);
80 struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev);
81
82 result = dev->match_id == drv->match_id;
83
84 pr_info("%s:%d: dev=%u(%s), drv=%u(%s): %s\n", __func__, __LINE__,
85 dev->match_id, dev->core.bus_id, drv->match_id, drv->core.name,
86 (result ? "match" : "miss"));
87 return result;
88}
89
90static int ps3_system_bus_probe(struct device *_dev)
91{
92 int result;
93 struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev);
94 struct ps3_system_bus_driver *drv =
95 to_ps3_system_bus_driver(_dev->driver);
96
97 result = lv1_open_device(dev->did.bus_id, dev->did.dev_id, 0);
98
99 if (result) {
100 pr_debug("%s:%d: lv1_open_device failed (%d)\n",
101 __func__, __LINE__, result);
102 result = -EACCES;
103 goto clean_none;
104 }
105
106 if (dev->d_region->did.bus_id) {
107 result = ps3_dma_region_create(dev->d_region);
108
109 if (result) {
110 pr_debug("%s:%d: ps3_dma_region_create failed (%d)\n",
111 __func__, __LINE__, result);
112 BUG_ON("check region type");
113 result = -EINVAL;
114 goto clean_device;
115 }
116 }
117
118 BUG_ON(!drv);
119
120 if (drv->probe)
121 result = drv->probe(dev);
122 else
123 pr_info("%s:%d: %s no probe method\n", __func__, __LINE__,
124 dev->core.bus_id);
125
126 if (result) {
127 pr_debug("%s:%d: drv->probe failed\n", __func__, __LINE__);
128 goto clean_dma;
129 }
130
131 return result;
132
133clean_dma:
134 ps3_dma_region_free(dev->d_region);
135clean_device:
136 lv1_close_device(dev->did.bus_id, dev->did.dev_id);
137clean_none:
138 return result;
139}
140
141static int ps3_system_bus_remove(struct device *_dev)
142{
143 struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev);
144 struct ps3_system_bus_driver *drv =
145 to_ps3_system_bus_driver(_dev->driver);
146
147 if (drv->remove)
148 drv->remove(dev);
149 else
150 pr_info("%s:%d: %s no remove method\n", __func__, __LINE__,
151 dev->core.bus_id);
152
153 ps3_dma_region_free(dev->d_region);
154 ps3_free_mmio_region(dev->m_region);
155 lv1_close_device(dev->did.bus_id, dev->did.dev_id);
156
157 return 0;
158}
159
160struct bus_type ps3_system_bus_type = {
161 .name = "ps3_system_bus",
162 .match = ps3_system_bus_match,
163 .probe = ps3_system_bus_probe,
164 .remove = ps3_system_bus_remove,
165};
166
167int __init ps3_system_bus_init(void)
168{
169 int result;
170
171 if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
172 return 0;
173
174 result = bus_register(&ps3_system_bus_type);
175 BUG_ON(result);
176 return result;
177}
178
179core_initcall(ps3_system_bus_init);
180
181/* Allocates a contiguous real buffer and creates mappings over it.
182 * Returns the virtual address of the buffer and sets dma_handle
183 * to the dma address (mapping) of the first page.
184 */
185
186static void * ps3_alloc_coherent(struct device *_dev, size_t size,
187 dma_addr_t *dma_handle, gfp_t flag)
188{
189 int result;
190 struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev);
191 unsigned long virt_addr;
192
193 BUG_ON(!dev->d_region->bus_addr);
194
195 flag &= ~(__GFP_DMA | __GFP_HIGHMEM);
196 flag |= __GFP_ZERO;
197
198 virt_addr = __get_free_pages(flag, get_order(size));
199
200 if (!virt_addr) {
201 pr_debug("%s:%d: get_free_pages failed\n", __func__, __LINE__);
202 goto clean_none;
203 }
204
205 result = ps3_dma_map(dev->d_region, virt_addr, size, dma_handle);
206
207 if (result) {
208 pr_debug("%s:%d: ps3_dma_map failed (%d)\n",
209 __func__, __LINE__, result);
210 BUG_ON("check region type");
211 goto clean_alloc;
212 }
213
214 return (void*)virt_addr;
215
216clean_alloc:
217 free_pages(virt_addr, get_order(size));
218clean_none:
219 dma_handle = NULL;
220 return NULL;
221}
222
223static void ps3_free_coherent(struct device *_dev, size_t size, void *vaddr,
224 dma_addr_t dma_handle)
225{
226 struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev);
227
228 ps3_dma_unmap(dev->d_region, dma_handle, size);
229 free_pages((unsigned long)vaddr, get_order(size));
230}
231
232/* Creates TCEs for a user provided buffer. The user buffer must be
233 * contiguous real kernel storage (not vmalloc). The address of the buffer
234 * passed here is the kernel (virtual) address of the buffer. The buffer
235 * need not be page aligned, the dma_addr_t returned will point to the same
236 * byte within the page as vaddr.
237 */
238
239static dma_addr_t ps3_map_single(struct device *_dev, void *ptr, size_t size,
240 enum dma_data_direction direction)
241{
242 struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev);
243 int result;
244 unsigned long bus_addr;
245
246 result = ps3_dma_map(dev->d_region, (unsigned long)ptr, size,
247 &bus_addr);
248
249 if (result) {
250 pr_debug("%s:%d: ps3_dma_map failed (%d)\n",
251 __func__, __LINE__, result);
252 }
253
254 return bus_addr;
255}
256
257static void ps3_unmap_single(struct device *_dev, dma_addr_t dma_addr,
258 size_t size, enum dma_data_direction direction)
259{
260 struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev);
261 int result;
262
263 result = ps3_dma_unmap(dev->d_region, dma_addr, size);
264
265 if (result) {
266 pr_debug("%s:%d: ps3_dma_unmap failed (%d)\n",
267 __func__, __LINE__, result);
268 }
269}
270
271static int ps3_map_sg(struct device *_dev, struct scatterlist *sg, int nents,
272 enum dma_data_direction direction)
273{
274#if defined(CONFIG_PS3_DYNAMIC_DMA)
275 BUG_ON("do");
276#endif
277 return 0;
278}
279
280static void ps3_unmap_sg(struct device *_dev, struct scatterlist *sg,
281 int nents, enum dma_data_direction direction)
282{
283#if defined(CONFIG_PS3_DYNAMIC_DMA)
284 BUG_ON("do");
285#endif
286}
287
288static int ps3_dma_supported(struct device *_dev, u64 mask)
289{
290 return 1;
291}
292
293static struct dma_mapping_ops ps3_dma_ops = {
294 .alloc_coherent = ps3_alloc_coherent,
295 .free_coherent = ps3_free_coherent,
296 .map_single = ps3_map_single,
297 .unmap_single = ps3_unmap_single,
298 .map_sg = ps3_map_sg,
299 .unmap_sg = ps3_unmap_sg,
300 .dma_supported = ps3_dma_supported
301};
302
303/**
304 * ps3_system_bus_release_device - remove a device from the system bus
305 */
306
307static void ps3_system_bus_release_device(struct device *_dev)
308{
309 struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev);
310 kfree(dev);
311}
312
313/**
314 * ps3_system_bus_device_register - add a device to the system bus
315 *
316 * ps3_system_bus_device_register() expects the dev object to be allocated
317 * dynamically by the caller. The system bus takes ownership of the dev
318 * object and frees the object in ps3_system_bus_release_device().
319 */
320
321int ps3_system_bus_device_register(struct ps3_system_bus_device *dev)
322{
323 int result;
324 static unsigned int dev_count = 1;
325
326 dev->core.parent = NULL;
327 dev->core.bus = &ps3_system_bus_type;
328 dev->core.release = ps3_system_bus_release_device;
329
330 dev->core.archdata.of_node = NULL;
331 dev->core.archdata.dma_ops = &ps3_dma_ops;
332 dev->core.archdata.numa_node = 0;
333
334 snprintf(dev->core.bus_id, sizeof(dev->core.bus_id), "sb_%02x",
335 dev_count++);
336
337 pr_debug("%s:%d add %s\n", __func__, __LINE__, dev->core.bus_id);
338
339 result = device_register(&dev->core);
340 return result;
341}
342
343EXPORT_SYMBOL_GPL(ps3_system_bus_device_register);
344
345int ps3_system_bus_driver_register(struct ps3_system_bus_driver *drv)
346{
347 int result;
348
349 drv->core.bus = &ps3_system_bus_type;
350
351 result = driver_register(&drv->core);
352 return result;
353}
354
355EXPORT_SYMBOL_GPL(ps3_system_bus_driver_register);
356
357void ps3_system_bus_driver_unregister(struct ps3_system_bus_driver *drv)
358{
359 driver_unregister(&drv->core);
360}
361
362EXPORT_SYMBOL_GPL(ps3_system_bus_driver_unregister);
diff --git a/drivers/ps3/vuart.c b/drivers/ps3/vuart.c
index 6974f65bcda5..a72da8f651f8 100644
--- a/drivers/ps3/vuart.c
+++ b/drivers/ps3/vuart.c
@@ -783,8 +783,8 @@ static int ps3_vuart_probe(struct device *_dev)
783 783
784 vuart_private.in_use++; 784 vuart_private.in_use++;
785 if (vuart_private.in_use == 1) { 785 if (vuart_private.in_use == 1) {
786 result = ps3_alloc_vuart_irq((void*)&vuart_private.bmp.status, 786 result = ps3_alloc_vuart_irq(PS3_BINDING_CPU_ANY,
787 &vuart_private.virq); 787 (void*)&vuart_private.bmp.status, &vuart_private.virq);
788 788
789 if (result) { 789 if (result) {
790 dev_dbg(&dev->core, 790 dev_dbg(&dev->core,
diff --git a/drivers/ps3/vuart.h b/drivers/ps3/vuart.h
index 28fd89f0c8aa..11c421cf7a03 100644
--- a/drivers/ps3/vuart.h
+++ b/drivers/ps3/vuart.h
@@ -21,37 +21,6 @@
21#if !defined(_PS3_VUART_H) 21#if !defined(_PS3_VUART_H)
22#define _PS3_VUART_H 22#define _PS3_VUART_H
23 23
24struct ps3_vuart_stats {
25 unsigned long bytes_written;
26 unsigned long bytes_read;
27 unsigned long tx_interrupts;
28 unsigned long rx_interrupts;
29 unsigned long disconnect_interrupts;
30};
31
32/**
33 * struct ps3_vuart_port_device - a device on a vuart port
34 */
35
36struct ps3_vuart_port_device {
37 enum ps3_match_id match_id;
38 struct device core;
39
40 /* private driver variables */
41 unsigned int port_number;
42 unsigned long interrupt_mask;
43 struct {
44 spinlock_t lock;
45 struct list_head head;
46 } tx_list;
47 struct {
48 unsigned long bytes_held;
49 spinlock_t lock;
50 struct list_head head;
51 } rx_list;
52 struct ps3_vuart_stats stats;
53};
54
55/** 24/**
56 * struct ps3_vuart_port_driver - a driver for a device on a vuart port 25 * struct ps3_vuart_port_driver - a driver for a device on a vuart port
57 */ 26 */
@@ -68,9 +37,9 @@ struct ps3_vuart_port_driver {
68 /* int (*resume)(struct ps3_vuart_port_device *); */ 37 /* int (*resume)(struct ps3_vuart_port_device *); */
69}; 38};
70 39
71int ps3_vuart_port_device_register(struct ps3_vuart_port_device *dev);
72int ps3_vuart_port_driver_register(struct ps3_vuart_port_driver *drv); 40int ps3_vuart_port_driver_register(struct ps3_vuart_port_driver *drv);
73void ps3_vuart_port_driver_unregister(struct ps3_vuart_port_driver *drv); 41void ps3_vuart_port_driver_unregister(struct ps3_vuart_port_driver *drv);
42
74int ps3_vuart_write(struct ps3_vuart_port_device *dev, 43int ps3_vuart_write(struct ps3_vuart_port_device *dev,
75 const void* buf, unsigned int bytes); 44 const void* buf, unsigned int bytes);
76int ps3_vuart_read(struct ps3_vuart_port_device *dev, void* buf, 45int ps3_vuart_read(struct ps3_vuart_port_device *dev, void* buf,
@@ -86,9 +55,4 @@ static inline struct ps3_vuart_port_device *to_ps3_vuart_port_device(
86 return container_of(_dev, struct ps3_vuart_port_device, core); 55 return container_of(_dev, struct ps3_vuart_port_device, core);
87} 56}
88 57
89int ps3_vuart_write(struct ps3_vuart_port_device *dev, const void* buf,
90 unsigned int bytes);
91int ps3_vuart_read(struct ps3_vuart_port_device *dev, void* buf,
92 unsigned int bytes);
93
94#endif 58#endif
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
index 08e55fdc882a..925fb607d8c4 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
@@ -40,6 +40,7 @@
40 40
41#include <asm/io.h> 41#include <asm/io.h>
42#include <asm/irq.h> 42#include <asm/irq.h>
43#include <asm/fs_pd.h>
43 44
44#include <linux/serial_core.h> 45#include <linux/serial_core.h>
45#include <linux/kernel.h> 46#include <linux/kernel.h>
@@ -145,7 +146,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con)
145 /* was hostalloc but changed cause it blows away the */ 146 /* was hostalloc but changed cause it blows away the */
146 /* large tlb mapping when pinning the kernel area */ 147 /* large tlb mapping when pinning the kernel area */
147 mem_addr = (u8 *) cpm_dpram_addr(cpm_dpalloc(memsz, 8)); 148 mem_addr = (u8 *) cpm_dpram_addr(cpm_dpalloc(memsz, 8));
148 dma_addr = (u32)mem_addr; 149 dma_addr = (u32)cpm_dpram_phys(mem_addr);
149 } else 150 } else
150 mem_addr = dma_alloc_coherent(NULL, memsz, &dma_addr, 151 mem_addr = dma_alloc_coherent(NULL, memsz, &dma_addr,
151 GFP_KERNEL); 152 GFP_KERNEL);
@@ -205,7 +206,7 @@ int __init cpm_uart_init_portdesc(void)
205 (unsigned long)&cpmp->cp_smc[0]; 206 (unsigned long)&cpmp->cp_smc[0];
206 cpm_uart_ports[UART_SMC1].smcp->smc_smcm |= (SMCM_RX | SMCM_TX); 207 cpm_uart_ports[UART_SMC1].smcp->smc_smcm |= (SMCM_RX | SMCM_TX);
207 cpm_uart_ports[UART_SMC1].smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); 208 cpm_uart_ports[UART_SMC1].smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
208 cpm_uart_ports[UART_SMC1].port.uartclk = (((bd_t *) __res)->bi_intfreq); 209 cpm_uart_ports[UART_SMC1].port.uartclk = uart_clock();
209 cpm_uart_port_map[cpm_uart_nr++] = UART_SMC1; 210 cpm_uart_port_map[cpm_uart_nr++] = UART_SMC1;
210#endif 211#endif
211 212
@@ -217,7 +218,7 @@ int __init cpm_uart_init_portdesc(void)
217 (unsigned long)&cpmp->cp_smc[1]; 218 (unsigned long)&cpmp->cp_smc[1];
218 cpm_uart_ports[UART_SMC2].smcp->smc_smcm |= (SMCM_RX | SMCM_TX); 219 cpm_uart_ports[UART_SMC2].smcp->smc_smcm |= (SMCM_RX | SMCM_TX);
219 cpm_uart_ports[UART_SMC2].smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); 220 cpm_uart_ports[UART_SMC2].smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
220 cpm_uart_ports[UART_SMC2].port.uartclk = (((bd_t *) __res)->bi_intfreq); 221 cpm_uart_ports[UART_SMC2].port.uartclk = uart_clock();
221 cpm_uart_port_map[cpm_uart_nr++] = UART_SMC2; 222 cpm_uart_port_map[cpm_uart_nr++] = UART_SMC2;
222#endif 223#endif
223 224
@@ -231,7 +232,7 @@ int __init cpm_uart_init_portdesc(void)
231 ~(UART_SCCM_TX | UART_SCCM_RX); 232 ~(UART_SCCM_TX | UART_SCCM_RX);
232 cpm_uart_ports[UART_SCC1].sccp->scc_gsmrl &= 233 cpm_uart_ports[UART_SCC1].sccp->scc_gsmrl &=
233 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); 234 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
234 cpm_uart_ports[UART_SCC1].port.uartclk = (((bd_t *) __res)->bi_intfreq); 235 cpm_uart_ports[UART_SCC1].port.uartclk = uart_clock();
235 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC1; 236 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC1;
236#endif 237#endif
237 238
@@ -245,7 +246,7 @@ int __init cpm_uart_init_portdesc(void)
245 ~(UART_SCCM_TX | UART_SCCM_RX); 246 ~(UART_SCCM_TX | UART_SCCM_RX);
246 cpm_uart_ports[UART_SCC2].sccp->scc_gsmrl &= 247 cpm_uart_ports[UART_SCC2].sccp->scc_gsmrl &=
247 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); 248 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
248 cpm_uart_ports[UART_SCC2].port.uartclk = (((bd_t *) __res)->bi_intfreq); 249 cpm_uart_ports[UART_SCC2].port.uartclk = uart_clock();
249 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC2; 250 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC2;
250#endif 251#endif
251 252
@@ -259,7 +260,7 @@ int __init cpm_uart_init_portdesc(void)
259 ~(UART_SCCM_TX | UART_SCCM_RX); 260 ~(UART_SCCM_TX | UART_SCCM_RX);
260 cpm_uart_ports[UART_SCC3].sccp->scc_gsmrl &= 261 cpm_uart_ports[UART_SCC3].sccp->scc_gsmrl &=
261 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); 262 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
262 cpm_uart_ports[UART_SCC3].port.uartclk = (((bd_t *) __res)->bi_intfreq); 263 cpm_uart_ports[UART_SCC3].port.uartclk = uart_clock();
263 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC3; 264 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC3;
264#endif 265#endif
265 266
@@ -273,7 +274,7 @@ int __init cpm_uart_init_portdesc(void)
273 ~(UART_SCCM_TX | UART_SCCM_RX); 274 ~(UART_SCCM_TX | UART_SCCM_RX);
274 cpm_uart_ports[UART_SCC4].sccp->scc_gsmrl &= 275 cpm_uart_ports[UART_SCC4].sccp->scc_gsmrl &=
275 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); 276 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
276 cpm_uart_ports[UART_SCC4].port.uartclk = (((bd_t *) __res)->bi_intfreq); 277 cpm_uart_ports[UART_SCC4].port.uartclk = uart_clock();
277 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC4; 278 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC4;
278#endif 279#endif
279 return 0; 280 return 0;
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.h b/drivers/serial/cpm_uart/cpm_uart_cpm1.h
index 5eb49ea63bfe..a99e45e2b6d8 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm1.h
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.h
@@ -20,9 +20,6 @@
20#define SCC3_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC3) 20#define SCC3_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC3)
21#define SCC4_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC4) 21#define SCC4_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC4)
22 22
23/* the CPM address */
24#define CPM_ADDR IMAP_ADDR
25
26static inline void cpm_set_brg(int brg, int baud) 23static inline void cpm_set_brg(int brg, int baud)
27{ 24{
28 cpm_setbrg(brg, baud); 25 cpm_setbrg(brg, baud);
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.h b/drivers/serial/cpm_uart/cpm_uart_cpm2.h
index 4b779111eaf9..1b3219f56c81 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.h
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.h
@@ -20,9 +20,6 @@
20#define SCC3_IRQ SIU_INT_SCC3 20#define SCC3_IRQ SIU_INT_SCC3
21#define SCC4_IRQ SIU_INT_SCC4 21#define SCC4_IRQ SIU_INT_SCC4
22 22
23/* the CPM address */
24#define CPM_ADDR CPM_MAP_ADDR
25
26static inline void cpm_set_brg(int brg, int baud) 23static inline void cpm_set_brg(int brg, int baud)
27{ 24{
28 cpm_setbrg(brg, baud); 25 cpm_setbrg(brg, baud);