Commit 690c8fd3 authored by David S. Miller's avatar David S. Miller

[SPARC64]: Use in-kernel PROM tree for EBUS and ISA.

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent de8d28b1
...@@ -136,7 +136,7 @@ void __init auxio_probe(void) ...@@ -136,7 +136,7 @@ void __init auxio_probe(void)
for_each_ebus(ebus) { for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) { for_each_ebusdev(edev, ebus) {
if (!strcmp(edev->prom_name, "auxio")) if (!strcmp(edev->prom_node->name, "auxio"))
goto ebus_done; goto ebus_done;
} }
} }
......
...@@ -285,36 +285,38 @@ static inline void *ebus_alloc(size_t size) ...@@ -285,36 +285,38 @@ static inline void *ebus_alloc(size_t size)
static void __init ebus_ranges_init(struct linux_ebus *ebus) static void __init ebus_ranges_init(struct linux_ebus *ebus)
{ {
int success; struct linux_prom_ebus_ranges *rngs;
int len;
ebus->num_ebus_ranges = 0; ebus->num_ebus_ranges = 0;
success = prom_getproperty(ebus->prom_node, "ranges", rngs = of_get_property(ebus->prom_node, "ranges", &len);
(char *)ebus->ebus_ranges, if (rngs) {
sizeof(ebus->ebus_ranges)); memcpy(ebus->ebus_ranges, rngs, len);
if (success != -1) ebus->num_ebus_ranges =
ebus->num_ebus_ranges = (success/sizeof(struct linux_prom_ebus_ranges)); (len / sizeof(struct linux_prom_ebus_ranges));
}
} }
static void __init ebus_intmap_init(struct linux_ebus *ebus) static void __init ebus_intmap_init(struct linux_ebus *ebus)
{ {
int success; struct linux_prom_ebus_intmap *imap;
struct linux_prom_ebus_intmask *imask;
int len;
ebus->num_ebus_intmap = 0; ebus->num_ebus_intmap = 0;
success = prom_getproperty(ebus->prom_node, "interrupt-map", imap = of_get_property(ebus->prom_node, "interrupt-map", &len);
(char *)ebus->ebus_intmap, if (!imap)
sizeof(ebus->ebus_intmap));
if (success == -1)
return; return;
ebus->num_ebus_intmap = (success/sizeof(struct linux_prom_ebus_intmap)); memcpy(ebus->ebus_intmap, imap, len);
ebus->num_ebus_intmap = (len / sizeof(struct linux_prom_ebus_intmap));
success = prom_getproperty(ebus->prom_node, "interrupt-map-mask", imask = of_get_property(ebus->prom_node, "interrupt-map-mask", &len);
(char *)&ebus->ebus_intmask, if (!imask) {
sizeof(ebus->ebus_intmask)); prom_printf("EBUS: can't get interrupt-map-mask\n");
if (success == -1) {
prom_printf("%s: can't get interrupt-map-mask\n", __FUNCTION__);
prom_halt(); prom_halt();
} }
memcpy(&ebus->ebus_intmask, imask, sizeof(ebus->ebus_intmask));
} }
int __init ebus_intmap_match(struct linux_ebus *ebus, int __init ebus_intmap_match(struct linux_ebus *ebus,
...@@ -341,19 +343,23 @@ int __init ebus_intmap_match(struct linux_ebus *ebus, ...@@ -341,19 +343,23 @@ int __init ebus_intmap_match(struct linux_ebus *ebus,
return -1; return -1;
} }
void __init fill_ebus_child(int node, struct linux_prom_registers *preg, void __init fill_ebus_child(struct device_node *dp,
struct linux_ebus_child *dev, int non_standard_regs) struct linux_prom_registers *preg,
struct linux_ebus_child *dev,
int non_standard_regs)
{ {
int regs[PROMREG_MAX]; int *regs;
int irqs[PROMREG_MAX]; int *irqs;
int i, len; int i, len;
dev->prom_node = node; dev->prom_node = dp;
prom_getstring(node, "name", dev->prom_name, sizeof(dev->prom_name)); printk(" (%s)", dp->name);
printk(" (%s)", dev->prom_name);
len = prom_getproperty(node, "reg", (void *)regs, sizeof(regs)); regs = of_get_property(dp, "reg", &len);
dev->num_addrs = len / sizeof(regs[0]); if (!regs)
dev->num_addrs = 0;
else
dev->num_addrs = len / sizeof(regs[0]);
if (non_standard_regs) { if (non_standard_regs) {
/* This is to handle reg properties which are not /* This is to handle reg properties which are not
...@@ -370,21 +376,21 @@ void __init fill_ebus_child(int node, struct linux_prom_registers *preg, ...@@ -370,21 +376,21 @@ void __init fill_ebus_child(int node, struct linux_prom_registers *preg,
int rnum = regs[i]; int rnum = regs[i];
if (rnum >= dev->parent->num_addrs) { if (rnum >= dev->parent->num_addrs) {
prom_printf("UGH: property for %s was %d, need < %d\n", prom_printf("UGH: property for %s was %d, need < %d\n",
dev->prom_name, len, dev->parent->num_addrs); dp->name, len, dev->parent->num_addrs);
panic(__FUNCTION__); prom_halt();
} }
dev->resource[i].start = dev->parent->resource[i].start; dev->resource[i].start = dev->parent->resource[i].start;
dev->resource[i].end = dev->parent->resource[i].end; dev->resource[i].end = dev->parent->resource[i].end;
dev->resource[i].flags = IORESOURCE_MEM; dev->resource[i].flags = IORESOURCE_MEM;
dev->resource[i].name = dev->prom_name; dev->resource[i].name = dp->name;
} }
} }
for (i = 0; i < PROMINTR_MAX; i++) for (i = 0; i < PROMINTR_MAX; i++)
dev->irqs[i] = PCI_IRQ_NONE; dev->irqs[i] = PCI_IRQ_NONE;
len = prom_getproperty(node, "interrupts", (char *)&irqs, sizeof(irqs)); irqs = of_get_property(dp, "interrupts", &len);
if ((len == -1) || (len == 0)) { if (!irqs) {
dev->num_irqs = 0; dev->num_irqs = 0;
/* /*
* Oh, well, some PROMs don't export interrupts * Oh, well, some PROMs don't export interrupts
...@@ -392,8 +398,8 @@ void __init fill_ebus_child(int node, struct linux_prom_registers *preg, ...@@ -392,8 +398,8 @@ void __init fill_ebus_child(int node, struct linux_prom_registers *preg,
* *
* Be smart about PS/2 keyboard and mouse. * Be smart about PS/2 keyboard and mouse.
*/ */
if (!strcmp(dev->parent->prom_name, "8042")) { if (!strcmp(dev->parent->prom_node->name, "8042")) {
if (!strcmp(dev->prom_name, "kb_ps2")) { if (!strcmp(dev->prom_node->name, "kb_ps2")) {
dev->num_irqs = 1; dev->num_irqs = 1;
dev->irqs[0] = dev->parent->irqs[0]; dev->irqs[0] = dev->parent->irqs[0];
} else { } else {
...@@ -423,32 +429,32 @@ void __init fill_ebus_child(int node, struct linux_prom_registers *preg, ...@@ -423,32 +429,32 @@ void __init fill_ebus_child(int node, struct linux_prom_registers *preg,
static int __init child_regs_nonstandard(struct linux_ebus_device *dev) static int __init child_regs_nonstandard(struct linux_ebus_device *dev)
{ {
if (!strcmp(dev->prom_name, "i2c") || if (!strcmp(dev->prom_node->name, "i2c") ||
!strcmp(dev->prom_name, "SUNW,lombus")) !strcmp(dev->prom_node->name, "SUNW,lombus"))
return 1; return 1;
return 0; return 0;
} }
void __init fill_ebus_device(int node, struct linux_ebus_device *dev) void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_device *dev)
{ {
struct linux_prom_registers regs[PROMREG_MAX]; struct linux_prom_registers *regs;
struct linux_ebus_child *child; struct linux_ebus_child *child;
int irqs[PROMINTR_MAX]; int *irqs;
int i, n, len; int i, n, len;
dev->prom_node = node; dev->prom_node = dp;
prom_getstring(node, "name", dev->prom_name, sizeof(dev->prom_name));
printk(" [%s", dev->prom_name);
len = prom_getproperty(node, "reg", (void *)regs, sizeof(regs)); printk(" [%s", dp->name);
if (len == -1) {
regs = of_get_property(dp, "reg", &len);
if (!regs) {
dev->num_addrs = 0; dev->num_addrs = 0;
goto probe_interrupts; goto probe_interrupts;
} }
if (len % sizeof(struct linux_prom_registers)) { if (len % sizeof(struct linux_prom_registers)) {
prom_printf("UGH: proplen for %s was %d, need multiple of %d\n", prom_printf("UGH: proplen for %s was %d, need multiple of %d\n",
dev->prom_name, len, dev->prom_node->name, len,
(int)sizeof(struct linux_prom_registers)); (int)sizeof(struct linux_prom_registers));
prom_halt(); prom_halt();
} }
...@@ -466,7 +472,7 @@ void __init fill_ebus_device(int node, struct linux_ebus_device *dev) ...@@ -466,7 +472,7 @@ void __init fill_ebus_device(int node, struct linux_ebus_device *dev)
dev->resource[i].end = dev->resource[i].end =
(dev->resource[i].start + (unsigned long)regs[i].reg_size - 1UL); (dev->resource[i].start + (unsigned long)regs[i].reg_size - 1UL);
dev->resource[i].flags = IORESOURCE_MEM; dev->resource[i].flags = IORESOURCE_MEM;
dev->resource[i].name = dev->prom_name; dev->resource[i].name = dev->prom_node->name;
request_resource(&dev->bus->self->resource[n], request_resource(&dev->bus->self->resource[n],
&dev->resource[i]); &dev->resource[i]);
} }
...@@ -475,8 +481,8 @@ void __init fill_ebus_device(int node, struct linux_ebus_device *dev) ...@@ -475,8 +481,8 @@ void __init fill_ebus_device(int node, struct linux_ebus_device *dev)
for (i = 0; i < PROMINTR_MAX; i++) for (i = 0; i < PROMINTR_MAX; i++)
dev->irqs[i] = PCI_IRQ_NONE; dev->irqs[i] = PCI_IRQ_NONE;
len = prom_getproperty(node, "interrupts", (char *)&irqs, sizeof(irqs)); irqs = of_get_property(dp, "interrupts", &len);
if ((len == -1) || (len == 0)) { if (!irqs) {
dev->num_irqs = 0; dev->num_irqs = 0;
} else { } else {
dev->num_irqs = len / sizeof(irqs[0]); dev->num_irqs = len / sizeof(irqs[0]);
...@@ -497,7 +503,8 @@ void __init fill_ebus_device(int node, struct linux_ebus_device *dev) ...@@ -497,7 +503,8 @@ void __init fill_ebus_device(int node, struct linux_ebus_device *dev)
} }
} }
if ((node = prom_getchild(node))) { dp = dp->child;
if (dp) {
printk(" ->"); printk(" ->");
dev->children = ebus_alloc(sizeof(struct linux_ebus_child)); dev->children = ebus_alloc(sizeof(struct linux_ebus_child));
...@@ -505,18 +512,18 @@ void __init fill_ebus_device(int node, struct linux_ebus_device *dev) ...@@ -505,18 +512,18 @@ void __init fill_ebus_device(int node, struct linux_ebus_device *dev)
child->next = NULL; child->next = NULL;
child->parent = dev; child->parent = dev;
child->bus = dev->bus; child->bus = dev->bus;
fill_ebus_child(node, &regs[0], fill_ebus_child(dp, regs, child,
child, child_regs_nonstandard(dev)); child_regs_nonstandard(dev));
while ((node = prom_getsibling(node)) != 0) { while ((dp = dp->sibling) != NULL) {
child->next = ebus_alloc(sizeof(struct linux_ebus_child)); child->next = ebus_alloc(sizeof(struct linux_ebus_child));
child = child->next; child = child->next;
child->next = NULL; child->next = NULL;
child->parent = dev; child->parent = dev;
child->bus = dev->bus; child->bus = dev->bus;
fill_ebus_child(node, &regs[0], fill_ebus_child(dp, regs, child,
child, child_regs_nonstandard(dev)); child_regs_nonstandard(dev));
} }
} }
printk("]"); printk("]");
...@@ -543,7 +550,8 @@ void __init ebus_init(void) ...@@ -543,7 +550,8 @@ void __init ebus_init(void)
struct linux_ebus *ebus; struct linux_ebus *ebus;
struct pci_dev *pdev; struct pci_dev *pdev;
struct pcidev_cookie *cookie; struct pcidev_cookie *cookie;
int nd, ebusnd, is_rio; struct device_node *dp;
int is_rio;
int num_ebus = 0; int num_ebus = 0;
pdev = find_next_ebus(NULL, &is_rio); pdev = find_next_ebus(NULL, &is_rio);
...@@ -553,20 +561,22 @@ void __init ebus_init(void) ...@@ -553,20 +561,22 @@ void __init ebus_init(void)
} }
cookie = pdev->sysdata; cookie = pdev->sysdata;
ebusnd = cookie->prom_node->node; dp = cookie->prom_node;
ebus_chain = ebus = ebus_alloc(sizeof(struct linux_ebus)); ebus_chain = ebus = ebus_alloc(sizeof(struct linux_ebus));
ebus->next = NULL; ebus->next = NULL;
ebus->is_rio = is_rio; ebus->is_rio = is_rio;
while (ebusnd) { while (dp) {
struct device_node *child;
/* SUNW,pci-qfe uses four empty ebuses on it. /* SUNW,pci-qfe uses four empty ebuses on it.
I think we should not consider them here, I think we should not consider them here,
as they have half of the properties this as they have half of the properties this
code expects and once we do PCI hot-plug, code expects and once we do PCI hot-plug,
we'd have to tweak with the ebus_chain we'd have to tweak with the ebus_chain
in the runtime after initialization. -jj */ in the runtime after initialization. -jj */
if (!prom_getchild (ebusnd)) { if (!dp->child) {
pdev = find_next_ebus(pdev, &is_rio); pdev = find_next_ebus(pdev, &is_rio);
if (!pdev) { if (!pdev) {
if (ebus == ebus_chain) { if (ebus == ebus_chain) {
...@@ -578,22 +588,21 @@ void __init ebus_init(void) ...@@ -578,22 +588,21 @@ void __init ebus_init(void)
} }
ebus->is_rio = is_rio; ebus->is_rio = is_rio;
cookie = pdev->sysdata; cookie = pdev->sysdata;
ebusnd = cookie->prom_node->node; dp = cookie->prom_node;
continue; continue;
} }
printk("ebus%d:", num_ebus); printk("ebus%d:", num_ebus);
prom_getstring(ebusnd, "name", ebus->prom_name, sizeof(ebus->prom_name));
ebus->index = num_ebus; ebus->index = num_ebus;
ebus->prom_node = ebusnd; ebus->prom_node = dp;
ebus->self = pdev; ebus->self = pdev;
ebus->parent = pbm = cookie->pbm; ebus->parent = pbm = cookie->pbm;
ebus_ranges_init(ebus); ebus_ranges_init(ebus);
ebus_intmap_init(ebus); ebus_intmap_init(ebus);
nd = prom_getchild(ebusnd); child = dp->child;
if (!nd) if (!child)
goto next_ebus; goto next_ebus;
ebus->devices = ebus_alloc(sizeof(struct linux_ebus_device)); ebus->devices = ebus_alloc(sizeof(struct linux_ebus_device));
...@@ -602,16 +611,16 @@ void __init ebus_init(void) ...@@ -602,16 +611,16 @@ void __init ebus_init(void)
dev->next = NULL; dev->next = NULL;
dev->children = NULL; dev->children = NULL;
dev->bus = ebus; dev->bus = ebus;
fill_ebus_device(nd, dev); fill_ebus_device(child, dev);
while ((nd = prom_getsibling(nd)) != 0) { while ((child = child->sibling) != NULL) {
dev->next = ebus_alloc(sizeof(struct linux_ebus_device)); dev->next = ebus_alloc(sizeof(struct linux_ebus_device));
dev = dev->next; dev = dev->next;
dev->next = NULL; dev->next = NULL;
dev->children = NULL; dev->children = NULL;
dev->bus = ebus; dev->bus = ebus;
fill_ebus_device(nd, dev); fill_ebus_device(child, dev);
} }
next_ebus: next_ebus:
...@@ -622,7 +631,7 @@ void __init ebus_init(void) ...@@ -622,7 +631,7 @@ void __init ebus_init(void)
break; break;
cookie = pdev->sysdata; cookie = pdev->sysdata;
ebusnd = cookie->prom_node->node; dp = cookie->prom_node;
ebus->next = ebus_alloc(sizeof(struct linux_ebus)); ebus->next = ebus_alloc(sizeof(struct linux_ebus));
ebus = ebus->next; ebus = ebus->next;
......
...@@ -15,23 +15,19 @@ static void __init fatal_err(const char *reason) ...@@ -15,23 +15,19 @@ static void __init fatal_err(const char *reason)
static void __init report_dev(struct sparc_isa_device *isa_dev, int child) static void __init report_dev(struct sparc_isa_device *isa_dev, int child)
{ {
if (child) if (child)
printk(" (%s)", isa_dev->prom_name); printk(" (%s)", isa_dev->prom_node->name);
else else
printk(" [%s", isa_dev->prom_name); printk(" [%s", isa_dev->prom_node->name);
} }
static void __init isa_dev_get_resource(struct sparc_isa_device *isa_dev, static struct linux_prom_registers * __init
struct linux_prom_registers *pregs, isa_dev_get_resource(struct sparc_isa_device *isa_dev)
int pregs_size)
{ {
struct linux_prom_registers *pregs;
unsigned long base, len; unsigned long base, len;
int prop_len; int prop_len;
prop_len = prom_getproperty(isa_dev->prom_node, "reg", pregs = of_get_property(isa_dev->prom_node, "reg", &prop_len);
(char *) pregs, pregs_size);
if (prop_len <= 0)
return;
/* Only the first one is interesting. */ /* Only the first one is interesting. */
len = pregs[0].reg_size; len = pregs[0].reg_size;
...@@ -42,10 +38,12 @@ static void __init isa_dev_get_resource(struct sparc_isa_device *isa_dev, ...@@ -42,10 +38,12 @@ static void __init isa_dev_get_resource(struct sparc_isa_device *isa_dev,
isa_dev->resource.start = base; isa_dev->resource.start = base;
isa_dev->resource.end = (base + len - 1UL); isa_dev->resource.end = (base + len - 1UL);
isa_dev->resource.flags = IORESOURCE_IO; isa_dev->resource.flags = IORESOURCE_IO;
isa_dev->resource.name = isa_dev->prom_name; isa_dev->resource.name = isa_dev->prom_node->name;
request_resource(&isa_dev->bus->parent->io_space, request_resource(&isa_dev->bus->parent->io_space,
&isa_dev->resource); &isa_dev->resource);
return pregs;
} }
/* I can't believe they didn't put a real INO in the isa device /* I can't believe they didn't put a real INO in the isa device
...@@ -98,8 +96,8 @@ static void __init isa_dev_get_irq(struct sparc_isa_device *isa_dev, ...@@ -98,8 +96,8 @@ static void __init isa_dev_get_irq(struct sparc_isa_device *isa_dev,
{ {
int irq_prop; int irq_prop;
irq_prop = prom_getintdefault(isa_dev->prom_node, irq_prop = of_getintprop_default(isa_dev->prom_node,
"interrupts", -1); "interrupts", -1);
if (irq_prop <= 0) { if (irq_prop <= 0) {
goto no_irq; goto no_irq;
} else { } else {
...@@ -141,16 +139,15 @@ static void __init isa_dev_get_irq(struct sparc_isa_device *isa_dev, ...@@ -141,16 +139,15 @@ static void __init isa_dev_get_irq(struct sparc_isa_device *isa_dev,
static void __init isa_fill_children(struct sparc_isa_device *parent_isa_dev) static void __init isa_fill_children(struct sparc_isa_device *parent_isa_dev)
{ {
int node = prom_getchild(parent_isa_dev->prom_node); struct device_node *dp = parent_isa_dev->prom_node->child;
if (node == 0) if (!dp)
return; return;
printk(" ->"); printk(" ->");
while (node != 0) { while (dp) {
struct linux_prom_registers regs[PROMREG_MAX]; struct linux_prom_registers *regs;
struct sparc_isa_device *isa_dev; struct sparc_isa_device *isa_dev;
int prop_len;
isa_dev = kmalloc(sizeof(*isa_dev), GFP_KERNEL); isa_dev = kmalloc(sizeof(*isa_dev), GFP_KERNEL);
if (!isa_dev) { if (!isa_dev) {
...@@ -165,40 +162,24 @@ static void __init isa_fill_children(struct sparc_isa_device *parent_isa_dev) ...@@ -165,40 +162,24 @@ static void __init isa_fill_children(struct sparc_isa_device *parent_isa_dev)
parent_isa_dev->child = isa_dev; parent_isa_dev->child = isa_dev;
isa_dev->bus = parent_isa_dev->bus; isa_dev->bus = parent_isa_dev->bus;
isa_dev->prom_node = node; isa_dev->prom_node = dp;
prop_len = prom_getproperty(node, "name",
(char *) isa_dev->prom_name,
sizeof(isa_dev->prom_name));
if (prop_len <= 0) {
fatal_err("cannot get child isa_dev OBP node name");
prom_halt();
}
prop_len = prom_getproperty(node, "compatible",
(char *) isa_dev->compatible,
sizeof(isa_dev->compatible));
/* Not having this is OK. */ regs = isa_dev_get_resource(isa_dev);
if (prop_len <= 0)
isa_dev->compatible[0] = '\0';
isa_dev_get_resource(isa_dev, regs, sizeof(regs));
isa_dev_get_irq(isa_dev, regs); isa_dev_get_irq(isa_dev, regs);
report_dev(isa_dev, 1); report_dev(isa_dev, 1);
node = prom_getsibling(node); dp = dp->sibling;
} }
} }
static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br) static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br)
{ {
int node = prom_getchild(isa_br->prom_node); struct device_node *dp = isa_br->prom_node->child;
while (node != 0) { while (dp) {
struct linux_prom_registers regs[PROMREG_MAX]; struct linux_prom_registers *regs;
struct sparc_isa_device *isa_dev; struct sparc_isa_device *isa_dev;
int prop_len;
isa_dev = kmalloc(sizeof(*isa_dev), GFP_KERNEL); isa_dev = kmalloc(sizeof(*isa_dev), GFP_KERNEL);
if (!isa_dev) { if (!isa_dev) {
...@@ -222,24 +203,9 @@ static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br) ...@@ -222,24 +203,9 @@ static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br)
} }
isa_dev->bus = isa_br; isa_dev->bus = isa_br;
isa_dev->prom_node = node; isa_dev->prom_node = dp;
prop_len = prom_getproperty(node, "name",
(char *) isa_dev->prom_name,
sizeof(isa_dev->prom_name));
if (prop_len <= 0) {
fatal_err("cannot get isa_dev OBP node name");
prom_halt();
}
prop_len = prom_getproperty(node, "compatible",
(char *) isa_dev->compatible,
sizeof(isa_dev->compatible));
/* Not having this is OK. */
if (prop_len <= 0)
isa_dev->compatible[0] = '\0';
isa_dev_get_resource(isa_dev, regs, sizeof(regs)); regs = isa_dev_get_resource(isa_dev);
isa_dev_get_irq(isa_dev, regs); isa_dev_get_irq(isa_dev, regs);
report_dev(isa_dev, 0); report_dev(isa_dev, 0);
...@@ -248,10 +214,40 @@ static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br) ...@@ -248,10 +214,40 @@ static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br)
printk("]"); printk("]");
node = prom_getsibling(node); dp = dp->sibling;
} }
} }
static void __init get_bridge_props(struct sparc_isa_bridge *isa_br)
{
struct device_node *dp = isa_br->prom_node;
void *pval;
int len;
pval = of_get_property(dp, "ranges", &len);
if (pval) {
memcpy(isa_br->isa_ranges, pval, len);
isa_br->num_isa_ranges =
len / sizeof(struct linux_prom_isa_ranges);
} else {
isa_br->num_isa_ranges = 0;
}
pval = of_get_property(dp, "interrupt-map", &len);
if (pval) {
memcpy(isa_br->isa_intmap, pval, len);
isa_br->num_isa_intmap =
(len / sizeof(struct linux_prom_isa_intmap));
} else {
isa_br->num_isa_intmap = 0;
}
pval = of_get_property(dp, "interrupt-map-mask", &len);
if (pval)
memcpy(&isa_br->isa_intmask, pval,
sizeof(isa_br->isa_intmask));
}
void __init isa_init(void) void __init isa_init(void)
{ {
struct pci_dev *pdev; struct pci_dev *pdev;
...@@ -266,7 +262,6 @@ void __init isa_init(void) ...@@ -266,7 +262,6 @@ void __init isa_init(void)
struct pcidev_cookie *pdev_cookie; struct pcidev_cookie *pdev_cookie;
struct pci_pbm_info *pbm; struct pci_pbm_info *pbm;
struct sparc_isa_bridge *isa_br; struct sparc_isa_bridge *isa_br;
int prop_len;
pdev_cookie = pdev->sysdata; pdev_cookie = pdev->sysdata;
if (!pdev_cookie) { if (!pdev_cookie) {
...@@ -291,34 +286,9 @@ void __init isa_init(void) ...@@ -291,34 +286,9 @@ void __init isa_init(void)
isa_br->parent = pbm; isa_br->parent = pbm;
isa_br->self = pdev; isa_br->self = pdev;
isa_br->index = index++; isa_br->index = index++;
isa_br->prom_node = pdev_cookie->prom_node->node; isa_br->prom_node = pdev_cookie->prom_node;
strncpy(isa_br->prom_name, pdev_cookie->prom_node->name,
sizeof(isa_br->prom_name)); get_bridge_props(isa_br);
prop_len = prom_getproperty(isa_br->prom_node,
"ranges",
(char *) isa_br->isa_ranges,
sizeof(isa_br->isa_ranges));
if (prop_len <= 0)
isa_br->num_isa_ranges = 0;
else
isa_br->num_isa_ranges =
(prop_len / sizeof(struct linux_prom_isa_ranges));
prop_len = prom_getproperty(isa_br->prom_node,
"interrupt-map",
(char *) isa_br->isa_intmap,
sizeof(isa_br->isa_intmap));
if (prop_len <= 0)
isa_br->num_isa_intmap = 0;
else
isa_br->num_isa_intmap =
(prop_len / sizeof(struct linux_prom_isa_intmap));
prop_len = prom_getproperty(isa_br->prom_node,
"interrupt-map-mask",
(char *) &(isa_br->isa_intmask),
sizeof(isa_br->isa_intmask));
printk("isa%d:", isa_br->index); printk("isa%d:", isa_br->index);
......
...@@ -105,24 +105,24 @@ static int powerd(void *__unused) ...@@ -105,24 +105,24 @@ static int powerd(void *__unused)
return 0; return 0;
} }
static int __init has_button_interrupt(unsigned int irq, int prom_node) static int __init has_button_interrupt(unsigned int irq, struct device_node *dp)
{ {
if (irq == PCI_IRQ_NONE) if (irq == PCI_IRQ_NONE)
return 0; return 0;
if (!prom_node_has_property(prom_node, "button")) if (!of_find_property(dp, "button", NULL))
return 0; return 0;
return 1; return 1;
} }
static int __init power_probe_ebus(struct resource **resp, unsigned int *irq_p, int *prom_node_p) static int __init power_probe_ebus(struct resource **resp, unsigned int *irq_p, struct device_node **prom_node_p)
{ {
struct linux_ebus *ebus; struct linux_ebus *ebus;
struct linux_ebus_device *edev; struct linux_ebus_device *edev;
for_each_ebus(ebus) { for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) { for_each_ebusdev(edev, ebus) {
if (!strcmp(edev->prom_name, "power")) { if (!strcmp(edev->prom_node->name, "power")) {
*resp = &edev->resource[0]; *resp = &edev->resource[0];
*irq_p = edev->irqs[0]; *irq_p = edev->irqs[0];
*prom_node_p = edev->prom_node; *prom_node_p = edev->prom_node;
...@@ -133,14 +133,14 @@ static int __init power_probe_ebus(struct resource **resp, unsigned int *irq_p, ...@@ -133,14 +133,14 @@ static int __init power_probe_ebus(struct resource **resp, unsigned int *irq_p,
return -ENODEV; return -ENODEV;
} }
static int __init power_probe_isa(struct resource **resp, unsigned int *irq_p, int *prom_node_p) static int __init power_probe_isa(struct resource **resp, unsigned int *irq_p, struct device_node **prom_node_p)
{ {
struct sparc_isa_bridge *isa_bus; struct sparc_isa_bridge *isa_bus;
struct sparc_isa_device *isa_dev; struct sparc_isa_device *isa_dev;
for_each_isa(isa_bus) { for_each_isa(isa_bus) {
for_each_isadev(isa_dev, isa_bus) { for_each_isadev(isa_dev, isa_bus) {
if (!strcmp(isa_dev->prom_name, "power")) { if (!strcmp(isa_dev->prom_node->name, "power")) {
*resp = &isa_dev->resource; *resp = &isa_dev->resource;
*irq_p = isa_dev->irq; *irq_p = isa_dev->irq;
*prom_node_p = isa_dev->prom_node; *prom_node_p = isa_dev->prom_node;
...@@ -155,17 +155,17 @@ void __init power_init(void) ...@@ -155,17 +155,17 @@ void __init power_init(void)
{ {
struct resource *res = NULL; struct resource *res = NULL;
unsigned int irq; unsigned int irq;
int prom_node; struct device_node *dp;
static int invoked; static int invoked;
if (invoked) if (invoked)
return; return;
invoked = 1; invoked = 1;
if (!power_probe_ebus(&res, &irq, &prom_node)) if (!power_probe_ebus(&res, &irq, &dp))
goto found; goto found;
if (!power_probe_isa(&res, &irq, &prom_node)) if (!power_probe_isa(&res, &irq, &dp))
goto found; goto found;
return; return;
...@@ -174,7 +174,7 @@ void __init power_init(void) ...@@ -174,7 +174,7 @@ void __init power_init(void)
power_reg = ioremap(res->start, 0x4); power_reg = ioremap(res->start, 0x4);
printk("power: Control reg at %p ... ", power_reg); printk("power: Control reg at %p ... ", power_reg);
poweroff_method = machine_halt; /* able to use the standard halt */ poweroff_method = machine_halt; /* able to use the standard halt */
if (has_button_interrupt(irq, prom_node)) { if (has_button_interrupt(irq, dp)) {
if (kernel_thread(powerd, NULL, CLONE_FS) < 0) { if (kernel_thread(powerd, NULL, CLONE_FS) < 0) {
printk("Failed to start power daemon.\n"); printk("Failed to start power daemon.\n");
return; return;
......
...@@ -63,6 +63,7 @@ struct device_node *of_find_node_by_path(const char *path) ...@@ -63,6 +63,7 @@ struct device_node *of_find_node_by_path(const char *path)
return np; return np;
} }
EXPORT_SYMBOL(of_find_node_by_path);
struct device_node *of_find_node_by_phandle(phandle handle) struct device_node *of_find_node_by_phandle(phandle handle)
{ {
......
...@@ -756,24 +756,200 @@ static int hypervisor_set_time(u32 secs) ...@@ -756,24 +756,200 @@ static int hypervisor_set_time(u32 secs)
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
void __init clock_probe(void) static int __init clock_model_matches(char *model)
{
if (strcmp(model, "mk48t02") &&
strcmp(model, "mk48t08") &&
strcmp(model, "mk48t59") &&
strcmp(model, "m5819") &&
strcmp(model, "m5819p") &&
strcmp(model, "m5823") &&
strcmp(model, "ds1287"))
return 0;
return 1;
}
static void __init __clock_assign_common(void __iomem *addr, char *model)
{
if (model[5] == '0' && model[6] == '2') {
mstk48t02_regs = addr;
} else if(model[5] == '0' && model[6] == '8') {
mstk48t08_regs = addr;
mstk48t02_regs = mstk48t08_regs + MOSTEK_48T08_48T02;
} else {
mstk48t59_regs = addr;
mstk48t02_regs = mstk48t59_regs + MOSTEK_48T59_48T02;
}
}
static void __init clock_assign_clk_reg(struct linux_prom_registers *clk_reg,
char *model)
{
unsigned long addr;
addr = ((unsigned long) clk_reg[0].phys_addr |
(((unsigned long) clk_reg[0].which_io) << 32UL));
__clock_assign_common((void __iomem *) addr, model);
}
static int __init clock_probe_central(void)
{ {
struct linux_prom_registers clk_reg[2]; struct linux_prom_registers clk_reg[2];
char model[128]; char model[64];
int node, busnd = -1, err; int node;
unsigned long flags;
struct linux_central *cbus; if (!central_bus)
return 0;
/* Get Central FHC's prom node. */
node = central_bus->child->prom_node;
/* Then get the first child device below it. */
node = prom_getchild(node);
while (node) {
prom_getstring(node, "model", model, sizeof(model));
if (!clock_model_matches(model))
goto next_sibling;
prom_getproperty(node, "reg", (char *)clk_reg,
sizeof(clk_reg));
apply_fhc_ranges(central_bus->child, clk_reg, 1);
apply_central_ranges(central_bus, clk_reg, 1);
clock_assign_clk_reg(clk_reg, model);
return 1;
next_sibling:
node = prom_getsibling(node);
}
return 0;
}
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
struct linux_ebus *ebus = NULL; static void __init clock_isa_ebus_assign_regs(struct resource *res, char *model)
struct sparc_isa_bridge *isa_br = NULL; {
if (!strcmp(model, "ds1287") ||
!strcmp(model, "m5819") ||
!strcmp(model, "m5819p") ||
!strcmp(model, "m5823")) {
ds1287_regs = res->start;
} else {
mstk48t59_regs = (void __iomem *) res->start;
mstk48t02_regs = mstk48t59_regs + MOSTEK_48T59_48T02;
}
}
static int __init clock_probe_one_ebus_dev(struct linux_ebus_device *edev)
{
struct device_node *dp = edev->prom_node;
char *model;
model = of_get_property(dp, "model", NULL);
if (!clock_model_matches(model))
return 0;
clock_isa_ebus_assign_regs(&edev->resource[0], model);
return 1;
}
static int __init clock_probe_ebus(void)
{
struct linux_ebus *ebus;
for_each_ebus(ebus) {
struct linux_ebus_device *edev;
for_each_ebusdev(edev, ebus) {
if (clock_probe_one_ebus_dev(edev))
return 1;
}
}
return 0;
}
static int __init clock_probe_one_isa_dev(struct sparc_isa_device *idev)
{
struct device_node *dp = idev->prom_node;
char *model;
model = of_get_property(dp, "model", NULL);
if (!clock_model_matches(model))
return 0;
clock_isa_ebus_assign_regs(&idev->resource, model);
return 1;
}
static int __init clock_probe_isa(void)
{
struct sparc_isa_bridge *isa_br;
for_each_isa(isa_br) {
struct sparc_isa_device *isa_dev;
for_each_isadev(isa_dev, isa_br) {
if (clock_probe_one_isa_dev(isa_dev))
return 1;
}
}
return 0;
}
#endif /* CONFIG_PCI */
#ifdef CONFIG_SBUS
static int __init clock_probe_one_sbus_dev(struct sbus_bus *sbus, struct sbus_dev *sdev)
{
struct resource *res;
char model[64];
void __iomem *addr;
prom_getstring(sdev->prom_node, "model", model, sizeof(model));
if (!clock_model_matches(model))
return 0;
res = &sdev->resource[0];
addr = sbus_ioremap(res, 0, 0x800UL, "eeprom");
__clock_assign_common(addr, model);
return 1;
}
static int __init clock_probe_sbus(void)
{
struct sbus_bus *sbus;
for_each_sbus(sbus) {
struct sbus_dev *sdev;
for_each_sbusdev(sdev, sbus) {
if (clock_probe_one_sbus_dev(sbus, sdev))
return 1;
}
}
return 0;
}
#endif #endif
void __init clock_probe(void)
{
static int invoked; static int invoked;
unsigned long flags;
if (invoked) if (invoked)
return; return;
invoked = 1; invoked = 1;
if (this_is_starfire) { if (this_is_starfire) {
xtime.tv_sec = starfire_get_time(); xtime.tv_sec = starfire_get_time();
xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ); xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
...@@ -789,183 +965,27 @@ void __init clock_probe(void) ...@@ -789,183 +965,27 @@ void __init clock_probe(void)
return; return;
} }
local_irq_save(flags);
cbus = central_bus;
if (cbus != NULL)
busnd = central_bus->child->prom_node;
/* Check FHC Central then EBUSs then ISA bridges then SBUSs. /* Check FHC Central then EBUSs then ISA bridges then SBUSs.
* That way we handle the presence of multiple properly. * That way we handle the presence of multiple properly.
* *
* As a special case, machines with Central must provide the * As a special case, machines with Central must provide the
* timer chip there. * timer chip there.
*/ */
if (!clock_probe_central() &&
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
if (ebus_chain != NULL) { !clock_probe_ebus() &&
ebus = ebus_chain; !clock_probe_isa() &&
if (busnd == -1)
busnd = ebus->prom_node;
}
if (isa_chain != NULL) {
isa_br = isa_chain;
if (busnd == -1)
busnd = isa_br->prom_node;
}
#endif
if (sbus_root != NULL && busnd == -1)
busnd = sbus_root->prom_node;
if (busnd == -1) {
prom_printf("clock_probe: problem, cannot find bus to search.\n");
prom_halt();
}
node = prom_getchild(busnd);
while (1) {
if (!node)
model[0] = 0;
else
prom_getstring(node, "model", model, sizeof(model));
if (strcmp(model, "mk48t02") &&
strcmp(model, "mk48t08") &&
strcmp(model, "mk48t59") &&
strcmp(model, "m5819") &&
strcmp(model, "m5819p") &&
strcmp(model, "m5823") &&
strcmp(model, "ds1287")) {
if (cbus != NULL) {
prom_printf("clock_probe: Central bus lacks timer chip.\n");
prom_halt();
}
if (node != 0)
node = prom_getsibling(node);
#ifdef CONFIG_PCI
while ((node == 0) && ebus != NULL) {
ebus = ebus->next;
if (ebus != NULL) {
busnd = ebus->prom_node;
node = prom_getchild(busnd);
}
}
while ((node == 0) && isa_br != NULL) {
isa_br = isa_br->next;
if (isa_br != NULL) {
busnd = isa_br->prom_node;
node = prom_getchild(busnd);
}
}
#endif #endif
if (node == 0) { #ifdef CONFIG_SBUS
prom_printf("clock_probe: Cannot find timer chip\n"); !clock_probe_sbus()
prom_halt();
}
continue;
}
err = prom_getproperty(node, "reg", (char *)clk_reg,
sizeof(clk_reg));
if(err == -1) {
prom_printf("clock_probe: Cannot get Mostek reg property\n");
prom_halt();
}
if (cbus != NULL) {
apply_fhc_ranges(central_bus->child, clk_reg, 1);
apply_central_ranges(central_bus, clk_reg, 1);
}
#ifdef CONFIG_PCI
else if (ebus != NULL) {
struct linux_ebus_device *edev;
for_each_ebusdev(edev, ebus)
if (edev->prom_node == node)
break;
if (edev == NULL) {
if (isa_chain != NULL)
goto try_isa_clock;
prom_printf("%s: Mostek not probed by EBUS\n",
__FUNCTION__);
prom_halt();
}
if (!strcmp(model, "ds1287") ||
!strcmp(model, "m5819") ||
!strcmp(model, "m5819p") ||
!strcmp(model, "m5823")) {
ds1287_regs = edev->resource[0].start;
} else {
mstk48t59_regs = (void __iomem *)
edev->resource[0].start;
mstk48t02_regs = mstk48t59_regs + MOSTEK_48T59_48T02;
}
break;
}
else if (isa_br != NULL) {
struct sparc_isa_device *isadev;
try_isa_clock:
for_each_isadev(isadev, isa_br)
if (isadev->prom_node == node)
break;
if (isadev == NULL) {
prom_printf("%s: Mostek not probed by ISA\n");
prom_halt();
}
if (!strcmp(model, "ds1287") ||
!strcmp(model, "m5819") ||
!strcmp(model, "m5819p") ||
!strcmp(model, "m5823")) {
ds1287_regs = isadev->resource.start;
} else {
mstk48t59_regs = (void __iomem *)
isadev->resource.start;
mstk48t02_regs = mstk48t59_regs + MOSTEK_48T59_48T02;
}
break;
}
#endif #endif
else { ) {
if (sbus_root->num_sbus_ranges) { printk(KERN_WARNING "No clock chip found.\n");
int nranges = sbus_root->num_sbus_ranges; return;
int rngc;
for (rngc = 0; rngc < nranges; rngc++)
if (clk_reg[0].which_io ==
sbus_root->sbus_ranges[rngc].ot_child_space)
break;
if (rngc == nranges) {
prom_printf("clock_probe: Cannot find ranges for "
"clock regs.\n");
prom_halt();
}
clk_reg[0].which_io =
sbus_root->sbus_ranges[rngc].ot_parent_space;
clk_reg[0].phys_addr +=
sbus_root->sbus_ranges[rngc].ot_parent_base;
}
}
if(model[5] == '0' && model[6] == '2') {
mstk48t02_regs = (void __iomem *)
(((u64)clk_reg[0].phys_addr) |
(((u64)clk_reg[0].which_io)<<32UL));
} else if(model[5] == '0' && model[6] == '8') {
mstk48t08_regs = (void __iomem *)
(((u64)clk_reg[0].phys_addr) |
(((u64)clk_reg[0].which_io)<<32UL));
mstk48t02_regs = mstk48t08_regs + MOSTEK_48T08_48T02;
} else {
mstk48t59_regs = (void __iomem *)
(((u64)clk_reg[0].phys_addr) |
(((u64)clk_reg[0].which_io)<<32UL));
mstk48t02_regs = mstk48t59_regs + MOSTEK_48T59_48T02;
}
break;
} }
local_irq_save(flags);
if (mstk48t02_regs != NULL) { if (mstk48t02_regs != NULL) {
/* Report a low battery voltage condition. */ /* Report a low battery voltage condition. */
if (has_low_battery()) if (has_low_battery())
......
...@@ -928,7 +928,7 @@ static int __init rtc_init(void) ...@@ -928,7 +928,7 @@ static int __init rtc_init(void)
#ifdef __sparc__ #ifdef __sparc__
for_each_ebus(ebus) { for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) { for_each_ebusdev(edev, ebus) {
if(strcmp(edev->prom_name, "rtc") == 0) { if(strcmp(edev->prom_node->name, "rtc") == 0) {
rtc_port = edev->resource[0].start; rtc_port = edev->resource[0].start;
rtc_irq = edev->irqs[0]; rtc_irq = edev->irqs[0];
goto found; goto found;
...@@ -938,7 +938,7 @@ static int __init rtc_init(void) ...@@ -938,7 +938,7 @@ static int __init rtc_init(void)
#ifdef __sparc_v9__ #ifdef __sparc_v9__
for_each_isa(isa_br) { for_each_isa(isa_br) {
for_each_isadev(isa_dev, isa_br) { for_each_isadev(isa_dev, isa_br) {
if (strcmp(isa_dev->prom_name, "rtc") == 0) { if (strcmp(isa_dev->prom_node->name, "rtc") == 0) {
rtc_port = isa_dev->resource.start; rtc_port = isa_dev->resource.start;
rtc_irq = isa_dev->irq; rtc_irq = isa_dev->irq;
goto found; goto found;
......
...@@ -199,7 +199,7 @@ static int __init sparcspkr_init(void) ...@@ -199,7 +199,7 @@ static int __init sparcspkr_init(void)
for_each_ebus(ebus) { for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) { for_each_ebusdev(edev, ebus) {
if (!strcmp(edev->prom_name, "beep")) { if (!strcmp(edev->prom_node->name, "beep")) {
beep_name = "Sparc EBUS Speaker"; beep_name = "Sparc EBUS Speaker";
beep_event = ebus_spkr_event; beep_event = ebus_spkr_event;
beep_iobase = edev->resource[0].start; beep_iobase = edev->resource[0].start;
...@@ -213,7 +213,7 @@ static int __init sparcspkr_init(void) ...@@ -213,7 +213,7 @@ static int __init sparcspkr_init(void)
/* A hack, the beep device's base lives in /* A hack, the beep device's base lives in
* the DMA isa node. * the DMA isa node.
*/ */
if (!strcmp(isa_dev->prom_name, "dma")) { if (!strcmp(isa_dev->prom_node->name, "dma")) {
beep_name = "Sparc ISA Speaker"; beep_name = "Sparc ISA Speaker";
beep_event = isa_spkr_event, beep_event = isa_spkr_event,
beep_iobase = isa_dev->resource.start; beep_iobase = isa_dev->resource.start;
......
...@@ -74,7 +74,7 @@ static int __init i8042_platform_init(void) ...@@ -74,7 +74,7 @@ static int __init i8042_platform_init(void)
for_each_ebus(ebus) { for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) { for_each_ebusdev(edev, ebus) {
if (!strcmp(edev->prom_name, "8042")) if (!strcmp(edev->prom_node->name, "8042"))
goto edev_found; goto edev_found;
} }
} }
...@@ -82,14 +82,14 @@ static int __init i8042_platform_init(void) ...@@ -82,14 +82,14 @@ static int __init i8042_platform_init(void)
edev_found: edev_found:
for_each_edevchild(edev, child) { for_each_edevchild(edev, child) {
if (!strcmp(child->prom_name, OBP_PS2KBD_NAME1) || if (!strcmp(child->prom_node->name, OBP_PS2KBD_NAME1) ||
!strcmp(child->prom_name, OBP_PS2KBD_NAME2)) { !strcmp(child->prom_node->name, OBP_PS2KBD_NAME2)) {
i8042_kbd_irq = child->irqs[0]; i8042_kbd_irq = child->irqs[0];
kbd_iobase = kbd_iobase =
ioremap(child->resource[0].start, 8); ioremap(child->resource[0].start, 8);
} }
if (!strcmp(child->prom_name, OBP_PS2MS_NAME1) || if (!strcmp(child->prom_node->name, OBP_PS2MS_NAME1) ||
!strcmp(child->prom_name, OBP_PS2MS_NAME2)) !strcmp(child->prom_node->name, OBP_PS2MS_NAME2))
i8042_aux_irq = child->irqs[0]; i8042_aux_irq = child->irqs[0];
} }
if (i8042_kbd_irq == -1 || if (i8042_kbd_irq == -1 ||
......
...@@ -575,9 +575,9 @@ int bbc_envctrl_init(void) ...@@ -575,9 +575,9 @@ int bbc_envctrl_init(void)
int devidx = 0; int devidx = 0;
while ((echild = bbc_i2c_getdev(devidx++)) != NULL) { while ((echild = bbc_i2c_getdev(devidx++)) != NULL) {
if (!strcmp(echild->prom_name, "temperature")) if (!strcmp(echild->prom_node->name, "temperature"))
attach_one_temp(echild, temp_index++); attach_one_temp(echild, temp_index++);
if (!strcmp(echild->prom_name, "fan-control")) if (!strcmp(echild->prom_node->name, "fan-control"))
attach_one_fan(echild, fan_index++); attach_one_fan(echild, fan_index++);
} }
if (temp_index != 0 && fan_index != 0) { if (temp_index != 0 && fan_index != 0) {
......
...@@ -423,7 +423,7 @@ static int __init bbc_present(void) ...@@ -423,7 +423,7 @@ static int __init bbc_present(void)
for_each_ebus(ebus) { for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) { for_each_ebusdev(edev, ebus) {
if (!strcmp(edev->prom_name, "bbc")) if (!strcmp(edev->prom_node->name, "bbc"))
return 1; return 1;
} }
} }
...@@ -446,7 +446,7 @@ static int __init bbc_i2c_init(void) ...@@ -446,7 +446,7 @@ static int __init bbc_i2c_init(void)
for_each_ebus(ebus) { for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) { for_each_ebusdev(edev, ebus) {
if (!strcmp(edev->prom_name, "i2c")) { if (!strcmp(edev->prom_node->name, "i2c")) {
if (!attach_one_i2c(edev, index)) if (!attach_one_i2c(edev, index))
index++; index++;
} }
......
...@@ -184,7 +184,7 @@ static int __init d7s_init(void) ...@@ -184,7 +184,7 @@ static int __init d7s_init(void)
for_each_ebus(ebus) { for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) { for_each_ebusdev(edev, ebus) {
if (!strcmp(edev->prom_name, D7S_OBPNAME)) if (!strcmp(edev->prom_node->name, D7S_OBPNAME))
goto ebus_done; goto ebus_done;
} }
} }
......
...@@ -768,16 +768,14 @@ static void envctrl_set_mon(struct i2c_child_t *pchild, ...@@ -768,16 +768,14 @@ static void envctrl_set_mon(struct i2c_child_t *pchild,
* decoding tables, monitor type, optional properties. * decoding tables, monitor type, optional properties.
* Return: None. * Return: None.
*/ */
static void envctrl_init_adc(struct i2c_child_t *pchild, int node) static void envctrl_init_adc(struct i2c_child_t *pchild, struct device_node *dp)
{ {
char chnls_desc[CHANNEL_DESC_SZ];
int i = 0, len; int i = 0, len;
char *pos = chnls_desc; char *pos;
unsigned int *pval;
/* Firmware describe channels into a stream separated by a '\0'. */ /* Firmware describe channels into a stream separated by a '\0'. */
len = prom_getproperty(node, "channels-description", chnls_desc, pos = of_get_property(dp, "channels-description", &len);
CHANNEL_DESC_SZ);
chnls_desc[CHANNEL_DESC_SZ - 1] = '\0';
while (len > 0) { while (len > 0) {
int l = strlen(pos) + 1; int l = strlen(pos) + 1;
...@@ -787,10 +785,13 @@ static void envctrl_init_adc(struct i2c_child_t *pchild, int node) ...@@ -787,10 +785,13 @@ static void envctrl_init_adc(struct i2c_child_t *pchild, int node)
} }
/* Get optional properties. */ /* Get optional properties. */
len = prom_getproperty(node, "warning-temp", (char *)&warning_temperature, pval = of_get_property(dp, "warning-temp", NULL);
sizeof(warning_temperature)); if (pval)
len = prom_getproperty(node, "shutdown-temp", (char *)&shutdown_temperature, warning_temperature = *pval;
sizeof(shutdown_temperature));
pval = of_get_property(dp, "shutdown-temp", NULL);
if (pval)
shutdown_temperature = *pval;
} }
/* Function Description: Initialize child device monitoring fan status. /* Function Description: Initialize child device monitoring fan status.
...@@ -864,21 +865,18 @@ static void envctrl_init_voltage_status(struct i2c_child_t *pchild) ...@@ -864,21 +865,18 @@ static void envctrl_init_voltage_status(struct i2c_child_t *pchild)
static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child, static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child,
struct i2c_child_t *pchild) struct i2c_child_t *pchild)
{ {
int node, len, i, tbls_size = 0; int len, i, tbls_size = 0;
struct device_node *dp = edev_child->prom_node;
node = edev_child->prom_node; void *pval;
/* Get device address. */ /* Get device address. */
len = prom_getproperty(node, "reg", pval = of_get_property(dp, "reg", &len);
(char *) &(pchild->addr), memcpy(&pchild->addr, pval, len);
sizeof(pchild->addr));
/* Get tables property. Read firmware temperature tables. */ /* Get tables property. Read firmware temperature tables. */
len = prom_getproperty(node, "translation", pval = of_get_property(dp, "translation", &len);
(char *) pchild->tblprop_array, if (pval && len > 0) {
(PCF8584_MAX_CHANNELS * memcpy(pchild->tblprop_array, pval, len);
sizeof(struct pcf8584_tblprop)));
if (len > 0) {
pchild->total_tbls = len / sizeof(struct pcf8584_tblprop); pchild->total_tbls = len / sizeof(struct pcf8584_tblprop);
for (i = 0; i < pchild->total_tbls; i++) { for (i = 0; i < pchild->total_tbls; i++) {
if ((pchild->tblprop_array[i].size + pchild->tblprop_array[i].offset) > tbls_size) { if ((pchild->tblprop_array[i].size + pchild->tblprop_array[i].offset) > tbls_size) {
...@@ -891,12 +889,12 @@ static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child, ...@@ -891,12 +889,12 @@ static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child,
printk("envctrl: Failed to allocate table.\n"); printk("envctrl: Failed to allocate table.\n");
return; return;
} }
len = prom_getproperty(node, "tables", pval = of_get_property(dp, "tables", &len);
(char *) pchild->tables, tbls_size); if (!pval || len <= 0) {
if (len <= 0) {
printk("envctrl: Failed to get table.\n"); printk("envctrl: Failed to get table.\n");
return; return;
} }
memcpy(pchild->tables, pval, len);
} }
/* SPARCengine ASM Reference Manual (ref. SMI doc 805-7581-04) /* SPARCengine ASM Reference Manual (ref. SMI doc 805-7581-04)
...@@ -907,12 +905,11 @@ static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child, ...@@ -907,12 +905,11 @@ static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child,
* 'NULL' monitor type. * 'NULL' monitor type.
*/ */
if (ENVCTRL_CPCI_IGNORED_NODE == pchild->addr) { if (ENVCTRL_CPCI_IGNORED_NODE == pchild->addr) {
struct device_node *root_node;
int len; int len;
char prop[56];
len = prom_getproperty(prom_root_node, "name", prop, sizeof(prop)); root_node = of_find_node_by_path("/");
if (0 < len && (0 == strncmp(prop, "SUNW,UltraSPARC-IIi-cEngine", len))) if (!strcmp(root_node->name, "SUNW,UltraSPARC-IIi-cEngine")) {
{
for (len = 0; len < PCF8584_MAX_CHANNELS; ++len) { for (len = 0; len < PCF8584_MAX_CHANNELS; ++len) {
pchild->mon_type[len] = ENVCTRL_NOMON; pchild->mon_type[len] = ENVCTRL_NOMON;
} }
...@@ -921,16 +918,14 @@ static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child, ...@@ -921,16 +918,14 @@ static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child,
} }
/* Get the monitor channels. */ /* Get the monitor channels. */
len = prom_getproperty(node, "channels-in-use", pval = of_get_property(dp, "channels-in-use", &len);
(char *) pchild->chnl_array, memcpy(pchild->chnl_array, pval, len);
(PCF8584_MAX_CHANNELS *
sizeof(struct pcf8584_channel)));
pchild->total_chnls = len / sizeof(struct pcf8584_channel); pchild->total_chnls = len / sizeof(struct pcf8584_channel);
for (i = 0; i < pchild->total_chnls; i++) { for (i = 0; i < pchild->total_chnls; i++) {
switch (pchild->chnl_array[i].type) { switch (pchild->chnl_array[i].type) {
case PCF8584_TEMP_TYPE: case PCF8584_TEMP_TYPE:
envctrl_init_adc(pchild, node); envctrl_init_adc(pchild, dp);
break; break;
case PCF8584_GLOBALADDR_TYPE: case PCF8584_GLOBALADDR_TYPE:
...@@ -945,7 +940,7 @@ static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child, ...@@ -945,7 +940,7 @@ static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child,
case PCF8584_VOLTAGE_TYPE: case PCF8584_VOLTAGE_TYPE:
if (pchild->i2ctype == I2C_ADC) { if (pchild->i2ctype == I2C_ADC) {
envctrl_init_adc(pchild,node); envctrl_init_adc(pchild,dp);
} else { } else {
envctrl_init_voltage_status(pchild); envctrl_init_voltage_status(pchild);
} }
...@@ -1046,7 +1041,7 @@ static int __init envctrl_init(void) ...@@ -1046,7 +1041,7 @@ static int __init envctrl_init(void)
for_each_ebus(ebus) { for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) { for_each_ebusdev(edev, ebus) {
if (!strcmp(edev->prom_name, "bbc")) { if (!strcmp(edev->prom_node->name, "bbc")) {
/* If we find a boot-bus controller node, /* If we find a boot-bus controller node,
* then this envctrl driver is not for us. * then this envctrl driver is not for us.
*/ */
...@@ -1060,14 +1055,14 @@ static int __init envctrl_init(void) ...@@ -1060,14 +1055,14 @@ static int __init envctrl_init(void)
*/ */
for_each_ebus(ebus) { for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) { for_each_ebusdev(edev, ebus) {
if (!strcmp(edev->prom_name, "i2c")) { if (!strcmp(edev->prom_node->name, "i2c")) {
i2c = ioremap(edev->resource[0].start, 0x2); i2c = ioremap(edev->resource[0].start, 0x2);
for_each_edevchild(edev, edev_child) { for_each_edevchild(edev, edev_child) {
if (!strcmp("gpio", edev_child->prom_name)) { if (!strcmp("gpio", edev_child->prom_node->name)) {
i2c_childlist[i].i2ctype = I2C_GPIO; i2c_childlist[i].i2ctype = I2C_GPIO;
envctrl_init_i2c_child(edev_child, &(i2c_childlist[i++])); envctrl_init_i2c_child(edev_child, &(i2c_childlist[i++]));
} }
if (!strcmp("adc", edev_child->prom_name)) { if (!strcmp("adc", edev_child->prom_node->name)) {
i2c_childlist[i].i2ctype = I2C_ADC; i2c_childlist[i].i2ctype = I2C_ADC;
envctrl_init_i2c_child(edev_child, &(i2c_childlist[i++])); envctrl_init_i2c_child(edev_child, &(i2c_childlist[i++]));
} }
......
...@@ -192,9 +192,11 @@ static int __init flash_init(void) ...@@ -192,9 +192,11 @@ static int __init flash_init(void)
} }
if (!sdev) { if (!sdev) {
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
struct linux_prom_registers *ebus_regs;
for_each_ebus(ebus) { for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) { for_each_ebusdev(edev, ebus) {
if (!strcmp(edev->prom_name, "flashprom")) if (!strcmp(edev->prom_node->name, "flashprom"))
goto ebus_done; goto ebus_done;
} }
} }
...@@ -202,23 +204,23 @@ static int __init flash_init(void) ...@@ -202,23 +204,23 @@ static int __init flash_init(void)
if (!edev) if (!edev)
return -ENODEV; return -ENODEV;
len = prom_getproperty(edev->prom_node, "reg", (void *)regs, sizeof(regs)); ebus_regs = of_get_property(edev->prom_node, "reg", &len);
if ((len % sizeof(regs[0])) != 0) { if (!ebus_regs || (len % sizeof(regs[0])) != 0) {
printk("flash: Strange reg property size %d\n", len); printk("flash: Strange reg property size %d\n", len);
return -ENODEV; return -ENODEV;
} }
nregs = len / sizeof(regs[0]); nregs = len / sizeof(ebus_regs[0]);
flash.read_base = edev->resource[0].start; flash.read_base = edev->resource[0].start;
flash.read_size = regs[0].reg_size; flash.read_size = ebus_regs[0].reg_size;
if (nregs == 1) { if (nregs == 1) {
flash.write_base = edev->resource[0].start; flash.write_base = edev->resource[0].start;
flash.write_size = regs[0].reg_size; flash.write_size = ebus_regs[0].reg_size;
} else if (nregs == 2) { } else if (nregs == 2) {
flash.write_base = edev->resource[1].start; flash.write_base = edev->resource[1].start;
flash.write_size = regs[1].reg_size; flash.write_size = ebus_regs[1].reg_size;
} else { } else {
printk("flash: Strange number of regs %d\n", nregs); printk("flash: Strange number of regs %d\n", nregs);
return -ENODEV; return -ENODEV;
......
...@@ -984,19 +984,19 @@ static void __init for_each_sab_edev(void (*callback)(struct linux_ebus_device * ...@@ -984,19 +984,19 @@ static void __init for_each_sab_edev(void (*callback)(struct linux_ebus_device *
for_each_ebus(ebus) { for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) { for_each_ebusdev(edev, ebus) {
if (!strcmp(edev->prom_name, "se")) { if (!strcmp(edev->prom_node->name, "se")) {
callback(edev, arg); callback(edev, arg);
continue; continue;
} else if (!strcmp(edev->prom_name, "serial")) { } else if (!strcmp(edev->prom_node->name, "serial")) {
char compat[32]; char *compat;
int clen; int clen;
/* On RIO this can be an SE, check it. We could /* On RIO this can be an SE, check it. We could
* just check ebus->is_rio, but this is more portable. * just check ebus->is_rio, but this is more portable.
*/ */
clen = prom_getproperty(edev->prom_node, "compatible", compat = of_get_property(edev->prom_node,
compat, sizeof(compat)); "compatible", &clen);
if (clen > 0) { if (compat && clen > 0) {
if (strncmp(compat, "sab82532", 8) == 0) { if (strncmp(compat, "sab82532", 8) == 0) {
callback(edev, arg); callback(edev, arg);
continue; continue;
......
...@@ -1053,7 +1053,7 @@ static void sunsu_autoconfig(struct uart_sunsu_port *up) ...@@ -1053,7 +1053,7 @@ static void sunsu_autoconfig(struct uart_sunsu_port *up)
*/ */
for_each_ebus(ebus) { for_each_ebus(ebus) {
for_each_ebusdev(dev, ebus) { for_each_ebusdev(dev, ebus) {
if (dev->prom_node == up->port_node) { if (dev->prom_node->node == up->port_node) {
/* /*
* The EBus is broken on sparc; it delivers * The EBus is broken on sparc; it delivers
* virtual addresses in resources. Oh well... * virtual addresses in resources. Oh well...
...@@ -1073,7 +1073,7 @@ static void sunsu_autoconfig(struct uart_sunsu_port *up) ...@@ -1073,7 +1073,7 @@ static void sunsu_autoconfig(struct uart_sunsu_port *up)
#ifdef CONFIG_SPARC64 #ifdef CONFIG_SPARC64
for_each_isa(isa_br) { for_each_isa(isa_br) {
for_each_isadev(isa_dev, isa_br) { for_each_isadev(isa_dev, isa_br) {
if (isa_dev->prom_node == up->port_node) { if (isa_dev->prom_node->node == up->port_node) {
/* Same on sparc64. Cool architecure... */ /* Same on sparc64. Cool architecure... */
up->port.membase = (char *) isa_dev->resource.start; up->port.membase = (char *) isa_dev->resource.start;
up->port.mapbase = isa_dev->resource.start; up->port.mapbase = isa_dev->resource.start;
......
...@@ -10,13 +10,13 @@ ...@@ -10,13 +10,13 @@
#include <asm/pbm.h> #include <asm/pbm.h>
#include <asm/oplib.h> #include <asm/oplib.h>
#include <asm/prom.h>
struct linux_ebus_child { struct linux_ebus_child {
struct linux_ebus_child *next; struct linux_ebus_child *next;
struct linux_ebus_device *parent; struct linux_ebus_device *parent;
struct linux_ebus *bus; struct linux_ebus *bus;
int prom_node; struct device_node *prom_node;
char prom_name[64];
struct resource resource[PROMREG_MAX]; struct resource resource[PROMREG_MAX];
int num_addrs; int num_addrs;
unsigned int irqs[PROMINTR_MAX]; unsigned int irqs[PROMINTR_MAX];
...@@ -27,8 +27,7 @@ struct linux_ebus_device { ...@@ -27,8 +27,7 @@ struct linux_ebus_device {
struct linux_ebus_device *next; struct linux_ebus_device *next;
struct linux_ebus_child *children; struct linux_ebus_child *children;
struct linux_ebus *bus; struct linux_ebus *bus;
int prom_node; struct device_node *prom_node;
char prom_name[64];
struct resource resource[PROMREG_MAX]; struct resource resource[PROMREG_MAX];
int num_addrs; int num_addrs;
unsigned int irqs[PROMINTR_MAX]; unsigned int irqs[PROMINTR_MAX];
...@@ -42,8 +41,7 @@ struct linux_ebus { ...@@ -42,8 +41,7 @@ struct linux_ebus {
struct pci_dev *self; struct pci_dev *self;
int index; int index;
int is_rio; int is_rio;
int prom_node; struct device_node *prom_node;
char prom_name[64];
struct linux_prom_ebus_ranges ebus_ranges[PROMREG_MAX]; struct linux_prom_ebus_ranges ebus_ranges[PROMREG_MAX];
int num_ebus_ranges; int num_ebus_ranges;
struct linux_prom_ebus_intmap ebus_intmap[PROMREG_MAX]; struct linux_prom_ebus_intmap ebus_intmap[PROMREG_MAX];
......
...@@ -498,15 +498,14 @@ static int sun_pci_fd_test_drive(unsigned long port, int drive) ...@@ -498,15 +498,14 @@ static int sun_pci_fd_test_drive(unsigned long port, int drive)
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
static int __init ebus_fdthree_p(struct linux_ebus_device *edev) static int __init ebus_fdthree_p(struct linux_ebus_device *edev)
{ {
if (!strcmp(edev->prom_name, "fdthree")) if (!strcmp(edev->prom_node->name, "fdthree"))
return 1; return 1;
if (!strcmp(edev->prom_name, "floppy")) { if (!strcmp(edev->prom_node->name, "floppy")) {
char compat[16]; char *compat;
prom_getstring(edev->prom_node,
"compatible", compat = of_get_property(edev->prom_node,
compat, sizeof(compat)); "compatible", NULL);
compat[15] = '\0'; if (compat && !strcmp(compat, "fdthree"))
if (!strcmp(compat, "fdthree"))
return 1; return 1;
} }
return 0; return 0;
...@@ -524,12 +523,12 @@ static unsigned long __init isa_floppy_init(void) ...@@ -524,12 +523,12 @@ static unsigned long __init isa_floppy_init(void)
for_each_isa(isa_br) { for_each_isa(isa_br) {
for_each_isadev(isa_dev, isa_br) { for_each_isadev(isa_dev, isa_br) {
if (!strcmp(isa_dev->prom_name, "dma")) { if (!strcmp(isa_dev->prom_node->name, "dma")) {
struct sparc_isa_device *child = struct sparc_isa_device *child =
isa_dev->child; isa_dev->child;
while (child) { while (child) {
if (!strcmp(child->prom_name, if (!strcmp(child->prom_node->name,
"floppy")) { "floppy")) {
isa_dev = child; isa_dev = child;
goto isa_done; goto isa_done;
...@@ -614,6 +613,7 @@ static unsigned long __init sun_floppy_init(void) ...@@ -614,6 +613,7 @@ static unsigned long __init sun_floppy_init(void)
struct linux_ebus_device *edev = NULL; struct linux_ebus_device *edev = NULL;
unsigned long config = 0; unsigned long config = 0;
void __iomem *auxio_reg; void __iomem *auxio_reg;
char *state_prop;
for_each_ebus(ebus) { for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) { for_each_ebusdev(edev, ebus) {
...@@ -630,9 +630,8 @@ static unsigned long __init sun_floppy_init(void) ...@@ -630,9 +630,8 @@ static unsigned long __init sun_floppy_init(void)
#endif #endif
} }
prom_getproperty(edev->prom_node, "status", state_prop = of_get_property(edev->prom_node, "status", NULL);
state, sizeof(state)); if (state_prop && !strncmp(state_prop, "disabled", 8))
if (!strncmp(state, "disabled", 8))
return 0; return 0;
FLOPPY_IRQ = edev->irqs[0]; FLOPPY_IRQ = edev->irqs[0];
...@@ -703,7 +702,7 @@ static unsigned long __init sun_floppy_init(void) ...@@ -703,7 +702,7 @@ static unsigned long __init sun_floppy_init(void)
*/ */
for_each_ebus(ebus) { for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) { for_each_ebusdev(edev, ebus) {
if (!strcmp(edev->prom_name, "ecpp")) { if (!strcmp(edev->prom_node->name, "ecpp")) {
config = edev->resource[1].start; config = edev->resource[1].start;
goto config_done; goto config_done;
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <asm/pbm.h> #include <asm/pbm.h>
#include <asm/oplib.h> #include <asm/oplib.h>
#include <asm/prom.h>
struct sparc_isa_bridge; struct sparc_isa_bridge;
...@@ -16,9 +17,7 @@ struct sparc_isa_device { ...@@ -16,9 +17,7 @@ struct sparc_isa_device {
struct sparc_isa_device *next; struct sparc_isa_device *next;
struct sparc_isa_device *child; struct sparc_isa_device *child;
struct sparc_isa_bridge *bus; struct sparc_isa_bridge *bus;
int prom_node; struct device_node *prom_node;
char prom_name[64];
char compatible[64];
struct resource resource; struct resource resource;
unsigned int irq; unsigned int irq;
}; };
...@@ -29,8 +28,7 @@ struct sparc_isa_bridge { ...@@ -29,8 +28,7 @@ struct sparc_isa_bridge {
struct pci_pbm_info *parent; struct pci_pbm_info *parent;
struct pci_dev *self; struct pci_dev *self;
int index; int index;
int prom_node; struct device_node *prom_node;
char prom_name[64];
#define linux_prom_isa_ranges linux_prom_ebus_ranges #define linux_prom_isa_ranges linux_prom_ebus_ranges
struct linux_prom_isa_ranges isa_ranges[PROMREG_MAX]; struct linux_prom_isa_ranges isa_ranges[PROMREG_MAX];
int num_isa_ranges; int num_isa_ranges;
......
...@@ -67,18 +67,17 @@ static __inline__ unsigned int get_dma_residue(unsigned int dmanr) ...@@ -67,18 +67,17 @@ static __inline__ unsigned int get_dma_residue(unsigned int dmanr)
static int ebus_ecpp_p(struct linux_ebus_device *edev) static int ebus_ecpp_p(struct linux_ebus_device *edev)
{ {
if (!strcmp(edev->prom_name, "ecpp")) if (!strcmp(edev->prom_node->name, "ecpp"))
return 1; return 1;
if (!strcmp(edev->prom_name, "parallel")) { if (!strcmp(edev->prom_node->name, "parallel")) {
char compat[19]; char *compat;
prom_getstring(edev->prom_node,
"compatible", compat = of_get_property(edev->prom_node,
compat, sizeof(compat)); "compatible", NULL);
compat[18] = '\0'; if (compat &&
if (!strcmp(compat, "ecpp")) (!strcmp(compat, "ecpp") ||
return 1; !strcmp(compat, "ns87317-ecpp") ||
if (!strcmp(compat, "ns87317-ecpp") && !strcmp(compat + 13, "ecpp")))
!strcmp(compat + 13, "ecpp"))
return 1; return 1;
} }
return 0; return 0;
...@@ -94,12 +93,12 @@ static int parport_isa_probe(int count) ...@@ -94,12 +93,12 @@ static int parport_isa_probe(int count)
struct sparc_isa_device *child; struct sparc_isa_device *child;
unsigned long base; unsigned long base;
if (strcmp(isa_dev->prom_name, "dma")) if (strcmp(isa_dev->prom_node->name, "dma"))
continue; continue;
child = isa_dev->child; child = isa_dev->child;
while (child) { while (child) {
if (!strcmp(child->prom_name, "parallel")) if (!strcmp(child->prom_node->name, "parallel"))
break; break;
child = child->next; child = child->next;
} }
......
...@@ -2284,15 +2284,14 @@ static int __init cs4231_init(void) ...@@ -2284,15 +2284,14 @@ static int __init cs4231_init(void)
for_each_ebusdev(edev, ebus) { for_each_ebusdev(edev, ebus) {
int match = 0; int match = 0;
if (!strcmp(edev->prom_name, "SUNW,CS4231")) { if (!strcmp(edev->prom_node->name, "SUNW,CS4231")) {
match = 1; match = 1;
} else if (!strcmp(edev->prom_name, "audio")) { } else if (!strcmp(edev->prom_node->name, "audio")) {
char compat[16]; char *compat;
prom_getstring(edev->prom_node, "compatible", compat = of_get_property(edev->prom_node,
compat, sizeof(compat)); "compatible", NULL);
compat[15] = '\0'; if (compat && !strcmp(compat, "SUNW,CS4231"))
if (!strcmp(compat, "SUNW,CS4231"))
match = 1; match = 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment