diff options
Diffstat (limited to 'arch/sh/boards')
-rw-r--r-- | arch/sh/boards/superh/microdev/io.c | 192 | ||||
-rw-r--r-- | arch/sh/boards/superh/microdev/irq.c | 2 | ||||
-rw-r--r-- | arch/sh/boards/superh/microdev/setup.c | 166 | ||||
-rw-r--r-- | arch/sh/boards/unknown/Makefile | 2 | ||||
-rw-r--r-- | arch/sh/boards/unknown/io.c | 46 | ||||
-rw-r--r-- | arch/sh/boards/unknown/mach.c | 67 | ||||
-rw-r--r-- | arch/sh/boards/unknown/setup.c | 12 |
7 files changed, 262 insertions, 225 deletions
diff --git a/arch/sh/boards/superh/microdev/io.c b/arch/sh/boards/superh/microdev/io.c index fe83b2c0307..1ed7f880b8c 100644 --- a/arch/sh/boards/superh/microdev/io.c +++ b/arch/sh/boards/superh/microdev/io.c @@ -16,7 +16,7 @@ #include <linux/pci.h> #include <linux/wait.h> #include <asm/io.h> -#include <asm/mach/io.h> +#include <asm/microdev.h> /* * we need to have a 'safe' address to re-direct all I/O requests @@ -52,8 +52,90 @@ #define IO_ISP1161_PHYS 0xa7700000ul /* Physical address of Philips ISP1161x USB chip */ #define IO_SUPERIO_PHYS 0xa7800000ul /* Physical address of SMSC FDC37C93xAPM SuperIO chip */ -#define PORT2ADDR(x) (microdev_isa_port2addr(x)) +/* + * map I/O ports to memory-mapped addresses + */ +static unsigned long microdev_isa_port2addr(unsigned long offset) +{ + unsigned long result; + + if ((offset >= IO_LAN91C111_BASE) && + (offset < IO_LAN91C111_BASE + IO_LAN91C111_EXTENT)) { + /* + * SMSC LAN91C111 Ethernet chip + */ + result = IO_LAN91C111_PHYS + offset - IO_LAN91C111_BASE; + } else if ((offset >= IO_SUPERIO_BASE) && + (offset < IO_SUPERIO_BASE + IO_SUPERIO_EXTENT)) { + /* + * SMSC FDC37C93xAPM SuperIO chip + * + * Configuration Registers + */ + result = IO_SUPERIO_PHYS + (offset << 1); +#if 0 + } else if (offset == KBD_DATA_REG || offset == KBD_CNTL_REG || + offset == KBD_STATUS_REG) { + /* + * SMSC FDC37C93xAPM SuperIO chip + * + * PS/2 Keyboard + Mouse (ports 0x60 and 0x64). + */ + result = IO_SUPERIO_PHYS + (offset << 1); +#endif + } else if (((offset >= IO_IDE1_BASE) && + (offset < IO_IDE1_BASE + IO_IDE_EXTENT)) || + (offset == IO_IDE1_MISC)) { + /* + * SMSC FDC37C93xAPM SuperIO chip + * + * IDE #1 + */ + result = IO_SUPERIO_PHYS + (offset << 1); + } else if (((offset >= IO_IDE2_BASE) && + (offset < IO_IDE2_BASE + IO_IDE_EXTENT)) || + (offset == IO_IDE2_MISC)) { + /* + * SMSC FDC37C93xAPM SuperIO chip + * + * IDE #2 + */ + result = IO_SUPERIO_PHYS + (offset << 1); + } else if ((offset >= IO_SERIAL1_BASE) && + (offset < IO_SERIAL1_BASE + IO_SERIAL_EXTENT)) { + /* + * SMSC FDC37C93xAPM SuperIO chip + * + * Serial #1 + */ + result = IO_SUPERIO_PHYS + (offset << 1); + } else if ((offset >= IO_SERIAL2_BASE) && + (offset < IO_SERIAL2_BASE + IO_SERIAL_EXTENT)) { + /* + * SMSC FDC37C93xAPM SuperIO chip + * + * Serial #2 + */ + result = IO_SUPERIO_PHYS + (offset << 1); + } else if ((offset >= IO_ISP1161_BASE) && + (offset < IO_ISP1161_BASE + IO_ISP1161_EXTENT)) { + /* + * Philips USB ISP1161x chip + */ + result = IO_ISP1161_PHYS + offset - IO_ISP1161_BASE; + } else { + /* + * safe default. + */ + printk("Warning: unexpected port in %s( offset = 0x%lx )\n", + __FUNCTION__, offset); + result = PVR; + } + + return result; +} +#define PORT2ADDR(x) (microdev_isa_port2addr(x)) static inline void delay(void) { @@ -94,6 +176,17 @@ unsigned int microdev_inl(unsigned long port) return *(volatile unsigned int*)PORT2ADDR(port); } +void microdev_outw(unsigned short b, unsigned long port) +{ +#ifdef CONFIG_PCI + if (port >= PCIBIOS_MIN_IO) { + microdev_pci_outw(b, port); + return; + } +#endif + *(volatile unsigned short*)PORT2ADDR(port) = b; +} + void microdev_outb(unsigned char b, unsigned long port) { #ifdef CONFIG_PCI @@ -158,17 +251,6 @@ void microdev_outb(unsigned char b, unsigned long port) } } -void microdev_outw(unsigned short b, unsigned long port) -{ -#ifdef CONFIG_PCI - if (port >= PCIBIOS_MIN_IO) { - microdev_pci_outw(b, port); - return; - } -#endif - *(volatile unsigned short*)PORT2ADDR(port) = b; -} - void microdev_outl(unsigned int b, unsigned long port) { #ifdef CONFIG_PCI @@ -284,87 +366,3 @@ void microdev_outsl(unsigned long port, const void *buffer, unsigned long count) while (count--) *port_addr = *buf++; } - -/* - * map I/O ports to memory-mapped addresses - */ -unsigned long microdev_isa_port2addr(unsigned long offset) -{ - unsigned long result; - - if ((offset >= IO_LAN91C111_BASE) && - (offset < IO_LAN91C111_BASE + IO_LAN91C111_EXTENT)) { - /* - * SMSC LAN91C111 Ethernet chip - */ - result = IO_LAN91C111_PHYS + offset - IO_LAN91C111_BASE; - } else if ((offset >= IO_SUPERIO_BASE) && - (offset < IO_SUPERIO_BASE + IO_SUPERIO_EXTENT)) { - /* - * SMSC FDC37C93xAPM SuperIO chip - * - * Configuration Registers - */ - result = IO_SUPERIO_PHYS + (offset << 1); -#if 0 - } else if (offset == KBD_DATA_REG || offset == KBD_CNTL_REG || - offset == KBD_STATUS_REG) { - /* - * SMSC FDC37C93xAPM SuperIO chip - * - * PS/2 Keyboard + Mouse (ports 0x60 and 0x64). - */ - result = IO_SUPERIO_PHYS + (offset << 1); -#endif - } else if (((offset >= IO_IDE1_BASE) && - (offset < IO_IDE1_BASE + IO_IDE_EXTENT)) || - (offset == IO_IDE1_MISC)) { - /* - * SMSC FDC37C93xAPM SuperIO chip - * - * IDE #1 - */ - result = IO_SUPERIO_PHYS + (offset << 1); - } else if (((offset >= IO_IDE2_BASE) && - (offset < IO_IDE2_BASE + IO_IDE_EXTENT)) || - (offset == IO_IDE2_MISC)) { - /* - * SMSC FDC37C93xAPM SuperIO chip - * - * IDE #2 - */ - result = IO_SUPERIO_PHYS + (offset << 1); - } else if ((offset >= IO_SERIAL1_BASE) && - (offset < IO_SERIAL1_BASE + IO_SERIAL_EXTENT)) { - /* - * SMSC FDC37C93xAPM SuperIO chip - * - * Serial #1 - */ - result = IO_SUPERIO_PHYS + (offset << 1); - } else if ((offset >= IO_SERIAL2_BASE) && - (offset < IO_SERIAL2_BASE + IO_SERIAL_EXTENT)) { - /* - * SMSC FDC37C93xAPM SuperIO chip - * - * Serial #2 - */ - result = IO_SUPERIO_PHYS + (offset << 1); - } else if ((offset >= IO_ISP1161_BASE) && - (offset < IO_ISP1161_BASE + IO_ISP1161_EXTENT)) { - /* - * Philips USB ISP1161x chip - */ - result = IO_ISP1161_PHYS + offset - IO_ISP1161_BASE; - } else { - /* - * safe default. - */ - printk("Warning: unexpected port in %s( offset = 0x%lx )\n", - __FUNCTION__, offset); - result = PVR; - } - - return result; -} - diff --git a/arch/sh/boards/superh/microdev/irq.c b/arch/sh/boards/superh/microdev/irq.c index 1395c1e65da..efcbd86b7cd 100644 --- a/arch/sh/boards/superh/microdev/irq.c +++ b/arch/sh/boards/superh/microdev/irq.c @@ -15,7 +15,7 @@ #include <asm/system.h> #include <asm/io.h> -#include <asm/mach/irq.h> +#include <asm/microdev.h> #define NUM_EXTERNAL_IRQS 16 /* IRL0 .. IRL15 */ diff --git a/arch/sh/boards/superh/microdev/setup.c b/arch/sh/boards/superh/microdev/setup.c index 1c1d65fb12d..892b14d3140 100644 --- a/arch/sh/boards/superh/microdev/setup.c +++ b/arch/sh/boards/superh/microdev/setup.c @@ -3,7 +3,7 @@ * * Copyright (C) 2003 Sean McGoogan (Sean.McGoogan@superh.com) * Copyright (C) 2003, 2004 SuperH, Inc. - * Copyright (C) 2004 Paul Mundt + * Copyright (C) 2004, 2005 Paul Mundt * * SuperH SH4-202 MicroDev board support. * @@ -15,11 +15,10 @@ #include <linux/init.h> #include <linux/platform_device.h> #include <linux/ioport.h> +#include <video/s1d13xxxfb.h> +#include <asm/microdev.h> #include <asm/io.h> -#include <asm/mach/irq.h> -#include <asm/mach/io.h> #include <asm/machvec.h> -#include <asm/machvec_init.h> extern void microdev_heartbeat(void); @@ -51,8 +50,6 @@ struct sh_machine_vector mv_sh4202_microdev __initmv = { .mv_outsw = microdev_outsw, .mv_outsl = microdev_outsl, - .mv_isa_port2addr = microdev_isa_port2addr, - .mv_init_irq = init_microdev_irq, #ifdef CONFIG_HEARTBEAT @@ -142,16 +139,161 @@ static struct platform_device smc91x_device = { .resource = smc91x_resources, }; -static int __init smc91x_setup(void) +#ifdef CONFIG_FB_S1D13XXX +static struct s1d13xxxfb_regval s1d13806_initregs[] = { + { S1DREG_MISC, 0x00 }, + { S1DREG_COM_DISP_MODE, 0x00 }, + { S1DREG_GPIO_CNF0, 0x00 }, + { S1DREG_GPIO_CNF1, 0x00 }, + { S1DREG_GPIO_CTL0, 0x00 }, + { S1DREG_GPIO_CTL1, 0x00 }, + { S1DREG_CLK_CNF, 0x02 }, + { S1DREG_LCD_CLK_CNF, 0x01 }, + { S1DREG_CRT_CLK_CNF, 0x03 }, + { S1DREG_MPLUG_CLK_CNF, 0x03 }, + { S1DREG_CPU2MEM_WST_SEL, 0x02 }, + { S1DREG_SDRAM_REF_RATE, 0x03 }, + { S1DREG_SDRAM_TC0, 0x00 }, + { S1DREG_SDRAM_TC1, 0x01 }, + { S1DREG_MEM_CNF, 0x80 }, + { S1DREG_PANEL_TYPE, 0x25 }, + { S1DREG_MOD_RATE, 0x00 }, + { S1DREG_LCD_DISP_HWIDTH, 0x63 }, + { S1DREG_LCD_NDISP_HPER, 0x1e }, + { S1DREG_TFT_FPLINE_START, 0x06 }, + { S1DREG_TFT_FPLINE_PWIDTH, 0x03 }, + { S1DREG_LCD_DISP_VHEIGHT0, 0x57 }, + { S1DREG_LCD_DISP_VHEIGHT1, 0x02 }, + { S1DREG_LCD_NDISP_VPER, 0x00 }, + { S1DREG_TFT_FPFRAME_START, 0x0a }, + { S1DREG_TFT_FPFRAME_PWIDTH, 0x81 }, + { S1DREG_LCD_DISP_MODE, 0x03 }, + { S1DREG_LCD_MISC, 0x00 }, + { S1DREG_LCD_DISP_START0, 0x00 }, + { S1DREG_LCD_DISP_START1, 0x00 }, + { S1DREG_LCD_DISP_START2, 0x00 }, + { S1DREG_LCD_MEM_OFF0, 0x90 }, + { S1DREG_LCD_MEM_OFF1, 0x01 }, + { S1DREG_LCD_PIX_PAN, 0x00 }, + { S1DREG_LCD_DISP_FIFO_HTC, 0x00 }, + { S1DREG_LCD_DISP_FIFO_LTC, 0x00 }, + { S1DREG_CRT_DISP_HWIDTH, 0x63 }, + { S1DREG_CRT_NDISP_HPER, 0x1f }, + { S1DREG_CRT_HRTC_START, 0x04 }, + { S1DREG_CRT_HRTC_PWIDTH, 0x8f }, + { S1DREG_CRT_DISP_VHEIGHT0, 0x57 }, + { S1DREG_CRT_DISP_VHEIGHT1, 0x02 }, + { S1DREG_CRT_NDISP_VPER, 0x1b }, + { S1DREG_CRT_VRTC_START, 0x00 }, + { S1DREG_CRT_VRTC_PWIDTH, 0x83 }, + { S1DREG_TV_OUT_CTL, 0x10 }, + { S1DREG_CRT_DISP_MODE, 0x05 }, + { S1DREG_CRT_DISP_START0, 0x00 }, + { S1DREG_CRT_DISP_START1, 0x00 }, + { S1DREG_CRT_DISP_START2, 0x00 }, + { S1DREG_CRT_MEM_OFF0, 0x20 }, + { S1DREG_CRT_MEM_OFF1, 0x03 }, + { S1DREG_CRT_PIX_PAN, 0x00 }, + { S1DREG_CRT_DISP_FIFO_HTC, 0x00 }, + { S1DREG_CRT_DISP_FIFO_LTC, 0x00 }, + { S1DREG_LCD_CUR_CTL, 0x00 }, + { S1DREG_LCD_CUR_START, 0x01 }, + { S1DREG_LCD_CUR_XPOS0, 0x00 }, + { S1DREG_LCD_CUR_XPOS1, 0x00 }, + { S1DREG_LCD_CUR_YPOS0, 0x00 }, + { S1DREG_LCD_CUR_YPOS1, 0x00 }, + { S1DREG_LCD_CUR_BCTL0, 0x00 }, + { S1DREG_LCD_CUR_GCTL0, 0x00 }, + { S1DREG_LCD_CUR_RCTL0, 0x00 }, + { S1DREG_LCD_CUR_BCTL1, 0x1f }, + { S1DREG_LCD_CUR_GCTL1, 0x3f }, + { S1DREG_LCD_CUR_RCTL1, 0x1f }, + { S1DREG_LCD_CUR_FIFO_HTC, 0x00 }, + { S1DREG_CRT_CUR_CTL, 0x00 }, + { S1DREG_CRT_CUR_START, 0x01 }, + { S1DREG_CRT_CUR_XPOS0, 0x00 }, + { S1DREG_CRT_CUR_XPOS1, 0x00 }, + { S1DREG_CRT_CUR_YPOS0, 0x00 }, + { S1DREG_CRT_CUR_YPOS1, 0x00 }, + { S1DREG_CRT_CUR_BCTL0, 0x00 }, + { S1DREG_CRT_CUR_GCTL0, 0x00 }, + { S1DREG_CRT_CUR_RCTL0, 0x00 }, + { S1DREG_CRT_CUR_BCTL1, 0x1f }, + { S1DREG_CRT_CUR_GCTL1, 0x3f }, + { S1DREG_CRT_CUR_RCTL1, 0x1f }, + { S1DREG_CRT_CUR_FIFO_HTC, 0x00 }, + { S1DREG_BBLT_CTL0, 0x00 }, + { S1DREG_BBLT_CTL1, 0x00 }, + { S1DREG_BBLT_CC_EXP, 0x00 }, + { S1DREG_BBLT_OP, 0x00 }, + { S1DREG_BBLT_SRC_START0, 0x00 }, + { S1DREG_BBLT_SRC_START1, 0x00 }, + { S1DREG_BBLT_SRC_START2, 0x00 }, + { S1DREG_BBLT_DST_START0, 0x00 }, + { S1DREG_BBLT_DST_START1, 0x00 }, + { S1DREG_BBLT_DST_START2, 0x00 }, + { S1DREG_BBLT_MEM_OFF0, 0x00 }, + { S1DREG_BBLT_MEM_OFF1, 0x00 }, + { S1DREG_BBLT_WIDTH0, 0x00 }, + { S1DREG_BBLT_WIDTH1, 0x00 }, + { S1DREG_BBLT_HEIGHT0, 0x00 }, + { S1DREG_BBLT_HEIGHT1, 0x00 }, + { S1DREG_BBLT_BGC0, 0x00 }, + { S1DREG_BBLT_BGC1, 0x00 }, + { S1DREG_BBLT_FGC0, 0x00 }, + { S1DREG_BBLT_FGC1, 0x00 }, + { S1DREG_LKUP_MODE, 0x00 }, + { S1DREG_LKUP_ADDR, 0x00 }, + { S1DREG_PS_CNF, 0x10 }, + { S1DREG_PS_STATUS, 0x00 }, + { S1DREG_CPU2MEM_WDOGT, 0x00 }, + { S1DREG_COM_DISP_MODE, 0x02 }, +}; + +static struct s1d13xxxfb_pdata s1d13806_platform_data = { + .initregs = s1d13806_initregs, + .initregssize = ARRAY_SIZE(s1d13806_initregs), +}; + +static struct resource s1d13806_resources[] = { + [0] = { + .start = 0x07200000, + .end = 0x07200000 + 0x00200000 - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = 0x07000000, + .end = 0x07000000 + 0x00200000 - 1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device s1d13806_device = { + .name = "s1d13806fb", + .id = -1, + .num_resources = ARRAY_SIZE(s1d13806_resources), + .resource = s1d13806_resources, + + .dev = { + .platform_data = &s1d13806_platform_data, + }, +}; +#endif + +static struct platform_device *microdev_devices[] __initdata = { + &smc91x_device, +#ifdef CONFIG_FB_S1D13XXX + &s1d13806_device, +#endif +}; + +static int __init microdev_devices_setup(void) { - return platform_device_register(&smc91x_device); + return platform_add_devices(microdev_devices, ARRAY_SIZE(microdev_devices)); } -__initcall(smc91x_setup); +__initcall(microdev_devices_setup); - /* - * Initialize the board - */ void __init platform_setup(void) { int * const fpgaRevisionRegister = (int*)(MICRODEV_FPGA_GP_BASE + 0x8ul); diff --git a/arch/sh/boards/unknown/Makefile b/arch/sh/boards/unknown/Makefile index cffc21031e7..7d18f408b0c 100644 --- a/arch/sh/boards/unknown/Makefile +++ b/arch/sh/boards/unknown/Makefile @@ -2,5 +2,5 @@ # Makefile for unknown SH boards # -obj-y := mach.o io.o setup.o +obj-y := setup.o diff --git a/arch/sh/boards/unknown/io.c b/arch/sh/boards/unknown/io.c deleted file mode 100644 index 8f3f17267bd..00000000000 --- a/arch/sh/boards/unknown/io.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * linux/arch/sh/kernel/io_unknown.c - * - * Copyright (C) 2000 Stuart Menefy (stuart.menefy@st.com) - * - * May be copied or modified under the terms of the GNU General Public - * License. See linux/COPYING for more information. - * - * I/O routine for unknown hardware. - */ - -static unsigned int unknown_handler(void) -{ - return 0; -} - -#define UNKNOWN_ALIAS(fn) \ - void unknown_##fn(void) __attribute__ ((alias ("unknown_handler"))); - -UNKNOWN_ALIAS(inb) -UNKNOWN_ALIAS(inw) -UNKNOWN_ALIAS(inl) -UNKNOWN_ALIAS(outb) -UNKNOWN_ALIAS(outw) -UNKNOWN_ALIAS(outl) -UNKNOWN_ALIAS(inb_p) -UNKNOWN_ALIAS(inw_p) -UNKNOWN_ALIAS(inl_p) -UNKNOWN_ALIAS(outb_p) -UNKNOWN_ALIAS(outw_p) -UNKNOWN_ALIAS(outl_p) -UNKNOWN_ALIAS(insb) -UNKNOWN_ALIAS(insw) -UNKNOWN_ALIAS(insl) -UNKNOWN_ALIAS(outsb) -UNKNOWN_ALIAS(outsw) -UNKNOWN_ALIAS(outsl) -UNKNOWN_ALIAS(readb) -UNKNOWN_ALIAS(readw) -UNKNOWN_ALIAS(readl) -UNKNOWN_ALIAS(writeb) -UNKNOWN_ALIAS(writew) -UNKNOWN_ALIAS(writel) -UNKNOWN_ALIAS(isa_port2addr) -UNKNOWN_ALIAS(ioremap) -UNKNOWN_ALIAS(iounmap) diff --git a/arch/sh/boards/unknown/mach.c b/arch/sh/boards/unknown/mach.c deleted file mode 100644 index ad0bcc60a64..00000000000 --- a/arch/sh/boards/unknown/mach.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * linux/arch/sh/kernel/mach_unknown.c - * - * Copyright (C) 2000 Stuart Menefy (stuart.menefy@st.com) - * - * May be copied or modified under the terms of the GNU General Public - * License. See linux/COPYING for more information. - * - * Machine specific code for an unknown machine (internal peripherials only) - */ - -#include <linux/config.h> -#include <linux/init.h> - -#include <asm/machvec.h> -#include <asm/machvec_init.h> - -#include <asm/io_unknown.h> - -#include <asm/rtc.h> -/* - * The Machine Vector - */ - -struct sh_machine_vector mv_unknown __initmv = { -#if defined(CONFIG_CPU_SH4) - .mv_nr_irqs = 48, -#elif defined(CONFIG_CPU_SUBTYPE_SH7708) - .mv_nr_irqs = 32, -#elif defined(CONFIG_CPU_SUBTYPE_SH7709) - .mv_nr_irqs = 61, -#endif - - .mv_inb = unknown_inb, - .mv_inw = unknown_inw, - .mv_inl = unknown_inl, - .mv_outb = unknown_outb, - .mv_outw = unknown_outw, - .mv_outl = unknown_outl, - - .mv_inb_p = unknown_inb_p, - .mv_inw_p = unknown_inw_p, - .mv_inl_p = unknown_inl_p, - .mv_outb_p = unknown_outb_p, - .mv_outw_p = unknown_outw_p, - .mv_outl_p = unknown_outl_p, - - .mv_insb = unknown_insb, - .mv_insw = unknown_insw, - .mv_insl = unknown_insl, - .mv_outsb = unknown_outsb, - .mv_outsw = unknown_outsw, - .mv_outsl = unknown_outsl, - - .mv_readb = unknown_readb, - .mv_readw = unknown_readw, - .mv_readl = unknown_readl, - .mv_writeb = unknown_writeb, - .mv_writew = unknown_writew, - .mv_writel = unknown_writel, - - .mv_ioremap = unknown_ioremap, - .mv_iounmap = unknown_iounmap, - - .mv_isa_port2addr = unknown_isa_port2addr, -}; -ALIAS_MV(unknown) diff --git a/arch/sh/boards/unknown/setup.c b/arch/sh/boards/unknown/setup.c index 7d772a6f886..02e84f03f45 100644 --- a/arch/sh/boards/unknown/setup.c +++ b/arch/sh/boards/unknown/setup.c @@ -7,10 +7,20 @@ * License. See linux/COPYING for more information. * * Setup code for an unknown machine (internal peripherials only) + * + * This is the simplest of all boards, and serves only as a quick and dirty + * method to start debugging a new board during bring-up until proper board + * setup code is written. */ - #include <linux/config.h> #include <linux/init.h> +#include <asm/machvec.h> +#include <asm/irq.h> + +struct sh_machine_vector mv_unknown __initmv = { + .mv_nr_irqs = NR_IRQS, +}; +ALIAS_MV(unknown) const char *get_system_type(void) { |