Commit 9858a38e authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'sh-latest' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6

* 'sh-latest' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6:
  sh: include Migo-R TS driver in Migo-R defconfig
  sh: correct definitions to access stack pointers
  sh: Tidy up SH-4A unaligned load support.
  dma: shdma: NMI support.
  sh: mach-sdk7786: Handle baseboard NMI source selection.
  sh: mach-rsk: Add polled GPIO buttons support for RSK+7203.
  sh: Break out cpuinfo_op procfs bits.
  sh: Enable optional gpiolib for all CPUs with pinmux tables.
  sh: migrate SH_CLK_MD to mode pin API.
  sh: machvec IO death.
parents abb35945 f862f904
...@@ -162,7 +162,8 @@ config ARCH_HAS_CPU_IDLE_WAIT ...@@ -162,7 +162,8 @@ config ARCH_HAS_CPU_IDLE_WAIT
def_bool y def_bool y
config NO_IOPORT config NO_IOPORT
bool def_bool !PCI
depends on !SH_CAYMAN && !SH_SH4202_MICRODEV
config IO_TRAPPED config IO_TRAPPED
bool bool
...@@ -275,6 +276,7 @@ config CPU_SUBTYPE_SH7203 ...@@ -275,6 +276,7 @@ config CPU_SUBTYPE_SH7203
select CPU_HAS_FPU select CPU_HAS_FPU
select SYS_SUPPORTS_CMT select SYS_SUPPORTS_CMT
select SYS_SUPPORTS_MTU2 select SYS_SUPPORTS_MTU2
select ARCH_WANT_OPTIONAL_GPIOLIB
config CPU_SUBTYPE_SH7206 config CPU_SUBTYPE_SH7206
bool "Support SH7206 processor" bool "Support SH7206 processor"
...@@ -346,6 +348,7 @@ config CPU_SUBTYPE_SH7720 ...@@ -346,6 +348,7 @@ config CPU_SUBTYPE_SH7720
select CPU_SH3 select CPU_SH3
select CPU_HAS_DSP select CPU_HAS_DSP
select SYS_SUPPORTS_CMT select SYS_SUPPORTS_CMT
select ARCH_WANT_OPTIONAL_GPIOLIB
help help
Select SH7720 if you have a SH3-DSP SH7720 CPU. Select SH7720 if you have a SH3-DSP SH7720 CPU.
...@@ -408,6 +411,7 @@ config CPU_SUBTYPE_SH7723 ...@@ -408,6 +411,7 @@ config CPU_SUBTYPE_SH7723
select ARCH_SHMOBILE select ARCH_SHMOBILE
select ARCH_SPARSEMEM_ENABLE select ARCH_SPARSEMEM_ENABLE
select SYS_SUPPORTS_CMT select SYS_SUPPORTS_CMT
select ARCH_WANT_OPTIONAL_GPIOLIB
help help
Select SH7723 if you have an SH-MobileR2 CPU. Select SH7723 if you have an SH-MobileR2 CPU.
...@@ -418,6 +422,7 @@ config CPU_SUBTYPE_SH7724 ...@@ -418,6 +422,7 @@ config CPU_SUBTYPE_SH7724
select ARCH_SHMOBILE select ARCH_SHMOBILE
select ARCH_SPARSEMEM_ENABLE select ARCH_SPARSEMEM_ENABLE
select SYS_SUPPORTS_CMT select SYS_SUPPORTS_CMT
select ARCH_WANT_OPTIONAL_GPIOLIB
help help
Select SH7724 if you have an SH-MobileR2R CPU. Select SH7724 if you have an SH-MobileR2R CPU.
...@@ -425,6 +430,7 @@ config CPU_SUBTYPE_SH7757 ...@@ -425,6 +430,7 @@ config CPU_SUBTYPE_SH7757
bool "Support SH7757 processor" bool "Support SH7757 processor"
select CPU_SH4A select CPU_SH4A
select CPU_SHX2 select CPU_SHX2
select ARCH_WANT_OPTIONAL_GPIOLIB
help help
Select SH7757 if you have a SH4A SH7757 CPU. Select SH7757 if you have a SH4A SH7757 CPU.
...@@ -448,6 +454,7 @@ config CPU_SUBTYPE_SH7785 ...@@ -448,6 +454,7 @@ config CPU_SUBTYPE_SH7785
select CPU_SHX2 select CPU_SHX2
select ARCH_SPARSEMEM_ENABLE select ARCH_SPARSEMEM_ENABLE
select SYS_SUPPORTS_NUMA select SYS_SUPPORTS_NUMA
select ARCH_WANT_OPTIONAL_GPIOLIB
config CPU_SUBTYPE_SH7786 config CPU_SUBTYPE_SH7786
bool "Support SH7786 processor" bool "Support SH7786 processor"
...@@ -455,6 +462,7 @@ config CPU_SUBTYPE_SH7786 ...@@ -455,6 +462,7 @@ config CPU_SUBTYPE_SH7786
select CPU_SHX3 select CPU_SHX3
select CPU_HAS_PTEAEX select CPU_HAS_PTEAEX
select GENERIC_CLOCKEVENTS_BROADCAST if SMP select GENERIC_CLOCKEVENTS_BROADCAST if SMP
select ARCH_WANT_OPTIONAL_GPIOLIB
config CPU_SUBTYPE_SHX3 config CPU_SUBTYPE_SHX3
bool "Support SH-X3 processor" bool "Support SH-X3 processor"
...@@ -479,6 +487,7 @@ config CPU_SUBTYPE_SH7722 ...@@ -479,6 +487,7 @@ config CPU_SUBTYPE_SH7722
select ARCH_SPARSEMEM_ENABLE select ARCH_SPARSEMEM_ENABLE
select SYS_SUPPORTS_NUMA select SYS_SUPPORTS_NUMA
select SYS_SUPPORTS_CMT select SYS_SUPPORTS_CMT
select ARCH_WANT_OPTIONAL_GPIOLIB
config CPU_SUBTYPE_SH7366 config CPU_SUBTYPE_SH7366
bool "Support SH7366 processor" bool "Support SH7366 processor"
...@@ -568,15 +577,6 @@ config SH_CLK_CPG_LEGACY ...@@ -568,15 +577,6 @@ config SH_CLK_CPG_LEGACY
def_bool y if !CPU_SUBTYPE_SH7785 && !ARCH_SHMOBILE && \ def_bool y if !CPU_SUBTYPE_SH7785 && !ARCH_SHMOBILE && \
!CPU_SHX3 && !CPU_SUBTYPE_SH7757 !CPU_SHX3 && !CPU_SUBTYPE_SH7757
config SH_CLK_MD
int "CPU Mode Pin Setting"
depends on CPU_SH2
default 6 if CPU_SUBTYPE_SH7206
default 5 if CPU_SUBTYPE_SH7619
default 0
help
MD2 - MD0 pin setting.
source "kernel/time/Kconfig" source "kernel/time/Kconfig"
endmenu endmenu
......
...@@ -29,8 +29,6 @@ unsigned short secureedge5410_ioport; ...@@ -29,8 +29,6 @@ unsigned short secureedge5410_ioport;
*/ */
static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id) static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id)
{ {
ctrl_delay(); /* dummy read */
printk("SnapGear: erase switch interrupt!\n"); printk("SnapGear: erase switch interrupt!\n");
return IRQ_HANDLED; return IRQ_HANDLED;
......
/* /*
* Renesas Technology Europe RSK+ 7203 Support. * Renesas Technology Europe RSK+ 7203 Support.
* *
* Copyright (C) 2008 Paul Mundt * Copyright (C) 2008 - 2010 Paul Mundt
* *
* This file is subject to the terms and conditions of the GNU General Public * 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 * License. See the file "COPYING" in the main directory of this archive
...@@ -12,7 +12,9 @@ ...@@ -12,7 +12,9 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/smsc911x.h> #include <linux/smsc911x.h>
#include <linux/input.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio_keys.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <asm/machvec.h> #include <asm/machvec.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -84,9 +86,42 @@ static struct platform_device led_device = { ...@@ -84,9 +86,42 @@ static struct platform_device led_device = {
}, },
}; };
static struct gpio_keys_button rsk7203_gpio_keys_table[] = {
{
.code = BTN_0,
.gpio = GPIO_PB0,
.active_low = 1,
.desc = "SW1",
}, {
.code = BTN_1,
.gpio = GPIO_PB1,
.active_low = 1,
.desc = "SW2",
}, {
.code = BTN_2,
.gpio = GPIO_PB2,
.active_low = 1,
.desc = "SW3",
},
};
static struct gpio_keys_platform_data rsk7203_gpio_keys_info = {
.buttons = rsk7203_gpio_keys_table,
.nbuttons = ARRAY_SIZE(rsk7203_gpio_keys_table),
.poll_interval = 50, /* default to 50ms */
};
static struct platform_device keys_device = {
.name = "gpio-keys-polled",
.dev = {
.platform_data = &rsk7203_gpio_keys_info,
},
};
static struct platform_device *rsk7203_devices[] __initdata = { static struct platform_device *rsk7203_devices[] __initdata = {
&smsc911x_device, &smsc911x_device,
&led_device, &led_device,
&keys_device,
}; };
static int __init rsk7203_devices_setup(void) static int __init rsk7203_devices_setup(void)
......
obj-y := fpga.o irq.o setup.o obj-y := fpga.o irq.o nmi.o setup.o
obj-$(CONFIG_GENERIC_GPIO) += gpio.o obj-$(CONFIG_GENERIC_GPIO) += gpio.o
obj-$(CONFIG_HAVE_SRAM_POOL) += sram.o obj-$(CONFIG_HAVE_SRAM_POOL) += sram.o
/*
* SDK7786 FPGA NMI Support.
*
* Copyright (C) 2010 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 <linux/init.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <mach/fpga.h>
enum {
NMI_MODE_MANUAL,
NMI_MODE_AUX,
NMI_MODE_MASKED,
NMI_MODE_ANY,
NMI_MODE_UNKNOWN,
};
/*
* Default to the manual NMI switch.
*/
static unsigned int __initdata nmi_mode = NMI_MODE_ANY;
static int __init nmi_mode_setup(char *str)
{
if (!str)
return 0;
if (strcmp(str, "manual") == 0)
nmi_mode = NMI_MODE_MANUAL;
else if (strcmp(str, "aux") == 0)
nmi_mode = NMI_MODE_AUX;
else if (strcmp(str, "masked") == 0)
nmi_mode = NMI_MODE_MASKED;
else if (strcmp(str, "any") == 0)
nmi_mode = NMI_MODE_ANY;
else {
nmi_mode = NMI_MODE_UNKNOWN;
pr_warning("Unknown NMI mode %s\n", str);
}
printk("Set NMI mode to %d\n", nmi_mode);
return 0;
}
early_param("nmi_mode", nmi_mode_setup);
void __init sdk7786_nmi_init(void)
{
unsigned int source, mask, tmp;
switch (nmi_mode) {
case NMI_MODE_MANUAL:
source = NMISR_MAN_NMI;
mask = NMIMR_MAN_NMIM;
break;
case NMI_MODE_AUX:
source = NMISR_AUX_NMI;
mask = NMIMR_AUX_NMIM;
break;
case NMI_MODE_ANY:
source = NMISR_MAN_NMI | NMISR_AUX_NMI;
mask = NMIMR_MAN_NMIM | NMIMR_AUX_NMIM;
break;
case NMI_MODE_MASKED:
case NMI_MODE_UNKNOWN:
default:
source = mask = 0;
break;
}
/* Set the NMI source */
tmp = fpga_read_reg(NMISR);
tmp &= ~NMISR_MASK;
tmp |= source;
fpga_write_reg(tmp, NMISR);
/* And the IRQ masking */
fpga_write_reg(NMIMR_MASK ^ mask, NMIMR);
}
...@@ -237,6 +237,7 @@ static void __init sdk7786_setup(char **cmdline_p) ...@@ -237,6 +237,7 @@ static void __init sdk7786_setup(char **cmdline_p)
pr_info("Renesas Technology Europe SDK7786 support:\n"); pr_info("Renesas Technology Europe SDK7786 support:\n");
sdk7786_fpga_init(); sdk7786_fpga_init();
sdk7786_nmi_init();
pr_info("\tPCB revision:\t%d\n", fpga_read_reg(PCBRR) & 0xf); pr_info("\tPCB revision:\t%d\n", fpga_read_reg(PCBRR) & 0xf);
......
...@@ -79,6 +79,11 @@ static int __init se7206_devices_setup(void) ...@@ -79,6 +79,11 @@ static int __init se7206_devices_setup(void)
} }
__initcall(se7206_devices_setup); __initcall(se7206_devices_setup);
static int se7206_mode_pins(void)
{
return MODE_PIN1 | MODE_PIN2;
}
/* /*
* The Machine Vector * The Machine Vector
*/ */
...@@ -87,4 +92,5 @@ static struct sh_machine_vector mv_se __initmv = { ...@@ -87,4 +92,5 @@ static struct sh_machine_vector mv_se __initmv = {
.mv_name = "SolutionEngine", .mv_name = "SolutionEngine",
.mv_nr_irqs = 256, .mv_nr_irqs = 256,
.mv_init_irq = init_se7206_IRQ, .mv_init_irq = init_se7206_IRQ,
.mv_mode_pins = se7206_mode_pins,
}; };
...@@ -11,6 +11,11 @@ ...@@ -11,6 +11,11 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/machvec.h> #include <asm/machvec.h>
static int se7619_mode_pins(void)
{
return MODE_PIN2 | MODE_PIN0;
}
/* /*
* The Machine Vector * The Machine Vector
*/ */
...@@ -18,4 +23,5 @@ ...@@ -18,4 +23,5 @@
static struct sh_machine_vector mv_se __initmv = { static struct sh_machine_vector mv_se __initmv = {
.mv_name = "SolutionEngine", .mv_name = "SolutionEngine",
.mv_nr_irqs = 108, .mv_nr_irqs = 108,
.mv_mode_pins = se7619_mode_pins,
}; };
...@@ -54,6 +54,8 @@ CONFIG_INPUT_EVDEV=y ...@@ -54,6 +54,8 @@ CONFIG_INPUT_EVDEV=y
# CONFIG_KEYBOARD_ATKBD is not set # CONFIG_KEYBOARD_ATKBD is not set
CONFIG_KEYBOARD_SH_KEYSC=y CONFIG_KEYBOARD_SH_KEYSC=y
# CONFIG_INPUT_MOUSE is not set # CONFIG_INPUT_MOUSE is not set
CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_MIGOR=y
# CONFIG_SERIO is not set # CONFIG_SERIO is not set
CONFIG_VT_HW_CONSOLE_BINDING=y CONFIG_VT_HW_CONSOLE_BINDING=y
CONFIG_SERIAL_SH_SCI=y CONFIG_SERIAL_SH_SCI=y
......
...@@ -382,14 +382,13 @@ static void __iomem *ioport_map_pci(struct pci_dev *dev, ...@@ -382,14 +382,13 @@ static void __iomem *ioport_map_pci(struct pci_dev *dev,
struct pci_channel *chan = dev->sysdata; struct pci_channel *chan = dev->sysdata;
if (unlikely(!chan->io_map_base)) { if (unlikely(!chan->io_map_base)) {
chan->io_map_base = generic_io_base; chan->io_map_base = sh_io_port_base;
if (pci_domains_supported) if (pci_domains_supported)
panic("To avoid data corruption io_map_base MUST be " panic("To avoid data corruption io_map_base MUST be "
"set with multiple PCI domains."); "set with multiple PCI domains.");
} }
return (void __iomem *)(chan->io_map_base + port); return (void __iomem *)(chan->io_map_base + port);
} }
......
This diff is collapsed.
...@@ -11,31 +11,6 @@ ...@@ -11,31 +11,6 @@
#error "Don't include this header without a valid system prefix" #error "Don't include this header without a valid system prefix"
#endif #endif
u8 IO_CONCAT(__IO_PREFIX,inb)(unsigned long);
u16 IO_CONCAT(__IO_PREFIX,inw)(unsigned long);
u32 IO_CONCAT(__IO_PREFIX,inl)(unsigned long);
void IO_CONCAT(__IO_PREFIX,outb)(u8, unsigned long);
void IO_CONCAT(__IO_PREFIX,outw)(u16, unsigned long);
void IO_CONCAT(__IO_PREFIX,outl)(u32, unsigned long);
u8 IO_CONCAT(__IO_PREFIX,inb_p)(unsigned long);
u16 IO_CONCAT(__IO_PREFIX,inw_p)(unsigned long);
u32 IO_CONCAT(__IO_PREFIX,inl_p)(unsigned long);
void IO_CONCAT(__IO_PREFIX,outb_p)(u8, unsigned long);
void IO_CONCAT(__IO_PREFIX,outw_p)(u16, unsigned long);
void IO_CONCAT(__IO_PREFIX,outl_p)(u32, unsigned long);
void IO_CONCAT(__IO_PREFIX,insb)(unsigned long, void *dst, unsigned long count);
void IO_CONCAT(__IO_PREFIX,insw)(unsigned long, void *dst, unsigned long count);
void IO_CONCAT(__IO_PREFIX,insl)(unsigned long, void *dst, unsigned long count);
void IO_CONCAT(__IO_PREFIX,outsb)(unsigned long, const void *src, unsigned long count);
void IO_CONCAT(__IO_PREFIX,outsw)(unsigned long, const void *src, unsigned long count);
void IO_CONCAT(__IO_PREFIX,outsl)(unsigned long, const void *src, unsigned long count);
void *IO_CONCAT(__IO_PREFIX,ioremap)(unsigned long offset, unsigned long size);
void IO_CONCAT(__IO_PREFIX,iounmap)(void *addr);
void __iomem *IO_CONCAT(__IO_PREFIX,ioport_map)(unsigned long addr, unsigned int size); void __iomem *IO_CONCAT(__IO_PREFIX,ioport_map)(unsigned long addr, unsigned int size);
void IO_CONCAT(__IO_PREFIX,ioport_unmap)(void __iomem *addr); void IO_CONCAT(__IO_PREFIX,ioport_unmap)(void __iomem *addr);
void IO_CONCAT(__IO_PREFIX,mem_init)(void); void IO_CONCAT(__IO_PREFIX,mem_init)(void);
......
...@@ -23,27 +23,6 @@ struct sh_machine_vector { ...@@ -23,27 +23,6 @@ struct sh_machine_vector {
void (*mv_init_irq)(void); void (*mv_init_irq)(void);
#ifdef CONFIG_HAS_IOPORT #ifdef CONFIG_HAS_IOPORT
u8 (*mv_inb)(unsigned long);
u16 (*mv_inw)(unsigned long);
u32 (*mv_inl)(unsigned long);
void (*mv_outb)(u8, unsigned long);
void (*mv_outw)(u16, unsigned long);
void (*mv_outl)(u32, unsigned long);
u8 (*mv_inb_p)(unsigned long);
u16 (*mv_inw_p)(unsigned long);
u32 (*mv_inl_p)(unsigned long);
void (*mv_outb_p)(u8, unsigned long);
void (*mv_outw_p)(u16, unsigned long);
void (*mv_outl_p)(u32, unsigned long);
void (*mv_insb)(unsigned long, void *dst, unsigned long count);
void (*mv_insw)(unsigned long, void *dst, unsigned long count);
void (*mv_insl)(unsigned long, void *dst, unsigned long count);
void (*mv_outsb)(unsigned long, const void *src, unsigned long count);
void (*mv_outsw)(unsigned long, const void *src, unsigned long count);
void (*mv_outsl)(unsigned long, const void *src, unsigned long count);
void __iomem *(*mv_ioport_map)(unsigned long port, unsigned int size); void __iomem *(*mv_ioport_map)(unsigned long port, unsigned int size);
void (*mv_ioport_unmap)(void __iomem *); void (*mv_ioport_unmap)(void __iomem *);
#endif #endif
......
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
#include <asm/system.h> #include <asm/system.h>
#define user_mode(regs) (((regs)->sr & 0x40000000)==0) #define user_mode(regs) (((regs)->sr & 0x40000000)==0)
#define user_stack_pointer(regs) ((unsigned long)(regs)->regs[15]) #define user_stack_pointer(_regs) ((unsigned long)(_regs)->regs[15])
#define kernel_stack_pointer(regs) ((unsigned long)(regs)->regs[15]) #define kernel_stack_pointer(_regs) ((unsigned long)(_regs)->regs[15])
#define instruction_pointer(regs) ((unsigned long)(regs)->pc) #define instruction_pointer(regs) ((unsigned long)(regs)->pc)
extern void show_regs(struct pt_regs *); extern void show_regs(struct pt_regs *);
......
...@@ -76,7 +76,7 @@ struct pt_dspregs { ...@@ -76,7 +76,7 @@ struct pt_dspregs {
#ifdef __KERNEL__ #ifdef __KERNEL__
#define MAX_REG_OFFSET offsetof(struct pt_regs, tra) #define MAX_REG_OFFSET offsetof(struct pt_regs, tra)
#define regs_return_value(regs) ((regs)->regs[0]) #define regs_return_value(_regs) ((_regs)->regs[0])
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
...@@ -13,7 +13,7 @@ struct pt_regs { ...@@ -13,7 +13,7 @@ struct pt_regs {
#ifdef __KERNEL__ #ifdef __KERNEL__
#define MAX_REG_OFFSET offsetof(struct pt_regs, tregs[7]) #define MAX_REG_OFFSET offsetof(struct pt_regs, tregs[7])
#define regs_return_value(regs) ((regs)->regs[3]) #define regs_return_value(_regs) ((_regs)->regs[3])
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
...@@ -18,10 +18,20 @@ ...@@ -18,10 +18,20 @@
* of spill registers and blowing up when building at low optimization * of spill registers and blowing up when building at low optimization
* levels. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34777. * levels. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34777.
*/ */
#include <linux/unaligned/packed_struct.h>
#include <linux/types.h> #include <linux/types.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
static __always_inline u32 __get_unaligned_cpu32(const u8 *p) static inline u16 sh4a_get_unaligned_cpu16(const u8 *p)
{
#ifdef __LITTLE_ENDIAN
return p[0] | p[1] << 8;
#else
return p[0] << 8 | p[1];
#endif
}
static __always_inline u32 sh4a_get_unaligned_cpu32(const u8 *p)
{ {
unsigned long unaligned; unsigned long unaligned;
...@@ -34,218 +44,148 @@ static __always_inline u32 __get_unaligned_cpu32(const u8 *p) ...@@ -34,218 +44,148 @@ static __always_inline u32 __get_unaligned_cpu32(const u8 *p)
return unaligned; return unaligned;
} }
struct __una_u16 { u16 x __attribute__((packed)); };
struct __una_u32 { u32 x __attribute__((packed)); };
struct __una_u64 { u64 x __attribute__((packed)); };
static inline u16 __get_unaligned_cpu16(const u8 *p)
{
#ifdef __LITTLE_ENDIAN
return p[0] | p[1] << 8;
#else
return p[0] << 8 | p[1];
#endif
}
/* /*
* Even though movua.l supports auto-increment on the read side, it can * Even though movua.l supports auto-increment on the read side, it can
* only store to r0 due to instruction encoding constraints, so just let * only store to r0 due to instruction encoding constraints, so just let
* the compiler sort it out on its own. * the compiler sort it out on its own.
*/ */
static inline u64 __get_unaligned_cpu64(const u8 *p) static inline u64 sh4a_get_unaligned_cpu64(const u8 *p)
{ {
#ifdef __LITTLE_ENDIAN #ifdef __LITTLE_ENDIAN
return (u64)__get_unaligned_cpu32(p + 4) << 32 | return (u64)sh4a_get_unaligned_cpu32(p + 4) << 32 |
__get_unaligned_cpu32(p); sh4a_get_unaligned_cpu32(p);
#else #else
return (u64)__get_unaligned_cpu32(p) << 32 | return (u64)sh4a_get_unaligned_cpu32(p) << 32 |
__get_unaligned_cpu32(p + 4); sh4a_get_unaligned_cpu32(p + 4);
#endif #endif
} }
static inline u16 get_unaligned_le16(const void *p) static inline u16 get_unaligned_le16(const void *p)
{ {
return le16_to_cpu(__get_unaligned_cpu16(p)); return le16_to_cpu(sh4a_get_unaligned_cpu16(p));
} }
static inline u32 get_unaligned_le32(const void *p) static inline u32 get_unaligned_le32(const void *p)
{ {
return le32_to_cpu(__get_unaligned_cpu32(p)); return le32_to_cpu(sh4a_get_unaligned_cpu32(p));
} }
static inline u64 get_unaligned_le64(const void *p) static inline u64 get_unaligned_le64(const void *p)
{ {
return le64_to_cpu(__get_unaligned_cpu64(p)); return le64_to_cpu(sh4a_get_unaligned_cpu64(p));
} }
static inline u16 get_unaligned_be16(const void *p) static inline u16 get_unaligned_be16(const void *p)
{ {
return be16_to_cpu(__get_unaligned_cpu16(p)); return be16_to_cpu(sh4a_get_unaligned_cpu16(p));
} }
static inline u32 get_unaligned_be32(const void *p) static inline u32 get_unaligned_be32(const void *p)
{ {
return be32_to_cpu(__get_unaligned_cpu32(p)); return be32_to_cpu(sh4a_get_unaligned_cpu32(p));
} }
static inline u64 get_unaligned_be64(const void *p) static inline u64 get_unaligned_be64(const void *p)
{ {
return be64_to_cpu(__get_unaligned_cpu64(p)); return be64_to_cpu(sh4a_get_unaligned_cpu64(p));
} }
static inline void __put_le16_noalign(u8 *p, u16 val) static inline void nonnative_put_le16(u16 val, u8 *p)
{ {
*p++ = val; *p++ = val;
*p++ = val >> 8; *p++ = val >> 8;
} }
static inline void __put_le32_noalign(u8 *p, u32 val) static inline void nonnative_put_le32(u32 val, u8 *p)
{ {
__put_le16_noalign(p, val); nonnative_put_le16(val, p);
__put_le16_noalign(p + 2, val >> 16); nonnative_put_le16(val >> 16, p + 2);
} }
static inline void __put_le64_noalign(u8 *p, u64 val) static inline void nonnative_put_le64(u64 val, u8 *p)
{ {
__put_le32_noalign(p, val); nonnative_put_le32(val, p);
__put_le32_noalign(p + 4, val >> 32); nonnative_put_le32(val >> 32, p + 4);
} }
static inline void __put_be16_noalign(u8 *p, u16 val) static inline void nonnative_put_be16(u16 val, u8 *p)
{ {
*p++ = val >> 8; *p++ = val >> 8;
*p++ = val; *p++ = val;
} }
static inline void __put_be32_noalign(u8 *p, u32 val) static inline void nonnative_put_be32(u32 val, u8 *p)
{ {
__put_be16_noalign(p, val >> 16); nonnative_put_be16(val >> 16, p);
__put_be16_noalign(p + 2, val); nonnative_put_be16(val, p + 2);
} }
static inline void __put_be64_noalign(u8 *p, u64 val) static inline void nonnative_put_be64(u64 val, u8 *p)
{ {
__put_be32_noalign(p, val >> 32); nonnative_put_be32(val >> 32, p);
__put_be32_noalign(p + 4, val); nonnative_put_be32(val, p + 4);
} }
static inline void put_unaligned_le16(u16 val, void *p) static inline void put_unaligned_le16(u16 val, void *p)
{ {
#ifdef __LITTLE_ENDIAN #ifdef __LITTLE_ENDIAN
((struct __una_u16 *)p)->x = val; __put_unaligned_cpu16(val, p);
#else #else
__put_le16_noalign(p, val); nonnative_put_le16(val, p);
#endif #endif
} }
static inline void put_unaligned_le32(u32 val, void *p) static inline void put_unaligned_le32(u32 val, void *p)
{ {
#ifdef __LITTLE_ENDIAN #ifdef __LITTLE_ENDIAN
((struct __una_u32 *)p)->x = val; __put_unaligned_cpu32(val, p);
#else #else
__put_le32_noalign(p, val); nonnative_put_le32(val, p);
#endif #endif
} }
static inline void put_unaligned_le64(u64 val, void *p) static inline void put_unaligned_le64(u64 val, void *p)
{ {
#ifdef __LITTLE_ENDIAN #ifdef __LITTLE_ENDIAN
((struct __una_u64 *)p)->x = val; __put_unaligned_cpu64(val, p);
#else #else
__put_le64_noalign(p, val); nonnative_put_le64(val, p);
#endif #endif
} }
static inline void put_unaligned_be16(u16 val, void *p) static inline void put_unaligned_be16(u16 val, void *p)
{ {
#ifdef __BIG_ENDIAN #ifdef __BIG_ENDIAN
((struct __una_u16 *)p)->x = val; __put_unaligned_cpu16(val, p);
#else #else
__put_be16_noalign(p, val); nonnative_put_be16(val, p);
#endif #endif
} }
static inline void put_unaligned_be32(u32 val, void *p) static inline void put_unaligned_be32(u32 val, void *p)
{ {
#ifdef __BIG_ENDIAN #ifdef __BIG_ENDIAN
((struct __una_u32 *)p)->x = val; __put_unaligned_cpu32(val, p);
#else #else
__put_be32_noalign(p, val); nonnative_put_be32(val, p);
#endif #endif
} }
static inline void put_unaligned_be64(u64 val, void *p) static inline void put_unaligned_be64(u64 val, void *p)
{ {
#ifdef __BIG_ENDIAN #ifdef __BIG_ENDIAN
((struct __una_u64 *)p)->x = val; __put_unaligned_cpu64(val, p);
#else #else
__put_be64_noalign(p, val); nonnative_put_be64(val, p);
#endif #endif
} }
/* /*
* Cause a link-time error if we try an unaligned access other than * While it's a bit non-obvious, even though the generic le/be wrappers
* 1,2,4 or 8 bytes long * use the __get/put_xxx prefixing, they actually wrap in to the
* non-prefixed get/put_xxx variants as provided above.
*/ */
extern void __bad_unaligned_access_size(void); #include <linux/unaligned/generic.h>
#define __get_unaligned_le(ptr) ((__force typeof(*(ptr)))({ \
__builtin_choose_expr(sizeof(*(ptr)) == 1, *(ptr), \
__builtin_choose_expr(sizeof(*(ptr)) == 2, get_unaligned_le16((ptr)), \
__builtin_choose_expr(sizeof(*(ptr)) == 4, get_unaligned_le32((ptr)), \
__builtin_choose_expr(sizeof(*(ptr)) == 8, get_unaligned_le64((ptr)), \
__bad_unaligned_access_size())))); \
}))
#define __get_unaligned_be(ptr) ((__force typeof(*(ptr)))({ \
__builtin_choose_expr(sizeof(*(ptr)) == 1, *(ptr), \
__builtin_choose_expr(sizeof(*(ptr)) == 2, get_unaligned_be16((ptr)), \
__builtin_choose_expr(sizeof(*(ptr)) == 4, get_unaligned_be32((ptr)), \
__builtin_choose_expr(sizeof(*(ptr)) == 8, get_unaligned_be64((ptr)), \
__bad_unaligned_access_size())))); \
}))
#define __put_unaligned_le(val, ptr) ({ \
void *__gu_p = (ptr); \
switch (sizeof(*(ptr))) { \
case 1: \
*(u8 *)__gu_p = (__force u8)(val); \
break; \
case 2: \
put_unaligned_le16((__force u16)(val), __gu_p); \
break; \
case 4: \
put_unaligned_le32((__force u32)(val), __gu_p); \
break; \
case 8: \
put_unaligned_le64((__force u64)(val), __gu_p); \
break; \
default: \
__bad_unaligned_access_size(); \
break; \
} \
(void)0; })
#define __put_unaligned_be(val, ptr) ({ \
void *__gu_p = (ptr); \
switch (sizeof(*(ptr))) { \
case 1: \
*(u8 *)__gu_p = (__force u8)(val); \
break; \
case 2: \
put_unaligned_be16((__force u16)(val), __gu_p); \
break; \
case 4: \
put_unaligned_be32((__force u32)(val), __gu_p); \
break; \
case 8: \
put_unaligned_be64((__force u64)(val), __gu_p); \
break; \
default: \
__bad_unaligned_access_size(); \
break; \
} \
(void)0; })
#ifdef __LITTLE_ENDIAN #ifdef __LITTLE_ENDIAN
# define get_unaligned __get_unaligned_le # define get_unaligned __get_unaligned_le
......
...@@ -14,11 +14,16 @@ ...@@ -14,11 +14,16 @@
#define INTTESTR 0x040 #define INTTESTR 0x040
#define SYSSR 0x050 #define SYSSR 0x050
#define NRGPR 0x060 #define NRGPR 0x060
#define NMISR 0x070 #define NMISR 0x070
#define NMISR_MAN_NMI BIT(0)
#define NMISR_AUX_NMI BIT(1)
#define NMISR_MASK (NMISR_MAN_NMI | NMISR_AUX_NMI)
#define NMIMR 0x080 #define NMIMR 0x080
#define NMIMR_MAN_NMIM BIT(0) /* Manual NMI mask */ #define NMIMR_MAN_NMIM BIT(0) /* Manual NMI mask */
#define NMIMR_AUX_NMIM BIT(1) /* Auxiliary NMI mask */ #define NMIMR_AUX_NMIM BIT(1) /* Auxiliary NMI mask */
#define NMIMR_MASK (NMIMR_MAN_NMIM | NMIMR_AUX_NMIM)
#define INTBSR 0x090 #define INTBSR 0x090
#define INTBMR 0x0a0 #define INTBMR 0x0a0
...@@ -126,6 +131,9 @@ ...@@ -126,6 +131,9 @@
extern void __iomem *sdk7786_fpga_base; extern void __iomem *sdk7786_fpga_base;
extern void sdk7786_fpga_init(void); extern void sdk7786_fpga_init(void);
/* arch/sh/boards/mach-sdk7786/nmi.c */
extern void sdk7786_nmi_init(void);
#define SDK7786_FPGA_REGADDR(reg) (sdk7786_fpga_base + (reg)) #define SDK7786_FPGA_REGADDR(reg) (sdk7786_fpga_base + (reg))
/* /*
......
...@@ -20,6 +20,11 @@ obj-y := clkdev.o debugtraps.o dma-nommu.o dumpstack.o \ ...@@ -20,6 +20,11 @@ obj-y := clkdev.o debugtraps.o dma-nommu.o dumpstack.o \
syscalls_$(BITS).o time.o topology.o traps.o \ syscalls_$(BITS).o time.o topology.o traps.o \
traps_$(BITS).o unwinder.o traps_$(BITS).o unwinder.o
ifndef CONFIG_GENERIC_IOMAP
obj-y += iomap.o
obj-$(CONFIG_HAS_IOPORT) += ioport.o
endif
obj-y += cpu/ obj-y += cpu/
obj-$(CONFIG_VSYSCALL) += vsyscall/ obj-$(CONFIG_VSYSCALL) += vsyscall/
obj-$(CONFIG_SMP) += smp.o obj-$(CONFIG_SMP) += smp.o
...@@ -39,7 +44,6 @@ obj-$(CONFIG_DUMP_CODE) += disassemble.o ...@@ -39,7 +44,6 @@ obj-$(CONFIG_DUMP_CODE) += disassemble.o
obj-$(CONFIG_HIBERNATION) += swsusp.o obj-$(CONFIG_HIBERNATION) += swsusp.o
obj-$(CONFIG_DWARF_UNWINDER) += dwarf.o obj-$(CONFIG_DWARF_UNWINDER) += dwarf.o
obj-$(CONFIG_PERF_EVENTS) += perf_event.o perf_callchain.o obj-$(CONFIG_PERF_EVENTS) += perf_event.o perf_callchain.o
obj-$(CONFIG_HAS_IOPORT) += io_generic.o
obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) += localtimer.o obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) += localtimer.o
......
...@@ -20,4 +20,4 @@ obj-$(CONFIG_SH_CLK_CPG_LEGACY) += clock-cpg.o ...@@ -20,4 +20,4 @@ obj-$(CONFIG_SH_CLK_CPG_LEGACY) += clock-cpg.o
obj-$(CONFIG_SH_FPU) += fpu.o obj-$(CONFIG_SH_FPU) += fpu.o
obj-$(CONFIG_SH_FPU_EMU) += fpu.o obj-$(CONFIG_SH_FPU_EMU) += fpu.o
obj-y += irq/ init.o clock.o hwblk.o obj-y += irq/ init.o clock.o hwblk.o proc.o
#include <linux/seq_file.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <asm/machvec.h>
#include <asm/processor.h>
static const char *cpu_name[] = {
[CPU_SH7201] = "SH7201",
[CPU_SH7203] = "SH7203", [CPU_SH7263] = "SH7263",
[CPU_SH7206] = "SH7206", [CPU_SH7619] = "SH7619",
[CPU_SH7705] = "SH7705", [CPU_SH7706] = "SH7706",
[CPU_SH7707] = "SH7707", [CPU_SH7708] = "SH7708",
[CPU_SH7709] = "SH7709", [CPU_SH7710] = "SH7710",
[CPU_SH7712] = "SH7712", [CPU_SH7720] = "SH7720",
[CPU_SH7721] = "SH7721", [CPU_SH7729] = "SH7729",
[CPU_SH7750] = "SH7750", [CPU_SH7750S] = "SH7750S",
[CPU_SH7750R] = "SH7750R", [CPU_SH7751] = "SH7751",
[CPU_SH7751R] = "SH7751R", [CPU_SH7760] = "SH7760",
[CPU_SH4_202] = "SH4-202", [CPU_SH4_501] = "SH4-501",
[CPU_SH7763] = "SH7763", [CPU_SH7770] = "SH7770",
[CPU_SH7780] = "SH7780", [CPU_SH7781] = "SH7781",
[CPU_SH7343] = "SH7343", [CPU_SH7785] = "SH7785",
[CPU_SH7786] = "SH7786", [CPU_SH7757] = "SH7757",
[CPU_SH7722] = "SH7722", [CPU_SHX3] = "SH-X3",
[CPU_SH5_101] = "SH5-101", [CPU_SH5_103] = "SH5-103",
[CPU_MXG] = "MX-G", [CPU_SH7723] = "SH7723",
[CPU_SH7366] = "SH7366", [CPU_SH7724] = "SH7724",
[CPU_SH_NONE] = "Unknown"
};
const char *get_cpu_subtype(struct sh_cpuinfo *c)
{
return cpu_name[c->type];
}
EXPORT_SYMBOL(get_cpu_subtype);
#ifdef CONFIG_PROC_FS
/* Symbolic CPU flags, keep in sync with asm/cpu-features.h */
static const char *cpu_flags[] = {
"none", "fpu", "p2flush", "mmuassoc", "dsp", "perfctr",
"ptea", "llsc", "l2", "op32", "pteaex", NULL
};
static void show_cpuflags(struct seq_file *m, struct sh_cpuinfo *c)
{
unsigned long i;
seq_printf(m, "cpu flags\t:");
if (!c->flags) {
seq_printf(m, " %s\n", cpu_flags[0]);
return;
}
for (i = 0; cpu_flags[i]; i++)
if ((c->flags & (1 << i)))
seq_printf(m, " %s", cpu_flags[i+1]);
seq_printf(m, "\n");
}
static void show_cacheinfo(struct seq_file *m, const char *type,
struct cache_info info)
{
unsigned int cache_size;
cache_size = info.ways * info.sets * info.linesz;
seq_printf(m, "%s size\t: %2dKiB (%d-way)\n",
type, cache_size >> 10, info.ways);
}
/*
* Get CPU information for use by the procfs.
*/
static int show_cpuinfo(struct seq_file *m, void *v)
{
struct sh_cpuinfo *c = v;
unsigned int cpu = c - cpu_data;
if (!cpu_online(cpu))
return 0;
if (cpu == 0)
seq_printf(m, "machine\t\t: %s\n", get_system_type());
else
seq_printf(m, "\n");
seq_printf(m, "processor\t: %d\n", cpu);
seq_printf(m, "cpu family\t: %s\n", init_utsname()->machine);
seq_printf(m, "cpu type\t: %s\n", get_cpu_subtype(c));
if (c->cut_major == -1)
seq_printf(m, "cut\t\t: unknown\n");
else if (c->cut_minor == -1)
seq_printf(m, "cut\t\t: %d.x\n", c->cut_major);
else
seq_printf(m, "cut\t\t: %d.%d\n", c->cut_major, c->cut_minor);
show_cpuflags(m, c);
seq_printf(m, "cache type\t: ");
/*
* Check for what type of cache we have, we support both the
* unified cache on the SH-2 and SH-3, as well as the harvard
* style cache on the SH-4.
*/
if (c->icache.flags & SH_CACHE_COMBINED) {
seq_printf(m, "unified\n");
show_cacheinfo(m, "cache", c->icache);
} else {
seq_printf(m, "split (harvard)\n");
show_cacheinfo(m, "icache", c->icache);
show_cacheinfo(m, "dcache", c->dcache);
}
/* Optional secondary cache */
if (c->flags & CPU_HAS_L2_CACHE)
show_cacheinfo(m, "scache", c->scache);
seq_printf(m, "address sizes\t: %u bits physical\n", c->phys_bits);
seq_printf(m, "bogomips\t: %lu.%02lu\n",
c->loops_per_jiffy/(500000/HZ),
(c->loops_per_jiffy/(5000/HZ)) % 100);
return 0;
}
static void *c_start(struct seq_file *m, loff_t *pos)
{
return *pos < NR_CPUS ? cpu_data + *pos : NULL;
}
static void *c_next(struct seq_file *m, void *v, loff_t *pos)
{
++*pos;
return c_start(m, pos);
}
static void c_stop(struct seq_file *m, void *v)
{
}
const struct seq_operations cpuinfo_op = {
.start = c_start,
.next = c_next,
.stop = c_stop,
.show = show_cpuinfo,
};
#endif /* CONFIG_PROC_FS */
...@@ -14,24 +14,18 @@ ...@@ -14,24 +14,18 @@
*/ */
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/io.h>
#include <asm/clock.h> #include <asm/clock.h>
#include <asm/freq.h> #include <asm/freq.h>
#include <asm/io.h> #include <asm/processor.h>
static const int pll1rate[] = {1,2}; static const int pll1rate[] = {1,2};
static const int pfc_divisors[] = {1,2,0,4}; static const int pfc_divisors[] = {1,2,0,4};
static unsigned int pll2_mult;
#if (CONFIG_SH_CLK_MD == 1) || (CONFIG_SH_CLK_MD == 2)
#define PLL2 (4)
#elif (CONFIG_SH_CLK_MD == 5) || (CONFIG_SH_CLK_MD == 6)
#define PLL2 (2)
#else
#error "Illigal Clock Mode!"
#endif
static void master_clk_init(struct clk *clk) static void master_clk_init(struct clk *clk)
{ {
clk->rate *= PLL2 * pll1rate[(__raw_readw(FREQCR) >> 8) & 7]; clk->rate *= pll2_mult * pll1rate[(__raw_readw(FREQCR) >> 8) & 7];
} }
static struct clk_ops sh7619_master_clk_ops = { static struct clk_ops sh7619_master_clk_ops = {
...@@ -70,6 +64,14 @@ static struct clk_ops *sh7619_clk_ops[] = { ...@@ -70,6 +64,14 @@ static struct clk_ops *sh7619_clk_ops[] = {
void __init arch_init_clk_ops(struct clk_ops **ops, int idx) void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
{ {
if (test_mode_pin(MODE_PIN2 | MODE_PIN0) ||
test_mode_pin(MODE_PIN2 | MODE_PIN1))
pll2_mult = 2;
else if (test_mode_pin(MODE_PIN0) || test_mode_pin(MODE_PIN1))
pll2_mult = 4;
BUG_ON(!pll2_mult);
if (idx < ARRAY_SIZE(sh7619_clk_ops)) if (idx < ARRAY_SIZE(sh7619_clk_ops))
*ops = sh7619_clk_ops[idx]; *ops = sh7619_clk_ops[idx];
} }
...@@ -22,19 +22,12 @@ static const int pll1rate[]={1,2,3,4,6,8}; ...@@ -22,19 +22,12 @@ static const int pll1rate[]={1,2,3,4,6,8};
static const int pfc_divisors[]={1,2,3,4,6,8,12}; static const int pfc_divisors[]={1,2,3,4,6,8,12};
#define ifc_divisors pfc_divisors #define ifc_divisors pfc_divisors
#if (CONFIG_SH_CLK_MD == 0) static unsigned int pll2_mult;
#define PLL2 (4)
#elif (CONFIG_SH_CLK_MD == 2)
#define PLL2 (2)
#elif (CONFIG_SH_CLK_MD == 3)
#define PLL2 (1)
#else
#error "Illegal Clock Mode!"
#endif
static void master_clk_init(struct clk *clk) static void master_clk_init(struct clk *clk)
{ {
clk->rate = 10000000 * PLL2 * pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0007]; clk->rate = 10000000 * pll2_mult *
pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0007];
} }
static struct clk_ops sh7201_master_clk_ops = { static struct clk_ops sh7201_master_clk_ops = {
...@@ -80,6 +73,13 @@ static struct clk_ops *sh7201_clk_ops[] = { ...@@ -80,6 +73,13 @@ static struct clk_ops *sh7201_clk_ops[] = {
void __init arch_init_clk_ops(struct clk_ops **ops, int idx) void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
{ {
if (test_mode_pin(MODE_PIN1 | MODE_PIN0))
pll2_mult = 1;
else if (test_mode_pin(MODE_PIN1))
pll2_mult = 2;
else
pll2_mult = 4;
if (idx < ARRAY_SIZE(sh7201_clk_ops)) if (idx < ARRAY_SIZE(sh7201_clk_ops))
*ops = sh7201_clk_ops[idx]; *ops = sh7201_clk_ops[idx];
} }
...@@ -25,21 +25,11 @@ static const int pll1rate[]={8,12,16,0}; ...@@ -25,21 +25,11 @@ static const int pll1rate[]={8,12,16,0};
static const int pfc_divisors[]={1,2,3,4,6,8,12}; static const int pfc_divisors[]={1,2,3,4,6,8,12};
#define ifc_divisors pfc_divisors #define ifc_divisors pfc_divisors
#if (CONFIG_SH_CLK_MD == 0) static unsigned int pll2_mult;
#define PLL2 (1)
#elif (CONFIG_SH_CLK_MD == 1)
#define PLL2 (2)
#elif (CONFIG_SH_CLK_MD == 2)
#define PLL2 (4)
#elif (CONFIG_SH_CLK_MD == 3)
#define PLL2 (4)
#else
#error "Illegal Clock Mode!"
#endif
static void master_clk_init(struct clk *clk) static void master_clk_init(struct clk *clk)
{ {
clk->rate *= pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0003] * PLL2 ; clk->rate *= pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0003] * pll2_mult;
} }
static struct clk_ops sh7203_master_clk_ops = { static struct clk_ops sh7203_master_clk_ops = {
...@@ -79,6 +69,13 @@ static struct clk_ops *sh7203_clk_ops[] = { ...@@ -79,6 +69,13 @@ static struct clk_ops *sh7203_clk_ops[] = {
void __init arch_init_clk_ops(struct clk_ops **ops, int idx) void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
{ {
if (test_mode_pin(MODE_PIN1))
pll2_mult = 4;
else if (test_mode_pin(MODE_PIN0))
pll2_mult = 2;
else
pll2_mult = 1;
if (idx < ARRAY_SIZE(sh7203_clk_ops)) if (idx < ARRAY_SIZE(sh7203_clk_ops))
*ops = sh7203_clk_ops[idx]; *ops = sh7203_clk_ops[idx];
} }
...@@ -22,19 +22,11 @@ static const int pll1rate[]={1,2,3,4,6,8}; ...@@ -22,19 +22,11 @@ static const int pll1rate[]={1,2,3,4,6,8};
static const int pfc_divisors[]={1,2,3,4,6,8,12}; static const int pfc_divisors[]={1,2,3,4,6,8,12};
#define ifc_divisors pfc_divisors #define ifc_divisors pfc_divisors
#if (CONFIG_SH_CLK_MD == 2) static unsigned int pll2_mult;
#define PLL2 (4)
#elif (CONFIG_SH_CLK_MD == 6)
#define PLL2 (2)
#elif (CONFIG_SH_CLK_MD == 7)
#define PLL2 (1)
#else
#error "Illigal Clock Mode!"
#endif
static void master_clk_init(struct clk *clk) static void master_clk_init(struct clk *clk)
{ {
clk->rate *= PLL2 * pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0007]; clk->rate *= pll2_mult * pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0007];
} }
static struct clk_ops sh7206_master_clk_ops = { static struct clk_ops sh7206_master_clk_ops = {
...@@ -79,7 +71,13 @@ static struct clk_ops *sh7206_clk_ops[] = { ...@@ -79,7 +71,13 @@ static struct clk_ops *sh7206_clk_ops[] = {
void __init arch_init_clk_ops(struct clk_ops **ops, int idx) void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
{ {
if (test_mode_pin(MODE_PIN2 | MODE_PIN1 | MODE_PIN0))
pll2_mult = 1;
else if (test_mode_pin(MODE_PIN2 | MODE_PIN1))
pll2_mult = 2;
else if (test_mode_pin(MODE_PIN1))
pll2_mult = 4;
if (idx < ARRAY_SIZE(sh7206_clk_ops)) if (idx < ARRAY_SIZE(sh7206_clk_ops))
*ops = sh7206_clk_ops[idx]; *ops = sh7206_clk_ops[idx];
} }
/*
* arch/sh/kernel/io_generic.c
*
* Copyright (C) 2000 Niibe Yutaka
* Copyright (C) 2005 - 2007 Paul Mundt
*
* Generic I/O routine. These can be used where a machine specific version
* is not required.
*
* 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 <linux/module.h>
#include <linux/io.h>
#include <asm/machvec.h>
#ifdef CONFIG_CPU_SH3
/* SH3 has a PCMCIA bug that needs a dummy read from area 6 for a
* workaround. */
/* I'm not sure SH7709 has this kind of bug */
#define dummy_read() __raw_readb(0xba000000)
#else
#define dummy_read()
#endif
unsigned long generic_io_base = 0;
u8 generic_inb(unsigned long port)
{
return __raw_readb(__ioport_map(port, 1));
}
u16 generic_inw(unsigned long port)
{
return __raw_readw(__ioport_map(port, 2));
}
u32 generic_inl(unsigned long port)
{
return __raw_readl(__ioport_map(port, 4));
}
u8 generic_inb_p(unsigned long port)
{
unsigned long v = generic_inb(port);
ctrl_delay();
return v;
}
u16 generic_inw_p(unsigned long port)
{
unsigned long v = generic_inw(port);
ctrl_delay();
return v;
}
u32 generic_inl_p(unsigned long port)
{
unsigned long v = generic_inl(port);
ctrl_delay();
return v;
}
/*
* insb/w/l all read a series of bytes/words/longs from a fixed port
* address. However as the port address doesn't change we only need to
* convert the port address to real address once.
*/
void generic_insb(unsigned long port, void *dst, unsigned long count)
{
__raw_readsb(__ioport_map(port, 1), dst, count);
dummy_read();
}
void generic_insw(unsigned long port, void *dst, unsigned long count)
{
__raw_readsw(__ioport_map(port, 2), dst, count);
dummy_read();
}
void generic_insl(unsigned long port, void *dst, unsigned long count)
{
__raw_readsl(__ioport_map(port, 4), dst, count);
dummy_read();
}
void generic_outb(u8 b, unsigned long port)
{
__raw_writeb(b, __ioport_map(port, 1));
}
void generic_outw(u16 b, unsigned long port)
{
__raw_writew(b, __ioport_map(port, 2));
}
void generic_outl(u32 b, unsigned long port)
{
__raw_writel(b, __ioport_map(port, 4));
}
void generic_outb_p(u8 b, unsigned long port)
{
generic_outb(b, port);
ctrl_delay();
}
void generic_outw_p(u16 b, unsigned long port)
{
generic_outw(b, port);
ctrl_delay();
}
void generic_outl_p(u32 b, unsigned long port)
{
generic_outl(b, port);
ctrl_delay();
}
/*
* outsb/w/l all write a series of bytes/words/longs to a fixed port
* address. However as the port address doesn't change we only need to
* convert the port address to real address once.
*/
void generic_outsb(unsigned long port, const void *src, unsigned long count)
{
__raw_writesb(__ioport_map(port, 1), src, count);
dummy_read();
}
void generic_outsw(unsigned long port, const void *src, unsigned long count)
{
__raw_writesw(__ioport_map(port, 2), src, count);
dummy_read();
}
void generic_outsl(unsigned long port, const void *src, unsigned long count)
{
__raw_writesl(__ioport_map(port, 4), src, count);
dummy_read();
}
void __iomem *generic_ioport_map(unsigned long addr, unsigned int size)
{
#ifdef P1SEG
if (PXSEG(addr) >= P1SEG)
return (void __iomem *)addr;
#endif
return (void __iomem *)(addr + generic_io_base);
}
void generic_ioport_unmap(void __iomem *addr)
{
}
#ifndef CONFIG_GENERIC_IOMAP
void __iomem *ioport_map(unsigned long port, unsigned int nr)
{
void __iomem *ret;
ret = __ioport_map_trapped(port, nr);
if (ret)
return ret;
return __ioport_map(port, nr);
}
EXPORT_SYMBOL(ioport_map);
void ioport_unmap(void __iomem *addr)
{
sh_mv.mv_ioport_unmap(addr);
}
EXPORT_SYMBOL(ioport_unmap);
#endif /* CONFIG_GENERIC_IOMAP */
/*
* arch/sh/kernel/iomap.c
*
* Copyright (C) 2000 Niibe Yutaka
* Copyright (C) 2005 - 2007 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 <linux/module.h>
#include <linux/io.h>
unsigned int ioread8(void __iomem *addr)
{
return readb(addr);
}
EXPORT_SYMBOL(ioread8);
unsigned int ioread16(void __iomem *addr)
{
return readw(addr);
}
EXPORT_SYMBOL(ioread16);
unsigned int ioread16be(void __iomem *addr)
{
return be16_to_cpu(__raw_readw(addr));
}
EXPORT_SYMBOL(ioread16be);
unsigned int ioread32(void __iomem *addr)
{
return readl(addr);
}
EXPORT_SYMBOL(ioread32);
unsigned int ioread32be(void __iomem *addr)
{
return be32_to_cpu(__raw_readl(addr));
}
EXPORT_SYMBOL(ioread32be);
void iowrite8(u8 val, void __iomem *addr)
{
writeb(val, addr);
}
EXPORT_SYMBOL(iowrite8);
void iowrite16(u16 val, void __iomem *addr)
{
writew(val, addr);
}
EXPORT_SYMBOL(iowrite16);
void iowrite16be(u16 val, void __iomem *addr)
{
__raw_writew(cpu_to_be16(val), addr);
}
EXPORT_SYMBOL(iowrite16be);
void iowrite32(u32 val, void __iomem *addr)
{
writel(val, addr);
}
EXPORT_SYMBOL(iowrite32);
void iowrite32be(u32 val, void __iomem *addr)
{
__raw_writel(cpu_to_be32(val), addr);
}
EXPORT_SYMBOL(iowrite32be);
/*
* These are the "repeat MMIO read/write" functions.
* Note the "__raw" accesses, since we don't want to
* convert to CPU byte order. We write in "IO byte
* order" (we also don't have IO barriers).
*/
static inline void mmio_insb(void __iomem *addr, u8 *dst, int count)
{
while (--count >= 0) {
u8 data = __raw_readb(addr);
*dst = data;
dst++;
}
}
static inline void mmio_insw(void __iomem *addr, u16 *dst, int count)
{
while (--count >= 0) {
u16 data = __raw_readw(addr);
*dst = data;
dst++;
}
}
static inline void mmio_insl(void __iomem *addr, u32 *dst, int count)
{
while (--count >= 0) {
u32 data = __raw_readl(addr);
*dst = data;
dst++;
}
}
static inline void mmio_outsb(void __iomem *addr, const u8 *src, int count)
{
while (--count >= 0) {
__raw_writeb(*src, addr);
src++;
}
}
static inline void mmio_outsw(void __iomem *addr, const u16 *src, int count)
{
while (--count >= 0) {
__raw_writew(*src, addr);
src++;
}
}
static inline void mmio_outsl(void __iomem *addr, const u32 *src, int count)
{
while (--count >= 0) {
__raw_writel(*src, addr);
src++;
}
}
void ioread8_rep(void __iomem *addr, void *dst, unsigned long count)
{
mmio_insb(addr, dst, count);
}
EXPORT_SYMBOL(ioread8_rep);
void ioread16_rep(void __iomem *addr, void *dst, unsigned long count)
{
mmio_insw(addr, dst, count);
}
EXPORT_SYMBOL(ioread16_rep);
void ioread32_rep(void __iomem *addr, void *dst, unsigned long count)
{
mmio_insl(addr, dst, count);
}
EXPORT_SYMBOL(ioread32_rep);
void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count)
{
mmio_outsb(addr, src, count);
}
EXPORT_SYMBOL(iowrite8_rep);
void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count)
{
mmio_outsw(addr, src, count);
}
EXPORT_SYMBOL(iowrite16_rep);
void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count)
{
mmio_outsl(addr, src, count);
}
EXPORT_SYMBOL(iowrite32_rep);
/*
* arch/sh/kernel/ioport.c
*
* Copyright (C) 2000 Niibe Yutaka
* Copyright (C) 2005 - 2007 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 <linux/module.h>
#include <linux/io.h>
const unsigned long sh_io_port_base __read_mostly = -1;
EXPORT_SYMBOL(sh_io_port_base);
void __iomem *__ioport_map(unsigned long addr, unsigned int size)
{
if (sh_mv.mv_ioport_map)
return sh_mv.mv_ioport_map(addr, size);
return (void __iomem *)(addr + sh_io_port_base);
}
EXPORT_SYMBOL(__ioport_map);
void __iomem *ioport_map(unsigned long port, unsigned int nr)
{
void __iomem *ret;
ret = __ioport_map_trapped(port, nr);
if (ret)
return ret;
return __ioport_map(port, nr);
}
EXPORT_SYMBOL(ioport_map);
void ioport_unmap(void __iomem *addr)
{
if (sh_mv.mv_ioport_unmap)
sh_mv.mv_ioport_unmap(addr);
}
EXPORT_SYMBOL(ioport_unmap);
...@@ -118,28 +118,6 @@ void __init sh_mv_setup(void) ...@@ -118,28 +118,6 @@ void __init sh_mv_setup(void)
sh_mv.mv_##elem = generic_##elem; \ sh_mv.mv_##elem = generic_##elem; \
} while (0) } while (0)
#ifdef CONFIG_HAS_IOPORT
#ifdef P2SEG
__set_io_port_base(P2SEG);
#else
__set_io_port_base(0);
#endif
mv_set(inb); mv_set(inw); mv_set(inl);
mv_set(outb); mv_set(outw); mv_set(outl);
mv_set(inb_p); mv_set(inw_p); mv_set(inl_p);
mv_set(outb_p); mv_set(outw_p); mv_set(outl_p);
mv_set(insb); mv_set(insw); mv_set(insl);
mv_set(outsb); mv_set(outsw); mv_set(outsl);
mv_set(ioport_map);
mv_set(ioport_unmap);
#endif
mv_set(irq_demux); mv_set(irq_demux);
mv_set(mode_pins); mv_set(mode_pins);
mv_set(mem_init); mv_set(mem_init);
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <linux/initrd.h> #include <linux/initrd.h>
#include <linux/bootmem.h> #include <linux/bootmem.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/seq_file.h>
#include <linux/root_dev.h> #include <linux/root_dev.h>
#include <linux/utsname.h> #include <linux/utsname.h>
#include <linux/nodemask.h> #include <linux/nodemask.h>
...@@ -319,146 +318,3 @@ int test_mode_pin(int pin) ...@@ -319,146 +318,3 @@ int test_mode_pin(int pin)
{ {
return sh_mv.mv_mode_pins() & pin; return sh_mv.mv_mode_pins() & pin;
} }
static const char *cpu_name[] = {
[CPU_SH7201] = "SH7201",
[CPU_SH7203] = "SH7203", [CPU_SH7263] = "SH7263",
[CPU_SH7206] = "SH7206", [CPU_SH7619] = "SH7619",
[CPU_SH7705] = "SH7705", [CPU_SH7706] = "SH7706",
[CPU_SH7707] = "SH7707", [CPU_SH7708] = "SH7708",
[CPU_SH7709] = "SH7709", [CPU_SH7710] = "SH7710",
[CPU_SH7712] = "SH7712", [CPU_SH7720] = "SH7720",
[CPU_SH7721] = "SH7721", [CPU_SH7729] = "SH7729",
[CPU_SH7750] = "SH7750", [CPU_SH7750S] = "SH7750S",
[CPU_SH7750R] = "SH7750R", [CPU_SH7751] = "SH7751",
[CPU_SH7751R] = "SH7751R", [CPU_SH7760] = "SH7760",
[CPU_SH4_202] = "SH4-202", [CPU_SH4_501] = "SH4-501",
[CPU_SH7763] = "SH7763", [CPU_SH7770] = "SH7770",
[CPU_SH7780] = "SH7780", [CPU_SH7781] = "SH7781",
[CPU_SH7343] = "SH7343", [CPU_SH7785] = "SH7785",
[CPU_SH7786] = "SH7786", [CPU_SH7757] = "SH7757",
[CPU_SH7722] = "SH7722", [CPU_SHX3] = "SH-X3",
[CPU_SH5_101] = "SH5-101", [CPU_SH5_103] = "SH5-103",
[CPU_MXG] = "MX-G", [CPU_SH7723] = "SH7723",
[CPU_SH7366] = "SH7366", [CPU_SH7724] = "SH7724",
[CPU_SH_NONE] = "Unknown"
};
const char *get_cpu_subtype(struct sh_cpuinfo *c)
{
return cpu_name[c->type];
}
EXPORT_SYMBOL(get_cpu_subtype);
#ifdef CONFIG_PROC_FS
/* Symbolic CPU flags, keep in sync with asm/cpu-features.h */
static const char *cpu_flags[] = {
"none", "fpu", "p2flush", "mmuassoc", "dsp", "perfctr",
"ptea", "llsc", "l2", "op32", "pteaex", NULL
};
static void show_cpuflags(struct seq_file *m, struct sh_cpuinfo *c)
{
unsigned long i;
seq_printf(m, "cpu flags\t:");
if (!c->flags) {
seq_printf(m, " %s\n", cpu_flags[0]);
return;
}
for (i = 0; cpu_flags[i]; i++)
if ((c->flags & (1 << i)))
seq_printf(m, " %s", cpu_flags[i+1]);
seq_printf(m, "\n");
}
static void show_cacheinfo(struct seq_file *m, const char *type,
struct cache_info info)
{
unsigned int cache_size;
cache_size = info.ways * info.sets * info.linesz;
seq_printf(m, "%s size\t: %2dKiB (%d-way)\n",
type, cache_size >> 10, info.ways);
}
/*
* Get CPU information for use by the procfs.
*/
static int show_cpuinfo(struct seq_file *m, void *v)
{
struct sh_cpuinfo *c = v;
unsigned int cpu = c - cpu_data;
if (!cpu_online(cpu))
return 0;
if (cpu == 0)
seq_printf(m, "machine\t\t: %s\n", get_system_type());
else
seq_printf(m, "\n");
seq_printf(m, "processor\t: %d\n", cpu);
seq_printf(m, "cpu family\t: %s\n", init_utsname()->machine);
seq_printf(m, "cpu type\t: %s\n", get_cpu_subtype(c));
if (c->cut_major == -1)
seq_printf(m, "cut\t\t: unknown\n");
else if (c->cut_minor == -1)
seq_printf(m, "cut\t\t: %d.x\n", c->cut_major);
else
seq_printf(m, "cut\t\t: %d.%d\n", c->cut_major, c->cut_minor);
show_cpuflags(m, c);
seq_printf(m, "cache type\t: ");
/*
* Check for what type of cache we have, we support both the
* unified cache on the SH-2 and SH-3, as well as the harvard
* style cache on the SH-4.
*/
if (c->icache.flags & SH_CACHE_COMBINED) {
seq_printf(m, "unified\n");
show_cacheinfo(m, "cache", c->icache);
} else {
seq_printf(m, "split (harvard)\n");
show_cacheinfo(m, "icache", c->icache);
show_cacheinfo(m, "dcache", c->dcache);
}
/* Optional secondary cache */
if (c->flags & CPU_HAS_L2_CACHE)
show_cacheinfo(m, "scache", c->scache);
seq_printf(m, "address sizes\t: %u bits physical\n", c->phys_bits);
seq_printf(m, "bogomips\t: %lu.%02lu\n",
c->loops_per_jiffy/(500000/HZ),
(c->loops_per_jiffy/(5000/HZ)) % 100);
return 0;
}
static void *c_start(struct seq_file *m, loff_t *pos)
{
return *pos < NR_CPUS ? cpu_data + *pos : NULL;
}
static void *c_next(struct seq_file *m, void *v, loff_t *pos)
{
++*pos;
return c_start(m, pos);
}
static void c_stop(struct seq_file *m, void *v)
{
}
const struct seq_operations cpuinfo_op = {
.start = c_start,
.next = c_next,
.stop = c_stop,
.show = show_cpuinfo,
};
#endif /* CONFIG_PROC_FS */
...@@ -27,7 +27,10 @@ ...@@ -27,7 +27,10 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/sh_dma.h> #include <linux/sh_dma.h>
#include <linux/notifier.h>
#include <linux/kdebug.h>
#include <linux/spinlock.h>
#include <linux/rculist.h>
#include "shdma.h" #include "shdma.h"
/* DMA descriptor control */ /* DMA descriptor control */
...@@ -43,6 +46,13 @@ enum sh_dmae_desc_status { ...@@ -43,6 +46,13 @@ enum sh_dmae_desc_status {
/* Default MEMCPY transfer size = 2^2 = 4 bytes */ /* Default MEMCPY transfer size = 2^2 = 4 bytes */
#define LOG2_DEFAULT_XFER_SIZE 2 #define LOG2_DEFAULT_XFER_SIZE 2
/*
* Used for write-side mutual exclusion for the global device list,
* read-side synchronization by way of RCU.
*/
static DEFINE_SPINLOCK(sh_dmae_lock);
static LIST_HEAD(sh_dmae_devices);
/* A bitmask with bits enough for enum sh_dmae_slave_chan_id */ /* A bitmask with bits enough for enum sh_dmae_slave_chan_id */
static unsigned long sh_dmae_slave_used[BITS_TO_LONGS(SH_DMA_SLAVE_NUMBER)]; static unsigned long sh_dmae_slave_used[BITS_TO_LONGS(SH_DMA_SLAVE_NUMBER)];
...@@ -817,10 +827,9 @@ static irqreturn_t sh_dmae_interrupt(int irq, void *data) ...@@ -817,10 +827,9 @@ static irqreturn_t sh_dmae_interrupt(int irq, void *data)
return ret; return ret;
} }
#if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE) static unsigned int sh_dmae_reset(struct sh_dmae_device *shdev)
static irqreturn_t sh_dmae_err(int irq, void *data)
{ {
struct sh_dmae_device *shdev = (struct sh_dmae_device *)data; unsigned int handled = 0;
int i; int i;
/* halt the dma controller */ /* halt the dma controller */
...@@ -829,25 +838,35 @@ static irqreturn_t sh_dmae_err(int irq, void *data) ...@@ -829,25 +838,35 @@ static irqreturn_t sh_dmae_err(int irq, void *data)
/* We cannot detect, which channel caused the error, have to reset all */ /* We cannot detect, which channel caused the error, have to reset all */
for (i = 0; i < SH_DMAC_MAX_CHANNELS; i++) { for (i = 0; i < SH_DMAC_MAX_CHANNELS; i++) {
struct sh_dmae_chan *sh_chan = shdev->chan[i]; struct sh_dmae_chan *sh_chan = shdev->chan[i];
if (sh_chan) { struct sh_desc *desc;
struct sh_desc *desc;
/* Stop the channel */ if (!sh_chan)
dmae_halt(sh_chan); continue;
/* Complete all */
list_for_each_entry(desc, &sh_chan->ld_queue, node) { /* Stop the channel */
struct dma_async_tx_descriptor *tx = &desc->async_tx; dmae_halt(sh_chan);
desc->mark = DESC_IDLE;
if (tx->callback) /* Complete all */
tx->callback(tx->callback_param); list_for_each_entry(desc, &sh_chan->ld_queue, node) {
} struct dma_async_tx_descriptor *tx = &desc->async_tx;
list_splice_init(&sh_chan->ld_queue, &sh_chan->ld_free); desc->mark = DESC_IDLE;
if (tx->callback)
tx->callback(tx->callback_param);
} }
list_splice_init(&sh_chan->ld_queue, &sh_chan->ld_free);
handled++;
} }
sh_dmae_rst(shdev); sh_dmae_rst(shdev);
return IRQ_HANDLED; return !!handled;
}
static irqreturn_t sh_dmae_err(int irq, void *data)
{
return IRQ_RETVAL(sh_dmae_reset(data));
} }
#endif
static void dmae_do_tasklet(unsigned long data) static void dmae_do_tasklet(unsigned long data)
{ {
...@@ -876,6 +895,60 @@ static void dmae_do_tasklet(unsigned long data) ...@@ -876,6 +895,60 @@ static void dmae_do_tasklet(unsigned long data)
sh_dmae_chan_ld_cleanup(sh_chan, false); sh_dmae_chan_ld_cleanup(sh_chan, false);
} }
static bool sh_dmae_nmi_notify(struct sh_dmae_device *shdev)
{
unsigned int handled;
/* Fast path out if NMIF is not asserted for this controller */
if ((dmaor_read(shdev) & DMAOR_NMIF) == 0)
return false;
handled = sh_dmae_reset(shdev);
if (handled)
return true;
return false;
}
static int sh_dmae_nmi_handler(struct notifier_block *self,
unsigned long cmd, void *data)
{
struct sh_dmae_device *shdev;
int ret = NOTIFY_DONE;
bool triggered;
/*
* Only concern ourselves with NMI events.
*
* Normally we would check the die chain value, but as this needs
* to be architecture independent, check for NMI context instead.
*/
if (!in_nmi())
return NOTIFY_DONE;
rcu_read_lock();
list_for_each_entry_rcu(shdev, &sh_dmae_devices, node) {
/*
* Only stop if one of the controllers has NMIF asserted,
* we do not want to interfere with regular address error
* handling or NMI events that don't concern the DMACs.
*/
triggered = sh_dmae_nmi_notify(shdev);
if (triggered == true)
ret = NOTIFY_OK;
}
rcu_read_unlock();
return ret;
}
static struct notifier_block sh_dmae_nmi_notifier __read_mostly = {
.notifier_call = sh_dmae_nmi_handler,
/* Run before NMI debug handler and KGDB */
.priority = 1,
};
static int __devinit sh_dmae_chan_probe(struct sh_dmae_device *shdev, int id, static int __devinit sh_dmae_chan_probe(struct sh_dmae_device *shdev, int id,
int irq, unsigned long flags) int irq, unsigned long flags)
{ {
...@@ -967,6 +1040,7 @@ static int __init sh_dmae_probe(struct platform_device *pdev) ...@@ -967,6 +1040,7 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
struct sh_dmae_pdata *pdata = pdev->dev.platform_data; struct sh_dmae_pdata *pdata = pdev->dev.platform_data;
unsigned long irqflags = IRQF_DISABLED, unsigned long irqflags = IRQF_DISABLED,
chan_flag[SH_DMAC_MAX_CHANNELS] = {}; chan_flag[SH_DMAC_MAX_CHANNELS] = {};
unsigned long flags;
int errirq, chan_irq[SH_DMAC_MAX_CHANNELS]; int errirq, chan_irq[SH_DMAC_MAX_CHANNELS];
int err, i, irq_cnt = 0, irqres = 0; int err, i, irq_cnt = 0, irqres = 0;
struct sh_dmae_device *shdev; struct sh_dmae_device *shdev;
...@@ -1032,6 +1106,15 @@ static int __init sh_dmae_probe(struct platform_device *pdev) ...@@ -1032,6 +1106,15 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
pm_runtime_get_sync(&pdev->dev); pm_runtime_get_sync(&pdev->dev);
spin_lock_irqsave(&sh_dmae_lock, flags);
list_add_tail_rcu(&shdev->node, &sh_dmae_devices);
spin_unlock_irqrestore(&sh_dmae_lock, flags);
/* Wire up NMI handling before bringing the controller online */
err = register_die_notifier(&sh_dmae_nmi_notifier);
if (err)
goto notifier_err;
/* reset dma controller */ /* reset dma controller */
err = sh_dmae_rst(shdev); err = sh_dmae_rst(shdev);
if (err) if (err)
...@@ -1135,6 +1218,12 @@ static int __init sh_dmae_probe(struct platform_device *pdev) ...@@ -1135,6 +1218,12 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
eirq_err: eirq_err:
#endif #endif
rst_err: rst_err:
unregister_die_notifier(&sh_dmae_nmi_notifier);
notifier_err:
spin_lock_irqsave(&sh_dmae_lock, flags);
list_del_rcu(&shdev->node);
spin_unlock_irqrestore(&sh_dmae_lock, flags);
pm_runtime_put(&pdev->dev); pm_runtime_put(&pdev->dev);
if (dmars) if (dmars)
iounmap(shdev->dmars); iounmap(shdev->dmars);
...@@ -1155,6 +1244,7 @@ static int __exit sh_dmae_remove(struct platform_device *pdev) ...@@ -1155,6 +1244,7 @@ static int __exit sh_dmae_remove(struct platform_device *pdev)
{ {
struct sh_dmae_device *shdev = platform_get_drvdata(pdev); struct sh_dmae_device *shdev = platform_get_drvdata(pdev);
struct resource *res; struct resource *res;
unsigned long flags;
int errirq = platform_get_irq(pdev, 0); int errirq = platform_get_irq(pdev, 0);
dma_async_device_unregister(&shdev->common); dma_async_device_unregister(&shdev->common);
...@@ -1162,6 +1252,12 @@ static int __exit sh_dmae_remove(struct platform_device *pdev) ...@@ -1162,6 +1252,12 @@ static int __exit sh_dmae_remove(struct platform_device *pdev)
if (errirq > 0) if (errirq > 0)
free_irq(errirq, shdev); free_irq(errirq, shdev);
unregister_die_notifier(&sh_dmae_nmi_notifier);
spin_lock_irqsave(&sh_dmae_lock, flags);
list_del_rcu(&shdev->node);
spin_unlock_irqrestore(&sh_dmae_lock, flags);
/* channel data remove */ /* channel data remove */
sh_dmae_chan_remove(shdev); sh_dmae_chan_remove(shdev);
......
...@@ -43,6 +43,7 @@ struct sh_dmae_device { ...@@ -43,6 +43,7 @@ struct sh_dmae_device {
struct dma_device common; struct dma_device common;
struct sh_dmae_chan *chan[SH_DMAC_MAX_CHANNELS]; struct sh_dmae_chan *chan[SH_DMAC_MAX_CHANNELS];
struct sh_dmae_pdata *pdata; struct sh_dmae_pdata *pdata;
struct list_head node;
u32 __iomem *chan_reg; u32 __iomem *chan_reg;
u16 __iomem *dmars; u16 __iomem *dmars;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment