aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/Kconfig16
-rw-r--r--arch/sh/boards/Kconfig3
-rw-r--r--arch/sh/boards/mach-ap325rxa/setup.c2
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c101
-rw-r--r--arch/sh/boards/mach-migor/setup.c2
-rw-r--r--arch/sh/boards/mach-se/7724/setup.c8
-rw-r--r--arch/sh/boot/compressed/vmlinux.scr2
-rw-r--r--arch/sh/boot/romimage/Makefile13
-rw-r--r--arch/sh/boot/romimage/head.S42
-rw-r--r--arch/sh/boot/romimage/mmcif-sh7724.c72
-rw-r--r--arch/sh/boot/romimage/vmlinux.scr2
-rw-r--r--arch/sh/include/asm/cache.h2
-rw-r--r--arch/sh/include/asm/io.h8
-rw-r--r--arch/sh/include/asm/machvec.h9
-rw-r--r--arch/sh/include/cpu-sh4/cpu/sh7724.h1
-rw-r--r--arch/sh/include/mach-common/mach/romimage.h10
-rw-r--r--arch/sh/include/mach-ecovec24/mach/romimage.h27
-rw-r--r--arch/sh/include/mach-kfr2r09/mach/romimage.h10
-rw-r--r--arch/sh/kernel/Makefile3
-rw-r--r--arch/sh/kernel/dwarf.c19
-rw-r--r--arch/sh/kernel/io.c22
-rw-r--r--arch/sh/kernel/io_generic.c20
-rw-r--r--arch/sh/kernel/io_trapped.c4
-rw-r--r--arch/sh/kernel/machvec.c17
-rw-r--r--arch/sh/kernel/return_address.c2
25 files changed, 356 insertions, 61 deletions
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index c5ee4ce60b57..573fca1fbd9b 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -9,7 +9,7 @@ config SUPERH
9 def_bool y 9 def_bool y
10 select EMBEDDED 10 select EMBEDDED
11 select HAVE_CLK 11 select HAVE_CLK
12 select HAVE_IDE 12 select HAVE_IDE if HAS_IOPORT
13 select HAVE_LMB 13 select HAVE_LMB
14 select HAVE_OPROFILE 14 select HAVE_OPROFILE
15 select HAVE_GENERIC_DMA_COHERENT 15 select HAVE_GENERIC_DMA_COHERENT
@@ -174,6 +174,9 @@ config ARCH_HAS_DEFAULT_IDLE
174config ARCH_HAS_CPU_IDLE_WAIT 174config ARCH_HAS_CPU_IDLE_WAIT
175 def_bool y 175 def_bool y
176 176
177config NO_IOPORT
178 bool
179
177config IO_TRAPPED 180config IO_TRAPPED
178 bool 181 bool
179 182
@@ -776,6 +779,17 @@ config ENTRY_OFFSET
776 default "0x00010000" if PAGE_SIZE_64KB 779 default "0x00010000" if PAGE_SIZE_64KB
777 default "0x00000000" 780 default "0x00000000"
778 781
782config ROMIMAGE_MMCIF
783 bool "Include MMCIF loader in romImage (EXPERIMENTAL)"
784 depends on CPU_SUBTYPE_SH7724 && EXPERIMENTAL
785 help
786 Say Y here to include experimental MMCIF loading code in
787 romImage. With this enabled it is possible to write the romImage
788 kernel image to an MMC card and boot the kernel straight from
789 the reset vector. At reset the processor Mask ROM will load the
790 first part of the romImage which in turn loads the rest the kernel
791 image to RAM using the MMCIF hardware block.
792
779choice 793choice
780 prompt "Kernel command line" 794 prompt "Kernel command line"
781 optional 795 optional
diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig
index 938e87d51482..07b35ca2f644 100644
--- a/arch/sh/boards/Kconfig
+++ b/arch/sh/boards/Kconfig
@@ -154,6 +154,7 @@ config SH_SDK7786
154 bool "SDK7786" 154 bool "SDK7786"
155 depends on CPU_SUBTYPE_SH7786 155 depends on CPU_SUBTYPE_SH7786
156 select SYS_SUPPORTS_PCI 156 select SYS_SUPPORTS_PCI
157 select NO_IOPORT if !PCI
157 help 158 help
158 Select SDK7786 if configuring for a Renesas Technology Europe 159 Select SDK7786 if configuring for a Renesas Technology Europe
159 SH7786-65nm board. 160 SH7786-65nm board.
@@ -190,6 +191,7 @@ config SH_URQUELL
190 depends on CPU_SUBTYPE_SH7786 191 depends on CPU_SUBTYPE_SH7786
191 select ARCH_REQUIRE_GPIOLIB 192 select ARCH_REQUIRE_GPIOLIB
192 select SYS_SUPPORTS_PCI 193 select SYS_SUPPORTS_PCI
194 select NO_IOPORT if !PCI
193 195
194config SH_MIGOR 196config SH_MIGOR
195 bool "Migo-R" 197 bool "Migo-R"
@@ -286,6 +288,7 @@ config SH_LBOX_RE2
286config SH_X3PROTO 288config SH_X3PROTO
287 bool "SH-X3 Prototype board" 289 bool "SH-X3 Prototype board"
288 depends on CPU_SUBTYPE_SHX3 290 depends on CPU_SUBTYPE_SHX3
291 select NO_IOPORT if !PCI
289 292
290config SH_MAGIC_PANEL_R2 293config SH_MAGIC_PANEL_R2
291 bool "Magic Panel R2" 294 bool "Magic Panel R2"
diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
index 57e37e284208..3a170bd3f3d0 100644
--- a/arch/sh/boards/mach-ap325rxa/setup.c
+++ b/arch/sh/boards/mach-ap325rxa/setup.c
@@ -328,7 +328,7 @@ static struct soc_camera_platform_info camera_info = {
328 .set_capture = camera_set_capture, 328 .set_capture = camera_set_capture,
329}; 329};
330 330
331struct soc_camera_link camera_link = { 331static struct soc_camera_link camera_link = {
332 .bus_id = 0, 332 .bus_id = 0,
333 .add_device = ap325rxa_camera_add, 333 .add_device = ap325rxa_camera_add,
334 .del_device = ap325rxa_camera_del, 334 .del_device = ap325rxa_camera_del,
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 49714258732e..be1d114d3a43 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -12,6 +12,8 @@
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/mfd/sh_mobile_sdhi.h> 14#include <linux/mfd/sh_mobile_sdhi.h>
15#include <linux/mmc/host.h>
16#include <linux/mmc/sh_mmcif.h>
15#include <linux/mtd/physmap.h> 17#include <linux/mtd/physmap.h>
16#include <linux/gpio.h> 18#include <linux/gpio.h>
17#include <linux/interrupt.h> 19#include <linux/interrupt.h>
@@ -26,7 +28,6 @@
26#include <linux/mmc/host.h> 28#include <linux/mmc/host.h>
27#include <linux/input.h> 29#include <linux/input.h>
28#include <linux/input/sh_keysc.h> 30#include <linux/input/sh_keysc.h>
29#include <linux/mfd/sh_mobile_sdhi.h>
30#include <video/sh_mobile_lcdc.h> 31#include <video/sh_mobile_lcdc.h>
31#include <sound/sh_fsi.h> 32#include <sound/sh_fsi.h>
32#include <media/sh_mobile_ceu.h> 33#include <media/sh_mobile_ceu.h>
@@ -139,7 +140,7 @@ static struct resource sh_eth_resources[] = {
139 }, 140 },
140}; 141};
141 142
142struct sh_eth_plat_data sh_eth_plat = { 143static struct sh_eth_plat_data sh_eth_plat = {
143 .phy = 0x1f, /* SMSC LAN8700 */ 144 .phy = 0x1f, /* SMSC LAN8700 */
144 .edmac_endian = EDMAC_LITTLE_ENDIAN, 145 .edmac_endian = EDMAC_LITTLE_ENDIAN,
145 .ether_link_active_low = 1 146 .ether_link_active_low = 1
@@ -159,7 +160,7 @@ static struct platform_device sh_eth_device = {
159}; 160};
160 161
161/* USB0 host */ 162/* USB0 host */
162void usb0_port_power(int port, int power) 163static void usb0_port_power(int port, int power)
163{ 164{
164 gpio_set_value(GPIO_PTB4, power); 165 gpio_set_value(GPIO_PTB4, power);
165} 166}
@@ -195,7 +196,7 @@ static struct platform_device usb0_host_device = {
195}; 196};
196 197
197/* USB1 host/function */ 198/* USB1 host/function */
198void usb1_port_power(int port, int power) 199static void usb1_port_power(int port, int power)
199{ 200{
200 gpio_set_value(GPIO_PTB5, power); 201 gpio_set_value(GPIO_PTB5, power);
201} 202}
@@ -421,7 +422,7 @@ static int ts_init(void)
421 return 0; 422 return 0;
422} 423}
423 424
424struct tsc2007_platform_data tsc2007_info = { 425static struct tsc2007_platform_data tsc2007_info = {
425 .model = 2007, 426 .model = 2007,
426 .x_plate_ohms = 180, 427 .x_plate_ohms = 180,
427 .get_pendown_state = ts_get_pendown_state, 428 .get_pendown_state = ts_get_pendown_state,
@@ -436,7 +437,7 @@ static struct i2c_board_info ts_i2c_clients = {
436}; 437};
437 438
438#ifdef CONFIG_MFD_SH_MOBILE_SDHI 439#ifdef CONFIG_MFD_SH_MOBILE_SDHI
439/* SHDI0 */ 440/* SDHI0 */
440static void sdhi0_set_pwr(struct platform_device *pdev, int state) 441static void sdhi0_set_pwr(struct platform_device *pdev, int state)
441{ 442{
442 gpio_set_value(GPIO_PTB6, state); 443 gpio_set_value(GPIO_PTB6, state);
@@ -474,7 +475,8 @@ static struct platform_device sdhi0_device = {
474 }, 475 },
475}; 476};
476 477
477/* SHDI1 */ 478#if !defined(CONFIG_MMC_SH_MMCIF)
479/* SDHI1 */
478static void sdhi1_set_pwr(struct platform_device *pdev, int state) 480static void sdhi1_set_pwr(struct platform_device *pdev, int state)
479{ 481{
480 gpio_set_value(GPIO_PTB7, state); 482 gpio_set_value(GPIO_PTB7, state);
@@ -511,6 +513,7 @@ static struct platform_device sdhi1_device = {
511 .hwblk_id = HWBLK_SDHI1, 513 .hwblk_id = HWBLK_SDHI1,
512 }, 514 },
513}; 515};
516#endif /* CONFIG_MMC_SH_MMCIF */
514 517
515#else 518#else
516 519
@@ -720,7 +723,7 @@ static struct clk fsimckb_clk = {
720 .rate = 0, /* unknown */ 723 .rate = 0, /* unknown */
721}; 724};
722 725
723struct sh_fsi_platform_info fsi_info = { 726static struct sh_fsi_platform_info fsi_info = {
724 .portb_flags = SH_FSI_BRS_INV | 727 .portb_flags = SH_FSI_BRS_INV |
725 SH_FSI_OUT_SLAVE_MODE | 728 SH_FSI_OUT_SLAVE_MODE |
726 SH_FSI_IN_SLAVE_MODE | 729 SH_FSI_IN_SLAVE_MODE |
@@ -777,7 +780,7 @@ static struct platform_device irda_device = {
777#include <media/ak881x.h> 780#include <media/ak881x.h>
778#include <media/sh_vou.h> 781#include <media/sh_vou.h>
779 782
780struct ak881x_pdata ak881x_pdata = { 783static struct ak881x_pdata ak881x_pdata = {
781 .flags = AK881X_IF_MODE_SLAVE, 784 .flags = AK881X_IF_MODE_SLAVE,
782}; 785};
783 786
@@ -786,7 +789,7 @@ static struct i2c_board_info ak8813 = {
786 .platform_data = &ak881x_pdata, 789 .platform_data = &ak881x_pdata,
787}; 790};
788 791
789struct sh_vou_pdata sh_vou_pdata = { 792static struct sh_vou_pdata sh_vou_pdata = {
790 .bus_fmt = SH_VOU_BUS_8BIT, 793 .bus_fmt = SH_VOU_BUS_8BIT,
791 .flags = SH_VOU_HSYNC_LOW | SH_VOU_VSYNC_LOW, 794 .flags = SH_VOU_HSYNC_LOW | SH_VOU_VSYNC_LOW,
792 .board_info = &ak8813, 795 .board_info = &ak8813,
@@ -819,6 +822,58 @@ static struct platform_device vou_device = {
819 }, 822 },
820}; 823};
821 824
825#if defined(CONFIG_MMC_SH_MMCIF)
826/* SH_MMCIF */
827static void mmcif_set_pwr(struct platform_device *pdev, int state)
828{
829 gpio_set_value(GPIO_PTB7, state);
830}
831
832static void mmcif_down_pwr(struct platform_device *pdev)
833{
834 gpio_set_value(GPIO_PTB7, 0);
835}
836
837static struct resource sh_mmcif_resources[] = {
838 [0] = {
839 .name = "SH_MMCIF",
840 .start = 0xA4CA0000,
841 .end = 0xA4CA00FF,
842 .flags = IORESOURCE_MEM,
843 },
844 [1] = {
845 /* MMC2I */
846 .start = 29,
847 .flags = IORESOURCE_IRQ,
848 },
849 [2] = {
850 /* MMC3I */
851 .start = 30,
852 .flags = IORESOURCE_IRQ,
853 },
854};
855
856static struct sh_mmcif_plat_data sh_mmcif_plat = {
857 .set_pwr = mmcif_set_pwr,
858 .down_pwr = mmcif_down_pwr,
859 .sup_pclk = 0, /* SH7724: Max Pclk/2 */
860 .caps = MMC_CAP_4_BIT_DATA |
861 MMC_CAP_8_BIT_DATA |
862 MMC_CAP_NEEDS_POLL,
863 .ocr = MMC_VDD_32_33 | MMC_VDD_33_34,
864};
865
866static struct platform_device sh_mmcif_device = {
867 .name = "sh_mmcif",
868 .id = 0,
869 .dev = {
870 .platform_data = &sh_mmcif_plat,
871 },
872 .num_resources = ARRAY_SIZE(sh_mmcif_resources),
873 .resource = sh_mmcif_resources,
874};
875#endif
876
822static struct platform_device *ecovec_devices[] __initdata = { 877static struct platform_device *ecovec_devices[] __initdata = {
823 &heartbeat_device, 878 &heartbeat_device,
824 &nor_flash_device, 879 &nor_flash_device,
@@ -831,7 +886,9 @@ static struct platform_device *ecovec_devices[] __initdata = {
831 &keysc_device, 886 &keysc_device,
832#ifdef CONFIG_MFD_SH_MOBILE_SDHI 887#ifdef CONFIG_MFD_SH_MOBILE_SDHI
833 &sdhi0_device, 888 &sdhi0_device,
889#if !defined(CONFIG_MMC_SH_MMCIF)
834 &sdhi1_device, 890 &sdhi1_device,
891#endif
835#else 892#else
836 &msiof0_device, 893 &msiof0_device,
837#endif 894#endif
@@ -841,6 +898,9 @@ static struct platform_device *ecovec_devices[] __initdata = {
841 &fsi_device, 898 &fsi_device,
842 &irda_device, 899 &irda_device,
843 &vou_device, 900 &vou_device,
901#if defined(CONFIG_MMC_SH_MMCIF)
902 &sh_mmcif_device,
903#endif
844}; 904};
845 905
846#ifdef CONFIG_I2C 906#ifdef CONFIG_I2C
@@ -1134,6 +1194,7 @@ static int __init arch_setup(void)
1134 gpio_request(GPIO_PTB6, NULL); 1194 gpio_request(GPIO_PTB6, NULL);
1135 gpio_direction_output(GPIO_PTB6, 0); 1195 gpio_direction_output(GPIO_PTB6, 0);
1136 1196
1197#if !defined(CONFIG_MMC_SH_MMCIF)
1137 /* enable SDHI1 on CN12 (needs DS2.6,7 set to ON,OFF) */ 1198 /* enable SDHI1 on CN12 (needs DS2.6,7 set to ON,OFF) */
1138 gpio_request(GPIO_FN_SDHI1CD, NULL); 1199 gpio_request(GPIO_FN_SDHI1CD, NULL);
1139 gpio_request(GPIO_FN_SDHI1WP, NULL); 1200 gpio_request(GPIO_FN_SDHI1WP, NULL);
@@ -1148,6 +1209,7 @@ static int __init arch_setup(void)
1148 1209
1149 /* I/O buffer drive ability is high for SDHI1 */ 1210 /* I/O buffer drive ability is high for SDHI1 */
1150 __raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA); 1211 __raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);
1212#endif /* CONFIG_MMC_SH_MMCIF */
1151#else 1213#else
1152 /* enable MSIOF0 on CN11 (needs DS2.4 set to OFF) */ 1214 /* enable MSIOF0 on CN11 (needs DS2.4 set to OFF) */
1153 gpio_request(GPIO_FN_MSIOF0_TXD, NULL); 1215 gpio_request(GPIO_FN_MSIOF0_TXD, NULL);
@@ -1223,6 +1285,25 @@ static int __init arch_setup(void)
1223 gpio_request(GPIO_PTU5, NULL); 1285 gpio_request(GPIO_PTU5, NULL);
1224 gpio_direction_output(GPIO_PTU5, 0); 1286 gpio_direction_output(GPIO_PTU5, 0);
1225 1287
1288#if defined(CONFIG_MMC_SH_MMCIF)
1289 /* enable MMCIF (needs DS2.6,7 set to OFF,ON) */
1290 gpio_request(GPIO_FN_MMC_D7, NULL);
1291 gpio_request(GPIO_FN_MMC_D6, NULL);
1292 gpio_request(GPIO_FN_MMC_D5, NULL);
1293 gpio_request(GPIO_FN_MMC_D4, NULL);
1294 gpio_request(GPIO_FN_MMC_D3, NULL);
1295 gpio_request(GPIO_FN_MMC_D2, NULL);
1296 gpio_request(GPIO_FN_MMC_D1, NULL);
1297 gpio_request(GPIO_FN_MMC_D0, NULL);
1298 gpio_request(GPIO_FN_MMC_CLK, NULL);
1299 gpio_request(GPIO_FN_MMC_CMD, NULL);
1300 gpio_request(GPIO_PTB7, NULL);
1301 gpio_direction_output(GPIO_PTB7, 0);
1302
1303 /* I/O buffer drive ability is high for MMCIF */
1304 __raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);
1305#endif
1306
1226 /* enable I2C device */ 1307 /* enable I2C device */
1227 i2c_register_board_info(0, i2c0_devices, 1308 i2c_register_board_info(0, i2c0_devices,
1228 ARRAY_SIZE(i2c0_devices)); 1309 ARRAY_SIZE(i2c0_devices));
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
index 87185de20446..662debe4ead2 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -181,7 +181,7 @@ static int migor_nand_flash_ready(struct mtd_info *mtd)
181 return gpio_get_value(GPIO_PTA1); /* NAND_RBn */ 181 return gpio_get_value(GPIO_PTA1); /* NAND_RBn */
182} 182}
183 183
184struct platform_nand_data migor_nand_flash_data = { 184static struct platform_nand_data migor_nand_flash_data = {
185 .chip = { 185 .chip = {
186 .nr_chips = 1, 186 .nr_chips = 1,
187 .partitions = migor_nand_flash_partitions, 187 .partitions = migor_nand_flash_partitions,
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
index f9b82546c2df..552ebd9ba82b 100644
--- a/arch/sh/boards/mach-se/7724/setup.c
+++ b/arch/sh/boards/mach-se/7724/setup.c
@@ -283,7 +283,7 @@ static struct clk fsimcka_clk = {
283}; 283};
284 284
285/* change J20, J21, J22 pin to 1-2 connection to use slave mode */ 285/* change J20, J21, J22 pin to 1-2 connection to use slave mode */
286struct sh_fsi_platform_info fsi_info = { 286static struct sh_fsi_platform_info fsi_info = {
287 .porta_flags = SH_FSI_BRS_INV | 287 .porta_flags = SH_FSI_BRS_INV |
288 SH_FSI_OUT_SLAVE_MODE | 288 SH_FSI_OUT_SLAVE_MODE |
289 SH_FSI_IN_SLAVE_MODE | 289 SH_FSI_IN_SLAVE_MODE |
@@ -371,7 +371,7 @@ static struct resource sh_eth_resources[] = {
371 }, 371 },
372}; 372};
373 373
374struct sh_eth_plat_data sh_eth_plat = { 374static struct sh_eth_plat_data sh_eth_plat = {
375 .phy = 0x1f, /* SMSC LAN8187 */ 375 .phy = 0x1f, /* SMSC LAN8187 */
376 .edmac_endian = EDMAC_LITTLE_ENDIAN, 376 .edmac_endian = EDMAC_LITTLE_ENDIAN,
377}; 377};
@@ -535,7 +535,7 @@ static struct platform_device irda_device = {
535#include <media/ak881x.h> 535#include <media/ak881x.h>
536#include <media/sh_vou.h> 536#include <media/sh_vou.h>
537 537
538struct ak881x_pdata ak881x_pdata = { 538static struct ak881x_pdata ak881x_pdata = {
539 .flags = AK881X_IF_MODE_SLAVE, 539 .flags = AK881X_IF_MODE_SLAVE,
540}; 540};
541 541
@@ -545,7 +545,7 @@ static struct i2c_board_info ak8813 = {
545 .platform_data = &ak881x_pdata, 545 .platform_data = &ak881x_pdata,
546}; 546};
547 547
548struct sh_vou_pdata sh_vou_pdata = { 548static struct sh_vou_pdata sh_vou_pdata = {
549 .bus_fmt = SH_VOU_BUS_8BIT, 549 .bus_fmt = SH_VOU_BUS_8BIT,
550 .flags = SH_VOU_HSYNC_LOW | SH_VOU_VSYNC_LOW, 550 .flags = SH_VOU_HSYNC_LOW | SH_VOU_VSYNC_LOW,
551 .board_info = &ak8813, 551 .board_info = &ak8813,
diff --git a/arch/sh/boot/compressed/vmlinux.scr b/arch/sh/boot/compressed/vmlinux.scr
index f02382ae5c48..862d74808236 100644
--- a/arch/sh/boot/compressed/vmlinux.scr
+++ b/arch/sh/boot/compressed/vmlinux.scr
@@ -1,6 +1,6 @@
1SECTIONS 1SECTIONS
2{ 2{
3 .rodata.compressed : { 3 .rodata..compressed : {
4 input_len = .; 4 input_len = .;
5 LONG(input_data_end - input_data) input_data = .; 5 LONG(input_data_end - input_data) input_data = .;
6 *(.data) 6 *(.data)
diff --git a/arch/sh/boot/romimage/Makefile b/arch/sh/boot/romimage/Makefile
index f473a24a2d92..2216ee57f251 100644
--- a/arch/sh/boot/romimage/Makefile
+++ b/arch/sh/boot/romimage/Makefile
@@ -1,16 +1,21 @@
1# 1#
2# linux/arch/sh/boot/romimage/Makefile 2# linux/arch/sh/boot/romimage/Makefile
3# 3#
4# create an image suitable for burning to flash from zImage 4# create an romImage file suitable for burning to flash/mmc from zImage
5# 5#
6 6
7targets := vmlinux head.o zeropage.bin piggy.o 7targets := vmlinux head.o zeropage.bin piggy.o
8load-y := 0
8 9
9OBJECTS = $(obj)/head.o 10mmcif-load-$(CONFIG_CPU_SUBTYPE_SH7724) := 0xe5200000 # ILRAM
10LDFLAGS_vmlinux := --oformat $(ld-bfd) -Ttext 0 -e romstart \ 11mmcif-obj-$(CONFIG_CPU_SUBTYPE_SH7724) := $(obj)/mmcif-sh7724.o
12load-$(CONFIG_ROMIMAGE_MMCIF) := $(mmcif-load-y)
13obj-$(CONFIG_ROMIMAGE_MMCIF) := $(mmcif-obj-y)
14
15LDFLAGS_vmlinux := --oformat $(ld-bfd) -Ttext $(load-y) -e romstart \
11 -T $(obj)/../../kernel/vmlinux.lds 16 -T $(obj)/../../kernel/vmlinux.lds
12 17
13$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o FORCE 18$(obj)/vmlinux: $(obj)/head.o $(obj-y) $(obj)/piggy.o FORCE
14 $(call if_changed,ld) 19 $(call if_changed,ld)
15 @: 20 @:
16 21
diff --git a/arch/sh/boot/romimage/head.S b/arch/sh/boot/romimage/head.S
index 93e779a405ec..4671d1b82150 100644
--- a/arch/sh/boot/romimage/head.S
+++ b/arch/sh/boot/romimage/head.S
@@ -12,8 +12,40 @@ romstart:
12 /* include board specific setup code */ 12 /* include board specific setup code */
13#include <mach/romimage.h> 13#include <mach/romimage.h>
14 14
15#ifdef CONFIG_ROMIMAGE_MMCIF
16 /* load the romImage to above the empty zero page */
17 mov.l empty_zero_page_dst, r4
18 mov.l empty_zero_page_dst_adj, r5
19 add r5, r4
20 mov.l bytes_to_load, r5
21 mov.l loader_function, r7
22 jsr @r7
23 mov r4, r15
24
25 mov.l empty_zero_page_dst, r4
26 mov.l empty_zero_page_dst_adj, r5
27 add r5, r4
28 mov.l loaded_code_offs, r5
29 add r5, r4
30 jmp @r4
31 nop
32
33 .balign 4
34empty_zero_page_dst_adj:
35 .long PAGE_SIZE
36bytes_to_load:
37 .long end_data - romstart
38loader_function:
39 .long mmcif_loader
40loaded_code_offs:
41 .long loaded_code - romstart
42loaded_code:
43#endif /* CONFIG_ROMIMAGE_MMCIF */
44
15 /* copy the empty_zero_page contents to where vmlinux expects it */ 45 /* copy the empty_zero_page contents to where vmlinux expects it */
16 mova empty_zero_page_src, r0 46 mova extra_data_pos, r0
47 mov.l extra_data_size, r1
48 add r1, r0
17 mov.l empty_zero_page_dst, r1 49 mov.l empty_zero_page_dst, r1
18 mov #(PAGE_SHIFT - 4), r4 50 mov #(PAGE_SHIFT - 4), r4
19 mov #1, r3 51 mov #1, r3
@@ -37,7 +69,9 @@ romstart:
37 mov #PAGE_SHIFT, r4 69 mov #PAGE_SHIFT, r4
38 mov #1, r1 70 mov #1, r1
39 shld r4, r1 71 shld r4, r1
40 mova empty_zero_page_src, r0 72 mova extra_data_pos, r0
73 add r1, r0
74 mov.l extra_data_size, r1
41 add r1, r0 75 add r1, r0
42 jmp @r0 76 jmp @r0
43 nop 77 nop
@@ -45,4 +79,6 @@ romstart:
45 .align 2 79 .align 2
46empty_zero_page_dst: 80empty_zero_page_dst:
47 .long _text 81 .long _text
48empty_zero_page_src: 82extra_data_pos:
83extra_data_size:
84 .long zero_page_pos - extra_data_pos
diff --git a/arch/sh/boot/romimage/mmcif-sh7724.c b/arch/sh/boot/romimage/mmcif-sh7724.c
new file mode 100644
index 000000000000..14863d7292cb
--- /dev/null
+++ b/arch/sh/boot/romimage/mmcif-sh7724.c
@@ -0,0 +1,72 @@
1/*
2 * sh7724 MMCIF loader
3 *
4 * Copyright (C) 2010 Magnus Damm
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/mmc/sh_mmcif.h>
12#include <mach/romimage.h>
13
14#define MMCIF_BASE (void __iomem *)0xa4ca0000
15
16#define MSTPCR2 0xa4150038
17#define PTWCR 0xa4050146
18#define PTXCR 0xa4050148
19#define PSELA 0xa405014e
20#define PSELE 0xa4050156
21#define HIZCRC 0xa405015c
22#define DRVCRA 0xa405018a
23
24enum { MMCIF_PROGRESS_ENTER, MMCIF_PROGRESS_INIT,
25 MMCIF_PROGRESS_LOAD, MMCIF_PROGRESS_DONE };
26
27/* SH7724 specific MMCIF loader
28 *
29 * loads the romImage from an MMC card starting from block 512
30 * use the following line to write the romImage to an MMC card
31 * # dd if=arch/sh/boot/romImage of=/dev/sdx bs=512 seek=512
32 */
33asmlinkage void mmcif_loader(unsigned char *buf, unsigned long no_bytes)
34{
35 mmcif_update_progress(MMCIF_PROGRESS_ENTER);
36
37 /* enable clock to the MMCIF hardware block */
38 __raw_writel(__raw_readl(MSTPCR2) & ~0x20000000, MSTPCR2);
39
40 /* setup pins D7-D0 */
41 __raw_writew(0x0000, PTWCR);
42
43 /* setup pins MMC_CLK, MMC_CMD */
44 __raw_writew(__raw_readw(PTXCR) & ~0x000f, PTXCR);
45
46 /* select D3-D0 pin function */
47 __raw_writew(__raw_readw(PSELA) & ~0x2000, PSELA);
48
49 /* select D7-D4 pin function */
50 __raw_writew(__raw_readw(PSELE) & ~0x3000, PSELE);
51
52 /* disable Hi-Z for the MMC pins */
53 __raw_writew(__raw_readw(HIZCRC) & ~0x0620, HIZCRC);
54
55 /* high drive capability for MMC pins */
56 __raw_writew(__raw_readw(DRVCRA) | 0x3000, DRVCRA);
57
58 mmcif_update_progress(MMCIF_PROGRESS_INIT);
59
60 /* setup MMCIF hardware */
61 sh_mmcif_boot_init(MMCIF_BASE);
62
63 mmcif_update_progress(MMCIF_PROGRESS_LOAD);
64
65 /* load kernel via MMCIF interface */
66 sh_mmcif_boot_slurp(MMCIF_BASE, buf, no_bytes);
67
68 /* disable clock to the MMCIF hardware block */
69 __raw_writel(__raw_readl(MSTPCR2) | 0x20000000, MSTPCR2);
70
71 mmcif_update_progress(MMCIF_PROGRESS_DONE);
72}
diff --git a/arch/sh/boot/romimage/vmlinux.scr b/arch/sh/boot/romimage/vmlinux.scr
index 287c08f8b4bb..590394e2f5f2 100644
--- a/arch/sh/boot/romimage/vmlinux.scr
+++ b/arch/sh/boot/romimage/vmlinux.scr
@@ -1,6 +1,8 @@
1SECTIONS 1SECTIONS
2{ 2{
3 .text : { 3 .text : {
4 zero_page_pos = .;
4 *(.data) 5 *(.data)
6 end_data = .;
5 } 7 }
6} 8}
diff --git a/arch/sh/include/asm/cache.h b/arch/sh/include/asm/cache.h
index e461d67f03c3..ef9e555aafba 100644
--- a/arch/sh/include/asm/cache.h
+++ b/arch/sh/include/asm/cache.h
@@ -14,7 +14,7 @@
14 14
15#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 15#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
16 16
17#define __read_mostly __attribute__((__section__(".data.read_mostly"))) 17#define __read_mostly __attribute__((__section__(".data..read_mostly")))
18 18
19#ifndef __ASSEMBLY__ 19#ifndef __ASSEMBLY__
20struct cache_info { 20struct cache_info {
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index f689554e17c1..b237d525d592 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -39,6 +39,8 @@
39#include <asm/io_generic.h> 39#include <asm/io_generic.h>
40#include <asm/io_trapped.h> 40#include <asm/io_trapped.h>
41 41
42#ifdef CONFIG_HAS_IOPORT
43
42#define inb(p) sh_mv.mv_inb((p)) 44#define inb(p) sh_mv.mv_inb((p))
43#define inw(p) sh_mv.mv_inw((p)) 45#define inw(p) sh_mv.mv_inw((p))
44#define inl(p) sh_mv.mv_inl((p)) 46#define inl(p) sh_mv.mv_inl((p))
@@ -60,6 +62,8 @@
60#define outsw(p,b,c) sh_mv.mv_outsw((p), (b), (c)) 62#define outsw(p,b,c) sh_mv.mv_outsw((p), (b), (c))
61#define outsl(p,b,c) sh_mv.mv_outsl((p), (b), (c)) 63#define outsl(p,b,c) sh_mv.mv_outsl((p), (b), (c))
62 64
65#endif
66
63#define __raw_writeb(v,a) (__chk_io_ptr(a), *(volatile u8 __force *)(a) = (v)) 67#define __raw_writeb(v,a) (__chk_io_ptr(a), *(volatile u8 __force *)(a) = (v))
64#define __raw_writew(v,a) (__chk_io_ptr(a), *(volatile u16 __force *)(a) = (v)) 68#define __raw_writew(v,a) (__chk_io_ptr(a), *(volatile u16 __force *)(a) = (v))
65#define __raw_writel(v,a) (__chk_io_ptr(a), *(volatile u32 __force *)(a) = (v)) 69#define __raw_writel(v,a) (__chk_io_ptr(a), *(volatile u32 __force *)(a) = (v))
@@ -240,6 +244,8 @@ __BUILD_MEMORY_STRING(q, u64)
240 244
241#define IO_SPACE_LIMIT 0xffffffff 245#define IO_SPACE_LIMIT 0xffffffff
242 246
247#ifdef CONFIG_HAS_IOPORT
248
243/* 249/*
244 * This function provides a method for the generic case where a 250 * This function provides a method for the generic case where a
245 * board-specific ioport_map simply needs to return the port + some 251 * board-specific ioport_map simply needs to return the port + some
@@ -255,6 +261,8 @@ static inline void __set_io_port_base(unsigned long pbase)
255 261
256#define __ioport_map(p, n) sh_mv.mv_ioport_map((p), (n)) 262#define __ioport_map(p, n) sh_mv.mv_ioport_map((p), (n))
257 263
264#endif
265
258/* We really want to try and get these to memcpy etc */ 266/* We really want to try and get these to memcpy etc */
259void memcpy_fromio(void *, const volatile void __iomem *, unsigned long); 267void memcpy_fromio(void *, const volatile void __iomem *, unsigned long);
260void memcpy_toio(volatile void __iomem *, const void *, unsigned long); 268void memcpy_toio(volatile void __iomem *, const void *, unsigned long);
diff --git a/arch/sh/include/asm/machvec.h b/arch/sh/include/asm/machvec.h
index bc0218cb72e1..a0b0cf79cf8a 100644
--- a/arch/sh/include/asm/machvec.h
+++ b/arch/sh/include/asm/machvec.h
@@ -19,6 +19,10 @@ struct sh_machine_vector {
19 const char *mv_name; 19 const char *mv_name;
20 int mv_nr_irqs; 20 int mv_nr_irqs;
21 21
22 int (*mv_irq_demux)(int irq);
23 void (*mv_init_irq)(void);
24
25#ifdef CONFIG_HAS_IOPORT
22 u8 (*mv_inb)(unsigned long); 26 u8 (*mv_inb)(unsigned long);
23 u16 (*mv_inw)(unsigned long); 27 u16 (*mv_inw)(unsigned long);
24 u32 (*mv_inl)(unsigned long); 28 u32 (*mv_inl)(unsigned long);
@@ -40,12 +44,9 @@ struct sh_machine_vector {
40 void (*mv_outsw)(unsigned long, const void *src, unsigned long count); 44 void (*mv_outsw)(unsigned long, const void *src, unsigned long count);
41 void (*mv_outsl)(unsigned long, const void *src, unsigned long count); 45 void (*mv_outsl)(unsigned long, const void *src, unsigned long count);
42 46
43 int (*mv_irq_demux)(int irq);
44
45 void (*mv_init_irq)(void);
46
47 void __iomem *(*mv_ioport_map)(unsigned long port, unsigned int size); 47 void __iomem *(*mv_ioport_map)(unsigned long port, unsigned int size);
48 void (*mv_ioport_unmap)(void __iomem *); 48 void (*mv_ioport_unmap)(void __iomem *);
49#endif
49 50
50 int (*mv_clk_init)(void); 51 int (*mv_clk_init)(void);
51 int (*mv_mode_pins)(void); 52 int (*mv_mode_pins)(void);
diff --git a/arch/sh/include/cpu-sh4/cpu/sh7724.h b/arch/sh/include/cpu-sh4/cpu/sh7724.h
index fbbf550cc529..4c27b68789b3 100644
--- a/arch/sh/include/cpu-sh4/cpu/sh7724.h
+++ b/arch/sh/include/cpu-sh4/cpu/sh7724.h
@@ -9,6 +9,7 @@
9 * MD3: BSC - Area0 Bus Width (16/32-bit) [CS0BCR.9,10] 9 * MD3: BSC - Area0 Bus Width (16/32-bit) [CS0BCR.9,10]
10 * MD5: BSC - Endian Mode (L: Big, H: Little) [CMNCR.3] 10 * MD5: BSC - Endian Mode (L: Big, H: Little) [CMNCR.3]
11 * MD8: Test Mode 11 * MD8: Test Mode
12 * BOOT: FBR - Boot Mode (L: MMCIF, H: Area0)
12 */ 13 */
13 14
14/* Pin Function Controller: 15/* Pin Function Controller:
diff --git a/arch/sh/include/mach-common/mach/romimage.h b/arch/sh/include/mach-common/mach/romimage.h
index 267e24112d82..08fb42269ecd 100644
--- a/arch/sh/include/mach-common/mach/romimage.h
+++ b/arch/sh/include/mach-common/mach/romimage.h
@@ -1 +1,11 @@
1#ifdef __ASSEMBLY__
2
1/* do nothing here by default */ 3/* do nothing here by default */
4
5#else /* __ASSEMBLY__ */
6
7extern inline void mmcif_update_progress(int nr)
8{
9}
10
11#endif /* __ASSEMBLY__ */
diff --git a/arch/sh/include/mach-ecovec24/mach/romimage.h b/arch/sh/include/mach-ecovec24/mach/romimage.h
index 1c8787ecb1c1..1dcf5e6c8d83 100644
--- a/arch/sh/include/mach-ecovec24/mach/romimage.h
+++ b/arch/sh/include/mach-ecovec24/mach/romimage.h
@@ -1,3 +1,5 @@
1#ifdef __ASSEMBLY__
2
1/* EcoVec board specific boot code: 3/* EcoVec board specific boot code:
2 * converts the "partner-jet-script.txt" script into assembly 4 * converts the "partner-jet-script.txt" script into assembly
3 * the assembly code is the first code to be executed in the romImage 5 * the assembly code is the first code to be executed in the romImage
@@ -18,3 +20,28 @@
18 .align 2 20 .align 2
191 : .long 0xa8000000 211 : .long 0xa8000000
202 : 222 :
23
24#else /* __ASSEMBLY__ */
25
26/* Ecovec board specific information:
27 *
28 * Set the following to enable MMCIF boot from the MMC card in CN12:
29 *
30 * DS1.5 = OFF (SH BOOT pin set to L)
31 * DS2.6 = OFF (Select MMCIF on CN12 instead of SDHI1)
32 * DS2.7 = ON (Select MMCIF on CN12 instead of SDHI1)
33 *
34 */
35#define HIZCRA 0xa4050158
36#define PGDR 0xa405012c
37
38extern inline void mmcif_update_progress(int nr)
39{
40 /* disable Hi-Z for LED pins */
41 __raw_writew(__raw_readw(HIZCRA) & ~(1 << 1), HIZCRA);
42
43 /* update progress on LED4, LED5, LED6 and LED7 */
44 __raw_writeb(1 << (nr - 1), PGDR);
45}
46
47#endif /* __ASSEMBLY__ */
diff --git a/arch/sh/include/mach-kfr2r09/mach/romimage.h b/arch/sh/include/mach-kfr2r09/mach/romimage.h
index a110823f2bde..976256a323f2 100644
--- a/arch/sh/include/mach-kfr2r09/mach/romimage.h
+++ b/arch/sh/include/mach-kfr2r09/mach/romimage.h
@@ -1,3 +1,5 @@
1#ifdef __ASSEMBLY__
2
1/* kfr2r09 board specific boot code: 3/* kfr2r09 board specific boot code:
2 * converts the "partner-jet-script.txt" script into assembly 4 * converts the "partner-jet-script.txt" script into assembly
3 * the assembly code is the first code to be executed in the romImage 5 * the assembly code is the first code to be executed in the romImage
@@ -18,3 +20,11 @@
18 .align 2 20 .align 2
191: .long 0xa8000000 211: .long 0xa8000000
202: 222:
23
24#else /* __ASSEMBLY__ */
25
26extern inline void mmcif_update_progress(int nr)
27{
28}
29
30#endif /* __ASSEMBLY__ */
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index 650b92f00ee5..e25f3c69525d 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -12,7 +12,7 @@ endif
12CFLAGS_REMOVE_return_address.o = -pg 12CFLAGS_REMOVE_return_address.o = -pg
13 13
14obj-y := clkdev.o debugtraps.o dma-nommu.o dumpstack.o \ 14obj-y := clkdev.o debugtraps.o dma-nommu.o dumpstack.o \
15 idle.o io.o io_generic.o irq.o \ 15 idle.o io.o irq.o \
16 irq_$(BITS).o machvec.o nmi_debug.o process.o \ 16 irq_$(BITS).o machvec.o nmi_debug.o process.o \
17 process_$(BITS).o ptrace_$(BITS).o \ 17 process_$(BITS).o ptrace_$(BITS).o \
18 reboot.o return_address.o \ 18 reboot.o return_address.o \
@@ -39,6 +39,7 @@ obj-$(CONFIG_DUMP_CODE) += disassemble.o
39obj-$(CONFIG_HIBERNATION) += swsusp.o 39obj-$(CONFIG_HIBERNATION) += swsusp.o
40obj-$(CONFIG_DWARF_UNWINDER) += dwarf.o 40obj-$(CONFIG_DWARF_UNWINDER) += dwarf.o
41obj-$(CONFIG_PERF_EVENTS) += perf_event.o perf_callchain.o 41obj-$(CONFIG_PERF_EVENTS) += perf_event.o perf_callchain.o
42obj-$(CONFIG_HAS_IOPORT) += io_generic.o
42 43
43obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o 44obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
44obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) += localtimer.o 45obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) += localtimer.o
diff --git a/arch/sh/kernel/dwarf.c b/arch/sh/kernel/dwarf.c
index 886d7d83ace3..49c09c7d5b77 100644
--- a/arch/sh/kernel/dwarf.c
+++ b/arch/sh/kernel/dwarf.c
@@ -49,6 +49,8 @@ static DEFINE_SPINLOCK(dwarf_fde_lock);
49 49
50static struct dwarf_cie *cached_cie; 50static struct dwarf_cie *cached_cie;
51 51
52static unsigned int dwarf_unwinder_ready;
53
52/** 54/**
53 * dwarf_frame_alloc_reg - allocate memory for a DWARF register 55 * dwarf_frame_alloc_reg - allocate memory for a DWARF register
54 * @frame: the DWARF frame whose list of registers we insert on 56 * @frame: the DWARF frame whose list of registers we insert on
@@ -582,6 +584,13 @@ struct dwarf_frame *dwarf_unwind_stack(unsigned long pc,
582 unsigned long addr; 584 unsigned long addr;
583 585
584 /* 586 /*
587 * If we've been called in to before initialization has
588 * completed, bail out immediately.
589 */
590 if (!dwarf_unwinder_ready)
591 return NULL;
592
593 /*
585 * If we're starting at the top of the stack we need get the 594 * If we're starting at the top of the stack we need get the
586 * contents of a physical register to get the CFA in order to 595 * contents of a physical register to get the CFA in order to
587 * begin the virtual unwinding of the stack. 596 * begin the virtual unwinding of the stack.
@@ -1167,7 +1176,7 @@ void module_dwarf_cleanup(struct module *mod)
1167 */ 1176 */
1168static int __init dwarf_unwinder_init(void) 1177static int __init dwarf_unwinder_init(void)
1169{ 1178{
1170 int err; 1179 int err = -ENOMEM;
1171 1180
1172 dwarf_frame_cachep = kmem_cache_create("dwarf_frames", 1181 dwarf_frame_cachep = kmem_cache_create("dwarf_frames",
1173 sizeof(struct dwarf_frame), 0, 1182 sizeof(struct dwarf_frame), 0,
@@ -1181,11 +1190,15 @@ static int __init dwarf_unwinder_init(void)
1181 mempool_alloc_slab, 1190 mempool_alloc_slab,
1182 mempool_free_slab, 1191 mempool_free_slab,
1183 dwarf_frame_cachep); 1192 dwarf_frame_cachep);
1193 if (!dwarf_frame_pool)
1194 goto out;
1184 1195
1185 dwarf_reg_pool = mempool_create(DWARF_REG_MIN_REQ, 1196 dwarf_reg_pool = mempool_create(DWARF_REG_MIN_REQ,
1186 mempool_alloc_slab, 1197 mempool_alloc_slab,
1187 mempool_free_slab, 1198 mempool_free_slab,
1188 dwarf_reg_cachep); 1199 dwarf_reg_cachep);
1200 if (!dwarf_reg_pool)
1201 goto out;
1189 1202
1190 err = dwarf_parse_section(__start_eh_frame, __stop_eh_frame, NULL); 1203 err = dwarf_parse_section(__start_eh_frame, __stop_eh_frame, NULL);
1191 if (err) 1204 if (err)
@@ -1195,11 +1208,13 @@ static int __init dwarf_unwinder_init(void)
1195 if (err) 1208 if (err)
1196 goto out; 1209 goto out;
1197 1210
1211 dwarf_unwinder_ready = 1;
1212
1198 return 0; 1213 return 0;
1199 1214
1200out: 1215out:
1201 printk(KERN_ERR "Failed to initialise DWARF unwinder: %d\n", err); 1216 printk(KERN_ERR "Failed to initialise DWARF unwinder: %d\n", err);
1202 dwarf_unwinder_cleanup(); 1217 dwarf_unwinder_cleanup();
1203 return -EINVAL; 1218 return err;
1204} 1219}
1205early_initcall(dwarf_unwinder_init); 1220early_initcall(dwarf_unwinder_init);
diff --git a/arch/sh/kernel/io.c b/arch/sh/kernel/io.c
index 4770c241c679..5c51b794ba2a 100644
--- a/arch/sh/kernel/io.c
+++ b/arch/sh/kernel/io.c
@@ -112,25 +112,3 @@ void memset_io(volatile void __iomem *dst, int c, unsigned long count)
112 } 112 }
113} 113}
114EXPORT_SYMBOL(memset_io); 114EXPORT_SYMBOL(memset_io);
115
116#ifndef CONFIG_GENERIC_IOMAP
117
118void __iomem *ioport_map(unsigned long port, unsigned int nr)
119{
120 void __iomem *ret;
121
122 ret = __ioport_map_trapped(port, nr);
123 if (ret)
124 return ret;
125
126 return __ioport_map(port, nr);
127}
128EXPORT_SYMBOL(ioport_map);
129
130void ioport_unmap(void __iomem *addr)
131{
132 sh_mv.mv_ioport_unmap(addr);
133}
134EXPORT_SYMBOL(ioport_unmap);
135
136#endif /* CONFIG_GENERIC_IOMAP */
diff --git a/arch/sh/kernel/io_generic.c b/arch/sh/kernel/io_generic.c
index e1e1dbd19557..447d78f666f9 100644
--- a/arch/sh/kernel/io_generic.c
+++ b/arch/sh/kernel/io_generic.c
@@ -158,3 +158,23 @@ void __iomem *generic_ioport_map(unsigned long addr, unsigned int size)
158void generic_ioport_unmap(void __iomem *addr) 158void generic_ioport_unmap(void __iomem *addr)
159{ 159{
160} 160}
161
162#ifndef CONFIG_GENERIC_IOMAP
163void __iomem *ioport_map(unsigned long port, unsigned int nr)
164{
165 void __iomem *ret;
166
167 ret = __ioport_map_trapped(port, nr);
168 if (ret)
169 return ret;
170
171 return __ioport_map(port, nr);
172}
173EXPORT_SYMBOL(ioport_map);
174
175void ioport_unmap(void __iomem *addr)
176{
177 sh_mv.mv_ioport_unmap(addr);
178}
179EXPORT_SYMBOL(ioport_unmap);
180#endif /* CONFIG_GENERIC_IOMAP */
diff --git a/arch/sh/kernel/io_trapped.c b/arch/sh/kernel/io_trapped.c
index 4a8bb4eeb8ad..2947d2bd1291 100644
--- a/arch/sh/kernel/io_trapped.c
+++ b/arch/sh/kernel/io_trapped.c
@@ -91,10 +91,14 @@ int register_trapped_io(struct trapped_io *tiop)
91 tiop->magic = IO_TRAPPED_MAGIC; 91 tiop->magic = IO_TRAPPED_MAGIC;
92 INIT_LIST_HEAD(&tiop->list); 92 INIT_LIST_HEAD(&tiop->list);
93 spin_lock_irq(&trapped_lock); 93 spin_lock_irq(&trapped_lock);
94#ifdef CONFIG_HAS_IOPORT
94 if (flags & IORESOURCE_IO) 95 if (flags & IORESOURCE_IO)
95 list_add(&tiop->list, &trapped_io); 96 list_add(&tiop->list, &trapped_io);
97#endif
98#ifdef CONFIG_HAS_IOMEM
96 if (flags & IORESOURCE_MEM) 99 if (flags & IORESOURCE_MEM)
97 list_add(&tiop->list, &trapped_mem); 100 list_add(&tiop->list, &trapped_mem);
101#endif
98 spin_unlock_irq(&trapped_lock); 102 spin_unlock_irq(&trapped_lock);
99 103
100 return 0; 104 return 0;
diff --git a/arch/sh/kernel/machvec.c b/arch/sh/kernel/machvec.c
index 85cfaf916fdc..9f9bb63616ad 100644
--- a/arch/sh/kernel/machvec.c
+++ b/arch/sh/kernel/machvec.c
@@ -118,6 +118,14 @@ void __init sh_mv_setup(void)
118 sh_mv.mv_##elem = generic_##elem; \ 118 sh_mv.mv_##elem = generic_##elem; \
119} while (0) 119} while (0)
120 120
121#ifdef CONFIG_HAS_IOPORT
122
123#ifdef P2SEG
124 __set_io_port_base(P2SEG);
125#else
126 __set_io_port_base(0);
127#endif
128
121 mv_set(inb); mv_set(inw); mv_set(inl); 129 mv_set(inb); mv_set(inw); mv_set(inl);
122 mv_set(outb); mv_set(outw); mv_set(outl); 130 mv_set(outb); mv_set(outw); mv_set(outl);
123 131
@@ -129,16 +137,13 @@ void __init sh_mv_setup(void)
129 137
130 mv_set(ioport_map); 138 mv_set(ioport_map);
131 mv_set(ioport_unmap); 139 mv_set(ioport_unmap);
140
141#endif
142
132 mv_set(irq_demux); 143 mv_set(irq_demux);
133 mv_set(mode_pins); 144 mv_set(mode_pins);
134 mv_set(mem_init); 145 mv_set(mem_init);
135 146
136 if (!sh_mv.mv_nr_irqs) 147 if (!sh_mv.mv_nr_irqs)
137 sh_mv.mv_nr_irqs = NR_IRQS; 148 sh_mv.mv_nr_irqs = NR_IRQS;
138
139#ifdef P2SEG
140 __set_io_port_base(P2SEG);
141#else
142 __set_io_port_base(0);
143#endif
144} 149}
diff --git a/arch/sh/kernel/return_address.c b/arch/sh/kernel/return_address.c
index cbf1dd5372b2..5124aeb28c3f 100644
--- a/arch/sh/kernel/return_address.c
+++ b/arch/sh/kernel/return_address.c
@@ -24,6 +24,8 @@ void *return_address(unsigned int depth)
24 struct dwarf_frame *tmp; 24 struct dwarf_frame *tmp;
25 25
26 tmp = dwarf_unwind_stack(ra, frame); 26 tmp = dwarf_unwind_stack(ra, frame);
27 if (!tmp)
28 return NULL;
27 29
28 if (frame) 30 if (frame)
29 dwarf_free_frame(frame); 31 dwarf_free_frame(frame);