diff --git a/[refs] b/[refs] index a27f06be045a..2b7fb2b00359 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 63bfd7384b119409685a17d5c58f0b56e5dc03da +refs/heads/master: 618763958b2291a09057dbfa553da6ded93dcfad diff --git a/trunk/arch/arm/mach-shmobile/Kconfig b/trunk/arch/arm/mach-shmobile/Kconfig index 51dcd59eda6a..54b479c35ee0 100644 --- a/trunk/arch/arm/mach-shmobile/Kconfig +++ b/trunk/arch/arm/mach-shmobile/Kconfig @@ -116,6 +116,4 @@ endmenu config SH_CLK_CPG bool -source "drivers/sh/Kconfig" - endif diff --git a/trunk/arch/arm/mach-shmobile/board-ap4evb.c b/trunk/arch/arm/mach-shmobile/board-ap4evb.c index 32d9e2816e56..46ca4d4abf91 100644 --- a/trunk/arch/arm/mach-shmobile/board-ap4evb.c +++ b/trunk/arch/arm/mach-shmobile/board-ap4evb.c @@ -565,50 +565,12 @@ static struct platform_device *qhd_devices[] __initdata = { /* FSI */ #define IRQ_FSI evt2irq(0x1840) - -static int fsi_set_rate(int is_porta, int rate) -{ - struct clk *fsib_clk; - struct clk *fdiv_clk = &sh7372_fsidivb_clk; - int ret; - - /* set_rate is not needed if port A */ - if (is_porta) - return 0; - - fsib_clk = clk_get(NULL, "fsib_clk"); - if (IS_ERR(fsib_clk)) - return -EINVAL; - - switch (rate) { - case 48000: - clk_set_rate(fsib_clk, clk_round_rate(fsib_clk, 85428000)); - clk_set_rate(fdiv_clk, clk_round_rate(fdiv_clk, 12204000)); - ret = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64; - break; - default: - pr_err("unsupported rate in FSI2 port B\n"); - ret = -EINVAL; - break; - } - - clk_put(fsib_clk); - - return ret; -} - static struct sh_fsi_platform_info fsi_info = { .porta_flags = SH_FSI_BRS_INV | SH_FSI_OUT_SLAVE_MODE | SH_FSI_IN_SLAVE_MODE | SH_FSI_OFMT(PCM) | SH_FSI_IFMT(PCM), - - .portb_flags = SH_FSI_BRS_INV | - SH_FSI_BRM_INV | - SH_FSI_LRS_INV | - SH_FSI_OFMT(SPDIF), - .set_rate = fsi_set_rate, }; static struct resource fsi_resources[] = { @@ -672,7 +634,6 @@ static struct platform_device lcdc1_device = { static struct sh_mobile_hdmi_info hdmi_info = { .lcd_chan = &sh_mobile_lcdc1_info.ch[0], .lcd_dev = &lcdc1_device.dev, - .flags = HDMI_SND_SRC_SPDIF, }; static struct resource hdmi_resources[] = { @@ -1031,7 +992,6 @@ static void __init ap4evb_map_io(void) #define GPIO_PORT9CR 0xE6051009 #define GPIO_PORT10CR 0xE605100A -#define USCCR1 0xE6058144 static void __init ap4evb_init(void) { u32 srcr4; @@ -1102,7 +1062,7 @@ static void __init ap4evb_init(void) /* setup USB phy */ __raw_writew(0x8a0a, 0xE6058130); /* USBCR2 */ - /* enable FSI2 port A (ak4643) */ + /* enable FSI2 */ gpio_request(GPIO_FN_FSIAIBT, NULL); gpio_request(GPIO_FN_FSIAILR, NULL); gpio_request(GPIO_FN_FSIAISLD, NULL); @@ -1119,10 +1079,6 @@ static void __init ap4evb_init(void) gpio_request(GPIO_PORT41, NULL); gpio_direction_input(GPIO_PORT41); - /* setup FSI2 port B (HDMI) */ - gpio_request(GPIO_FN_FSIBCK, NULL); - __raw_writew(__raw_readw(USCCR1) & ~(1 << 6), USCCR1); /* use SPDIF */ - /* set SPU2 clock to 119.6 MHz */ clk = clk_get(NULL, "spu_clk"); if (!IS_ERR(clk)) { diff --git a/trunk/arch/arm/mach-shmobile/clock-sh7372.c b/trunk/arch/arm/mach-shmobile/clock-sh7372.c index 7db31e6c6bf2..8565aefa21fd 100644 --- a/trunk/arch/arm/mach-shmobile/clock-sh7372.c +++ b/trunk/arch/arm/mach-shmobile/clock-sh7372.c @@ -50,9 +50,6 @@ #define SMSTPCR3 0xe615013c #define SMSTPCR4 0xe6150140 -#define FSIDIVA 0xFE1F8000 -#define FSIDIVB 0xFE1F8008 - /* Platforms must set frequency on their DV_CLKI pin */ struct clk sh7372_dv_clki_clk = { }; @@ -291,7 +288,6 @@ struct clk sh7372_pllc2_clk = { .ops = &pllc2_clk_ops, .parent = &extal1_div2_clk, .freq_table = pllc2_freq_table, - .nr_freqs = ARRAY_SIZE(pllc2_freq_table) - 1, .parent_table = pllc2_parent, .parent_num = ARRAY_SIZE(pllc2_parent), }; @@ -421,101 +417,6 @@ static struct clk div6_reparent_clks[DIV6_REPARENT_NR] = { fsibckcr_parent, ARRAY_SIZE(fsibckcr_parent), 6, 2), }; -/* FSI DIV */ -static unsigned long fsidiv_recalc(struct clk *clk) -{ - unsigned long value; - - value = __raw_readl(clk->mapping->base); - - if ((value & 0x3) != 0x3) - return 0; - - value >>= 16; - if (value < 2) - return 0; - - return clk->parent->rate / value; -} - -static long fsidiv_round_rate(struct clk *clk, unsigned long rate) -{ - return clk_rate_div_range_round(clk, 2, 0xffff, rate); -} - -static void fsidiv_disable(struct clk *clk) -{ - __raw_writel(0, clk->mapping->base); -} - -static int fsidiv_enable(struct clk *clk) -{ - unsigned long value; - - value = __raw_readl(clk->mapping->base) >> 16; - if (value < 2) { - fsidiv_disable(clk); - return -ENOENT; - } - - __raw_writel((value << 16) | 0x3, clk->mapping->base); - - return 0; -} - -static int fsidiv_set_rate(struct clk *clk, - unsigned long rate, int algo_id) -{ - int idx; - - if (clk->parent->rate == rate) { - fsidiv_disable(clk); - return 0; - } - - idx = (clk->parent->rate / rate) & 0xffff; - if (idx < 2) - return -ENOENT; - - __raw_writel(idx << 16, clk->mapping->base); - return fsidiv_enable(clk); -} - -static struct clk_ops fsidiv_clk_ops = { - .recalc = fsidiv_recalc, - .round_rate = fsidiv_round_rate, - .set_rate = fsidiv_set_rate, - .enable = fsidiv_enable, - .disable = fsidiv_disable, -}; - -static struct clk_mapping sh7372_fsidiva_clk_mapping = { - .phys = FSIDIVA, - .len = 8, -}; - -struct clk sh7372_fsidiva_clk = { - .ops = &fsidiv_clk_ops, - .parent = &div6_reparent_clks[DIV6_FSIA], /* late install */ - .mapping = &sh7372_fsidiva_clk_mapping, -}; - -static struct clk_mapping sh7372_fsidivb_clk_mapping = { - .phys = FSIDIVB, - .len = 8, -}; - -struct clk sh7372_fsidivb_clk = { - .ops = &fsidiv_clk_ops, - .parent = &div6_reparent_clks[DIV6_FSIB], /* late install */ - .mapping = &sh7372_fsidivb_clk_mapping, -}; - -static struct clk *late_main_clks[] = { - &sh7372_fsidiva_clk, - &sh7372_fsidivb_clk, -}; - enum { MSTP001, MSTP131, MSTP130, MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, @@ -684,9 +585,6 @@ void __init sh7372_clock_init(void) if (!ret) ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); - for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++) - ret = clk_register(late_main_clks[k]); - clkdev_add_table(lookups, ARRAY_SIZE(lookups)); if (!ret) diff --git a/trunk/arch/arm/mach-shmobile/include/mach/gpio.h b/trunk/arch/arm/mach-shmobile/include/mach/gpio.h index 2b1bb9e43dda..5bc6bd444d72 100644 --- a/trunk/arch/arm/mach-shmobile/include/mach/gpio.h +++ b/trunk/arch/arm/mach-shmobile/include/mach/gpio.h @@ -35,12 +35,12 @@ static inline int gpio_cansleep(unsigned gpio) static inline int gpio_to_irq(unsigned gpio) { - return __gpio_to_irq(gpio); + return -ENOSYS; } static inline int irq_to_gpio(unsigned int irq) { - return -ENOSYS; + return -EINVAL; } #endif /* CONFIG_GPIOLIB */ diff --git a/trunk/arch/arm/mach-shmobile/include/mach/sh7372.h b/trunk/arch/arm/mach-shmobile/include/mach/sh7372.h index e4f9004e7103..147775a94bce 100644 --- a/trunk/arch/arm/mach-shmobile/include/mach/sh7372.h +++ b/trunk/arch/arm/mach-shmobile/include/mach/sh7372.h @@ -464,7 +464,5 @@ extern struct clk sh7372_dv_clki_div2_clk; extern struct clk sh7372_pllc2_clk; extern struct clk sh7372_fsiack_clk; extern struct clk sh7372_fsibck_clk; -extern struct clk sh7372_fsidiva_clk; -extern struct clk sh7372_fsidivb_clk; #endif /* __ASM_SH7372_H__ */ diff --git a/trunk/arch/sh/Kconfig b/trunk/arch/sh/Kconfig index 7f217b3a50a8..5c075f562eba 100644 --- a/trunk/arch/sh/Kconfig +++ b/trunk/arch/sh/Kconfig @@ -193,7 +193,6 @@ config CPU_SH2 config CPU_SH2A bool select CPU_SH2 - select UNCACHED_MAPPING config CPU_SH3 bool diff --git a/trunk/arch/sh/Makefile b/trunk/arch/sh/Makefile index 9c8c6e1a2a15..307b3a4a790b 100644 --- a/trunk/arch/sh/Makefile +++ b/trunk/arch/sh/Makefile @@ -133,7 +133,10 @@ machdir-$(CONFIG_SOLUTION_ENGINE) += mach-se machdir-$(CONFIG_SH_HP6XX) += mach-hp6xx machdir-$(CONFIG_SH_DREAMCAST) += mach-dreamcast machdir-$(CONFIG_SH_SH03) += mach-sh03 +machdir-$(CONFIG_SH_SECUREEDGE5410) += mach-snapgear machdir-$(CONFIG_SH_RTS7751R2D) += mach-r2d +machdir-$(CONFIG_SH_7751_SYSTEMH) += mach-systemh +machdir-$(CONFIG_SH_EDOSK7705) += mach-edosk7705 machdir-$(CONFIG_SH_HIGHLANDER) += mach-highlander machdir-$(CONFIG_SH_MIGOR) += mach-migor machdir-$(CONFIG_SH_AP325RXA) += mach-ap325rxa diff --git a/trunk/arch/sh/boards/Kconfig b/trunk/arch/sh/boards/Kconfig index 2018c7ea4c93..9c94711aa6ca 100644 --- a/trunk/arch/sh/boards/Kconfig +++ b/trunk/arch/sh/boards/Kconfig @@ -81,6 +81,13 @@ config SH_7343_SOLUTION_ENGINE Select 7343 SolutionEngine if configuring for a Hitachi SH7343 (SH-Mobile 3AS) evaluation board. +config SH_7751_SYSTEMH + bool "SystemH7751R" + depends on CPU_SUBTYPE_SH7751R + help + Select SystemH if you are configuring for a Renesas SystemH + 7751R evaluation board. + config SH_HP6XX bool "HP6XX" select SYS_SUPPORTS_APM_EMULATION diff --git a/trunk/arch/sh/boards/Makefile b/trunk/arch/sh/boards/Makefile index be7d11d04b26..38ef655cc0f0 100644 --- a/trunk/arch/sh/boards/Makefile +++ b/trunk/arch/sh/boards/Makefile @@ -2,12 +2,10 @@ # Specific board support, not covered by a mach group. # obj-$(CONFIG_SH_MAGIC_PANEL_R2) += board-magicpanelr2.o -obj-$(CONFIG_SH_SECUREEDGE5410) += board-secureedge5410.o obj-$(CONFIG_SH_SH2007) += board-sh2007.o obj-$(CONFIG_SH_SH7785LCR) += board-sh7785lcr.o obj-$(CONFIG_SH_URQUELL) += board-urquell.o obj-$(CONFIG_SH_SHMIN) += board-shmin.o -obj-$(CONFIG_SH_EDOSK7705) += board-edosk7705.o obj-$(CONFIG_SH_EDOSK7760) += board-edosk7760.o obj-$(CONFIG_SH_ESPT) += board-espt.o obj-$(CONFIG_SH_POLARIS) += board-polaris.o diff --git a/trunk/arch/sh/boards/board-edosk7705.c b/trunk/arch/sh/boards/board-edosk7705.c deleted file mode 100644 index 4cb3bb74c36f..000000000000 --- a/trunk/arch/sh/boards/board-edosk7705.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * arch/sh/boards/renesas/edosk7705/setup.c - * - * Copyright (C) 2000 Kazumoto Kojima - * - * Hitachi SolutionEngine Support. - * - * Modified for edosk7705 development - * board by S. Dunn, 2003. - */ -#include -#include -#include -#include -#include -#include -#include - -#define SMC_IOBASE 0xA2000000 -#define SMC_IO_OFFSET 0x300 -#define SMC_IOADDR (SMC_IOBASE + SMC_IO_OFFSET) - -#define ETHERNET_IRQ 0x09 - -static void __init sh_edosk7705_init_irq(void) -{ - make_imask_irq(ETHERNET_IRQ); -} - -/* eth initialization functions */ -static struct smc91x_platdata smc91x_info = { - .flags = SMC91X_USE_16BIT | SMC91X_IO_SHIFT_1 | IORESOURCE_IRQ_LOWLEVEL, -}; - -static struct resource smc91x_res[] = { - [0] = { - .start = SMC_IOADDR, - .end = SMC_IOADDR + SZ_32 - 1, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = ETHERNET_IRQ, - .end = ETHERNET_IRQ, - .flags = IORESOURCE_IRQ , - } -}; - -static struct platform_device smc91x_dev = { - .name = "smc91x", - .id = -1, - .num_resources = ARRAY_SIZE(smc91x_res), - .resource = smc91x_res, - - .dev = { - .platform_data = &smc91x_info, - }, -}; - -/* platform init code */ -static struct platform_device *edosk7705_devices[] __initdata = { - &smc91x_dev, -}; - -static int __init init_edosk7705_devices(void) -{ - return platform_add_devices(edosk7705_devices, - ARRAY_SIZE(edosk7705_devices)); -} -__initcall(init_edosk7705_devices); - -/* - * The Machine Vector - */ -static struct sh_machine_vector mv_edosk7705 __initmv = { - .mv_name = "EDOSK7705", - .mv_nr_irqs = 80, - .mv_init_irq = sh_edosk7705_init_irq, -}; diff --git a/trunk/arch/sh/boards/mach-edosk7705/Makefile b/trunk/arch/sh/boards/mach-edosk7705/Makefile new file mode 100644 index 000000000000..cd54acb51499 --- /dev/null +++ b/trunk/arch/sh/boards/mach-edosk7705/Makefile @@ -0,0 +1,5 @@ +# +# Makefile for the EDOSK7705 specific parts of the kernel +# + +obj-y := setup.o io.o diff --git a/trunk/arch/sh/boards/mach-edosk7705/io.c b/trunk/arch/sh/boards/mach-edosk7705/io.c new file mode 100644 index 000000000000..5b9c57c43241 --- /dev/null +++ b/trunk/arch/sh/boards/mach-edosk7705/io.c @@ -0,0 +1,71 @@ +/* + * arch/sh/boards/renesas/edosk7705/io.c + * + * Copyright (C) 2001 Ian da Silva, Jeremy Siegel + * Based largely on io_se.c. + * + * I/O routines for Hitachi EDOSK7705 board. + * + */ + +#include +#include +#include +#include +#include + +#define SMC_IOADDR 0xA2000000 + +/* Map the Ethernet addresses as if it is at 0x300 - 0x320 */ +static unsigned long sh_edosk7705_isa_port2addr(unsigned long port) +{ + /* + * SMC91C96 registers are 4 byte aligned rather than the + * usual 2 byte! + */ + if (port >= 0x300 && port < 0x320) + return SMC_IOADDR + ((port - 0x300) * 2); + + maybebadio(port); + return port; +} + +/* Trying to read / write bytes on odd-byte boundaries to the Ethernet + * registers causes problems. So we bit-shift the value and read / write + * in 2 byte chunks. Setting the low byte to 0 does not cause problems + * now as odd byte writes are only made on the bit mask / interrupt + * register. This may not be the case in future Mar-2003 SJD + */ +unsigned char sh_edosk7705_inb(unsigned long port) +{ + if (port >= 0x300 && port < 0x320 && port & 0x01) + return __raw_readw(port - 1) >> 8; + + return __raw_readb(sh_edosk7705_isa_port2addr(port)); +} + +void sh_edosk7705_outb(unsigned char value, unsigned long port) +{ + if (port >= 0x300 && port < 0x320 && port & 0x01) { + __raw_writew(((unsigned short)value << 8), port - 1); + return; + } + + __raw_writeb(value, sh_edosk7705_isa_port2addr(port)); +} + +void sh_edosk7705_insb(unsigned long port, void *addr, unsigned long count) +{ + unsigned char *p = addr; + + while (count--) + *p++ = sh_edosk7705_inb(port); +} + +void sh_edosk7705_outsb(unsigned long port, const void *addr, unsigned long count) +{ + unsigned char *p = (unsigned char *)addr; + + while (count--) + sh_edosk7705_outb(*p++, port); +} diff --git a/trunk/arch/sh/boards/mach-edosk7705/setup.c b/trunk/arch/sh/boards/mach-edosk7705/setup.c new file mode 100644 index 000000000000..d59225e26fb9 --- /dev/null +++ b/trunk/arch/sh/boards/mach-edosk7705/setup.c @@ -0,0 +1,36 @@ +/* + * arch/sh/boards/renesas/edosk7705/setup.c + * + * Copyright (C) 2000 Kazumoto Kojima + * + * Hitachi SolutionEngine Support. + * + * Modified for edosk7705 development + * board by S. Dunn, 2003. + */ +#include +#include +#include +#include + +static void __init sh_edosk7705_init_irq(void) +{ + /* This is the Ethernet interrupt */ + make_imask_irq(0x09); +} + +/* + * The Machine Vector + */ +static struct sh_machine_vector mv_edosk7705 __initmv = { + .mv_name = "EDOSK7705", + .mv_nr_irqs = 80, + + .mv_inb = sh_edosk7705_inb, + .mv_outb = sh_edosk7705_outb, + + .mv_insb = sh_edosk7705_insb, + .mv_outsb = sh_edosk7705_outsb, + + .mv_init_irq = sh_edosk7705_init_irq, +}; diff --git a/trunk/arch/sh/boards/mach-microdev/io.c b/trunk/arch/sh/boards/mach-microdev/io.c index acdafb0c6404..2960c659020e 100644 --- a/trunk/arch/sh/boards/mach-microdev/io.c +++ b/trunk/arch/sh/boards/mach-microdev/io.c @@ -54,7 +54,7 @@ /* * map I/O ports to memory-mapped addresses */ -void __iomem *microdev_ioport_map(unsigned long offset, unsigned int len) +static unsigned long microdev_isa_port2addr(unsigned long offset) { unsigned long result; @@ -72,6 +72,16 @@ void __iomem *microdev_ioport_map(unsigned long offset, unsigned int len) * 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)) { @@ -121,5 +131,237 @@ void __iomem *microdev_ioport_map(unsigned long offset, unsigned int len) result = PVR; } - return (void __iomem *)result; + return result; +} + +#define PORT2ADDR(x) (microdev_isa_port2addr(x)) + +static inline void delay(void) +{ +#if defined(CONFIG_PCI) + /* System board present, just make a dummy SRAM access. (CS0 will be + mapped to PCI memory, probably good to avoid it.) */ + __raw_readw(0xa6800000); +#else + /* CS0 will be mapped to flash, ROM etc so safe to access it. */ + __raw_readw(0xa0000000); +#endif +} + +unsigned char microdev_inb(unsigned long port) +{ +#ifdef CONFIG_PCI + if (port >= PCIBIOS_MIN_IO) + return microdev_pci_inb(port); +#endif + return *(volatile unsigned char*)PORT2ADDR(port); +} + +unsigned short microdev_inw(unsigned long port) +{ +#ifdef CONFIG_PCI + if (port >= PCIBIOS_MIN_IO) + return microdev_pci_inw(port); +#endif + return *(volatile unsigned short*)PORT2ADDR(port); +} + +unsigned int microdev_inl(unsigned long port) +{ +#ifdef CONFIG_PCI + if (port >= PCIBIOS_MIN_IO) + return microdev_pci_inl(port); +#endif + 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 + if (port >= PCIBIOS_MIN_IO) { + microdev_pci_outb(b, port); + return; + } +#endif + + /* + * There is a board feature with the current SH4-202 MicroDev in + * that the 2 byte enables (nBE0 and nBE1) are tied together (and + * to the Chip Select Line (Ethernet_CS)). Due to this connectivity, + * it is not possible to safely perform 8-bit writes to the + * Ethernet registers, as 16-bits will be consumed from the Data + * lines (corrupting the other byte). Hence, this function is + * written to implement 16-bit read/modify/write for all byte-wide + * accesses. + * + * Note: there is no problem with byte READS (even or odd). + * + * Sean McGoogan - 16th June 2003. + */ + if ((port >= IO_LAN91C111_BASE) && + (port < IO_LAN91C111_BASE + IO_LAN91C111_EXTENT)) { + /* + * Then are trying to perform a byte-write to the + * LAN91C111. This needs special care. + */ + if (port % 2 == 1) { /* is the port odd ? */ + /* unset bit-0, i.e. make even */ + const unsigned long evenPort = port-1; + unsigned short word; + + /* + * do a 16-bit read/write to write to 'port', + * preserving even byte. + * + * Even addresses are bits 0-7 + * Odd addresses are bits 8-15 + */ + word = microdev_inw(evenPort); + word = (word & 0xffu) | (b << 8); + microdev_outw(word, evenPort); + } else { + /* else, we are trying to do an even byte write */ + unsigned short word; + + /* + * do a 16-bit read/write to write to 'port', + * preserving odd byte. + * + * Even addresses are bits 0-7 + * Odd addresses are bits 8-15 + */ + word = microdev_inw(port); + word = (word & 0xff00u) | (b); + microdev_outw(word, port); + } + } else { + *(volatile unsigned char*)PORT2ADDR(port) = b; + } +} + +void microdev_outl(unsigned int b, unsigned long port) +{ +#ifdef CONFIG_PCI + if (port >= PCIBIOS_MIN_IO) { + microdev_pci_outl(b, port); + return; + } +#endif + *(volatile unsigned int*)PORT2ADDR(port) = b; +} + +unsigned char microdev_inb_p(unsigned long port) +{ + unsigned char v = microdev_inb(port); + delay(); + return v; +} + +unsigned short microdev_inw_p(unsigned long port) +{ + unsigned short v = microdev_inw(port); + delay(); + return v; +} + +unsigned int microdev_inl_p(unsigned long port) +{ + unsigned int v = microdev_inl(port); + delay(); + return v; +} + +void microdev_outb_p(unsigned char b, unsigned long port) +{ + microdev_outb(b, port); + delay(); +} + +void microdev_outw_p(unsigned short b, unsigned long port) +{ + microdev_outw(b, port); + delay(); +} + +void microdev_outl_p(unsigned int b, unsigned long port) +{ + microdev_outl(b, port); + delay(); +} + +void microdev_insb(unsigned long port, void *buffer, unsigned long count) +{ + volatile unsigned char *port_addr; + unsigned char *buf = buffer; + + port_addr = (volatile unsigned char *)PORT2ADDR(port); + + while (count--) + *buf++ = *port_addr; +} + +void microdev_insw(unsigned long port, void *buffer, unsigned long count) +{ + volatile unsigned short *port_addr; + unsigned short *buf = buffer; + + port_addr = (volatile unsigned short *)PORT2ADDR(port); + + while (count--) + *buf++ = *port_addr; +} + +void microdev_insl(unsigned long port, void *buffer, unsigned long count) +{ + volatile unsigned long *port_addr; + unsigned int *buf = buffer; + + port_addr = (volatile unsigned long *)PORT2ADDR(port); + + while (count--) + *buf++ = *port_addr; +} + +void microdev_outsb(unsigned long port, const void *buffer, unsigned long count) +{ + volatile unsigned char *port_addr; + const unsigned char *buf = buffer; + + port_addr = (volatile unsigned char *)PORT2ADDR(port); + + while (count--) + *port_addr = *buf++; +} + +void microdev_outsw(unsigned long port, const void *buffer, unsigned long count) +{ + volatile unsigned short *port_addr; + const unsigned short *buf = buffer; + + port_addr = (volatile unsigned short *)PORT2ADDR(port); + + while (count--) + *port_addr = *buf++; +} + +void microdev_outsl(unsigned long port, const void *buffer, unsigned long count) +{ + volatile unsigned long *port_addr; + const unsigned int *buf = buffer; + + port_addr = (volatile unsigned long *)PORT2ADDR(port); + + while (count--) + *port_addr = *buf++; } diff --git a/trunk/arch/sh/boards/mach-microdev/setup.c b/trunk/arch/sh/boards/mach-microdev/setup.c index d8a747291e03..d1df2a4fb9b8 100644 --- a/trunk/arch/sh/boards/mach-microdev/setup.c +++ b/trunk/arch/sh/boards/mach-microdev/setup.c @@ -195,6 +195,27 @@ device_initcall(microdev_devices_setup); static struct sh_machine_vector mv_sh4202_microdev __initmv = { .mv_name = "SH4-202 MicroDev", .mv_nr_irqs = 72, - .mv_ioport_map = microdev_ioport_map, + + .mv_inb = microdev_inb, + .mv_inw = microdev_inw, + .mv_inl = microdev_inl, + .mv_outb = microdev_outb, + .mv_outw = microdev_outw, + .mv_outl = microdev_outl, + + .mv_inb_p = microdev_inb_p, + .mv_inw_p = microdev_inw_p, + .mv_inl_p = microdev_inl_p, + .mv_outb_p = microdev_outb_p, + .mv_outw_p = microdev_outw_p, + .mv_outl_p = microdev_outl_p, + + .mv_insb = microdev_insb, + .mv_insw = microdev_insw, + .mv_insl = microdev_insl, + .mv_outsb = microdev_outsb, + .mv_outsw = microdev_outsw, + .mv_outsl = microdev_outsl, + .mv_init_irq = init_microdev_irq, }; diff --git a/trunk/arch/sh/boards/mach-se/7206/Makefile b/trunk/arch/sh/boards/mach-se/7206/Makefile index 5c9eaa0535b9..63e7ed699f39 100644 --- a/trunk/arch/sh/boards/mach-se/7206/Makefile +++ b/trunk/arch/sh/boards/mach-se/7206/Makefile @@ -2,4 +2,4 @@ # Makefile for the 7206 SolutionEngine specific parts of the kernel # -obj-y := setup.o irq.o +obj-y := setup.o io.o irq.o diff --git a/trunk/arch/sh/boards/mach-se/7206/io.c b/trunk/arch/sh/boards/mach-se/7206/io.c new file mode 100644 index 000000000000..adadc77532ee --- /dev/null +++ b/trunk/arch/sh/boards/mach-se/7206/io.c @@ -0,0 +1,104 @@ +/* $Id: io.c,v 1.5 2004/02/22 23:08:43 kkojima Exp $ + * + * linux/arch/sh/boards/se/7206/io.c + * + * Copyright (C) 2006 Yoshinori Sato + * + * I/O routine for Hitachi 7206 SolutionEngine. + * + */ + +#include +#include +#include +#include + + +static inline void delay(void) +{ + __raw_readw(0x20000000); /* P2 ROM Area */ +} + +/* MS7750 requires special versions of in*, out* routines, since + PC-like io ports are located at upper half byte of 16-bit word which + can be accessed only with 16-bit wide. */ + +static inline volatile __u16 * +port2adr(unsigned int port) +{ + if (port >= 0x2000 && port < 0x2020) + return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000)); + else if (port >= 0x300 && port < 0x310) + return (volatile __u16 *) (PA_SMSC + (port - 0x300)); + + return (volatile __u16 *)port; +} + +unsigned char se7206_inb(unsigned long port) +{ + return (*port2adr(port)) & 0xff; +} + +unsigned char se7206_inb_p(unsigned long port) +{ + unsigned long v; + + v = (*port2adr(port)) & 0xff; + delay(); + return v; +} + +unsigned short se7206_inw(unsigned long port) +{ + return *port2adr(port); +} + +void se7206_outb(unsigned char value, unsigned long port) +{ + *(port2adr(port)) = value; +} + +void se7206_outb_p(unsigned char value, unsigned long port) +{ + *(port2adr(port)) = value; + delay(); +} + +void se7206_outw(unsigned short value, unsigned long port) +{ + *port2adr(port) = value; +} + +void se7206_insb(unsigned long port, void *addr, unsigned long count) +{ + volatile __u16 *p = port2adr(port); + __u8 *ap = addr; + + while (count--) + *ap++ = *p; +} + +void se7206_insw(unsigned long port, void *addr, unsigned long count) +{ + volatile __u16 *p = port2adr(port); + __u16 *ap = addr; + while (count--) + *ap++ = *p; +} + +void se7206_outsb(unsigned long port, const void *addr, unsigned long count) +{ + volatile __u16 *p = port2adr(port); + const __u8 *ap = addr; + + while (count--) + *p = *ap++; +} + +void se7206_outsw(unsigned long port, const void *addr, unsigned long count) +{ + volatile __u16 *p = port2adr(port); + const __u16 *ap = addr; + while (count--) + *p = *ap++; +} diff --git a/trunk/arch/sh/boards/mach-se/7206/irq.c b/trunk/arch/sh/boards/mach-se/7206/irq.c index d961949600fd..883b21eacaa6 100644 --- a/trunk/arch/sh/boards/mach-se/7206/irq.c +++ b/trunk/arch/sh/boards/mach-se/7206/irq.c @@ -139,13 +139,11 @@ void __init init_se7206_IRQ(void) make_se7206_irq(IRQ0_IRQ); /* SMC91C111 */ make_se7206_irq(IRQ1_IRQ); /* ATA */ make_se7206_irq(IRQ3_IRQ); /* SLOT / PCM */ - - __raw_writew(__raw_readw(INTC_ICR1) | 0x000b, INTC_ICR); /* ICR1 */ + __raw_writew(inw(INTC_ICR1) | 0x000b ,INTC_ICR1 ) ; /* ICR1 */ /* FPGA System register setup*/ __raw_writew(0x0000,INTSTS0); /* Clear INTSTS0 */ __raw_writew(0x0000,INTSTS1); /* Clear INTSTS1 */ - /* IRQ0=LAN, IRQ1=ATA, IRQ3=SLT,PCM */ __raw_writew(0x0001,INTSEL); } diff --git a/trunk/arch/sh/boards/mach-se/7206/setup.c b/trunk/arch/sh/boards/mach-se/7206/setup.c index 7f4871c71a01..8f5c65d43d1d 100644 --- a/trunk/arch/sh/boards/mach-se/7206/setup.c +++ b/trunk/arch/sh/boards/mach-se/7206/setup.c @@ -86,5 +86,20 @@ __initcall(se7206_devices_setup); static struct sh_machine_vector mv_se __initmv = { .mv_name = "SolutionEngine", .mv_nr_irqs = 256, + .mv_inb = se7206_inb, + .mv_inw = se7206_inw, + .mv_outb = se7206_outb, + .mv_outw = se7206_outw, + + .mv_inb_p = se7206_inb_p, + .mv_inw_p = se7206_inw, + .mv_outb_p = se7206_outb_p, + .mv_outw_p = se7206_outw, + + .mv_insb = se7206_insb, + .mv_insw = se7206_insw, + .mv_outsb = se7206_outsb, + .mv_outsw = se7206_outsw, + .mv_init_irq = init_se7206_IRQ, }; diff --git a/trunk/arch/sh/boards/mach-se/770x/Makefile b/trunk/arch/sh/boards/mach-se/770x/Makefile index 43ea14feef51..8e624b06d5ea 100644 --- a/trunk/arch/sh/boards/mach-se/770x/Makefile +++ b/trunk/arch/sh/boards/mach-se/770x/Makefile @@ -2,4 +2,4 @@ # Makefile for the 770x SolutionEngine specific parts of the kernel # -obj-y := setup.o irq.o +obj-y := setup.o io.o irq.o diff --git a/trunk/arch/sh/boards/mach-se/770x/io.c b/trunk/arch/sh/boards/mach-se/770x/io.c new file mode 100644 index 000000000000..28833c8786ea --- /dev/null +++ b/trunk/arch/sh/boards/mach-se/770x/io.c @@ -0,0 +1,156 @@ +/* + * Copyright (C) 2000 Kazumoto Kojima + * + * I/O routine for Hitachi SolutionEngine. + */ +#include +#include +#include +#include + +/* MS7750 requires special versions of in*, out* routines, since + PC-like io ports are located at upper half byte of 16-bit word which + can be accessed only with 16-bit wide. */ + +static inline volatile __u16 * +port2adr(unsigned int port) +{ + if (port & 0xff000000) + return ( volatile __u16 *) port; + if (port >= 0x2000) + return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000)); + else if (port >= 0x1000) + return (volatile __u16 *) (PA_83902 + (port << 1)); + else + return (volatile __u16 *) (PA_SUPERIO + (port << 1)); +} + +static inline int +shifted_port(unsigned long port) +{ + /* For IDE registers, value is not shifted */ + if ((0x1f0 <= port && port < 0x1f8) || port == 0x3f6) + return 0; + else + return 1; +} + +unsigned char se_inb(unsigned long port) +{ + if (shifted_port(port)) + return (*port2adr(port) >> 8); + else + return (*port2adr(port))&0xff; +} + +unsigned char se_inb_p(unsigned long port) +{ + unsigned long v; + + if (shifted_port(port)) + v = (*port2adr(port) >> 8); + else + v = (*port2adr(port))&0xff; + ctrl_delay(); + return v; +} + +unsigned short se_inw(unsigned long port) +{ + if (port >= 0x2000) + return *port2adr(port); + else + maybebadio(port); + return 0; +} + +unsigned int se_inl(unsigned long port) +{ + maybebadio(port); + return 0; +} + +void se_outb(unsigned char value, unsigned long port) +{ + if (shifted_port(port)) + *(port2adr(port)) = value << 8; + else + *(port2adr(port)) = value; +} + +void se_outb_p(unsigned char value, unsigned long port) +{ + if (shifted_port(port)) + *(port2adr(port)) = value << 8; + else + *(port2adr(port)) = value; + ctrl_delay(); +} + +void se_outw(unsigned short value, unsigned long port) +{ + if (port >= 0x2000) + *port2adr(port) = value; + else + maybebadio(port); +} + +void se_outl(unsigned int value, unsigned long port) +{ + maybebadio(port); +} + +void se_insb(unsigned long port, void *addr, unsigned long count) +{ + volatile __u16 *p = port2adr(port); + __u8 *ap = addr; + + if (shifted_port(port)) { + while (count--) + *ap++ = *p >> 8; + } else { + while (count--) + *ap++ = *p; + } +} + +void se_insw(unsigned long port, void *addr, unsigned long count) +{ + volatile __u16 *p = port2adr(port); + __u16 *ap = addr; + while (count--) + *ap++ = *p; +} + +void se_insl(unsigned long port, void *addr, unsigned long count) +{ + maybebadio(port); +} + +void se_outsb(unsigned long port, const void *addr, unsigned long count) +{ + volatile __u16 *p = port2adr(port); + const __u8 *ap = addr; + + if (shifted_port(port)) { + while (count--) + *p = *ap++ << 8; + } else { + while (count--) + *p = *ap++; + } +} + +void se_outsw(unsigned long port, const void *addr, unsigned long count) +{ + volatile __u16 *p = port2adr(port); + const __u16 *ap = addr; + + while (count--) + *p = *ap++; +} + +void se_outsl(unsigned long port, const void *addr, unsigned long count) +{ + maybebadio(port); +} diff --git a/trunk/arch/sh/boards/mach-se/770x/setup.c b/trunk/arch/sh/boards/mach-se/770x/setup.c index 31330c65c0ce..66d39d1b0901 100644 --- a/trunk/arch/sh/boards/mach-se/770x/setup.c +++ b/trunk/arch/sh/boards/mach-se/770x/setup.c @@ -195,5 +195,27 @@ static struct sh_machine_vector mv_se __initmv = { #elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712) .mv_nr_irqs = 104, #endif + + .mv_inb = se_inb, + .mv_inw = se_inw, + .mv_inl = se_inl, + .mv_outb = se_outb, + .mv_outw = se_outw, + .mv_outl = se_outl, + + .mv_inb_p = se_inb_p, + .mv_inw_p = se_inw, + .mv_inl_p = se_inl, + .mv_outb_p = se_outb_p, + .mv_outw_p = se_outw, + .mv_outl_p = se_outl, + + .mv_insb = se_insb, + .mv_insw = se_insw, + .mv_insl = se_insl, + .mv_outsb = se_outsb, + .mv_outsw = se_outsw, + .mv_outsl = se_outsl, + .mv_init_irq = init_se_IRQ, }; diff --git a/trunk/arch/sh/boards/mach-se/7751/Makefile b/trunk/arch/sh/boards/mach-se/7751/Makefile index a338fd9d5039..e6f4341bfe6e 100644 --- a/trunk/arch/sh/boards/mach-se/7751/Makefile +++ b/trunk/arch/sh/boards/mach-se/7751/Makefile @@ -2,4 +2,4 @@ # Makefile for the 7751 SolutionEngine specific parts of the kernel # -obj-y := setup.o irq.o +obj-y := setup.o io.o irq.o diff --git a/trunk/arch/sh/boards/mach-se/7751/io.c b/trunk/arch/sh/boards/mach-se/7751/io.c new file mode 100644 index 000000000000..6e75bd4459e5 --- /dev/null +++ b/trunk/arch/sh/boards/mach-se/7751/io.c @@ -0,0 +1,119 @@ +/* + * Copyright (C) 2001 Ian da Silva, Jeremy Siegel + * Based largely on io_se.c. + * + * I/O routine for Hitachi 7751 SolutionEngine. + * + * Initial version only to support LAN access; some + * placeholder code from io_se.c left in with the + * expectation of later SuperIO and PCMCIA access. + */ +#include +#include +#include +#include +#include +#include + +static inline volatile u16 *port2adr(unsigned int port) +{ + if (port >= 0x2000) + return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000)); + maybebadio((unsigned long)port); + return (volatile __u16*)port; +} + +/* + * General outline: remap really low stuff [eventually] to SuperIO, + * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO) + * is mapped through the PCI IO window. Stuff with high bits (PXSEG) + * should be way beyond the window, and is used w/o translation for + * compatibility. + */ +unsigned char sh7751se_inb(unsigned long port) +{ + if (PXSEG(port)) + return *(volatile unsigned char *)port; + else + return (*port2adr(port)) & 0xff; +} + +unsigned char sh7751se_inb_p(unsigned long port) +{ + unsigned char v; + + if (PXSEG(port)) + v = *(volatile unsigned char *)port; + else + v = (*port2adr(port)) & 0xff; + ctrl_delay(); + return v; +} + +unsigned short sh7751se_inw(unsigned long port) +{ + if (PXSEG(port)) + return *(volatile unsigned short *)port; + else if (port >= 0x2000) + return *port2adr(port); + else + maybebadio(port); + return 0; +} + +unsigned int sh7751se_inl(unsigned long port) +{ + if (PXSEG(port)) + return *(volatile unsigned long *)port; + else if (port >= 0x2000) + return *port2adr(port); + else + maybebadio(port); + return 0; +} + +void sh7751se_outb(unsigned char value, unsigned long port) +{ + + if (PXSEG(port)) + *(volatile unsigned char *)port = value; + else + *(port2adr(port)) = value; +} + +void sh7751se_outb_p(unsigned char value, unsigned long port) +{ + if (PXSEG(port)) + *(volatile unsigned char *)port = value; + else + *(port2adr(port)) = value; + ctrl_delay(); +} + +void sh7751se_outw(unsigned short value, unsigned long port) +{ + if (PXSEG(port)) + *(volatile unsigned short *)port = value; + else if (port >= 0x2000) + *port2adr(port) = value; + else + maybebadio(port); +} + +void sh7751se_outl(unsigned int value, unsigned long port) +{ + if (PXSEG(port)) + *(volatile unsigned long *)port = value; + else + maybebadio(port); +} + +void sh7751se_insl(unsigned long port, void *addr, unsigned long count) +{ + maybebadio(port); +} + +void sh7751se_outsl(unsigned long port, const void *addr, unsigned long count) +{ + maybebadio(port); +} diff --git a/trunk/arch/sh/boards/mach-se/7751/setup.c b/trunk/arch/sh/boards/mach-se/7751/setup.c index 9fbc51beb181..50572512e3e8 100644 --- a/trunk/arch/sh/boards/mach-se/7751/setup.c +++ b/trunk/arch/sh/boards/mach-se/7751/setup.c @@ -56,5 +56,23 @@ __initcall(se7751_devices_setup); static struct sh_machine_vector mv_7751se __initmv = { .mv_name = "7751 SolutionEngine", .mv_nr_irqs = 72, + + .mv_inb = sh7751se_inb, + .mv_inw = sh7751se_inw, + .mv_inl = sh7751se_inl, + .mv_outb = sh7751se_outb, + .mv_outw = sh7751se_outw, + .mv_outl = sh7751se_outl, + + .mv_inb_p = sh7751se_inb_p, + .mv_inw_p = sh7751se_inw, + .mv_inl_p = sh7751se_inl, + .mv_outb_p = sh7751se_outb_p, + .mv_outw_p = sh7751se_outw, + .mv_outl_p = sh7751se_outl, + + .mv_insl = sh7751se_insl, + .mv_outsl = sh7751se_outsl, + .mv_init_irq = init_7751se_IRQ, }; diff --git a/trunk/arch/sh/boards/mach-snapgear/Makefile b/trunk/arch/sh/boards/mach-snapgear/Makefile new file mode 100644 index 000000000000..d2d2f4b6a502 --- /dev/null +++ b/trunk/arch/sh/boards/mach-snapgear/Makefile @@ -0,0 +1,5 @@ +# +# Makefile for the SnapGear specific parts of the kernel +# + +obj-y := setup.o io.o diff --git a/trunk/arch/sh/boards/mach-snapgear/io.c b/trunk/arch/sh/boards/mach-snapgear/io.c new file mode 100644 index 000000000000..476650e42dbc --- /dev/null +++ b/trunk/arch/sh/boards/mach-snapgear/io.c @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2002 David McCullough + * Copyright (C) 2001 Ian da Silva, Jeremy Siegel + * Based largely on io_se.c. + * + * I/O routine for Hitachi 7751 SolutionEngine. + * + * Initial version only to support LAN access; some + * placeholder code from io_se.c left in with the + * expectation of later SuperIO and PCMCIA access. + */ +#include +#include +#include +#include +#include + +#ifdef CONFIG_SH_SECUREEDGE5410 +unsigned short secureedge5410_ioport; +#endif + +static inline volatile __u16 *port2adr(unsigned int port) +{ + maybebadio((unsigned long)port); + return (volatile __u16*)port; +} + +/* + * General outline: remap really low stuff [eventually] to SuperIO, + * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO) + * is mapped through the PCI IO window. Stuff with high bits (PXSEG) + * should be way beyond the window, and is used w/o translation for + * compatibility. + */ +unsigned char snapgear_inb(unsigned long port) +{ + if (PXSEG(port)) + return *(volatile unsigned char *)port; + else + return (*port2adr(port)) & 0xff; +} + +unsigned char snapgear_inb_p(unsigned long port) +{ + unsigned char v; + + if (PXSEG(port)) + v = *(volatile unsigned char *)port; + else + v = (*port2adr(port))&0xff; + ctrl_delay(); + return v; +} + +unsigned short snapgear_inw(unsigned long port) +{ + if (PXSEG(port)) + return *(volatile unsigned short *)port; + else if (port >= 0x2000) + return *port2adr(port); + else + maybebadio(port); + return 0; +} + +unsigned int snapgear_inl(unsigned long port) +{ + if (PXSEG(port)) + return *(volatile unsigned long *)port; + else if (port >= 0x2000) + return *port2adr(port); + else + maybebadio(port); + return 0; +} + +void snapgear_outb(unsigned char value, unsigned long port) +{ + + if (PXSEG(port)) + *(volatile unsigned char *)port = value; + else + *(port2adr(port)) = value; +} + +void snapgear_outb_p(unsigned char value, unsigned long port) +{ + if (PXSEG(port)) + *(volatile unsigned char *)port = value; + else + *(port2adr(port)) = value; + ctrl_delay(); +} + +void snapgear_outw(unsigned short value, unsigned long port) +{ + if (PXSEG(port)) + *(volatile unsigned short *)port = value; + else if (port >= 0x2000) + *port2adr(port) = value; + else + maybebadio(port); +} + +void snapgear_outl(unsigned int value, unsigned long port) +{ + if (PXSEG(port)) + *(volatile unsigned long *)port = value; + else + maybebadio(port); +} + +void snapgear_insl(unsigned long port, void *addr, unsigned long count) +{ + maybebadio(port); +} + +void snapgear_outsl(unsigned long port, const void *addr, unsigned long count) +{ + maybebadio(port); +} diff --git a/trunk/arch/sh/boards/board-secureedge5410.c b/trunk/arch/sh/boards/mach-snapgear/setup.c similarity index 70% rename from trunk/arch/sh/boards/board-secureedge5410.c rename to trunk/arch/sh/boards/mach-snapgear/setup.c index 32f875e8493d..331745dee379 100644 --- a/trunk/arch/sh/boards/board-secureedge5410.c +++ b/trunk/arch/sh/boards/mach-snapgear/setup.c @@ -1,4 +1,6 @@ /* + * linux/arch/sh/boards/snapgear/setup.c + * * Copyright (C) 2002 David McCullough * Copyright (C) 2003 Paul Mundt * @@ -17,19 +19,18 @@ #include #include #include -#include +#include #include #include #include -unsigned short secureedge5410_ioport; - /* * EraseConfig handling functions */ + static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id) { - ctrl_delay(); /* dummy read */ + (void)__raw_readb(0xb8000000); /* dummy read */ printk("SnapGear: erase switch interrupt!\n"); @@ -38,22 +39,21 @@ static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id) static int __init eraseconfig_init(void) { - unsigned int irq = evt2irq(0x240); - printk("SnapGear: EraseConfig init\n"); - /* Setup "EraseConfig" switch on external IRQ 0 */ - if (request_irq(irq, eraseconfig_interrupt, IRQF_DISABLED, + if (request_irq(IRL0_IRQ, eraseconfig_interrupt, IRQF_DISABLED, "Erase Config", NULL)) printk("SnapGear: failed to register IRQ%d for Reset witch\n", - irq); + IRL0_IRQ); else printk("SnapGear: registered EraseConfig switch on IRQ%d\n", - irq); - return 0; + IRL0_IRQ); + return(0); } + module_init(eraseconfig_init); +/****************************************************************************/ /* * Initialize IRQ setting * @@ -62,6 +62,7 @@ module_init(eraseconfig_init); * IRL2 = eth1 * IRL3 = crypto */ + static void __init init_snapgear_IRQ(void) { printk("Setup SnapGear IRQ/IPR ...\n"); @@ -75,5 +76,20 @@ static void __init init_snapgear_IRQ(void) static struct sh_machine_vector mv_snapgear __initmv = { .mv_name = "SnapGear SecureEdge5410", .mv_nr_irqs = 72, + + .mv_inb = snapgear_inb, + .mv_inw = snapgear_inw, + .mv_inl = snapgear_inl, + .mv_outb = snapgear_outb, + .mv_outw = snapgear_outw, + .mv_outl = snapgear_outl, + + .mv_inb_p = snapgear_inb_p, + .mv_inw_p = snapgear_inw, + .mv_inl_p = snapgear_inl, + .mv_outb_p = snapgear_outb_p, + .mv_outw_p = snapgear_outw, + .mv_outl_p = snapgear_outl, + .mv_init_irq = init_snapgear_IRQ, }; diff --git a/trunk/arch/sh/boards/mach-systemh/Makefile b/trunk/arch/sh/boards/mach-systemh/Makefile new file mode 100644 index 000000000000..2cc6a23d9d39 --- /dev/null +++ b/trunk/arch/sh/boards/mach-systemh/Makefile @@ -0,0 +1,13 @@ +# +# Makefile for the SystemH specific parts of the kernel +# + +obj-y := setup.o irq.o io.o + +# XXX: This wants to be consolidated in arch/sh/drivers/pci, and more +# importantly, with the generic sh7751_pcic_init() code. For now, we'll +# just abuse the hell out of kbuild, because we can.. + +obj-$(CONFIG_PCI) += pci.o +pci-y := ../../se/7751/pci.o + diff --git a/trunk/arch/sh/boards/mach-systemh/io.c b/trunk/arch/sh/boards/mach-systemh/io.c new file mode 100644 index 000000000000..15577ff1f715 --- /dev/null +++ b/trunk/arch/sh/boards/mach-systemh/io.c @@ -0,0 +1,158 @@ +/* + * linux/arch/sh/boards/renesas/systemh/io.c + * + * Copyright (C) 2001 Ian da Silva, Jeremy Siegel + * Based largely on io_se.c. + * + * I/O routine for Hitachi 7751 Systemh. + */ +#include +#include +#include +#include +#include +#include + +#define ETHER_IOMAP(adr) (0xB3000000 + (adr)) /*map to 16bits access area + of smc lan chip*/ +static inline volatile __u16 * +port2adr(unsigned int port) +{ + if (port >= 0x2000) + return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000)); + maybebadio((unsigned long)port); + return (volatile __u16*)port; +} + +/* + * General outline: remap really low stuff [eventually] to SuperIO, + * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO) + * is mapped through the PCI IO window. Stuff with high bits (PXSEG) + * should be way beyond the window, and is used w/o translation for + * compatibility. + */ +unsigned char sh7751systemh_inb(unsigned long port) +{ + if (PXSEG(port)) + return *(volatile unsigned char *)port; + else if (port <= 0x3F1) + return *(volatile unsigned char *)ETHER_IOMAP(port); + else + return (*port2adr(port))&0xff; +} + +unsigned char sh7751systemh_inb_p(unsigned long port) +{ + unsigned char v; + + if (PXSEG(port)) + v = *(volatile unsigned char *)port; + else if (port <= 0x3F1) + v = *(volatile unsigned char *)ETHER_IOMAP(port); + else + v = (*port2adr(port))&0xff; + ctrl_delay(); + return v; +} + +unsigned short sh7751systemh_inw(unsigned long port) +{ + if (PXSEG(port)) + return *(volatile unsigned short *)port; + else if (port >= 0x2000) + return *port2adr(port); + else if (port <= 0x3F1) + return *(volatile unsigned int *)ETHER_IOMAP(port); + else + maybebadio(port); + return 0; +} + +unsigned int sh7751systemh_inl(unsigned long port) +{ + if (PXSEG(port)) + return *(volatile unsigned long *)port; + else if (port >= 0x2000) + return *port2adr(port); + else if (port <= 0x3F1) + return *(volatile unsigned int *)ETHER_IOMAP(port); + else + maybebadio(port); + return 0; +} + +void sh7751systemh_outb(unsigned char value, unsigned long port) +{ + + if (PXSEG(port)) + *(volatile unsigned char *)port = value; + else if (port <= 0x3F1) + *(volatile unsigned char *)ETHER_IOMAP(port) = value; + else + *(port2adr(port)) = value; +} + +void sh7751systemh_outb_p(unsigned char value, unsigned long port) +{ + if (PXSEG(port)) + *(volatile unsigned char *)port = value; + else if (port <= 0x3F1) + *(volatile unsigned char *)ETHER_IOMAP(port) = value; + else + *(port2adr(port)) = value; + ctrl_delay(); +} + +void sh7751systemh_outw(unsigned short value, unsigned long port) +{ + if (PXSEG(port)) + *(volatile unsigned short *)port = value; + else if (port >= 0x2000) + *port2adr(port) = value; + else if (port <= 0x3F1) + *(volatile unsigned short *)ETHER_IOMAP(port) = value; + else + maybebadio(port); +} + +void sh7751systemh_outl(unsigned int value, unsigned long port) +{ + if (PXSEG(port)) + *(volatile unsigned long *)port = value; + else + maybebadio(port); +} + +void sh7751systemh_insb(unsigned long port, void *addr, unsigned long count) +{ + unsigned char *p = addr; + while (count--) *p++ = sh7751systemh_inb(port); +} + +void sh7751systemh_insw(unsigned long port, void *addr, unsigned long count) +{ + unsigned short *p = addr; + while (count--) *p++ = sh7751systemh_inw(port); +} + +void sh7751systemh_insl(unsigned long port, void *addr, unsigned long count) +{ + maybebadio(port); +} + +void sh7751systemh_outsb(unsigned long port, const void *addr, unsigned long count) +{ + unsigned char *p = (unsigned char*)addr; + while (count--) sh7751systemh_outb(*p++, port); +} + +void sh7751systemh_outsw(unsigned long port, const void *addr, unsigned long count) +{ + unsigned short *p = (unsigned short*)addr; + while (count--) sh7751systemh_outw(*p++, port); +} + +void sh7751systemh_outsl(unsigned long port, const void *addr, unsigned long count) +{ + maybebadio(port); +} diff --git a/trunk/arch/sh/boards/mach-systemh/irq.c b/trunk/arch/sh/boards/mach-systemh/irq.c new file mode 100644 index 000000000000..e5ee13adeff4 --- /dev/null +++ b/trunk/arch/sh/boards/mach-systemh/irq.c @@ -0,0 +1,61 @@ +/* + * linux/arch/sh/boards/renesas/systemh/irq.c + * + * Copyright (C) 2000 Kazumoto Kojima + * + * Hitachi SystemH Support. + * + * Modified for 7751 SystemH by + * Jonathan Short. + */ + +#include +#include +#include +#include + +#include +#include + +/* address of external interrupt mask register + * address must be set prior to use these (maybe in init_XXX_irq()) + * XXX : is it better to use .config than specifying it in code? */ +static unsigned long *systemh_irq_mask_register = (unsigned long *)0xB3F10004; +static unsigned long *systemh_irq_request_register = (unsigned long *)0xB3F10000; + +static void disable_systemh_irq(struct irq_data *data) +{ + unsigned long val, mask = 0x01 << 1; + + /* Clear the "irq"th bit in the mask and set it in the request */ + val = __raw_readl((unsigned long)systemh_irq_mask_register); + val &= ~mask; + __raw_writel(val, (unsigned long)systemh_irq_mask_register); + + val = __raw_readl((unsigned long)systemh_irq_request_register); + val |= mask; + __raw_writel(val, (unsigned long)systemh_irq_request_register); +} + +static void enable_systemh_irq(struct irq_data *data) +{ + unsigned long val, mask = 0x01 << 1; + + /* Set "irq"th bit in the mask register */ + val = __raw_readl((unsigned long)systemh_irq_mask_register); + val |= mask; + __raw_writel(val, (unsigned long)systemh_irq_mask_register); +} + +static struct irq_chip systemh_irq_type = { + .name = "SystemH Register", + .irq_unmask = enable_systemh_irq, + .irq_mask = disable_systemh_irq, +}; + +void make_systemh_irq(unsigned int irq) +{ + disable_irq_nosync(irq); + set_irq_chip_and_handler(irq, &systemh_irq_type, handle_level_irq); + disable_systemh_irq(irq_get_irq_data(irq)); +} diff --git a/trunk/arch/sh/boards/mach-systemh/setup.c b/trunk/arch/sh/boards/mach-systemh/setup.c new file mode 100644 index 000000000000..219fd800a43f --- /dev/null +++ b/trunk/arch/sh/boards/mach-systemh/setup.c @@ -0,0 +1,57 @@ +/* + * linux/arch/sh/boards/renesas/systemh/setup.c + * + * Copyright (C) 2000 Kazumoto Kojima + * Copyright (C) 2003 Paul Mundt + * + * Hitachi SystemH Support. + * + * Modified for 7751 SystemH by Jonathan Short. + * + * Rewritten for 2.6 by Paul Mundt. + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ +#include +#include +#include + +extern void make_systemh_irq(unsigned int irq); + +/* + * Initialize IRQ setting + */ +static void __init sh7751systemh_init_irq(void) +{ + make_systemh_irq(0xb); /* Ethernet interrupt */ +} + +static struct sh_machine_vector mv_7751systemh __initmv = { + .mv_name = "7751 SystemH", + .mv_nr_irqs = 72, + + .mv_inb = sh7751systemh_inb, + .mv_inw = sh7751systemh_inw, + .mv_inl = sh7751systemh_inl, + .mv_outb = sh7751systemh_outb, + .mv_outw = sh7751systemh_outw, + .mv_outl = sh7751systemh_outl, + + .mv_inb_p = sh7751systemh_inb_p, + .mv_inw_p = sh7751systemh_inw, + .mv_inl_p = sh7751systemh_inl, + .mv_outb_p = sh7751systemh_outb_p, + .mv_outw_p = sh7751systemh_outw, + .mv_outl_p = sh7751systemh_outl, + + .mv_insb = sh7751systemh_insb, + .mv_insw = sh7751systemh_insw, + .mv_insl = sh7751systemh_insl, + .mv_outsb = sh7751systemh_outsb, + .mv_outsw = sh7751systemh_outsw, + .mv_outsl = sh7751systemh_outsl, + + .mv_init_irq = sh7751systemh_init_irq, +}; diff --git a/trunk/arch/sh/configs/secureedge5410_defconfig b/trunk/arch/sh/configs/snapgear_defconfig similarity index 100% rename from trunk/arch/sh/configs/secureedge5410_defconfig rename to trunk/arch/sh/configs/snapgear_defconfig diff --git a/trunk/arch/sh/configs/systemh_defconfig b/trunk/arch/sh/configs/systemh_defconfig new file mode 100644 index 000000000000..b58dfc505efe --- /dev/null +++ b/trunk/arch/sh/configs/systemh_defconfig @@ -0,0 +1,28 @@ +CONFIG_EXPERIMENTAL=y +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_BLK_DEV_INITRD=y +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +# CONFIG_SYSCTL_SYSCALL is not set +# CONFIG_HOTPLUG is not set +CONFIG_SLAB=y +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +# CONFIG_BLK_DEV_BSG is not set +CONFIG_CPU_SUBTYPE_SH7751R=y +CONFIG_MEMORY_START=0x0c000000 +CONFIG_MEMORY_SIZE=0x00400000 +CONFIG_FLATMEM_MANUAL=y +CONFIG_SH_7751_SYSTEMH=y +CONFIG_PREEMPT=y +# CONFIG_STANDALONE is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=1024 +# CONFIG_INPUT is not set +# CONFIG_SERIO_SERPORT is not set +# CONFIG_VT is not set +CONFIG_HW_RANDOM=y +CONFIG_PROC_KCORE=y +CONFIG_TMPFS=y +CONFIG_CRAMFS=y +CONFIG_ROMFS_FS=y +# CONFIG_RCU_CPU_STALL_DETECTOR is not set diff --git a/trunk/arch/sh/include/asm/addrspace.h b/trunk/arch/sh/include/asm/addrspace.h index 3d1ae2bfaa6f..446b3831c214 100644 --- a/trunk/arch/sh/include/asm/addrspace.h +++ b/trunk/arch/sh/include/asm/addrspace.h @@ -44,10 +44,10 @@ /* * These will never work in 32-bit, don't even bother. */ -#define P1SEGADDR(a) ({ (void)(a); BUG(); NULL; }) -#define P2SEGADDR(a) ({ (void)(a); BUG(); NULL; }) -#define P3SEGADDR(a) ({ (void)(a); BUG(); NULL; }) -#define P4SEGADDR(a) ({ (void)(a); BUG(); NULL; }) +#define P1SEGADDR(a) __futile_remapping_attempt +#define P2SEGADDR(a) __futile_remapping_attempt +#define P3SEGADDR(a) __futile_remapping_attempt +#define P4SEGADDR(a) __futile_remapping_attempt #endif #endif /* P1SEG */ diff --git a/trunk/arch/sh/include/asm/pgtable.h b/trunk/arch/sh/include/asm/pgtable.h index 083ea068e819..a15f1058bbf4 100644 --- a/trunk/arch/sh/include/asm/pgtable.h +++ b/trunk/arch/sh/include/asm/pgtable.h @@ -66,6 +66,7 @@ static inline unsigned long long neff_sign_extend(unsigned long val) #define PHYS_ADDR_MASK29 0x1fffffff #define PHYS_ADDR_MASK32 0xffffffff +#ifdef CONFIG_PMB static inline unsigned long phys_addr_mask(void) { /* Is the MMU in 29bit mode? */ @@ -74,6 +75,17 @@ static inline unsigned long phys_addr_mask(void) return PHYS_ADDR_MASK32; } +#elif defined(CONFIG_32BIT) +static inline unsigned long phys_addr_mask(void) +{ + return PHYS_ADDR_MASK32; +} +#else +static inline unsigned long phys_addr_mask(void) +{ + return PHYS_ADDR_MASK29; +} +#endif #define PTE_PHYS_MASK (phys_addr_mask() & PAGE_MASK) #define PTE_FLAGS_MASK (~(PTE_PHYS_MASK) << PAGE_SHIFT) diff --git a/trunk/arch/sh/include/asm/system.h b/trunk/arch/sh/include/asm/system.h index 10c8b1823a18..1f1af5afff03 100644 --- a/trunk/arch/sh/include/asm/system.h +++ b/trunk/arch/sh/include/asm/system.h @@ -10,7 +10,6 @@ #include #include #include -#include #define AT_VECTOR_SIZE_ARCH 5 /* entries in ARCH_DLINFO */ @@ -138,6 +137,9 @@ extern unsigned int instruction_size(unsigned int insn); #define instruction_size(insn) (4) #endif +extern unsigned long cached_to_uncached; +extern unsigned long uncached_size; + void per_cpu_trap_init(void); void default_idle(void); void cpu_idle_wait(void); diff --git a/trunk/arch/sh/include/asm/system_32.h b/trunk/arch/sh/include/asm/system_32.h index a4ad1cd9bc4d..c941b2739405 100644 --- a/trunk/arch/sh/include/asm/system_32.h +++ b/trunk/arch/sh/include/asm/system_32.h @@ -145,6 +145,42 @@ do { \ __restore_dsp(prev); \ } while (0) +/* + * Jump to uncached area. + * When handling TLB or caches, we need to do it from an uncached area. + */ +#define jump_to_uncached() \ +do { \ + unsigned long __dummy; \ + \ + __asm__ __volatile__( \ + "mova 1f, %0\n\t" \ + "add %1, %0\n\t" \ + "jmp @%0\n\t" \ + " nop\n\t" \ + ".balign 4\n" \ + "1:" \ + : "=&z" (__dummy) \ + : "r" (cached_to_uncached)); \ +} while (0) + +/* + * Back to cached area. + */ +#define back_to_cached() \ +do { \ + unsigned long __dummy; \ + ctrl_barrier(); \ + __asm__ __volatile__( \ + "mov.l 1f, %0\n\t" \ + "jmp @%0\n\t" \ + " nop\n\t" \ + ".balign 4\n" \ + "1: .long 2f\n" \ + "2:" \ + : "=&r" (__dummy)); \ +} while (0) + #ifdef CONFIG_CPU_HAS_SR_RB #define lookup_exception_vector() \ ({ \ diff --git a/trunk/arch/sh/include/asm/system_64.h b/trunk/arch/sh/include/asm/system_64.h index 8593bc8d1a4e..36338646dfc8 100644 --- a/trunk/arch/sh/include/asm/system_64.h +++ b/trunk/arch/sh/include/asm/system_64.h @@ -34,6 +34,9 @@ do { \ &next->thread); \ } while (0) +#define jump_to_uncached() do { } while (0) +#define back_to_cached() do { } while (0) + #define __icbi(addr) __asm__ __volatile__ ( "icbi %0, 0\n\t" : : "r" (addr)) #define __ocbp(addr) __asm__ __volatile__ ( "ocbp %0, 0\n\t" : : "r" (addr)) #define __ocbi(addr) __asm__ __volatile__ ( "ocbi %0, 0\n\t" : : "r" (addr)) diff --git a/trunk/arch/sh/include/asm/uncached.h b/trunk/arch/sh/include/asm/uncached.h index 6f8816b79cf1..e3419f96626a 100644 --- a/trunk/arch/sh/include/asm/uncached.h +++ b/trunk/arch/sh/include/asm/uncached.h @@ -4,55 +4,15 @@ #include #ifdef CONFIG_UNCACHED_MAPPING -extern unsigned long cached_to_uncached; -extern unsigned long uncached_size; extern unsigned long uncached_start, uncached_end; extern int virt_addr_uncached(unsigned long kaddr); extern void uncached_init(void); extern void uncached_resize(unsigned long size); - -/* - * Jump to uncached area. - * When handling TLB or caches, we need to do it from an uncached area. - */ -#define jump_to_uncached() \ -do { \ - unsigned long __dummy; \ - \ - __asm__ __volatile__( \ - "mova 1f, %0\n\t" \ - "add %1, %0\n\t" \ - "jmp @%0\n\t" \ - " nop\n\t" \ - ".balign 4\n" \ - "1:" \ - : "=&z" (__dummy) \ - : "r" (cached_to_uncached)); \ -} while (0) - -/* - * Back to cached area. - */ -#define back_to_cached() \ -do { \ - unsigned long __dummy; \ - ctrl_barrier(); \ - __asm__ __volatile__( \ - "mov.l 1f, %0\n\t" \ - "jmp @%0\n\t" \ - " nop\n\t" \ - ".balign 4\n" \ - "1: .long 2f\n" \ - "2:" \ - : "=&r" (__dummy)); \ -} while (0) #else #define virt_addr_uncached(kaddr) (0) #define uncached_init() do { } while (0) #define uncached_resize(size) BUG() -#define jump_to_uncached() do { } while (0) -#define back_to_cached() do { } while (0) #endif #endif /* __ASM_SH_UNCACHED_H */ diff --git a/trunk/arch/sh/include/mach-common/mach/edosk7705.h b/trunk/arch/sh/include/mach-common/mach/edosk7705.h new file mode 100644 index 000000000000..efc43b323466 --- /dev/null +++ b/trunk/arch/sh/include/mach-common/mach/edosk7705.h @@ -0,0 +1,7 @@ +#ifndef __ASM_SH_EDOSK7705_H +#define __ASM_SH_EDOSK7705_H + +#define __IO_PREFIX sh_edosk7705 +#include + +#endif /* __ASM_SH_EDOSK7705_H */ diff --git a/trunk/arch/sh/include/mach-common/mach/microdev.h b/trunk/arch/sh/include/mach-common/mach/microdev.h index dcb05fa8c164..1aed15856e11 100644 --- a/trunk/arch/sh/include/mach-common/mach/microdev.h +++ b/trunk/arch/sh/include/mach-common/mach/microdev.h @@ -68,4 +68,13 @@ extern void microdev_print_fpga_intc_status(void); #define __IO_PREFIX microdev #include +#if defined(CONFIG_PCI) +unsigned char microdev_pci_inb(unsigned long port); +unsigned short microdev_pci_inw(unsigned long port); +unsigned long microdev_pci_inl(unsigned long port); +void microdev_pci_outb(unsigned char data, unsigned long port); +void microdev_pci_outw(unsigned short data, unsigned long port); +void microdev_pci_outl(unsigned long data, unsigned long port); +#endif + #endif /* __ASM_SH_MICRODEV_H */ diff --git a/trunk/arch/sh/include/mach-common/mach/secureedge5410.h b/trunk/arch/sh/include/mach-common/mach/snapgear.h similarity index 79% rename from trunk/arch/sh/include/mach-common/mach/secureedge5410.h rename to trunk/arch/sh/include/mach-common/mach/snapgear.h index 3653b9a4bacc..042d95f51c4d 100644 --- a/trunk/arch/sh/include/mach-common/mach/secureedge5410.h +++ b/trunk/arch/sh/include/mach-common/mach/snapgear.h @@ -12,9 +12,30 @@ #ifndef _ASM_SH_IO_SNAPGEAR_H #define _ASM_SH_IO_SNAPGEAR_H +#if defined(CONFIG_CPU_SH4) +/* + * The external interrupt lines, these take up ints 0 - 15 inclusive + * depending on the priority for the interrupt. In fact the priority + * is the interrupt :-) + */ + +#define IRL0_IRQ 2 +#define IRL0_PRIORITY 13 + +#define IRL1_IRQ 5 +#define IRL1_PRIORITY 10 + +#define IRL2_IRQ 8 +#define IRL2_PRIORITY 7 + +#define IRL3_IRQ 11 +#define IRL3_PRIORITY 4 +#endif + #define __IO_PREFIX snapgear #include +#ifdef CONFIG_SH_SECUREEDGE5410 /* * We need to remember what was written to the ioport as some bits * are shared with other functions and you cannot read back what was @@ -45,5 +66,6 @@ extern unsigned short secureedge5410_ioport; ((secureedge5410_ioport & ~(mask)) | ((val) & (mask))))) #define SECUREEDGE_READ_IOPORT() \ ((*SECUREEDGE_IOPORT_ADDR&0x0817) | (secureedge5410_ioport&~0x0817)) +#endif #endif /* _ASM_SH_IO_SNAPGEAR_H */ diff --git a/trunk/arch/sh/include/mach-common/mach/systemh7751.h b/trunk/arch/sh/include/mach-common/mach/systemh7751.h new file mode 100644 index 000000000000..4161122c84ef --- /dev/null +++ b/trunk/arch/sh/include/mach-common/mach/systemh7751.h @@ -0,0 +1,71 @@ +#ifndef __ASM_SH_SYSTEMH_7751SYSTEMH_H +#define __ASM_SH_SYSTEMH_7751SYSTEMH_H + +/* + * linux/include/asm-sh/systemh/7751systemh.h + * + * Copyright (C) 2000 Kazumoto Kojima + * + * Hitachi SystemH support + + * Modified for 7751 SystemH by + * Jonathan Short, 2002. + */ + +/* Box specific addresses. */ + +#define PA_ROM 0x00000000 /* EPROM */ +#define PA_ROM_SIZE 0x00400000 /* EPROM size 4M byte */ +#define PA_FROM 0x01000000 /* EPROM */ +#define PA_FROM_SIZE 0x00400000 /* EPROM size 4M byte */ +#define PA_EXT1 0x04000000 +#define PA_EXT1_SIZE 0x04000000 +#define PA_EXT2 0x08000000 +#define PA_EXT2_SIZE 0x04000000 +#define PA_SDRAM 0x0c000000 +#define PA_SDRAM_SIZE 0x04000000 + +#define PA_EXT4 0x12000000 +#define PA_EXT4_SIZE 0x02000000 +#define PA_EXT5 0x14000000 +#define PA_EXT5_SIZE 0x04000000 +#define PA_PCIC 0x18000000 /* MR-SHPC-01 PCMCIA */ + +#define PA_DIPSW0 0xb9000000 /* Dip switch 5,6 */ +#define PA_DIPSW1 0xb9000002 /* Dip switch 7,8 */ +#define PA_LED 0xba000000 /* LED */ +#define PA_BCR 0xbb000000 /* FPGA on the MS7751SE01 */ + +#define PA_MRSHPC 0xb83fffe0 /* MR-SHPC-01 PCMCIA controller */ +#define PA_MRSHPC_MW1 0xb8400000 /* MR-SHPC-01 memory window base */ +#define PA_MRSHPC_MW2 0xb8500000 /* MR-SHPC-01 attribute window base */ +#define PA_MRSHPC_IO 0xb8600000 /* MR-SHPC-01 I/O window base */ +#define MRSHPC_MODE (PA_MRSHPC + 4) +#define MRSHPC_OPTION (PA_MRSHPC + 6) +#define MRSHPC_CSR (PA_MRSHPC + 8) +#define MRSHPC_ISR (PA_MRSHPC + 10) +#define MRSHPC_ICR (PA_MRSHPC + 12) +#define MRSHPC_CPWCR (PA_MRSHPC + 14) +#define MRSHPC_MW0CR1 (PA_MRSHPC + 16) +#define MRSHPC_MW1CR1 (PA_MRSHPC + 18) +#define MRSHPC_IOWCR1 (PA_MRSHPC + 20) +#define MRSHPC_MW0CR2 (PA_MRSHPC + 22) +#define MRSHPC_MW1CR2 (PA_MRSHPC + 24) +#define MRSHPC_IOWCR2 (PA_MRSHPC + 26) +#define MRSHPC_CDCR (PA_MRSHPC + 28) +#define MRSHPC_PCIC_INFO (PA_MRSHPC + 30) + +#define BCR_ILCRA (PA_BCR + 0) +#define BCR_ILCRB (PA_BCR + 2) +#define BCR_ILCRC (PA_BCR + 4) +#define BCR_ILCRD (PA_BCR + 6) +#define BCR_ILCRE (PA_BCR + 8) +#define BCR_ILCRF (PA_BCR + 10) +#define BCR_ILCRG (PA_BCR + 12) + +#define IRQ_79C973 13 + +#define __IO_PREFIX sh7751systemh +#include + +#endif /* __ASM_SH_SYSTEMH_7751SYSTEMH_H */ diff --git a/trunk/arch/sh/kernel/cpu/sh4a/clock-sh7724.c b/trunk/arch/sh/kernel/cpu/sh4a/clock-sh7724.c index 0fe2e9329cb2..2d9700c6b53a 100644 --- a/trunk/arch/sh/kernel/cpu/sh4a/clock-sh7724.c +++ b/trunk/arch/sh/kernel/cpu/sh4a/clock-sh7724.c @@ -48,7 +48,7 @@ static struct clk r_clk = { * Default rate for the root input clock, reset this with clk_set_rate() * from the platform code. */ -static struct clk extal_clk = { +struct clk extal_clk = { .rate = 33333333, }; @@ -111,7 +111,7 @@ static struct clk div3_clk = { .parent = &pll_clk, }; -static struct clk *main_clks[] = { +struct clk *main_clks[] = { &r_clk, &extal_clk, &fll_clk, @@ -156,7 +156,7 @@ struct clk div4_clks[DIV4_NR] = { enum { DIV6_V, DIV6_FA, DIV6_FB, DIV6_I, DIV6_S, DIV6_NR }; -static struct clk div6_clks[DIV6_NR] = { +struct clk div6_clks[DIV6_NR] = { [DIV6_V] = SH_CLK_DIV6(&div3_clk, VCLKCR, 0), [DIV6_FA] = SH_CLK_DIV6(&div3_clk, FCLKACR, 0), [DIV6_FB] = SH_CLK_DIV6(&div3_clk, FCLKBCR, 0), diff --git a/trunk/arch/sh/mm/Kconfig b/trunk/arch/sh/mm/Kconfig index c3e61b366493..09370392aff1 100644 --- a/trunk/arch/sh/mm/Kconfig +++ b/trunk/arch/sh/mm/Kconfig @@ -79,7 +79,7 @@ config 29BIT config 32BIT bool - default y if CPU_SH5 || !MMU + default y if CPU_SH5 config PMB bool "Support 32-bit physical addressing through PMB" diff --git a/trunk/arch/sh/mm/consistent.c b/trunk/arch/sh/mm/consistent.c index 40733a952402..038793286990 100644 --- a/trunk/arch/sh/mm/consistent.c +++ b/trunk/arch/sh/mm/consistent.c @@ -79,20 +79,21 @@ void dma_generic_free_coherent(struct device *dev, size_t size, void dma_cache_sync(struct device *dev, void *vaddr, size_t size, enum dma_data_direction direction) { - void *addr; - - addr = __in_29bit_mode() ? - (void *)P1SEGADDR((unsigned long)vaddr) : vaddr; +#if defined(CONFIG_CPU_SH5) || defined(CONFIG_PMB) + void *p1addr = vaddr; +#else + void *p1addr = (void*) P1SEGADDR((unsigned long)vaddr); +#endif switch (direction) { case DMA_FROM_DEVICE: /* invalidate only */ - __flush_invalidate_region(addr, size); + __flush_invalidate_region(p1addr, size); break; case DMA_TO_DEVICE: /* writeback only */ - __flush_wback_region(addr, size); + __flush_wback_region(p1addr, size); break; case DMA_BIDIRECTIONAL: /* writeback and invalidate */ - __flush_purge_region(addr, size); + __flush_purge_region(p1addr, size); break; default: BUG(); diff --git a/trunk/arch/sh/mm/uncached.c b/trunk/arch/sh/mm/uncached.c index a7767da815e9..8a4eca551fc0 100644 --- a/trunk/arch/sh/mm/uncached.c +++ b/trunk/arch/sh/mm/uncached.c @@ -28,7 +28,7 @@ EXPORT_SYMBOL(virt_addr_uncached); void __init uncached_init(void) { -#if defined(CONFIG_29BIT) || !defined(CONFIG_MMU) +#ifdef CONFIG_29BIT uncached_start = P2SEG; #else uncached_start = memory_end; diff --git a/trunk/arch/sh/tools/mach-types b/trunk/arch/sh/tools/mach-types index 0e68465e7b50..9f56eb978024 100644 --- a/trunk/arch/sh/tools/mach-types +++ b/trunk/arch/sh/tools/mach-types @@ -26,6 +26,7 @@ HD64461 HD64461 7724SE SH_7724_SOLUTION_ENGINE 7751SE SH_7751_SOLUTION_ENGINE 7780SE SH_7780_SOLUTION_ENGINE +7751SYSTEMH SH_7751_SYSTEMH HP6XX SH_HP6XX DREAMCAST SH_DREAMCAST SNAPGEAR SH_SECUREEDGE5410 diff --git a/trunk/drivers/Makefile b/trunk/drivers/Makefile index f3ebb30f1b7f..14cf9077bb2b 100644 --- a/trunk/drivers/Makefile +++ b/trunk/drivers/Makefile @@ -26,7 +26,6 @@ obj-$(CONFIG_REGULATOR) += regulator/ # char/ comes before serial/ etc so that the VT console is the boot-time # default. -obj-y += tty/ obj-y += char/ # gpu/ comes after char for AGP vs DRM startup diff --git a/trunk/drivers/block/floppy.c b/trunk/drivers/block/floppy.c index 3951020e494a..8f19b380ca83 100644 --- a/trunk/drivers/block/floppy.c +++ b/trunk/drivers/block/floppy.c @@ -4573,8 +4573,8 @@ static void __exit floppy_module_exit(void) device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos); platform_device_unregister(&floppy_device[drive]); } - blk_cleanup_queue(disks[drive]->queue); put_disk(disks[drive]); + blk_cleanup_queue(disks[drive]->queue); } del_timer_sync(&fd_timeout); diff --git a/trunk/drivers/tty/vt/.gitignore b/trunk/drivers/char/.gitignore similarity index 100% rename from trunk/drivers/tty/vt/.gitignore rename to trunk/drivers/char/.gitignore diff --git a/trunk/drivers/char/Makefile b/trunk/drivers/char/Makefile index ba53ec956c95..3a9c01416839 100644 --- a/trunk/drivers/char/Makefile +++ b/trunk/drivers/char/Makefile @@ -2,10 +2,24 @@ # Makefile for the kernel character device drivers. # -obj-y += mem.o random.o +# +# This file contains the font map for the default (hardware) font +# +FONTMAPFILE = cp437.uni + +obj-y += mem.o random.o tty_io.o n_tty.o tty_ioctl.o tty_ldisc.o tty_buffer.o tty_port.o + +obj-y += tty_mutex.o +obj-$(CONFIG_LEGACY_PTYS) += pty.o +obj-$(CONFIG_UNIX98_PTYS) += pty.o obj-$(CONFIG_TTY_PRINTK) += ttyprintk.o obj-y += misc.o +obj-$(CONFIG_VT) += vt_ioctl.o vc_screen.o selection.o keyboard.o obj-$(CONFIG_BFIN_JTAG_COMM) += bfin_jtag_comm.o +obj-$(CONFIG_CONSOLE_TRANSLATIONS) += consolemap.o consolemap_deftbl.o +obj-$(CONFIG_HW_CONSOLE) += vt.o defkeymap.o +obj-$(CONFIG_AUDIT) += tty_audit.o +obj-$(CONFIG_MAGIC_SYSRQ) += sysrq.o obj-$(CONFIG_MVME147_SCC) += generic_serial.o vme_scc.o obj-$(CONFIG_MVME162_SCC) += generic_serial.o vme_scc.o obj-$(CONFIG_BVME6000_SCC) += generic_serial.o vme_scc.o @@ -27,6 +41,8 @@ obj-$(CONFIG_ISI) += isicom.o obj-$(CONFIG_SYNCLINK) += synclink.o obj-$(CONFIG_SYNCLINKMP) += synclinkmp.o obj-$(CONFIG_SYNCLINK_GT) += synclink_gt.o +obj-$(CONFIG_N_HDLC) += n_hdlc.o +obj-$(CONFIG_N_GSM) += n_gsm.o obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o obj-$(CONFIG_SX) += sx.o generic_serial.o obj-$(CONFIG_RIO) += rio/ generic_serial.o @@ -58,6 +74,7 @@ obj-$(CONFIG_PRINTER) += lp.o obj-$(CONFIG_APM_EMULATION) += apm-emulation.o obj-$(CONFIG_DTLK) += dtlk.o +obj-$(CONFIG_R3964) += n_r3964.o obj-$(CONFIG_APPLICOM) += applicom.o obj-$(CONFIG_SONYPI) += sonypi.o obj-$(CONFIG_RTC) += rtc.o @@ -98,3 +115,28 @@ obj-$(CONFIG_RAMOOPS) += ramoops.o obj-$(CONFIG_JS_RTC) += js-rtc.o js-rtc-y = rtc.o + +# Files generated that shall be removed upon make clean +clean-files := consolemap_deftbl.c defkeymap.c + +quiet_cmd_conmk = CONMK $@ + cmd_conmk = scripts/conmakehash $< > $@ + +$(obj)/consolemap_deftbl.c: $(src)/$(FONTMAPFILE) + $(call cmd,conmk) + +$(obj)/defkeymap.o: $(obj)/defkeymap.c + +# Uncomment if you're changing the keymap and have an appropriate +# loadkeys version for the map. By default, we'll use the shipped +# versions. +# GENERATE_KEYMAP := 1 + +ifdef GENERATE_KEYMAP + +$(obj)/defkeymap.c: $(obj)/%.c: $(src)/%.map + loadkeys --mktable $< > $@.tmp + sed -e 's/^static *//' $@.tmp > $@ + rm $@.tmp + +endif diff --git a/trunk/drivers/tty/vt/consolemap.c b/trunk/drivers/char/consolemap.c similarity index 100% rename from trunk/drivers/tty/vt/consolemap.c rename to trunk/drivers/char/consolemap.c diff --git a/trunk/drivers/tty/vt/cp437.uni b/trunk/drivers/char/cp437.uni similarity index 100% rename from trunk/drivers/tty/vt/cp437.uni rename to trunk/drivers/char/cp437.uni diff --git a/trunk/drivers/tty/vt/defkeymap.c_shipped b/trunk/drivers/char/defkeymap.c_shipped similarity index 100% rename from trunk/drivers/tty/vt/defkeymap.c_shipped rename to trunk/drivers/char/defkeymap.c_shipped diff --git a/trunk/drivers/tty/vt/defkeymap.map b/trunk/drivers/char/defkeymap.map similarity index 100% rename from trunk/drivers/tty/vt/defkeymap.map rename to trunk/drivers/char/defkeymap.map diff --git a/trunk/drivers/tty/vt/keyboard.c b/trunk/drivers/char/keyboard.c similarity index 100% rename from trunk/drivers/tty/vt/keyboard.c rename to trunk/drivers/char/keyboard.c diff --git a/trunk/drivers/tty/n_gsm.c b/trunk/drivers/char/n_gsm.c similarity index 100% rename from trunk/drivers/tty/n_gsm.c rename to trunk/drivers/char/n_gsm.c diff --git a/trunk/drivers/tty/n_hdlc.c b/trunk/drivers/char/n_hdlc.c similarity index 100% rename from trunk/drivers/tty/n_hdlc.c rename to trunk/drivers/char/n_hdlc.c diff --git a/trunk/drivers/tty/n_r3964.c b/trunk/drivers/char/n_r3964.c similarity index 100% rename from trunk/drivers/tty/n_r3964.c rename to trunk/drivers/char/n_r3964.c diff --git a/trunk/drivers/tty/n_tty.c b/trunk/drivers/char/n_tty.c similarity index 100% rename from trunk/drivers/tty/n_tty.c rename to trunk/drivers/char/n_tty.c diff --git a/trunk/drivers/tty/pty.c b/trunk/drivers/char/pty.c similarity index 100% rename from trunk/drivers/tty/pty.c rename to trunk/drivers/char/pty.c diff --git a/trunk/drivers/tty/vt/selection.c b/trunk/drivers/char/selection.c similarity index 100% rename from trunk/drivers/tty/vt/selection.c rename to trunk/drivers/char/selection.c diff --git a/trunk/drivers/tty/sysrq.c b/trunk/drivers/char/sysrq.c similarity index 100% rename from trunk/drivers/tty/sysrq.c rename to trunk/drivers/char/sysrq.c diff --git a/trunk/drivers/tty/tty_audit.c b/trunk/drivers/char/tty_audit.c similarity index 100% rename from trunk/drivers/tty/tty_audit.c rename to trunk/drivers/char/tty_audit.c diff --git a/trunk/drivers/tty/tty_buffer.c b/trunk/drivers/char/tty_buffer.c similarity index 100% rename from trunk/drivers/tty/tty_buffer.c rename to trunk/drivers/char/tty_buffer.c diff --git a/trunk/drivers/tty/tty_io.c b/trunk/drivers/char/tty_io.c similarity index 100% rename from trunk/drivers/tty/tty_io.c rename to trunk/drivers/char/tty_io.c diff --git a/trunk/drivers/tty/tty_ioctl.c b/trunk/drivers/char/tty_ioctl.c similarity index 100% rename from trunk/drivers/tty/tty_ioctl.c rename to trunk/drivers/char/tty_ioctl.c diff --git a/trunk/drivers/tty/tty_ldisc.c b/trunk/drivers/char/tty_ldisc.c similarity index 100% rename from trunk/drivers/tty/tty_ldisc.c rename to trunk/drivers/char/tty_ldisc.c diff --git a/trunk/drivers/tty/tty_mutex.c b/trunk/drivers/char/tty_mutex.c similarity index 100% rename from trunk/drivers/tty/tty_mutex.c rename to trunk/drivers/char/tty_mutex.c diff --git a/trunk/drivers/tty/tty_port.c b/trunk/drivers/char/tty_port.c similarity index 100% rename from trunk/drivers/tty/tty_port.c rename to trunk/drivers/char/tty_port.c diff --git a/trunk/drivers/tty/vt/vc_screen.c b/trunk/drivers/char/vc_screen.c similarity index 100% rename from trunk/drivers/tty/vt/vc_screen.c rename to trunk/drivers/char/vc_screen.c diff --git a/trunk/drivers/tty/vt/vt.c b/trunk/drivers/char/vt.c similarity index 100% rename from trunk/drivers/tty/vt/vt.c rename to trunk/drivers/char/vt.c diff --git a/trunk/drivers/tty/vt/vt_ioctl.c b/trunk/drivers/char/vt_ioctl.c similarity index 100% rename from trunk/drivers/tty/vt/vt_ioctl.c rename to trunk/drivers/char/vt_ioctl.c diff --git a/trunk/drivers/clocksource/sh_cmt.c b/trunk/drivers/clocksource/sh_cmt.c index d68d3aa1814b..a44611652282 100644 --- a/trunk/drivers/clocksource/sh_cmt.c +++ b/trunk/drivers/clocksource/sh_cmt.c @@ -616,9 +616,13 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) /* get hold of clock */ p->clk = clk_get(&p->pdev->dev, "cmt_fck"); if (IS_ERR(p->clk)) { - dev_err(&p->pdev->dev, "cannot get clock\n"); - ret = PTR_ERR(p->clk); - goto err1; + dev_warn(&p->pdev->dev, "using deprecated clock lookup\n"); + p->clk = clk_get(&p->pdev->dev, cfg->clk); + if (IS_ERR(p->clk)) { + dev_err(&p->pdev->dev, "cannot get clock\n"); + ret = PTR_ERR(p->clk); + goto err1; + } } if (resource_size(res) == 6) { diff --git a/trunk/drivers/clocksource/sh_mtu2.c b/trunk/drivers/clocksource/sh_mtu2.c index 40630cb98237..ef7a5be8a09f 100644 --- a/trunk/drivers/clocksource/sh_mtu2.c +++ b/trunk/drivers/clocksource/sh_mtu2.c @@ -287,9 +287,13 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev) /* get hold of clock */ p->clk = clk_get(&p->pdev->dev, "mtu2_fck"); if (IS_ERR(p->clk)) { - dev_err(&p->pdev->dev, "cannot get clock\n"); - ret = PTR_ERR(p->clk); - goto err1; + dev_warn(&p->pdev->dev, "using deprecated clock lookup\n"); + p->clk = clk_get(&p->pdev->dev, cfg->clk); + if (IS_ERR(p->clk)) { + dev_err(&p->pdev->dev, "cannot get clock\n"); + ret = PTR_ERR(p->clk); + goto err1; + } } return sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev), diff --git a/trunk/drivers/clocksource/sh_tmu.c b/trunk/drivers/clocksource/sh_tmu.c index 36aba9923060..de715901b82a 100644 --- a/trunk/drivers/clocksource/sh_tmu.c +++ b/trunk/drivers/clocksource/sh_tmu.c @@ -393,9 +393,13 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev) /* get hold of clock */ p->clk = clk_get(&p->pdev->dev, "tmu_fck"); if (IS_ERR(p->clk)) { - dev_err(&p->pdev->dev, "cannot get clock\n"); - ret = PTR_ERR(p->clk); - goto err1; + dev_warn(&p->pdev->dev, "using deprecated clock lookup\n"); + p->clk = clk_get(&p->pdev->dev, cfg->clk); + if (IS_ERR(p->clk)) { + dev_err(&p->pdev->dev, "cannot get clock\n"); + ret = PTR_ERR(p->clk); + goto err1; + } } return sh_tmu_register(p, (char *)dev_name(&p->pdev->dev), diff --git a/trunk/drivers/rtc/rtc-ds1302.c b/trunk/drivers/rtc/rtc-ds1302.c index f0d638922644..359d1e04626c 100644 --- a/trunk/drivers/rtc/rtc-ds1302.c +++ b/trunk/drivers/rtc/rtc-ds1302.c @@ -35,7 +35,7 @@ #ifdef CONFIG_SH_SECUREEDGE5410 #include -#include +#include #define RTC_RESET 0x1000 #define RTC_IODATA 0x0800 diff --git a/trunk/drivers/sh/clk/core.c b/trunk/drivers/sh/clk/core.c index 09615b51d591..fd0d1b98901c 100644 --- a/trunk/drivers/sh/clk/core.c +++ b/trunk/drivers/sh/clk/core.c @@ -90,8 +90,8 @@ struct clk_rate_round_data { static long clk_rate_round_helper(struct clk_rate_round_data *rounder) { unsigned long rate_error, rate_error_prev = ~0UL; + unsigned long rate_best_fit = rounder->rate; unsigned long highest, lowest, freq; - long rate_best_fit = -ENOENT; int i; highest = 0; @@ -146,7 +146,7 @@ long clk_rate_table_round(struct clk *clk, }; if (clk->nr_freqs < 1) - return -ENOSYS; + return 0; return clk_rate_round_helper(&table_round); } @@ -541,98 +541,6 @@ long clk_round_rate(struct clk *clk, unsigned long rate) } EXPORT_SYMBOL_GPL(clk_round_rate); -long clk_round_parent(struct clk *clk, unsigned long target, - unsigned long *best_freq, unsigned long *parent_freq, - unsigned int div_min, unsigned int div_max) -{ - struct cpufreq_frequency_table *freq, *best = NULL; - unsigned long error = ULONG_MAX, freq_high, freq_low, div; - struct clk *parent = clk_get_parent(clk); - - if (!parent) { - *parent_freq = 0; - *best_freq = clk_round_rate(clk, target); - return abs(target - *best_freq); - } - - for (freq = parent->freq_table; freq->frequency != CPUFREQ_TABLE_END; - freq++) { - if (freq->frequency == CPUFREQ_ENTRY_INVALID) - continue; - - if (unlikely(freq->frequency / target <= div_min - 1)) { - unsigned long freq_max; - - freq_max = (freq->frequency + div_min / 2) / div_min; - if (error > target - freq_max) { - error = target - freq_max; - best = freq; - if (best_freq) - *best_freq = freq_max; - } - - pr_debug("too low freq %lu, error %lu\n", freq->frequency, - target - freq_max); - - if (!error) - break; - - continue; - } - - if (unlikely(freq->frequency / target >= div_max)) { - unsigned long freq_min; - - freq_min = (freq->frequency + div_max / 2) / div_max; - if (error > freq_min - target) { - error = freq_min - target; - best = freq; - if (best_freq) - *best_freq = freq_min; - } - - pr_debug("too high freq %lu, error %lu\n", freq->frequency, - freq_min - target); - - if (!error) - break; - - continue; - } - - div = freq->frequency / target; - freq_high = freq->frequency / div; - freq_low = freq->frequency / (div + 1); - - if (freq_high - target < error) { - error = freq_high - target; - best = freq; - if (best_freq) - *best_freq = freq_high; - } - - if (target - freq_low < error) { - error = target - freq_low; - best = freq; - if (best_freq) - *best_freq = freq_low; - } - - pr_debug("%u / %lu = %lu, / %lu = %lu, best %lu, parent %u\n", - freq->frequency, div, freq_high, div + 1, freq_low, - *best_freq, best->frequency); - - if (!error) - break; - } - - if (parent_freq) - *parent_freq = best->frequency; - - return error; -} -EXPORT_SYMBOL_GPL(clk_round_parent); - #ifdef CONFIG_PM static int clks_sysdev_suspend(struct sys_device *dev, pm_message_t state) { diff --git a/trunk/drivers/sh/intc/core.c b/trunk/drivers/sh/intc/core.c index e5e9e6735f7d..873a99ff8f64 100644 --- a/trunk/drivers/sh/intc/core.c +++ b/trunk/drivers/sh/intc/core.c @@ -79,7 +79,7 @@ static void __init intc_register_irq(struct intc_desc *desc, * Register the IRQ position with the global IRQ map, then insert * it in to the radix tree. */ - irq_reserve_irq(irq); + irq_reserve_irqs(irq, 1); raw_spin_lock_irqsave(&intc_big_lock, flags); radix_tree_insert(&d->tree, enum_id, intc_irq_xlate_get(irq)); diff --git a/trunk/drivers/sh/intc/dynamic.c b/trunk/drivers/sh/intc/dynamic.c index a3677c9dfe36..4187cce20ffd 100644 --- a/trunk/drivers/sh/intc/dynamic.c +++ b/trunk/drivers/sh/intc/dynamic.c @@ -60,5 +60,5 @@ void reserve_intc_vectors(struct intc_vect *vectors, unsigned int nr_vecs) int i; for (i = 0; i < nr_vecs; i++) - irq_reserve_irq(evt2irq(vectors[i].vect)); + irq_reserve_irqs(evt2irq(vectors[i].vect), 1); } diff --git a/trunk/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c b/trunk/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c index ee8b47746a15..22c6c6659f5b 100644 --- a/trunk/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c +++ b/trunk/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c @@ -285,9 +285,9 @@ A_STATUS SetupHIFScatterSupport(HIF_DEVICE *device, HIF_DEVICE_SCATTER_SUPPORT_I do { /* check if host supports scatter requests and it meets our requirements */ - if (device->func->card->host->max_segs < MAX_SCATTER_ENTRIES_PER_REQ) { + if (device->func->card->host->max_hw_segs < MAX_SCATTER_ENTRIES_PER_REQ) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HIF-SCATTER : host only supports scatter of : %d entries, need: %d \n", - device->func->card->host->max_segs, MAX_SCATTER_ENTRIES_PER_REQ)); + device->func->card->host->max_hw_segs, MAX_SCATTER_ENTRIES_PER_REQ)); status = A_ENOTSUP; break; } diff --git a/trunk/drivers/staging/ath6kl/os/linux/include/athendpack_linux.h b/trunk/drivers/staging/ath6kl/os/linux/include/athendpack_linux.h new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/trunk/drivers/staging/ath6kl/os/linux/include/athstartpack_linux.h b/trunk/drivers/staging/ath6kl/os/linux/include/athstartpack_linux.h new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/trunk/drivers/staging/solo6x10/solo6010-v4l2-enc.c b/trunk/drivers/staging/solo6x10/solo6010-v4l2-enc.c index 097e82bc7a63..bbf3d9c4abb0 100644 --- a/trunk/drivers/staging/solo6x10/solo6010-v4l2-enc.c +++ b/trunk/drivers/staging/solo6x10/solo6010-v4l2-enc.c @@ -766,7 +766,7 @@ static int solo_enc_open(struct file *file) &solo_enc->lock, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_INTERLACED, - sizeof(struct videobuf_buffer), fh, NULL); + sizeof(struct videobuf_buffer), fh); spin_unlock(&solo_enc->lock); diff --git a/trunk/drivers/staging/solo6x10/solo6010-v4l2.c b/trunk/drivers/staging/solo6x10/solo6010-v4l2.c index 6ffd21de837d..9731fa02b5e8 100644 --- a/trunk/drivers/staging/solo6x10/solo6010-v4l2.c +++ b/trunk/drivers/staging/solo6x10/solo6010-v4l2.c @@ -437,7 +437,7 @@ static int solo_v4l2_open(struct file *file) &solo_dev->pdev->dev, &fh->slock, V4L2_BUF_TYPE_VIDEO_CAPTURE, SOLO_DISP_PIX_FIELD, - sizeof(struct videobuf_buffer), fh, NULL); + sizeof(struct videobuf_buffer), fh); return 0; } diff --git a/trunk/drivers/tty/Makefile b/trunk/drivers/tty/Makefile deleted file mode 100644 index c43ef48b1a0f..000000000000 --- a/trunk/drivers/tty/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -obj-y += tty_io.o n_tty.o tty_ioctl.o tty_ldisc.o \ - tty_buffer.o tty_port.o tty_mutex.o -obj-$(CONFIG_LEGACY_PTYS) += pty.o -obj-$(CONFIG_UNIX98_PTYS) += pty.o -obj-$(CONFIG_AUDIT) += tty_audit.o -obj-$(CONFIG_MAGIC_SYSRQ) += sysrq.o -obj-$(CONFIG_N_HDLC) += n_hdlc.o -obj-$(CONFIG_N_GSM) += n_gsm.o -obj-$(CONFIG_R3964) += n_r3964.o - -obj-y += vt/ diff --git a/trunk/drivers/tty/vt/Makefile b/trunk/drivers/tty/vt/Makefile deleted file mode 100644 index 14a51c9960df..000000000000 --- a/trunk/drivers/tty/vt/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -# -# This file contains the font map for the default (hardware) font -# -FONTMAPFILE = cp437.uni - -obj-$(CONFIG_VT) += vt_ioctl.o vc_screen.o \ - selection.o keyboard.o -obj-$(CONFIG_CONSOLE_TRANSLATIONS) += consolemap.o consolemap_deftbl.o -obj-$(CONFIG_HW_CONSOLE) += vt.o defkeymap.o - -# Files generated that shall be removed upon make clean -clean-files := consolemap_deftbl.c defkeymap.c - -quiet_cmd_conmk = CONMK $@ - cmd_conmk = scripts/conmakehash $< > $@ - -$(obj)/consolemap_deftbl.c: $(src)/$(FONTMAPFILE) - $(call cmd,conmk) - -$(obj)/defkeymap.o: $(obj)/defkeymap.c - -# Uncomment if you're changing the keymap and have an appropriate -# loadkeys version for the map. By default, we'll use the shipped -# versions. -# GENERATE_KEYMAP := 1 - -ifdef GENERATE_KEYMAP - -$(obj)/defkeymap.c: $(obj)/%.c: $(src)/%.map - loadkeys --mktable $< > $@.tmp - sed -e 's/^static *//' $@.tmp > $@ - rm $@.tmp - -endif diff --git a/trunk/fs/cifs/ioctl.c b/trunk/fs/cifs/ioctl.c index 2fa22f20cfc5..0c98672d0122 100644 --- a/trunk/fs/cifs/ioctl.c +++ b/trunk/fs/cifs/ioctl.c @@ -38,10 +38,10 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) struct cifs_sb_info *cifs_sb; #ifdef CONFIG_CIFS_POSIX struct cifsFileInfo *pSMBFile = filep->private_data; - struct cifsTconInfo *tcon = tlink_tcon(pSMBFile->tlink); + struct cifsTconInfo *tcon; __u64 ExtAttrBits = 0; __u64 ExtAttrMask = 0; - __u64 caps = le64_to_cpu(tcon->fsUnixInfo.Capability); + __u64 caps; #endif /* CONFIG_CIFS_POSIX */ xid = GetXid(); @@ -62,6 +62,10 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) break; #ifdef CONFIG_CIFS_POSIX case FS_IOC_GETFLAGS: + if (pSMBFile == NULL) + break; + tcon = tlink_tcon(pSMBFile->tlink); + caps = le64_to_cpu(tcon->fsUnixInfo.Capability); if (CIFS_UNIX_EXTATTR_CAP & caps) { rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid, &ExtAttrBits, &ExtAttrMask); @@ -73,6 +77,10 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) break; case FS_IOC_SETFLAGS: + if (pSMBFile == NULL) + break; + tcon = tlink_tcon(pSMBFile->tlink); + caps = le64_to_cpu(tcon->fsUnixInfo.Capability); if (CIFS_UNIX_EXTATTR_CAP & caps) { if (get_user(ExtAttrBits, (int __user *)arg)) { rc = -EFAULT; diff --git a/trunk/fs/ext4/ext4.h b/trunk/fs/ext4/ext4.h index 6a5edea2d70b..8b5dd6369f82 100644 --- a/trunk/fs/ext4/ext4.h +++ b/trunk/fs/ext4/ext4.h @@ -177,7 +177,7 @@ struct mpage_da_data { struct ext4_io_page { struct page *p_page; - atomic_t p_count; + int p_count; }; #define MAX_IO_PAGES 128 @@ -858,7 +858,6 @@ struct ext4_inode_info { spinlock_t i_completed_io_lock; /* current io_end structure for async DIO write*/ ext4_io_end_t *cur_aio_dio; - atomic_t i_ioend_count; /* Number of outstanding io_end structs */ /* * Transactions that contain inode's metadata needed to complete @@ -2061,7 +2060,6 @@ extern int ext4_move_extents(struct file *o_filp, struct file *d_filp, /* page-io.c */ extern int __init ext4_init_pageio(void); extern void ext4_exit_pageio(void); -extern void ext4_ioend_wait(struct inode *); extern void ext4_free_io_end(ext4_io_end_t *io); extern ext4_io_end_t *ext4_init_io_end(struct inode *inode, gfp_t flags); extern int ext4_end_io_nolock(ext4_io_end_t *io); diff --git a/trunk/fs/ext4/inode.c b/trunk/fs/ext4/inode.c index bdbe69902207..4d78342f3bf0 100644 --- a/trunk/fs/ext4/inode.c +++ b/trunk/fs/ext4/inode.c @@ -53,7 +53,6 @@ static inline int ext4_begin_ordered_truncate(struct inode *inode, loff_t new_size) { - trace_ext4_begin_ordered_truncate(inode, new_size); return jbd2_journal_begin_ordered_truncate( EXT4_SB(inode->i_sb)->s_journal, &EXT4_I(inode)->jinode, @@ -179,7 +178,6 @@ void ext4_evict_inode(struct inode *inode) handle_t *handle; int err; - trace_ext4_evict_inode(inode); if (inode->i_nlink) { truncate_inode_pages(&inode->i_data, 0); goto no_delete; @@ -5649,7 +5647,6 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode) int err, ret; might_sleep(); - trace_ext4_mark_inode_dirty(inode, _RET_IP_); err = ext4_reserve_inode_write(handle, inode, &iloc); if (ext4_handle_valid(handle) && EXT4_I(inode)->i_extra_isize < sbi->s_want_extra_isize && diff --git a/trunk/fs/ext4/mballoc.c b/trunk/fs/ext4/mballoc.c index 5b4d4e3a4d58..c58eba34724a 100644 --- a/trunk/fs/ext4/mballoc.c +++ b/trunk/fs/ext4/mballoc.c @@ -4640,6 +4640,8 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode, * with group lock held. generate_buddy look at * them with group lock_held */ + if (test_opt(sb, DISCARD)) + ext4_issue_discard(sb, block_group, bit, count); ext4_lock_group(sb, block_group); mb_clear_bits(bitmap_bh->b_data, bit, count); mb_free_blocks(inode, &e4b, bit, count); diff --git a/trunk/fs/ext4/page-io.c b/trunk/fs/ext4/page-io.c index 7f5451cd1d38..46a7d6a9d976 100644 --- a/trunk/fs/ext4/page-io.c +++ b/trunk/fs/ext4/page-io.c @@ -32,14 +32,8 @@ static struct kmem_cache *io_page_cachep, *io_end_cachep; -#define WQ_HASH_SZ 37 -#define to_ioend_wq(v) (&ioend_wq[((unsigned long)v) % WQ_HASH_SZ]) -static wait_queue_head_t ioend_wq[WQ_HASH_SZ]; - int __init ext4_init_pageio(void) { - int i; - io_page_cachep = KMEM_CACHE(ext4_io_page, SLAB_RECLAIM_ACCOUNT); if (io_page_cachep == NULL) return -ENOMEM; @@ -48,8 +42,6 @@ int __init ext4_init_pageio(void) kmem_cache_destroy(io_page_cachep); return -ENOMEM; } - for (i = 0; i < WQ_HASH_SZ; i++) - init_waitqueue_head(&ioend_wq[i]); return 0; } @@ -60,37 +52,24 @@ void ext4_exit_pageio(void) kmem_cache_destroy(io_page_cachep); } -void ext4_ioend_wait(struct inode *inode) -{ - wait_queue_head_t *wq = to_ioend_wq(inode); - - wait_event(*wq, (atomic_read(&EXT4_I(inode)->i_ioend_count) == 0)); -} - -static void put_io_page(struct ext4_io_page *io_page) -{ - if (atomic_dec_and_test(&io_page->p_count)) { - end_page_writeback(io_page->p_page); - put_page(io_page->p_page); - kmem_cache_free(io_page_cachep, io_page); - } -} - void ext4_free_io_end(ext4_io_end_t *io) { int i; - wait_queue_head_t *wq; BUG_ON(!io); if (io->page) put_page(io->page); - for (i = 0; i < io->num_io_pages; i++) - put_io_page(io->pages[i]); + for (i = 0; i < io->num_io_pages; i++) { + if (--io->pages[i]->p_count == 0) { + struct page *page = io->pages[i]->p_page; + + end_page_writeback(page); + put_page(page); + kmem_cache_free(io_page_cachep, io->pages[i]); + } + } io->num_io_pages = 0; - wq = to_ioend_wq(io->inode); - if (atomic_dec_and_test(&EXT4_I(io->inode)->i_ioend_count) && - waitqueue_active(wq)) - wake_up_all(wq); + iput(io->inode); kmem_cache_free(io_end_cachep, io); } @@ -163,8 +142,8 @@ ext4_io_end_t *ext4_init_io_end(struct inode *inode, gfp_t flags) io = kmem_cache_alloc(io_end_cachep, flags); if (io) { memset(io, 0, sizeof(*io)); - atomic_inc(&EXT4_I(inode)->i_ioend_count); - io->inode = inode; + io->inode = igrab(inode); + BUG_ON(!io->inode); INIT_WORK(&io->work, ext4_end_io_work); INIT_LIST_HEAD(&io->list); } @@ -192,15 +171,35 @@ static void ext4_end_bio(struct bio *bio, int error) struct workqueue_struct *wq; struct inode *inode; unsigned long flags; + ext4_fsblk_t err_block; int i; BUG_ON(!io_end); + inode = io_end->inode; bio->bi_private = NULL; bio->bi_end_io = NULL; if (test_bit(BIO_UPTODATE, &bio->bi_flags)) error = 0; + err_block = bio->bi_sector >> (inode->i_blkbits - 9); bio_put(bio); + if (!(inode->i_sb->s_flags & MS_ACTIVE)) { + pr_err("sb umounted, discard end_io request for inode %lu\n", + io_end->inode->i_ino); + ext4_free_io_end(io_end); + return; + } + + if (error) { + io_end->flag |= EXT4_IO_END_ERROR; + ext4_warning(inode->i_sb, "I/O error writing to inode %lu " + "(offset %llu size %ld starting block %llu)", + inode->i_ino, + (unsigned long long) io_end->offset, + (long) io_end->size, + (unsigned long long) err_block); + } + for (i = 0; i < io_end->num_io_pages; i++) { struct page *page = io_end->pages[i]->p_page; struct buffer_head *bh, *head; @@ -237,7 +236,13 @@ static void ext4_end_bio(struct bio *bio, int error) } while (bh != head); } - put_io_page(io_end->pages[i]); + if (--io_end->pages[i]->p_count == 0) { + struct page *page = io_end->pages[i]->p_page; + + end_page_writeback(page); + put_page(page); + kmem_cache_free(io_page_cachep, io_end->pages[i]); + } /* * If this is a partial write which happened to make @@ -249,19 +254,8 @@ static void ext4_end_bio(struct bio *bio, int error) if (!partial_write) SetPageUptodate(page); } - io_end->num_io_pages = 0; - inode = io_end->inode; - if (error) { - io_end->flag |= EXT4_IO_END_ERROR; - ext4_warning(inode->i_sb, "I/O error writing to inode %lu " - "(offset %llu size %ld starting block %llu)", - inode->i_ino, - (unsigned long long) io_end->offset, - (long) io_end->size, - (unsigned long long) - bio->bi_sector >> (inode->i_blkbits - 9)); - } + io_end->num_io_pages = 0; /* Add the io_end to per-inode completed io list*/ spin_lock_irqsave(&EXT4_I(inode)->i_completed_io_lock, flags); @@ -311,6 +305,7 @@ static int io_submit_init(struct ext4_io_submit *io, bio->bi_private = io->io_end = io_end; bio->bi_end_io = ext4_end_bio; + io_end->inode = inode; io_end->offset = (page->index << PAGE_CACHE_SHIFT) + bh_offset(bh); io->io_bio = bio; @@ -365,7 +360,7 @@ static int io_submit_add_bh(struct ext4_io_submit *io, if ((io_end->num_io_pages == 0) || (io_end->pages[io_end->num_io_pages-1] != io_page)) { io_end->pages[io_end->num_io_pages++] = io_page; - atomic_inc(&io_page->p_count); + io_page->p_count++; } return 0; } @@ -394,7 +389,7 @@ int ext4_bio_write_page(struct ext4_io_submit *io, return -ENOMEM; } io_page->p_page = page; - atomic_set(&io_page->p_count, 1); + io_page->p_count = 0; get_page(page); for (bh = head = page_buffers(page), block_start = 0; @@ -426,6 +421,10 @@ int ext4_bio_write_page(struct ext4_io_submit *io, * PageWriteback bit from the page to prevent the system from * wedging later on. */ - put_io_page(io_page); + if (io_page->p_count == 0) { + put_page(page); + end_page_writeback(page); + kmem_cache_free(io_page_cachep, io_page); + } return ret; } diff --git a/trunk/fs/ext4/super.c b/trunk/fs/ext4/super.c index 61182fe6254e..40131b777af6 100644 --- a/trunk/fs/ext4/super.c +++ b/trunk/fs/ext4/super.c @@ -828,22 +828,12 @@ static struct inode *ext4_alloc_inode(struct super_block *sb) ei->cur_aio_dio = NULL; ei->i_sync_tid = 0; ei->i_datasync_tid = 0; - atomic_set(&ei->i_ioend_count, 0); return &ei->vfs_inode; } -static int ext4_drop_inode(struct inode *inode) -{ - int drop = generic_drop_inode(inode); - - trace_ext4_drop_inode(inode, drop); - return drop; -} - static void ext4_destroy_inode(struct inode *inode) { - ext4_ioend_wait(inode); if (!list_empty(&(EXT4_I(inode)->i_orphan))) { ext4_msg(inode->i_sb, KERN_ERR, "Inode %lu (%p): orphan list check failed!", @@ -1183,7 +1173,6 @@ static const struct super_operations ext4_sops = { .destroy_inode = ext4_destroy_inode, .write_inode = ext4_write_inode, .dirty_inode = ext4_dirty_inode, - .drop_inode = ext4_drop_inode, .evict_inode = ext4_evict_inode, .put_super = ext4_put_super, .sync_fs = ext4_sync_fs, @@ -1205,7 +1194,6 @@ static const struct super_operations ext4_nojournal_sops = { .destroy_inode = ext4_destroy_inode, .write_inode = ext4_write_inode, .dirty_inode = ext4_dirty_inode, - .drop_inode = ext4_drop_inode, .evict_inode = ext4_evict_inode, .write_super = ext4_write_super, .put_super = ext4_put_super, @@ -2711,6 +2699,7 @@ static int ext4_lazyinit_thread(void *arg) struct ext4_li_request *elr; unsigned long next_wakeup; DEFINE_WAIT(wait); + int ret; BUG_ON(NULL == eli); @@ -2734,12 +2723,13 @@ static int ext4_lazyinit_thread(void *arg) elr = list_entry(pos, struct ext4_li_request, lr_request); - if (time_after_eq(jiffies, elr->lr_next_sched)) { - if (ext4_run_li_request(elr) != 0) { - /* error, remove the lazy_init job */ - ext4_remove_li_request(elr); - continue; - } + if (time_after_eq(jiffies, elr->lr_next_sched)) + ret = ext4_run_li_request(elr); + + if (ret) { + ret = 0; + ext4_remove_li_request(elr); + continue; } if (time_before(elr->lr_next_sched, next_wakeup)) @@ -2750,8 +2740,7 @@ static int ext4_lazyinit_thread(void *arg) if (freezing(current)) refrigerator(); - if ((time_after_eq(jiffies, next_wakeup)) || - (MAX_JIFFY_OFFSET == next_wakeup)) { + if (time_after_eq(jiffies, next_wakeup)) { cond_resched(); continue; } @@ -3359,24 +3348,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) get_random_bytes(&sbi->s_next_generation, sizeof(u32)); spin_lock_init(&sbi->s_next_gen_lock); - err = percpu_counter_init(&sbi->s_freeblocks_counter, - ext4_count_free_blocks(sb)); - if (!err) { - err = percpu_counter_init(&sbi->s_freeinodes_counter, - ext4_count_free_inodes(sb)); - } - if (!err) { - err = percpu_counter_init(&sbi->s_dirs_counter, - ext4_count_dirs(sb)); - } - if (!err) { - err = percpu_counter_init(&sbi->s_dirtyblocks_counter, 0); - } - if (err) { - ext4_msg(sb, KERN_ERR, "insufficient memory"); - goto failed_mount3; - } - sbi->s_stripe = ext4_get_stripe_size(sbi); sbi->s_max_writeback_mb_bump = 128; @@ -3475,19 +3446,22 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) } set_task_ioprio(sbi->s_journal->j_task, journal_ioprio); - /* - * The journal may have updated the bg summary counts, so we - * need to update the global counters. - */ - percpu_counter_set(&sbi->s_freeblocks_counter, - ext4_count_free_blocks(sb)); - percpu_counter_set(&sbi->s_freeinodes_counter, - ext4_count_free_inodes(sb)); - percpu_counter_set(&sbi->s_dirs_counter, - ext4_count_dirs(sb)); - percpu_counter_set(&sbi->s_dirtyblocks_counter, 0); - no_journal: + err = percpu_counter_init(&sbi->s_freeblocks_counter, + ext4_count_free_blocks(sb)); + if (!err) + err = percpu_counter_init(&sbi->s_freeinodes_counter, + ext4_count_free_inodes(sb)); + if (!err) + err = percpu_counter_init(&sbi->s_dirs_counter, + ext4_count_dirs(sb)); + if (!err) + err = percpu_counter_init(&sbi->s_dirtyblocks_counter, 0); + if (err) { + ext4_msg(sb, KERN_ERR, "insufficient memory"); + goto failed_mount_wq; + } + EXT4_SB(sb)->dio_unwritten_wq = create_workqueue("ext4-dio-unwritten"); if (!EXT4_SB(sb)->dio_unwritten_wq) { printk(KERN_ERR "EXT4-fs: failed to create DIO workqueue\n"); @@ -3637,6 +3611,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) jbd2_journal_destroy(sbi->s_journal); sbi->s_journal = NULL; } + percpu_counter_destroy(&sbi->s_freeblocks_counter); + percpu_counter_destroy(&sbi->s_freeinodes_counter); + percpu_counter_destroy(&sbi->s_dirs_counter); + percpu_counter_destroy(&sbi->s_dirtyblocks_counter); failed_mount3: if (sbi->s_flex_groups) { if (is_vmalloc_addr(sbi->s_flex_groups)) @@ -3644,10 +3622,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) else kfree(sbi->s_flex_groups); } - percpu_counter_destroy(&sbi->s_freeblocks_counter); - percpu_counter_destroy(&sbi->s_freeinodes_counter); - percpu_counter_destroy(&sbi->s_dirs_counter); - percpu_counter_destroy(&sbi->s_dirtyblocks_counter); failed_mount2: for (i = 0; i < db_count; i++) brelse(sbi->s_group_desc[i]); @@ -3975,11 +3949,13 @@ static int ext4_commit_super(struct super_block *sb, int sync) else es->s_kbytes_written = cpu_to_le64(EXT4_SB(sb)->s_kbytes_written); - ext4_free_blocks_count_set(es, percpu_counter_sum_positive( - &EXT4_SB(sb)->s_freeblocks_counter)); - es->s_free_inodes_count = - cpu_to_le32(percpu_counter_sum_positive( - &EXT4_SB(sb)->s_freeinodes_counter)); + if (percpu_counter_initialized(&EXT4_SB(sb)->s_freeblocks_counter)) + ext4_free_blocks_count_set(es, percpu_counter_sum_positive( + &EXT4_SB(sb)->s_freeblocks_counter)); + if (percpu_counter_initialized(&EXT4_SB(sb)->s_freeinodes_counter)) + es->s_free_inodes_count = + cpu_to_le32(percpu_counter_sum_positive( + &EXT4_SB(sb)->s_freeinodes_counter)); sb->s_dirt = 0; BUFFER_TRACE(sbh, "marking dirty"); mark_buffer_dirty(sbh); @@ -4580,10 +4556,12 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, static int ext4_quota_off(struct super_block *sb, int type) { - /* Force all delayed allocation blocks to be allocated. - * Caller already holds s_umount sem */ - if (test_opt(sb, DELALLOC)) + /* Force all delayed allocation blocks to be allocated */ + if (test_opt(sb, DELALLOC)) { + down_read(&sb->s_umount); sync_filesystem(sb); + up_read(&sb->s_umount); + } return dquot_quota_off(sb, type); } diff --git a/trunk/fs/openpromfs/inode.c b/trunk/fs/openpromfs/inode.c index 911e61f348fc..ddb1f41376e5 100644 --- a/trunk/fs/openpromfs/inode.c +++ b/trunk/fs/openpromfs/inode.c @@ -418,7 +418,7 @@ static int openprom_fill_super(struct super_block *s, void *data, int silent) static struct dentry *openprom_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data) { - return mount_single(fs_type, flags, data, openprom_fill_super); + return mount_single(fs_type, flags, data, openprom_fill_super) } static struct file_system_type openprom_fs_type = { diff --git a/trunk/include/linux/kernel.h b/trunk/include/linux/kernel.h index b526947bdf48..450092c1e35f 100644 --- a/trunk/include/linux/kernel.h +++ b/trunk/include/linux/kernel.h @@ -60,7 +60,7 @@ extern const char linux_proc_banner[]; #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) #define roundup(x, y) ( \ { \ - const typeof(y) __y = y; \ + typeof(y) __y = y; \ (((x) + (__y - 1)) / __y) * __y; \ } \ ) diff --git a/trunk/include/linux/mmc/sh_mmcif.h b/trunk/include/linux/mmc/sh_mmcif.h index 5c99da1078aa..d19e2114fd86 100644 --- a/trunk/include/linux/mmc/sh_mmcif.h +++ b/trunk/include/linux/mmc/sh_mmcif.h @@ -59,19 +59,19 @@ struct sh_mmcif_plat_data { #define MMCIF_CE_HOST_STS2 0x0000004C #define MMCIF_CE_VERSION 0x0000007C -static inline u32 sh_mmcif_readl(void __iomem *addr, int reg) +extern inline u32 sh_mmcif_readl(void __iomem *addr, int reg) { return readl(addr + reg); } -static inline void sh_mmcif_writel(void __iomem *addr, int reg, u32 val) +extern inline void sh_mmcif_writel(void __iomem *addr, int reg, u32 val) { writel(val, addr + reg); } #define SH_MMCIF_BBS 512 /* boot block size */ -static inline void sh_mmcif_boot_cmd_send(void __iomem *base, +extern inline void sh_mmcif_boot_cmd_send(void __iomem *base, unsigned long cmd, unsigned long arg) { sh_mmcif_writel(base, MMCIF_CE_INT, 0); @@ -79,7 +79,7 @@ static inline void sh_mmcif_boot_cmd_send(void __iomem *base, sh_mmcif_writel(base, MMCIF_CE_CMD_SET, cmd); } -static inline int sh_mmcif_boot_cmd_poll(void __iomem *base, unsigned long mask) +extern inline int sh_mmcif_boot_cmd_poll(void __iomem *base, unsigned long mask) { unsigned long tmp; int cnt; @@ -95,14 +95,14 @@ static inline int sh_mmcif_boot_cmd_poll(void __iomem *base, unsigned long mask) return -1; } -static inline int sh_mmcif_boot_cmd(void __iomem *base, +extern inline int sh_mmcif_boot_cmd(void __iomem *base, unsigned long cmd, unsigned long arg) { sh_mmcif_boot_cmd_send(base, cmd, arg); return sh_mmcif_boot_cmd_poll(base, 0x00010000); } -static inline int sh_mmcif_boot_do_read_single(void __iomem *base, +extern inline int sh_mmcif_boot_do_read_single(void __iomem *base, unsigned int block_nr, unsigned long *buf) { @@ -125,7 +125,7 @@ static inline int sh_mmcif_boot_do_read_single(void __iomem *base, return 0; } -static inline int sh_mmcif_boot_do_read(void __iomem *base, +extern inline int sh_mmcif_boot_do_read(void __iomem *base, unsigned long first_block, unsigned long nr_blocks, void *buf) @@ -143,7 +143,7 @@ static inline int sh_mmcif_boot_do_read(void __iomem *base, return ret; } -static inline void sh_mmcif_boot_init(void __iomem *base) +extern inline void sh_mmcif_boot_init(void __iomem *base) { unsigned long tmp; @@ -177,7 +177,7 @@ static inline void sh_mmcif_boot_init(void __iomem *base) sh_mmcif_boot_cmd(base, 0x03400040, 0x00010000); } -static inline void sh_mmcif_boot_slurp(void __iomem *base, +extern inline void sh_mmcif_boot_slurp(void __iomem *base, unsigned char *buf, unsigned long no_bytes) { diff --git a/trunk/include/linux/sh_clk.h b/trunk/include/linux/sh_clk.h index cea0c38e7a63..4dca992f3093 100644 --- a/trunk/include/linux/sh_clk.h +++ b/trunk/include/linux/sh_clk.h @@ -122,10 +122,6 @@ int clk_rate_table_find(struct clk *clk, long clk_rate_div_range_round(struct clk *clk, unsigned int div_min, unsigned int div_max, unsigned long rate); -long clk_round_parent(struct clk *clk, unsigned long target, - unsigned long *best_freq, unsigned long *parent_freq, - unsigned int div_min, unsigned int div_max); - #define SH_CLK_MSTP32(_parent, _enable_reg, _enable_bit, _flags) \ { \ .parent = _parent, \ diff --git a/trunk/include/linux/sh_timer.h b/trunk/include/linux/sh_timer.h index 4d9dcd138315..864bd56bd3b0 100644 --- a/trunk/include/linux/sh_timer.h +++ b/trunk/include/linux/sh_timer.h @@ -5,6 +5,7 @@ struct sh_timer_config { char *name; long channel_offset; int timer_bit; + char *clk; unsigned long clockevent_rating; unsigned long clocksource_rating; }; diff --git a/trunk/include/trace/events/ext4.h b/trunk/include/trace/events/ext4.h index e5e345fb2a5c..289010d3270b 100644 --- a/trunk/include/trace/events/ext4.h +++ b/trunk/include/trace/events/ext4.h @@ -98,103 +98,6 @@ TRACE_EVENT(ext4_allocate_inode, (unsigned long) __entry->dir, __entry->mode) ); -TRACE_EVENT(ext4_evict_inode, - TP_PROTO(struct inode *inode), - - TP_ARGS(inode), - - TP_STRUCT__entry( - __field( int, dev_major ) - __field( int, dev_minor ) - __field( ino_t, ino ) - __field( int, nlink ) - ), - - TP_fast_assign( - __entry->dev_major = MAJOR(inode->i_sb->s_dev); - __entry->dev_minor = MINOR(inode->i_sb->s_dev); - __entry->ino = inode->i_ino; - __entry->nlink = inode->i_nlink; - ), - - TP_printk("dev %d,%d ino %lu nlink %d", - __entry->dev_major, __entry->dev_minor, - (unsigned long) __entry->ino, __entry->nlink) -); - -TRACE_EVENT(ext4_drop_inode, - TP_PROTO(struct inode *inode, int drop), - - TP_ARGS(inode, drop), - - TP_STRUCT__entry( - __field( int, dev_major ) - __field( int, dev_minor ) - __field( ino_t, ino ) - __field( int, drop ) - ), - - TP_fast_assign( - __entry->dev_major = MAJOR(inode->i_sb->s_dev); - __entry->dev_minor = MINOR(inode->i_sb->s_dev); - __entry->ino = inode->i_ino; - __entry->drop = drop; - ), - - TP_printk("dev %d,%d ino %lu drop %d", - __entry->dev_major, __entry->dev_minor, - (unsigned long) __entry->ino, __entry->drop) -); - -TRACE_EVENT(ext4_mark_inode_dirty, - TP_PROTO(struct inode *inode, unsigned long IP), - - TP_ARGS(inode, IP), - - TP_STRUCT__entry( - __field( int, dev_major ) - __field( int, dev_minor ) - __field( ino_t, ino ) - __field(unsigned long, ip ) - ), - - TP_fast_assign( - __entry->dev_major = MAJOR(inode->i_sb->s_dev); - __entry->dev_minor = MINOR(inode->i_sb->s_dev); - __entry->ino = inode->i_ino; - __entry->ip = IP; - ), - - TP_printk("dev %d,%d ino %lu caller %pF", - __entry->dev_major, __entry->dev_minor, - (unsigned long) __entry->ino, (void *)__entry->ip) -); - -TRACE_EVENT(ext4_begin_ordered_truncate, - TP_PROTO(struct inode *inode, loff_t new_size), - - TP_ARGS(inode, new_size), - - TP_STRUCT__entry( - __field( int, dev_major ) - __field( int, dev_minor ) - __field( ino_t, ino ) - __field( loff_t, new_size ) - ), - - TP_fast_assign( - __entry->dev_major = MAJOR(inode->i_sb->s_dev); - __entry->dev_minor = MINOR(inode->i_sb->s_dev); - __entry->ino = inode->i_ino; - __entry->new_size = new_size; - ), - - TP_printk("dev %d,%d ino %lu new_size %lld", - __entry->dev_major, __entry->dev_minor, - (unsigned long) __entry->ino, - (long long) __entry->new_size) -); - DECLARE_EVENT_CLASS(ext4__write_begin, TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, diff --git a/trunk/mm/mprotect.c b/trunk/mm/mprotect.c index 4c5133873097..2d1bf7cf8851 100644 --- a/trunk/mm/mprotect.c +++ b/trunk/mm/mprotect.c @@ -211,7 +211,6 @@ mprotect_fixup(struct vm_area_struct *vma, struct vm_area_struct **pprev, mmu_notifier_invalidate_range_end(mm, start, end); vm_stat_account(mm, oldflags, vma->vm_file, -nrpages); vm_stat_account(mm, newflags, vma->vm_file, nrpages); - perf_event_mmap(vma); return 0; fail: @@ -300,6 +299,7 @@ SYSCALL_DEFINE3(mprotect, unsigned long, start, size_t, len, error = mprotect_fixup(vma, &prev, nstart, tmp, newflags); if (error) goto out; + perf_event_mmap(vma); nstart = tmp; if (nstart < prev->vm_end)