Skip to content

Commit

Permalink
sh: machvec rework.
Browse files Browse the repository at this point in the history
Some more machvec overhauling and setup code cleanup. Kill off
get_system_type() and platform_setup(), we can do these both
through the machvec. While we're add it, kill off more useless
mach.c's and drop some legacy cruft from setup.c.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Paul Mundt committed Sep 27, 2006
1 parent bc8fb5d commit 2c7834a
Show file tree
Hide file tree
Showing 31 changed files with 481 additions and 776 deletions.
47 changes: 20 additions & 27 deletions arch/sh/boards/bigsur/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,31 +41,7 @@
// Big Sur Init Routines
/*===========================================================*/

const char *get_system_type(void)
{
return "Big Sur";
}

/*
* The Machine Vector
*/
extern void heartbeat_bigsur(void);
extern void init_bigsur_IRQ(void);

struct sh_machine_vector mv_bigsur __initmv = {
.mv_nr_irqs = NR_IRQS, // Defined in <asm/irq.h>

.mv_isa_port2addr = bigsur_isa_port2addr,
.mv_irq_demux = bigsur_irq_demux,

.mv_init_irq = init_bigsur_IRQ,
#ifdef CONFIG_HEARTBEAT
.mv_heartbeat = heartbeat_bigsur,
#endif
};
ALIAS_MV(bigsur)

int __init platform_setup(void)
static void __init bigsur_setup(char **cmdline_p)
{
/* Mask all 2nd level IRQ's */
outb(-1,BIGSUR_IMR0);
Expand All @@ -89,7 +65,24 @@ int __init platform_setup(void)
outw(1, BIGSUR_ETHR+0xe);
/* set the IO port to BIGSUR_ETHER_IOPORT */
outw(BIGSUR_ETHER_IOPORT<<3, BIGSUR_ETHR+0x2);

return 0;
}

/*
* The Machine Vector
*/
extern void heartbeat_bigsur(void);
extern void init_bigsur_IRQ(void);

struct sh_machine_vector mv_bigsur __initmv = {
.mv_name = "Big Sur",
.mv_setup = bigsur_setup,

.mv_isa_port2addr = bigsur_isa_port2addr,
.mv_irq_demux = bigsur_irq_demux,

.mv_init_irq = init_bigsur_IRQ,
#ifdef CONFIG_HEARTBEAT
.mv_heartbeat = heartbeat_bigsur,
#endif
};
ALIAS_MV(bigsur)
34 changes: 13 additions & 21 deletions arch/sh/boards/dreamcast/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/device.h>

#include <asm/io.h>
#include <asm/irq.h>
#include <asm/rtc.h>
Expand All @@ -37,24 +36,7 @@ extern int systemasic_irq_demux(int);
void *dreamcast_consistent_alloc(struct device *, size_t, dma_addr_t *, gfp_t);
int dreamcast_consistent_free(struct device *, size_t, void *, dma_addr_t);

const char *get_system_type(void)
{
return "Sega Dreamcast";
}

struct sh_machine_vector mv_dreamcast __initmv = {
.mv_nr_irqs = NR_IRQS,

.mv_irq_demux = systemasic_irq_demux,

#ifdef CONFIG_PCI
.mv_consistent_alloc = dreamcast_consistent_alloc,
.mv_consistent_free = dreamcast_consistent_free,
#endif
};
ALIAS_MV(dreamcast)

int __init platform_setup(void)
static void __init dreamcast_setup(char **cmdline_p)
{
int i;

Expand All @@ -76,6 +58,16 @@ int __init platform_setup(void)
if (gapspci_init() < 0)
printk(KERN_WARNING "GAPSPCI was not detected.\n");
#endif

return 0;
}

struct sh_machine_vector mv_dreamcast __initmv = {
.mv_name = "Sega Dreamcast",
.mv_setup = dreamcast_setup,
.mv_irq_demux = systemasic_irq_demux,

#ifdef CONFIG_PCI
.mv_consistent_alloc = dreamcast_consistent_alloc,
.mv_consistent_free = dreamcast_consistent_free,
#endif
};
ALIAS_MV(dreamcast)
49 changes: 18 additions & 31 deletions arch/sh/boards/ec3104/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,36 @@
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/types.h>

#include <asm/io.h>
#include <asm/irq.h>
#include <asm/machvec.h>
#include <asm/mach/ec3104.h>

const char *get_system_type(void)
static void __init ec3104_setup(char **cmdline_p)
{
return "EC3104";
char str[8];
int i;

for (i=0; i<8; i++)
str[i] = ctrl_readb(EC3104_BASE + i);

for (i = EC3104_IRQBASE; i < EC3104_IRQBASE + 32; i++)
irq_desc[i].handler = &ec3104_int;

printk("initializing EC3104 \"%.8s\" at %08x, IRQ %d, IRQ base %d\n",
str, EC3104_BASE, EC3104_IRQ, EC3104_IRQBASE);

/* mask all interrupts. this should have been done by the boot
* loader for us but we want to be sure ... */
ctrl_writel(0xffffffff, EC3104_IMR);
}

/*
* The Machine Vector
*/

struct sh_machine_vector mv_ec3104 __initmv = {
.mv_name = "EC3104",
.mv_setup = ec3104_setup,
.mv_nr_irqs = 96,

.mv_inb = ec3104_inb,
Expand All @@ -48,31 +62,4 @@ struct sh_machine_vector mv_ec3104 __initmv = {

.mv_irq_demux = ec3104_irq_demux,
};

ALIAS_MV(ec3104)

int __init platform_setup(void)
{
char str[8];
int i;

if (0)
return 0;

for (i=0; i<8; i++)
str[i] = ctrl_readb(EC3104_BASE + i);

for (i = EC3104_IRQBASE; i < EC3104_IRQBASE + 32; i++)
irq_desc[i].chip = &ec3104_int;

printk("initializing EC3104 \"%.8s\" at %08x, IRQ %d, IRQ base %d\n",
str, EC3104_BASE, EC3104_IRQ, EC3104_IRQBASE);


/* mask all interrupts. this should have been done by the boot
* loader for us but we want to be sure ... */
ctrl_writel(0xffffffff, EC3104_IMR);

return 0;
}

4 changes: 1 addition & 3 deletions arch/sh/boards/hp6xx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# Makefile for the HP6xx specific parts of the kernel
#

obj-y := mach.o setup.o
obj-y := setup.o
obj-$(CONFIG_PM) += pm.o pm_wakeup.o
obj-$(CONFIG_APM) += hp6xx_apm.o


47 changes: 39 additions & 8 deletions arch/sh/boards/hp6xx/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@
#define SCPCR 0xa4000116
#define SCPDR 0xa4000136

const char *get_system_type(void)
{
return "HP6xx";
}

int __init platform_setup(void)
static void __init hp6xx_setup(char **cmdline_p)
{
u8 v8;
u16 v;
Expand Down Expand Up @@ -64,6 +59,42 @@ int __init platform_setup(void)
v &= ~SCPCR_TS_MASK;
v |= SCPCR_TS_ENABLE;
ctrl_outw(v, SCPCR);

return 0;
}

/*
* XXX: This is stupid, we should have a generic machine vector for the cchips
* and just wrap the platform setup code in to this, as it's the only thing
* that ends up being different.
*/
struct sh_machine_vector mv_hp6xx __initmv = {
.mv_name = "hp6xx",
.mv_setup = hp6xx_setup,
.mv_nr_irqs = HD64461_IRQBASE + HD64461_IRQ_NUM,

.mv_inb = hd64461_inb,
.mv_inw = hd64461_inw,
.mv_inl = hd64461_inl,
.mv_outb = hd64461_outb,
.mv_outw = hd64461_outw,
.mv_outl = hd64461_outl,

.mv_inb_p = hd64461_inb_p,
.mv_inw_p = hd64461_inw,
.mv_inl_p = hd64461_inl,
.mv_outb_p = hd64461_outb_p,
.mv_outw_p = hd64461_outw,
.mv_outl_p = hd64461_outl,

.mv_insb = hd64461_insb,
.mv_insw = hd64461_insw,
.mv_insl = hd64461_insl,
.mv_outsb = hd64461_outsb,
.mv_outsw = hd64461_outsw,
.mv_outsl = hd64461_outsl,

.mv_readw = hd64461_readw,
.mv_writew = hd64461_writew,

.mv_irq_demux = hd64461_irq_demux,
};
ALIAS_MV(hp6xx)
92 changes: 45 additions & 47 deletions arch/sh/boards/landisk/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,42 +69,6 @@ static void heartbeat_landisk(void)
landisk_buzzerparam >>= 1;
}

/*
* The Machine Vector
*/
struct sh_machine_vector mv_landisk __initmv = {
.mv_nr_irqs = 72,
.mv_inb = landisk_inb,
.mv_inw = landisk_inw,
.mv_inl = landisk_inl,
.mv_outb = landisk_outb,
.mv_outw = landisk_outw,
.mv_outl = landisk_outl,
.mv_inb_p = landisk_inb_p,
.mv_inw_p = landisk_inw,
.mv_inl_p = landisk_inl,
.mv_outb_p = landisk_outb_p,
.mv_outw_p = landisk_outw,
.mv_outl_p = landisk_outl,
.mv_insb = landisk_insb,
.mv_insw = landisk_insw,
.mv_insl = landisk_insl,
.mv_outsb = landisk_outsb,
.mv_outsw = landisk_outsw,
.mv_outsl = landisk_outsl,
.mv_ioport_map = landisk_ioport_map,
.mv_init_irq = init_landisk_IRQ,
#ifdef CONFIG_HEARTBEAT
.mv_heartbeat = heartbeat_landisk,
#endif
};
ALIAS_MV(landisk)

const char *get_system_type(void)
{
return "LANDISK";
}

static void landisk_power_off(void)
{
ctrl_outb(0x01, PA_SHUTDOWN);
Expand Down Expand Up @@ -132,16 +96,6 @@ static void check_usl5p(void)
}
}

void __init platform_setup(void)
{
landisk_buzzerparam = 0;
check_usl5p();

printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n");
board_time_init = landisk_time_init;
pm_power_off = landisk_power_off;
}

void *area5_io_base;
void *area6_io_base;

Expand Down Expand Up @@ -176,4 +130,48 @@ static int __init landisk_cf_init(void)
return 0;
}

__initcall(landisk_cf_init);
static void __init landisk_setup(char **cmdline_p)
{
device_initcall(landisk_cf_init);

landisk_buzzerparam = 0;
check_usl5p();

printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n");

board_time_init = landisk_time_init;
pm_power_off = landisk_power_off;
}

/*
* The Machine Vector
*/
struct sh_machine_vector mv_landisk __initmv = {
.mv_name = "LANDISK",
.mv_setup = landisk_setup,
.mv_nr_irqs = 72,
.mv_inb = landisk_inb,
.mv_inw = landisk_inw,
.mv_inl = landisk_inl,
.mv_outb = landisk_outb,
.mv_outw = landisk_outw,
.mv_outl = landisk_outl,
.mv_inb_p = landisk_inb_p,
.mv_inw_p = landisk_inw,
.mv_inl_p = landisk_inl,
.mv_outb_p = landisk_outb_p,
.mv_outw_p = landisk_outw,
.mv_outl_p = landisk_outl,
.mv_insb = landisk_insb,
.mv_insw = landisk_insw,
.mv_insl = landisk_insl,
.mv_outsb = landisk_outsb,
.mv_outsw = landisk_outsw,
.mv_outsl = landisk_outsl,
.mv_ioport_map = landisk_ioport_map,
.mv_init_irq = init_landisk_IRQ,
#ifdef CONFIG_HEARTBEAT
.mv_heartbeat = heartbeat_landisk,
#endif
};
ALIAS_MV(landisk)
Loading

0 comments on commit 2c7834a

Please sign in to comment.