aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/kernel/head.S
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2013-05-28 22:37:17 -0400
committerGeert Uytterhoeven <geert@linux-m68k.org>2013-05-31 04:43:18 -0400
commitdf66834a43c461de2565c45d815288ba1c0def37 (patch)
treef2c62a298b8ebf095c3de5b4ae164a49ce5db03c /arch/m68k/kernel/head.S
parente4aa937ec75df0eea0bee03bffa3303ad36c986b (diff)
m68k/mac: Fix unexpected interrupt with CONFIG_EARLY_PRINTK
The present code does not wait for the SCC to finish resetting itself before trying to initialise the device. The result is that the SCC interrupt sources become enabled (if they weren't already). This leads to an early boot crash (unexpected interrupt) given CONFIG_EARLY_PRINTK. Fix this by adding a delay. A successful reset disables the interrupt sources. Also, after the reset for channel A setup, the SCC then gets a second reset for channel B setup which leaves channel A uninitialised again. Fix this by performing the reset only once. Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Cc: stable@vger.kernel.org Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'arch/m68k/kernel/head.S')
-rw-r--r--arch/m68k/kernel/head.S29
1 files changed, 19 insertions, 10 deletions
diff --git a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S
index d197e7ff62c5..ac85f16534af 100644
--- a/arch/m68k/kernel/head.S
+++ b/arch/m68k/kernel/head.S
@@ -2752,11 +2752,9 @@ func_return get_new_page
2752#ifdef CONFIG_MAC 2752#ifdef CONFIG_MAC
2753 2753
2754L(scc_initable_mac): 2754L(scc_initable_mac):
2755 .byte 9,12 /* Reset */
2756 .byte 4,0x44 /* x16, 1 stopbit, no parity */ 2755 .byte 4,0x44 /* x16, 1 stopbit, no parity */
2757 .byte 3,0xc0 /* receiver: 8 bpc */ 2756 .byte 3,0xc0 /* receiver: 8 bpc */
2758 .byte 5,0xe2 /* transmitter: 8 bpc, assert dtr/rts */ 2757 .byte 5,0xe2 /* transmitter: 8 bpc, assert dtr/rts */
2759 .byte 9,0 /* no interrupts */
2760 .byte 10,0 /* NRZ */ 2758 .byte 10,0 /* NRZ */
2761 .byte 11,0x50 /* use baud rate generator */ 2759 .byte 11,0x50 /* use baud rate generator */
2762 .byte 12,1,13,0 /* 38400 baud */ 2760 .byte 12,1,13,0 /* 38400 baud */
@@ -2899,6 +2897,7 @@ func_start serial_init,%d0/%d1/%a0/%a1
2899 is_not_mac(L(serial_init_not_mac)) 2897 is_not_mac(L(serial_init_not_mac))
2900 2898
2901#ifdef SERIAL_DEBUG 2899#ifdef SERIAL_DEBUG
2900
2902/* You may define either or both of these. */ 2901/* You may define either or both of these. */
2903#define MAC_USE_SCC_A /* Modem port */ 2902#define MAC_USE_SCC_A /* Modem port */
2904#define MAC_USE_SCC_B /* Printer port */ 2903#define MAC_USE_SCC_B /* Printer port */
@@ -2908,9 +2907,21 @@ func_start serial_init,%d0/%d1/%a0/%a1
2908#define mac_scc_cha_b_data_offset 0x4 2907#define mac_scc_cha_b_data_offset 0x4
2909#define mac_scc_cha_a_data_offset 0x6 2908#define mac_scc_cha_a_data_offset 0x6
2910 2909
2910#if defined(MAC_USE_SCC_A) || defined(MAC_USE_SCC_B)
2911 movel %pc@(L(mac_sccbase)),%a0
2912 /* Reset SCC device */
2913 moveb #9,%a0@(mac_scc_cha_a_ctrl_offset)
2914 moveb #0xc0,%a0@(mac_scc_cha_a_ctrl_offset)
2915 /* Wait for 5 PCLK cycles, which is about 68 CPU cycles */
2916 /* 5 / 3.6864 MHz = approx. 1.36 us = 68 / 50 MHz */
2917 movel #35,%d0
29185:
2919 subq #1,%d0
2920 jne 5b
2921#endif
2922
2911#ifdef MAC_USE_SCC_A 2923#ifdef MAC_USE_SCC_A
2912 /* Initialize channel A */ 2924 /* Initialize channel A */
2913 movel %pc@(L(mac_sccbase)),%a0
2914 lea %pc@(L(scc_initable_mac)),%a1 2925 lea %pc@(L(scc_initable_mac)),%a1
29155: moveb %a1@+,%d0 29265: moveb %a1@+,%d0
2916 jmi 6f 2927 jmi 6f
@@ -2922,9 +2933,6 @@ func_start serial_init,%d0/%d1/%a0/%a1
2922 2933
2923#ifdef MAC_USE_SCC_B 2934#ifdef MAC_USE_SCC_B
2924 /* Initialize channel B */ 2935 /* Initialize channel B */
2925#ifndef MAC_USE_SCC_A /* Load mac_sccbase only if needed */
2926 movel %pc@(L(mac_sccbase)),%a0
2927#endif /* MAC_USE_SCC_A */
2928 lea %pc@(L(scc_initable_mac)),%a1 2936 lea %pc@(L(scc_initable_mac)),%a1
29297: moveb %a1@+,%d0 29377: moveb %a1@+,%d0
2930 jmi 8f 2938 jmi 8f
@@ -2933,6 +2941,7 @@ func_start serial_init,%d0/%d1/%a0/%a1
2933 jra 7b 2941 jra 7b
29348: 29428:
2935#endif /* MAC_USE_SCC_B */ 2943#endif /* MAC_USE_SCC_B */
2944
2936#endif /* SERIAL_DEBUG */ 2945#endif /* SERIAL_DEBUG */
2937 2946
2938 jra L(serial_init_done) 2947 jra L(serial_init_done)
@@ -3006,17 +3015,17 @@ func_start serial_putc,%d0/%d1/%a0/%a1
3006 3015
3007#ifdef SERIAL_DEBUG 3016#ifdef SERIAL_DEBUG
3008 3017
3009#ifdef MAC_USE_SCC_A 3018#if defined(MAC_USE_SCC_A) || defined(MAC_USE_SCC_B)
3010 movel %pc@(L(mac_sccbase)),%a1 3019 movel %pc@(L(mac_sccbase)),%a1
3020#endif
3021
3022#ifdef MAC_USE_SCC_A
30113: btst #2,%a1@(mac_scc_cha_a_ctrl_offset) 30233: btst #2,%a1@(mac_scc_cha_a_ctrl_offset)
3012 jeq 3b 3024 jeq 3b
3013 moveb %d0,%a1@(mac_scc_cha_a_data_offset) 3025 moveb %d0,%a1@(mac_scc_cha_a_data_offset)
3014#endif /* MAC_USE_SCC_A */ 3026#endif /* MAC_USE_SCC_A */
3015 3027
3016#ifdef MAC_USE_SCC_B 3028#ifdef MAC_USE_SCC_B
3017#ifndef MAC_USE_SCC_A /* Load mac_sccbase only if needed */
3018 movel %pc@(L(mac_sccbase)),%a1
3019#endif /* MAC_USE_SCC_A */
30204: btst #2,%a1@(mac_scc_cha_b_ctrl_offset) 30294: btst #2,%a1@(mac_scc_cha_b_ctrl_offset)
3021 jeq 4b 3030 jeq 4b
3022 moveb %d0,%a1@(mac_scc_cha_b_data_offset) 3031 moveb %d0,%a1@(mac_scc_cha_b_data_offset)