aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2008-01-23 18:07:21 -0500
committerPaul Mackerras <paulus@samba.org>2008-01-23 18:07:21 -0500
commit9156ad48338e0306e508ead5c0d9986050744475 (patch)
tree37f3a90e38190052ecf3cdf9171dfdddd37b56fd /arch/powerpc/kernel
parentfa28237cfcc5827553044cbd6ee52e33692b0faa (diff)
parent8f7b3d156d348b6766833cd4e272d0d19b501e64 (diff)
Merge branch 'linux-2.6'
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/iommu.c17
-rw-r--r--arch/powerpc/kernel/prom_init.c39
2 files changed, 53 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 47c3fe55242f..a3c406aca664 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -278,6 +278,7 @@ int iommu_map_sg(struct iommu_table *tbl, struct scatterlist *sglist,
278 unsigned long flags; 278 unsigned long flags;
279 struct scatterlist *s, *outs, *segstart; 279 struct scatterlist *s, *outs, *segstart;
280 int outcount, incount, i; 280 int outcount, incount, i;
281 unsigned int align;
281 unsigned long handle; 282 unsigned long handle;
282 283
283 BUG_ON(direction == DMA_NONE); 284 BUG_ON(direction == DMA_NONE);
@@ -309,7 +310,12 @@ int iommu_map_sg(struct iommu_table *tbl, struct scatterlist *sglist,
309 /* Allocate iommu entries for that segment */ 310 /* Allocate iommu entries for that segment */
310 vaddr = (unsigned long) sg_virt(s); 311 vaddr = (unsigned long) sg_virt(s);
311 npages = iommu_num_pages(vaddr, slen); 312 npages = iommu_num_pages(vaddr, slen);
312 entry = iommu_range_alloc(tbl, npages, &handle, mask >> IOMMU_PAGE_SHIFT, 0); 313 align = 0;
314 if (IOMMU_PAGE_SHIFT < PAGE_SHIFT && slen >= PAGE_SIZE &&
315 (vaddr & ~PAGE_MASK) == 0)
316 align = PAGE_SHIFT - IOMMU_PAGE_SHIFT;
317 entry = iommu_range_alloc(tbl, npages, &handle,
318 mask >> IOMMU_PAGE_SHIFT, align);
313 319
314 DBG(" - vaddr: %lx, size: %lx\n", vaddr, slen); 320 DBG(" - vaddr: %lx, size: %lx\n", vaddr, slen);
315 321
@@ -570,7 +576,7 @@ dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr,
570{ 576{
571 dma_addr_t dma_handle = DMA_ERROR_CODE; 577 dma_addr_t dma_handle = DMA_ERROR_CODE;
572 unsigned long uaddr; 578 unsigned long uaddr;
573 unsigned int npages; 579 unsigned int npages, align;
574 580
575 BUG_ON(direction == DMA_NONE); 581 BUG_ON(direction == DMA_NONE);
576 582
@@ -578,8 +584,13 @@ dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr,
578 npages = iommu_num_pages(uaddr, size); 584 npages = iommu_num_pages(uaddr, size);
579 585
580 if (tbl) { 586 if (tbl) {
587 align = 0;
588 if (IOMMU_PAGE_SHIFT < PAGE_SHIFT && size >= PAGE_SIZE &&
589 ((unsigned long)vaddr & ~PAGE_MASK) == 0)
590 align = PAGE_SHIFT - IOMMU_PAGE_SHIFT;
591
581 dma_handle = iommu_alloc(tbl, vaddr, npages, direction, 592 dma_handle = iommu_alloc(tbl, vaddr, npages, direction,
582 mask >> IOMMU_PAGE_SHIFT, 0); 593 mask >> IOMMU_PAGE_SHIFT, align);
583 if (dma_handle == DMA_ERROR_CODE) { 594 if (dma_handle == DMA_ERROR_CODE) {
584 if (printk_ratelimit()) { 595 if (printk_ratelimit()) {
585 printk(KERN_INFO "iommu_alloc failed, " 596 printk(KERN_INFO "iommu_alloc failed, "
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 1add6efdb315..5d89a21dd0d6 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -2216,6 +2216,45 @@ static void __init fixup_device_tree_efika(void)
2216 prom_printf("fixup_device_tree_efika: ", 2216 prom_printf("fixup_device_tree_efika: ",
2217 "skipped entry %x - setprop error\n", i); 2217 "skipped entry %x - setprop error\n", i);
2218 } 2218 }
2219
2220 /* Make sure ethernet mdio bus node exists */
2221 node = call_prom("finddevice", 1, 1, ADDR("/builtin/mdio"));
2222 if (!PHANDLE_VALID(node)) {
2223 prom_printf("Adding Ethernet MDIO node\n");
2224 call_prom("interpret", 1, 1,
2225 " s\" /builtin\" find-device"
2226 " new-device"
2227 " 1 encode-int s\" #address-cells\" property"
2228 " 0 encode-int s\" #size-cells\" property"
2229 " s\" mdio\" 2dup device-name device-type"
2230 " s\" mpc5200b-fec-phy\" encode-string"
2231 " s\" compatible\" property"
2232 " 0xf0003000 0x400 reg"
2233 " 0x2 encode-int"
2234 " 0x5 encode-int encode+"
2235 " 0x3 encode-int encode+"
2236 " s\" interrupts\" property"
2237 " finish-device");
2238 };
2239
2240 /* Make sure ethernet phy device node exist */
2241 node = call_prom("finddevice", 1, 1, ADDR("/builtin/mdio/ethernet-phy"));
2242 if (!PHANDLE_VALID(node)) {
2243 prom_printf("Adding Ethernet PHY node\n");
2244 call_prom("interpret", 1, 1,
2245 " s\" /builtin/mdio\" find-device"
2246 " new-device"
2247 " s\" ethernet-phy\" device-name"
2248 " 0x10 encode-int s\" reg\" property"
2249 " my-self"
2250 " ihandle>phandle"
2251 " finish-device"
2252 " s\" /builtin/ethernet\" find-device"
2253 " encode-int"
2254 " s\" phy-handle\" property"
2255 " device-end");
2256 }
2257
2219} 2258}
2220#else 2259#else
2221#define fixup_device_tree_efika() 2260#define fixup_device_tree_efika()