Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 1323
b: refs/heads/master
c: 1263cc6
h: refs/heads/master
i:
  1321: 5efcd24
  1319: 4a42629
v: v3
  • Loading branch information
Benjamin Herrenschmidt authored and Linus Torvalds committed May 23, 2005
1 parent 01998a6 commit 9b61543
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b5c44c2147a447f77e07fecdb087ae288e1f4e40
refs/heads/master: 1263cc67c09bc7f913a6877f3ba0427f0b76617e
44 changes: 43 additions & 1 deletion trunk/arch/ppc64/kernel/prom_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1750,7 +1750,44 @@ static void __init flatten_device_tree(void)
prom_printf("Device tree struct 0x%x -> 0x%x\n",
RELOC(dt_struct_start), RELOC(dt_struct_end));

}
}


static void __init fixup_device_tree(void)
{
unsigned long offset = reloc_offset();
phandle u3, i2c, mpic;
u32 u3_rev;
u32 interrupts[2];
u32 parent;

/* Some G5s have a missing interrupt definition, fix it up here */
u3 = call_prom("finddevice", 1, 1, ADDR("/u3@0,f8000000"));
if ((long)u3 <= 0)
return;
i2c = call_prom("finddevice", 1, 1, ADDR("/u3@0,f8000000/i2c@f8001000"));
if ((long)i2c <= 0)
return;
mpic = call_prom("finddevice", 1, 1, ADDR("/u3@0,f8000000/mpic@f8040000"));
if ((long)mpic <= 0)
return;

/* check if proper rev of u3 */
if (prom_getprop(u3, "device-rev", &u3_rev, sizeof(u3_rev)) <= 0)
return;
if (u3_rev != 0x35)
return;
/* does it need fixup ? */
if (prom_getproplen(i2c, "interrupts") > 0)
return;
/* interrupt on this revision of u3 is number 0 and level */
interrupts[0] = 0;
interrupts[1] = 1;
prom_setprop(i2c, "interrupts", &interrupts, sizeof(interrupts));
parent = (u32)mpic;
prom_setprop(i2c, "interrupt-parent", &parent, sizeof(parent));
}


static void __init prom_find_boot_cpu(void)
{
Expand Down Expand Up @@ -1919,6 +1956,11 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, unsigned long
PTRRELOC(&prom_tce_alloc_end), sizeof(RELOC(prom_tce_alloc_end)));
}

/*
* Fixup any known bugs in the device-tree
*/
fixup_device_tree();

/*
* Now finally create the flattened device-tree
*/
Expand Down
5 changes: 5 additions & 0 deletions trunk/drivers/i2c/busses/i2c-keywest.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,11 @@ create_iface(struct device_node *np, struct device *dev)
u32 *psteps, *prate;
int rc;

if (np->n_intrs < 1 || np->n_addrs < 1) {
printk(KERN_ERR "%s: Missing interrupt or address !\n",
np->full_name);
return -ENODEV;
}
if (pmac_low_i2c_lock(np))
return -ENODEV;

Expand Down

0 comments on commit 9b61543

Please sign in to comment.