Skip to content

Commit

Permalink
[SBUS]: Rewrite and plug into of_device framework.
Browse files Browse the repository at this point in the history
I severely apologize, I was still learning how to program
in C when I wrote this stuff 10 years ago...

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller authored and David S. Miller committed Jun 24, 2006
1 parent fd53143 commit 576c352
Show file tree
Hide file tree
Showing 5 changed files with 293 additions and 327 deletions.
85 changes: 85 additions & 0 deletions arch/sparc/kernel/ioport.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
#include <asm/io.h>
#include <asm/vaddrs.h>
#include <asm/oplib.h>
#include <asm/prom.h>
#include <asm/sbus.h>
#include <asm/page.h>
#include <asm/pgalloc.h>
#include <asm/dma.h>
Expand Down Expand Up @@ -458,6 +460,89 @@ void sbus_dma_sync_sg_for_device(struct sbus_dev *sdev, struct scatterlist *sg,
{
printk("sbus_dma_sync_sg_for_device: not implemented yet\n");
}

/* Support code for sbus_init(). */
/*
* XXX This functions appears to be a distorted version of
* prom_sbus_ranges_init(), with all sun4d stuff cut away.
* Ask DaveM what is going on here, how is sun4d supposed to work... XXX
*/
/* added back sun4d patch from Thomas Bogendoerfer - should be OK (crn) */
void __init sbus_arch_bus_ranges_init(struct device_node *pn, struct sbus_bus *sbus)
{
int parent_node = pn->node;

if (sparc_cpu_model == sun4d) {
struct linux_prom_ranges iounit_ranges[PROMREG_MAX];
int num_iounit_ranges, len;

len = prom_getproperty(parent_node, "ranges",
(char *) iounit_ranges,
sizeof (iounit_ranges));
if (len != -1) {
num_iounit_ranges =
(len / sizeof(struct linux_prom_ranges));
prom_adjust_ranges(sbus->sbus_ranges,
sbus->num_sbus_ranges,
iounit_ranges, num_iounit_ranges);
}
}
}

void __init sbus_setup_iommu(struct sbus_bus *sbus, struct device_node *dp)
{
struct device_node *parent = dp->parent;

if (sparc_cpu_model != sun4d &&
parent != NULL &&
!strcmp(parent->name, "iommu")) {
extern void iommu_init(int iommu_node, struct sbus_bus *sbus);

iommu_init(parent->node, sbus);
}

if (sparc_cpu_model == sun4d) {
extern void iounit_init(int sbi_node, int iounit_node,
struct sbus_bus *sbus);

iounit_init(dp->node, parent->node, sbus);
}
}

void __init sbus_setup_arch_props(struct sbus_bus *sbus, struct device_node *dp)
{
if (sparc_cpu_model == sun4d) {
struct device_node *parent = dp->parent;

sbus->devid = of_getintprop_default(parent, "device-id", 0);
sbus->board = of_getintprop_default(parent, "board#", 0);
}
}

int __init sbus_arch_preinit(void)
{
extern void register_proc_sparc_ioport(void);

register_proc_sparc_ioport();

#ifdef CONFIG_SUN4
{
extern void sun4_dvma_init(void);
sun4_dvma_init();
}
return 1;
#else
return 0;
#endif
}

void __init sbus_arch_postinit(void)
{
if (sparc_cpu_model == sun4d) {
extern void sun4d_init_sbi_irq(void);
sun4d_init_sbi_irq();
}
}
#endif /* CONFIG_SBUS */

#ifdef CONFIG_PCI
Expand Down
31 changes: 30 additions & 1 deletion arch/sparc64/kernel/sbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ static void __init sysio_register_error_handlers(struct sbus_bus *sbus)
}

/* Boot time initialization. */
void __init sbus_iommu_init(int __node, struct sbus_bus *sbus)
static void __init sbus_iommu_init(int __node, struct sbus_bus *sbus)
{
struct linux_prom64_registers *pr;
struct device_node *dp;
Expand Down Expand Up @@ -1247,3 +1247,32 @@ void sbus_fill_device_irq(struct sbus_dev *sdev)
sdev->irqs[0] = sbus_build_irq(sdev->bus, pri);
}
}

void __init sbus_arch_bus_ranges_init(struct device_node *pn, struct sbus_bus *sbus)
{
}

void __init sbus_setup_iommu(struct sbus_bus *sbus, struct device_node *dp)
{
sbus_iommu_init(dp->node, sbus);
}

void __init sbus_setup_arch_props(struct sbus_bus *sbus, struct device_node *dp)
{
}

int __init sbus_arch_preinit(void)
{
return 0;
}

void __init sbus_arch_postinit(void)
{
extern void firetruck_init(void);
extern void auxio_probe(void);
extern void clock_probe(void);

firetruck_init();
auxio_probe();
clock_probe();
}
Loading

0 comments on commit 576c352

Please sign in to comment.