diff options
Diffstat (limited to 'arch/sh/boards/renesas')
27 files changed, 1208 insertions, 670 deletions
diff --git a/arch/sh/boards/renesas/edosk7705/Makefile b/arch/sh/boards/renesas/edosk7705/Makefile index 7fccbf2e4a1d..14bdd531f116 100644 --- a/arch/sh/boards/renesas/edosk7705/Makefile +++ b/arch/sh/boards/renesas/edosk7705/Makefile | |||
| @@ -1,10 +1,6 @@ | |||
| 1 | # | 1 | # |
| 2 | # Makefile for the EDOSK7705 specific parts of the kernel | 2 | # Makefile for the EDOSK7705 specific parts of the kernel |
| 3 | # | 3 | # |
| 4 | # Note! Dependencies are done automagically by 'make dep', which also | ||
| 5 | # removes any old dependencies. DON'T put your own dependencies here | ||
| 6 | # unless it's something special (ie not a .c file). | ||
| 7 | # | ||
| 8 | 4 | ||
| 9 | obj-y := setup.o io.o | 5 | obj-y := setup.o io.o |
| 10 | 6 | ||
diff --git a/arch/sh/boards/renesas/edosk7705/setup.c b/arch/sh/boards/renesas/edosk7705/setup.c index ba143fa4afaa..ec5be0107719 100644 --- a/arch/sh/boards/renesas/edosk7705/setup.c +++ b/arch/sh/boards/renesas/edosk7705/setup.c | |||
| @@ -8,19 +8,21 @@ | |||
| 8 | * Modified for edosk7705 development | 8 | * Modified for edosk7705 development |
| 9 | * board by S. Dunn, 2003. | 9 | * board by S. Dunn, 2003. |
| 10 | */ | 10 | */ |
| 11 | |||
| 12 | #include <linux/init.h> | 11 | #include <linux/init.h> |
| 13 | #include <asm/machvec.h> | 12 | #include <asm/machvec.h> |
| 14 | #include <asm/machvec_init.h> | ||
| 15 | #include <asm/edosk7705/io.h> | 13 | #include <asm/edosk7705/io.h> |
| 16 | 14 | ||
| 17 | static void init_edosk7705(void); | 15 | static void __init sh_edosk7705_init_irq(void) |
| 16 | { | ||
| 17 | /* This is the Ethernet interrupt */ | ||
| 18 | make_imask_irq(0x09); | ||
| 19 | } | ||
| 18 | 20 | ||
| 19 | /* | 21 | /* |
| 20 | * The Machine Vector | 22 | * The Machine Vector |
| 21 | */ | 23 | */ |
| 22 | |||
| 23 | struct sh_machine_vector mv_edosk7705 __initmv = { | 24 | struct sh_machine_vector mv_edosk7705 __initmv = { |
| 25 | .mv_name = "EDOSK7705", | ||
| 24 | .mv_nr_irqs = 80, | 26 | .mv_nr_irqs = 80, |
| 25 | 27 | ||
| 26 | .mv_inb = sh_edosk7705_inb, | 28 | .mv_inb = sh_edosk7705_inb, |
| @@ -37,23 +39,6 @@ struct sh_machine_vector mv_edosk7705 __initmv = { | |||
| 37 | .mv_outsl = sh_edosk7705_outsl, | 39 | .mv_outsl = sh_edosk7705_outsl, |
| 38 | 40 | ||
| 39 | .mv_isa_port2addr = sh_edosk7705_isa_port2addr, | 41 | .mv_isa_port2addr = sh_edosk7705_isa_port2addr, |
| 40 | .mv_init_irq = init_edosk7705, | 42 | .mv_init_irq = sh_edosk7705_init_irq, |
| 41 | }; | 43 | }; |
| 42 | ALIAS_MV(edosk7705) | 44 | ALIAS_MV(edosk7705) |
| 43 | |||
| 44 | static void __init init_edosk7705(void) | ||
| 45 | { | ||
| 46 | /* This is the Ethernet interrupt */ | ||
| 47 | make_imask_irq(0x09); | ||
| 48 | } | ||
| 49 | |||
| 50 | const char *get_system_type(void) | ||
| 51 | { | ||
| 52 | return "EDOSK7705"; | ||
| 53 | } | ||
| 54 | |||
| 55 | void __init platform_setup(void) | ||
| 56 | { | ||
| 57 | /* Nothing .. */ | ||
| 58 | } | ||
| 59 | |||
diff --git a/arch/sh/boards/renesas/hs7751rvoip/Kconfig b/arch/sh/boards/renesas/hs7751rvoip/Kconfig new file mode 100644 index 000000000000..1743be477be5 --- /dev/null +++ b/arch/sh/boards/renesas/hs7751rvoip/Kconfig | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | if SH_HS7751RVOIP | ||
| 2 | |||
| 3 | menu "HS7751RVoIP options" | ||
| 4 | |||
| 5 | config HS7751RVOIP_CODEC | ||
| 6 | bool "Support VoIP Codec section" | ||
| 7 | help | ||
| 8 | Selecting this option will support CODEC section. | ||
| 9 | |||
| 10 | endmenu | ||
| 11 | |||
| 12 | endif | ||
diff --git a/arch/sh/boards/renesas/hs7751rvoip/Makefile b/arch/sh/boards/renesas/hs7751rvoip/Makefile index e8b4109ace11..e626377c55ee 100644 --- a/arch/sh/boards/renesas/hs7751rvoip/Makefile +++ b/arch/sh/boards/renesas/hs7751rvoip/Makefile | |||
| @@ -1,12 +1,8 @@ | |||
| 1 | # | 1 | # |
| 2 | # Makefile for the HS7751RVoIP specific parts of the kernel | 2 | # Makefile for the HS7751RVoIP specific parts of the kernel |
| 3 | # | 3 | # |
| 4 | # Note! Dependencies are done automagically by 'make dep', which also | ||
| 5 | # removes any old dependencies. DON'T put your own dependencies here | ||
| 6 | # unless it's something special (ie not a .c file). | ||
| 7 | # | ||
| 8 | 4 | ||
| 9 | obj-y := mach.o setup.o io.o irq.o led.o | 5 | obj-y := setup.o io.o irq.o |
| 10 | 6 | ||
| 11 | obj-$(CONFIG_PCI) += pci.o | 7 | obj-$(CONFIG_PCI) += pci.o |
| 12 | 8 | ||
diff --git a/arch/sh/boards/renesas/hs7751rvoip/io.c b/arch/sh/boards/renesas/hs7751rvoip/io.c index 3a1abfa2fefb..9ea1136b219b 100644 --- a/arch/sh/boards/renesas/hs7751rvoip/io.c +++ b/arch/sh/boards/renesas/hs7751rvoip/io.c | |||
| @@ -10,21 +10,16 @@ | |||
| 10 | * placeholder code from io_hs7751rvoip.c left in with the | 10 | * placeholder code from io_hs7751rvoip.c left in with the |
| 11 | * expectation of later SuperIO and PCMCIA access. | 11 | * expectation of later SuperIO and PCMCIA access. |
| 12 | */ | 12 | */ |
| 13 | |||
| 14 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
| 15 | #include <linux/types.h> | 14 | #include <linux/types.h> |
| 15 | #include <linux/module.h> | ||
| 16 | #include <linux/pci.h> | ||
| 16 | #include <asm/io.h> | 17 | #include <asm/io.h> |
| 17 | #include <asm/hs7751rvoip/hs7751rvoip.h> | 18 | #include <asm/hs7751rvoip/hs7751rvoip.h> |
| 18 | #include <asm/addrspace.h> | 19 | #include <asm/addrspace.h> |
| 19 | 20 | ||
| 20 | #include <linux/module.h> | ||
| 21 | #include <linux/pci.h> | ||
| 22 | #include "../../../drivers/pci/pci-sh7751.h" | ||
| 23 | |||
| 24 | extern void *area5_io8_base; /* Area 5 8bit I/O Base address */ | ||
| 25 | extern void *area6_io8_base; /* Area 6 8bit I/O Base address */ | 21 | extern void *area6_io8_base; /* Area 6 8bit I/O Base address */ |
| 26 | extern void *area5_io16_base; /* Area 5 16bit I/O Base address */ | 22 | extern void *area5_io16_base; /* Area 5 16bit I/O Base address */ |
| 27 | extern void *area6_io16_base; /* Area 6 16bit I/O Base address */ | ||
| 28 | 23 | ||
| 29 | /* | 24 | /* |
| 30 | * The 7751R HS7751RVoIP uses the built-in PCI controller (PCIC) | 25 | * The 7751R HS7751RVoIP uses the built-in PCI controller (PCIC) |
| @@ -33,25 +28,8 @@ extern void *area6_io16_base; /* Area 6 16bit I/O Base address */ | |||
| 33 | * like the other Solution Engine boards. | 28 | * like the other Solution Engine boards. |
| 34 | */ | 29 | */ |
| 35 | 30 | ||
| 36 | #define PCIIOBR (volatile long *)PCI_REG(SH7751_PCIIOBR) | ||
| 37 | #define PCIMBR (volatile long *)PCI_REG(SH7751_PCIMBR) | ||
| 38 | #define PCI_IO_AREA SH7751_PCI_IO_BASE | ||
| 39 | #define PCI_MEM_AREA SH7751_PCI_CONFIG_BASE | ||
| 40 | |||
| 41 | #define PCI_IOMAP(adr) (PCI_IO_AREA + (adr & ~SH7751_PCIIOBR_MASK)) | ||
| 42 | |||
| 43 | #if defined(CONFIG_HS7751RVOIP_CODEC) | ||
| 44 | #define CODEC_IO_BASE 0x1000 | 31 | #define CODEC_IO_BASE 0x1000 |
| 45 | #endif | 32 | #define CODEC_IOMAP(a) ((unsigned long)area6_io8_base + ((a) - CODEC_IO_BASE)) |
| 46 | |||
| 47 | #define maybebadio(name,port) \ | ||
| 48 | printk("bad PC-like io %s for port 0x%lx at 0x%08x\n", \ | ||
| 49 | #name, (port), (__u32) __builtin_return_address(0)) | ||
| 50 | |||
| 51 | static inline void delay(void) | ||
| 52 | { | ||
| 53 | ctrl_inw(0xa0000000); | ||
| 54 | } | ||
| 55 | 33 | ||
| 56 | static inline unsigned long port2adr(unsigned int port) | 34 | static inline unsigned long port2adr(unsigned int port) |
| 57 | { | 35 | { |
| @@ -59,9 +37,10 @@ static inline unsigned long port2adr(unsigned int port) | |||
| 59 | if (port == 0x3f6) | 37 | if (port == 0x3f6) |
| 60 | return ((unsigned long)area5_io16_base + 0x0c); | 38 | return ((unsigned long)area5_io16_base + 0x0c); |
| 61 | else | 39 | else |
| 62 | return ((unsigned long)area5_io16_base + 0x800 + ((port-0x1f0) << 1)); | 40 | return ((unsigned long)area5_io16_base + 0x800 + |
| 41 | ((port-0x1f0) << 1)); | ||
| 63 | else | 42 | else |
| 64 | maybebadio(port2adr, (unsigned long)port); | 43 | maybebadio((unsigned long)port); |
| 65 | return port; | 44 | return port; |
| 66 | } | 45 | } |
| 67 | 46 | ||
| @@ -78,25 +57,10 @@ static inline int shifted_port(unsigned long port) | |||
| 78 | } | 57 | } |
| 79 | 58 | ||
| 80 | #if defined(CONFIG_HS7751RVOIP_CODEC) | 59 | #if defined(CONFIG_HS7751RVOIP_CODEC) |
| 81 | static inline int | 60 | #define codec_port(port) \ |
| 82 | codec_port(unsigned long port) | 61 | ((CODEC_IO_BASE <= (port)) && ((port) < (CODEC_IO_BASE + 0x20))) |
| 83 | { | ||
| 84 | if (CODEC_IO_BASE <= port && port < (CODEC_IO_BASE+0x20)) | ||
| 85 | return 1; | ||
| 86 | else | ||
| 87 | return 0; | ||
| 88 | } | ||
| 89 | #endif | ||
| 90 | |||
| 91 | /* In case someone configures the kernel w/o PCI support: in that */ | ||
| 92 | /* scenario, don't ever bother to check for PCI-window addresses */ | ||
| 93 | |||
| 94 | /* NOTE: WINDOW CHECK MAY BE A BIT OFF, HIGH PCIBIOS_MIN_IO WRAPS? */ | ||
| 95 | #if defined(CONFIG_PCI) | ||
| 96 | #define CHECK_SH7751_PCIIO(port) \ | ||
| 97 | ((port >= PCIBIOS_MIN_IO) && (port < (PCIBIOS_MIN_IO + SH7751_PCI_IO_SIZE))) | ||
| 98 | #else | 62 | #else |
| 99 | #define CHECK_SH7751_PCIIO(port) (0) | 63 | #define codec_port(port) (0) |
| 100 | #endif | 64 | #endif |
| 101 | 65 | ||
| 102 | /* | 66 | /* |
| @@ -109,15 +73,13 @@ codec_port(unsigned long port) | |||
| 109 | unsigned char hs7751rvoip_inb(unsigned long port) | 73 | unsigned char hs7751rvoip_inb(unsigned long port) |
| 110 | { | 74 | { |
| 111 | if (PXSEG(port)) | 75 | if (PXSEG(port)) |
| 112 | return *(volatile unsigned char *)port; | 76 | return ctrl_inb(port); |
| 113 | #if defined(CONFIG_HS7751RVOIP_CODEC) | ||
| 114 | else if (codec_port(port)) | 77 | else if (codec_port(port)) |
| 115 | return *(volatile unsigned char *)((unsigned long)area6_io8_base+(port-CODEC_IO_BASE)); | 78 | return ctrl_inb(CODEC_IOMAP(port)); |
| 116 | #endif | 79 | else if (is_pci_ioaddr(port) || shifted_port(port)) |
| 117 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | 80 | return ctrl_inb(pci_ioaddr(port)); |
| 118 | return *(volatile unsigned char *)PCI_IOMAP(port); | ||
| 119 | else | 81 | else |
| 120 | return (*(volatile unsigned short *)port2adr(port) & 0xff); | 82 | return ctrl_inw(port2adr(port)) & 0xff; |
| 121 | } | 83 | } |
| 122 | 84 | ||
| 123 | unsigned char hs7751rvoip_inb_p(unsigned long port) | 85 | unsigned char hs7751rvoip_inb_p(unsigned long port) |
| @@ -125,38 +87,36 @@ unsigned char hs7751rvoip_inb_p(unsigned long port) | |||
| 125 | unsigned char v; | 87 | unsigned char v; |
| 126 | 88 | ||
| 127 | if (PXSEG(port)) | 89 | if (PXSEG(port)) |
| 128 | v = *(volatile unsigned char *)port; | 90 | v = ctrl_inb(port); |
| 129 | #if defined(CONFIG_HS7751RVOIP_CODEC) | ||
| 130 | else if (codec_port(port)) | 91 | else if (codec_port(port)) |
| 131 | v = *(volatile unsigned char *)((unsigned long)area6_io8_base+(port-CODEC_IO_BASE)); | 92 | v = ctrl_inb(CODEC_IOMAP(port)); |
| 132 | #endif | 93 | else if (is_pci_ioaddr(port) || shifted_port(port)) |
| 133 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | 94 | v = ctrl_inb(pci_ioaddr(port)); |
| 134 | v = *(volatile unsigned char *)PCI_IOMAP(port); | ||
| 135 | else | 95 | else |
| 136 | v = (*(volatile unsigned short *)port2adr(port) & 0xff); | 96 | v = ctrl_inw(port2adr(port)) & 0xff; |
| 137 | delay(); | 97 | ctrl_delay(); |
| 138 | return v; | 98 | return v; |
| 139 | } | 99 | } |
| 140 | 100 | ||
| 141 | unsigned short hs7751rvoip_inw(unsigned long port) | 101 | unsigned short hs7751rvoip_inw(unsigned long port) |
| 142 | { | 102 | { |
| 143 | if (PXSEG(port)) | 103 | if (PXSEG(port)) |
| 144 | return *(volatile unsigned short *)port; | 104 | return ctrl_inw(port); |
| 145 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | 105 | else if (is_pci_ioaddr(port) || shifted_port(port)) |
| 146 | return *(volatile unsigned short *)PCI_IOMAP(port); | 106 | return ctrl_inw(pci_ioaddr(port)); |
| 147 | else | 107 | else |
| 148 | maybebadio(inw, port); | 108 | maybebadio(port); |
| 149 | return 0; | 109 | return 0; |
| 150 | } | 110 | } |
| 151 | 111 | ||
| 152 | unsigned int hs7751rvoip_inl(unsigned long port) | 112 | unsigned int hs7751rvoip_inl(unsigned long port) |
| 153 | { | 113 | { |
| 154 | if (PXSEG(port)) | 114 | if (PXSEG(port)) |
| 155 | return *(volatile unsigned long *)port; | 115 | return ctrl_inl(port); |
| 156 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | 116 | else if (is_pci_ioaddr(port) || shifted_port(port)) |
| 157 | return *(volatile unsigned long *)PCI_IOMAP(port); | 117 | return ctrl_inl(pci_ioaddr(port)); |
| 158 | else | 118 | else |
| 159 | maybebadio(inl, port); | 119 | maybebadio(port); |
| 160 | return 0; | 120 | return 0; |
| 161 | } | 121 | } |
| 162 | 122 | ||
| @@ -164,146 +124,160 @@ void hs7751rvoip_outb(unsigned char value, unsigned long port) | |||
| 164 | { | 124 | { |
| 165 | 125 | ||
| 166 | if (PXSEG(port)) | 126 | if (PXSEG(port)) |
| 167 | *(volatile unsigned char *)port = value; | 127 | ctrl_outb(value, port); |
| 168 | #if defined(CONFIG_HS7751RVOIP_CODEC) | ||
| 169 | else if (codec_port(port)) | 128 | else if (codec_port(port)) |
| 170 | *(volatile unsigned cjar *)((unsigned long)area6_io8_base+(port-CODEC_IO_BASE)) = value; | 129 | ctrl_outb(value, CODEC_IOMAP(port)); |
| 171 | #endif | 130 | else if (is_pci_ioaddr(port) || shifted_port(port)) |
| 172 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | 131 | ctrl_outb(value, pci_ioaddr(port)); |
| 173 | *(unsigned char *)PCI_IOMAP(port) = value; | ||
| 174 | else | 132 | else |
| 175 | *(volatile unsigned short *)port2adr(port) = value; | 133 | ctrl_outb(value, port2adr(port)); |
| 176 | } | 134 | } |
| 177 | 135 | ||
| 178 | void hs7751rvoip_outb_p(unsigned char value, unsigned long port) | 136 | void hs7751rvoip_outb_p(unsigned char value, unsigned long port) |
| 179 | { | 137 | { |
| 180 | if (PXSEG(port)) | 138 | if (PXSEG(port)) |
| 181 | *(volatile unsigned char *)port = value; | 139 | ctrl_outb(value, port); |
| 182 | #if defined(CONFIG_HS7751RVOIP_CODEC) | ||
| 183 | else if (codec_port(port)) | 140 | else if (codec_port(port)) |
| 184 | *(volatile unsigned cjar *)((unsigned long)area6_io8_base+(port-CODEC_IO_BASE)) = value; | 141 | ctrl_outb(value, CODEC_IOMAP(port)); |
| 185 | #endif | 142 | else if (is_pci_ioaddr(port) || shifted_port(port)) |
| 186 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | 143 | ctrl_outb(value, pci_ioaddr(port)); |
| 187 | *(unsigned char *)PCI_IOMAP(port) = value; | ||
| 188 | else | 144 | else |
| 189 | *(volatile unsigned short *)port2adr(port) = value; | 145 | ctrl_outw(value, port2adr(port)); |
| 190 | delay(); | 146 | |
| 147 | ctrl_delay(); | ||
| 191 | } | 148 | } |
| 192 | 149 | ||
| 193 | void hs7751rvoip_outw(unsigned short value, unsigned long port) | 150 | void hs7751rvoip_outw(unsigned short value, unsigned long port) |
| 194 | { | 151 | { |
| 195 | if (PXSEG(port)) | 152 | if (PXSEG(port)) |
| 196 | *(volatile unsigned short *)port = value; | 153 | ctrl_outw(value, port); |
| 197 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | 154 | else if (is_pci_ioaddr(port) || shifted_port(port)) |
| 198 | *(unsigned short *)PCI_IOMAP(port) = value; | 155 | ctrl_outw(value, pci_ioaddr(port)); |
| 199 | else | 156 | else |
| 200 | maybebadio(outw, port); | 157 | maybebadio(port); |
| 201 | } | 158 | } |
| 202 | 159 | ||
| 203 | void hs7751rvoip_outl(unsigned int value, unsigned long port) | 160 | void hs7751rvoip_outl(unsigned int value, unsigned long port) |
| 204 | { | 161 | { |
| 205 | if (PXSEG(port)) | 162 | if (PXSEG(port)) |
| 206 | *(volatile unsigned long *)port = value; | 163 | ctrl_outl(value, port); |
| 207 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | 164 | else if (is_pci_ioaddr(port) || shifted_port(port)) |
| 208 | *((unsigned long *)PCI_IOMAP(port)) = value; | 165 | ctrl_outl(value, pci_ioaddr(port)); |
| 209 | else | 166 | else |
| 210 | maybebadio(outl, port); | 167 | maybebadio(port); |
| 211 | } | 168 | } |
| 212 | 169 | ||
| 213 | void hs7751rvoip_insb(unsigned long port, void *addr, unsigned long count) | 170 | void hs7751rvoip_insb(unsigned long port, void *addr, unsigned long count) |
| 214 | { | 171 | { |
| 172 | u8 *buf = addr; | ||
| 173 | |||
| 215 | if (PXSEG(port)) | 174 | if (PXSEG(port)) |
| 216 | while (count--) *((unsigned char *) addr)++ = *(volatile unsigned char *)port; | 175 | while (count--) |
| 217 | #if defined(CONFIG_HS7751RVOIP_CODEC) | 176 | *buf++ = ctrl_inb(port); |
| 218 | else if (codec_port(port)) | 177 | else if (codec_port(port)) |
| 219 | while (count--) *((unsigned char *) addr)++ = *(volatile unsigned char *)((unsigned long)area6_io8_base+(port-CODEC_IO_BASE)); | 178 | while (count--) |
| 220 | #endif | 179 | *buf++ = ctrl_inb(CODEC_IOMAP(port)); |
| 221 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { | 180 | else if (is_pci_ioaddr(port) || shifted_port(port)) { |
| 222 | volatile __u8 *bp = (__u8 *)PCI_IOMAP(port); | 181 | volatile u8 *bp = (volatile u8 *)pci_ioaddr(port); |
| 223 | 182 | ||
| 224 | while (count--) *((volatile unsigned char *) addr)++ = *bp; | 183 | while (count--) |
| 184 | *buf++ = *bp; | ||
| 225 | } else { | 185 | } else { |
| 226 | volatile __u16 *p = (volatile unsigned short *)port2adr(port); | 186 | volatile u16 *p = (volatile u16 *)port2adr(port); |
| 227 | 187 | ||
| 228 | while (count--) *((unsigned char *) addr)++ = *p & 0xff; | 188 | while (count--) |
| 189 | *buf++ = *p & 0xff; | ||
| 229 | } | 190 | } |
| 230 | } | 191 | } |
| 231 | 192 | ||
| 232 | void hs7751rvoip_insw(unsigned long port, void *addr, unsigned long count) | 193 | void hs7751rvoip_insw(unsigned long port, void *addr, unsigned long count) |
| 233 | { | 194 | { |
| 234 | volatile __u16 *p; | 195 | volatile u16 *p; |
| 196 | u16 *buf = addr; | ||
| 235 | 197 | ||
| 236 | if (PXSEG(port)) | 198 | if (PXSEG(port)) |
| 237 | p = (volatile unsigned short *)port; | 199 | p = (volatile u16 *)port; |
| 238 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | 200 | else if (is_pci_ioaddr(port) || shifted_port(port)) |
| 239 | p = (volatile unsigned short *)PCI_IOMAP(port); | 201 | p = (volatile u16 *)pci_ioaddr(port); |
| 240 | else | 202 | else |
| 241 | p = (volatile unsigned short *)port2adr(port); | 203 | p = (volatile u16 *)port2adr(port); |
| 242 | while (count--) *((__u16 *) addr)++ = *p; | 204 | while (count--) |
| 205 | *buf++ = *p; | ||
| 243 | } | 206 | } |
| 244 | 207 | ||
| 245 | void hs7751rvoip_insl(unsigned long port, void *addr, unsigned long count) | 208 | void hs7751rvoip_insl(unsigned long port, void *addr, unsigned long count) |
| 246 | { | 209 | { |
| 247 | if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { | ||
| 248 | volatile __u32 *p = (__u32 *)PCI_IOMAP(port); | ||
| 249 | 210 | ||
| 250 | while (count--) *((__u32 *) addr)++ = *p; | 211 | if (is_pci_ioaddr(port) || shifted_port(port)) { |
| 212 | volatile u32 *p = (volatile u32 *)pci_ioaddr(port); | ||
| 213 | u32 *buf = addr; | ||
| 214 | |||
| 215 | while (count--) | ||
| 216 | *buf++ = *p; | ||
| 251 | } else | 217 | } else |
| 252 | maybebadio(insl, port); | 218 | maybebadio(port); |
| 253 | } | 219 | } |
| 254 | 220 | ||
| 255 | void hs7751rvoip_outsb(unsigned long port, const void *addr, unsigned long count) | 221 | void hs7751rvoip_outsb(unsigned long port, const void *addr, unsigned long count) |
| 256 | { | 222 | { |
| 223 | const u8 *buf = addr; | ||
| 224 | |||
| 257 | if (PXSEG(port)) | 225 | if (PXSEG(port)) |
| 258 | while (count--) *(volatile unsigned char *)port = *((unsigned char *) addr)++; | 226 | while (count--) |
| 259 | #if defined(CONFIG_HS7751RVOIP_CODEC) | 227 | ctrl_outb(*buf++, port); |
| 260 | else if (codec_port(port)) | 228 | else if (codec_port(port)) |
| 261 | while (count--) *(volatile unsigned char *)((unsigned long)area6_io8_base+(port-CODEC_IO_BASE)) = *((unsigned char *) addr)++; | 229 | while (count--) |
| 262 | #endif | 230 | ctrl_outb(*buf++, CODEC_IOMAP(port)); |
| 263 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { | 231 | else if (is_pci_ioaddr(port) || shifted_port(port)) { |
| 264 | volatile __u8 *bp = (__u8 *)PCI_IOMAP(port); | 232 | volatile u8 *bp = (volatile u8 *)pci_ioaddr(port); |
| 265 | 233 | ||
| 266 | while (count--) *bp = *((volatile unsigned char *) addr)++; | 234 | while (count--) |
| 235 | *bp = *buf++; | ||
| 267 | } else { | 236 | } else { |
| 268 | volatile __u16 *p = (volatile unsigned short *)port2adr(port); | 237 | volatile u16 *p = (volatile u16 *)port2adr(port); |
| 269 | 238 | ||
| 270 | while (count--) *p = *((unsigned char *) addr)++; | 239 | while (count--) |
| 240 | *p = *buf++; | ||
| 271 | } | 241 | } |
| 272 | } | 242 | } |
| 273 | 243 | ||
| 274 | void hs7751rvoip_outsw(unsigned long port, const void *addr, unsigned long count) | 244 | void hs7751rvoip_outsw(unsigned long port, const void *addr, unsigned long count) |
| 275 | { | 245 | { |
| 276 | volatile __u16 *p; | 246 | volatile u16 *p; |
| 247 | const u16 *buf = addr; | ||
| 277 | 248 | ||
| 278 | if (PXSEG(port)) | 249 | if (PXSEG(port)) |
| 279 | p = (volatile unsigned short *)port; | 250 | p = (volatile u16 *)port; |
| 280 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | 251 | else if (is_pci_ioaddr(port) || shifted_port(port)) |
| 281 | p = (volatile unsigned short *)PCI_IOMAP(port); | 252 | p = (volatile u16 *)pci_ioaddr(port); |
| 282 | else | 253 | else |
| 283 | p = (volatile unsigned short *)port2adr(port); | 254 | p = (volatile u16 *)port2adr(port); |
| 284 | while (count--) *p = *((__u16 *) addr)++; | 255 | |
| 256 | while (count--) | ||
| 257 | *p = *buf++; | ||
| 285 | } | 258 | } |
| 286 | 259 | ||
| 287 | void hs7751rvoip_outsl(unsigned long port, const void *addr, unsigned long count) | 260 | void hs7751rvoip_outsl(unsigned long port, const void *addr, unsigned long count) |
| 288 | { | 261 | { |
| 289 | if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { | 262 | const u32 *buf = addr; |
| 290 | volatile __u32 *p = (__u32 *)PCI_IOMAP(port); | ||
| 291 | 263 | ||
| 292 | while (count--) *p = *((__u32 *) addr)++; | 264 | if (is_pci_ioaddr(port) || shifted_port(port)) { |
| 265 | volatile u32 *p = (volatile u32 *)pci_ioaddr(port); | ||
| 266 | |||
| 267 | while (count--) | ||
| 268 | *p = *buf++; | ||
| 293 | } else | 269 | } else |
| 294 | maybebadio(outsl, port); | 270 | maybebadio(port); |
| 295 | } | 271 | } |
| 296 | 272 | ||
| 297 | void *hs7751rvoip_ioremap(unsigned long offset, unsigned long size) | 273 | void __iomem *hs7751rvoip_ioport_map(unsigned long port, unsigned int size) |
| 298 | { | 274 | { |
| 299 | if (offset >= 0xfd000000) | 275 | if (PXSEG(port)) |
| 300 | return (void *)offset; | 276 | return (void __iomem *)port; |
| 301 | else | 277 | else if (unlikely(codec_port(port) && (size == 1))) |
| 302 | return (void *)P2SEGADDR(offset); | 278 | return (void __iomem *)CODEC_IOMAP(port); |
| 303 | } | 279 | else if (is_pci_ioaddr(port)) |
| 304 | EXPORT_SYMBOL(hs7751rvoip_ioremap); | 280 | return (void __iomem *)pci_ioaddr(port); |
| 305 | 281 | ||
| 306 | unsigned long hs7751rvoip_isa_port2addr(unsigned long offset) | 282 | return (void __iomem *)port2adr(port); |
| 307 | { | ||
| 308 | return port2adr(offset); | ||
| 309 | } | 283 | } |
diff --git a/arch/sh/boards/renesas/hs7751rvoip/irq.c b/arch/sh/boards/renesas/hs7751rvoip/irq.c index 705b7ddcb0d2..c617b188258a 100644 --- a/arch/sh/boards/renesas/hs7751rvoip/irq.c +++ b/arch/sh/boards/renesas/hs7751rvoip/irq.c | |||
| @@ -35,30 +35,24 @@ static unsigned int startup_hs7751rvoip_irq(unsigned int irq) | |||
| 35 | 35 | ||
| 36 | static void disable_hs7751rvoip_irq(unsigned int irq) | 36 | static void disable_hs7751rvoip_irq(unsigned int irq) |
| 37 | { | 37 | { |
| 38 | unsigned long flags; | ||
| 39 | unsigned short val; | 38 | unsigned short val; |
| 40 | unsigned short mask = 0xffff ^ (0x0001 << mask_pos[irq]); | 39 | unsigned short mask = 0xffff ^ (0x0001 << mask_pos[irq]); |
| 41 | 40 | ||
| 42 | /* Set the priority in IPR to 0 */ | 41 | /* Set the priority in IPR to 0 */ |
| 43 | local_irq_save(flags); | ||
| 44 | val = ctrl_inw(IRLCNTR3); | 42 | val = ctrl_inw(IRLCNTR3); |
| 45 | val &= mask; | 43 | val &= mask; |
| 46 | ctrl_outw(val, IRLCNTR3); | 44 | ctrl_outw(val, IRLCNTR3); |
| 47 | local_irq_restore(flags); | ||
| 48 | } | 45 | } |
| 49 | 46 | ||
| 50 | static void enable_hs7751rvoip_irq(unsigned int irq) | 47 | static void enable_hs7751rvoip_irq(unsigned int irq) |
| 51 | { | 48 | { |
| 52 | unsigned long flags; | ||
| 53 | unsigned short val; | 49 | unsigned short val; |
| 54 | unsigned short value = (0x0001 << mask_pos[irq]); | 50 | unsigned short value = (0x0001 << mask_pos[irq]); |
| 55 | 51 | ||
| 56 | /* Set priority in IPR back to original value */ | 52 | /* Set priority in IPR back to original value */ |
| 57 | local_irq_save(flags); | ||
| 58 | val = ctrl_inw(IRLCNTR3); | 53 | val = ctrl_inw(IRLCNTR3); |
| 59 | val |= value; | 54 | val |= value; |
| 60 | ctrl_outw(val, IRLCNTR3); | 55 | ctrl_outw(val, IRLCNTR3); |
| 61 | local_irq_restore(flags); | ||
| 62 | } | 56 | } |
| 63 | 57 | ||
| 64 | static void ack_hs7751rvoip_irq(unsigned int irq) | 58 | static void ack_hs7751rvoip_irq(unsigned int irq) |
diff --git a/arch/sh/boards/renesas/hs7751rvoip/led.c b/arch/sh/boards/renesas/hs7751rvoip/led.c deleted file mode 100644 index b6608fff9f38..000000000000 --- a/arch/sh/boards/renesas/hs7751rvoip/led.c +++ /dev/null | |||
| @@ -1,26 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * linux/arch/sh/kernel/setup_hs7751rvoip.c | ||
| 3 | * | ||
| 4 | * Copyright (C) 2000 Kazumoto Kojima | ||
| 5 | * | ||
| 6 | * Renesas Technology Sales HS7751RVoIP Support. | ||
| 7 | * | ||
| 8 | * Modified for HS7751RVoIP by | ||
| 9 | * Atom Create Engineering Co., Ltd. 2002. | ||
| 10 | * Lineo uSolutions, Inc. 2003. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include <asm/io.h> | ||
| 14 | #include <asm/hs7751rvoip/hs7751rvoip.h> | ||
| 15 | |||
| 16 | extern unsigned int debug_counter; | ||
| 17 | |||
| 18 | void debug_led_disp(void) | ||
| 19 | { | ||
| 20 | unsigned short value; | ||
| 21 | |||
| 22 | value = (unsigned char)debug_counter++; | ||
| 23 | ctrl_outb((0xf0|value), PA_OUTPORTR); | ||
| 24 | if (value == 0x0f) | ||
| 25 | debug_counter = 0; | ||
| 26 | } | ||
diff --git a/arch/sh/boards/renesas/hs7751rvoip/mach.c b/arch/sh/boards/renesas/hs7751rvoip/mach.c deleted file mode 100644 index caf967f77c61..000000000000 --- a/arch/sh/boards/renesas/hs7751rvoip/mach.c +++ /dev/null | |||
| @@ -1,54 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * linux/arch/sh/kernel/mach_hs7751rvoip.c | ||
| 3 | * | ||
| 4 | * Minor tweak of mach_se.c file to reference hs7751rvoip-specific items. | ||
| 5 | * | ||
| 6 | * May be copied or modified under the terms of the GNU General Public | ||
| 7 | * License. See linux/COPYING for more information. | ||
| 8 | * | ||
| 9 | * Machine vector for the Renesas Technology sales HS7751RVoIP | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/init.h> | ||
| 13 | |||
| 14 | #include <asm/machvec.h> | ||
| 15 | #include <asm/rtc.h> | ||
| 16 | #include <asm/irq.h> | ||
| 17 | #include <asm/hs7751rvoip/io.h> | ||
| 18 | |||
| 19 | extern void init_hs7751rvoip_IRQ(void); | ||
| 20 | extern void *hs7751rvoip_ioremap(unsigned long, unsigned long); | ||
| 21 | |||
| 22 | /* | ||
| 23 | * The Machine Vector | ||
| 24 | */ | ||
| 25 | |||
| 26 | struct sh_machine_vector mv_hs7751rvoip __initmv = { | ||
| 27 | .mv_nr_irqs = 72, | ||
| 28 | |||
| 29 | .mv_inb = hs7751rvoip_inb, | ||
| 30 | .mv_inw = hs7751rvoip_inw, | ||
| 31 | .mv_inl = hs7751rvoip_inl, | ||
| 32 | .mv_outb = hs7751rvoip_outb, | ||
| 33 | .mv_outw = hs7751rvoip_outw, | ||
| 34 | .mv_outl = hs7751rvoip_outl, | ||
| 35 | |||
| 36 | .mv_inb_p = hs7751rvoip_inb_p, | ||
| 37 | .mv_inw_p = hs7751rvoip_inw, | ||
| 38 | .mv_inl_p = hs7751rvoip_inl, | ||
| 39 | .mv_outb_p = hs7751rvoip_outb_p, | ||
| 40 | .mv_outw_p = hs7751rvoip_outw, | ||
| 41 | .mv_outl_p = hs7751rvoip_outl, | ||
| 42 | |||
| 43 | .mv_insb = hs7751rvoip_insb, | ||
| 44 | .mv_insw = hs7751rvoip_insw, | ||
| 45 | .mv_insl = hs7751rvoip_insl, | ||
| 46 | .mv_outsb = hs7751rvoip_outsb, | ||
| 47 | .mv_outsw = hs7751rvoip_outsw, | ||
| 48 | .mv_outsl = hs7751rvoip_outsl, | ||
| 49 | |||
| 50 | .mv_ioremap = hs7751rvoip_ioremap, | ||
| 51 | .mv_isa_port2addr = hs7751rvoip_isa_port2addr, | ||
| 52 | .mv_init_irq = init_hs7751rvoip_IRQ, | ||
| 53 | }; | ||
| 54 | ALIAS_MV(hs7751rvoip) | ||
diff --git a/arch/sh/boards/renesas/hs7751rvoip/setup.c b/arch/sh/boards/renesas/hs7751rvoip/setup.c index 29fb5ff70fb5..0414c15c3458 100644 --- a/arch/sh/boards/renesas/hs7751rvoip/setup.c +++ b/arch/sh/boards/renesas/hs7751rvoip/setup.c | |||
| @@ -1,44 +1,38 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * linux/arch/sh/kernel/setup_hs7751rvoip.c | 2 | * Renesas Technology Sales HS7751RVoIP Support. |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2000 Kazumoto Kojima | 4 | * Copyright (C) 2000 Kazumoto Kojima |
| 5 | * | 5 | * |
| 6 | * Renesas Technology Sales HS7751RVoIP Support. | ||
| 7 | * | ||
| 8 | * Modified for HS7751RVoIP by | 6 | * Modified for HS7751RVoIP by |
| 9 | * Atom Create Engineering Co., Ltd. 2002. | 7 | * Atom Create Engineering Co., Ltd. 2002. |
| 10 | * Lineo uSolutions, Inc. 2003. | 8 | * Lineo uSolutions, Inc. 2003. |
| 11 | */ | 9 | */ |
| 12 | |||
| 13 | #include <linux/init.h> | 10 | #include <linux/init.h> |
| 14 | #include <linux/irq.h> | 11 | #include <linux/irq.h> |
| 15 | 12 | #include <linux/mm.h> | |
| 13 | #include <linux/vmalloc.h> | ||
| 16 | #include <linux/hdreg.h> | 14 | #include <linux/hdreg.h> |
| 17 | #include <linux/ide.h> | 15 | #include <linux/ide.h> |
| 16 | #include <linux/pm.h> | ||
| 18 | #include <asm/io.h> | 17 | #include <asm/io.h> |
| 19 | #include <asm/hs7751rvoip/hs7751rvoip.h> | 18 | #include <asm/hs7751rvoip/hs7751rvoip.h> |
| 19 | #include <asm/machvec.h> | ||
| 20 | #include <asm/rtc.h> | ||
| 21 | #include <asm/irq.h> | ||
| 20 | 22 | ||
| 21 | #include <linux/mm.h> | 23 | static void __init hs7751rvoip_init_irq(void) |
| 22 | #include <linux/vmalloc.h> | ||
| 23 | |||
| 24 | /* defined in mm/ioremap.c */ | ||
| 25 | extern void * p3_ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags); | ||
| 26 | |||
| 27 | unsigned int debug_counter; | ||
| 28 | |||
| 29 | const char *get_system_type(void) | ||
| 30 | { | 24 | { |
| 31 | return "HS7751RVoIP"; | 25 | #if defined(CONFIG_HS7751RVOIP_CODEC) |
| 26 | make_ipr_irq(DMTE0_IRQ, DMA_IPR_ADDR, DMA_IPR_POS, DMA_PRIORITY); | ||
| 27 | make_ipr_irq(DMTE1_IRQ, DMA_IPR_ADDR, DMA_IPR_POS, DMA_PRIORITY); | ||
| 28 | #endif | ||
| 29 | |||
| 30 | init_hs7751rvoip_IRQ(); | ||
| 32 | } | 31 | } |
| 33 | 32 | ||
| 34 | /* | 33 | static void hs7751rvoip_power_off(void) |
| 35 | * Initialize the board | ||
| 36 | */ | ||
| 37 | void __init platform_setup(void) | ||
| 38 | { | 34 | { |
| 39 | printk(KERN_INFO "Renesas Technology Sales HS7751RVoIP-2 support.\n"); | 35 | ctrl_outw(ctrl_inw(PA_OUTPORTR) & 0xffdf, PA_OUTPORTR); |
| 40 | ctrl_outb(0xf0, PA_OUTPORTR); | ||
| 41 | debug_counter = 0; | ||
| 42 | } | 36 | } |
| 43 | 37 | ||
| 44 | void *area5_io8_base; | 38 | void *area5_io8_base; |
| @@ -46,16 +40,15 @@ void *area6_io8_base; | |||
| 46 | void *area5_io16_base; | 40 | void *area5_io16_base; |
| 47 | void *area6_io16_base; | 41 | void *area6_io16_base; |
| 48 | 42 | ||
| 49 | int __init cf_init(void) | 43 | static int __init hs7751rvoip_cf_init(void) |
| 50 | { | 44 | { |
| 51 | pgprot_t prot; | 45 | pgprot_t prot; |
| 52 | unsigned long paddrbase, psize; | 46 | unsigned long paddrbase; |
| 53 | 47 | ||
| 54 | /* open I/O area window */ | 48 | /* open I/O area window */ |
| 55 | paddrbase = virt_to_phys((void *)(PA_AREA5_IO+0x00000800)); | 49 | paddrbase = virt_to_phys((void *)(PA_AREA5_IO+0x00000800)); |
| 56 | psize = PAGE_SIZE; | ||
| 57 | prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_COM16); | 50 | prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_COM16); |
| 58 | area5_io16_base = p3_ioremap(paddrbase, psize, prot.pgprot); | 51 | area5_io16_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot); |
| 59 | if (!area5_io16_base) { | 52 | if (!area5_io16_base) { |
| 60 | printk("allocate_cf_area : can't open CF I/O window!\n"); | 53 | printk("allocate_cf_area : can't open CF I/O window!\n"); |
| 61 | return -ENOMEM; | 54 | return -ENOMEM; |
| @@ -64,19 +57,18 @@ int __init cf_init(void) | |||
| 64 | /* XXX : do we need attribute and common-memory area also? */ | 57 | /* XXX : do we need attribute and common-memory area also? */ |
| 65 | 58 | ||
| 66 | paddrbase = virt_to_phys((void *)PA_AREA6_IO); | 59 | paddrbase = virt_to_phys((void *)PA_AREA6_IO); |
| 67 | psize = PAGE_SIZE; | ||
| 68 | #if defined(CONFIG_HS7751RVOIP_CODEC) | 60 | #if defined(CONFIG_HS7751RVOIP_CODEC) |
| 69 | prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_COM8); | 61 | prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_COM8); |
| 70 | #else | 62 | #else |
| 71 | prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_IO8); | 63 | prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_IO8); |
| 72 | #endif | 64 | #endif |
| 73 | area6_io8_base = p3_ioremap(paddrbase, psize, prot.pgprot); | 65 | area6_io8_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot); |
| 74 | if (!area6_io8_base) { | 66 | if (!area6_io8_base) { |
| 75 | printk("allocate_cf_area : can't open CODEC I/O 8bit window!\n"); | 67 | printk("allocate_cf_area : can't open CODEC I/O 8bit window!\n"); |
| 76 | return -ENOMEM; | 68 | return -ENOMEM; |
| 77 | } | 69 | } |
| 78 | prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_IO16); | 70 | prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_IO16); |
| 79 | area6_io16_base = p3_ioremap(paddrbase, psize, prot.pgprot); | 71 | area6_io16_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot); |
| 80 | if (!area6_io16_base) { | 72 | if (!area6_io16_base) { |
| 81 | printk("allocate_cf_area : can't open CODEC I/O 16bit window!\n"); | 73 | printk("allocate_cf_area : can't open CODEC I/O 16bit window!\n"); |
| 82 | return -ENOMEM; | 74 | return -ENOMEM; |
| @@ -85,4 +77,46 @@ int __init cf_init(void) | |||
| 85 | return 0; | 77 | return 0; |
| 86 | } | 78 | } |
| 87 | 79 | ||
| 88 | __initcall (cf_init); | 80 | /* |
| 81 | * Initialize the board | ||
| 82 | */ | ||
| 83 | static void __init hs7751rvoip_setup(char **cmdline_p) | ||
| 84 | { | ||
| 85 | device_initcall(hs7751rvoip_cf_init); | ||
| 86 | |||
| 87 | ctrl_outb(0xf0, PA_OUTPORTR); | ||
| 88 | pm_power_off = hs7751rvoip_power_off; | ||
| 89 | |||
| 90 | printk(KERN_INFO "Renesas Technology Sales HS7751RVoIP-2 support.\n"); | ||
| 91 | } | ||
| 92 | |||
| 93 | struct sh_machine_vector mv_hs7751rvoip __initmv = { | ||
| 94 | .mv_name = "HS7751RVoIP", | ||
| 95 | .mv_setup = hs7751rvoip_setup, | ||
| 96 | .mv_nr_irqs = 72, | ||
| 97 | |||
| 98 | .mv_inb = hs7751rvoip_inb, | ||
| 99 | .mv_inw = hs7751rvoip_inw, | ||
| 100 | .mv_inl = hs7751rvoip_inl, | ||
| 101 | .mv_outb = hs7751rvoip_outb, | ||
| 102 | .mv_outw = hs7751rvoip_outw, | ||
| 103 | .mv_outl = hs7751rvoip_outl, | ||
| 104 | |||
| 105 | .mv_inb_p = hs7751rvoip_inb_p, | ||
| 106 | .mv_inw_p = hs7751rvoip_inw, | ||
| 107 | .mv_inl_p = hs7751rvoip_inl, | ||
| 108 | .mv_outb_p = hs7751rvoip_outb_p, | ||
| 109 | .mv_outw_p = hs7751rvoip_outw, | ||
| 110 | .mv_outl_p = hs7751rvoip_outl, | ||
| 111 | |||
| 112 | .mv_insb = hs7751rvoip_insb, | ||
| 113 | .mv_insw = hs7751rvoip_insw, | ||
| 114 | .mv_insl = hs7751rvoip_insl, | ||
| 115 | .mv_outsb = hs7751rvoip_outsb, | ||
| 116 | .mv_outsw = hs7751rvoip_outsw, | ||
| 117 | .mv_outsl = hs7751rvoip_outsl, | ||
| 118 | |||
| 119 | .mv_init_irq = hs7751rvoip_init_irq, | ||
| 120 | .mv_ioport_map = hs7751rvoip_ioport_map, | ||
| 121 | }; | ||
| 122 | ALIAS_MV(hs7751rvoip) | ||
diff --git a/arch/sh/boards/renesas/r7780rp/Kconfig b/arch/sh/boards/renesas/r7780rp/Kconfig new file mode 100644 index 000000000000..c26d9813d239 --- /dev/null +++ b/arch/sh/boards/renesas/r7780rp/Kconfig | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | if SH_R7780RP | ||
| 2 | |||
| 3 | menu "R7780RP options" | ||
| 4 | |||
| 5 | config SH_R7780MP | ||
| 6 | bool "R7780MP board support" | ||
| 7 | default y | ||
| 8 | help | ||
| 9 | Selecting this option will enable support for the mass-production | ||
| 10 | version of the R7780RP. If in doubt, say Y. | ||
| 11 | |||
| 12 | endmenu | ||
| 13 | |||
| 14 | endif | ||
diff --git a/arch/sh/boards/renesas/r7780rp/Makefile b/arch/sh/boards/renesas/r7780rp/Makefile new file mode 100644 index 000000000000..f1776d027978 --- /dev/null +++ b/arch/sh/boards/renesas/r7780rp/Makefile | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | # | ||
| 2 | # Makefile for the R7780RP-1 specific parts of the kernel | ||
| 3 | # | ||
| 4 | |||
| 5 | obj-y := setup.o io.o irq.o | ||
| 6 | obj-$(CONFIG_HEARTBEAT) += led.o | ||
diff --git a/arch/sh/boards/renesas/r7780rp/io.c b/arch/sh/boards/renesas/r7780rp/io.c new file mode 100644 index 000000000000..db92d6e6ae99 --- /dev/null +++ b/arch/sh/boards/renesas/r7780rp/io.c | |||
| @@ -0,0 +1,301 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2001 Ian da Silva, Jeremy Siegel | ||
| 3 | * Based largely on io_se.c. | ||
| 4 | * | ||
| 5 | * I/O routine for Renesas Solutions Highlander R7780RP-1 | ||
| 6 | * | ||
| 7 | * Initial version only to support LAN access; some | ||
| 8 | * placeholder code from io_r7780rp.c left in with the | ||
| 9 | * expectation of later SuperIO and PCMCIA access. | ||
| 10 | */ | ||
| 11 | #include <linux/pci.h> | ||
| 12 | #include <linux/kernel.h> | ||
| 13 | #include <linux/types.h> | ||
| 14 | #include <asm/r7780rp/r7780rp.h> | ||
| 15 | #include <asm/addrspace.h> | ||
| 16 | #include <asm/io.h> | ||
| 17 | |||
| 18 | static inline unsigned long port2adr(unsigned int port) | ||
| 19 | { | ||
| 20 | if ((0x1f0 <= port && port < 0x1f8) || port == 0x3f6) | ||
| 21 | if (port == 0x3f6) | ||
| 22 | return (PA_AREA5_IO + 0x80c); | ||
| 23 | else | ||
| 24 | return (PA_AREA5_IO + 0x1000 + ((port-0x1f0) << 1)); | ||
| 25 | else | ||
| 26 | maybebadio((unsigned long)port); | ||
| 27 | |||
| 28 | return port; | ||
| 29 | } | ||
| 30 | |||
| 31 | static inline unsigned long port88796l(unsigned int port, int flag) | ||
| 32 | { | ||
| 33 | unsigned long addr; | ||
| 34 | |||
| 35 | if (flag) | ||
| 36 | addr = PA_AX88796L + ((port - AX88796L_IO_BASE) << 1); | ||
| 37 | else | ||
| 38 | addr = PA_AX88796L + ((port - AX88796L_IO_BASE) << 1) + 0x1000; | ||
| 39 | |||
| 40 | return addr; | ||
| 41 | } | ||
| 42 | |||
| 43 | /* The 7780 R7780RP-1 seems to have everything hooked */ | ||
| 44 | /* up pretty normally (nothing on high-bytes only...) so this */ | ||
| 45 | /* shouldn't be needed */ | ||
| 46 | static inline int shifted_port(unsigned long port) | ||
| 47 | { | ||
| 48 | /* For IDE registers, value is not shifted */ | ||
| 49 | if ((0x1f0 <= port && port < 0x1f8) || port == 0x3f6) | ||
| 50 | return 0; | ||
| 51 | else | ||
| 52 | return 1; | ||
| 53 | } | ||
| 54 | |||
| 55 | #if defined(CONFIG_NE2000) || defined(CONFIG_NE2000_MODULE) | ||
| 56 | #define CHECK_AX88796L_PORT(port) \ | ||
| 57 | ((port >= AX88796L_IO_BASE) && (port < (AX88796L_IO_BASE+0x20))) | ||
| 58 | #else | ||
| 59 | #define CHECK_AX88796L_PORT(port) (0) | ||
| 60 | #endif | ||
| 61 | |||
| 62 | /* | ||
| 63 | * General outline: remap really low stuff [eventually] to SuperIO, | ||
| 64 | * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO) | ||
| 65 | * is mapped through the PCI IO window. Stuff with high bits (PXSEG) | ||
| 66 | * should be way beyond the window, and is used w/o translation for | ||
| 67 | * compatibility. | ||
| 68 | */ | ||
| 69 | u8 r7780rp_inb(unsigned long port) | ||
| 70 | { | ||
| 71 | if (CHECK_AX88796L_PORT(port)) | ||
| 72 | return ctrl_inw(port88796l(port, 0)) & 0xff; | ||
| 73 | else if (PXSEG(port)) | ||
| 74 | return ctrl_inb(port); | ||
| 75 | else if (is_pci_ioaddr(port) || shifted_port(port)) | ||
| 76 | return ctrl_inb(pci_ioaddr(port)); | ||
| 77 | |||
| 78 | return ctrl_inw(port2adr(port)) & 0xff; | ||
| 79 | } | ||
| 80 | |||
| 81 | u8 r7780rp_inb_p(unsigned long port) | ||
| 82 | { | ||
| 83 | u8 v; | ||
| 84 | |||
| 85 | if (CHECK_AX88796L_PORT(port)) | ||
| 86 | v = ctrl_inw(port88796l(port, 0)) & 0xff; | ||
| 87 | else if (PXSEG(port)) | ||
| 88 | v = ctrl_inb(port); | ||
| 89 | else if (is_pci_ioaddr(port) || shifted_port(port)) | ||
| 90 | v = ctrl_inb(pci_ioaddr(port)); | ||
| 91 | else | ||
| 92 | v = ctrl_inw(port2adr(port)) & 0xff; | ||
| 93 | |||
| 94 | ctrl_delay(); | ||
| 95 | |||
| 96 | return v; | ||
| 97 | } | ||
| 98 | |||
| 99 | u16 r7780rp_inw(unsigned long port) | ||
| 100 | { | ||
| 101 | if (CHECK_AX88796L_PORT(port)) | ||
| 102 | maybebadio(port); | ||
| 103 | else if (PXSEG(port)) | ||
| 104 | return ctrl_inw(port); | ||
| 105 | else if (is_pci_ioaddr(port) || shifted_port(port)) | ||
| 106 | return ctrl_inw(pci_ioaddr(port)); | ||
| 107 | else | ||
| 108 | maybebadio(port); | ||
| 109 | |||
| 110 | return 0; | ||
| 111 | } | ||
| 112 | |||
| 113 | u32 r7780rp_inl(unsigned long port) | ||
| 114 | { | ||
| 115 | if (CHECK_AX88796L_PORT(port)) | ||
| 116 | maybebadio(port); | ||
| 117 | else if (PXSEG(port)) | ||
| 118 | return ctrl_inl(port); | ||
| 119 | else if (is_pci_ioaddr(port) || shifted_port(port)) | ||
| 120 | return ctrl_inl(pci_ioaddr(port)); | ||
| 121 | else | ||
| 122 | maybebadio(port); | ||
| 123 | |||
| 124 | return 0; | ||
| 125 | } | ||
| 126 | |||
| 127 | void r7780rp_outb(u8 value, unsigned long port) | ||
| 128 | { | ||
| 129 | if (CHECK_AX88796L_PORT(port)) | ||
| 130 | ctrl_outw(value, port88796l(port, 0)); | ||
| 131 | else if (PXSEG(port)) | ||
| 132 | ctrl_outb(value, port); | ||
| 133 | else if (is_pci_ioaddr(port) || shifted_port(port)) | ||
| 134 | ctrl_outb(value, pci_ioaddr(port)); | ||
| 135 | else | ||
| 136 | ctrl_outw(value, port2adr(port)); | ||
| 137 | } | ||
| 138 | |||
| 139 | void r7780rp_outb_p(u8 value, unsigned long port) | ||
| 140 | { | ||
| 141 | if (CHECK_AX88796L_PORT(port)) | ||
| 142 | ctrl_outw(value, port88796l(port, 0)); | ||
| 143 | else if (PXSEG(port)) | ||
| 144 | ctrl_outb(value, port); | ||
| 145 | else if (is_pci_ioaddr(port) || shifted_port(port)) | ||
| 146 | ctrl_outb(value, pci_ioaddr(port)); | ||
| 147 | else | ||
| 148 | ctrl_outw(value, port2adr(port)); | ||
| 149 | |||
| 150 | ctrl_delay(); | ||
| 151 | } | ||
| 152 | |||
| 153 | void r7780rp_outw(u16 value, unsigned long port) | ||
| 154 | { | ||
| 155 | if (CHECK_AX88796L_PORT(port)) | ||
| 156 | maybebadio(port); | ||
| 157 | else if (PXSEG(port)) | ||
| 158 | ctrl_outw(value, port); | ||
| 159 | else if (is_pci_ioaddr(port) || shifted_port(port)) | ||
| 160 | ctrl_outw(value, pci_ioaddr(port)); | ||
| 161 | else | ||
| 162 | maybebadio(port); | ||
| 163 | } | ||
| 164 | |||
| 165 | void r7780rp_outl(u32 value, unsigned long port) | ||
| 166 | { | ||
| 167 | if (CHECK_AX88796L_PORT(port)) | ||
| 168 | maybebadio(port); | ||
| 169 | else if (PXSEG(port)) | ||
| 170 | ctrl_outl(value, port); | ||
| 171 | else if (is_pci_ioaddr(port) || shifted_port(port)) | ||
| 172 | ctrl_outl(value, pci_ioaddr(port)); | ||
| 173 | else | ||
| 174 | maybebadio(port); | ||
| 175 | } | ||
| 176 | |||
| 177 | void r7780rp_insb(unsigned long port, void *dst, unsigned long count) | ||
| 178 | { | ||
| 179 | volatile u16 *p; | ||
| 180 | u8 *buf = dst; | ||
| 181 | |||
| 182 | if (CHECK_AX88796L_PORT(port)) { | ||
| 183 | p = (volatile u16 *)port88796l(port, 0); | ||
| 184 | while (count--) | ||
| 185 | *buf++ = *p & 0xff; | ||
| 186 | } else if (PXSEG(port)) { | ||
| 187 | while (count--) | ||
| 188 | *buf++ = *(volatile u8 *)port; | ||
| 189 | } else if (is_pci_ioaddr(port) || shifted_port(port)) { | ||
| 190 | volatile u8 *bp = (volatile u8 *)pci_ioaddr(port); | ||
| 191 | |||
| 192 | while (count--) | ||
| 193 | *buf++ = *bp; | ||
| 194 | } else { | ||
| 195 | p = (volatile u16 *)port2adr(port); | ||
| 196 | while (count--) | ||
| 197 | *buf++ = *p & 0xff; | ||
| 198 | } | ||
| 199 | } | ||
| 200 | |||
| 201 | void r7780rp_insw(unsigned long port, void *dst, unsigned long count) | ||
| 202 | { | ||
| 203 | volatile u16 *p; | ||
| 204 | u16 *buf = dst; | ||
| 205 | |||
| 206 | if (CHECK_AX88796L_PORT(port)) | ||
| 207 | p = (volatile u16 *)port88796l(port, 1); | ||
| 208 | else if (PXSEG(port)) | ||
| 209 | p = (volatile u16 *)port; | ||
| 210 | else if (is_pci_ioaddr(port) || shifted_port(port)) | ||
| 211 | p = (volatile u16 *)pci_ioaddr(port); | ||
| 212 | else | ||
| 213 | p = (volatile u16 *)port2adr(port); | ||
| 214 | |||
| 215 | while (count--) | ||
| 216 | *buf++ = *p; | ||
| 217 | } | ||
| 218 | |||
| 219 | void r7780rp_insl(unsigned long port, void *dst, unsigned long count) | ||
| 220 | { | ||
| 221 | u32 *buf = dst; | ||
| 222 | |||
| 223 | if (CHECK_AX88796L_PORT(port)) | ||
| 224 | maybebadio(port); | ||
| 225 | else if (is_pci_ioaddr(port) || shifted_port(port)) { | ||
| 226 | volatile u32 *p = (volatile u32 *)pci_ioaddr(port); | ||
| 227 | |||
| 228 | while (count--) | ||
| 229 | *buf++ = *p; | ||
| 230 | } else | ||
| 231 | maybebadio(port); | ||
| 232 | } | ||
| 233 | |||
| 234 | void r7780rp_outsb(unsigned long port, const void *src, unsigned long count) | ||
| 235 | { | ||
| 236 | volatile u16 *p; | ||
| 237 | const u8 *buf = src; | ||
| 238 | |||
| 239 | if (CHECK_AX88796L_PORT(port)) { | ||
| 240 | p = (volatile u16 *)port88796l(port, 0); | ||
| 241 | while (count--) | ||
| 242 | *p = *buf++; | ||
| 243 | } else if (PXSEG(port)) | ||
| 244 | while (count--) | ||
| 245 | ctrl_outb(*buf++, port); | ||
| 246 | else if (is_pci_ioaddr(port) || shifted_port(port)) { | ||
| 247 | volatile u8 *bp = (volatile u8 *)pci_ioaddr(port); | ||
| 248 | |||
| 249 | while (count--) | ||
| 250 | *bp = *buf++; | ||
| 251 | } else { | ||
| 252 | p = (volatile u16 *)port2adr(port); | ||
| 253 | while (count--) | ||
| 254 | *p = *buf++; | ||
| 255 | } | ||
| 256 | } | ||
| 257 | |||
| 258 | void r7780rp_outsw(unsigned long port, const void *src, unsigned long count) | ||
| 259 | { | ||
| 260 | volatile u16 *p; | ||
| 261 | const u16 *buf = src; | ||
| 262 | |||
| 263 | if (CHECK_AX88796L_PORT(port)) | ||
| 264 | p = (volatile u16 *)port88796l(port, 1); | ||
| 265 | else if (PXSEG(port)) | ||
| 266 | p = (volatile u16 *)port; | ||
| 267 | else if (is_pci_ioaddr(port) || shifted_port(port)) | ||
| 268 | p = (volatile u16 *)pci_ioaddr(port); | ||
| 269 | else | ||
| 270 | p = (volatile u16 *)port2adr(port); | ||
| 271 | |||
| 272 | while (count--) | ||
| 273 | *p = *buf++; | ||
| 274 | } | ||
| 275 | |||
| 276 | void r7780rp_outsl(unsigned long port, const void *src, unsigned long count) | ||
| 277 | { | ||
| 278 | const u32 *buf = src; | ||
| 279 | |||
| 280 | if (CHECK_AX88796L_PORT(port)) | ||
| 281 | maybebadio(port); | ||
| 282 | else if (is_pci_ioaddr(port) || shifted_port(port)) { | ||
| 283 | volatile u32 *p = (volatile u32 *)pci_ioaddr(port); | ||
| 284 | |||
| 285 | while (count--) | ||
| 286 | *p = *buf++; | ||
| 287 | } else | ||
| 288 | maybebadio(port); | ||
| 289 | } | ||
| 290 | |||
| 291 | void __iomem *r7780rp_ioport_map(unsigned long port, unsigned int size) | ||
| 292 | { | ||
| 293 | if (CHECK_AX88796L_PORT(port)) | ||
| 294 | return (void __iomem *)port88796l(port, size > 1); | ||
| 295 | else if (PXSEG(port)) | ||
| 296 | return (void __iomem *)port; | ||
| 297 | else if (is_pci_ioaddr(port) || shifted_port(port)) | ||
| 298 | return (void __iomem *)pci_ioaddr(port); | ||
| 299 | |||
| 300 | return (void __iomem *)port2adr(port); | ||
| 301 | } | ||
diff --git a/arch/sh/boards/renesas/r7780rp/irq.c b/arch/sh/boards/renesas/r7780rp/irq.c new file mode 100644 index 000000000000..61d5e5d3c294 --- /dev/null +++ b/arch/sh/boards/renesas/r7780rp/irq.c | |||
| @@ -0,0 +1,117 @@ | |||
| 1 | /* | ||
| 2 | * linux/arch/sh/boards/renesas/r7780rp/irq.c | ||
| 3 | * | ||
| 4 | * Copyright (C) 2000 Kazumoto Kojima | ||
| 5 | * | ||
| 6 | * Renesas Solutions Highlander R7780RP-1 Support. | ||
| 7 | * | ||
| 8 | * Modified for R7780RP-1 by | ||
| 9 | * Atom Create Engineering Co., Ltd. 2002. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/config.h> | ||
| 13 | #include <linux/init.h> | ||
| 14 | #include <linux/irq.h> | ||
| 15 | #include <asm/io.h> | ||
| 16 | #include <asm/irq.h> | ||
| 17 | #include <asm/r7780rp/r7780rp.h> | ||
| 18 | |||
| 19 | #ifdef CONFIG_SH_R7780MP | ||
| 20 | static int mask_pos[] = {12, 11, 9, 14, 15, 8, 13, 6, 5, 4, 3, 2, 0, 0, 1, 0}; | ||
| 21 | #else | ||
| 22 | static int mask_pos[] = {15, 14, 13, 12, 11, 10, 9, 8, 7, 5, 6, 4, 0, 1, 2, 0}; | ||
| 23 | #endif | ||
| 24 | |||
| 25 | static void enable_r7780rp_irq(unsigned int irq); | ||
| 26 | static void disable_r7780rp_irq(unsigned int irq); | ||
| 27 | |||
| 28 | /* shutdown is same as "disable" */ | ||
| 29 | #define shutdown_r7780rp_irq disable_r7780rp_irq | ||
| 30 | |||
| 31 | static void ack_r7780rp_irq(unsigned int irq); | ||
| 32 | static void end_r7780rp_irq(unsigned int irq); | ||
| 33 | |||
| 34 | static unsigned int startup_r7780rp_irq(unsigned int irq) | ||
| 35 | { | ||
| 36 | enable_r7780rp_irq(irq); | ||
| 37 | return 0; /* never anything pending */ | ||
| 38 | } | ||
| 39 | |||
| 40 | static void disable_r7780rp_irq(unsigned int irq) | ||
| 41 | { | ||
| 42 | unsigned short val; | ||
| 43 | unsigned short mask = 0xffff ^ (0x0001 << mask_pos[irq]); | ||
| 44 | |||
| 45 | /* Set the priority in IPR to 0 */ | ||
| 46 | val = ctrl_inw(IRLCNTR1); | ||
| 47 | val &= mask; | ||
| 48 | ctrl_outw(val, IRLCNTR1); | ||
| 49 | } | ||
| 50 | |||
| 51 | static void enable_r7780rp_irq(unsigned int irq) | ||
| 52 | { | ||
| 53 | unsigned short val; | ||
| 54 | unsigned short value = (0x0001 << mask_pos[irq]); | ||
| 55 | |||
| 56 | /* Set priority in IPR back to original value */ | ||
| 57 | val = ctrl_inw(IRLCNTR1); | ||
| 58 | val |= value; | ||
| 59 | ctrl_outw(val, IRLCNTR1); | ||
| 60 | } | ||
| 61 | |||
| 62 | static void ack_r7780rp_irq(unsigned int irq) | ||
| 63 | { | ||
| 64 | disable_r7780rp_irq(irq); | ||
| 65 | } | ||
| 66 | |||
| 67 | static void end_r7780rp_irq(unsigned int irq) | ||
| 68 | { | ||
| 69 | if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) | ||
| 70 | enable_r7780rp_irq(irq); | ||
| 71 | } | ||
| 72 | |||
| 73 | static struct hw_interrupt_type r7780rp_irq_type = { | ||
| 74 | .typename = "R7780RP-IRQ", | ||
| 75 | .startup = startup_r7780rp_irq, | ||
| 76 | .shutdown = shutdown_r7780rp_irq, | ||
| 77 | .enable = enable_r7780rp_irq, | ||
| 78 | .disable = disable_r7780rp_irq, | ||
| 79 | .ack = ack_r7780rp_irq, | ||
| 80 | .end = end_r7780rp_irq, | ||
| 81 | }; | ||
| 82 | |||
| 83 | static void make_r7780rp_irq(unsigned int irq) | ||
| 84 | { | ||
| 85 | disable_irq_nosync(irq); | ||
| 86 | irq_desc[irq].handler = &r7780rp_irq_type; | ||
| 87 | disable_r7780rp_irq(irq); | ||
| 88 | } | ||
| 89 | |||
| 90 | /* | ||
| 91 | * Initialize IRQ setting | ||
| 92 | */ | ||
| 93 | void __init init_r7780rp_IRQ(void) | ||
| 94 | { | ||
| 95 | int i; | ||
| 96 | |||
| 97 | /* IRL0=PCI Slot #A | ||
| 98 | * IRL1=PCI Slot #B | ||
| 99 | * IRL2=PCI Slot #C | ||
| 100 | * IRL3=PCI Slot #D | ||
| 101 | * IRL4=CF Card | ||
| 102 | * IRL5=CF Card Insert | ||
| 103 | * IRL6=M66596 | ||
| 104 | * IRL7=SD Card | ||
| 105 | * IRL8=Touch Panel | ||
| 106 | * IRL9=SCI | ||
| 107 | * IRL10=Serial | ||
| 108 | * IRL11=Extention #A | ||
| 109 | * IRL11=Extention #B | ||
| 110 | * IRL12=Debug LAN | ||
| 111 | * IRL13=Push Switch | ||
| 112 | * IRL14=ZiggBee IO | ||
| 113 | */ | ||
| 114 | |||
| 115 | for (i=0; i<15; i++) | ||
| 116 | make_r7780rp_irq(i); | ||
| 117 | } | ||
diff --git a/arch/sh/boards/renesas/r7780rp/led.c b/arch/sh/boards/renesas/r7780rp/led.c new file mode 100644 index 000000000000..9f02766b6f53 --- /dev/null +++ b/arch/sh/boards/renesas/r7780rp/led.c | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) Atom Create Engineering Co., Ltd. | ||
| 3 | * | ||
| 4 | * May be copied or modified under the terms of GNU General Public | ||
| 5 | * License. See linux/COPYING for more information. | ||
| 6 | * | ||
| 7 | * This file contains Renesas Solutions HIGHLANDER R7780RP-1 specific LED code. | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include <linux/config.h> | ||
| 11 | #include <linux/sched.h> | ||
| 12 | #include <asm/io.h> | ||
| 13 | #include <asm/r7780rp/r7780rp.h> | ||
| 14 | |||
| 15 | /* Cycle the LED's in the clasic Knightriger/Sun pattern */ | ||
| 16 | void heartbeat_r7780rp(void) | ||
| 17 | { | ||
| 18 | static unsigned int cnt = 0, period = 0; | ||
| 19 | volatile unsigned short *p = (volatile unsigned short *)PA_OBLED; | ||
| 20 | static unsigned bit = 0, up = 1; | ||
| 21 | unsigned bit_pos[] = {2, 1, 0, 3, 6, 5, 4, 7}; | ||
| 22 | |||
| 23 | cnt += 1; | ||
| 24 | if (cnt < period) | ||
| 25 | return; | ||
| 26 | |||
| 27 | cnt = 0; | ||
| 28 | |||
| 29 | /* Go through the points (roughly!): | ||
| 30 | * f(0)=10, f(1)=16, f(2)=20, f(5)=35, f(int)->110 | ||
| 31 | */ | ||
| 32 | period = 110 - ((300 << FSHIFT)/((avenrun[0]/5) + (3<<FSHIFT))); | ||
| 33 | |||
| 34 | *p = 1 << bit_pos[bit]; | ||
| 35 | if (up) | ||
| 36 | if (bit == 7) { | ||
| 37 | bit--; | ||
| 38 | up = 0; | ||
| 39 | } else | ||
| 40 | bit++; | ||
| 41 | else if (bit == 0) | ||
| 42 | up = 1; | ||
| 43 | else | ||
| 44 | bit--; | ||
| 45 | } | ||
diff --git a/arch/sh/boards/renesas/r7780rp/setup.c b/arch/sh/boards/renesas/r7780rp/setup.c new file mode 100644 index 000000000000..b941aa0aa34e --- /dev/null +++ b/arch/sh/boards/renesas/r7780rp/setup.c | |||
| @@ -0,0 +1,163 @@ | |||
| 1 | /* | ||
| 2 | * arch/sh/boards/renesas/r7780rp/setup.c | ||
| 3 | * | ||
| 4 | * Copyright (C) 2002 Atom Create Engineering Co., Ltd. | ||
| 5 | * Copyright (C) 2005, 2006 Paul Mundt | ||
| 6 | * | ||
| 7 | * Renesas Solutions Highlander R7780RP-1 Support. | ||
| 8 | * | ||
| 9 | * This file is subject to the terms and conditions of the GNU General Public | ||
| 10 | * License. See the file "COPYING" in the main directory of this archive | ||
| 11 | * for more details. | ||
| 12 | */ | ||
| 13 | #include <linux/init.h> | ||
| 14 | #include <linux/platform_device.h> | ||
| 15 | #include <asm/machvec.h> | ||
| 16 | #include <asm/r7780rp/r7780rp.h> | ||
| 17 | #include <asm/clock.h> | ||
| 18 | #include <asm/io.h> | ||
| 19 | |||
| 20 | extern void heartbeat_r7780rp(void); | ||
| 21 | extern void init_r7780rp_IRQ(void); | ||
| 22 | |||
| 23 | static struct resource m66596_usb_host_resources[] = { | ||
| 24 | [0] = { | ||
| 25 | .start = 0xa4800000, | ||
| 26 | .end = 0xa4ffffff, | ||
| 27 | .flags = IORESOURCE_MEM, | ||
| 28 | }, | ||
| 29 | [1] = { | ||
| 30 | .start = 6, /* irq number */ | ||
| 31 | .end = 6, | ||
| 32 | .flags = IORESOURCE_IRQ, | ||
| 33 | }, | ||
| 34 | }; | ||
| 35 | |||
| 36 | static struct platform_device m66596_usb_host_device = { | ||
| 37 | .name = "m66596-hcd", | ||
| 38 | .id = 0, | ||
| 39 | .dev = { | ||
| 40 | .dma_mask = NULL, /* don't use dma */ | ||
| 41 | .coherent_dma_mask = 0xffffffff, | ||
| 42 | }, | ||
| 43 | .num_resources = ARRAY_SIZE(m66596_usb_host_resources), | ||
| 44 | .resource = m66596_usb_host_resources, | ||
| 45 | }; | ||
| 46 | |||
| 47 | static struct platform_device *r7780rp_devices[] __initdata = { | ||
| 48 | &m66596_usb_host_device, | ||
| 49 | }; | ||
| 50 | |||
| 51 | static int __init r7780rp_devices_setup(void) | ||
| 52 | { | ||
| 53 | return platform_add_devices(r7780rp_devices, | ||
| 54 | ARRAY_SIZE(r7780rp_devices)); | ||
| 55 | } | ||
| 56 | |||
| 57 | /* | ||
| 58 | * Platform specific clocks | ||
| 59 | */ | ||
| 60 | static void ivdr_clk_enable(struct clk *clk) | ||
| 61 | { | ||
| 62 | ctrl_outw(ctrl_inw(PA_IVDRCTL) | (1 << 8), PA_IVDRCTL); | ||
| 63 | } | ||
| 64 | |||
| 65 | static void ivdr_clk_disable(struct clk *clk) | ||
| 66 | { | ||
| 67 | ctrl_outw(ctrl_inw(PA_IVDRCTL) & ~(1 << 8), PA_IVDRCTL); | ||
| 68 | } | ||
| 69 | |||
| 70 | static struct clk_ops ivdr_clk_ops = { | ||
| 71 | .enable = ivdr_clk_enable, | ||
| 72 | .disable = ivdr_clk_disable, | ||
| 73 | }; | ||
| 74 | |||
| 75 | static struct clk ivdr_clk = { | ||
| 76 | .name = "ivdr_clk", | ||
| 77 | .ops = &ivdr_clk_ops, | ||
| 78 | }; | ||
| 79 | |||
| 80 | static struct clk *r7780rp_clocks[] = { | ||
| 81 | &ivdr_clk, | ||
| 82 | }; | ||
| 83 | |||
| 84 | static void r7780rp_power_off(void) | ||
| 85 | { | ||
| 86 | #ifdef CONFIG_SH_R7780MP | ||
| 87 | ctrl_outw(0x0001, PA_POFF); | ||
| 88 | #endif | ||
| 89 | } | ||
| 90 | |||
| 91 | /* | ||
| 92 | * Initialize the board | ||
| 93 | */ | ||
| 94 | static void __init r7780rp_setup(char **cmdline_p) | ||
| 95 | { | ||
| 96 | u16 ver = ctrl_inw(PA_VERREG); | ||
| 97 | int i; | ||
| 98 | |||
| 99 | device_initcall(r7780rp_devices_setup); | ||
| 100 | |||
| 101 | printk(KERN_INFO "Renesas Solutions Highlander R7780RP-1 support.\n"); | ||
| 102 | |||
| 103 | printk(KERN_INFO "Board version: %d (revision %d), " | ||
| 104 | "FPGA version: %d (revision %d)\n", | ||
| 105 | (ver >> 12) & 0xf, (ver >> 8) & 0xf, | ||
| 106 | (ver >> 4) & 0xf, ver & 0xf); | ||
| 107 | |||
| 108 | /* | ||
| 109 | * Enable the important clocks right away.. | ||
| 110 | */ | ||
| 111 | for (i = 0; i < ARRAY_SIZE(r7780rp_clocks); i++) { | ||
| 112 | struct clk *clk = r7780rp_clocks[i]; | ||
| 113 | |||
| 114 | clk_register(clk); | ||
| 115 | clk_enable(clk); | ||
| 116 | } | ||
| 117 | |||
| 118 | ctrl_outw(0x0000, PA_OBLED); /* Clear LED. */ | ||
| 119 | #ifndef CONFIG_SH_R7780MP | ||
| 120 | ctrl_outw(0x0001, PA_SDPOW); /* SD Power ON */ | ||
| 121 | #endif | ||
| 122 | ctrl_outw(ctrl_inw(PA_IVDRCTL) | 0x0100, PA_IVDRCTL); /* Si13112 */ | ||
| 123 | |||
| 124 | pm_power_off = r7780rp_power_off; | ||
| 125 | } | ||
| 126 | |||
| 127 | /* | ||
| 128 | * The Machine Vector | ||
| 129 | */ | ||
| 130 | struct sh_machine_vector mv_r7780rp __initmv = { | ||
| 131 | .mv_name = "Highlander R7780RP-1", | ||
| 132 | .mv_setup = r7780rp_setup, | ||
| 133 | |||
| 134 | .mv_nr_irqs = 109, | ||
| 135 | |||
| 136 | .mv_inb = r7780rp_inb, | ||
| 137 | .mv_inw = r7780rp_inw, | ||
| 138 | .mv_inl = r7780rp_inl, | ||
| 139 | .mv_outb = r7780rp_outb, | ||
| 140 | .mv_outw = r7780rp_outw, | ||
| 141 | .mv_outl = r7780rp_outl, | ||
| 142 | |||
| 143 | .mv_inb_p = r7780rp_inb_p, | ||
| 144 | .mv_inw_p = r7780rp_inw, | ||
| 145 | .mv_inl_p = r7780rp_inl, | ||
| 146 | .mv_outb_p = r7780rp_outb_p, | ||
| 147 | .mv_outw_p = r7780rp_outw, | ||
| 148 | .mv_outl_p = r7780rp_outl, | ||
| 149 | |||
| 150 | .mv_insb = r7780rp_insb, | ||
| 151 | .mv_insw = r7780rp_insw, | ||
| 152 | .mv_insl = r7780rp_insl, | ||
| 153 | .mv_outsb = r7780rp_outsb, | ||
| 154 | .mv_outsw = r7780rp_outsw, | ||
| 155 | .mv_outsl = r7780rp_outsl, | ||
| 156 | |||
| 157 | .mv_ioport_map = r7780rp_ioport_map, | ||
| 158 | .mv_init_irq = init_r7780rp_IRQ, | ||
| 159 | #ifdef CONFIG_HEARTBEAT | ||
| 160 | .mv_heartbeat = heartbeat_r7780rp, | ||
| 161 | #endif | ||
| 162 | }; | ||
| 163 | ALIAS_MV(r7780rp) | ||
diff --git a/arch/sh/boards/renesas/rts7751r2d/Kconfig b/arch/sh/boards/renesas/rts7751r2d/Kconfig new file mode 100644 index 000000000000..7780d1fb13ff --- /dev/null +++ b/arch/sh/boards/renesas/rts7751r2d/Kconfig | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | if SH_RTS7751R2D | ||
| 2 | |||
| 3 | menu "RTS7751R2D options" | ||
| 4 | |||
| 5 | config RTS7751R2D_REV11 | ||
| 6 | bool "RTS7751R2D Rev. 1.1 board support" | ||
| 7 | help | ||
| 8 | Selecting this option will support version rev. 1.1. | ||
| 9 | endmenu | ||
| 10 | |||
| 11 | endif | ||
| 12 | |||
diff --git a/arch/sh/boards/renesas/rts7751r2d/Makefile b/arch/sh/boards/renesas/rts7751r2d/Makefile index daa53334bdc3..686fc9ea5989 100644 --- a/arch/sh/boards/renesas/rts7751r2d/Makefile +++ b/arch/sh/boards/renesas/rts7751r2d/Makefile | |||
| @@ -1,10 +1,6 @@ | |||
| 1 | # | 1 | # |
| 2 | # Makefile for the RTS7751R2D specific parts of the kernel | 2 | # Makefile for the RTS7751R2D specific parts of the kernel |
| 3 | # | 3 | # |
| 4 | # Note! Dependencies are done automagically by 'make dep', which also | ||
| 5 | # removes any old dependencies. DON'T put your own dependencies here | ||
| 6 | # unless it's something special (ie not a .c file). | ||
| 7 | # | ||
| 8 | |||
| 9 | obj-y := mach.o setup.o io.o irq.o led.o | ||
| 10 | 4 | ||
| 5 | obj-y := setup.o io.o irq.o | ||
| 6 | obj-$(CONFIG_HEARTBEAT) += led.o | ||
diff --git a/arch/sh/boards/renesas/rts7751r2d/io.c b/arch/sh/boards/renesas/rts7751r2d/io.c index 123abbbc91e0..135aa0b5e62d 100644 --- a/arch/sh/boards/renesas/rts7751r2d/io.c +++ b/arch/sh/boards/renesas/rts7751r2d/io.c | |||
| @@ -1,6 +1,4 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * linux/arch/sh/kernel/io_rts7751r2d.c | ||
| 3 | * | ||
| 4 | * Copyright (C) 2001 Ian da Silva, Jeremy Siegel | 2 | * Copyright (C) 2001 Ian da Silva, Jeremy Siegel |
| 5 | * Based largely on io_se.c. | 3 | * Based largely on io_se.c. |
| 6 | * | 4 | * |
| @@ -10,17 +8,13 @@ | |||
| 10 | * placeholder code from io_rts7751r2d.c left in with the | 8 | * placeholder code from io_rts7751r2d.c left in with the |
| 11 | * expectation of later SuperIO and PCMCIA access. | 9 | * expectation of later SuperIO and PCMCIA access. |
| 12 | */ | 10 | */ |
| 13 | |||
| 14 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
| 15 | #include <linux/types.h> | 12 | #include <linux/types.h> |
| 16 | #include <asm/io.h> | 13 | #include <linux/pci.h> |
| 17 | #include <asm/rts7751r2d/rts7751r2d.h> | 14 | #include <asm/rts7751r2d/rts7751r2d.h> |
| 15 | #include <asm/io.h> | ||
| 18 | #include <asm/addrspace.h> | 16 | #include <asm/addrspace.h> |
| 19 | 17 | ||
| 20 | #include <linux/module.h> | ||
| 21 | #include <linux/pci.h> | ||
| 22 | #include "../../../drivers/pci/pci-sh7751.h" | ||
| 23 | |||
| 24 | /* | 18 | /* |
| 25 | * The 7751R RTS7751R2D uses the built-in PCI controller (PCIC) | 19 | * The 7751R RTS7751R2D uses the built-in PCI controller (PCIC) |
| 26 | * of the 7751R processor, and has a SuperIO accessible via the PCI. | 20 | * of the 7751R processor, and has a SuperIO accessible via the PCI. |
| @@ -28,22 +22,6 @@ | |||
| 28 | * like the other Solution Engine boards. | 22 | * like the other Solution Engine boards. |
| 29 | */ | 23 | */ |
| 30 | 24 | ||
| 31 | #define PCIIOBR (volatile long *)PCI_REG(SH7751_PCIIOBR) | ||
| 32 | #define PCIMBR (volatile long *)PCI_REG(SH7751_PCIMBR) | ||
| 33 | #define PCI_IO_AREA SH7751_PCI_IO_BASE | ||
| 34 | #define PCI_MEM_AREA SH7751_PCI_CONFIG_BASE | ||
| 35 | |||
| 36 | #define PCI_IOMAP(adr) (PCI_IO_AREA + (adr & ~SH7751_PCIIOBR_MASK)) | ||
| 37 | |||
| 38 | #define maybebadio(name,port) \ | ||
| 39 | printk("bad PC-like io %s for port 0x%lx at 0x%08x\n", \ | ||
| 40 | #name, (port), (__u32) __builtin_return_address(0)) | ||
| 41 | |||
| 42 | static inline void delay(void) | ||
| 43 | { | ||
| 44 | ctrl_inw(0xa0000000); | ||
| 45 | } | ||
| 46 | |||
| 47 | static inline unsigned long port2adr(unsigned int port) | 25 | static inline unsigned long port2adr(unsigned int port) |
| 48 | { | 26 | { |
| 49 | if ((0x1f0 <= port && port < 0x1f8) || port == 0x3f6) | 27 | if ((0x1f0 <= port && port < 0x1f8) || port == 0x3f6) |
| @@ -52,7 +30,7 @@ static inline unsigned long port2adr(unsigned int port) | |||
| 52 | else | 30 | else |
| 53 | return (PA_AREA5_IO + 0x1000 + ((port-0x1f0) << 1)); | 31 | return (PA_AREA5_IO + 0x1000 + ((port-0x1f0) << 1)); |
| 54 | else | 32 | else |
| 55 | maybebadio(port2adr, (unsigned long)port); | 33 | maybebadio((unsigned long)port); |
| 56 | 34 | ||
| 57 | return port; | 35 | return port; |
| 58 | } | 36 | } |
| @@ -81,17 +59,6 @@ static inline int shifted_port(unsigned long port) | |||
| 81 | return 1; | 59 | return 1; |
| 82 | } | 60 | } |
| 83 | 61 | ||
| 84 | /* In case someone configures the kernel w/o PCI support: in that */ | ||
| 85 | /* scenario, don't ever bother to check for PCI-window addresses */ | ||
| 86 | |||
| 87 | /* NOTE: WINDOW CHECK MAY BE A BIT OFF, HIGH PCIBIOS_MIN_IO WRAPS? */ | ||
| 88 | #if defined(CONFIG_PCI) | ||
| 89 | #define CHECK_SH7751_PCIIO(port) \ | ||
| 90 | ((port >= PCIBIOS_MIN_IO) && (port < (PCIBIOS_MIN_IO + SH7751_PCI_IO_SIZE))) | ||
| 91 | #else | ||
| 92 | #define CHECK_SH7751_PCIIO(port) (0) | ||
| 93 | #endif | ||
| 94 | |||
| 95 | #if defined(CONFIG_NE2000) || defined(CONFIG_NE2000_MODULE) | 62 | #if defined(CONFIG_NE2000) || defined(CONFIG_NE2000_MODULE) |
| 96 | #define CHECK_AX88796L_PORT(port) \ | 63 | #define CHECK_AX88796L_PORT(port) \ |
| 97 | ((port >= AX88796L_IO_BASE) && (port < (AX88796L_IO_BASE+0x20))) | 64 | ((port >= AX88796L_IO_BASE) && (port < (AX88796L_IO_BASE+0x20))) |
| @@ -112,8 +79,8 @@ unsigned char rts7751r2d_inb(unsigned long port) | |||
| 112 | return (*(volatile unsigned short *)port88796l(port, 0)) & 0xff; | 79 | return (*(volatile unsigned short *)port88796l(port, 0)) & 0xff; |
| 113 | else if (PXSEG(port)) | 80 | else if (PXSEG(port)) |
| 114 | return *(volatile unsigned char *)port; | 81 | return *(volatile unsigned char *)port; |
| 115 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | 82 | else if (is_pci_ioaddr(port) || shifted_port(port)) |
| 116 | return *(volatile unsigned char *)PCI_IOMAP(port); | 83 | return *(volatile unsigned char *)pci_ioaddr(port); |
| 117 | else | 84 | else |
| 118 | return (*(volatile unsigned short *)port2adr(port) & 0xff); | 85 | return (*(volatile unsigned short *)port2adr(port) & 0xff); |
| 119 | } | 86 | } |
| @@ -126,11 +93,12 @@ unsigned char rts7751r2d_inb_p(unsigned long port) | |||
| 126 | v = (*(volatile unsigned short *)port88796l(port, 0)) & 0xff; | 93 | v = (*(volatile unsigned short *)port88796l(port, 0)) & 0xff; |
| 127 | else if (PXSEG(port)) | 94 | else if (PXSEG(port)) |
| 128 | v = *(volatile unsigned char *)port; | 95 | v = *(volatile unsigned char *)port; |
| 129 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | 96 | else if (is_pci_ioaddr(port) || shifted_port(port)) |
| 130 | v = *(volatile unsigned char *)PCI_IOMAP(port); | 97 | v = *(volatile unsigned char *)pci_ioaddr(port); |
| 131 | else | 98 | else |
| 132 | v = (*(volatile unsigned short *)port2adr(port) & 0xff); | 99 | v = (*(volatile unsigned short *)port2adr(port) & 0xff); |
| 133 | delay(); | 100 | |
| 101 | ctrl_delay(); | ||
| 134 | 102 | ||
| 135 | return v; | 103 | return v; |
| 136 | } | 104 | } |
| @@ -138,13 +106,13 @@ unsigned char rts7751r2d_inb_p(unsigned long port) | |||
| 138 | unsigned short rts7751r2d_inw(unsigned long port) | 106 | unsigned short rts7751r2d_inw(unsigned long port) |
| 139 | { | 107 | { |
| 140 | if (CHECK_AX88796L_PORT(port)) | 108 | if (CHECK_AX88796L_PORT(port)) |
| 141 | maybebadio(inw, port); | 109 | maybebadio(port); |
| 142 | else if (PXSEG(port)) | 110 | else if (PXSEG(port)) |
| 143 | return *(volatile unsigned short *)port; | 111 | return *(volatile unsigned short *)port; |
| 144 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | 112 | else if (is_pci_ioaddr(port) || shifted_port(port)) |
| 145 | return *(volatile unsigned short *)PCI_IOMAP(port); | 113 | return *(volatile unsigned short *)pci_ioaddr(port); |
| 146 | else | 114 | else |
| 147 | maybebadio(inw, port); | 115 | maybebadio(port); |
| 148 | 116 | ||
| 149 | return 0; | 117 | return 0; |
| 150 | } | 118 | } |
| @@ -152,13 +120,13 @@ unsigned short rts7751r2d_inw(unsigned long port) | |||
| 152 | unsigned int rts7751r2d_inl(unsigned long port) | 120 | unsigned int rts7751r2d_inl(unsigned long port) |
| 153 | { | 121 | { |
| 154 | if (CHECK_AX88796L_PORT(port)) | 122 | if (CHECK_AX88796L_PORT(port)) |
| 155 | maybebadio(inl, port); | 123 | maybebadio(port); |
| 156 | else if (PXSEG(port)) | 124 | else if (PXSEG(port)) |
| 157 | return *(volatile unsigned long *)port; | 125 | return *(volatile unsigned long *)port; |
| 158 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | 126 | else if (is_pci_ioaddr(port) || shifted_port(port)) |
| 159 | return *(volatile unsigned long *)PCI_IOMAP(port); | 127 | return *(volatile unsigned long *)pci_ioaddr(port); |
| 160 | else | 128 | else |
| 161 | maybebadio(inl, port); | 129 | maybebadio(port); |
| 162 | 130 | ||
| 163 | return 0; | 131 | return 0; |
| 164 | } | 132 | } |
| @@ -169,8 +137,8 @@ void rts7751r2d_outb(unsigned char value, unsigned long port) | |||
| 169 | *((volatile unsigned short *)port88796l(port, 0)) = value; | 137 | *((volatile unsigned short *)port88796l(port, 0)) = value; |
| 170 | else if (PXSEG(port)) | 138 | else if (PXSEG(port)) |
| 171 | *(volatile unsigned char *)port = value; | 139 | *(volatile unsigned char *)port = value; |
| 172 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | 140 | else if (is_pci_ioaddr(port) || shifted_port(port)) |
| 173 | *(volatile unsigned char *)PCI_IOMAP(port) = value; | 141 | *(volatile unsigned char *)pci_ioaddr(port) = value; |
| 174 | else | 142 | else |
| 175 | *(volatile unsigned short *)port2adr(port) = value; | 143 | *(volatile unsigned short *)port2adr(port) = value; |
| 176 | } | 144 | } |
| @@ -181,143 +149,152 @@ void rts7751r2d_outb_p(unsigned char value, unsigned long port) | |||
| 181 | *((volatile unsigned short *)port88796l(port, 0)) = value; | 149 | *((volatile unsigned short *)port88796l(port, 0)) = value; |
| 182 | else if (PXSEG(port)) | 150 | else if (PXSEG(port)) |
| 183 | *(volatile unsigned char *)port = value; | 151 | *(volatile unsigned char *)port = value; |
| 184 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | 152 | else if (is_pci_ioaddr(port) || shifted_port(port)) |
| 185 | *(volatile unsigned char *)PCI_IOMAP(port) = value; | 153 | *(volatile unsigned char *)pci_ioaddr(port) = value; |
| 186 | else | 154 | else |
| 187 | *(volatile unsigned short *)port2adr(port) = value; | 155 | *(volatile unsigned short *)port2adr(port) = value; |
| 188 | delay(); | 156 | |
| 157 | ctrl_delay(); | ||
| 189 | } | 158 | } |
| 190 | 159 | ||
| 191 | void rts7751r2d_outw(unsigned short value, unsigned long port) | 160 | void rts7751r2d_outw(unsigned short value, unsigned long port) |
| 192 | { | 161 | { |
| 193 | if (CHECK_AX88796L_PORT(port)) | 162 | if (CHECK_AX88796L_PORT(port)) |
| 194 | maybebadio(outw, port); | 163 | maybebadio(port); |
| 195 | else if (PXSEG(port)) | 164 | else if (PXSEG(port)) |
| 196 | *(volatile unsigned short *)port = value; | 165 | *(volatile unsigned short *)port = value; |
| 197 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | 166 | else if (is_pci_ioaddr(port) || shifted_port(port)) |
| 198 | *(volatile unsigned short *)PCI_IOMAP(port) = value; | 167 | *(volatile unsigned short *)pci_ioaddr(port) = value; |
| 199 | else | 168 | else |
| 200 | maybebadio(outw, port); | 169 | maybebadio(port); |
| 201 | } | 170 | } |
| 202 | 171 | ||
| 203 | void rts7751r2d_outl(unsigned int value, unsigned long port) | 172 | void rts7751r2d_outl(unsigned int value, unsigned long port) |
| 204 | { | 173 | { |
| 205 | if (CHECK_AX88796L_PORT(port)) | 174 | if (CHECK_AX88796L_PORT(port)) |
| 206 | maybebadio(outl, port); | 175 | maybebadio(port); |
| 207 | else if (PXSEG(port)) | 176 | else if (PXSEG(port)) |
| 208 | *(volatile unsigned long *)port = value; | 177 | *(volatile unsigned long *)port = value; |
| 209 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | 178 | else if (is_pci_ioaddr(port) || shifted_port(port)) |
| 210 | *(volatile unsigned long *)PCI_IOMAP(port) = value; | 179 | *(volatile unsigned long *)pci_ioaddr(port) = value; |
| 211 | else | 180 | else |
| 212 | maybebadio(outl, port); | 181 | maybebadio(port); |
| 213 | } | 182 | } |
| 214 | 183 | ||
| 215 | void rts7751r2d_insb(unsigned long port, void *addr, unsigned long count) | 184 | void rts7751r2d_insb(unsigned long port, void *addr, unsigned long count) |
| 216 | { | 185 | { |
| 186 | unsigned long a = (unsigned long)addr; | ||
| 217 | volatile __u8 *bp; | 187 | volatile __u8 *bp; |
| 218 | volatile __u16 *p; | 188 | volatile __u16 *p; |
| 219 | unsigned char *s = addr; | ||
| 220 | 189 | ||
| 221 | if (CHECK_AX88796L_PORT(port)) { | 190 | if (CHECK_AX88796L_PORT(port)) { |
| 222 | p = (volatile unsigned short *)port88796l(port, 0); | 191 | p = (volatile unsigned short *)port88796l(port, 0); |
| 223 | while (count--) *s++ = *p & 0xff; | 192 | while (count--) |
| 193 | ctrl_outb(*p & 0xff, a++); | ||
| 224 | } else if (PXSEG(port)) | 194 | } else if (PXSEG(port)) |
| 225 | while (count--) *s++ = *(volatile unsigned char *)port; | 195 | while (count--) |
| 226 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { | 196 | ctrl_outb(ctrl_inb(port), a++); |
| 227 | bp = (__u8 *)PCI_IOMAP(port); | 197 | else if (is_pci_ioaddr(port) || shifted_port(port)) { |
| 228 | while (count--) *s++ = *bp; | 198 | bp = (__u8 *)pci_ioaddr(port); |
| 199 | while (count--) | ||
| 200 | ctrl_outb(*bp, a++); | ||
| 229 | } else { | 201 | } else { |
| 230 | p = (volatile unsigned short *)port2adr(port); | 202 | p = (volatile unsigned short *)port2adr(port); |
| 231 | while (count--) *s++ = *p & 0xff; | 203 | while (count--) |
| 204 | ctrl_outb(*p & 0xff, a++); | ||
| 232 | } | 205 | } |
| 233 | } | 206 | } |
| 234 | 207 | ||
| 235 | void rts7751r2d_insw(unsigned long port, void *addr, unsigned long count) | 208 | void rts7751r2d_insw(unsigned long port, void *addr, unsigned long count) |
| 236 | { | 209 | { |
| 210 | unsigned long a = (unsigned long)addr; | ||
| 237 | volatile __u16 *p; | 211 | volatile __u16 *p; |
| 238 | __u16 *s = addr; | ||
| 239 | 212 | ||
| 240 | if (CHECK_AX88796L_PORT(port)) | 213 | if (CHECK_AX88796L_PORT(port)) |
| 241 | p = (volatile unsigned short *)port88796l(port, 1); | 214 | p = (volatile unsigned short *)port88796l(port, 1); |
| 242 | else if (PXSEG(port)) | 215 | else if (PXSEG(port)) |
| 243 | p = (volatile unsigned short *)port; | 216 | p = (volatile unsigned short *)port; |
| 244 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | 217 | else if (is_pci_ioaddr(port) || shifted_port(port)) |
| 245 | p = (volatile unsigned short *)PCI_IOMAP(port); | 218 | p = (volatile unsigned short *)pci_ioaddr(port); |
| 246 | else | 219 | else |
| 247 | p = (volatile unsigned short *)port2adr(port); | 220 | p = (volatile unsigned short *)port2adr(port); |
| 248 | while (count--) *s++ = *p; | 221 | while (count--) |
| 222 | ctrl_outw(*p, a++); | ||
| 249 | } | 223 | } |
| 250 | 224 | ||
| 251 | void rts7751r2d_insl(unsigned long port, void *addr, unsigned long count) | 225 | void rts7751r2d_insl(unsigned long port, void *addr, unsigned long count) |
| 252 | { | 226 | { |
| 253 | if (CHECK_AX88796L_PORT(port)) | 227 | if (CHECK_AX88796L_PORT(port)) |
| 254 | maybebadio(insl, port); | 228 | maybebadio(port); |
| 255 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { | 229 | else if (is_pci_ioaddr(port) || shifted_port(port)) { |
| 256 | volatile __u32 *p = (__u32 *)PCI_IOMAP(port); | 230 | unsigned long a = (unsigned long)addr; |
| 257 | __u32 *s = addr; | 231 | |
| 258 | 232 | while (count--) { | |
| 259 | while (count--) *s++ = *p; | 233 | ctrl_outl(ctrl_inl(pci_ioaddr(port)), a); |
| 234 | a += 4; | ||
| 235 | } | ||
| 260 | } else | 236 | } else |
| 261 | maybebadio(insl, port); | 237 | maybebadio(port); |
| 262 | } | 238 | } |
| 263 | 239 | ||
| 264 | void rts7751r2d_outsb(unsigned long port, const void *addr, unsigned long count) | 240 | void rts7751r2d_outsb(unsigned long port, const void *addr, unsigned long count) |
| 265 | { | 241 | { |
| 242 | unsigned long a = (unsigned long)addr; | ||
| 266 | volatile __u8 *bp; | 243 | volatile __u8 *bp; |
| 267 | volatile __u16 *p; | 244 | volatile __u16 *p; |
| 268 | const __u8 *s = addr; | ||
| 269 | 245 | ||
| 270 | if (CHECK_AX88796L_PORT(port)) { | 246 | if (CHECK_AX88796L_PORT(port)) { |
| 271 | p = (volatile unsigned short *)port88796l(port, 0); | 247 | p = (volatile unsigned short *)port88796l(port, 0); |
| 272 | while (count--) *p = *s++; | 248 | while (count--) |
| 249 | *p = ctrl_inb(a++); | ||
| 273 | } else if (PXSEG(port)) | 250 | } else if (PXSEG(port)) |
| 274 | while (count--) *(volatile unsigned char *)port = *s++; | 251 | while (count--) |
| 275 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { | 252 | ctrl_outb(a++, port); |
| 276 | bp = (__u8 *)PCI_IOMAP(port); | 253 | else if (is_pci_ioaddr(port) || shifted_port(port)) { |
| 277 | while (count--) *bp = *s++; | 254 | bp = (__u8 *)pci_ioaddr(port); |
| 255 | while (count--) | ||
| 256 | *bp = ctrl_inb(a++); | ||
| 278 | } else { | 257 | } else { |
| 279 | p = (volatile unsigned short *)port2adr(port); | 258 | p = (volatile unsigned short *)port2adr(port); |
| 280 | while (count--) *p = *s++; | 259 | while (count--) |
| 260 | *p = ctrl_inb(a++); | ||
| 281 | } | 261 | } |
| 282 | } | 262 | } |
| 283 | 263 | ||
| 284 | void rts7751r2d_outsw(unsigned long port, const void *addr, unsigned long count) | 264 | void rts7751r2d_outsw(unsigned long port, const void *addr, unsigned long count) |
| 285 | { | 265 | { |
| 266 | unsigned long a = (unsigned long)addr; | ||
| 286 | volatile __u16 *p; | 267 | volatile __u16 *p; |
| 287 | const __u16 *s = addr; | ||
| 288 | 268 | ||
| 289 | if (CHECK_AX88796L_PORT(port)) | 269 | if (CHECK_AX88796L_PORT(port)) |
| 290 | p = (volatile unsigned short *)port88796l(port, 1); | 270 | p = (volatile unsigned short *)port88796l(port, 1); |
| 291 | else if (PXSEG(port)) | 271 | else if (PXSEG(port)) |
| 292 | p = (volatile unsigned short *)port; | 272 | p = (volatile unsigned short *)port; |
| 293 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | 273 | else if (is_pci_ioaddr(port) || shifted_port(port)) |
| 294 | p = (volatile unsigned short *)PCI_IOMAP(port); | 274 | p = (volatile unsigned short *)pci_ioaddr(port); |
| 295 | else | 275 | else |
| 296 | p = (volatile unsigned short *)port2adr(port); | 276 | p = (volatile unsigned short *)port2adr(port); |
| 297 | while (count--) *p = *s++; | 277 | |
| 278 | while (count--) { | ||
| 279 | ctrl_outw(*p, a); | ||
| 280 | a += 2; | ||
| 281 | } | ||
| 298 | } | 282 | } |
| 299 | 283 | ||
| 300 | void rts7751r2d_outsl(unsigned long port, const void *addr, unsigned long count) | 284 | void rts7751r2d_outsl(unsigned long port, const void *addr, unsigned long count) |
| 301 | { | 285 | { |
| 302 | if (CHECK_AX88796L_PORT(port)) | 286 | if (CHECK_AX88796L_PORT(port)) |
| 303 | maybebadio(outsl, port); | 287 | maybebadio(port); |
| 304 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { | 288 | else if (is_pci_ioaddr(port) || shifted_port(port)) { |
| 305 | volatile __u32 *p = (__u32 *)PCI_IOMAP(port); | 289 | unsigned long a = (unsigned long)addr; |
| 306 | const __u32 *s = addr; | 290 | |
| 307 | 291 | while (count--) { | |
| 308 | while (count--) *p = *s++; | 292 | ctrl_outl(ctrl_inl(a), pci_ioaddr(port)); |
| 293 | a += 4; | ||
| 294 | } | ||
| 309 | } else | 295 | } else |
| 310 | maybebadio(outsl, port); | 296 | maybebadio(port); |
| 311 | } | ||
| 312 | |||
| 313 | void *rts7751r2d_ioremap(unsigned long offset, unsigned long size) | ||
| 314 | { | ||
| 315 | if (offset >= 0xfd000000) | ||
| 316 | return (void *)offset; | ||
| 317 | else | ||
| 318 | return (void *)P2SEGADDR(offset); | ||
| 319 | } | 297 | } |
| 320 | EXPORT_SYMBOL(rts7751r2d_ioremap); | ||
| 321 | 298 | ||
| 322 | unsigned long rts7751r2d_isa_port2addr(unsigned long offset) | 299 | unsigned long rts7751r2d_isa_port2addr(unsigned long offset) |
| 323 | { | 300 | { |
diff --git a/arch/sh/boards/renesas/rts7751r2d/irq.c b/arch/sh/boards/renesas/rts7751r2d/irq.c index 154535440bbf..c915e7a3693a 100644 --- a/arch/sh/boards/renesas/rts7751r2d/irq.c +++ b/arch/sh/boards/renesas/rts7751r2d/irq.c | |||
| @@ -41,30 +41,24 @@ static unsigned int startup_rts7751r2d_irq(unsigned int irq) | |||
| 41 | 41 | ||
| 42 | static void disable_rts7751r2d_irq(unsigned int irq) | 42 | static void disable_rts7751r2d_irq(unsigned int irq) |
| 43 | { | 43 | { |
| 44 | unsigned long flags; | ||
| 45 | unsigned short val; | 44 | unsigned short val; |
| 46 | unsigned short mask = 0xffff ^ (0x0001 << mask_pos[irq]); | 45 | unsigned short mask = 0xffff ^ (0x0001 << mask_pos[irq]); |
| 47 | 46 | ||
| 48 | /* Set the priority in IPR to 0 */ | 47 | /* Set the priority in IPR to 0 */ |
| 49 | local_irq_save(flags); | ||
| 50 | val = ctrl_inw(IRLCNTR1); | 48 | val = ctrl_inw(IRLCNTR1); |
| 51 | val &= mask; | 49 | val &= mask; |
| 52 | ctrl_outw(val, IRLCNTR1); | 50 | ctrl_outw(val, IRLCNTR1); |
| 53 | local_irq_restore(flags); | ||
| 54 | } | 51 | } |
| 55 | 52 | ||
| 56 | static void enable_rts7751r2d_irq(unsigned int irq) | 53 | static void enable_rts7751r2d_irq(unsigned int irq) |
| 57 | { | 54 | { |
| 58 | unsigned long flags; | ||
| 59 | unsigned short val; | 55 | unsigned short val; |
| 60 | unsigned short value = (0x0001 << mask_pos[irq]); | 56 | unsigned short value = (0x0001 << mask_pos[irq]); |
| 61 | 57 | ||
| 62 | /* Set priority in IPR back to original value */ | 58 | /* Set priority in IPR back to original value */ |
| 63 | local_irq_save(flags); | ||
| 64 | val = ctrl_inw(IRLCNTR1); | 59 | val = ctrl_inw(IRLCNTR1); |
| 65 | val |= value; | 60 | val |= value; |
| 66 | ctrl_outw(val, IRLCNTR1); | 61 | ctrl_outw(val, IRLCNTR1); |
| 67 | local_irq_restore(flags); | ||
| 68 | } | 62 | } |
| 69 | 63 | ||
| 70 | int rts7751r2d_irq_demux(int irq) | 64 | int rts7751r2d_irq_demux(int irq) |
diff --git a/arch/sh/boards/renesas/rts7751r2d/led.c b/arch/sh/boards/renesas/rts7751r2d/led.c index 4d16de71fac1..e14a13d12d4a 100644 --- a/arch/sh/boards/renesas/rts7751r2d/led.c +++ b/arch/sh/boards/renesas/rts7751r2d/led.c | |||
| @@ -12,8 +12,6 @@ | |||
| 12 | #include <asm/io.h> | 12 | #include <asm/io.h> |
| 13 | #include <asm/rts7751r2d/rts7751r2d.h> | 13 | #include <asm/rts7751r2d/rts7751r2d.h> |
| 14 | 14 | ||
| 15 | extern unsigned int debug_counter; | ||
| 16 | |||
| 17 | #ifdef CONFIG_HEARTBEAT | 15 | #ifdef CONFIG_HEARTBEAT |
| 18 | 16 | ||
| 19 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
| @@ -55,12 +53,3 @@ void rts7751r2d_led(unsigned short value) | |||
| 55 | ctrl_outw(value, PA_OUTPORT); | 53 | ctrl_outw(value, PA_OUTPORT); |
| 56 | } | 54 | } |
| 57 | 55 | ||
| 58 | void debug_led_disp(void) | ||
| 59 | { | ||
| 60 | unsigned short value; | ||
| 61 | |||
| 62 | value = (unsigned short)debug_counter++; | ||
| 63 | rts7751r2d_led(value); | ||
| 64 | if (value == 0xff) | ||
| 65 | debug_counter = 0; | ||
| 66 | } | ||
diff --git a/arch/sh/boards/renesas/rts7751r2d/mach.c b/arch/sh/boards/renesas/rts7751r2d/mach.c deleted file mode 100644 index 5ed9e97ea197..000000000000 --- a/arch/sh/boards/renesas/rts7751r2d/mach.c +++ /dev/null | |||
| @@ -1,69 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * linux/arch/sh/kernel/mach_rts7751r2d.c | ||
| 3 | * | ||
| 4 | * Minor tweak of mach_se.c file to reference rts7751r2d-specific items. | ||
| 5 | * | ||
| 6 | * May be copied or modified under the terms of the GNU General Public | ||
| 7 | * License. See linux/COPYING for more information. | ||
| 8 | * | ||
| 9 | * Machine vector for the Renesas Technology sales RTS7751R2D | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/init.h> | ||
| 13 | #include <linux/types.h> | ||
| 14 | |||
| 15 | #include <asm/machvec.h> | ||
| 16 | #include <asm/rtc.h> | ||
| 17 | #include <asm/irq.h> | ||
| 18 | #include <asm/rts7751r2d/io.h> | ||
| 19 | |||
| 20 | extern void heartbeat_rts7751r2d(void); | ||
| 21 | extern void init_rts7751r2d_IRQ(void); | ||
| 22 | extern void *rts7751r2d_ioremap(unsigned long, unsigned long); | ||
| 23 | extern int rts7751r2d_irq_demux(int irq); | ||
| 24 | |||
| 25 | extern void *voyagergx_consistent_alloc(struct device *, size_t, dma_addr_t *, gfp_t); | ||
| 26 | extern int voyagergx_consistent_free(struct device *, size_t, void *, dma_addr_t); | ||
| 27 | |||
| 28 | /* | ||
| 29 | * The Machine Vector | ||
| 30 | */ | ||
| 31 | |||
| 32 | struct sh_machine_vector mv_rts7751r2d __initmv = { | ||
| 33 | .mv_nr_irqs = 72, | ||
| 34 | |||
| 35 | .mv_inb = rts7751r2d_inb, | ||
| 36 | .mv_inw = rts7751r2d_inw, | ||
| 37 | .mv_inl = rts7751r2d_inl, | ||
| 38 | .mv_outb = rts7751r2d_outb, | ||
| 39 | .mv_outw = rts7751r2d_outw, | ||
| 40 | .mv_outl = rts7751r2d_outl, | ||
| 41 | |||
| 42 | .mv_inb_p = rts7751r2d_inb_p, | ||
| 43 | .mv_inw_p = rts7751r2d_inw, | ||
| 44 | .mv_inl_p = rts7751r2d_inl, | ||
| 45 | .mv_outb_p = rts7751r2d_outb_p, | ||
| 46 | .mv_outw_p = rts7751r2d_outw, | ||
| 47 | .mv_outl_p = rts7751r2d_outl, | ||
| 48 | |||
| 49 | .mv_insb = rts7751r2d_insb, | ||
| 50 | .mv_insw = rts7751r2d_insw, | ||
| 51 | .mv_insl = rts7751r2d_insl, | ||
| 52 | .mv_outsb = rts7751r2d_outsb, | ||
| 53 | .mv_outsw = rts7751r2d_outsw, | ||
| 54 | .mv_outsl = rts7751r2d_outsl, | ||
| 55 | |||
| 56 | .mv_ioremap = rts7751r2d_ioremap, | ||
| 57 | .mv_isa_port2addr = rts7751r2d_isa_port2addr, | ||
| 58 | .mv_init_irq = init_rts7751r2d_IRQ, | ||
| 59 | #ifdef CONFIG_HEARTBEAT | ||
| 60 | .mv_heartbeat = heartbeat_rts7751r2d, | ||
| 61 | #endif | ||
| 62 | .mv_irq_demux = rts7751r2d_irq_demux, | ||
| 63 | |||
| 64 | #ifdef CONFIG_USB_OHCI_HCD | ||
| 65 | .mv_consistent_alloc = voyagergx_consistent_alloc, | ||
| 66 | .mv_consistent_free = voyagergx_consistent_free, | ||
| 67 | #endif | ||
| 68 | }; | ||
| 69 | ALIAS_MV(rts7751r2d) | ||
diff --git a/arch/sh/boards/renesas/rts7751r2d/setup.c b/arch/sh/boards/renesas/rts7751r2d/setup.c index 2587fd1a0240..20597a6e6702 100644 --- a/arch/sh/boards/renesas/rts7751r2d/setup.c +++ b/arch/sh/boards/renesas/rts7751r2d/setup.c | |||
| @@ -1,31 +1,142 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * linux/arch/sh/kernel/setup_rts7751r2d.c | ||
| 3 | * | ||
| 4 | * Copyright (C) 2000 Kazumoto Kojima | ||
| 5 | * | ||
| 6 | * Renesas Technology Sales RTS7751R2D Support. | 2 | * Renesas Technology Sales RTS7751R2D Support. |
| 7 | * | 3 | * |
| 8 | * Modified for RTS7751R2D by | 4 | * Copyright (C) 2002 Atom Create Engineering Co., Ltd. |
| 9 | * Atom Create Engineering Co., Ltd. 2002. | 5 | * Copyright (C) 2004 - 2006 Paul Mundt |
| 6 | * | ||
| 7 | * This file is subject to the terms and conditions of the GNU General Public | ||
| 8 | * License. See the file "COPYING" in the main directory of this archive | ||
| 9 | * for more details. | ||
| 10 | */ | 10 | */ |
| 11 | |||
| 12 | #include <linux/init.h> | 11 | #include <linux/init.h> |
| 12 | #include <linux/platform_device.h> | ||
| 13 | #include <linux/serial_8250.h> | ||
| 14 | #include <linux/pm.h> | ||
| 13 | #include <asm/io.h> | 15 | #include <asm/io.h> |
| 14 | #include <asm/rts7751r2d/rts7751r2d.h> | 16 | #include <asm/machvec.h> |
| 17 | #include <asm/mach/rts7751r2d.h> | ||
| 18 | #include <asm/voyagergx.h> | ||
| 19 | |||
| 20 | extern void heartbeat_rts7751r2d(void); | ||
| 21 | extern void init_rts7751r2d_IRQ(void); | ||
| 22 | extern int rts7751r2d_irq_demux(int irq); | ||
| 23 | |||
| 24 | extern void *voyagergx_consistent_alloc(struct device *, size_t, dma_addr_t *, gfp_t); | ||
| 25 | extern int voyagergx_consistent_free(struct device *, size_t, void *, dma_addr_t); | ||
| 26 | |||
| 27 | static struct plat_serial8250_port uart_platform_data[] = { | ||
| 28 | { | ||
| 29 | .membase = (void *)VOYAGER_UART_BASE, | ||
| 30 | .mapbase = VOYAGER_UART_BASE, | ||
| 31 | .iotype = UPIO_MEM, | ||
| 32 | .irq = VOYAGER_UART0_IRQ, | ||
| 33 | .flags = UPF_BOOT_AUTOCONF, | ||
| 34 | .regshift = 2, | ||
| 35 | .uartclk = (9600 * 16), | ||
| 36 | }, { | ||
| 37 | .flags = 0, | ||
| 38 | }, | ||
| 39 | }; | ||
| 40 | |||
| 41 | static void __init voyagergx_serial_init(void) | ||
| 42 | { | ||
| 43 | unsigned long val; | ||
| 44 | |||
| 45 | /* | ||
| 46 | * GPIO Control | ||
| 47 | */ | ||
| 48 | val = inl(GPIO_MUX_HIGH); | ||
| 49 | val |= 0x00001fe0; | ||
| 50 | outl(val, GPIO_MUX_HIGH); | ||
| 51 | |||
| 52 | /* | ||
| 53 | * Power Mode Gate | ||
| 54 | */ | ||
| 55 | val = inl(POWER_MODE0_GATE); | ||
| 56 | val |= (POWER_MODE0_GATE_U0 | POWER_MODE0_GATE_U1); | ||
| 57 | outl(val, POWER_MODE0_GATE); | ||
| 58 | |||
| 59 | val = inl(POWER_MODE1_GATE); | ||
| 60 | val |= (POWER_MODE1_GATE_U0 | POWER_MODE1_GATE_U1); | ||
| 61 | outl(val, POWER_MODE1_GATE); | ||
| 62 | } | ||
| 63 | |||
| 64 | static struct platform_device uart_device = { | ||
| 65 | .name = "serial8250", | ||
| 66 | .id = -1, | ||
| 67 | .dev = { | ||
| 68 | .platform_data = uart_platform_data, | ||
| 69 | }, | ||
| 70 | }; | ||
| 71 | |||
| 72 | static struct platform_device *rts7751r2d_devices[] __initdata = { | ||
| 73 | &uart_device, | ||
| 74 | }; | ||
| 15 | 75 | ||
| 16 | unsigned int debug_counter; | 76 | static int __init rts7751r2d_devices_setup(void) |
| 77 | { | ||
| 78 | return platform_add_devices(rts7751r2d_devices, | ||
| 79 | ARRAY_SIZE(rts7751r2d_devices)); | ||
| 80 | } | ||
| 17 | 81 | ||
| 18 | const char *get_system_type(void) | 82 | static void rts7751r2d_power_off(void) |
| 19 | { | 83 | { |
| 20 | return "RTS7751R2D"; | 84 | ctrl_outw(0x0001, PA_POWOFF); |
| 21 | } | 85 | } |
| 22 | 86 | ||
| 23 | /* | 87 | /* |
| 24 | * Initialize the board | 88 | * Initialize the board |
| 25 | */ | 89 | */ |
| 26 | void __init platform_setup(void) | 90 | static void __init rts7751r2d_setup(char **cmdline_p) |
| 27 | { | 91 | { |
| 28 | printk(KERN_INFO "Renesas Technology Sales RTS7751R2D support.\n"); | 92 | device_initcall(rts7751r2d_devices_setup); |
| 93 | |||
| 29 | ctrl_outw(0x0000, PA_OUTPORT); | 94 | ctrl_outw(0x0000, PA_OUTPORT); |
| 30 | debug_counter = 0; | 95 | pm_power_off = rts7751r2d_power_off; |
| 96 | |||
| 97 | voyagergx_serial_init(); | ||
| 98 | |||
| 99 | printk(KERN_INFO "Renesas Technology Sales RTS7751R2D support.\n"); | ||
| 31 | } | 100 | } |
| 101 | |||
| 102 | /* | ||
| 103 | * The Machine Vector | ||
| 104 | */ | ||
| 105 | struct sh_machine_vector mv_rts7751r2d __initmv = { | ||
| 106 | .mv_name = "RTS7751R2D", | ||
| 107 | .mv_setup = rts7751r2d_setup, | ||
| 108 | .mv_nr_irqs = 72, | ||
| 109 | |||
| 110 | .mv_inb = rts7751r2d_inb, | ||
| 111 | .mv_inw = rts7751r2d_inw, | ||
| 112 | .mv_inl = rts7751r2d_inl, | ||
| 113 | .mv_outb = rts7751r2d_outb, | ||
| 114 | .mv_outw = rts7751r2d_outw, | ||
| 115 | .mv_outl = rts7751r2d_outl, | ||
| 116 | |||
| 117 | .mv_inb_p = rts7751r2d_inb_p, | ||
| 118 | .mv_inw_p = rts7751r2d_inw, | ||
| 119 | .mv_inl_p = rts7751r2d_inl, | ||
| 120 | .mv_outb_p = rts7751r2d_outb_p, | ||
| 121 | .mv_outw_p = rts7751r2d_outw, | ||
| 122 | .mv_outl_p = rts7751r2d_outl, | ||
| 123 | |||
| 124 | .mv_insb = rts7751r2d_insb, | ||
| 125 | .mv_insw = rts7751r2d_insw, | ||
| 126 | .mv_insl = rts7751r2d_insl, | ||
| 127 | .mv_outsb = rts7751r2d_outsb, | ||
| 128 | .mv_outsw = rts7751r2d_outsw, | ||
| 129 | .mv_outsl = rts7751r2d_outsl, | ||
| 130 | |||
| 131 | .mv_init_irq = init_rts7751r2d_IRQ, | ||
| 132 | #ifdef CONFIG_HEARTBEAT | ||
| 133 | .mv_heartbeat = heartbeat_rts7751r2d, | ||
| 134 | #endif | ||
| 135 | .mv_irq_demux = rts7751r2d_irq_demux, | ||
| 136 | |||
| 137 | #ifdef CONFIG_USB_SM501 | ||
| 138 | .mv_consistent_alloc = voyagergx_consistent_alloc, | ||
| 139 | .mv_consistent_free = voyagergx_consistent_free, | ||
| 140 | #endif | ||
| 141 | }; | ||
| 142 | ALIAS_MV(rts7751r2d) | ||
diff --git a/arch/sh/boards/renesas/sh7710voipgw/Makefile b/arch/sh/boards/renesas/sh7710voipgw/Makefile new file mode 100644 index 000000000000..77037567633b --- /dev/null +++ b/arch/sh/boards/renesas/sh7710voipgw/Makefile | |||
| @@ -0,0 +1 @@ | |||
| obj-y := setup.o | |||
diff --git a/arch/sh/boards/renesas/sh7710voipgw/setup.c b/arch/sh/boards/renesas/sh7710voipgw/setup.c new file mode 100644 index 000000000000..e57e7afab8c6 --- /dev/null +++ b/arch/sh/boards/renesas/sh7710voipgw/setup.c | |||
| @@ -0,0 +1,109 @@ | |||
| 1 | /* | ||
| 2 | * Renesas Technology SH7710 VoIP Gateway | ||
| 3 | * | ||
| 4 | * Copyright (C) 2006 Ranjit Deshpande | ||
| 5 | * Kenati Technologies Inc. | ||
| 6 | * | ||
| 7 | * May be copied or modified under the terms of the GNU General Public | ||
| 8 | * License. See linux/COPYING for more information. | ||
| 9 | */ | ||
| 10 | #include <linux/init.h> | ||
| 11 | #include <asm/machvec.h> | ||
| 12 | #include <asm/irq.h> | ||
| 13 | #include <asm/io.h> | ||
| 14 | #include <asm/irq.h> | ||
| 15 | |||
| 16 | /* | ||
| 17 | * Initialize IRQ setting | ||
| 18 | */ | ||
| 19 | static void __init sh7710voipgw_init_irq(void) | ||
| 20 | { | ||
| 21 | /* Disable all interrupts in IPR registers */ | ||
| 22 | ctrl_outw(0x0, INTC_IPRA); | ||
| 23 | ctrl_outw(0x0, INTC_IPRB); | ||
| 24 | ctrl_outw(0x0, INTC_IPRC); | ||
| 25 | ctrl_outw(0x0, INTC_IPRD); | ||
| 26 | ctrl_outw(0x0, INTC_IPRE); | ||
| 27 | ctrl_outw(0x0, INTC_IPRF); | ||
| 28 | ctrl_outw(0x0, INTC_IPRG); | ||
| 29 | ctrl_outw(0x0, INTC_IPRH); | ||
| 30 | ctrl_outw(0x0, INTC_IPRI); | ||
| 31 | |||
| 32 | /* Ack all interrupt sources in the IRR0 register */ | ||
| 33 | ctrl_outb(0x3f, INTC_IRR0); | ||
| 34 | |||
| 35 | /* Use IRQ0 - IRQ3 as active low interrupt lines i.e. disable | ||
| 36 | * IRL mode. | ||
| 37 | */ | ||
| 38 | ctrl_outw(0x2aa, INTC_ICR1); | ||
| 39 | |||
| 40 | /* Now make IPR interrupts */ | ||
| 41 | make_ipr_irq(TIMER2_IRQ, TIMER2_IPR_ADDR, | ||
| 42 | TIMER2_IPR_POS, TIMER2_PRIORITY); | ||
| 43 | make_ipr_irq(WDT_IRQ, WDT_IPR_ADDR, WDT_IPR_POS, WDT_PRIORITY); | ||
| 44 | |||
| 45 | /* SCIF0 */ | ||
| 46 | make_ipr_irq(SCIF0_ERI_IRQ, SCIF0_IPR_ADDR, SCIF0_IPR_POS, | ||
| 47 | SCIF0_PRIORITY); | ||
| 48 | make_ipr_irq(SCIF0_RXI_IRQ, SCIF0_IPR_ADDR, SCIF0_IPR_POS, | ||
| 49 | SCIF0_PRIORITY); | ||
| 50 | make_ipr_irq(SCIF0_BRI_IRQ, SCIF0_IPR_ADDR, SCIF0_IPR_POS, | ||
| 51 | SCIF0_PRIORITY); | ||
| 52 | make_ipr_irq(SCIF0_TXI_IRQ, SCIF0_IPR_ADDR, SCIF0_IPR_POS, | ||
| 53 | SCIF0_PRIORITY); | ||
| 54 | |||
| 55 | /* DMAC-1 */ | ||
| 56 | make_ipr_irq(DMTE0_IRQ, DMA_IPR_ADDR, DMA_IPR_POS, DMA_PRIORITY); | ||
| 57 | make_ipr_irq(DMTE1_IRQ, DMA_IPR_ADDR, DMA_IPR_POS, DMA_PRIORITY); | ||
| 58 | make_ipr_irq(DMTE2_IRQ, DMA_IPR_ADDR, DMA_IPR_POS, DMA_PRIORITY); | ||
| 59 | make_ipr_irq(DMTE3_IRQ, DMA_IPR_ADDR, DMA_IPR_POS, DMA_PRIORITY); | ||
| 60 | |||
| 61 | /* DMAC-2 */ | ||
| 62 | make_ipr_irq(DMTE4_IRQ, DMA2_IPR_ADDR, DMA2_IPR_POS, DMA2_PRIORITY); | ||
| 63 | make_ipr_irq(DMTE4_IRQ, DMA2_IPR_ADDR, DMA2_IPR_POS, DMA2_PRIORITY); | ||
| 64 | |||
| 65 | /* IPSEC */ | ||
| 66 | make_ipr_irq(IPSEC_IRQ, IPSEC_IPR_ADDR, IPSEC_IPR_POS, IPSEC_PRIORITY); | ||
| 67 | |||
| 68 | /* EDMAC */ | ||
| 69 | make_ipr_irq(EDMAC0_IRQ, EDMAC0_IPR_ADDR, EDMAC0_IPR_POS, | ||
| 70 | EDMAC0_PRIORITY); | ||
| 71 | make_ipr_irq(EDMAC1_IRQ, EDMAC1_IPR_ADDR, EDMAC1_IPR_POS, | ||
| 72 | EDMAC1_PRIORITY); | ||
| 73 | make_ipr_irq(EDMAC2_IRQ, EDMAC2_IPR_ADDR, EDMAC2_IPR_POS, | ||
| 74 | EDMAC2_PRIORITY); | ||
| 75 | |||
| 76 | /* SIOF0 */ | ||
| 77 | make_ipr_irq(SIOF0_ERI_IRQ, SIOF0_IPR_ADDR, SIOF0_IPR_POS, | ||
| 78 | SIOF0_PRIORITY); | ||
| 79 | make_ipr_irq(SIOF0_TXI_IRQ, SIOF0_IPR_ADDR, SIOF0_IPR_POS, | ||
| 80 | SIOF0_PRIORITY); | ||
| 81 | make_ipr_irq(SIOF0_RXI_IRQ, SIOF0_IPR_ADDR, SIOF0_IPR_POS, | ||
| 82 | SIOF0_PRIORITY); | ||
| 83 | make_ipr_irq(SIOF0_CCI_IRQ, SIOF0_IPR_ADDR, SIOF0_IPR_POS, | ||
| 84 | SIOF0_PRIORITY); | ||
| 85 | |||
| 86 | /* SIOF1 */ | ||
| 87 | make_ipr_irq(SIOF1_ERI_IRQ, SIOF1_IPR_ADDR, SIOF1_IPR_POS, | ||
| 88 | SIOF1_PRIORITY); | ||
| 89 | make_ipr_irq(SIOF1_TXI_IRQ, SIOF1_IPR_ADDR, SIOF1_IPR_POS, | ||
| 90 | SIOF1_PRIORITY); | ||
| 91 | make_ipr_irq(SIOF1_RXI_IRQ, SIOF1_IPR_ADDR, SIOF1_IPR_POS, | ||
| 92 | SIOF1_PRIORITY); | ||
| 93 | make_ipr_irq(SIOF1_CCI_IRQ, SIOF1_IPR_ADDR, SIOF1_IPR_POS, | ||
| 94 | SIOF1_PRIORITY); | ||
| 95 | |||
| 96 | /* SLIC IRQ's */ | ||
| 97 | make_ipr_irq(IRQ1_IRQ, IRQ1_IPR_ADDR, IRQ1_IPR_POS, IRQ1_PRIORITY); | ||
| 98 | make_ipr_irq(IRQ2_IRQ, IRQ2_IPR_ADDR, IRQ2_IPR_POS, IRQ2_PRIORITY); | ||
| 99 | } | ||
| 100 | |||
| 101 | /* | ||
| 102 | * The Machine Vector | ||
| 103 | */ | ||
| 104 | struct sh_machine_vector mv_sh7710voipgw __initmv = { | ||
| 105 | .mv_name = "SH7710 VoIP Gateway", | ||
| 106 | .mv_nr_irqs = 104, | ||
| 107 | .mv_init_irq = sh7710voipgw_init_irq, | ||
| 108 | }; | ||
| 109 | ALIAS_MV(sh7710voipgw) | ||
diff --git a/arch/sh/boards/renesas/systemh/io.c b/arch/sh/boards/renesas/systemh/io.c index cf979011aa94..cde6e5d192c4 100644 --- a/arch/sh/boards/renesas/systemh/io.c +++ b/arch/sh/boards/renesas/systemh/io.c | |||
| @@ -5,66 +5,25 @@ | |||
| 5 | * Based largely on io_se.c. | 5 | * Based largely on io_se.c. |
| 6 | * | 6 | * |
| 7 | * I/O routine for Hitachi 7751 Systemh. | 7 | * I/O routine for Hitachi 7751 Systemh. |
| 8 | * | ||
| 9 | */ | 8 | */ |
| 10 | |||
| 11 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
| 12 | #include <linux/types.h> | 10 | #include <linux/types.h> |
| 13 | #include <asm/systemh/7751systemh.h> | 11 | #include <linux/pci.h> |
| 12 | #include <asm/systemh7751.h> | ||
| 14 | #include <asm/addrspace.h> | 13 | #include <asm/addrspace.h> |
| 15 | #include <asm/io.h> | 14 | #include <asm/io.h> |
| 16 | 15 | ||
| 17 | #include <linux/pci.h> | ||
| 18 | #include "../../drivers/pci/pci-sh7751.h" | ||
| 19 | |||
| 20 | /* | ||
| 21 | * The 7751 SystemH Engine uses the built-in PCI controller (PCIC) | ||
| 22 | * of the 7751 processor, and has a SuperIO accessible on its memory | ||
| 23 | * bus. | ||
| 24 | */ | ||
| 25 | |||
| 26 | #define PCIIOBR (volatile long *)PCI_REG(SH7751_PCIIOBR) | ||
| 27 | #define PCIMBR (volatile long *)PCI_REG(SH7751_PCIMBR) | ||
| 28 | #define PCI_IO_AREA SH7751_PCI_IO_BASE | ||
| 29 | #define PCI_MEM_AREA SH7751_PCI_CONFIG_BASE | ||
| 30 | |||
| 31 | #define PCI_IOMAP(adr) (PCI_IO_AREA + (adr & ~SH7751_PCIIOBR_MASK)) | ||
| 32 | #define ETHER_IOMAP(adr) (0xB3000000 + (adr)) /*map to 16bits access area | 16 | #define ETHER_IOMAP(adr) (0xB3000000 + (adr)) /*map to 16bits access area |
| 33 | of smc lan chip*/ | 17 | of smc lan chip*/ |
| 34 | |||
| 35 | #define maybebadio(name,port) \ | ||
| 36 | printk("bad PC-like io %s for port 0x%lx at 0x%08x\n", \ | ||
| 37 | #name, (port), (__u32) __builtin_return_address(0)) | ||
| 38 | |||
| 39 | static inline void delay(void) | ||
| 40 | { | ||
| 41 | ctrl_inw(0xa0000000); | ||
| 42 | } | ||
| 43 | |||
| 44 | static inline volatile __u16 * | 18 | static inline volatile __u16 * |
| 45 | port2adr(unsigned int port) | 19 | port2adr(unsigned int port) |
| 46 | { | 20 | { |
| 47 | if (port >= 0x2000) | 21 | if (port >= 0x2000) |
| 48 | return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000)); | 22 | return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000)); |
| 49 | #if 0 | 23 | maybebadio((unsigned long)port); |
| 50 | else | ||
| 51 | return (volatile __u16 *) (PA_SUPERIO + (port << 1)); | ||
| 52 | #endif | ||
| 53 | maybebadio(name,(unsigned long)port); | ||
| 54 | return (volatile __u16*)port; | 24 | return (volatile __u16*)port; |
| 55 | } | 25 | } |
| 56 | 26 | ||
| 57 | /* In case someone configures the kernel w/o PCI support: in that */ | ||
| 58 | /* scenario, don't ever bother to check for PCI-window addresses */ | ||
| 59 | |||
| 60 | /* NOTE: WINDOW CHECK MAY BE A BIT OFF, HIGH PCIBIOS_MIN_IO WRAPS? */ | ||
| 61 | #if defined(CONFIG_PCI) | ||
| 62 | #define CHECK_SH7751_PCIIO(port) \ | ||
| 63 | ((port >= PCIBIOS_MIN_IO) && (port < (PCIBIOS_MIN_IO + SH7751_PCI_IO_SIZE))) | ||
| 64 | #else | ||
| 65 | #define CHECK_SH7751_PCIIO(port) (0) | ||
| 66 | #endif | ||
| 67 | |||
| 68 | /* | 27 | /* |
| 69 | * General outline: remap really low stuff [eventually] to SuperIO, | 28 | * General outline: remap really low stuff [eventually] to SuperIO, |
| 70 | * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO) | 29 | * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO) |
| @@ -76,8 +35,8 @@ unsigned char sh7751systemh_inb(unsigned long port) | |||
| 76 | { | 35 | { |
| 77 | if (PXSEG(port)) | 36 | if (PXSEG(port)) |
| 78 | return *(volatile unsigned char *)port; | 37 | return *(volatile unsigned char *)port; |
| 79 | else if (CHECK_SH7751_PCIIO(port)) | 38 | else if (is_pci_ioaddr(port)) |
| 80 | return *(volatile unsigned char *)PCI_IOMAP(port); | 39 | return *(volatile unsigned char *)pci_ioaddr(port); |
| 81 | else if (port <= 0x3F1) | 40 | else if (port <= 0x3F1) |
| 82 | return *(volatile unsigned char *)ETHER_IOMAP(port); | 41 | return *(volatile unsigned char *)ETHER_IOMAP(port); |
| 83 | else | 42 | else |
| @@ -90,13 +49,13 @@ unsigned char sh7751systemh_inb_p(unsigned long port) | |||
| 90 | 49 | ||
| 91 | if (PXSEG(port)) | 50 | if (PXSEG(port)) |
| 92 | v = *(volatile unsigned char *)port; | 51 | v = *(volatile unsigned char *)port; |
| 93 | else if (CHECK_SH7751_PCIIO(port)) | 52 | else if (is_pci_ioaddr(port)) |
| 94 | v = *(volatile unsigned char *)PCI_IOMAP(port); | 53 | v = *(volatile unsigned char *)pci_ioaddr(port); |
| 95 | else if (port <= 0x3F1) | 54 | else if (port <= 0x3F1) |
| 96 | v = *(volatile unsigned char *)ETHER_IOMAP(port); | 55 | v = *(volatile unsigned char *)ETHER_IOMAP(port); |
| 97 | else | 56 | else |
| 98 | v = (*port2adr(port))&0xff; | 57 | v = (*port2adr(port))&0xff; |
| 99 | delay(); | 58 | ctrl_delay(); |
| 100 | return v; | 59 | return v; |
| 101 | } | 60 | } |
| 102 | 61 | ||
| @@ -104,14 +63,14 @@ unsigned short sh7751systemh_inw(unsigned long port) | |||
| 104 | { | 63 | { |
| 105 | if (PXSEG(port)) | 64 | if (PXSEG(port)) |
| 106 | return *(volatile unsigned short *)port; | 65 | return *(volatile unsigned short *)port; |
| 107 | else if (CHECK_SH7751_PCIIO(port)) | 66 | else if (is_pci_ioaddr(port)) |
| 108 | return *(volatile unsigned short *)PCI_IOMAP(port); | 67 | return *(volatile unsigned short *)pci_ioaddr(port); |
| 109 | else if (port >= 0x2000) | 68 | else if (port >= 0x2000) |
| 110 | return *port2adr(port); | 69 | return *port2adr(port); |
| 111 | else if (port <= 0x3F1) | 70 | else if (port <= 0x3F1) |
| 112 | return *(volatile unsigned int *)ETHER_IOMAP(port); | 71 | return *(volatile unsigned int *)ETHER_IOMAP(port); |
| 113 | else | 72 | else |
| 114 | maybebadio(inw, port); | 73 | maybebadio(port); |
| 115 | return 0; | 74 | return 0; |
| 116 | } | 75 | } |
| 117 | 76 | ||
| @@ -119,14 +78,14 @@ unsigned int sh7751systemh_inl(unsigned long port) | |||
| 119 | { | 78 | { |
| 120 | if (PXSEG(port)) | 79 | if (PXSEG(port)) |
| 121 | return *(volatile unsigned long *)port; | 80 | return *(volatile unsigned long *)port; |
| 122 | else if (CHECK_SH7751_PCIIO(port)) | 81 | else if (is_pci_ioaddr(port)) |
| 123 | return *(volatile unsigned int *)PCI_IOMAP(port); | 82 | return *(volatile unsigned int *)pci_ioaddr(port); |
| 124 | else if (port >= 0x2000) | 83 | else if (port >= 0x2000) |
| 125 | return *port2adr(port); | 84 | return *port2adr(port); |
| 126 | else if (port <= 0x3F1) | 85 | else if (port <= 0x3F1) |
| 127 | return *(volatile unsigned int *)ETHER_IOMAP(port); | 86 | return *(volatile unsigned int *)ETHER_IOMAP(port); |
| 128 | else | 87 | else |
| 129 | maybebadio(inl, port); | 88 | maybebadio(port); |
| 130 | return 0; | 89 | return 0; |
| 131 | } | 90 | } |
| 132 | 91 | ||
| @@ -135,8 +94,8 @@ void sh7751systemh_outb(unsigned char value, unsigned long port) | |||
| 135 | 94 | ||
| 136 | if (PXSEG(port)) | 95 | if (PXSEG(port)) |
| 137 | *(volatile unsigned char *)port = value; | 96 | *(volatile unsigned char *)port = value; |
| 138 | else if (CHECK_SH7751_PCIIO(port)) | 97 | else if (is_pci_ioaddr(port)) |
| 139 | *((unsigned char*)PCI_IOMAP(port)) = value; | 98 | *((unsigned char*)pci_ioaddr(port)) = value; |
| 140 | else if (port <= 0x3F1) | 99 | else if (port <= 0x3F1) |
| 141 | *(volatile unsigned char *)ETHER_IOMAP(port) = value; | 100 | *(volatile unsigned char *)ETHER_IOMAP(port) = value; |
| 142 | else | 101 | else |
| @@ -147,37 +106,37 @@ void sh7751systemh_outb_p(unsigned char value, unsigned long port) | |||
| 147 | { | 106 | { |
| 148 | if (PXSEG(port)) | 107 | if (PXSEG(port)) |
| 149 | *(volatile unsigned char *)port = value; | 108 | *(volatile unsigned char *)port = value; |
| 150 | else if (CHECK_SH7751_PCIIO(port)) | 109 | else if (is_pci_ioaddr(port)) |
| 151 | *((unsigned char*)PCI_IOMAP(port)) = value; | 110 | *((unsigned char*)pci_ioaddr(port)) = value; |
| 152 | else if (port <= 0x3F1) | 111 | else if (port <= 0x3F1) |
| 153 | *(volatile unsigned char *)ETHER_IOMAP(port) = value; | 112 | *(volatile unsigned char *)ETHER_IOMAP(port) = value; |
| 154 | else | 113 | else |
| 155 | *(port2adr(port)) = value; | 114 | *(port2adr(port)) = value; |
| 156 | delay(); | 115 | ctrl_delay(); |
| 157 | } | 116 | } |
| 158 | 117 | ||
| 159 | void sh7751systemh_outw(unsigned short value, unsigned long port) | 118 | void sh7751systemh_outw(unsigned short value, unsigned long port) |
| 160 | { | 119 | { |
| 161 | if (PXSEG(port)) | 120 | if (PXSEG(port)) |
| 162 | *(volatile unsigned short *)port = value; | 121 | *(volatile unsigned short *)port = value; |
| 163 | else if (CHECK_SH7751_PCIIO(port)) | 122 | else if (is_pci_ioaddr(port)) |
| 164 | *((unsigned short *)PCI_IOMAP(port)) = value; | 123 | *((unsigned short *)pci_ioaddr(port)) = value; |
| 165 | else if (port >= 0x2000) | 124 | else if (port >= 0x2000) |
| 166 | *port2adr(port) = value; | 125 | *port2adr(port) = value; |
| 167 | else if (port <= 0x3F1) | 126 | else if (port <= 0x3F1) |
| 168 | *(volatile unsigned short *)ETHER_IOMAP(port) = value; | 127 | *(volatile unsigned short *)ETHER_IOMAP(port) = value; |
| 169 | else | 128 | else |
| 170 | maybebadio(outw, port); | 129 | maybebadio(port); |
| 171 | } | 130 | } |
| 172 | 131 | ||
| 173 | void sh7751systemh_outl(unsigned int value, unsigned long port) | 132 | void sh7751systemh_outl(unsigned int value, unsigned long port) |
| 174 | { | 133 | { |
| 175 | if (PXSEG(port)) | 134 | if (PXSEG(port)) |
| 176 | *(volatile unsigned long *)port = value; | 135 | *(volatile unsigned long *)port = value; |
| 177 | else if (CHECK_SH7751_PCIIO(port)) | 136 | else if (is_pci_ioaddr(port)) |
| 178 | *((unsigned long*)PCI_IOMAP(port)) = value; | 137 | *((unsigned long*)pci_ioaddr(port)) = value; |
| 179 | else | 138 | else |
| 180 | maybebadio(outl, port); | 139 | maybebadio(port); |
| 181 | } | 140 | } |
| 182 | 141 | ||
| 183 | void sh7751systemh_insb(unsigned long port, void *addr, unsigned long count) | 142 | void sh7751systemh_insb(unsigned long port, void *addr, unsigned long count) |
| @@ -194,7 +153,7 @@ void sh7751systemh_insw(unsigned long port, void *addr, unsigned long count) | |||
| 194 | 153 | ||
| 195 | void sh7751systemh_insl(unsigned long port, void *addr, unsigned long count) | 154 | void sh7751systemh_insl(unsigned long port, void *addr, unsigned long count) |
| 196 | { | 155 | { |
| 197 | maybebadio(insl, port); | 156 | maybebadio(port); |
| 198 | } | 157 | } |
| 199 | 158 | ||
| 200 | void sh7751systemh_outsb(unsigned long port, const void *addr, unsigned long count) | 159 | void sh7751systemh_outsb(unsigned long port, const void *addr, unsigned long count) |
| @@ -211,73 +170,5 @@ void sh7751systemh_outsw(unsigned long port, const void *addr, unsigned long cou | |||
| 211 | 170 | ||
| 212 | void sh7751systemh_outsl(unsigned long port, const void *addr, unsigned long count) | 171 | void sh7751systemh_outsl(unsigned long port, const void *addr, unsigned long count) |
| 213 | { | 172 | { |
| 214 | maybebadio(outsw, port); | 173 | maybebadio(port); |
| 215 | } | ||
| 216 | |||
| 217 | /* For read/write calls, just copy generic (pass-thru); PCIMBR is */ | ||
| 218 | /* already set up. For a larger memory space, these would need to */ | ||
| 219 | /* reset PCIMBR as needed on a per-call basis... */ | ||
| 220 | |||
| 221 | unsigned char sh7751systemh_readb(unsigned long addr) | ||
| 222 | { | ||
| 223 | return *(volatile unsigned char*)addr; | ||
| 224 | } | ||
| 225 | |||
| 226 | unsigned short sh7751systemh_readw(unsigned long addr) | ||
| 227 | { | ||
| 228 | return *(volatile unsigned short*)addr; | ||
| 229 | } | ||
| 230 | |||
| 231 | unsigned int sh7751systemh_readl(unsigned long addr) | ||
| 232 | { | ||
| 233 | return *(volatile unsigned long*)addr; | ||
| 234 | } | ||
| 235 | |||
| 236 | void sh7751systemh_writeb(unsigned char b, unsigned long addr) | ||
| 237 | { | ||
| 238 | *(volatile unsigned char*)addr = b; | ||
| 239 | } | ||
| 240 | |||
| 241 | void sh7751systemh_writew(unsigned short b, unsigned long addr) | ||
| 242 | { | ||
| 243 | *(volatile unsigned short*)addr = b; | ||
| 244 | } | ||
| 245 | |||
| 246 | void sh7751systemh_writel(unsigned int b, unsigned long addr) | ||
| 247 | { | ||
| 248 | *(volatile unsigned long*)addr = b; | ||
| 249 | } | ||
| 250 | |||
| 251 | |||
| 252 | |||
| 253 | /* Map ISA bus address to the real address. Only for PCMCIA. */ | ||
| 254 | |||
| 255 | /* ISA page descriptor. */ | ||
| 256 | static __u32 sh_isa_memmap[256]; | ||
| 257 | |||
| 258 | #if 0 | ||
| 259 | static int | ||
| 260 | sh_isa_mmap(__u32 start, __u32 length, __u32 offset) | ||
| 261 | { | ||
| 262 | int idx; | ||
| 263 | |||
| 264 | if (start >= 0x100000 || (start & 0xfff) || (length != 0x1000)) | ||
| 265 | return -1; | ||
| 266 | |||
| 267 | idx = start >> 12; | ||
| 268 | sh_isa_memmap[idx] = 0xb8000000 + (offset &~ 0xfff); | ||
| 269 | printk("sh_isa_mmap: start %x len %x offset %x (idx %x paddr %x)\n", | ||
| 270 | start, length, offset, idx, sh_isa_memmap[idx]); | ||
| 271 | return 0; | ||
| 272 | } | ||
| 273 | #endif | ||
| 274 | |||
| 275 | unsigned long | ||
| 276 | sh7751systemh_isa_port2addr(unsigned long offset) | ||
| 277 | { | ||
| 278 | int idx; | ||
| 279 | |||
| 280 | idx = (offset >> 12) & 0xff; | ||
| 281 | offset &= 0xfff; | ||
| 282 | return sh_isa_memmap[idx] + offset; | ||
| 283 | } | 174 | } |
diff --git a/arch/sh/boards/renesas/systemh/irq.c b/arch/sh/boards/renesas/systemh/irq.c index 8372d967f601..8d016dae2333 100644 --- a/arch/sh/boards/renesas/systemh/irq.c +++ b/arch/sh/boards/renesas/systemh/irq.c | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | #include <linux/hdreg.h> | 15 | #include <linux/hdreg.h> |
| 16 | #include <linux/ide.h> | 16 | #include <linux/ide.h> |
| 17 | #include <asm/io.h> | 17 | #include <asm/io.h> |
| 18 | #include <asm/mach/7751systemh.h> | 18 | #include <asm/systemh7751.h> |
| 19 | #include <asm/smc37c93x.h> | 19 | #include <asm/smc37c93x.h> |
| 20 | 20 | ||
| 21 | /* address of external interrupt mask register | 21 | /* address of external interrupt mask register |
| @@ -57,12 +57,9 @@ static void shutdown_systemh_irq(unsigned int irq) | |||
| 57 | static void disable_systemh_irq(unsigned int irq) | 57 | static void disable_systemh_irq(unsigned int irq) |
| 58 | { | 58 | { |
| 59 | if (systemh_irq_mask_register) { | 59 | if (systemh_irq_mask_register) { |
| 60 | unsigned long flags; | ||
| 61 | unsigned long val, mask = 0x01 << 1; | 60 | unsigned long val, mask = 0x01 << 1; |
| 62 | 61 | ||
| 63 | /* Clear the "irq"th bit in the mask and set it in the request */ | 62 | /* Clear the "irq"th bit in the mask and set it in the request */ |
| 64 | local_irq_save(flags); | ||
| 65 | |||
| 66 | val = ctrl_inl((unsigned long)systemh_irq_mask_register); | 63 | val = ctrl_inl((unsigned long)systemh_irq_mask_register); |
| 67 | val &= ~mask; | 64 | val &= ~mask; |
| 68 | ctrl_outl(val, (unsigned long)systemh_irq_mask_register); | 65 | ctrl_outl(val, (unsigned long)systemh_irq_mask_register); |
| @@ -70,23 +67,18 @@ static void disable_systemh_irq(unsigned int irq) | |||
| 70 | val = ctrl_inl((unsigned long)systemh_irq_request_register); | 67 | val = ctrl_inl((unsigned long)systemh_irq_request_register); |
| 71 | val |= mask; | 68 | val |= mask; |
| 72 | ctrl_outl(val, (unsigned long)systemh_irq_request_register); | 69 | ctrl_outl(val, (unsigned long)systemh_irq_request_register); |
| 73 | |||
| 74 | local_irq_restore(flags); | ||
| 75 | } | 70 | } |
| 76 | } | 71 | } |
| 77 | 72 | ||
| 78 | static void enable_systemh_irq(unsigned int irq) | 73 | static void enable_systemh_irq(unsigned int irq) |
| 79 | { | 74 | { |
| 80 | if (systemh_irq_mask_register) { | 75 | if (systemh_irq_mask_register) { |
| 81 | unsigned long flags; | ||
| 82 | unsigned long val, mask = 0x01 << 1; | 76 | unsigned long val, mask = 0x01 << 1; |
| 83 | 77 | ||
| 84 | /* Set "irq"th bit in the mask register */ | 78 | /* Set "irq"th bit in the mask register */ |
| 85 | local_irq_save(flags); | ||
| 86 | val = ctrl_inl((unsigned long)systemh_irq_mask_register); | 79 | val = ctrl_inl((unsigned long)systemh_irq_mask_register); |
| 87 | val |= mask; | 80 | val |= mask; |
| 88 | ctrl_outl(val, (unsigned long)systemh_irq_mask_register); | 81 | ctrl_outl(val, (unsigned long)systemh_irq_mask_register); |
| 89 | local_irq_restore(flags); | ||
| 90 | } | 82 | } |
| 91 | } | 83 | } |
| 92 | 84 | ||
diff --git a/arch/sh/boards/renesas/systemh/setup.c b/arch/sh/boards/renesas/systemh/setup.c index 826fa3d7669c..a8467bf90c25 100644 --- a/arch/sh/boards/renesas/systemh/setup.c +++ b/arch/sh/boards/renesas/systemh/setup.c | |||
| @@ -15,28 +15,21 @@ | |||
| 15 | * for more details. | 15 | * for more details. |
| 16 | */ | 16 | */ |
| 17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
| 18 | #include <asm/mach/7751systemh.h> | ||
| 19 | #include <asm/mach/io.h> | ||
| 20 | #include <asm/machvec.h> | 18 | #include <asm/machvec.h> |
| 19 | #include <asm/systemh7751.h> | ||
| 21 | 20 | ||
| 22 | extern void make_systemh_irq(unsigned int irq); | 21 | extern void make_systemh_irq(unsigned int irq); |
| 23 | 22 | ||
| 24 | const char *get_system_type(void) | ||
| 25 | { | ||
| 26 | return "7751 SystemH"; | ||
| 27 | } | ||
| 28 | |||
| 29 | /* | 23 | /* |
| 30 | * Initialize IRQ setting | 24 | * Initialize IRQ setting |
| 31 | */ | 25 | */ |
| 32 | void __init init_7751systemh_IRQ(void) | 26 | static void __init sh7751systemh_init_irq(void) |
| 33 | { | 27 | { |
| 34 | /* make_ipr_irq(10, BCR_ILCRD, 1, 0x0f-10); LAN */ | ||
| 35 | /* make_ipr_irq(14, BCR_ILCRA, 2, 0x0f-4); */ | ||
| 36 | make_systemh_irq(0xb); /* Ethernet interrupt */ | 28 | make_systemh_irq(0xb); /* Ethernet interrupt */ |
| 37 | } | 29 | } |
| 38 | 30 | ||
| 39 | struct sh_machine_vector mv_7751systemh __initmv = { | 31 | struct sh_machine_vector mv_7751systemh __initmv = { |
| 32 | .mv_name = "7751 SystemH", | ||
| 40 | .mv_nr_irqs = 72, | 33 | .mv_nr_irqs = 72, |
| 41 | 34 | ||
| 42 | .mv_inb = sh7751systemh_inb, | 35 | .mv_inb = sh7751systemh_inb, |
| @@ -60,21 +53,6 @@ struct sh_machine_vector mv_7751systemh __initmv = { | |||
| 60 | .mv_outsw = sh7751systemh_outsw, | 53 | .mv_outsw = sh7751systemh_outsw, |
| 61 | .mv_outsl = sh7751systemh_outsl, | 54 | .mv_outsl = sh7751systemh_outsl, |
| 62 | 55 | ||
| 63 | .mv_readb = sh7751systemh_readb, | 56 | .mv_init_irq = sh7751system_init_irq, |
| 64 | .mv_readw = sh7751systemh_readw, | ||
| 65 | .mv_readl = sh7751systemh_readl, | ||
| 66 | .mv_writeb = sh7751systemh_writeb, | ||
| 67 | .mv_writew = sh7751systemh_writew, | ||
| 68 | .mv_writel = sh7751systemh_writel, | ||
| 69 | |||
| 70 | .mv_isa_port2addr = sh7751systemh_isa_port2addr, | ||
| 71 | |||
| 72 | .mv_init_irq = init_7751systemh_IRQ, | ||
| 73 | }; | 57 | }; |
| 74 | ALIAS_MV(7751systemh) | 58 | ALIAS_MV(7751systemh) |
| 75 | |||
| 76 | int __init platform_setup(void) | ||
| 77 | { | ||
| 78 | return 0; | ||
| 79 | } | ||
| 80 | |||
