Commit b69416b5 authored by David S. Miller's avatar David S. Miller

sparc64: Rewrite central driver.

This driver is now limited to just doing the basic clock board and FHC
chip initialization and registering the platform devices for the
per-board LEDs, which are driven by the new LEDS_STARFIRE driver.

The IRQ register handling is already confined purely to the device
tree code.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5843492c
/* /* fhc.h: FHC and Clock board register definitions.
* fhc.h: Structures for central/fhc pseudo driver on Sunfire/Starfire/Wildfire.
* *
* Copyright (C) 1997, 1999 David S. Miller (davem@redhat.com) * Copyright (C) 1997, 1999 David S. Miller (davem@redhat.com)
*/ */
...@@ -7,14 +6,6 @@ ...@@ -7,14 +6,6 @@
#ifndef _SPARC64_FHC_H #ifndef _SPARC64_FHC_H
#define _SPARC64_FHC_H #define _SPARC64_FHC_H
#include <linux/timer.h>
#include <asm/oplib.h>
#include <asm/prom.h>
#include <asm/upa.h>
struct linux_fhc;
/* Clock board register offsets. */ /* Clock board register offsets. */
#define CLOCK_CTRL 0x00UL /* Main control */ #define CLOCK_CTRL 0x00UL /* Main control */
#define CLOCK_STAT1 0x10UL /* Status one */ #define CLOCK_STAT1 0x10UL /* Status one */
...@@ -29,21 +20,7 @@ struct linux_fhc; ...@@ -29,21 +20,7 @@ struct linux_fhc;
#define CLOCK_CTRL_MLED 0x02 /* Mid LED, 1 == on */ #define CLOCK_CTRL_MLED 0x02 /* Mid LED, 1 == on */
#define CLOCK_CTRL_RLED 0x01 /* RIght LED, 1 == on */ #define CLOCK_CTRL_RLED 0x01 /* RIght LED, 1 == on */
struct linux_central {
struct linux_fhc *child;
unsigned long cfreg;
unsigned long clkregs;
unsigned long clkver;
int slots;
struct device_node *prom_node;
struct linux_prom_ranges central_ranges[PROMREG_MAX];
int num_central_ranges;
};
/* Firehose controller register offsets */ /* Firehose controller register offsets */
struct fhc_regs {
unsigned long pregs; /* FHC internal regs */
#define FHC_PREGS_ID 0x00UL /* FHC ID */ #define FHC_PREGS_ID 0x00UL /* FHC ID */
#define FHC_ID_VERS 0xf0000000 /* Version of this FHC */ #define FHC_ID_VERS 0xf0000000 /* Version of this FHC */
#define FHC_ID_PARTID 0x0ffff000 /* Part ID code (0x0f9f == FHC) */ #define FHC_ID_PARTID 0x0ffff000 /* Part ID code (0x0f9f == FHC) */
...@@ -90,32 +67,14 @@ struct fhc_regs { ...@@ -90,32 +67,14 @@ struct fhc_regs {
#define FHC_JTAG_CTRL_MENAB 0x80000000 /* Indicates this is JTAG Master */ #define FHC_JTAG_CTRL_MENAB 0x80000000 /* Indicates this is JTAG Master */
#define FHC_JTAG_CTRL_MNONE 0x40000000 /* Indicates no JTAG Master present */ #define FHC_JTAG_CTRL_MNONE 0x40000000 /* Indicates no JTAG Master present */
#define FHC_PREGS_JCMD 0x100UL /* FHC JTAG Command Register */ #define FHC_PREGS_JCMD 0x100UL /* FHC JTAG Command Register */
unsigned long ireg; /* FHC IGN reg */
#define FHC_IREG_IGN 0x00UL /* This FHC's IGN */ #define FHC_IREG_IGN 0x00UL /* This FHC's IGN */
unsigned long ffregs; /* FHC fanfail regs */
#define FHC_FFREGS_IMAP 0x00UL /* FHC Fanfail IMAP */ #define FHC_FFREGS_IMAP 0x00UL /* FHC Fanfail IMAP */
#define FHC_FFREGS_ICLR 0x10UL /* FHC Fanfail ICLR */ #define FHC_FFREGS_ICLR 0x10UL /* FHC Fanfail ICLR */
unsigned long sregs; /* FHC system regs */
#define FHC_SREGS_IMAP 0x00UL /* FHC System IMAP */ #define FHC_SREGS_IMAP 0x00UL /* FHC System IMAP */
#define FHC_SREGS_ICLR 0x10UL /* FHC System ICLR */ #define FHC_SREGS_ICLR 0x10UL /* FHC System ICLR */
unsigned long uregs; /* FHC uart regs */
#define FHC_UREGS_IMAP 0x00UL /* FHC Uart IMAP */ #define FHC_UREGS_IMAP 0x00UL /* FHC Uart IMAP */
#define FHC_UREGS_ICLR 0x10UL /* FHC Uart ICLR */ #define FHC_UREGS_ICLR 0x10UL /* FHC Uart ICLR */
unsigned long tregs; /* FHC TOD regs */
#define FHC_TREGS_IMAP 0x00UL /* FHC TOD IMAP */ #define FHC_TREGS_IMAP 0x00UL /* FHC TOD IMAP */
#define FHC_TREGS_ICLR 0x10UL /* FHC TOD ICLR */ #define FHC_TREGS_ICLR 0x10UL /* FHC TOD ICLR */
};
struct linux_fhc {
struct linux_fhc *next;
struct linux_central *parent; /* NULL if not central FHC */
struct fhc_regs fhc_regs;
int board;
int jtag_master;
struct device_node *prom_node;
struct linux_prom_ranges fhc_ranges[PROMREG_MAX];
int num_fhc_ranges;
};
#endif /* !(_SPARC64_FHC_H) */ #endif /* !(_SPARC64_FHC_H) */
/* central.c: Central FHC driver for Sunfire/Starfire/Wildfire. /* central.c: Central FHC driver for Sunfire/Starfire/Wildfire.
* *
* Copyright (C) 1997, 1999 David S. Miller (davem@davemloft.net) * Copyright (C) 1997, 1999, 2008 David S. Miller (davem@davemloft.net)
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/timer.h>
#include <linux/sched.h>
#include <linux/delay.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/bootmem.h> #include <linux/of_device.h>
#include <linux/platform_device.h>
#include <asm/page.h>
#include <asm/fhc.h> #include <asm/fhc.h>
#include <asm/starfire.h> #include <asm/upa.h>
static struct linux_central *central_bus = NULL; struct clock_board {
static struct linux_fhc *fhc_list = NULL; void __iomem *clock_freq_regs;
void __iomem *clock_regs;
void __iomem *clock_ver_reg;
int num_slots;
struct resource leds_resource;
struct platform_device leds_pdev;
};
struct fhc {
void __iomem *pregs;
bool central;
bool jtag_master;
int board_num;
struct resource leds_resource;
struct platform_device leds_pdev;
};
static int __devinit clock_board_calc_nslots(struct clock_board *p)
{
u8 reg = upa_readb(p->clock_regs + CLOCK_STAT1) & 0xc0;
#define IS_CENTRAL_FHC(__fhc) ((__fhc) == central_bus->child) switch (reg) {
case 0x40:
return 16;
static void central_probe_failure(int line) case 0xc0:
{ return 8;
prom_printf("CENTRAL: Critical device probe failure at central.c:%d\n",
line);
prom_halt();
}
static void central_ranges_init(struct linux_central *central) case 0x80:
{ reg = 0;
struct device_node *dp = central->prom_node; if (p->clock_ver_reg)
const void *pval; reg = upa_readb(p->clock_ver_reg);
int len; if (reg) {
if (reg & 0x80)
central->num_central_ranges = 0; return 4;
pval = of_get_property(dp, "ranges", &len); else
if (pval) { return 5;
memcpy(central->central_ranges, pval, len); }
central->num_central_ranges = /* Fallthrough */
(len / sizeof(struct linux_prom_ranges)); default:
return 4;
} }
} }
static void fhc_ranges_init(struct linux_fhc *fhc) static int __devinit clock_board_probe(struct of_device *op,
const struct of_device_id *match)
{ {
struct device_node *dp = fhc->prom_node; struct clock_board *p = kzalloc(sizeof(*p), GFP_KERNEL);
const void *pval; int err = -ENOMEM;
int len;
fhc->num_fhc_ranges = 0;
pval = of_get_property(dp, "ranges", &len);
if (pval) {
memcpy(fhc->fhc_ranges, pval, len);
fhc->num_fhc_ranges =
(len / sizeof(struct linux_prom_ranges));
}
}
/* Range application routines are exported to various drivers, if (!p) {
* so do not __init this. printk(KERN_ERR "clock_board: Cannot allocate struct clock_board\n");
*/ goto out;
static void adjust_regs(struct linux_prom_registers *regp, int nregs,
struct linux_prom_ranges *rangep, int nranges)
{
int regc, rngc;
for (regc = 0; regc < nregs; regc++) {
for (rngc = 0; rngc < nranges; rngc++)
if (regp[regc].which_io == rangep[rngc].ot_child_space)
break; /* Fount it */
if (rngc == nranges) /* oops */
central_probe_failure(__LINE__);
regp[regc].which_io = rangep[rngc].ot_parent_space;
regp[regc].phys_addr -= rangep[rngc].ot_child_base;
regp[regc].phys_addr += rangep[rngc].ot_parent_base;
} }
}
/* Apply probed fhc ranges to registers passed, if no ranges return. */ p->clock_freq_regs = of_ioremap(&op->resource[0], 0,
static void apply_fhc_ranges(struct linux_fhc *fhc, resource_size(&op->resource[0]),
struct linux_prom_registers *regs, "clock_board_freq");
int nregs) if (!p->clock_freq_regs) {
{ printk(KERN_ERR "clock_board: Cannot map clock_freq_regs\n");
if (fhc->num_fhc_ranges) goto out_free;
adjust_regs(regs, nregs, fhc->fhc_ranges, }
fhc->num_fhc_ranges);
}
/* Apply probed central ranges to registers passed, if no ranges return. */ p->clock_regs = of_ioremap(&op->resource[1], 0,
static void apply_central_ranges(struct linux_central *central, resource_size(&op->resource[1]),
struct linux_prom_registers *regs, int nregs) "clock_board_regs");
{ if (!p->clock_regs) {
if (central->num_central_ranges) printk(KERN_ERR "clock_board: Cannot map clock_regs\n");
adjust_regs(regs, nregs, central->central_ranges, goto out_unmap_clock_freq_regs;
central->num_central_ranges); }
}
static void * __init central_alloc_bootmem(unsigned long size) if (op->resource[2].flags) {
{ p->clock_ver_reg = of_ioremap(&op->resource[2], 0,
void *ret; resource_size(&op->resource[2]),
"clock_ver_reg");
if (!p->clock_ver_reg) {
printk(KERN_ERR "clock_board: Cannot map clock_ver_reg\n");
goto out_unmap_clock_regs;
}
}
ret = __alloc_bootmem(size, SMP_CACHE_BYTES, 0UL); p->num_slots = clock_board_calc_nslots(p);
if (ret != NULL)
memset(ret, 0, size);
return ret; p->leds_resource.start = (unsigned long)
} (p->clock_regs + CLOCK_CTRL);
p->leds_resource.end = p->leds_resource.end;
p->leds_resource.name = "leds";
static unsigned long prom_reg_to_paddr(struct linux_prom_registers *r) p->leds_pdev.name = "sunfire-clockboard-leds";
{ p->leds_pdev.resource = &p->leds_resource;
unsigned long ret = ((unsigned long) r->which_io) << 32; p->leds_pdev.num_resources = 1;
p->leds_pdev.dev.parent = &op->dev;
return ret | (unsigned long) r->phys_addr; err = platform_device_register(&p->leds_pdev);
} if (err) {
printk(KERN_ERR "clock_board: Could not register LEDS "
static void __init probe_other_fhcs(void) "platform device\n");
{ goto out_unmap_clock_ver_reg;
struct device_node *dp;
const struct linux_prom64_registers *fpregs;
for_each_node_by_name(dp, "fhc") {
struct linux_fhc *fhc;
int board;
u32 tmp;
if (dp->parent &&
dp->parent->parent != NULL)
continue;
fhc = (struct linux_fhc *)
central_alloc_bootmem(sizeof(struct linux_fhc));
if (fhc == NULL)
central_probe_failure(__LINE__);
/* Link it into the FHC chain. */
fhc->next = fhc_list;
fhc_list = fhc;
/* Toplevel FHCs have no parent. */
fhc->parent = NULL;
fhc->prom_node = dp;
fhc_ranges_init(fhc);
/* Non-central FHC's have 64-bit OBP format registers. */
fpregs = of_get_property(dp, "reg", NULL);
if (!fpregs)
central_probe_failure(__LINE__);
/* Only central FHC needs special ranges applied. */
fhc->fhc_regs.pregs = fpregs[0].phys_addr;
fhc->fhc_regs.ireg = fpregs[1].phys_addr;
fhc->fhc_regs.ffregs = fpregs[2].phys_addr;
fhc->fhc_regs.sregs = fpregs[3].phys_addr;
fhc->fhc_regs.uregs = fpregs[4].phys_addr;
fhc->fhc_regs.tregs = fpregs[5].phys_addr;
board = of_getintprop_default(dp, "board#", -1);
fhc->board = board;
tmp = upa_readl(fhc->fhc_regs.pregs + FHC_PREGS_JCTRL);
if ((tmp & FHC_JTAG_CTRL_MENAB) != 0)
fhc->jtag_master = 1;
else
fhc->jtag_master = 0;
tmp = upa_readl(fhc->fhc_regs.pregs + FHC_PREGS_ID);
printk("FHC(board %d): Version[%x] PartID[%x] Manuf[%x] %s\n",
board,
(tmp & FHC_ID_VERS) >> 28,
(tmp & FHC_ID_PARTID) >> 12,
(tmp & FHC_ID_MANUF) >> 1,
(fhc->jtag_master ? "(JTAG Master)" : ""));
/* This bit must be set in all non-central FHC's in
* the system. When it is clear, this identifies
* the central board.
*/
tmp = upa_readl(fhc->fhc_regs.pregs + FHC_PREGS_CTRL);
tmp |= FHC_CONTROL_IXIST;
upa_writel(tmp, fhc->fhc_regs.pregs + FHC_PREGS_CTRL);
} }
}
static void probe_clock_board(struct linux_central *central, printk(KERN_INFO "clock_board: Detected %d slot Enterprise system.\n",
struct linux_fhc *fhc, p->num_slots);
struct device_node *fp)
{
struct device_node *dp;
struct linux_prom_registers cregs[3];
const struct linux_prom_registers *pr;
int nslots, tmp, nregs;
dp = fp->child;
while (dp) {
if (!strcmp(dp->name, "clock-board"))
break;
dp = dp->sibling;
}
if (!dp)
central_probe_failure(__LINE__);
pr = of_get_property(dp, "reg", &nregs); err = 0;
if (!pr) out:
central_probe_failure(__LINE__); return err;
memcpy(cregs, pr, nregs); out_unmap_clock_ver_reg:
nregs /= sizeof(struct linux_prom_registers); if (p->clock_ver_reg)
of_iounmap(&op->resource[2], p->clock_ver_reg,
resource_size(&op->resource[2]));
apply_fhc_ranges(fhc, &cregs[0], nregs); out_unmap_clock_regs:
apply_central_ranges(central, &cregs[0], nregs); of_iounmap(&op->resource[1], p->clock_regs,
central->cfreg = prom_reg_to_paddr(&cregs[0]); resource_size(&op->resource[1]));
central->clkregs = prom_reg_to_paddr(&cregs[1]);
if (nregs == 2) out_unmap_clock_freq_regs:
central->clkver = 0UL; of_iounmap(&op->resource[0], p->clock_freq_regs,
else resource_size(&op->resource[0]));
central->clkver = prom_reg_to_paddr(&cregs[2]);
tmp = upa_readb(central->clkregs + CLOCK_STAT1); out_free:
tmp &= 0xc0; kfree(p);
switch(tmp) { goto out;
case 0x40:
nslots = 16;
break;
case 0xc0:
nslots = 8;
break;
case 0x80:
if (central->clkver != 0UL &&
upa_readb(central->clkver) != 0) {
if ((upa_readb(central->clkver) & 0x80) != 0)
nslots = 4;
else
nslots = 5;
break;
}
default:
nslots = 4;
break;
};
central->slots = nslots;
printk("CENTRAL: Detected %d slot Enterprise system. cfreg[%02x] cver[%02x]\n",
central->slots, upa_readb(central->cfreg),
(central->clkver ? upa_readb(central->clkver) : 0x00));
} }
static void ZAP(unsigned long iclr, unsigned long imap) static struct of_device_id __initdata clock_board_match[] = {
{
.name = "clock-board",
},
{},
};
static struct of_platform_driver clock_board_driver = {
.match_table = clock_board_match,
.probe = clock_board_probe,
.driver = {
.name = "clock_board",
},
};
static int __devinit fhc_probe(struct of_device *op,
const struct of_device_id *match)
{ {
u32 imap_tmp; struct fhc *p = kzalloc(sizeof(*p), GFP_KERNEL);
int err = -ENOMEM;
upa_writel(0, iclr); u32 reg;
upa_readl(iclr);
imap_tmp = upa_readl(imap);
imap_tmp &= ~(0x80000000);
upa_writel(imap_tmp, imap);
upa_readl(imap);
}
static void init_all_fhc_hw(void) if (!p) {
{ printk(KERN_ERR "fhc: Cannot allocate struct fhc\n");
struct linux_fhc *fhc; goto out;
for (fhc = fhc_list; fhc != NULL; fhc = fhc->next) {
u32 tmp;
/* Clear all of the interrupt mapping registers
* just in case OBP left them in a foul state.
*/
ZAP(fhc->fhc_regs.ffregs + FHC_FFREGS_ICLR,
fhc->fhc_regs.ffregs + FHC_FFREGS_IMAP);
ZAP(fhc->fhc_regs.sregs + FHC_SREGS_ICLR,
fhc->fhc_regs.sregs + FHC_SREGS_IMAP);
ZAP(fhc->fhc_regs.uregs + FHC_UREGS_ICLR,
fhc->fhc_regs.uregs + FHC_UREGS_IMAP);
ZAP(fhc->fhc_regs.tregs + FHC_TREGS_ICLR,
fhc->fhc_regs.tregs + FHC_TREGS_IMAP);
/* Setup FHC control register. */
tmp = upa_readl(fhc->fhc_regs.pregs + FHC_PREGS_CTRL);
/* All non-central boards have this bit set. */
if (! IS_CENTRAL_FHC(fhc))
tmp |= FHC_CONTROL_IXIST;
/* For all FHCs, clear the firmware synchronization
* line and both low power mode enables.
*/
tmp &= ~(FHC_CONTROL_AOFF | FHC_CONTROL_BOFF |
FHC_CONTROL_SLINE);
upa_writel(tmp, fhc->fhc_regs.pregs + FHC_PREGS_CTRL);
upa_readl(fhc->fhc_regs.pregs + FHC_PREGS_CTRL);
} }
} if (!strcmp(op->node->parent->name, "central"))
p->central = true;
void __init central_probe(void) p->pregs = of_ioremap(&op->resource[0], 0,
{ resource_size(&op->resource[0]),
struct linux_prom_registers fpregs[6]; "fhc_pregs");
const struct linux_prom_registers *pr; if (!p->pregs) {
struct linux_fhc *fhc; printk(KERN_ERR "fhc: Cannot map pregs\n");
struct device_node *dp, *fp; goto out_free;
int err;
dp = of_find_node_by_name(NULL, "central");
if (!dp)
return;
/* Ok we got one, grab some memory for software state. */
central_bus = (struct linux_central *)
central_alloc_bootmem(sizeof(struct linux_central));
if (central_bus == NULL)
central_probe_failure(__LINE__);
fhc = (struct linux_fhc *)
central_alloc_bootmem(sizeof(struct linux_fhc));
if (fhc == NULL)
central_probe_failure(__LINE__);
/* First init central. */
central_bus->child = fhc;
central_bus->prom_node = dp;
central_ranges_init(central_bus);
/* And then central's FHC. */
fhc->next = fhc_list;
fhc_list = fhc;
fhc->parent = central_bus;
fp = dp->child;
while (fp) {
if (!strcmp(fp->name, "fhc"))
break;
fp = fp->sibling;
} }
if (!fp)
central_probe_failure(__LINE__);
fhc->prom_node = fp;
fhc_ranges_init(fhc);
/* Now, map in FHC register set. */
pr = of_get_property(fp, "reg", NULL);
if (!pr)
central_probe_failure(__LINE__);
memcpy(fpregs, pr, sizeof(fpregs));
apply_central_ranges(central_bus, &fpregs[0], 6);
fhc->fhc_regs.pregs = prom_reg_to_paddr(&fpregs[0]);
fhc->fhc_regs.ireg = prom_reg_to_paddr(&fpregs[1]);
fhc->fhc_regs.ffregs = prom_reg_to_paddr(&fpregs[2]);
fhc->fhc_regs.sregs = prom_reg_to_paddr(&fpregs[3]);
fhc->fhc_regs.uregs = prom_reg_to_paddr(&fpregs[4]);
fhc->fhc_regs.tregs = prom_reg_to_paddr(&fpregs[5]);
/* Obtain board number from board status register, Central's
* FHC lacks "board#" property.
*/
err = upa_readl(fhc->fhc_regs.pregs + FHC_PREGS_BSR);
fhc->board = (((err >> 16) & 0x01) |
((err >> 12) & 0x0e));
fhc->jtag_master = 0;
/* Attach the clock board registers for CENTRAL. */
probe_clock_board(central_bus, fhc, fp);
err = upa_readl(fhc->fhc_regs.pregs + FHC_PREGS_ID);
printk("FHC(board %d): Version[%x] PartID[%x] Manuf[%x] (CENTRAL)\n",
fhc->board,
((err & FHC_ID_VERS) >> 28),
((err & FHC_ID_PARTID) >> 12),
((err & FHC_ID_MANUF) >> 1));
probe_other_fhcs();
init_all_fhc_hw();
}
static inline void fhc_ledblink(struct linux_fhc *fhc, int on) if (p->central) {
{ reg = upa_readl(p->pregs + FHC_PREGS_BSR);
u32 tmp; p->board_num = ((reg >> 16) & 1) | ((reg >> 12) & 0x0e);
} else {
p->board_num = of_getintprop_default(op->node, "board#", -1);
if (p->board_num == -1) {
printk(KERN_ERR "fhc: No board# property\n");
goto out_unmap_pregs;
}
if (upa_readl(p->pregs + FHC_PREGS_JCTRL) & FHC_JTAG_CTRL_MENAB)
p->jtag_master = true;
}
tmp = upa_readl(fhc->fhc_regs.pregs + FHC_PREGS_CTRL); if (!p->central) {
p->leds_resource.start = (unsigned long)
(p->pregs + FHC_PREGS_CTRL);
p->leds_resource.end = p->leds_resource.end;
p->leds_resource.name = "leds";
p->leds_pdev.name = "sunfire-fhc-leds";
p->leds_pdev.resource = &p->leds_resource;
p->leds_pdev.num_resources = 1;
p->leds_pdev.dev.parent = &op->dev;
err = platform_device_register(&p->leds_pdev);
if (err) {
printk(KERN_ERR "fhc: Could not register LEDS "
"platform device\n");
goto out_unmap_pregs;
}
}
reg = upa_readl(p->pregs + FHC_PREGS_CTRL);
/* NOTE: reverse logic on this bit */ if (!p->central)
if (on) reg |= FHC_CONTROL_IXIST;
tmp &= ~(FHC_CONTROL_RLED);
else
tmp |= FHC_CONTROL_RLED;
tmp &= ~(FHC_CONTROL_AOFF | FHC_CONTROL_BOFF | FHC_CONTROL_SLINE);
upa_writel(tmp, fhc->fhc_regs.pregs + FHC_PREGS_CTRL); reg &= ~(FHC_CONTROL_AOFF |
upa_readl(fhc->fhc_regs.pregs + FHC_PREGS_CTRL); FHC_CONTROL_BOFF |
} FHC_CONTROL_SLINE);
static inline void central_ledblink(struct linux_central *central, int on) upa_writel(reg, p->pregs + FHC_PREGS_CTRL);
{ upa_readl(p->pregs + FHC_PREGS_CTRL);
u8 tmp;
tmp = upa_readb(central->clkregs + CLOCK_CTRL); reg = upa_readl(p->pregs + FHC_PREGS_ID);
printk(KERN_INFO "fhc: Board #%d, Version[%x] PartID[%x] Manuf[%x] %s\n",
p->board_num,
(reg & FHC_ID_VERS) >> 28,
(reg & FHC_ID_PARTID) >> 12,
(reg & FHC_ID_MANUF) >> 1,
(p->jtag_master ?
"(JTAG Master)" :
(p->central ? "(Central)" : "")));
/* NOTE: reverse logic on this bit */ err = 0;
if (on)
tmp &= ~(CLOCK_CTRL_RLED);
else
tmp |= CLOCK_CTRL_RLED;
upa_writeb(tmp, central->clkregs + CLOCK_CTRL); out:
upa_readb(central->clkregs + CLOCK_CTRL); return err;
}
static struct timer_list sftimer; out_unmap_pregs:
static int led_state; of_iounmap(&op->resource[0], p->pregs, resource_size(&op->resource[0]));
static void sunfire_timer(unsigned long __ignored) out_free:
{ kfree(p);
struct linux_fhc *fhc; goto out;
central_ledblink(central_bus, led_state);
for (fhc = fhc_list; fhc != NULL; fhc = fhc->next)
if (! IS_CENTRAL_FHC(fhc))
fhc_ledblink(fhc, led_state);
led_state = ! led_state;
sftimer.expires = jiffies + (HZ >> 1);
add_timer(&sftimer);
} }
/* After PCI/SBUS busses have been probed, this is called to perform static struct of_device_id __initdata fhc_match[] = {
* final initialization of all FireHose Controllers in the system. {
*/ .name = "fhc",
void firetruck_init(void) },
{},
};
static struct of_platform_driver fhc_driver = {
.match_table = fhc_match,
.probe = fhc_probe,
.driver = {
.name = "fhc",
},
};
static int __init sunfire_init(void)
{ {
struct linux_central *central = central_bus; (void) of_register_driver(&fhc_driver, &of_platform_bus_type);
u8 ctrl; (void) of_register_driver(&clock_board_driver, &of_platform_bus_type);
return 0;
/* No central bus, nothing to do. */
if (central == NULL)
return;
/* OBP leaves it on, turn it off so clock board timer LED
* is in sync with FHC ones.
*/
ctrl = upa_readb(central->clkregs + CLOCK_CTRL);
ctrl &= ~(CLOCK_CTRL_RLED);
upa_writeb(ctrl, central->clkregs + CLOCK_CTRL);
led_state = 0;
init_timer(&sftimer);
sftimer.data = 0;
sftimer.function = &sunfire_timer;
sftimer.expires = jiffies + (HZ >> 1);
add_timer(&sftimer);
} }
subsys_initcall(sunfire_init);
...@@ -659,7 +659,6 @@ static void __init sbus_iommu_init(struct of_device *op) ...@@ -659,7 +659,6 @@ static void __init sbus_iommu_init(struct of_device *op)
static int __init sbus_init(void) static int __init sbus_init(void)
{ {
extern void firetruck_init(void);
struct device_node *dp; struct device_node *dp;
for_each_node_by_name(dp, "sbus") { for_each_node_by_name(dp, "sbus") {
...@@ -669,8 +668,6 @@ static int __init sbus_init(void) ...@@ -669,8 +668,6 @@ static int __init sbus_init(void)
of_propagate_archdata(op); of_propagate_archdata(op);
} }
firetruck_init();
return 0; return 0;
} }
......
...@@ -1673,8 +1673,6 @@ void __cpuinit sun4v_ktsb_register(void) ...@@ -1673,8 +1673,6 @@ void __cpuinit sun4v_ktsb_register(void)
/* paging_init() sets up the page tables */ /* paging_init() sets up the page tables */
extern void central_probe(void);
static unsigned long last_valid_pfn; static unsigned long last_valid_pfn;
pgd_t swapper_pg_dir[2048]; pgd_t swapper_pg_dir[2048];
...@@ -1844,7 +1842,6 @@ void __init paging_init(void) ...@@ -1844,7 +1842,6 @@ void __init paging_init(void)
printk("Booting Linux...\n"); printk("Booting Linux...\n");
central_probe();
cpu_probe(); cpu_probe();
} }
......
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