Commit 56583747 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Kyle McMartin

[PARISC] Convert parisc_device tree to use struct device klists

Fix parse_tree_node.  much more needs to be done to fix this file.
Signed-off-by: default avatarMatthew Wilcox <willy@parisc-linux.org>

Make drivers.c compile based on a patch from Pat Mochel.

From: Patrick Mochel <mochel@digitalimplant.org>
Signed-off-by: default avatarKyle McMartin <kyle@parisc-linux.org>

Fix drivers.c to create new device tree nodes when no match is found.
Signed-off-by: default avatarRichard Hirst <rhirst@parisc-linux.org>

Do a proper depth-first search returning parents before children, using the
new klist infrastructure.
Signed-off-by: default avatarRichard Hirst <rhirst@parisc-linux.org>

Fixed parisc_device traversal so that pdc_stable works again
Fixed check_dev so it doesn't dereference a parisc_device until it
has verified the bus type
Signed-off-by: default avatarRandolph Chung <tausq@parisc-linux.org>

Convert pa_dev->hpa from an unsigned long to a struct resource.
Use insert_resource() instead of request_mem_region().
Request resources at bus walk time instead of driver probe time.
Don't release the resources as we don't have any hotplug parisc_device
support yet.
Add parisc_pathname() to conveniently get the textual representation
of the hwpath used in sysfs.
Inline the remnants of claim_device() into its caller.
Signed-off-by: default avatarMatthew Wilcox <willy@parisc-linux.org>

I noticed that some of the STI regions weren't showing up in iomem.
Reading the STI spec indicated that all STI devices occupy at least 32MB.
So check for STI HPAs and give them 32MB instead of 4kB.
Signed-off-by: default avatarMatthew Wilcox <willy@parisc-linux.org>
Signed-off-by: default avatarKyle McMartin <kyle@parisc-linux.org>
parent 63172cb3
This diff is collapsed.
...@@ -183,12 +183,20 @@ void gsc_asic_assign_irq(struct gsc_asic *asic, int local_irq, int *irqp) ...@@ -183,12 +183,20 @@ void gsc_asic_assign_irq(struct gsc_asic *asic, int local_irq, int *irqp)
*irqp = irq; *irqp = irq;
} }
static struct device *next_device(struct klist_iter *i)
{
struct klist_node * n = klist_next(i);
return n ? container_of(n, struct device, knode_parent) : NULL;
}
void gsc_fixup_irqs(struct parisc_device *parent, void *ctrl, void gsc_fixup_irqs(struct parisc_device *parent, void *ctrl,
void (*choose_irq)(struct parisc_device *, void *)) void (*choose_irq)(struct parisc_device *, void *))
{ {
struct device *dev; struct device *dev;
struct klist_iter i;
list_for_each_entry(dev, &parent->dev.children, node) { klist_iter_init(&parent->dev.klist_children, &i);
while ((dev = next_device(&i))) {
struct parisc_device *padev = to_parisc_device(dev); struct parisc_device *padev = to_parisc_device(dev);
/* work-around for 715/64 and others which have parent /* work-around for 715/64 and others which have parent
...@@ -197,6 +205,7 @@ void gsc_fixup_irqs(struct parisc_device *parent, void *ctrl, ...@@ -197,6 +205,7 @@ void gsc_fixup_irqs(struct parisc_device *parent, void *ctrl,
return gsc_fixup_irqs(padev, ctrl, choose_irq); return gsc_fixup_irqs(padev, ctrl, choose_irq);
choose_irq(padev, ctrl); choose_irq(padev, ctrl);
} }
klist_iter_exit(&i);
} }
int gsc_common_setup(struct parisc_device *parent, struct gsc_asic *gsc_asic) int gsc_common_setup(struct parisc_device *parent, struct gsc_asic *gsc_asic)
......
...@@ -1322,19 +1322,29 @@ sba_alloc_pdir(unsigned int pdir_size) ...@@ -1322,19 +1322,29 @@ sba_alloc_pdir(unsigned int pdir_size)
return (void *) pdir_base; return (void *) pdir_base;
} }
static struct device *next_device(struct klist_iter *i)
{
struct klist_node * n = klist_next(i);
return n ? container_of(n, struct device, knode_parent) : NULL;
}
/* setup Mercury or Elroy IBASE/IMASK registers. */ /* setup Mercury or Elroy IBASE/IMASK registers. */
static void setup_ibase_imask(struct parisc_device *sba, struct ioc *ioc, int ioc_num) static void
setup_ibase_imask(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
{ {
/* lba_set_iregs() is in drivers/parisc/lba_pci.c */ /* lba_set_iregs() is in drivers/parisc/lba_pci.c */
extern void lba_set_iregs(struct parisc_device *, u32, u32); extern void lba_set_iregs(struct parisc_device *, u32, u32);
struct device *dev; struct device *dev;
struct klist_iter i;
list_for_each_entry(dev, &sba->dev.children, node) { klist_iter_init(&sba->dev.klist_children, &i);
while ((dev = next_device(&i))) {
struct parisc_device *lba = to_parisc_device(dev); struct parisc_device *lba = to_parisc_device(dev);
int rope_num = (lba->hpa >> 13) & 0xf; int rope_num = (lba->hpa.start >> 13) & 0xf;
if (rope_num >> 3 == ioc_num) if (rope_num >> 3 == ioc_num)
lba_set_iregs(lba, ioc->ibase, ioc->imask); lba_set_iregs(lba, ioc->ibase, ioc->imask);
} }
klist_iter_exit(&i);
} }
static void static void
......
...@@ -39,6 +39,11 @@ struct parisc_driver { ...@@ -39,6 +39,11 @@ struct parisc_driver {
#define to_parisc_driver(d) container_of(d, struct parisc_driver, drv) #define to_parisc_driver(d) container_of(d, struct parisc_driver, drv)
#define parisc_parent(d) to_parisc_device(d->dev.parent) #define parisc_parent(d) to_parisc_device(d->dev.parent)
static inline char *parisc_pathname(struct parisc_device *d)
{
return d->dev.bus_id;
}
static inline void static inline void
parisc_set_drvdata(struct parisc_device *d, void *p) parisc_set_drvdata(struct parisc_device *d, void *p)
{ {
......
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