Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu

Pull m68knommu arch updates from Greg Ungerer:
"Includes a cleanup of the non-MMU linker script (it now almost
exclusively uses the well defined linker script support macros and
definitions). Some more merging of MMU and non-MMU common files
(specifically the arch process.c, ptrace and time.c). And a big
cleanup of the massively duplicated ColdFire device definition code.

Overall we remove about 2000 lines of code, and end up with a single
set of platform device definitions for the serial ports, ethernet
ports and QSPI ports common in most ColdFire SoCs.

I expect you will get a merge conflict on arch/m68k/kernel/process.c,
in cpu_idle(). It should be relatively strait forward to fixup."

And cpu_idle() conflict resolution was indeed trivial (merging the
nommu/mmu versions of process.c trivially conflicting with the
conversion to use the schedule_preempt_disabled() helper function)

* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu: (57 commits)
m68knommu: factor more common ColdFire cpu reset code
m68knommu: make 528x CPU reset register addressing consistent
m68knommu: make 527x CPU reset register addressing consistent
m68knommu: make 523x CPU reset register addressing consistent
m68knommu: factor some common ColdFire cpu reset code
m68knommu: move old ColdFire timers init from CPU init to timers code
m68knommu: clean up init code in ColdFire 532x startup
m68knommu: clean up init code in ColdFire 528x startup
m68knommu: clean up init code in ColdFire 523x startup
m68knommu: merge common ColdFire QSPI platform setup code
m68knommu: make 532x QSPI platform addressing consistent
m68knommu: make 528x QSPI platform addressing consistent
m68knommu: make 527x QSPI platform addressing consistent
m68knommu: make 5249 QSPI platform addressing consistent
m68knommu: make 523x QSPI platform addressing consistent
m68knommu: make 520x QSPI platform addressing consistent
m68knommu: merge common ColdFire FEC platform setup code
m68knommu: make 532x FEC platform addressing consistent
m68knommu: make 528x FEC platform addressing consistent
m68knommu: make 527x FEC platform addressing consistent
...

+1590 -3636
+4 -3
arch/m68k/Kconfig
··· 7 7 select GENERIC_IRQ_SHOW 8 8 select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS 9 9 select GENERIC_CPU_DEVICES 10 + select FPU if MMU 10 11 11 12 config RWSEM_GENERIC_SPINLOCK 12 13 bool ··· 24 23 25 24 config GENERIC_CLOCKEVENTS 26 25 bool 27 - 28 - config GENERIC_CMOS_UPDATE 29 - def_bool !MMU 30 26 31 27 config GENERIC_GPIO 32 28 bool ··· 63 65 bool 64 66 65 67 config CPU_HAS_ADDRESS_SPACES 68 + bool 69 + 70 + config FPU 66 71 bool 67 72 68 73 config HZ
+6 -4
arch/m68k/include/asm/m5206sim.h
··· 100 100 #define MCFDMA_BASE1 (MCF_MBAR + 0x240) /* Base address DMA 1 */ 101 101 102 102 #if defined(CONFIG_NETtel) 103 - #define MCFUART_BASE1 0x180 /* Base address of UART1 */ 104 - #define MCFUART_BASE2 0x140 /* Base address of UART2 */ 103 + #define MCFUART_BASE0 (MCF_MBAR + 0x180) /* Base address UART0 */ 104 + #define MCFUART_BASE1 (MCF_MBAR + 0x140) /* Base address UART1 */ 105 105 #else 106 - #define MCFUART_BASE1 0x140 /* Base address of UART1 */ 107 - #define MCFUART_BASE2 0x180 /* Base address of UART2 */ 106 + #define MCFUART_BASE0 (MCF_MBAR + 0x140) /* Base address UART0 */ 107 + #define MCFUART_BASE1 (MCF_MBAR + 0x180) /* Base address UART1 */ 108 108 #endif 109 109 110 110 /* ··· 112 112 */ 113 113 #define MCF_IRQ_TIMER 30 /* Timer0, Level 6 */ 114 114 #define MCF_IRQ_PROFILER 31 /* Timer1, Level 7 */ 115 + #define MCF_IRQ_UART0 73 /* UART0 */ 116 + #define MCF_IRQ_UART1 74 /* UART1 */ 115 117 116 118 /* 117 119 * Generic GPIO
+28 -5
arch/m68k/include/asm/m520xsim.h
··· 48 48 #define MCFINT_UART1 27 /* Interrupt number for UART1 */ 49 49 #define MCFINT_UART2 28 /* Interrupt number for UART2 */ 50 50 #define MCFINT_QSPI 31 /* Interrupt number for QSPI */ 51 + #define MCFINT_FECRX0 36 /* Interrupt number for FEC RX */ 52 + #define MCFINT_FECTX0 40 /* Interrupt number for FEC RX */ 53 + #define MCFINT_FECENTC0 42 /* Interrupt number for FEC RX */ 51 54 #define MCFINT_PIT1 4 /* Interrupt number for PIT1 (PIT0 in processor) */ 55 + 56 + #define MCF_IRQ_UART0 (MCFINT_VECBASE + MCFINT_UART0) 57 + #define MCF_IRQ_UART1 (MCFINT_VECBASE + MCFINT_UART1) 58 + #define MCF_IRQ_UART2 (MCFINT_VECBASE + MCFINT_UART2) 59 + 60 + #define MCF_IRQ_FECRX0 (MCFINT_VECBASE + MCFINT_FECRX0) 61 + #define MCF_IRQ_FECTX0 (MCFINT_VECBASE + MCFINT_FECTX0) 62 + #define MCF_IRQ_FECENTC0 (MCFINT_VECBASE + MCFINT_FECENTC0) 63 + 64 + #define MCF_IRQ_QSPI (MCFINT_VECBASE + MCFINT_QSPI) 52 65 53 66 /* 54 67 * SDRAM configuration registers. ··· 157 144 /* 158 145 * UART module. 159 146 */ 160 - #define MCFUART_BASE1 0xFC060000 /* Base address of UART1 */ 161 - #define MCFUART_BASE2 0xFC064000 /* Base address of UART2 */ 162 - #define MCFUART_BASE3 0xFC068000 /* Base address of UART2 */ 147 + #define MCFUART_BASE0 0xFC060000 /* Base address of UART0 */ 148 + #define MCFUART_BASE1 0xFC064000 /* Base address of UART1 */ 149 + #define MCFUART_BASE2 0xFC068000 /* Base address of UART2 */ 163 150 164 151 /* 165 152 * FEC module. 166 153 */ 167 - #define MCFFEC_BASE 0xFC030000 /* Base of FEC ethernet */ 168 - #define MCFFEC_SIZE 0x800 /* Register set size */ 154 + #define MCFFEC_BASE0 0xFC030000 /* Base of FEC ethernet */ 155 + #define MCFFEC_SIZE0 0x800 /* Register set size */ 156 + 157 + /* 158 + * QSPI module. 159 + */ 160 + #define MCFQSPI_BASE 0xFC05C000 /* Base of QSPI module */ 161 + #define MCFQSPI_SIZE 0x40 /* Register set size */ 162 + 163 + #define MCFQSPI_CS0 46 164 + #define MCFQSPI_CS1 47 165 + #define MCFQSPI_CS2 27 169 166 170 167 /* 171 168 * Reset Control Unit.
+34 -8
arch/m68k/include/asm/m523xsim.h
··· 35 35 36 36 #define MCFINT_VECBASE 64 /* Vector base number */ 37 37 #define MCFINT_UART0 13 /* Interrupt number for UART0 */ 38 - #define MCFINT_PIT1 36 /* Interrupt number for PIT1 */ 38 + #define MCFINT_UART1 14 /* Interrupt number for UART1 */ 39 + #define MCFINT_UART2 15 /* Interrupt number for UART2 */ 39 40 #define MCFINT_QSPI 18 /* Interrupt number for QSPI */ 41 + #define MCFINT_FECRX0 23 /* Interrupt number for FEC */ 42 + #define MCFINT_FECTX0 27 /* Interrupt number for FEC */ 43 + #define MCFINT_FECENTC0 29 /* Interrupt number for FEC */ 44 + #define MCFINT_PIT1 36 /* Interrupt number for PIT1 */ 45 + 46 + #define MCF_IRQ_UART0 (MCFINT_VECBASE + MCFINT_UART0) 47 + #define MCF_IRQ_UART1 (MCFINT_VECBASE + MCFINT_UART1) 48 + #define MCF_IRQ_UART2 (MCFINT_VECBASE + MCFINT_UART2) 49 + 50 + #define MCF_IRQ_FECRX0 (MCFINT_VECBASE + MCFINT_FECRX0) 51 + #define MCF_IRQ_FECTX0 (MCFINT_VECBASE + MCFINT_FECTX0) 52 + #define MCF_IRQ_FECENTC0 (MCFINT_VECBASE + MCFINT_FECENTC0) 53 + 54 + #define MCF_IRQ_QSPI (MCFINT_VECBASE + MCFINT_QSPI) 40 55 41 56 /* 42 57 * SDRAM configuration registers. ··· 65 50 /* 66 51 * Reset Control Unit (relative to IPSBAR). 67 52 */ 68 - #define MCF_RCR 0x110000 69 - #define MCF_RSR 0x110001 53 + #define MCF_RCR (MCF_IPSBAR + 0x110000) 54 + #define MCF_RSR (MCF_IPSBAR + 0x110001) 70 55 71 56 #define MCF_RCR_SWRESET 0x80 /* Software reset bit */ 72 57 #define MCF_RCR_FRCSTOUT 0x40 /* Force external reset */ ··· 74 59 /* 75 60 * UART module. 76 61 */ 77 - #define MCFUART_BASE1 (MCF_IPSBAR + 0x200) 78 - #define MCFUART_BASE2 (MCF_IPSBAR + 0x240) 79 - #define MCFUART_BASE3 (MCF_IPSBAR + 0x280) 62 + #define MCFUART_BASE0 (MCF_IPSBAR + 0x200) 63 + #define MCFUART_BASE1 (MCF_IPSBAR + 0x240) 64 + #define MCFUART_BASE2 (MCF_IPSBAR + 0x280) 80 65 81 66 /* 82 67 * FEC ethernet module. 83 68 */ 84 - #define MCFFEC_BASE (MCF_IPSBAR + 0x1000) 85 - #define MCFFEC_SIZE 0x800 69 + #define MCFFEC_BASE0 (MCF_IPSBAR + 0x1000) 70 + #define MCFFEC_SIZE0 0x800 71 + 72 + /* 73 + * QSPI module. 74 + */ 75 + #define MCFQSPI_BASE (MCF_IPSBAR + 0x340) 76 + #define MCFQSPI_SIZE 0x40 77 + 78 + #define MCFQSPI_CS0 91 79 + #define MCFQSPI_CS1 92 80 + #define MCFQSPI_CS2 103 81 + #define MCFQSPI_CS3 99 86 82 87 83 /* 88 84 * GPIO module.
+16 -2
arch/m68k/include/asm/m5249sim.h
··· 76 76 /* 77 77 * UART module. 78 78 */ 79 - #define MCFUART_BASE1 0x1c0 /* Base address of UART1 */ 80 - #define MCFUART_BASE2 0x200 /* Base address of UART2 */ 79 + #define MCFUART_BASE0 (MCF_MBAR + 0x1c0) /* Base address UART0 */ 80 + #define MCFUART_BASE1 (MCF_MBAR + 0x200) /* Base address UART1 */ 81 + 82 + /* 83 + * QSPI module. 84 + */ 85 + #define MCFQSPI_BASE (MCF_MBAR + 0x300) /* Base address QSPI */ 86 + #define MCFQSPI_SIZE 0x40 /* Register set size */ 87 + 88 + #define MCFQSPI_CS0 29 89 + #define MCFQSPI_CS1 24 90 + #define MCFQSPI_CS2 21 91 + #define MCFQSPI_CS3 22 81 92 82 93 /* 83 94 * DMA unit base addresses. ··· 118 107 #define MCF_IRQ_QSPI 28 /* QSPI, Level 4 */ 119 108 #define MCF_IRQ_TIMER 30 /* Timer0, Level 6 */ 120 109 #define MCF_IRQ_PROFILER 31 /* Timer1, Level 7 */ 110 + 111 + #define MCF_IRQ_UART0 73 /* UART0 */ 112 + #define MCF_IRQ_UART1 74 /* UART1 */ 121 113 122 114 /* 123 115 * General purpose IO registers (in MBAR2).
+10 -7
arch/m68k/include/asm/m5272sim.h
··· 68 68 #define MCFSIM_DCMR1 0x5c /* DRAM 1 Mask reg (r/w) */ 69 69 #define MCFSIM_DCCR1 0x63 /* DRAM 1 Control reg (r/w) */ 70 70 71 - #define MCFUART_BASE1 0x100 /* Base address of UART1 */ 72 - #define MCFUART_BASE2 0x140 /* Base address of UART2 */ 71 + #define MCFUART_BASE0 (MCF_MBAR + 0x100) /* Base address UART0 */ 72 + #define MCFUART_BASE1 (MCF_MBAR + 0x140) /* Base address UART1 */ 73 73 74 74 #define MCFSIM_PACNT (MCF_MBAR + 0x80) /* Port A Control (r/w) */ 75 75 #define MCFSIM_PADDR (MCF_MBAR + 0x84) /* Port A Direction (r/w) */ ··· 88 88 #define MCFTIMER_BASE3 (MCF_MBAR + 0x240) /* Base address TIMER4 */ 89 89 #define MCFTIMER_BASE4 (MCF_MBAR + 0x260) /* Base address TIMER3 */ 90 90 91 + #define MCFFEC_BASE0 (MCF_MBAR + 0x840) /* Base FEC ethernet */ 92 + #define MCFFEC_SIZE0 0x1d0 93 + 91 94 /* 92 95 * Define system peripheral IRQ usage. 93 96 */ ··· 104 101 #define MCF_IRQ_TIMER2 70 /* Timer 2 */ 105 102 #define MCF_IRQ_TIMER3 71 /* Timer 3 */ 106 103 #define MCF_IRQ_TIMER4 72 /* Timer 4 */ 107 - #define MCF_IRQ_UART1 73 /* UART 1 */ 108 - #define MCF_IRQ_UART2 74 /* UART 2 */ 104 + #define MCF_IRQ_UART0 73 /* UART 0 */ 105 + #define MCF_IRQ_UART1 74 /* UART 1 */ 109 106 #define MCF_IRQ_PLIP 75 /* PLIC 2Khz Periodic */ 110 107 #define MCF_IRQ_PLIA 76 /* PLIC Asynchronous */ 111 108 #define MCF_IRQ_USB0 77 /* USB Endpoint 0 */ ··· 117 114 #define MCF_IRQ_USB6 83 /* USB Endpoint 6 */ 118 115 #define MCF_IRQ_USB7 84 /* USB Endpoint 7 */ 119 116 #define MCF_IRQ_DMA 85 /* DMA Controller */ 120 - #define MCF_IRQ_ERX 86 /* Ethernet Receiver */ 121 - #define MCF_IRQ_ETX 87 /* Ethernet Transmitter */ 122 - #define MCF_IRQ_ENTC 88 /* Ethernet Non-Time Critical */ 117 + #define MCF_IRQ_FECRX0 86 /* Ethernet Receiver */ 118 + #define MCF_IRQ_FECTX0 87 /* Ethernet Transmitter */ 119 + #define MCF_IRQ_FECENTC0 88 /* Ethernet Non-Time Critical */ 123 120 #define MCF_IRQ_QSPI 89 /* Queued Serial Interface */ 124 121 #define MCF_IRQ_EINT5 90 /* External Interrupt 5 */ 125 122 #define MCF_IRQ_EINT6 91 /* External Interrupt 6 */
+48 -5
arch/m68k/include/asm/m527xsim.h
··· 38 38 #define MCFINT_UART1 14 /* Interrupt number for UART1 */ 39 39 #define MCFINT_UART2 15 /* Interrupt number for UART2 */ 40 40 #define MCFINT_QSPI 18 /* Interrupt number for QSPI */ 41 + #define MCFINT_FECRX0 23 /* Interrupt number for FEC0 */ 42 + #define MCFINT_FECTX0 27 /* Interrupt number for FEC0 */ 43 + #define MCFINT_FECENTC0 29 /* Interrupt number for FEC0 */ 41 44 #define MCFINT_PIT1 36 /* Interrupt number for PIT1 */ 45 + 46 + #define MCFINT2_VECBASE 128 /* Vector base number 2 */ 47 + #define MCFINT2_FECRX1 23 /* Interrupt number for FEC1 */ 48 + #define MCFINT2_FECTX1 27 /* Interrupt number for FEC1 */ 49 + #define MCFINT2_FECENTC1 29 /* Interrupt number for FEC1 */ 50 + 51 + #define MCF_IRQ_UART0 (MCFINT_VECBASE + MCFINT_UART0) 52 + #define MCF_IRQ_UART1 (MCFINT_VECBASE + MCFINT_UART1) 53 + #define MCF_IRQ_UART2 (MCFINT_VECBASE + MCFINT_UART2) 54 + 55 + #define MCF_IRQ_FECRX0 (MCFINT_VECBASE + MCFINT_FECRX0) 56 + #define MCF_IRQ_FECTX0 (MCFINT_VECBASE + MCFINT_FECTX0) 57 + #define MCF_IRQ_FECENTC0 (MCFINT_VECBASE + MCFINT_FECENTC0) 58 + #define MCF_IRQ_FECRX1 (MCFINT2_VECBASE + MCFINT2_FECRX1) 59 + #define MCF_IRQ_FECTX1 (MCFINT2_VECBASE + MCFINT2_FECTX1) 60 + #define MCF_IRQ_FECENTC1 (MCFINT2_VECBASE + MCFINT2_FECENTC1) 61 + 62 + #define MCF_IRQ_QSPI (MCFINT_VECBASE + MCFINT_QSPI) 42 63 43 64 /* 44 65 * SDRAM configuration registers. ··· 93 72 /* 94 73 * UART module. 95 74 */ 96 - #define MCFUART_BASE1 (MCF_IPSBAR + 0x200) 97 - #define MCFUART_BASE2 (MCF_IPSBAR + 0x240) 98 - #define MCFUART_BASE3 (MCF_IPSBAR + 0x280) 75 + #define MCFUART_BASE0 (MCF_IPSBAR + 0x200) 76 + #define MCFUART_BASE1 (MCF_IPSBAR + 0x240) 77 + #define MCFUART_BASE2 (MCF_IPSBAR + 0x280) 99 78 100 79 /* 101 80 * FEC ethernet module. ··· 105 84 #define MCFFEC_BASE1 (MCF_IPSBAR + 0x1800) 106 85 #define MCFFEC_SIZE1 0x800 107 86 87 + /* 88 + * QSPI module. 89 + */ 90 + #define MCFQSPI_BASE (MCF_IPSBAR + 0x340) 91 + #define MCFQSPI_SIZE 0x40 92 + 93 + #ifdef CONFIG_M5271 94 + #define MCFQSPI_CS0 91 95 + #define MCFQSPI_CS1 92 96 + #define MCFQSPI_CS2 99 97 + #define MCFQSPI_CS3 103 98 + #endif 99 + #ifdef CONFIG_M5275 100 + #define MCFQSPI_CS0 59 101 + #define MCFQSPI_CS1 60 102 + #define MCFQSPI_CS2 61 103 + #define MCFQSPI_CS3 62 104 + #endif 105 + 106 + /* 107 + * GPIO module. 108 + */ 108 109 #ifdef CONFIG_M5271 109 110 #define MCFGPIO_PODR_ADDR (MCF_IPSBAR + 0x100000) 110 111 #define MCFGPIO_PODR_DATAH (MCF_IPSBAR + 0x100001) ··· 328 285 /* 329 286 * Reset Control Unit (relative to IPSBAR). 330 287 */ 331 - #define MCF_RCR 0x110000 332 - #define MCF_RSR 0x110001 288 + #define MCF_RCR (MCF_IPSBAR + 0x110000) 289 + #define MCF_RSR (MCF_IPSBAR + 0x110001) 333 290 334 291 #define MCF_RCR_SWRESET 0x80 /* Software reset bit */ 335 292 #define MCF_RCR_FRCSTOUT 0x40 /* Force external reset */
+33 -7
arch/m68k/include/asm/m528xsim.h
··· 35 35 36 36 #define MCFINT_VECBASE 64 /* Vector base number */ 37 37 #define MCFINT_UART0 13 /* Interrupt number for UART0 */ 38 + #define MCFINT_UART1 14 /* Interrupt number for UART1 */ 39 + #define MCFINT_UART2 15 /* Interrupt number for UART2 */ 38 40 #define MCFINT_QSPI 18 /* Interrupt number for QSPI */ 41 + #define MCFINT_FECRX0 23 /* Interrupt number for FEC */ 42 + #define MCFINT_FECTX0 27 /* Interrupt number for FEC */ 43 + #define MCFINT_FECENTC0 29 /* Interrupt number for FEC */ 39 44 #define MCFINT_PIT1 55 /* Interrupt number for PIT1 */ 45 + 46 + #define MCF_IRQ_UART0 (MCFINT_VECBASE + MCFINT_UART0) 47 + #define MCF_IRQ_UART1 (MCFINT_VECBASE + MCFINT_UART1) 48 + #define MCF_IRQ_UART2 (MCFINT_VECBASE + MCFINT_UART2) 49 + 50 + #define MCF_IRQ_FECRX0 (MCFINT_VECBASE + MCFINT_FECRX0) 51 + #define MCF_IRQ_FECTX0 (MCFINT_VECBASE + MCFINT_FECTX0) 52 + #define MCF_IRQ_FECENTC0 (MCFINT_VECBASE + MCFINT_FECENTC0) 53 + 54 + #define MCF_IRQ_QSPI (MCFINT_VECBASE + MCFINT_QSPI) 40 55 41 56 /* 42 57 * SDRAM configuration registers. ··· 73 58 /* 74 59 * UART module. 75 60 */ 76 - #define MCFUART_BASE1 (MCF_IPSBAR + 0x00000200) 77 - #define MCFUART_BASE2 (MCF_IPSBAR + 0x00000240) 78 - #define MCFUART_BASE3 (MCF_IPSBAR + 0x00000280) 61 + #define MCFUART_BASE0 (MCF_IPSBAR + 0x00000200) 62 + #define MCFUART_BASE1 (MCF_IPSBAR + 0x00000240) 63 + #define MCFUART_BASE2 (MCF_IPSBAR + 0x00000280) 79 64 80 65 /* 81 66 * FEC ethernet module. 82 67 */ 83 - #define MCFFEC_BASE (MCF_IPSBAR + 0x00001000) 84 - #define MCFFEC_SIZE 0x800 68 + #define MCFFEC_BASE0 (MCF_IPSBAR + 0x00001000) 69 + #define MCFFEC_SIZE0 0x800 70 + 71 + /* 72 + * QSPI module. 73 + */ 74 + #define MCFQSPI_IOBASE (MCF_IPSBAR + 0x340) 75 + #define MCFQSPI_SIZE 0x40 76 + 77 + #define MCFQSPI_CS0 147 78 + #define MCFQSPI_CS1 148 79 + #define MCFQSPI_CS2 149 80 + #define MCFQSPI_CS3 150 85 81 86 82 /* 87 83 * GPIO registers ··· 272 246 /* 273 247 * Reset Control Unit (relative to IPSBAR). 274 248 */ 275 - #define MCF_RCR 0x110000 276 - #define MCF_RSR 0x110001 249 + #define MCF_RCR (MCF_IPSBAR + 0x110000) 250 + #define MCF_RSR (MCF_IPSBAR + 0x110001) 277 251 278 252 #define MCF_RCR_SWRESET 0x80 /* Software reset bit */ 279 253 #define MCF_RCR_FRCSTOUT 0x40 /* Force external reset */
+6 -4
arch/m68k/include/asm/m5307sim.h
··· 117 117 * UART module. 118 118 */ 119 119 #if defined(CONFIG_NETtel) || defined(CONFIG_SECUREEDGEMP3) 120 - #define MCFUART_BASE1 0x200 /* Base address of UART1 */ 121 - #define MCFUART_BASE2 0x1c0 /* Base address of UART2 */ 120 + #define MCFUART_BASE0 (MCF_MBAR + 0x200) /* Base address UART0 */ 121 + #define MCFUART_BASE1 (MCF_MBAR + 0x1c0) /* Base address UART1 */ 122 122 #else 123 - #define MCFUART_BASE1 0x1c0 /* Base address of UART1 */ 124 - #define MCFUART_BASE2 0x200 /* Base address of UART2 */ 123 + #define MCFUART_BASE0 (MCF_MBAR + 0x1c0) /* Base address UART0 */ 124 + #define MCFUART_BASE1 (MCF_MBAR + 0x200) /* Base address UART1 */ 125 125 #endif 126 126 127 127 /* ··· 176 176 */ 177 177 #define MCF_IRQ_TIMER 30 /* Timer0, Level 6 */ 178 178 #define MCF_IRQ_PROFILER 31 /* Timer1, Level 7 */ 179 + #define MCF_IRQ_UART0 73 /* UART0 */ 180 + #define MCF_IRQ_UART1 74 /* UART1 */ 179 181 180 182 /****************************************************************************/ 181 183 #endif /* m5307sim_h */
+32 -3
arch/m68k/include/asm/m532xsim.h
··· 24 24 #define MCFINT_UART1 27 /* Interrupt number for UART1 */ 25 25 #define MCFINT_UART2 28 /* Interrupt number for UART2 */ 26 26 #define MCFINT_QSPI 31 /* Interrupt number for QSPI */ 27 + #define MCFINT_FECRX0 36 /* Interrupt number for FEC */ 28 + #define MCFINT_FECTX0 40 /* Interrupt number for FEC */ 29 + #define MCFINT_FECENTC0 42 /* Interrupt number for FEC */ 30 + 31 + #define MCF_IRQ_UART0 (MCFINT_VECBASE + MCFINT_UART0) 32 + #define MCF_IRQ_UART1 (MCFINT_VECBASE + MCFINT_UART1) 33 + #define MCF_IRQ_UART2 (MCFINT_VECBASE + MCFINT_UART2) 34 + 35 + #define MCF_IRQ_FECRX0 (MCFINT_VECBASE + MCFINT_FECRX0) 36 + #define MCF_IRQ_FECTX0 (MCFINT_VECBASE + MCFINT_FECTX0) 37 + #define MCF_IRQ_FECENTC0 (MCFINT_VECBASE + MCFINT_FECENTC0) 38 + 39 + #define MCF_IRQ_QSPI (MCFINT_VECBASE + MCFINT_QSPI) 27 40 28 41 #define MCF_WTM_WCR MCF_REG16(0xFC098000) 29 42 ··· 95 82 /* 96 83 * UART module. 97 84 */ 98 - #define MCFUART_BASE1 0xFC060000 /* Base address of UART1 */ 99 - #define MCFUART_BASE2 0xFC064000 /* Base address of UART2 */ 100 - #define MCFUART_BASE3 0xFC068000 /* Base address of UART3 */ 85 + #define MCFUART_BASE0 0xFC060000 /* Base address of UART1 */ 86 + #define MCFUART_BASE1 0xFC064000 /* Base address of UART2 */ 87 + #define MCFUART_BASE2 0xFC068000 /* Base address of UART3 */ 88 + 89 + /* 90 + * FEC module. 91 + */ 92 + #define MCFFEC_BASE0 0xFC030000 /* Base address of FEC0 */ 93 + #define MCFFEC_SIZE0 0x800 /* Size of FEC0 region */ 94 + 95 + /* 96 + * QSPI module. 97 + */ 98 + #define MCFQSPI_BASE 0xFC058000 /* Base address of QSPI */ 99 + #define MCFQSPI_SIZE 0x40 /* Size of QSPI region */ 100 + 101 + #define MCFQSPI_CS0 84 102 + #define MCFQSPI_CS1 85 103 + #define MCFQSPI_CS2 86 101 104 102 105 /* 103 106 * Timer module.
+4 -2
arch/m68k/include/asm/m5407sim.h
··· 85 85 #define MCFTIMER_BASE1 (MCF_MBAR + 0x140) /* Base of TIMER1 */ 86 86 #define MCFTIMER_BASE2 (MCF_MBAR + 0x180) /* Base of TIMER2 */ 87 87 88 - #define MCFUART_BASE1 0x1c0 /* Base address of UART1 */ 89 - #define MCFUART_BASE2 0x200 /* Base address of UART2 */ 88 + #define MCFUART_BASE0 (MCF_MBAR + 0x1c0) /* Base address UART0 */ 89 + #define MCFUART_BASE1 (MCF_MBAR + 0x200) /* Base address UART1 */ 90 90 91 91 #define MCFSIM_PADDR (MCF_MBAR + 0x244) 92 92 #define MCFSIM_PADAT (MCF_MBAR + 0x248) ··· 139 139 */ 140 140 #define MCF_IRQ_TIMER 30 /* Timer0, Level 6 */ 141 141 #define MCF_IRQ_PROFILER 31 /* Timer1, Level 7 */ 142 + #define MCF_IRQ_UART0 73 /* UART0 */ 143 + #define MCF_IRQ_UART1 74 /* UART1 */ 142 144 143 145 /****************************************************************************/ 144 146 #endif /* m5407sim_h */
+10 -6
arch/m68k/include/asm/m54xxsim.h
··· 31 31 /* 32 32 * UART module. 33 33 */ 34 - #define MCFUART_BASE1 0x8600 /* Base address of UART1 */ 35 - #define MCFUART_BASE2 0x8700 /* Base address of UART2 */ 36 - #define MCFUART_BASE3 0x8800 /* Base address of UART3 */ 37 - #define MCFUART_BASE4 0x8900 /* Base address of UART4 */ 34 + #define MCFUART_BASE0 (MCF_MBAR + 0x8600) /* Base address UART0 */ 35 + #define MCFUART_BASE1 (MCF_MBAR + 0x8700) /* Base address UART1 */ 36 + #define MCFUART_BASE2 (MCF_MBAR + 0x8800) /* Base address UART2 */ 37 + #define MCFUART_BASE3 (MCF_MBAR + 0x8900) /* Base address UART3 */ 38 38 39 39 /* 40 40 * Define system peripheral IRQ usage. 41 41 */ 42 - #define MCF_IRQ_TIMER (64 + 54) /* Slice Timer 0 */ 43 - #define MCF_IRQ_PROFILER (64 + 53) /* Slice Timer 1 */ 42 + #define MCF_IRQ_TIMER (MCFINT_VECBASE + 54) /* Slice Timer 0 */ 43 + #define MCF_IRQ_PROFILER (MCFINT_VECBASE + 53) /* Slice Timer 1 */ 44 + #define MCF_IRQ_UART0 (MCFINT_VECBASE + 35) 45 + #define MCF_IRQ_UART1 (MCFINT_VECBASE + 34) 46 + #define MCF_IRQ_UART2 (MCFINT_VECBASE + 33) 47 + #define MCF_IRQ_UART3 (MCFINT_VECBASE + 32) 44 48 45 49 /* 46 50 * Generic GPIO support
+1 -4
arch/m68k/include/asm/machdep.h
··· 22 22 extern int (*mach_get_rtc_pll)(struct rtc_pll_info *); 23 23 extern int (*mach_set_rtc_pll)(struct rtc_pll_info *); 24 24 extern int (*mach_set_clock_mmss)(unsigned long); 25 - extern void (*mach_gettod)(int *year, int *mon, int *day, int *hour, 26 - int *min, int *sec); 27 25 extern void (*mach_reset)( void ); 28 26 extern void (*mach_halt)( void ); 29 27 extern void (*mach_power_off)( void ); ··· 33 35 extern void (*mach_beep) (unsigned int, unsigned int); 34 36 35 37 /* Hardware clock functions */ 36 - extern void hw_timer_init(void); 38 + extern void hw_timer_init(irq_handler_t handler); 37 39 extern unsigned long hw_timer_offset(void); 38 - extern irqreturn_t arch_timer_interrupt(int irq, void *dummy); 39 40 40 41 extern void config_BSP(char *command, int len); 41 42
-11
arch/m68k/include/asm/mcfqspi.h
··· 21 21 #ifndef mcfqspi_h 22 22 #define mcfqspi_h 23 23 24 - #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) 25 - #define MCFQSPI_IOBASE (MCF_IPSBAR + 0x340) 26 - #elif defined(CONFIG_M5249) 27 - #define MCFQSPI_IOBASE (MCF_MBAR + 0x300) 28 - #elif defined(CONFIG_M520x) 29 - #define MCFQSPI_IOBASE 0xFC05C000 30 - #elif defined(CONFIG_M532x) 31 - #define MCFQSPI_IOBASE 0xFC058000 32 - #endif 33 - #define MCFQSPI_IOSIZE 0x40 34 - 35 24 /** 36 25 * struct mcfqspi_cs_control - chip select control for the coldfire qspi driver 37 26 * @setup: setup the control; allocate gpio's, etc. May be NULL.
+4 -1
arch/m68k/include/asm/mcfuart.h
··· 41 41 #define MCFUART_UTF 0x28 /* Transmitter FIFO (r/w) */ 42 42 #define MCFUART_URF 0x2c /* Receiver FIFO (r/w) */ 43 43 #define MCFUART_UFPD 0x30 /* Frac Prec. Divider (r/w) */ 44 - #else 44 + #endif 45 + #if defined(CONFIG_M5206) || defined(CONFIG_M5206e) || \ 46 + defined(CONFIG_M5249) || defined(CONFIG_M5307) || \ 47 + defined(CONFIG_M5407) 45 48 #define MCFUART_UIVR 0x30 /* Interrupt Vector (r/w) */ 46 49 #endif 47 50 #define MCFUART_UIPR 0x34 /* Input Port (r) */
+376 -3
arch/m68k/kernel/process.c
··· 1 - #ifdef CONFIG_MMU 2 - #include "process_mm.c" 1 + /* 2 + * linux/arch/m68k/kernel/process.c 3 + * 4 + * Copyright (C) 1995 Hamish Macdonald 5 + * 6 + * 68060 fixes by Jesper Skov 7 + */ 8 + 9 + /* 10 + * This file handles the architecture-dependent parts of process handling.. 11 + */ 12 + 13 + #include <linux/errno.h> 14 + #include <linux/module.h> 15 + #include <linux/sched.h> 16 + #include <linux/kernel.h> 17 + #include <linux/mm.h> 18 + #include <linux/slab.h> 19 + #include <linux/fs.h> 20 + #include <linux/smp.h> 21 + #include <linux/stddef.h> 22 + #include <linux/unistd.h> 23 + #include <linux/ptrace.h> 24 + #include <linux/user.h> 25 + #include <linux/reboot.h> 26 + #include <linux/init_task.h> 27 + #include <linux/mqueue.h> 28 + 29 + #include <asm/uaccess.h> 30 + #include <asm/system.h> 31 + #include <asm/traps.h> 32 + #include <asm/machdep.h> 33 + #include <asm/setup.h> 34 + #include <asm/pgtable.h> 35 + 36 + 37 + asmlinkage void ret_from_fork(void); 38 + 39 + 40 + /* 41 + * Return saved PC from a blocked thread 42 + */ 43 + unsigned long thread_saved_pc(struct task_struct *tsk) 44 + { 45 + struct switch_stack *sw = (struct switch_stack *)tsk->thread.ksp; 46 + /* Check whether the thread is blocked in resume() */ 47 + if (in_sched_functions(sw->retpc)) 48 + return ((unsigned long *)sw->a6)[1]; 49 + else 50 + return sw->retpc; 51 + } 52 + 53 + /* 54 + * The idle loop on an m68k.. 55 + */ 56 + static void default_idle(void) 57 + { 58 + if (!need_resched()) 59 + #if defined(MACH_ATARI_ONLY) 60 + /* block out HSYNC on the atari (falcon) */ 61 + __asm__("stop #0x2200" : : : "cc"); 3 62 #else 4 - #include "process_no.c" 63 + __asm__("stop #0x2000" : : : "cc"); 5 64 #endif 65 + } 66 + 67 + void (*idle)(void) = default_idle; 68 + 69 + /* 70 + * The idle thread. There's no useful work to be 71 + * done, so just try to conserve power and have a 72 + * low exit latency (ie sit in a loop waiting for 73 + * somebody to say that they'd like to reschedule) 74 + */ 75 + void cpu_idle(void) 76 + { 77 + /* endless idle loop with no priority at all */ 78 + while (1) { 79 + while (!need_resched()) 80 + idle(); 81 + schedule_preempt_disabled(); 82 + } 83 + } 84 + 85 + void machine_restart(char * __unused) 86 + { 87 + if (mach_reset) 88 + mach_reset(); 89 + for (;;); 90 + } 91 + 92 + void machine_halt(void) 93 + { 94 + if (mach_halt) 95 + mach_halt(); 96 + for (;;); 97 + } 98 + 99 + void machine_power_off(void) 100 + { 101 + if (mach_power_off) 102 + mach_power_off(); 103 + for (;;); 104 + } 105 + 106 + void (*pm_power_off)(void) = machine_power_off; 107 + EXPORT_SYMBOL(pm_power_off); 108 + 109 + void show_regs(struct pt_regs * regs) 110 + { 111 + printk("\n"); 112 + printk("Format %02x Vector: %04x PC: %08lx Status: %04x %s\n", 113 + regs->format, regs->vector, regs->pc, regs->sr, print_tainted()); 114 + printk("ORIG_D0: %08lx D0: %08lx A2: %08lx A1: %08lx\n", 115 + regs->orig_d0, regs->d0, regs->a2, regs->a1); 116 + printk("A0: %08lx D5: %08lx D4: %08lx\n", 117 + regs->a0, regs->d5, regs->d4); 118 + printk("D3: %08lx D2: %08lx D1: %08lx\n", 119 + regs->d3, regs->d2, regs->d1); 120 + if (!(regs->sr & PS_S)) 121 + printk("USP: %08lx\n", rdusp()); 122 + } 123 + 124 + /* 125 + * Create a kernel thread 126 + */ 127 + int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) 128 + { 129 + int pid; 130 + mm_segment_t fs; 131 + 132 + fs = get_fs(); 133 + set_fs (KERNEL_DS); 134 + 135 + { 136 + register long retval __asm__ ("d0"); 137 + register long clone_arg __asm__ ("d1") = flags | CLONE_VM | CLONE_UNTRACED; 138 + 139 + retval = __NR_clone; 140 + __asm__ __volatile__ 141 + ("clrl %%d2\n\t" 142 + "trap #0\n\t" /* Linux/m68k system call */ 143 + "tstl %0\n\t" /* child or parent */ 144 + "jne 1f\n\t" /* parent - jump */ 145 + #ifdef CONFIG_MMU 146 + "lea %%sp@(%c7),%6\n\t" /* reload current */ 147 + "movel %6@,%6\n\t" 148 + #endif 149 + "movel %3,%%sp@-\n\t" /* push argument */ 150 + "jsr %4@\n\t" /* call fn */ 151 + "movel %0,%%d1\n\t" /* pass exit value */ 152 + "movel %2,%%d0\n\t" /* exit */ 153 + "trap #0\n" 154 + "1:" 155 + : "+d" (retval) 156 + : "i" (__NR_clone), "i" (__NR_exit), 157 + "r" (arg), "a" (fn), "d" (clone_arg), "r" (current), 158 + "i" (-THREAD_SIZE) 159 + : "d2"); 160 + 161 + pid = retval; 162 + } 163 + 164 + set_fs (fs); 165 + return pid; 166 + } 167 + EXPORT_SYMBOL(kernel_thread); 168 + 169 + void flush_thread(void) 170 + { 171 + current->thread.fs = __USER_DS; 172 + #ifdef CONFIG_FPU 173 + if (!FPU_IS_EMU) { 174 + unsigned long zero = 0; 175 + asm volatile("frestore %0": :"m" (zero)); 176 + } 177 + #endif 178 + } 179 + 180 + /* 181 + * "m68k_fork()".. By the time we get here, the 182 + * non-volatile registers have also been saved on the 183 + * stack. We do some ugly pointer stuff here.. (see 184 + * also copy_thread) 185 + */ 186 + 187 + asmlinkage int m68k_fork(struct pt_regs *regs) 188 + { 189 + #ifdef CONFIG_MMU 190 + return do_fork(SIGCHLD, rdusp(), regs, 0, NULL, NULL); 191 + #else 192 + return -EINVAL; 193 + #endif 194 + } 195 + 196 + asmlinkage int m68k_vfork(struct pt_regs *regs) 197 + { 198 + return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(), regs, 0, 199 + NULL, NULL); 200 + } 201 + 202 + asmlinkage int m68k_clone(struct pt_regs *regs) 203 + { 204 + unsigned long clone_flags; 205 + unsigned long newsp; 206 + int __user *parent_tidptr, *child_tidptr; 207 + 208 + /* syscall2 puts clone_flags in d1 and usp in d2 */ 209 + clone_flags = regs->d1; 210 + newsp = regs->d2; 211 + parent_tidptr = (int __user *)regs->d3; 212 + child_tidptr = (int __user *)regs->d4; 213 + if (!newsp) 214 + newsp = rdusp(); 215 + return do_fork(clone_flags, newsp, regs, 0, 216 + parent_tidptr, child_tidptr); 217 + } 218 + 219 + int copy_thread(unsigned long clone_flags, unsigned long usp, 220 + unsigned long unused, 221 + struct task_struct * p, struct pt_regs * regs) 222 + { 223 + struct pt_regs * childregs; 224 + struct switch_stack * childstack, *stack; 225 + unsigned long *retp; 226 + 227 + childregs = (struct pt_regs *) (task_stack_page(p) + THREAD_SIZE) - 1; 228 + 229 + *childregs = *regs; 230 + childregs->d0 = 0; 231 + 232 + retp = ((unsigned long *) regs); 233 + stack = ((struct switch_stack *) retp) - 1; 234 + 235 + childstack = ((struct switch_stack *) childregs) - 1; 236 + *childstack = *stack; 237 + childstack->retpc = (unsigned long)ret_from_fork; 238 + 239 + p->thread.usp = usp; 240 + p->thread.ksp = (unsigned long)childstack; 241 + 242 + if (clone_flags & CLONE_SETTLS) 243 + task_thread_info(p)->tp_value = regs->d5; 244 + 245 + /* 246 + * Must save the current SFC/DFC value, NOT the value when 247 + * the parent was last descheduled - RGH 10-08-96 248 + */ 249 + p->thread.fs = get_fs().seg; 250 + 251 + #ifdef CONFIG_FPU 252 + if (!FPU_IS_EMU) { 253 + /* Copy the current fpu state */ 254 + asm volatile ("fsave %0" : : "m" (p->thread.fpstate[0]) : "memory"); 255 + 256 + if (!CPU_IS_060 ? p->thread.fpstate[0] : p->thread.fpstate[2]) { 257 + if (CPU_IS_COLDFIRE) { 258 + asm volatile ("fmovemd %/fp0-%/fp7,%0\n\t" 259 + "fmovel %/fpiar,%1\n\t" 260 + "fmovel %/fpcr,%2\n\t" 261 + "fmovel %/fpsr,%3" 262 + : 263 + : "m" (p->thread.fp[0]), 264 + "m" (p->thread.fpcntl[0]), 265 + "m" (p->thread.fpcntl[1]), 266 + "m" (p->thread.fpcntl[2]) 267 + : "memory"); 268 + } else { 269 + asm volatile ("fmovemx %/fp0-%/fp7,%0\n\t" 270 + "fmoveml %/fpiar/%/fpcr/%/fpsr,%1" 271 + : 272 + : "m" (p->thread.fp[0]), 273 + "m" (p->thread.fpcntl[0]) 274 + : "memory"); 275 + } 276 + } 277 + 278 + /* Restore the state in case the fpu was busy */ 279 + asm volatile ("frestore %0" : : "m" (p->thread.fpstate[0])); 280 + } 281 + #endif /* CONFIG_FPU */ 282 + 283 + return 0; 284 + } 285 + 286 + /* Fill in the fpu structure for a core dump. */ 287 + #ifdef CONFIG_FPU 288 + int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu) 289 + { 290 + char fpustate[216]; 291 + 292 + if (FPU_IS_EMU) { 293 + int i; 294 + 295 + memcpy(fpu->fpcntl, current->thread.fpcntl, 12); 296 + memcpy(fpu->fpregs, current->thread.fp, 96); 297 + /* Convert internal fpu reg representation 298 + * into long double format 299 + */ 300 + for (i = 0; i < 24; i += 3) 301 + fpu->fpregs[i] = ((fpu->fpregs[i] & 0xffff0000) << 15) | 302 + ((fpu->fpregs[i] & 0x0000ffff) << 16); 303 + return 1; 304 + } 305 + 306 + /* First dump the fpu context to avoid protocol violation. */ 307 + asm volatile ("fsave %0" :: "m" (fpustate[0]) : "memory"); 308 + if (!CPU_IS_060 ? !fpustate[0] : !fpustate[2]) 309 + return 0; 310 + 311 + if (CPU_IS_COLDFIRE) { 312 + asm volatile ("fmovel %/fpiar,%0\n\t" 313 + "fmovel %/fpcr,%1\n\t" 314 + "fmovel %/fpsr,%2\n\t" 315 + "fmovemd %/fp0-%/fp7,%3" 316 + : 317 + : "m" (fpu->fpcntl[0]), 318 + "m" (fpu->fpcntl[1]), 319 + "m" (fpu->fpcntl[2]), 320 + "m" (fpu->fpregs[0]) 321 + : "memory"); 322 + } else { 323 + asm volatile ("fmovem %/fpiar/%/fpcr/%/fpsr,%0" 324 + : 325 + : "m" (fpu->fpcntl[0]) 326 + : "memory"); 327 + asm volatile ("fmovemx %/fp0-%/fp7,%0" 328 + : 329 + : "m" (fpu->fpregs[0]) 330 + : "memory"); 331 + } 332 + 333 + return 1; 334 + } 335 + EXPORT_SYMBOL(dump_fpu); 336 + #endif /* CONFIG_FPU */ 337 + 338 + /* 339 + * sys_execve() executes a new program. 340 + */ 341 + asmlinkage int sys_execve(const char __user *name, 342 + const char __user *const __user *argv, 343 + const char __user *const __user *envp) 344 + { 345 + int error; 346 + char * filename; 347 + struct pt_regs *regs = (struct pt_regs *) &name; 348 + 349 + filename = getname(name); 350 + error = PTR_ERR(filename); 351 + if (IS_ERR(filename)) 352 + return error; 353 + error = do_execve(filename, argv, envp, regs); 354 + putname(filename); 355 + return error; 356 + } 357 + 358 + unsigned long get_wchan(struct task_struct *p) 359 + { 360 + unsigned long fp, pc; 361 + unsigned long stack_page; 362 + int count = 0; 363 + if (!p || p == current || p->state == TASK_RUNNING) 364 + return 0; 365 + 366 + stack_page = (unsigned long)task_stack_page(p); 367 + fp = ((struct switch_stack *)p->thread.ksp)->a6; 368 + do { 369 + if (fp < stack_page+sizeof(struct thread_info) || 370 + fp >= 8184+stack_page) 371 + return 0; 372 + pc = ((unsigned long *)fp)[1]; 373 + if (!in_sched_functions(pc)) 374 + return pc; 375 + fp = *(unsigned long *) fp; 376 + } while (count++ < 16); 377 + return 0; 378 + }
-367
arch/m68k/kernel/process_mm.c
··· 1 - /* 2 - * linux/arch/m68k/kernel/process.c 3 - * 4 - * Copyright (C) 1995 Hamish Macdonald 5 - * 6 - * 68060 fixes by Jesper Skov 7 - */ 8 - 9 - /* 10 - * This file handles the architecture-dependent parts of process handling.. 11 - */ 12 - 13 - #include <linux/errno.h> 14 - #include <linux/module.h> 15 - #include <linux/sched.h> 16 - #include <linux/kernel.h> 17 - #include <linux/mm.h> 18 - #include <linux/slab.h> 19 - #include <linux/fs.h> 20 - #include <linux/smp.h> 21 - #include <linux/stddef.h> 22 - #include <linux/unistd.h> 23 - #include <linux/ptrace.h> 24 - #include <linux/user.h> 25 - #include <linux/reboot.h> 26 - #include <linux/init_task.h> 27 - #include <linux/mqueue.h> 28 - 29 - #include <asm/uaccess.h> 30 - #include <asm/system.h> 31 - #include <asm/traps.h> 32 - #include <asm/machdep.h> 33 - #include <asm/setup.h> 34 - #include <asm/pgtable.h> 35 - 36 - 37 - asmlinkage void ret_from_fork(void); 38 - 39 - 40 - /* 41 - * Return saved PC from a blocked thread 42 - */ 43 - unsigned long thread_saved_pc(struct task_struct *tsk) 44 - { 45 - struct switch_stack *sw = (struct switch_stack *)tsk->thread.ksp; 46 - /* Check whether the thread is blocked in resume() */ 47 - if (in_sched_functions(sw->retpc)) 48 - return ((unsigned long *)sw->a6)[1]; 49 - else 50 - return sw->retpc; 51 - } 52 - 53 - /* 54 - * The idle loop on an m68k.. 55 - */ 56 - static void default_idle(void) 57 - { 58 - if (!need_resched()) 59 - #if defined(MACH_ATARI_ONLY) 60 - /* block out HSYNC on the atari (falcon) */ 61 - __asm__("stop #0x2200" : : : "cc"); 62 - #else 63 - __asm__("stop #0x2000" : : : "cc"); 64 - #endif 65 - } 66 - 67 - void (*idle)(void) = default_idle; 68 - 69 - /* 70 - * The idle thread. There's no useful work to be 71 - * done, so just try to conserve power and have a 72 - * low exit latency (ie sit in a loop waiting for 73 - * somebody to say that they'd like to reschedule) 74 - */ 75 - void cpu_idle(void) 76 - { 77 - /* endless idle loop with no priority at all */ 78 - while (1) { 79 - while (!need_resched()) 80 - idle(); 81 - schedule_preempt_disabled(); 82 - } 83 - } 84 - 85 - void machine_restart(char * __unused) 86 - { 87 - if (mach_reset) 88 - mach_reset(); 89 - for (;;); 90 - } 91 - 92 - void machine_halt(void) 93 - { 94 - if (mach_halt) 95 - mach_halt(); 96 - for (;;); 97 - } 98 - 99 - void machine_power_off(void) 100 - { 101 - if (mach_power_off) 102 - mach_power_off(); 103 - for (;;); 104 - } 105 - 106 - void (*pm_power_off)(void) = machine_power_off; 107 - EXPORT_SYMBOL(pm_power_off); 108 - 109 - void show_regs(struct pt_regs * regs) 110 - { 111 - printk("\n"); 112 - printk("Format %02x Vector: %04x PC: %08lx Status: %04x %s\n", 113 - regs->format, regs->vector, regs->pc, regs->sr, print_tainted()); 114 - printk("ORIG_D0: %08lx D0: %08lx A2: %08lx A1: %08lx\n", 115 - regs->orig_d0, regs->d0, regs->a2, regs->a1); 116 - printk("A0: %08lx D5: %08lx D4: %08lx\n", 117 - regs->a0, regs->d5, regs->d4); 118 - printk("D3: %08lx D2: %08lx D1: %08lx\n", 119 - regs->d3, regs->d2, regs->d1); 120 - if (!(regs->sr & PS_S)) 121 - printk("USP: %08lx\n", rdusp()); 122 - } 123 - 124 - /* 125 - * Create a kernel thread 126 - */ 127 - int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) 128 - { 129 - int pid; 130 - mm_segment_t fs; 131 - 132 - fs = get_fs(); 133 - set_fs (KERNEL_DS); 134 - 135 - { 136 - register long retval __asm__ ("d0"); 137 - register long clone_arg __asm__ ("d1") = flags | CLONE_VM | CLONE_UNTRACED; 138 - 139 - retval = __NR_clone; 140 - __asm__ __volatile__ 141 - ("clrl %%d2\n\t" 142 - "trap #0\n\t" /* Linux/m68k system call */ 143 - "tstl %0\n\t" /* child or parent */ 144 - "jne 1f\n\t" /* parent - jump */ 145 - "lea %%sp@(%c7),%6\n\t" /* reload current */ 146 - "movel %6@,%6\n\t" 147 - "movel %3,%%sp@-\n\t" /* push argument */ 148 - "jsr %4@\n\t" /* call fn */ 149 - "movel %0,%%d1\n\t" /* pass exit value */ 150 - "movel %2,%%d0\n\t" /* exit */ 151 - "trap #0\n" 152 - "1:" 153 - : "+d" (retval) 154 - : "i" (__NR_clone), "i" (__NR_exit), 155 - "r" (arg), "a" (fn), "d" (clone_arg), "r" (current), 156 - "i" (-THREAD_SIZE) 157 - : "d2"); 158 - 159 - pid = retval; 160 - } 161 - 162 - set_fs (fs); 163 - return pid; 164 - } 165 - EXPORT_SYMBOL(kernel_thread); 166 - 167 - void flush_thread(void) 168 - { 169 - unsigned long zero = 0; 170 - 171 - current->thread.fs = __USER_DS; 172 - if (!FPU_IS_EMU) 173 - asm volatile("frestore %0": :"m" (zero)); 174 - } 175 - 176 - /* 177 - * "m68k_fork()".. By the time we get here, the 178 - * non-volatile registers have also been saved on the 179 - * stack. We do some ugly pointer stuff here.. (see 180 - * also copy_thread) 181 - */ 182 - 183 - asmlinkage int m68k_fork(struct pt_regs *regs) 184 - { 185 - return do_fork(SIGCHLD, rdusp(), regs, 0, NULL, NULL); 186 - } 187 - 188 - asmlinkage int m68k_vfork(struct pt_regs *regs) 189 - { 190 - return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(), regs, 0, 191 - NULL, NULL); 192 - } 193 - 194 - asmlinkage int m68k_clone(struct pt_regs *regs) 195 - { 196 - unsigned long clone_flags; 197 - unsigned long newsp; 198 - int __user *parent_tidptr, *child_tidptr; 199 - 200 - /* syscall2 puts clone_flags in d1 and usp in d2 */ 201 - clone_flags = regs->d1; 202 - newsp = regs->d2; 203 - parent_tidptr = (int __user *)regs->d3; 204 - child_tidptr = (int __user *)regs->d4; 205 - if (!newsp) 206 - newsp = rdusp(); 207 - return do_fork(clone_flags, newsp, regs, 0, 208 - parent_tidptr, child_tidptr); 209 - } 210 - 211 - int copy_thread(unsigned long clone_flags, unsigned long usp, 212 - unsigned long unused, 213 - struct task_struct * p, struct pt_regs * regs) 214 - { 215 - struct pt_regs * childregs; 216 - struct switch_stack * childstack, *stack; 217 - unsigned long *retp; 218 - 219 - childregs = (struct pt_regs *) (task_stack_page(p) + THREAD_SIZE) - 1; 220 - 221 - *childregs = *regs; 222 - childregs->d0 = 0; 223 - 224 - retp = ((unsigned long *) regs); 225 - stack = ((struct switch_stack *) retp) - 1; 226 - 227 - childstack = ((struct switch_stack *) childregs) - 1; 228 - *childstack = *stack; 229 - childstack->retpc = (unsigned long)ret_from_fork; 230 - 231 - p->thread.usp = usp; 232 - p->thread.ksp = (unsigned long)childstack; 233 - 234 - if (clone_flags & CLONE_SETTLS) 235 - task_thread_info(p)->tp_value = regs->d5; 236 - 237 - /* 238 - * Must save the current SFC/DFC value, NOT the value when 239 - * the parent was last descheduled - RGH 10-08-96 240 - */ 241 - p->thread.fs = get_fs().seg; 242 - 243 - if (!FPU_IS_EMU) { 244 - /* Copy the current fpu state */ 245 - asm volatile ("fsave %0" : : "m" (p->thread.fpstate[0]) : "memory"); 246 - 247 - if (!CPU_IS_060 ? p->thread.fpstate[0] : p->thread.fpstate[2]) { 248 - if (CPU_IS_COLDFIRE) { 249 - asm volatile ("fmovemd %/fp0-%/fp7,%0\n\t" 250 - "fmovel %/fpiar,%1\n\t" 251 - "fmovel %/fpcr,%2\n\t" 252 - "fmovel %/fpsr,%3" 253 - : 254 - : "m" (p->thread.fp[0]), 255 - "m" (p->thread.fpcntl[0]), 256 - "m" (p->thread.fpcntl[1]), 257 - "m" (p->thread.fpcntl[2]) 258 - : "memory"); 259 - } else { 260 - asm volatile ("fmovemx %/fp0-%/fp7,%0\n\t" 261 - "fmoveml %/fpiar/%/fpcr/%/fpsr,%1" 262 - : 263 - : "m" (p->thread.fp[0]), 264 - "m" (p->thread.fpcntl[0]) 265 - : "memory"); 266 - } 267 - } 268 - 269 - /* Restore the state in case the fpu was busy */ 270 - asm volatile ("frestore %0" : : "m" (p->thread.fpstate[0])); 271 - } 272 - 273 - return 0; 274 - } 275 - 276 - /* Fill in the fpu structure for a core dump. */ 277 - 278 - int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu) 279 - { 280 - char fpustate[216]; 281 - 282 - if (FPU_IS_EMU) { 283 - int i; 284 - 285 - memcpy(fpu->fpcntl, current->thread.fpcntl, 12); 286 - memcpy(fpu->fpregs, current->thread.fp, 96); 287 - /* Convert internal fpu reg representation 288 - * into long double format 289 - */ 290 - for (i = 0; i < 24; i += 3) 291 - fpu->fpregs[i] = ((fpu->fpregs[i] & 0xffff0000) << 15) | 292 - ((fpu->fpregs[i] & 0x0000ffff) << 16); 293 - return 1; 294 - } 295 - 296 - /* First dump the fpu context to avoid protocol violation. */ 297 - asm volatile ("fsave %0" :: "m" (fpustate[0]) : "memory"); 298 - if (!CPU_IS_060 ? !fpustate[0] : !fpustate[2]) 299 - return 0; 300 - 301 - if (CPU_IS_COLDFIRE) { 302 - asm volatile ("fmovel %/fpiar,%0\n\t" 303 - "fmovel %/fpcr,%1\n\t" 304 - "fmovel %/fpsr,%2\n\t" 305 - "fmovemd %/fp0-%/fp7,%3" 306 - : 307 - : "m" (fpu->fpcntl[0]), 308 - "m" (fpu->fpcntl[1]), 309 - "m" (fpu->fpcntl[2]), 310 - "m" (fpu->fpregs[0]) 311 - : "memory"); 312 - } else { 313 - asm volatile ("fmovem %/fpiar/%/fpcr/%/fpsr,%0" 314 - : 315 - : "m" (fpu->fpcntl[0]) 316 - : "memory"); 317 - asm volatile ("fmovemx %/fp0-%/fp7,%0" 318 - : 319 - : "m" (fpu->fpregs[0]) 320 - : "memory"); 321 - } 322 - 323 - return 1; 324 - } 325 - EXPORT_SYMBOL(dump_fpu); 326 - 327 - /* 328 - * sys_execve() executes a new program. 329 - */ 330 - asmlinkage int sys_execve(const char __user *name, 331 - const char __user *const __user *argv, 332 - const char __user *const __user *envp) 333 - { 334 - int error; 335 - char * filename; 336 - struct pt_regs *regs = (struct pt_regs *) &name; 337 - 338 - filename = getname(name); 339 - error = PTR_ERR(filename); 340 - if (IS_ERR(filename)) 341 - return error; 342 - error = do_execve(filename, argv, envp, regs); 343 - putname(filename); 344 - return error; 345 - } 346 - 347 - unsigned long get_wchan(struct task_struct *p) 348 - { 349 - unsigned long fp, pc; 350 - unsigned long stack_page; 351 - int count = 0; 352 - if (!p || p == current || p->state == TASK_RUNNING) 353 - return 0; 354 - 355 - stack_page = (unsigned long)task_stack_page(p); 356 - fp = ((struct switch_stack *)p->thread.ksp)->a6; 357 - do { 358 - if (fp < stack_page+sizeof(struct thread_info) || 359 - fp >= 8184+stack_page) 360 - return 0; 361 - pc = ((unsigned long *)fp)[1]; 362 - if (!in_sched_functions(pc)) 363 - return pc; 364 - fp = *(unsigned long *) fp; 365 - } while (count++ < 16); 366 - return 0; 367 - }
-404
arch/m68k/kernel/process_no.c
··· 1 - /* 2 - * linux/arch/m68knommu/kernel/process.c 3 - * 4 - * Copyright (C) 1995 Hamish Macdonald 5 - * 6 - * 68060 fixes by Jesper Skov 7 - * 8 - * uClinux changes 9 - * Copyright (C) 2000-2002, David McCullough <davidm@snapgear.com> 10 - */ 11 - 12 - /* 13 - * This file handles the architecture-dependent parts of process handling.. 14 - */ 15 - 16 - #include <linux/module.h> 17 - #include <linux/errno.h> 18 - #include <linux/sched.h> 19 - #include <linux/kernel.h> 20 - #include <linux/mm.h> 21 - #include <linux/smp.h> 22 - #include <linux/stddef.h> 23 - #include <linux/unistd.h> 24 - #include <linux/ptrace.h> 25 - #include <linux/user.h> 26 - #include <linux/interrupt.h> 27 - #include <linux/reboot.h> 28 - #include <linux/fs.h> 29 - #include <linux/slab.h> 30 - 31 - #include <asm/uaccess.h> 32 - #include <asm/system.h> 33 - #include <asm/traps.h> 34 - #include <asm/machdep.h> 35 - #include <asm/setup.h> 36 - #include <asm/pgtable.h> 37 - 38 - asmlinkage void ret_from_fork(void); 39 - 40 - /* 41 - * The following aren't currently used. 42 - */ 43 - void (*pm_idle)(void); 44 - EXPORT_SYMBOL(pm_idle); 45 - 46 - void (*pm_power_off)(void); 47 - EXPORT_SYMBOL(pm_power_off); 48 - 49 - /* 50 - * The idle loop on an m68knommu.. 51 - */ 52 - static void default_idle(void) 53 - { 54 - local_irq_disable(); 55 - while (!need_resched()) { 56 - /* This stop will re-enable interrupts */ 57 - __asm__("stop #0x2000" : : : "cc"); 58 - local_irq_disable(); 59 - } 60 - local_irq_enable(); 61 - } 62 - 63 - void (*idle)(void) = default_idle; 64 - 65 - /* 66 - * The idle thread. There's no useful work to be 67 - * done, so just try to conserve power and have a 68 - * low exit latency (ie sit in a loop waiting for 69 - * somebody to say that they'd like to reschedule) 70 - */ 71 - void cpu_idle(void) 72 - { 73 - /* endless idle loop with no priority at all */ 74 - while (1) { 75 - idle(); 76 - schedule_preempt_disabled(); 77 - } 78 - } 79 - 80 - void machine_restart(char * __unused) 81 - { 82 - if (mach_reset) 83 - mach_reset(); 84 - for (;;); 85 - } 86 - 87 - void machine_halt(void) 88 - { 89 - if (mach_halt) 90 - mach_halt(); 91 - for (;;); 92 - } 93 - 94 - void machine_power_off(void) 95 - { 96 - if (mach_power_off) 97 - mach_power_off(); 98 - for (;;); 99 - } 100 - 101 - void show_regs(struct pt_regs * regs) 102 - { 103 - printk(KERN_NOTICE "\n"); 104 - printk(KERN_NOTICE "Format %02x Vector: %04x PC: %08lx Status: %04x %s\n", 105 - regs->format, regs->vector, regs->pc, regs->sr, print_tainted()); 106 - printk(KERN_NOTICE "ORIG_D0: %08lx D0: %08lx A2: %08lx A1: %08lx\n", 107 - regs->orig_d0, regs->d0, regs->a2, regs->a1); 108 - printk(KERN_NOTICE "A0: %08lx D5: %08lx D4: %08lx\n", 109 - regs->a0, regs->d5, regs->d4); 110 - printk(KERN_NOTICE "D3: %08lx D2: %08lx D1: %08lx\n", 111 - regs->d3, regs->d2, regs->d1); 112 - if (!(regs->sr & PS_S)) 113 - printk(KERN_NOTICE "USP: %08lx\n", rdusp()); 114 - } 115 - 116 - /* 117 - * Create a kernel thread 118 - */ 119 - int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) 120 - { 121 - int retval; 122 - long clone_arg = flags | CLONE_VM; 123 - mm_segment_t fs; 124 - 125 - fs = get_fs(); 126 - set_fs(KERNEL_DS); 127 - 128 - __asm__ __volatile__ ( 129 - "movel %%sp, %%d2\n\t" 130 - "movel %5, %%d1\n\t" 131 - "movel %1, %%d0\n\t" 132 - "trap #0\n\t" 133 - "cmpl %%sp, %%d2\n\t" 134 - "jeq 1f\n\t" 135 - "movel %3, %%sp@-\n\t" 136 - "jsr %4@\n\t" 137 - "movel %2, %%d0\n\t" 138 - "trap #0\n" 139 - "1:\n\t" 140 - "movel %%d0, %0\n" 141 - : "=d" (retval) 142 - : "i" (__NR_clone), 143 - "i" (__NR_exit), 144 - "a" (arg), 145 - "a" (fn), 146 - "a" (clone_arg) 147 - : "cc", "%d0", "%d1", "%d2"); 148 - 149 - set_fs(fs); 150 - return retval; 151 - } 152 - EXPORT_SYMBOL(kernel_thread); 153 - 154 - void flush_thread(void) 155 - { 156 - #ifdef CONFIG_FPU 157 - unsigned long zero = 0; 158 - #endif 159 - 160 - current->thread.fs = __USER_DS; 161 - #ifdef CONFIG_FPU 162 - if (!FPU_IS_EMU) 163 - asm volatile (".chip 68k/68881\n\t" 164 - "frestore %0\n\t" 165 - ".chip 68k" : : "m" (zero)); 166 - #endif 167 - } 168 - 169 - /* 170 - * "m68k_fork()".. By the time we get here, the 171 - * non-volatile registers have also been saved on the 172 - * stack. We do some ugly pointer stuff here.. (see 173 - * also copy_thread) 174 - */ 175 - 176 - asmlinkage int m68k_fork(struct pt_regs *regs) 177 - { 178 - /* fork almost works, enough to trick you into looking elsewhere :-( */ 179 - return(-EINVAL); 180 - } 181 - 182 - asmlinkage int m68k_vfork(struct pt_regs *regs) 183 - { 184 - return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(), regs, 0, NULL, NULL); 185 - } 186 - 187 - asmlinkage int m68k_clone(struct pt_regs *regs) 188 - { 189 - unsigned long clone_flags; 190 - unsigned long newsp; 191 - 192 - /* syscall2 puts clone_flags in d1 and usp in d2 */ 193 - clone_flags = regs->d1; 194 - newsp = regs->d2; 195 - if (!newsp) 196 - newsp = rdusp(); 197 - return do_fork(clone_flags, newsp, regs, 0, NULL, NULL); 198 - } 199 - 200 - int copy_thread(unsigned long clone_flags, 201 - unsigned long usp, unsigned long topstk, 202 - struct task_struct * p, struct pt_regs * regs) 203 - { 204 - struct pt_regs * childregs; 205 - struct switch_stack * childstack, *stack; 206 - unsigned long *retp; 207 - 208 - childregs = (struct pt_regs *) (task_stack_page(p) + THREAD_SIZE) - 1; 209 - 210 - *childregs = *regs; 211 - childregs->d0 = 0; 212 - 213 - retp = ((unsigned long *) regs); 214 - stack = ((struct switch_stack *) retp) - 1; 215 - 216 - childstack = ((struct switch_stack *) childregs) - 1; 217 - *childstack = *stack; 218 - childstack->retpc = (unsigned long)ret_from_fork; 219 - 220 - p->thread.usp = usp; 221 - p->thread.ksp = (unsigned long)childstack; 222 - 223 - if (clone_flags & CLONE_SETTLS) 224 - task_thread_info(p)->tp_value = regs->d5; 225 - 226 - /* 227 - * Must save the current SFC/DFC value, NOT the value when 228 - * the parent was last descheduled - RGH 10-08-96 229 - */ 230 - p->thread.fs = get_fs().seg; 231 - 232 - #ifdef CONFIG_FPU 233 - if (!FPU_IS_EMU) { 234 - /* Copy the current fpu state */ 235 - asm volatile ("fsave %0" : : "m" (p->thread.fpstate[0]) : "memory"); 236 - 237 - if (p->thread.fpstate[0]) 238 - asm volatile ("fmovemx %/fp0-%/fp7,%0\n\t" 239 - "fmoveml %/fpiar/%/fpcr/%/fpsr,%1" 240 - : : "m" (p->thread.fp[0]), "m" (p->thread.fpcntl[0]) 241 - : "memory"); 242 - /* Restore the state in case the fpu was busy */ 243 - asm volatile ("frestore %0" : : "m" (p->thread.fpstate[0])); 244 - } 245 - #endif 246 - 247 - return 0; 248 - } 249 - 250 - /* Fill in the fpu structure for a core dump. */ 251 - 252 - int dump_fpu(struct pt_regs *regs, struct user_m68kfp_struct *fpu) 253 - { 254 - #ifdef CONFIG_FPU 255 - char fpustate[216]; 256 - 257 - if (FPU_IS_EMU) { 258 - int i; 259 - 260 - memcpy(fpu->fpcntl, current->thread.fpcntl, 12); 261 - memcpy(fpu->fpregs, current->thread.fp, 96); 262 - /* Convert internal fpu reg representation 263 - * into long double format 264 - */ 265 - for (i = 0; i < 24; i += 3) 266 - fpu->fpregs[i] = ((fpu->fpregs[i] & 0xffff0000) << 15) | 267 - ((fpu->fpregs[i] & 0x0000ffff) << 16); 268 - return 1; 269 - } 270 - 271 - /* First dump the fpu context to avoid protocol violation. */ 272 - asm volatile ("fsave %0" :: "m" (fpustate[0]) : "memory"); 273 - if (!fpustate[0]) 274 - return 0; 275 - 276 - asm volatile ("fmovem %/fpiar/%/fpcr/%/fpsr,%0" 277 - :: "m" (fpu->fpcntl[0]) 278 - : "memory"); 279 - asm volatile ("fmovemx %/fp0-%/fp7,%0" 280 - :: "m" (fpu->fpregs[0]) 281 - : "memory"); 282 - #endif 283 - return 1; 284 - } 285 - EXPORT_SYMBOL(dump_fpu); 286 - 287 - /* 288 - * Generic dumping code. Used for panic and debug. 289 - */ 290 - void dump(struct pt_regs *fp) 291 - { 292 - unsigned long *sp; 293 - unsigned char *tp; 294 - int i; 295 - 296 - printk(KERN_EMERG "\nCURRENT PROCESS:\n\n"); 297 - printk(KERN_EMERG "COMM=%s PID=%d\n", current->comm, current->pid); 298 - 299 - if (current->mm) { 300 - printk(KERN_EMERG "TEXT=%08x-%08x DATA=%08x-%08x BSS=%08x-%08x\n", 301 - (int) current->mm->start_code, 302 - (int) current->mm->end_code, 303 - (int) current->mm->start_data, 304 - (int) current->mm->end_data, 305 - (int) current->mm->end_data, 306 - (int) current->mm->brk); 307 - printk(KERN_EMERG "USER-STACK=%08x KERNEL-STACK=%08x\n\n", 308 - (int) current->mm->start_stack, 309 - (int)(((unsigned long) current) + THREAD_SIZE)); 310 - } 311 - 312 - printk(KERN_EMERG "PC: %08lx\n", fp->pc); 313 - printk(KERN_EMERG "SR: %08lx SP: %08lx\n", (long) fp->sr, (long) fp); 314 - printk(KERN_EMERG "d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n", 315 - fp->d0, fp->d1, fp->d2, fp->d3); 316 - printk(KERN_EMERG "d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n", 317 - fp->d4, fp->d5, fp->a0, fp->a1); 318 - printk(KERN_EMERG "\nUSP: %08x TRAPFRAME: %p\n", 319 - (unsigned int) rdusp(), fp); 320 - 321 - printk(KERN_EMERG "\nCODE:"); 322 - tp = ((unsigned char *) fp->pc) - 0x20; 323 - for (sp = (unsigned long *) tp, i = 0; (i < 0x40); i += 4) { 324 - if ((i % 0x10) == 0) 325 - printk(KERN_EMERG "%p: ", tp + i); 326 - printk("%08x ", (int) *sp++); 327 - } 328 - printk(KERN_EMERG "\n"); 329 - 330 - printk(KERN_EMERG "KERNEL STACK:"); 331 - tp = ((unsigned char *) fp) - 0x40; 332 - for (sp = (unsigned long *) tp, i = 0; (i < 0xc0); i += 4) { 333 - if ((i % 0x10) == 0) 334 - printk(KERN_EMERG "%p: ", tp + i); 335 - printk("%08x ", (int) *sp++); 336 - } 337 - printk(KERN_EMERG "\n"); 338 - 339 - printk(KERN_EMERG "USER STACK:"); 340 - tp = (unsigned char *) (rdusp() - 0x10); 341 - for (sp = (unsigned long *) tp, i = 0; (i < 0x80); i += 4) { 342 - if ((i % 0x10) == 0) 343 - printk(KERN_EMERG "%p: ", tp + i); 344 - printk("%08x ", (int) *sp++); 345 - } 346 - printk(KERN_EMERG "\n"); 347 - } 348 - 349 - /* 350 - * sys_execve() executes a new program. 351 - */ 352 - asmlinkage int sys_execve(const char *name, 353 - const char *const *argv, 354 - const char *const *envp) 355 - { 356 - int error; 357 - char * filename; 358 - struct pt_regs *regs = (struct pt_regs *) &name; 359 - 360 - filename = getname(name); 361 - error = PTR_ERR(filename); 362 - if (IS_ERR(filename)) 363 - return error; 364 - error = do_execve(filename, argv, envp, regs); 365 - putname(filename); 366 - return error; 367 - } 368 - 369 - unsigned long get_wchan(struct task_struct *p) 370 - { 371 - unsigned long fp, pc; 372 - unsigned long stack_page; 373 - int count = 0; 374 - if (!p || p == current || p->state == TASK_RUNNING) 375 - return 0; 376 - 377 - stack_page = (unsigned long)p; 378 - fp = ((struct switch_stack *)p->thread.ksp)->a6; 379 - do { 380 - if (fp < stack_page+sizeof(struct thread_info) || 381 - fp >= THREAD_SIZE-8+stack_page) 382 - return 0; 383 - pc = ((unsigned long *)fp)[1]; 384 - if (!in_sched_functions(pc)) 385 - return pc; 386 - fp = *(unsigned long *) fp; 387 - } while (count++ < 16); 388 - return 0; 389 - } 390 - 391 - /* 392 - * Return saved PC of a blocked thread. 393 - */ 394 - unsigned long thread_saved_pc(struct task_struct *tsk) 395 - { 396 - struct switch_stack *sw = (struct switch_stack *)tsk->thread.ksp; 397 - 398 - /* Check whether the thread is blocked in resume() */ 399 - if (in_sched_functions(sw->retpc)) 400 - return ((unsigned long *)sw->a6)[1]; 401 - else 402 - return sw->retpc; 403 - } 404 -
+303 -3
arch/m68k/kernel/ptrace.c
··· 1 + /* 2 + * linux/arch/m68k/kernel/ptrace.c 3 + * 4 + * Copyright (C) 1994 by Hamish Macdonald 5 + * Taken from linux/kernel/ptrace.c and modified for M680x0. 6 + * linux/kernel/ptrace.c is by Ross Biro 1/23/92, edited by Linus Torvalds 7 + * 8 + * This file is subject to the terms and conditions of the GNU General 9 + * Public License. See the file COPYING in the main directory of 10 + * this archive for more details. 11 + */ 12 + 13 + #include <linux/kernel.h> 14 + #include <linux/sched.h> 15 + #include <linux/mm.h> 16 + #include <linux/smp.h> 17 + #include <linux/errno.h> 18 + #include <linux/ptrace.h> 19 + #include <linux/user.h> 20 + #include <linux/signal.h> 21 + #include <linux/tracehook.h> 22 + 23 + #include <asm/uaccess.h> 24 + #include <asm/page.h> 25 + #include <asm/pgtable.h> 26 + #include <asm/system.h> 27 + #include <asm/processor.h> 28 + 29 + /* 30 + * does not yet catch signals sent when the child dies. 31 + * in exit.c or in signal.c. 32 + */ 33 + 34 + /* determines which bits in the SR the user has access to. */ 35 + /* 1 = access 0 = no access */ 36 + #define SR_MASK 0x001f 37 + 38 + /* sets the trace bits. */ 39 + #define TRACE_BITS 0xC000 40 + #define T1_BIT 0x8000 41 + #define T0_BIT 0x4000 42 + 43 + /* Find the stack offset for a register, relative to thread.esp0. */ 44 + #define PT_REG(reg) ((long)&((struct pt_regs *)0)->reg) 45 + #define SW_REG(reg) ((long)&((struct switch_stack *)0)->reg \ 46 + - sizeof(struct switch_stack)) 47 + /* Mapping from PT_xxx to the stack offset at which the register is 48 + saved. Notice that usp has no stack-slot and needs to be treated 49 + specially (see get_reg/put_reg below). */ 50 + static const int regoff[] = { 51 + [0] = PT_REG(d1), 52 + [1] = PT_REG(d2), 53 + [2] = PT_REG(d3), 54 + [3] = PT_REG(d4), 55 + [4] = PT_REG(d5), 56 + [5] = SW_REG(d6), 57 + [6] = SW_REG(d7), 58 + [7] = PT_REG(a0), 59 + [8] = PT_REG(a1), 60 + [9] = PT_REG(a2), 61 + [10] = SW_REG(a3), 62 + [11] = SW_REG(a4), 63 + [12] = SW_REG(a5), 64 + [13] = SW_REG(a6), 65 + [14] = PT_REG(d0), 66 + [15] = -1, 67 + [16] = PT_REG(orig_d0), 68 + [17] = PT_REG(sr), 69 + [18] = PT_REG(pc), 70 + }; 71 + 72 + /* 73 + * Get contents of register REGNO in task TASK. 74 + */ 75 + static inline long get_reg(struct task_struct *task, int regno) 76 + { 77 + unsigned long *addr; 78 + 79 + if (regno == PT_USP) 80 + addr = &task->thread.usp; 81 + else if (regno < ARRAY_SIZE(regoff)) 82 + addr = (unsigned long *)(task->thread.esp0 + regoff[regno]); 83 + else 84 + return 0; 85 + /* Need to take stkadj into account. */ 86 + if (regno == PT_SR || regno == PT_PC) { 87 + long stkadj = *(long *)(task->thread.esp0 + PT_REG(stkadj)); 88 + addr = (unsigned long *) ((unsigned long)addr + stkadj); 89 + /* The sr is actually a 16 bit register. */ 90 + if (regno == PT_SR) 91 + return *(unsigned short *)addr; 92 + } 93 + return *addr; 94 + } 95 + 96 + /* 97 + * Write contents of register REGNO in task TASK. 98 + */ 99 + static inline int put_reg(struct task_struct *task, int regno, 100 + unsigned long data) 101 + { 102 + unsigned long *addr; 103 + 104 + if (regno == PT_USP) 105 + addr = &task->thread.usp; 106 + else if (regno < ARRAY_SIZE(regoff)) 107 + addr = (unsigned long *)(task->thread.esp0 + regoff[regno]); 108 + else 109 + return -1; 110 + /* Need to take stkadj into account. */ 111 + if (regno == PT_SR || regno == PT_PC) { 112 + long stkadj = *(long *)(task->thread.esp0 + PT_REG(stkadj)); 113 + addr = (unsigned long *) ((unsigned long)addr + stkadj); 114 + /* The sr is actually a 16 bit register. */ 115 + if (regno == PT_SR) { 116 + *(unsigned short *)addr = data; 117 + return 0; 118 + } 119 + } 120 + *addr = data; 121 + return 0; 122 + } 123 + 124 + /* 125 + * Make sure the single step bit is not set. 126 + */ 127 + static inline void singlestep_disable(struct task_struct *child) 128 + { 129 + unsigned long tmp = get_reg(child, PT_SR) & ~TRACE_BITS; 130 + put_reg(child, PT_SR, tmp); 131 + clear_tsk_thread_flag(child, TIF_DELAYED_TRACE); 132 + } 133 + 134 + /* 135 + * Called by kernel/ptrace.c when detaching.. 136 + */ 137 + void ptrace_disable(struct task_struct *child) 138 + { 139 + singlestep_disable(child); 140 + } 141 + 142 + void user_enable_single_step(struct task_struct *child) 143 + { 144 + unsigned long tmp = get_reg(child, PT_SR) & ~TRACE_BITS; 145 + put_reg(child, PT_SR, tmp | T1_BIT); 146 + set_tsk_thread_flag(child, TIF_DELAYED_TRACE); 147 + } 148 + 1 149 #ifdef CONFIG_MMU 2 - #include "ptrace_mm.c" 3 - #else 4 - #include "ptrace_no.c" 150 + void user_enable_block_step(struct task_struct *child) 151 + { 152 + unsigned long tmp = get_reg(child, PT_SR) & ~TRACE_BITS; 153 + put_reg(child, PT_SR, tmp | T0_BIT); 154 + } 5 155 #endif 156 + 157 + void user_disable_single_step(struct task_struct *child) 158 + { 159 + singlestep_disable(child); 160 + } 161 + 162 + long arch_ptrace(struct task_struct *child, long request, 163 + unsigned long addr, unsigned long data) 164 + { 165 + unsigned long tmp; 166 + int i, ret = 0; 167 + int regno = addr >> 2; /* temporary hack. */ 168 + unsigned long __user *datap = (unsigned long __user *) data; 169 + 170 + switch (request) { 171 + /* read the word at location addr in the USER area. */ 172 + case PTRACE_PEEKUSR: 173 + if (addr & 3) 174 + goto out_eio; 175 + 176 + if (regno >= 0 && regno < 19) { 177 + tmp = get_reg(child, regno); 178 + } else if (regno >= 21 && regno < 49) { 179 + tmp = child->thread.fp[regno - 21]; 180 + /* Convert internal fpu reg representation 181 + * into long double format 182 + */ 183 + if (FPU_IS_EMU && (regno < 45) && !(regno % 3)) 184 + tmp = ((tmp & 0xffff0000) << 15) | 185 + ((tmp & 0x0000ffff) << 16); 186 + #ifndef CONFIG_MMU 187 + } else if (regno == 49) { 188 + tmp = child->mm->start_code; 189 + } else if (regno == 50) { 190 + tmp = child->mm->start_data; 191 + } else if (regno == 51) { 192 + tmp = child->mm->end_code; 193 + #endif 194 + } else 195 + goto out_eio; 196 + ret = put_user(tmp, datap); 197 + break; 198 + 199 + case PTRACE_POKEUSR: 200 + /* write the word at location addr in the USER area */ 201 + if (addr & 3) 202 + goto out_eio; 203 + 204 + if (regno == PT_SR) { 205 + data &= SR_MASK; 206 + data |= get_reg(child, PT_SR) & ~SR_MASK; 207 + } 208 + if (regno >= 0 && regno < 19) { 209 + if (put_reg(child, regno, data)) 210 + goto out_eio; 211 + } else if (regno >= 21 && regno < 48) { 212 + /* Convert long double format 213 + * into internal fpu reg representation 214 + */ 215 + if (FPU_IS_EMU && (regno < 45) && !(regno % 3)) { 216 + data <<= 15; 217 + data = (data & 0xffff0000) | 218 + ((data & 0x0000ffff) >> 1); 219 + } 220 + child->thread.fp[regno - 21] = data; 221 + } else 222 + goto out_eio; 223 + break; 224 + 225 + case PTRACE_GETREGS: /* Get all gp regs from the child. */ 226 + for (i = 0; i < 19; i++) { 227 + tmp = get_reg(child, i); 228 + ret = put_user(tmp, datap); 229 + if (ret) 230 + break; 231 + datap++; 232 + } 233 + break; 234 + 235 + case PTRACE_SETREGS: /* Set all gp regs in the child. */ 236 + for (i = 0; i < 19; i++) { 237 + ret = get_user(tmp, datap); 238 + if (ret) 239 + break; 240 + if (i == PT_SR) { 241 + tmp &= SR_MASK; 242 + tmp |= get_reg(child, PT_SR) & ~SR_MASK; 243 + } 244 + put_reg(child, i, tmp); 245 + datap++; 246 + } 247 + break; 248 + 249 + case PTRACE_GETFPREGS: /* Get the child FPU state. */ 250 + if (copy_to_user(datap, &child->thread.fp, 251 + sizeof(struct user_m68kfp_struct))) 252 + ret = -EFAULT; 253 + break; 254 + 255 + case PTRACE_SETFPREGS: /* Set the child FPU state. */ 256 + if (copy_from_user(&child->thread.fp, datap, 257 + sizeof(struct user_m68kfp_struct))) 258 + ret = -EFAULT; 259 + break; 260 + 261 + case PTRACE_GET_THREAD_AREA: 262 + ret = put_user(task_thread_info(child)->tp_value, datap); 263 + break; 264 + 265 + default: 266 + ret = ptrace_request(child, request, addr, data); 267 + break; 268 + } 269 + 270 + return ret; 271 + out_eio: 272 + return -EIO; 273 + } 274 + 275 + asmlinkage void syscall_trace(void) 276 + { 277 + ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) 278 + ? 0x80 : 0)); 279 + /* 280 + * this isn't the same as continuing with a signal, but it will do 281 + * for normal use. strace only continues with a signal if the 282 + * stopping signal is not SIGTRAP. -brl 283 + */ 284 + if (current->exit_code) { 285 + send_sig(current->exit_code, current, 1); 286 + current->exit_code = 0; 287 + } 288 + } 289 + 290 + #ifdef CONFIG_COLDFIRE 291 + asmlinkage int syscall_trace_enter(void) 292 + { 293 + int ret = 0; 294 + 295 + if (test_thread_flag(TIF_SYSCALL_TRACE)) 296 + ret = tracehook_report_syscall_entry(task_pt_regs(current)); 297 + return ret; 298 + } 299 + 300 + asmlinkage void syscall_trace_leave(void) 301 + { 302 + if (test_thread_flag(TIF_SYSCALL_TRACE)) 303 + tracehook_report_syscall_exit(task_pt_regs(current), 0); 304 + } 305 + #endif /* CONFIG_COLDFIRE */
-295
arch/m68k/kernel/ptrace_mm.c
··· 1 - /* 2 - * linux/arch/m68k/kernel/ptrace.c 3 - * 4 - * Copyright (C) 1994 by Hamish Macdonald 5 - * Taken from linux/kernel/ptrace.c and modified for M680x0. 6 - * linux/kernel/ptrace.c is by Ross Biro 1/23/92, edited by Linus Torvalds 7 - * 8 - * This file is subject to the terms and conditions of the GNU General 9 - * Public License. See the file COPYING in the main directory of 10 - * this archive for more details. 11 - */ 12 - 13 - #include <linux/kernel.h> 14 - #include <linux/sched.h> 15 - #include <linux/mm.h> 16 - #include <linux/smp.h> 17 - #include <linux/errno.h> 18 - #include <linux/ptrace.h> 19 - #include <linux/user.h> 20 - #include <linux/signal.h> 21 - #include <linux/tracehook.h> 22 - 23 - #include <asm/uaccess.h> 24 - #include <asm/page.h> 25 - #include <asm/pgtable.h> 26 - #include <asm/system.h> 27 - #include <asm/processor.h> 28 - 29 - /* 30 - * does not yet catch signals sent when the child dies. 31 - * in exit.c or in signal.c. 32 - */ 33 - 34 - /* determines which bits in the SR the user has access to. */ 35 - /* 1 = access 0 = no access */ 36 - #define SR_MASK 0x001f 37 - 38 - /* sets the trace bits. */ 39 - #define TRACE_BITS 0xC000 40 - #define T1_BIT 0x8000 41 - #define T0_BIT 0x4000 42 - 43 - /* Find the stack offset for a register, relative to thread.esp0. */ 44 - #define PT_REG(reg) ((long)&((struct pt_regs *)0)->reg) 45 - #define SW_REG(reg) ((long)&((struct switch_stack *)0)->reg \ 46 - - sizeof(struct switch_stack)) 47 - /* Mapping from PT_xxx to the stack offset at which the register is 48 - saved. Notice that usp has no stack-slot and needs to be treated 49 - specially (see get_reg/put_reg below). */ 50 - static const int regoff[] = { 51 - [0] = PT_REG(d1), 52 - [1] = PT_REG(d2), 53 - [2] = PT_REG(d3), 54 - [3] = PT_REG(d4), 55 - [4] = PT_REG(d5), 56 - [5] = SW_REG(d6), 57 - [6] = SW_REG(d7), 58 - [7] = PT_REG(a0), 59 - [8] = PT_REG(a1), 60 - [9] = PT_REG(a2), 61 - [10] = SW_REG(a3), 62 - [11] = SW_REG(a4), 63 - [12] = SW_REG(a5), 64 - [13] = SW_REG(a6), 65 - [14] = PT_REG(d0), 66 - [15] = -1, 67 - [16] = PT_REG(orig_d0), 68 - [17] = PT_REG(sr), 69 - [18] = PT_REG(pc), 70 - }; 71 - 72 - /* 73 - * Get contents of register REGNO in task TASK. 74 - */ 75 - static inline long get_reg(struct task_struct *task, int regno) 76 - { 77 - unsigned long *addr; 78 - 79 - if (regno == PT_USP) 80 - addr = &task->thread.usp; 81 - else if (regno < ARRAY_SIZE(regoff)) 82 - addr = (unsigned long *)(task->thread.esp0 + regoff[regno]); 83 - else 84 - return 0; 85 - /* Need to take stkadj into account. */ 86 - if (regno == PT_SR || regno == PT_PC) { 87 - long stkadj = *(long *)(task->thread.esp0 + PT_REG(stkadj)); 88 - addr = (unsigned long *) ((unsigned long)addr + stkadj); 89 - /* The sr is actually a 16 bit register. */ 90 - if (regno == PT_SR) 91 - return *(unsigned short *)addr; 92 - } 93 - return *addr; 94 - } 95 - 96 - /* 97 - * Write contents of register REGNO in task TASK. 98 - */ 99 - static inline int put_reg(struct task_struct *task, int regno, 100 - unsigned long data) 101 - { 102 - unsigned long *addr; 103 - 104 - if (regno == PT_USP) 105 - addr = &task->thread.usp; 106 - else if (regno < ARRAY_SIZE(regoff)) 107 - addr = (unsigned long *)(task->thread.esp0 + regoff[regno]); 108 - else 109 - return -1; 110 - /* Need to take stkadj into account. */ 111 - if (regno == PT_SR || regno == PT_PC) { 112 - long stkadj = *(long *)(task->thread.esp0 + PT_REG(stkadj)); 113 - addr = (unsigned long *) ((unsigned long)addr + stkadj); 114 - /* The sr is actually a 16 bit register. */ 115 - if (regno == PT_SR) { 116 - *(unsigned short *)addr = data; 117 - return 0; 118 - } 119 - } 120 - *addr = data; 121 - return 0; 122 - } 123 - 124 - /* 125 - * Make sure the single step bit is not set. 126 - */ 127 - static inline void singlestep_disable(struct task_struct *child) 128 - { 129 - unsigned long tmp = get_reg(child, PT_SR) & ~TRACE_BITS; 130 - put_reg(child, PT_SR, tmp); 131 - clear_tsk_thread_flag(child, TIF_DELAYED_TRACE); 132 - } 133 - 134 - /* 135 - * Called by kernel/ptrace.c when detaching.. 136 - */ 137 - void ptrace_disable(struct task_struct *child) 138 - { 139 - singlestep_disable(child); 140 - } 141 - 142 - void user_enable_single_step(struct task_struct *child) 143 - { 144 - unsigned long tmp = get_reg(child, PT_SR) & ~TRACE_BITS; 145 - put_reg(child, PT_SR, tmp | T1_BIT); 146 - set_tsk_thread_flag(child, TIF_DELAYED_TRACE); 147 - } 148 - 149 - void user_enable_block_step(struct task_struct *child) 150 - { 151 - unsigned long tmp = get_reg(child, PT_SR) & ~TRACE_BITS; 152 - put_reg(child, PT_SR, tmp | T0_BIT); 153 - } 154 - 155 - void user_disable_single_step(struct task_struct *child) 156 - { 157 - singlestep_disable(child); 158 - } 159 - 160 - long arch_ptrace(struct task_struct *child, long request, 161 - unsigned long addr, unsigned long data) 162 - { 163 - unsigned long tmp; 164 - int i, ret = 0; 165 - int regno = addr >> 2; /* temporary hack. */ 166 - unsigned long __user *datap = (unsigned long __user *) data; 167 - 168 - switch (request) { 169 - /* read the word at location addr in the USER area. */ 170 - case PTRACE_PEEKUSR: 171 - if (addr & 3) 172 - goto out_eio; 173 - 174 - if (regno >= 0 && regno < 19) { 175 - tmp = get_reg(child, regno); 176 - } else if (regno >= 21 && regno < 49) { 177 - tmp = child->thread.fp[regno - 21]; 178 - /* Convert internal fpu reg representation 179 - * into long double format 180 - */ 181 - if (FPU_IS_EMU && (regno < 45) && !(regno % 3)) 182 - tmp = ((tmp & 0xffff0000) << 15) | 183 - ((tmp & 0x0000ffff) << 16); 184 - } else 185 - goto out_eio; 186 - ret = put_user(tmp, datap); 187 - break; 188 - 189 - case PTRACE_POKEUSR: 190 - /* write the word at location addr in the USER area */ 191 - if (addr & 3) 192 - goto out_eio; 193 - 194 - if (regno == PT_SR) { 195 - data &= SR_MASK; 196 - data |= get_reg(child, PT_SR) & ~SR_MASK; 197 - } 198 - if (regno >= 0 && regno < 19) { 199 - if (put_reg(child, regno, data)) 200 - goto out_eio; 201 - } else if (regno >= 21 && regno < 48) { 202 - /* Convert long double format 203 - * into internal fpu reg representation 204 - */ 205 - if (FPU_IS_EMU && (regno < 45) && !(regno % 3)) { 206 - data <<= 15; 207 - data = (data & 0xffff0000) | 208 - ((data & 0x0000ffff) >> 1); 209 - } 210 - child->thread.fp[regno - 21] = data; 211 - } else 212 - goto out_eio; 213 - break; 214 - 215 - case PTRACE_GETREGS: /* Get all gp regs from the child. */ 216 - for (i = 0; i < 19; i++) { 217 - tmp = get_reg(child, i); 218 - ret = put_user(tmp, datap); 219 - if (ret) 220 - break; 221 - datap++; 222 - } 223 - break; 224 - 225 - case PTRACE_SETREGS: /* Set all gp regs in the child. */ 226 - for (i = 0; i < 19; i++) { 227 - ret = get_user(tmp, datap); 228 - if (ret) 229 - break; 230 - if (i == PT_SR) { 231 - tmp &= SR_MASK; 232 - tmp |= get_reg(child, PT_SR) & ~SR_MASK; 233 - } 234 - put_reg(child, i, tmp); 235 - datap++; 236 - } 237 - break; 238 - 239 - case PTRACE_GETFPREGS: /* Get the child FPU state. */ 240 - if (copy_to_user(datap, &child->thread.fp, 241 - sizeof(struct user_m68kfp_struct))) 242 - ret = -EFAULT; 243 - break; 244 - 245 - case PTRACE_SETFPREGS: /* Set the child FPU state. */ 246 - if (copy_from_user(&child->thread.fp, datap, 247 - sizeof(struct user_m68kfp_struct))) 248 - ret = -EFAULT; 249 - break; 250 - 251 - case PTRACE_GET_THREAD_AREA: 252 - ret = put_user(task_thread_info(child)->tp_value, datap); 253 - break; 254 - 255 - default: 256 - ret = ptrace_request(child, request, addr, data); 257 - break; 258 - } 259 - 260 - return ret; 261 - out_eio: 262 - return -EIO; 263 - } 264 - 265 - asmlinkage void syscall_trace(void) 266 - { 267 - ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) 268 - ? 0x80 : 0)); 269 - /* 270 - * this isn't the same as continuing with a signal, but it will do 271 - * for normal use. strace only continues with a signal if the 272 - * stopping signal is not SIGTRAP. -brl 273 - */ 274 - if (current->exit_code) { 275 - send_sig(current->exit_code, current, 1); 276 - current->exit_code = 0; 277 - } 278 - } 279 - 280 - #ifdef CONFIG_COLDFIRE 281 - asmlinkage int syscall_trace_enter(void) 282 - { 283 - int ret = 0; 284 - 285 - if (test_thread_flag(TIF_SYSCALL_TRACE)) 286 - ret = tracehook_report_syscall_entry(task_pt_regs(current)); 287 - return ret; 288 - } 289 - 290 - asmlinkage void syscall_trace_leave(void) 291 - { 292 - if (test_thread_flag(TIF_SYSCALL_TRACE)) 293 - tracehook_report_syscall_exit(task_pt_regs(current), 0); 294 - } 295 - #endif /* CONFIG_COLDFIRE */
-255
arch/m68k/kernel/ptrace_no.c
··· 1 - /* 2 - * linux/arch/m68knommu/kernel/ptrace.c 3 - * 4 - * Copyright (C) 1994 by Hamish Macdonald 5 - * Taken from linux/kernel/ptrace.c and modified for M680x0. 6 - * linux/kernel/ptrace.c is by Ross Biro 1/23/92, edited by Linus Torvalds 7 - * 8 - * This file is subject to the terms and conditions of the GNU General 9 - * Public License. See the file COPYING in the main directory of 10 - * this archive for more details. 11 - */ 12 - 13 - #include <linux/kernel.h> 14 - #include <linux/sched.h> 15 - #include <linux/mm.h> 16 - #include <linux/smp.h> 17 - #include <linux/errno.h> 18 - #include <linux/ptrace.h> 19 - #include <linux/user.h> 20 - #include <linux/signal.h> 21 - #include <linux/tracehook.h> 22 - 23 - #include <asm/uaccess.h> 24 - #include <asm/page.h> 25 - #include <asm/pgtable.h> 26 - #include <asm/system.h> 27 - #include <asm/processor.h> 28 - 29 - /* 30 - * does not yet catch signals sent when the child dies. 31 - * in exit.c or in signal.c. 32 - */ 33 - 34 - /* determines which bits in the SR the user has access to. */ 35 - /* 1 = access 0 = no access */ 36 - #define SR_MASK 0x001f 37 - 38 - /* sets the trace bits. */ 39 - #define TRACE_BITS 0x8000 40 - 41 - /* Find the stack offset for a register, relative to thread.esp0. */ 42 - #define PT_REG(reg) ((long)&((struct pt_regs *)0)->reg) 43 - #define SW_REG(reg) ((long)&((struct switch_stack *)0)->reg \ 44 - - sizeof(struct switch_stack)) 45 - /* Mapping from PT_xxx to the stack offset at which the register is 46 - saved. Notice that usp has no stack-slot and needs to be treated 47 - specially (see get_reg/put_reg below). */ 48 - static int regoff[] = { 49 - PT_REG(d1), PT_REG(d2), PT_REG(d3), PT_REG(d4), 50 - PT_REG(d5), SW_REG(d6), SW_REG(d7), PT_REG(a0), 51 - PT_REG(a1), PT_REG(a2), SW_REG(a3), SW_REG(a4), 52 - SW_REG(a5), SW_REG(a6), PT_REG(d0), -1, 53 - PT_REG(orig_d0), PT_REG(sr), PT_REG(pc), 54 - }; 55 - 56 - /* 57 - * Get contents of register REGNO in task TASK. 58 - */ 59 - static inline long get_reg(struct task_struct *task, int regno) 60 - { 61 - unsigned long *addr; 62 - 63 - if (regno == PT_USP) 64 - addr = &task->thread.usp; 65 - else if (regno < ARRAY_SIZE(regoff)) 66 - addr = (unsigned long *)(task->thread.esp0 + regoff[regno]); 67 - else 68 - return 0; 69 - return *addr; 70 - } 71 - 72 - /* 73 - * Write contents of register REGNO in task TASK. 74 - */ 75 - static inline int put_reg(struct task_struct *task, int regno, 76 - unsigned long data) 77 - { 78 - unsigned long *addr; 79 - 80 - if (regno == PT_USP) 81 - addr = &task->thread.usp; 82 - else if (regno < ARRAY_SIZE(regoff)) 83 - addr = (unsigned long *) (task->thread.esp0 + regoff[regno]); 84 - else 85 - return -1; 86 - *addr = data; 87 - return 0; 88 - } 89 - 90 - void user_enable_single_step(struct task_struct *task) 91 - { 92 - unsigned long srflags; 93 - srflags = get_reg(task, PT_SR) | (TRACE_BITS << 16); 94 - put_reg(task, PT_SR, srflags); 95 - } 96 - 97 - void user_disable_single_step(struct task_struct *task) 98 - { 99 - unsigned long srflags; 100 - srflags = get_reg(task, PT_SR) & ~(TRACE_BITS << 16); 101 - put_reg(task, PT_SR, srflags); 102 - } 103 - 104 - /* 105 - * Called by kernel/ptrace.c when detaching.. 106 - * 107 - * Make sure the single step bit is not set. 108 - */ 109 - void ptrace_disable(struct task_struct *child) 110 - { 111 - /* make sure the single step bit is not set. */ 112 - user_disable_single_step(child); 113 - } 114 - 115 - long arch_ptrace(struct task_struct *child, long request, 116 - unsigned long addr, unsigned long data) 117 - { 118 - int ret; 119 - int regno = addr >> 2; 120 - unsigned long __user *datap = (unsigned long __user *) data; 121 - 122 - switch (request) { 123 - /* read the word at location addr in the USER area. */ 124 - case PTRACE_PEEKUSR: { 125 - unsigned long tmp; 126 - 127 - ret = -EIO; 128 - if ((addr & 3) || addr > sizeof(struct user) - 3) 129 - break; 130 - 131 - tmp = 0; /* Default return condition */ 132 - ret = -EIO; 133 - if (regno < 19) { 134 - tmp = get_reg(child, regno); 135 - if (regno == PT_SR) 136 - tmp >>= 16; 137 - } else if (regno >= 21 && regno < 49) { 138 - tmp = child->thread.fp[regno - 21]; 139 - } else if (regno == 49) { 140 - tmp = child->mm->start_code; 141 - } else if (regno == 50) { 142 - tmp = child->mm->start_data; 143 - } else if (regno == 51) { 144 - tmp = child->mm->end_code; 145 - } else 146 - break; 147 - ret = put_user(tmp, datap); 148 - break; 149 - } 150 - 151 - case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ 152 - ret = -EIO; 153 - if ((addr & 3) || addr > sizeof(struct user) - 3) 154 - break; 155 - 156 - if (regno == PT_SR) { 157 - data &= SR_MASK; 158 - data <<= 16; 159 - data |= get_reg(child, PT_SR) & ~(SR_MASK << 16); 160 - } 161 - if (regno < 19) { 162 - if (put_reg(child, regno, data)) 163 - break; 164 - ret = 0; 165 - break; 166 - } 167 - if (regno >= 21 && regno < 48) 168 - { 169 - child->thread.fp[regno - 21] = data; 170 - ret = 0; 171 - } 172 - break; 173 - 174 - case PTRACE_GETREGS: { /* Get all gp regs from the child. */ 175 - int i; 176 - unsigned long tmp; 177 - for (i = 0; i < 19; i++) { 178 - tmp = get_reg(child, i); 179 - if (i == PT_SR) 180 - tmp >>= 16; 181 - if (put_user(tmp, datap)) { 182 - ret = -EFAULT; 183 - break; 184 - } 185 - datap++; 186 - } 187 - ret = 0; 188 - break; 189 - } 190 - 191 - case PTRACE_SETREGS: { /* Set all gp regs in the child. */ 192 - int i; 193 - unsigned long tmp; 194 - for (i = 0; i < 19; i++) { 195 - if (get_user(tmp, datap)) { 196 - ret = -EFAULT; 197 - break; 198 - } 199 - if (i == PT_SR) { 200 - tmp &= SR_MASK; 201 - tmp <<= 16; 202 - tmp |= get_reg(child, PT_SR) & ~(SR_MASK << 16); 203 - } 204 - put_reg(child, i, tmp); 205 - datap++; 206 - } 207 - ret = 0; 208 - break; 209 - } 210 - 211 - #ifdef PTRACE_GETFPREGS 212 - case PTRACE_GETFPREGS: { /* Get the child FPU state. */ 213 - ret = 0; 214 - if (copy_to_user(datap, &child->thread.fp, 215 - sizeof(struct user_m68kfp_struct))) 216 - ret = -EFAULT; 217 - break; 218 - } 219 - #endif 220 - 221 - #ifdef PTRACE_SETFPREGS 222 - case PTRACE_SETFPREGS: { /* Set the child FPU state. */ 223 - ret = 0; 224 - if (copy_from_user(&child->thread.fp, datap, 225 - sizeof(struct user_m68kfp_struct))) 226 - ret = -EFAULT; 227 - break; 228 - } 229 - #endif 230 - 231 - case PTRACE_GET_THREAD_AREA: 232 - ret = put_user(task_thread_info(child)->tp_value, datap); 233 - break; 234 - 235 - default: 236 - ret = ptrace_request(child, request, addr, data); 237 - break; 238 - } 239 - return ret; 240 - } 241 - 242 - asmlinkage int syscall_trace_enter(void) 243 - { 244 - int ret = 0; 245 - 246 - if (test_thread_flag(TIF_SYSCALL_TRACE)) 247 - ret = tracehook_report_syscall_entry(task_pt_regs(current)); 248 - return ret; 249 - } 250 - 251 - asmlinkage void syscall_trace_leave(void) 252 - { 253 - if (test_thread_flag(TIF_SYSCALL_TRACE)) 254 - tracehook_report_syscall_exit(task_pt_regs(current), 0); 255 - }
+3
arch/m68k/kernel/setup_no.c
··· 31 31 #include <linux/init.h> 32 32 #include <linux/initrd.h> 33 33 #include <linux/root_dev.h> 34 + #include <linux/rtc.h> 34 35 35 36 #include <asm/setup.h> 36 37 #include <asm/irq.h> ··· 48 47 char __initdata command_line[COMMAND_LINE_SIZE]; 49 48 50 49 /* machine dependent timer functions */ 50 + void (*mach_sched_init)(irq_handler_t handler) __initdata = NULL; 51 51 int (*mach_set_clock_mmss)(unsigned long); 52 + int (*mach_hwclk) (int, struct rtc_time*); 52 53 53 54 /* machine dependent reboot functions */ 54 55 void (*mach_reset)(void);
+111 -5
arch/m68k/kernel/time.c
··· 1 - #if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE) 2 - #include "time_mm.c" 3 - #else 4 - #include "time_no.c" 5 - #endif 1 + /* 2 + * linux/arch/m68k/kernel/time.c 3 + * 4 + * Copyright (C) 1991, 1992, 1995 Linus Torvalds 5 + * 6 + * This file contains the m68k-specific time handling details. 7 + * Most of the stuff is located in the machine specific files. 8 + * 9 + * 1997-09-10 Updated NTP code according to technical memorandum Jan '96 10 + * "A Kernel Model for Precision Timekeeping" by Dave Mills 11 + */ 12 + 13 + #include <linux/errno.h> 14 + #include <linux/module.h> 15 + #include <linux/sched.h> 16 + #include <linux/kernel.h> 17 + #include <linux/param.h> 18 + #include <linux/string.h> 19 + #include <linux/mm.h> 20 + #include <linux/rtc.h> 21 + #include <linux/platform_device.h> 22 + 23 + #include <asm/machdep.h> 24 + #include <asm/io.h> 25 + #include <asm/irq_regs.h> 26 + 27 + #include <linux/time.h> 28 + #include <linux/timex.h> 29 + #include <linux/profile.h> 30 + 31 + /* 32 + * timer_interrupt() needs to keep up the real-time clock, 33 + * as well as call the "xtime_update()" routine every clocktick 34 + */ 35 + static irqreturn_t timer_interrupt(int irq, void *dummy) 36 + { 37 + xtime_update(1); 38 + update_process_times(user_mode(get_irq_regs())); 39 + profile_tick(CPU_PROFILING); 40 + 41 + #ifdef CONFIG_HEARTBEAT 42 + /* use power LED as a heartbeat instead -- much more useful 43 + for debugging -- based on the version for PReP by Cort */ 44 + /* acts like an actual heart beat -- ie thump-thump-pause... */ 45 + if (mach_heartbeat) { 46 + static unsigned cnt = 0, period = 0, dist = 0; 47 + 48 + if (cnt == 0 || cnt == dist) 49 + mach_heartbeat( 1 ); 50 + else if (cnt == 7 || cnt == dist+7) 51 + mach_heartbeat( 0 ); 52 + 53 + if (++cnt > period) { 54 + cnt = 0; 55 + /* The hyperbolic function below modifies the heartbeat period 56 + * length in dependency of the current (5min) load. It goes 57 + * through the points f(0)=126, f(1)=86, f(5)=51, 58 + * f(inf)->30. */ 59 + period = ((672<<FSHIFT)/(5*avenrun[0]+(7<<FSHIFT))) + 30; 60 + dist = period / 4; 61 + } 62 + } 63 + #endif /* CONFIG_HEARTBEAT */ 64 + return IRQ_HANDLED; 65 + } 66 + 67 + void read_persistent_clock(struct timespec *ts) 68 + { 69 + struct rtc_time time; 70 + ts->tv_sec = 0; 71 + ts->tv_nsec = 0; 72 + 73 + if (mach_hwclk) { 74 + mach_hwclk(0, &time); 75 + 76 + if ((time.tm_year += 1900) < 1970) 77 + time.tm_year += 100; 78 + ts->tv_sec = mktime(time.tm_year, time.tm_mon, time.tm_mday, 79 + time.tm_hour, time.tm_min, time.tm_sec); 80 + } 81 + } 82 + 83 + void __init time_init(void) 84 + { 85 + mach_sched_init(timer_interrupt); 86 + } 87 + 88 + #ifdef CONFIG_M68KCLASSIC 89 + 90 + u32 arch_gettimeoffset(void) 91 + { 92 + return mach_gettimeoffset() * 1000; 93 + } 94 + 95 + static int __init rtc_init(void) 96 + { 97 + struct platform_device *pdev; 98 + 99 + if (!mach_hwclk) 100 + return -ENODEV; 101 + 102 + pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0); 103 + if (IS_ERR(pdev)) 104 + return PTR_ERR(pdev); 105 + 106 + return 0; 107 + } 108 + 109 + module_init(rtc_init); 110 + 111 + #endif /* CONFIG_M68KCLASSIC */
-114
arch/m68k/kernel/time_mm.c
··· 1 - /* 2 - * linux/arch/m68k/kernel/time.c 3 - * 4 - * Copyright (C) 1991, 1992, 1995 Linus Torvalds 5 - * 6 - * This file contains the m68k-specific time handling details. 7 - * Most of the stuff is located in the machine specific files. 8 - * 9 - * 1997-09-10 Updated NTP code according to technical memorandum Jan '96 10 - * "A Kernel Model for Precision Timekeeping" by Dave Mills 11 - */ 12 - 13 - #include <linux/errno.h> 14 - #include <linux/module.h> 15 - #include <linux/sched.h> 16 - #include <linux/kernel.h> 17 - #include <linux/param.h> 18 - #include <linux/string.h> 19 - #include <linux/mm.h> 20 - #include <linux/rtc.h> 21 - #include <linux/platform_device.h> 22 - 23 - #include <asm/machdep.h> 24 - #include <asm/io.h> 25 - #include <asm/irq_regs.h> 26 - 27 - #include <linux/time.h> 28 - #include <linux/timex.h> 29 - #include <linux/profile.h> 30 - 31 - static inline int set_rtc_mmss(unsigned long nowtime) 32 - { 33 - if (mach_set_clock_mmss) 34 - return mach_set_clock_mmss (nowtime); 35 - return -1; 36 - } 37 - 38 - /* 39 - * timer_interrupt() needs to keep up the real-time clock, 40 - * as well as call the "xtime_update()" routine every clocktick 41 - */ 42 - static irqreturn_t timer_interrupt(int irq, void *dummy) 43 - { 44 - xtime_update(1); 45 - update_process_times(user_mode(get_irq_regs())); 46 - profile_tick(CPU_PROFILING); 47 - 48 - #ifdef CONFIG_HEARTBEAT 49 - /* use power LED as a heartbeat instead -- much more useful 50 - for debugging -- based on the version for PReP by Cort */ 51 - /* acts like an actual heart beat -- ie thump-thump-pause... */ 52 - if (mach_heartbeat) { 53 - static unsigned cnt = 0, period = 0, dist = 0; 54 - 55 - if (cnt == 0 || cnt == dist) 56 - mach_heartbeat( 1 ); 57 - else if (cnt == 7 || cnt == dist+7) 58 - mach_heartbeat( 0 ); 59 - 60 - if (++cnt > period) { 61 - cnt = 0; 62 - /* The hyperbolic function below modifies the heartbeat period 63 - * length in dependency of the current (5min) load. It goes 64 - * through the points f(0)=126, f(1)=86, f(5)=51, 65 - * f(inf)->30. */ 66 - period = ((672<<FSHIFT)/(5*avenrun[0]+(7<<FSHIFT))) + 30; 67 - dist = period / 4; 68 - } 69 - } 70 - #endif /* CONFIG_HEARTBEAT */ 71 - return IRQ_HANDLED; 72 - } 73 - 74 - void read_persistent_clock(struct timespec *ts) 75 - { 76 - struct rtc_time time; 77 - ts->tv_sec = 0; 78 - ts->tv_nsec = 0; 79 - 80 - if (mach_hwclk) { 81 - mach_hwclk(0, &time); 82 - 83 - if ((time.tm_year += 1900) < 1970) 84 - time.tm_year += 100; 85 - ts->tv_sec = mktime(time.tm_year, time.tm_mon, time.tm_mday, 86 - time.tm_hour, time.tm_min, time.tm_sec); 87 - } 88 - } 89 - 90 - void __init time_init(void) 91 - { 92 - mach_sched_init(timer_interrupt); 93 - } 94 - 95 - u32 arch_gettimeoffset(void) 96 - { 97 - return mach_gettimeoffset() * 1000; 98 - } 99 - 100 - static int __init rtc_init(void) 101 - { 102 - struct platform_device *pdev; 103 - 104 - if (!mach_hwclk) 105 - return -ENODEV; 106 - 107 - pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0); 108 - if (IS_ERR(pdev)) 109 - return PTR_ERR(pdev); 110 - 111 - return 0; 112 - } 113 - 114 - module_init(rtc_init);
-90
arch/m68k/kernel/time_no.c
··· 1 - /* 2 - * linux/arch/m68knommu/kernel/time.c 3 - * 4 - * Copyright (C) 1991, 1992, 1995 Linus Torvalds 5 - * 6 - * This file contains the m68k-specific time handling details. 7 - * Most of the stuff is located in the machine specific files. 8 - * 9 - * 1997-09-10 Updated NTP code according to technical memorandum Jan '96 10 - * "A Kernel Model for Precision Timekeeping" by Dave Mills 11 - */ 12 - 13 - #include <linux/errno.h> 14 - #include <linux/module.h> 15 - #include <linux/sched.h> 16 - #include <linux/kernel.h> 17 - #include <linux/param.h> 18 - #include <linux/string.h> 19 - #include <linux/mm.h> 20 - #include <linux/profile.h> 21 - #include <linux/time.h> 22 - #include <linux/timex.h> 23 - 24 - #include <asm/machdep.h> 25 - #include <asm/irq_regs.h> 26 - 27 - #define TICK_SIZE (tick_nsec / 1000) 28 - 29 - /* machine dependent timer functions */ 30 - void (*mach_gettod)(int*, int*, int*, int*, int*, int*); 31 - 32 - static inline int set_rtc_mmss(unsigned long nowtime) 33 - { 34 - if (mach_set_clock_mmss) 35 - return mach_set_clock_mmss (nowtime); 36 - return -1; 37 - } 38 - 39 - #ifndef CONFIG_GENERIC_CLOCKEVENTS 40 - /* 41 - * timer_interrupt() needs to keep up the real-time clock, 42 - * as well as call the "xtime_update()" routine every clocktick 43 - */ 44 - irqreturn_t arch_timer_interrupt(int irq, void *dummy) 45 - { 46 - 47 - if (current->pid) 48 - profile_tick(CPU_PROFILING); 49 - 50 - xtime_update(1); 51 - 52 - update_process_times(user_mode(get_irq_regs())); 53 - 54 - return(IRQ_HANDLED); 55 - } 56 - #endif 57 - 58 - static unsigned long read_rtc_mmss(void) 59 - { 60 - unsigned int year, mon, day, hour, min, sec; 61 - 62 - if (mach_gettod) { 63 - mach_gettod(&year, &mon, &day, &hour, &min, &sec); 64 - if ((year += 1900) < 1970) 65 - year += 100; 66 - } else { 67 - year = 1970; 68 - mon = day = 1; 69 - hour = min = sec = 0; 70 - } 71 - 72 - 73 - return mktime(year, mon, day, hour, min, sec); 74 - } 75 - 76 - void read_persistent_clock(struct timespec *ts) 77 - { 78 - ts->tv_sec = read_rtc_mmss(); 79 - ts->tv_nsec = 0; 80 - } 81 - 82 - int update_persistent_clock(struct timespec now) 83 - { 84 - return set_rtc_mmss(now.tv_sec); 85 - } 86 - 87 - void time_init(void) 88 - { 89 - hw_timer_init(); 90 - }
+48 -150
arch/m68k/kernel/vmlinux-nommu.lds
··· 1 1 /* 2 2 * vmlinux.lds.S -- master linker script for m68knommu arch 3 3 * 4 - * (C) Copyright 2002-2006, Greg Ungerer <gerg@snapgear.com> 4 + * (C) Copyright 2002-2012, Greg Ungerer <gerg@snapgear.com> 5 5 * 6 6 * This linker script is equipped to build either ROM loaded or RAM 7 7 * run kernels. 8 8 */ 9 9 10 - #include <asm-generic/vmlinux.lds.h> 10 + #if defined(CONFIG_RAMKERNEL) 11 + #define KTEXT_ADDR CONFIG_KERNELBASE 12 + #endif 13 + #if defined(CONFIG_ROMKERNEL) 14 + #define KTEXT_ADDR CONFIG_ROMSTART 15 + #define KDATA_ADDR CONFIG_KERNELBASE 16 + #define LOAD_OFFSET KDATA_ADDR + (ADDR(.text) + SIZEOF(.text)) 17 + #endif 18 + 11 19 #include <asm/page.h> 12 20 #include <asm/thread_info.h> 13 - 14 - #if defined(CONFIG_RAMKERNEL) 15 - #define RAM_START CONFIG_KERNELBASE 16 - #define RAM_LENGTH (CONFIG_RAMBASE + CONFIG_RAMSIZE - CONFIG_KERNELBASE) 17 - #define TEXT ram 18 - #define DATA ram 19 - #define INIT ram 20 - #define BSSS ram 21 - #endif 22 - #if defined(CONFIG_ROMKERNEL) || defined(CONFIG_HIMEMKERNEL) 23 - #define RAM_START CONFIG_RAMBASE 24 - #define RAM_LENGTH CONFIG_RAMSIZE 25 - #define ROMVEC_START CONFIG_ROMVEC 26 - #define ROMVEC_LENGTH CONFIG_ROMVECSIZE 27 - #define ROM_START CONFIG_ROMSTART 28 - #define ROM_LENGTH CONFIG_ROMSIZE 29 - #define TEXT rom 30 - #define DATA ram 31 - #define INIT ram 32 - #define BSSS ram 33 - #endif 34 - 35 - #ifndef DATA_ADDR 36 - #define DATA_ADDR 37 - #endif 38 - 21 + #include <asm-generic/vmlinux.lds.h> 39 22 40 23 OUTPUT_ARCH(m68k) 41 24 ENTRY(_start) 42 - 43 - MEMORY { 44 - ram : ORIGIN = RAM_START, LENGTH = RAM_LENGTH 45 - #ifdef ROM_START 46 - romvec : ORIGIN = ROMVEC_START, LENGTH = ROMVEC_LENGTH 47 - rom : ORIGIN = ROM_START, LENGTH = ROM_LENGTH 48 - #endif 49 - } 50 25 51 26 jiffies = jiffies_64 + 4; 52 27 53 28 SECTIONS { 54 29 55 - #ifdef ROMVEC_START 56 - . = ROMVEC_START ; 30 + #ifdef CONFIG_ROMVEC 31 + . = CONFIG_ROMVEC; 57 32 .romvec : { 58 - __rom_start = . ; 33 + __rom_start = .; 59 34 _romvec = .; 35 + *(.romvec) 60 36 *(.data..initvect) 61 - } > romvec 37 + } 62 38 #endif 63 39 40 + . = KTEXT_ADDR; 41 + 42 + _text = .; 43 + _stext = .; 64 44 .text : { 65 - _text = .; 66 - _stext = . ; 67 45 HEAD_TEXT 68 46 TEXT_TEXT 69 47 SCHED_TEXT 70 48 LOCK_TEXT 71 - *(.text..lock) 72 49 *(.fixup) 50 + . = ALIGN(16); 51 + } 52 + _etext = .; 73 53 74 - . = ALIGN(16); /* Exception table */ 75 - __start___ex_table = .; 76 - *(__ex_table) 77 - __stop___ex_table = .; 54 + #ifdef KDATA_ADDR 55 + . = KDATA_ADDR; 56 + #endif 78 57 79 - *(.rodata) *(.rodata.*) 80 - *(__vermagic) /* Kernel version magic */ 81 - *(.rodata1) 82 - *(.rodata.str1.1) 58 + _sdata = .; 59 + RO_DATA_SECTION(PAGE_SIZE) 60 + RW_DATA_SECTION(16, PAGE_SIZE, THREAD_SIZE) 61 + _edata = .; 83 62 84 - /* Kernel symbol table: Normal symbols */ 85 - . = ALIGN(4); 86 - __start___ksymtab = .; 87 - *(SORT(___ksymtab+*)) 88 - __stop___ksymtab = .; 63 + EXCEPTION_TABLE(16) 64 + NOTES 89 65 90 - /* Kernel symbol table: GPL-only symbols */ 91 - __start___ksymtab_gpl = .; 92 - *(SORT(___ksymtab_gpl+*)) 93 - __stop___ksymtab_gpl = .; 94 - 95 - /* Kernel symbol table: Normal unused symbols */ 96 - __start___ksymtab_unused = .; 97 - *(SORT(___ksymtab_unused+*)) 98 - __stop___ksymtab_unused = .; 99 - 100 - /* Kernel symbol table: GPL-only unused symbols */ 101 - __start___ksymtab_unused_gpl = .; 102 - *(SORT(___ksymtab_unused_gpl+*)) 103 - __stop___ksymtab_unused_gpl = .; 104 - 105 - /* Kernel symbol table: GPL-future symbols */ 106 - __start___ksymtab_gpl_future = .; 107 - *(SORT(___ksymtab_gpl_future+*)) 108 - __stop___ksymtab_gpl_future = .; 109 - 110 - /* Kernel symbol table: Normal symbols */ 111 - __start___kcrctab = .; 112 - *(SORT(___kcrctab+*)) 113 - __stop___kcrctab = .; 114 - 115 - /* Kernel symbol table: GPL-only symbols */ 116 - __start___kcrctab_gpl = .; 117 - *(SORT(___kcrctab_gpl+*)) 118 - __stop___kcrctab_gpl = .; 119 - 120 - /* Kernel symbol table: Normal unused symbols */ 121 - __start___kcrctab_unused = .; 122 - *(SORT(___kcrctab_unused+*)) 123 - __stop___kcrctab_unused = .; 124 - 125 - /* Kernel symbol table: GPL-only unused symbols */ 126 - __start___kcrctab_unused_gpl = .; 127 - *(SORT(___kcrctab_unused_gpl+*)) 128 - __stop___kcrctab_unused_gpl = .; 129 - 130 - /* Kernel symbol table: GPL-future symbols */ 131 - __start___kcrctab_gpl_future = .; 132 - *(SORT(___kcrctab_gpl_future+*)) 133 - __stop___kcrctab_gpl_future = .; 134 - 135 - /* Kernel symbol table: strings */ 136 - *(__ksymtab_strings) 137 - 138 - /* Built-in module parameters */ 139 - . = ALIGN(4) ; 140 - __start___param = .; 141 - *(__param) 142 - __stop___param = .; 143 - 144 - /* Built-in module versions */ 145 - . = ALIGN(4) ; 146 - __start___modver = .; 147 - *(__modver) 148 - __stop___modver = .; 149 - 150 - . = ALIGN(4) ; 151 - _etext = . ; 152 - } > TEXT 153 - 154 - .data DATA_ADDR : { 155 - . = ALIGN(4); 156 - _sdata = . ; 157 - DATA_DATA 158 - CACHELINE_ALIGNED_DATA(32) 159 - PAGE_ALIGNED_DATA(PAGE_SIZE) 160 - *(.data..shared_aligned) 161 - INIT_TASK_DATA(THREAD_SIZE) 162 - _edata = . ; 163 - } > DATA 164 - 66 + . = ALIGN(PAGE_SIZE); 67 + __init_begin = .; 68 + INIT_TEXT_SECTION(PAGE_SIZE) 69 + INIT_DATA_SECTION(16) 70 + PERCPU_SECTION(16) 165 71 .m68k_fixup : { 166 72 __start_fixup = .; 167 73 *(.m68k_fixup) 168 74 __stop_fixup = .; 169 - } > DATA 170 - NOTES > DATA 171 - 172 - .init.text : { 173 - . = ALIGN(PAGE_SIZE); 174 - __init_begin = .; 175 - } > INIT 176 - INIT_TEXT_SECTION(PAGE_SIZE) > INIT 177 - INIT_DATA_SECTION(16) > INIT 75 + } 178 76 .init.data : { 179 77 . = ALIGN(PAGE_SIZE); 180 78 __init_end = .; 181 - } > INIT 79 + } 182 80 183 - .bss : { 184 - . = ALIGN(4); 185 - _sbss = . ; 186 - *(.bss) 187 - *(COMMON) 188 - . = ALIGN(4) ; 189 - _ebss = . ; 190 - _end = . ; 191 - } > BSSS 81 + _sbss = .; 82 + BSS_SECTION(0, 0, 0) 83 + _ebss = .; 192 84 85 + _end = .; 86 + 87 + STABS_DEBUG 88 + .comment 0 : { *(.comment) } 89 + 90 + /* Sections to be discarded */ 193 91 DISCARDS 194 92 } 195 93
+1 -90
arch/m68k/platform/5206/config.c
··· 16 16 #include <asm/machdep.h> 17 17 #include <asm/coldfire.h> 18 18 #include <asm/mcfsim.h> 19 - #include <asm/mcfuart.h> 20 - 21 - /***************************************************************************/ 22 - 23 - static struct mcf_platform_uart m5206_uart_platform[] = { 24 - { 25 - .mapbase = MCF_MBAR + MCFUART_BASE1, 26 - .irq = 73, 27 - }, 28 - { 29 - .mapbase = MCF_MBAR + MCFUART_BASE2, 30 - .irq = 74, 31 - }, 32 - { }, 33 - }; 34 - 35 - static struct platform_device m5206_uart = { 36 - .name = "mcfuart", 37 - .id = 0, 38 - .dev.platform_data = m5206_uart_platform, 39 - }; 40 - 41 - static struct platform_device *m5206_devices[] __initdata = { 42 - &m5206_uart, 43 - }; 44 - 45 - /***************************************************************************/ 46 - 47 - static void __init m5206_uart_init_line(int line, int irq) 48 - { 49 - if (line == 0) { 50 - writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); 51 - writeb(irq, MCFUART_BASE1 + MCFUART_UIVR); 52 - mcf_mapirq2imr(irq, MCFINTC_UART0); 53 - } else if (line == 1) { 54 - writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); 55 - writeb(irq, MCFUART_BASE2 + MCFUART_UIVR); 56 - mcf_mapirq2imr(irq, MCFINTC_UART1); 57 - } 58 - } 59 - 60 - static void __init m5206_uarts_init(void) 61 - { 62 - const int nrlines = ARRAY_SIZE(m5206_uart_platform); 63 - int line; 64 - 65 - for (line = 0; (line < nrlines); line++) 66 - m5206_uart_init_line(line, m5206_uart_platform[line].irq); 67 - } 68 - 69 - /***************************************************************************/ 70 - 71 - static void __init m5206_timers_init(void) 72 - { 73 - /* Timer1 is always used as system timer */ 74 - writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3, 75 - MCF_MBAR + MCFSIM_TIMER1ICR); 76 - mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1); 77 - 78 - #ifdef CONFIG_HIGHPROFILE 79 - /* Timer2 is to be used as a high speed profile timer */ 80 - writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3, 81 - MCF_MBAR + MCFSIM_TIMER2ICR); 82 - mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2); 83 - #endif 84 - } 85 - 86 - /***************************************************************************/ 87 - 88 - void m5206_cpu_reset(void) 89 - { 90 - local_irq_disable(); 91 - /* Set watchdog to soft reset, and enabled */ 92 - __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR); 93 - for (;;) 94 - /* wait for watchdog to timeout */; 95 - } 96 19 97 20 /***************************************************************************/ 98 21 ··· 27 104 commandp[size-1] = 0; 28 105 #endif /* CONFIG_NETtel */ 29 106 30 - mach_reset = m5206_cpu_reset; 31 - m5206_timers_init(); 32 - m5206_uarts_init(); 107 + mach_sched_init = hw_timer_init; 33 108 34 109 /* Only support the external interrupts on their primary level */ 35 110 mcf_mapirq2imr(25, MCFINTC_EINT1); 36 111 mcf_mapirq2imr(28, MCFINTC_EINT4); 37 112 mcf_mapirq2imr(31, MCFINTC_EINT7); 38 113 } 39 - 40 - /***************************************************************************/ 41 - 42 - static int __init init_BSP(void) 43 - { 44 - platform_add_devices(m5206_devices, ARRAY_SIZE(m5206_devices)); 45 - return 0; 46 - } 47 - 48 - arch_initcall(init_BSP); 49 114 50 115 /***************************************************************************/
+16 -240
arch/m68k/platform/520x/config.c
··· 15 15 #include <linux/param.h> 16 16 #include <linux/init.h> 17 17 #include <linux/io.h> 18 - #include <linux/spi/spi.h> 19 - #include <linux/gpio.h> 20 18 #include <asm/machdep.h> 21 19 #include <asm/coldfire.h> 22 20 #include <asm/mcfsim.h> 23 21 #include <asm/mcfuart.h> 24 - #include <asm/mcfqspi.h> 25 22 26 23 /***************************************************************************/ 27 24 28 - static struct mcf_platform_uart m520x_uart_platform[] = { 29 - { 30 - .mapbase = MCFUART_BASE1, 31 - .irq = MCFINT_VECBASE + MCFINT_UART0, 32 - }, 33 - { 34 - .mapbase = MCFUART_BASE2, 35 - .irq = MCFINT_VECBASE + MCFINT_UART1, 36 - }, 37 - { 38 - .mapbase = MCFUART_BASE3, 39 - .irq = MCFINT_VECBASE + MCFINT_UART2, 40 - }, 41 - { }, 42 - }; 43 - 44 - static struct platform_device m520x_uart = { 45 - .name = "mcfuart", 46 - .id = 0, 47 - .dev.platform_data = m520x_uart_platform, 48 - }; 49 - 50 - static struct resource m520x_fec_resources[] = { 51 - { 52 - .start = MCFFEC_BASE, 53 - .end = MCFFEC_BASE + MCFFEC_SIZE - 1, 54 - .flags = IORESOURCE_MEM, 55 - }, 56 - { 57 - .start = 64 + 36, 58 - .end = 64 + 36, 59 - .flags = IORESOURCE_IRQ, 60 - }, 61 - { 62 - .start = 64 + 40, 63 - .end = 64 + 40, 64 - .flags = IORESOURCE_IRQ, 65 - }, 66 - { 67 - .start = 64 + 42, 68 - .end = 64 + 42, 69 - .flags = IORESOURCE_IRQ, 70 - }, 71 - }; 72 - 73 - static struct platform_device m520x_fec = { 74 - .name = "fec", 75 - .id = 0, 76 - .num_resources = ARRAY_SIZE(m520x_fec_resources), 77 - .resource = m520x_fec_resources, 78 - }; 79 - 80 - #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 81 - static struct resource m520x_qspi_resources[] = { 82 - { 83 - .start = MCFQSPI_IOBASE, 84 - .end = MCFQSPI_IOBASE + MCFQSPI_IOSIZE - 1, 85 - .flags = IORESOURCE_MEM, 86 - }, 87 - { 88 - .start = MCFINT_VECBASE + MCFINT_QSPI, 89 - .end = MCFINT_VECBASE + MCFINT_QSPI, 90 - .flags = IORESOURCE_IRQ, 91 - }, 92 - }; 93 - 94 - #define MCFQSPI_CS0 46 95 - #define MCFQSPI_CS1 47 96 - #define MCFQSPI_CS2 27 97 - 98 - static int m520x_cs_setup(struct mcfqspi_cs_control *cs_control) 99 - { 100 - int status; 101 - 102 - status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0"); 103 - if (status) { 104 - pr_debug("gpio_request for MCFQSPI_CS0 failed\n"); 105 - goto fail0; 106 - } 107 - status = gpio_direction_output(MCFQSPI_CS0, 1); 108 - if (status) { 109 - pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n"); 110 - goto fail1; 111 - } 112 - 113 - status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1"); 114 - if (status) { 115 - pr_debug("gpio_request for MCFQSPI_CS1 failed\n"); 116 - goto fail1; 117 - } 118 - status = gpio_direction_output(MCFQSPI_CS1, 1); 119 - if (status) { 120 - pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n"); 121 - goto fail2; 122 - } 123 - 124 - status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2"); 125 - if (status) { 126 - pr_debug("gpio_request for MCFQSPI_CS2 failed\n"); 127 - goto fail2; 128 - } 129 - status = gpio_direction_output(MCFQSPI_CS2, 1); 130 - if (status) { 131 - pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n"); 132 - goto fail3; 133 - } 134 - 135 - return 0; 136 - 137 - fail3: 138 - gpio_free(MCFQSPI_CS2); 139 - fail2: 140 - gpio_free(MCFQSPI_CS1); 141 - fail1: 142 - gpio_free(MCFQSPI_CS0); 143 - fail0: 144 - return status; 145 - } 146 - 147 - static void m520x_cs_teardown(struct mcfqspi_cs_control *cs_control) 148 - { 149 - gpio_free(MCFQSPI_CS2); 150 - gpio_free(MCFQSPI_CS1); 151 - gpio_free(MCFQSPI_CS0); 152 - } 153 - 154 - static void m520x_cs_select(struct mcfqspi_cs_control *cs_control, 155 - u8 chip_select, bool cs_high) 156 - { 157 - switch (chip_select) { 158 - case 0: 159 - gpio_set_value(MCFQSPI_CS0, cs_high); 160 - break; 161 - case 1: 162 - gpio_set_value(MCFQSPI_CS1, cs_high); 163 - break; 164 - case 2: 165 - gpio_set_value(MCFQSPI_CS2, cs_high); 166 - break; 167 - } 168 - } 169 - 170 - static void m520x_cs_deselect(struct mcfqspi_cs_control *cs_control, 171 - u8 chip_select, bool cs_high) 172 - { 173 - switch (chip_select) { 174 - case 0: 175 - gpio_set_value(MCFQSPI_CS0, !cs_high); 176 - break; 177 - case 1: 178 - gpio_set_value(MCFQSPI_CS1, !cs_high); 179 - break; 180 - case 2: 181 - gpio_set_value(MCFQSPI_CS2, !cs_high); 182 - break; 183 - } 184 - } 185 - 186 - static struct mcfqspi_cs_control m520x_cs_control = { 187 - .setup = m520x_cs_setup, 188 - .teardown = m520x_cs_teardown, 189 - .select = m520x_cs_select, 190 - .deselect = m520x_cs_deselect, 191 - }; 192 - 193 - static struct mcfqspi_platform_data m520x_qspi_data = { 194 - .bus_num = 0, 195 - .num_chipselect = 3, 196 - .cs_control = &m520x_cs_control, 197 - }; 198 - 199 - static struct platform_device m520x_qspi = { 200 - .name = "mcfqspi", 201 - .id = 0, 202 - .num_resources = ARRAY_SIZE(m520x_qspi_resources), 203 - .resource = m520x_qspi_resources, 204 - .dev.platform_data = &m520x_qspi_data, 205 - }; 25 + #ifdef CONFIG_SPI_COLDFIRE_QSPI 206 26 207 27 static void __init m520x_qspi_init(void) 208 28 { ··· 34 214 par &= 0x00ff; 35 215 writew(par, MCF_GPIO_PAR_UART); 36 216 } 37 - #endif /* defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) */ 38 217 39 - 40 - static struct platform_device *m520x_devices[] __initdata = { 41 - &m520x_uart, 42 - &m520x_fec, 43 - #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 44 - &m520x_qspi, 45 - #endif 46 - }; 218 + #endif /* CONFIG_SPI_COLDFIRE_QSPI */ 47 219 48 220 /***************************************************************************/ 49 221 50 - static void __init m520x_uart_init_line(int line, int irq) 222 + static void __init m520x_uarts_init(void) 51 223 { 52 224 u16 par; 53 225 u8 par2; 54 226 55 - switch (line) { 56 - case 0: 57 - par = readw(MCF_GPIO_PAR_UART); 58 - par |= MCF_GPIO_PAR_UART_PAR_UTXD0 | 59 - MCF_GPIO_PAR_UART_PAR_URXD0; 60 - writew(par, MCF_GPIO_PAR_UART); 61 - break; 62 - case 1: 63 - par = readw(MCF_GPIO_PAR_UART); 64 - par |= MCF_GPIO_PAR_UART_PAR_UTXD1 | 65 - MCF_GPIO_PAR_UART_PAR_URXD1; 66 - writew(par, MCF_GPIO_PAR_UART); 67 - break; 68 - case 2: 69 - par2 = readb(MCF_GPIO_PAR_FECI2C); 70 - par2 &= ~0x0F; 71 - par2 |= MCF_GPIO_PAR_FECI2C_PAR_SCL_UTXD2 | 72 - MCF_GPIO_PAR_FECI2C_PAR_SDA_URXD2; 73 - writeb(par2, MCF_GPIO_PAR_FECI2C); 74 - break; 75 - } 76 - } 227 + /* UART0 and UART1 GPIO pin setup */ 228 + par = readw(MCF_GPIO_PAR_UART); 229 + par |= MCF_GPIO_PAR_UART_PAR_UTXD0 | MCF_GPIO_PAR_UART_PAR_URXD0; 230 + par |= MCF_GPIO_PAR_UART_PAR_UTXD1 | MCF_GPIO_PAR_UART_PAR_URXD1; 231 + writew(par, MCF_GPIO_PAR_UART); 77 232 78 - static void __init m520x_uarts_init(void) 79 - { 80 - const int nrlines = ARRAY_SIZE(m520x_uart_platform); 81 - int line; 82 - 83 - for (line = 0; (line < nrlines); line++) 84 - m520x_uart_init_line(line, m520x_uart_platform[line].irq); 233 + /* UART1 GPIO pin setup */ 234 + par2 = readb(MCF_GPIO_PAR_FECI2C); 235 + par2 &= ~0x0F; 236 + par2 |= MCF_GPIO_PAR_FECI2C_PAR_SCL_UTXD2 | 237 + MCF_GPIO_PAR_FECI2C_PAR_SDA_URXD2; 238 + writeb(par2, MCF_GPIO_PAR_FECI2C); 85 239 } 86 240 87 241 /***************************************************************************/ ··· 74 280 75 281 /***************************************************************************/ 76 282 77 - static void m520x_cpu_reset(void) 78 - { 79 - local_irq_disable(); 80 - __raw_writeb(MCF_RCR_SWRESET, MCF_RCR); 81 - } 82 - 83 - /***************************************************************************/ 84 - 85 283 void __init config_BSP(char *commandp, int size) 86 284 { 87 - mach_reset = m520x_cpu_reset; 285 + mach_sched_init = hw_timer_init; 88 286 m520x_uarts_init(); 89 287 m520x_fec_init(); 90 - #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 288 + #ifdef CONFIG_SPI_COLDFIRE_QSPI 91 289 m520x_qspi_init(); 92 290 #endif 93 291 } 94 - 95 - /***************************************************************************/ 96 - 97 - static int __init init_BSP(void) 98 - { 99 - platform_add_devices(m520x_devices, ARRAY_SIZE(m520x_devices)); 100 - return 0; 101 - } 102 - 103 - arch_initcall(init_BSP); 104 292 105 293 /***************************************************************************/
+4 -231
arch/m68k/platform/523x/config.c
··· 16 16 #include <linux/param.h> 17 17 #include <linux/init.h> 18 18 #include <linux/io.h> 19 - #include <linux/spi/spi.h> 20 - #include <linux/gpio.h> 21 19 #include <asm/machdep.h> 22 20 #include <asm/coldfire.h> 23 21 #include <asm/mcfsim.h> 24 - #include <asm/mcfuart.h> 25 - #include <asm/mcfqspi.h> 26 22 27 23 /***************************************************************************/ 28 24 29 - static struct mcf_platform_uart m523x_uart_platform[] = { 30 - { 31 - .mapbase = MCFUART_BASE1, 32 - .irq = MCFINT_VECBASE + MCFINT_UART0, 33 - }, 34 - { 35 - .mapbase = MCFUART_BASE2, 36 - .irq = MCFINT_VECBASE + MCFINT_UART0 + 1, 37 - }, 38 - { 39 - .mapbase = MCFUART_BASE3, 40 - .irq = MCFINT_VECBASE + MCFINT_UART0 + 2, 41 - }, 42 - { }, 43 - }; 44 - 45 - static struct platform_device m523x_uart = { 46 - .name = "mcfuart", 47 - .id = 0, 48 - .dev.platform_data = m523x_uart_platform, 49 - }; 50 - 51 - static struct resource m523x_fec_resources[] = { 52 - { 53 - .start = MCFFEC_BASE, 54 - .end = MCFFEC_BASE + MCFFEC_SIZE - 1, 55 - .flags = IORESOURCE_MEM, 56 - }, 57 - { 58 - .start = 64 + 23, 59 - .end = 64 + 23, 60 - .flags = IORESOURCE_IRQ, 61 - }, 62 - { 63 - .start = 64 + 27, 64 - .end = 64 + 27, 65 - .flags = IORESOURCE_IRQ, 66 - }, 67 - { 68 - .start = 64 + 29, 69 - .end = 64 + 29, 70 - .flags = IORESOURCE_IRQ, 71 - }, 72 - }; 73 - 74 - static struct platform_device m523x_fec = { 75 - .name = "fec", 76 - .id = 0, 77 - .num_resources = ARRAY_SIZE(m523x_fec_resources), 78 - .resource = m523x_fec_resources, 79 - }; 80 - 81 - #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 82 - static struct resource m523x_qspi_resources[] = { 83 - { 84 - .start = MCFQSPI_IOBASE, 85 - .end = MCFQSPI_IOBASE + MCFQSPI_IOSIZE - 1, 86 - .flags = IORESOURCE_MEM, 87 - }, 88 - { 89 - .start = MCFINT_VECBASE + MCFINT_QSPI, 90 - .end = MCFINT_VECBASE + MCFINT_QSPI, 91 - .flags = IORESOURCE_IRQ, 92 - }, 93 - }; 94 - 95 - #define MCFQSPI_CS0 91 96 - #define MCFQSPI_CS1 92 97 - #define MCFQSPI_CS2 103 98 - #define MCFQSPI_CS3 99 99 - 100 - static int m523x_cs_setup(struct mcfqspi_cs_control *cs_control) 101 - { 102 - int status; 103 - 104 - status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0"); 105 - if (status) { 106 - pr_debug("gpio_request for MCFQSPI_CS0 failed\n"); 107 - goto fail0; 108 - } 109 - status = gpio_direction_output(MCFQSPI_CS0, 1); 110 - if (status) { 111 - pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n"); 112 - goto fail1; 113 - } 114 - 115 - status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1"); 116 - if (status) { 117 - pr_debug("gpio_request for MCFQSPI_CS1 failed\n"); 118 - goto fail1; 119 - } 120 - status = gpio_direction_output(MCFQSPI_CS1, 1); 121 - if (status) { 122 - pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n"); 123 - goto fail2; 124 - } 125 - 126 - status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2"); 127 - if (status) { 128 - pr_debug("gpio_request for MCFQSPI_CS2 failed\n"); 129 - goto fail2; 130 - } 131 - status = gpio_direction_output(MCFQSPI_CS2, 1); 132 - if (status) { 133 - pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n"); 134 - goto fail3; 135 - } 136 - 137 - status = gpio_request(MCFQSPI_CS3, "MCFQSPI_CS3"); 138 - if (status) { 139 - pr_debug("gpio_request for MCFQSPI_CS3 failed\n"); 140 - goto fail3; 141 - } 142 - status = gpio_direction_output(MCFQSPI_CS3, 1); 143 - if (status) { 144 - pr_debug("gpio_direction_output for MCFQSPI_CS3 failed\n"); 145 - goto fail4; 146 - } 147 - 148 - return 0; 149 - 150 - fail4: 151 - gpio_free(MCFQSPI_CS3); 152 - fail3: 153 - gpio_free(MCFQSPI_CS2); 154 - fail2: 155 - gpio_free(MCFQSPI_CS1); 156 - fail1: 157 - gpio_free(MCFQSPI_CS0); 158 - fail0: 159 - return status; 160 - } 161 - 162 - static void m523x_cs_teardown(struct mcfqspi_cs_control *cs_control) 163 - { 164 - gpio_free(MCFQSPI_CS3); 165 - gpio_free(MCFQSPI_CS2); 166 - gpio_free(MCFQSPI_CS1); 167 - gpio_free(MCFQSPI_CS0); 168 - } 169 - 170 - static void m523x_cs_select(struct mcfqspi_cs_control *cs_control, 171 - u8 chip_select, bool cs_high) 172 - { 173 - switch (chip_select) { 174 - case 0: 175 - gpio_set_value(MCFQSPI_CS0, cs_high); 176 - break; 177 - case 1: 178 - gpio_set_value(MCFQSPI_CS1, cs_high); 179 - break; 180 - case 2: 181 - gpio_set_value(MCFQSPI_CS2, cs_high); 182 - break; 183 - case 3: 184 - gpio_set_value(MCFQSPI_CS3, cs_high); 185 - break; 186 - } 187 - } 188 - 189 - static void m523x_cs_deselect(struct mcfqspi_cs_control *cs_control, 190 - u8 chip_select, bool cs_high) 191 - { 192 - switch (chip_select) { 193 - case 0: 194 - gpio_set_value(MCFQSPI_CS0, !cs_high); 195 - break; 196 - case 1: 197 - gpio_set_value(MCFQSPI_CS1, !cs_high); 198 - break; 199 - case 2: 200 - gpio_set_value(MCFQSPI_CS2, !cs_high); 201 - break; 202 - case 3: 203 - gpio_set_value(MCFQSPI_CS3, !cs_high); 204 - break; 205 - } 206 - } 207 - 208 - static struct mcfqspi_cs_control m523x_cs_control = { 209 - .setup = m523x_cs_setup, 210 - .teardown = m523x_cs_teardown, 211 - .select = m523x_cs_select, 212 - .deselect = m523x_cs_deselect, 213 - }; 214 - 215 - static struct mcfqspi_platform_data m523x_qspi_data = { 216 - .bus_num = 0, 217 - .num_chipselect = 4, 218 - .cs_control = &m523x_cs_control, 219 - }; 220 - 221 - static struct platform_device m523x_qspi = { 222 - .name = "mcfqspi", 223 - .id = 0, 224 - .num_resources = ARRAY_SIZE(m523x_qspi_resources), 225 - .resource = m523x_qspi_resources, 226 - .dev.platform_data = &m523x_qspi_data, 227 - }; 25 + #ifdef CONFIG_SPI_COLDFIRE_QSPI 228 26 229 27 static void __init m523x_qspi_init(void) 230 28 { ··· 35 237 par &= 0x3f3f; 36 238 writew(par, MCFGPIO_PAR_TIMER); 37 239 } 38 - #endif /* defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) */ 39 240 40 - static struct platform_device *m523x_devices[] __initdata = { 41 - &m523x_uart, 42 - &m523x_fec, 43 - #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 44 - &m523x_qspi, 45 - #endif 46 - }; 241 + #endif /* CONFIG_SPI_COLDFIRE_QSPI */ 47 242 48 243 /***************************************************************************/ 49 244 ··· 54 263 55 264 /***************************************************************************/ 56 265 57 - static void m523x_cpu_reset(void) 58 - { 59 - local_irq_disable(); 60 - __raw_writeb(MCF_RCR_SWRESET, MCF_IPSBAR + MCF_RCR); 61 - } 62 - 63 - /***************************************************************************/ 64 - 65 266 void __init config_BSP(char *commandp, int size) 66 267 { 67 - mach_reset = m523x_cpu_reset; 68 - } 69 - 70 - /***************************************************************************/ 71 - 72 - static int __init init_BSP(void) 73 - { 268 + mach_sched_init = hw_timer_init; 74 269 m523x_fec_init(); 75 - #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 270 + #ifdef CONFIG_SPI_COLDFIRE_QSPI 76 271 m523x_qspi_init(); 77 272 #endif 78 - platform_add_devices(m523x_devices, ARRAY_SIZE(m523x_devices)); 79 - return 0; 80 273 } 81 - 82 - arch_initcall(init_BSP); 83 274 84 275 /***************************************************************************/
+11 -233
arch/m68k/platform/5249/config.c
··· 12 12 #include <linux/param.h> 13 13 #include <linux/init.h> 14 14 #include <linux/io.h> 15 - #include <linux/spi/spi.h> 16 - #include <linux/gpio.h> 15 + #include <linux/platform_device.h> 17 16 #include <asm/machdep.h> 18 17 #include <asm/coldfire.h> 19 18 #include <asm/mcfsim.h> 20 - #include <asm/mcfuart.h> 21 - #include <asm/mcfqspi.h> 22 19 23 20 /***************************************************************************/ 24 - 25 - static struct mcf_platform_uart m5249_uart_platform[] = { 26 - { 27 - .mapbase = MCF_MBAR + MCFUART_BASE1, 28 - .irq = 73, 29 - }, 30 - { 31 - .mapbase = MCF_MBAR + MCFUART_BASE2, 32 - .irq = 74, 33 - }, 34 - { }, 35 - }; 36 - 37 - static struct platform_device m5249_uart = { 38 - .name = "mcfuart", 39 - .id = 0, 40 - .dev.platform_data = m5249_uart_platform, 41 - }; 42 21 43 22 #ifdef CONFIG_M5249C3 44 23 ··· 43 64 44 65 #endif /* CONFIG_M5249C3 */ 45 66 46 - #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 47 - static struct resource m5249_qspi_resources[] = { 48 - { 49 - .start = MCFQSPI_IOBASE, 50 - .end = MCFQSPI_IOBASE + MCFQSPI_IOSIZE - 1, 51 - .flags = IORESOURCE_MEM, 52 - }, 53 - { 54 - .start = MCF_IRQ_QSPI, 55 - .end = MCF_IRQ_QSPI, 56 - .flags = IORESOURCE_IRQ, 57 - }, 67 + static struct platform_device *m5249_devices[] __initdata = { 68 + #ifdef CONFIG_M5249C3 69 + &m5249_smc91x, 70 + #endif 58 71 }; 59 72 60 - #define MCFQSPI_CS0 29 61 - #define MCFQSPI_CS1 24 62 - #define MCFQSPI_CS2 21 63 - #define MCFQSPI_CS3 22 73 + /***************************************************************************/ 64 74 65 - static int m5249_cs_setup(struct mcfqspi_cs_control *cs_control) 66 - { 67 - int status; 68 - 69 - status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0"); 70 - if (status) { 71 - pr_debug("gpio_request for MCFQSPI_CS0 failed\n"); 72 - goto fail0; 73 - } 74 - status = gpio_direction_output(MCFQSPI_CS0, 1); 75 - if (status) { 76 - pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n"); 77 - goto fail1; 78 - } 79 - 80 - status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1"); 81 - if (status) { 82 - pr_debug("gpio_request for MCFQSPI_CS1 failed\n"); 83 - goto fail1; 84 - } 85 - status = gpio_direction_output(MCFQSPI_CS1, 1); 86 - if (status) { 87 - pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n"); 88 - goto fail2; 89 - } 90 - 91 - status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2"); 92 - if (status) { 93 - pr_debug("gpio_request for MCFQSPI_CS2 failed\n"); 94 - goto fail2; 95 - } 96 - status = gpio_direction_output(MCFQSPI_CS2, 1); 97 - if (status) { 98 - pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n"); 99 - goto fail3; 100 - } 101 - 102 - status = gpio_request(MCFQSPI_CS3, "MCFQSPI_CS3"); 103 - if (status) { 104 - pr_debug("gpio_request for MCFQSPI_CS3 failed\n"); 105 - goto fail3; 106 - } 107 - status = gpio_direction_output(MCFQSPI_CS3, 1); 108 - if (status) { 109 - pr_debug("gpio_direction_output for MCFQSPI_CS3 failed\n"); 110 - goto fail4; 111 - } 112 - 113 - return 0; 114 - 115 - fail4: 116 - gpio_free(MCFQSPI_CS3); 117 - fail3: 118 - gpio_free(MCFQSPI_CS2); 119 - fail2: 120 - gpio_free(MCFQSPI_CS1); 121 - fail1: 122 - gpio_free(MCFQSPI_CS0); 123 - fail0: 124 - return status; 125 - } 126 - 127 - static void m5249_cs_teardown(struct mcfqspi_cs_control *cs_control) 128 - { 129 - gpio_free(MCFQSPI_CS3); 130 - gpio_free(MCFQSPI_CS2); 131 - gpio_free(MCFQSPI_CS1); 132 - gpio_free(MCFQSPI_CS0); 133 - } 134 - 135 - static void m5249_cs_select(struct mcfqspi_cs_control *cs_control, 136 - u8 chip_select, bool cs_high) 137 - { 138 - switch (chip_select) { 139 - case 0: 140 - gpio_set_value(MCFQSPI_CS0, cs_high); 141 - break; 142 - case 1: 143 - gpio_set_value(MCFQSPI_CS1, cs_high); 144 - break; 145 - case 2: 146 - gpio_set_value(MCFQSPI_CS2, cs_high); 147 - break; 148 - case 3: 149 - gpio_set_value(MCFQSPI_CS3, cs_high); 150 - break; 151 - } 152 - } 153 - 154 - static void m5249_cs_deselect(struct mcfqspi_cs_control *cs_control, 155 - u8 chip_select, bool cs_high) 156 - { 157 - switch (chip_select) { 158 - case 0: 159 - gpio_set_value(MCFQSPI_CS0, !cs_high); 160 - break; 161 - case 1: 162 - gpio_set_value(MCFQSPI_CS1, !cs_high); 163 - break; 164 - case 2: 165 - gpio_set_value(MCFQSPI_CS2, !cs_high); 166 - break; 167 - case 3: 168 - gpio_set_value(MCFQSPI_CS3, !cs_high); 169 - break; 170 - } 171 - } 172 - 173 - static struct mcfqspi_cs_control m5249_cs_control = { 174 - .setup = m5249_cs_setup, 175 - .teardown = m5249_cs_teardown, 176 - .select = m5249_cs_select, 177 - .deselect = m5249_cs_deselect, 178 - }; 179 - 180 - static struct mcfqspi_platform_data m5249_qspi_data = { 181 - .bus_num = 0, 182 - .num_chipselect = 4, 183 - .cs_control = &m5249_cs_control, 184 - }; 185 - 186 - static struct platform_device m5249_qspi = { 187 - .name = "mcfqspi", 188 - .id = 0, 189 - .num_resources = ARRAY_SIZE(m5249_qspi_resources), 190 - .resource = m5249_qspi_resources, 191 - .dev.platform_data = &m5249_qspi_data, 192 - }; 75 + #ifdef CONFIG_SPI_COLDFIRE_QSPI 193 76 194 77 static void __init m5249_qspi_init(void) 195 78 { ··· 60 219 MCF_MBAR + MCFSIM_QSPIICR); 61 220 mcf_mapirq2imr(MCF_IRQ_QSPI, MCFINTC_QSPI); 62 221 } 63 - #endif /* defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) */ 64 222 65 - 66 - static struct platform_device *m5249_devices[] __initdata = { 67 - &m5249_uart, 68 - #ifdef CONFIG_M5249C3 69 - &m5249_smc91x, 70 - #endif 71 - #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 72 - &m5249_qspi, 73 - #endif 74 - }; 75 - 76 - /***************************************************************************/ 77 - 78 - static void __init m5249_uart_init_line(int line, int irq) 79 - { 80 - if (line == 0) { 81 - writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); 82 - writeb(irq, MCF_MBAR + MCFUART_BASE1 + MCFUART_UIVR); 83 - mcf_mapirq2imr(irq, MCFINTC_UART0); 84 - } else if (line == 1) { 85 - writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); 86 - writeb(irq, MCF_MBAR + MCFUART_BASE2 + MCFUART_UIVR); 87 - mcf_mapirq2imr(irq, MCFINTC_UART1); 88 - } 89 - } 90 - 91 - static void __init m5249_uarts_init(void) 92 - { 93 - const int nrlines = ARRAY_SIZE(m5249_uart_platform); 94 - int line; 95 - 96 - for (line = 0; (line < nrlines); line++) 97 - m5249_uart_init_line(line, m5249_uart_platform[line].irq); 98 - } 223 + #endif /* CONFIG_SPI_COLDFIRE_QSPI */ 99 224 100 225 /***************************************************************************/ 101 226 ··· 83 276 84 277 /***************************************************************************/ 85 278 86 - static void __init m5249_timers_init(void) 87 - { 88 - /* Timer1 is always used as system timer */ 89 - writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3, 90 - MCF_MBAR + MCFSIM_TIMER1ICR); 91 - mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1); 92 - 93 - #ifdef CONFIG_HIGHPROFILE 94 - /* Timer2 is to be used as a high speed profile timer */ 95 - writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3, 96 - MCF_MBAR + MCFSIM_TIMER2ICR); 97 - mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2); 98 - #endif 99 - } 100 - 101 - /***************************************************************************/ 102 - 103 - void m5249_cpu_reset(void) 104 - { 105 - local_irq_disable(); 106 - /* Set watchdog to soft reset, and enabled */ 107 - __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR); 108 - for (;;) 109 - /* wait for watchdog to timeout */; 110 - } 111 - 112 - /***************************************************************************/ 113 - 114 279 void __init config_BSP(char *commandp, int size) 115 280 { 116 - mach_reset = m5249_cpu_reset; 117 - m5249_timers_init(); 118 - m5249_uarts_init(); 281 + mach_sched_init = hw_timer_init; 282 + 119 283 #ifdef CONFIG_M5249C3 120 284 m5249_smc91x_init(); 121 285 #endif 122 - #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 286 + #ifdef CONFIG_SPI_COLDFIRE_QSPI 123 287 m5249_qspi_init(); 124 288 #endif 125 289 }
+9 -75
arch/m68k/platform/5272/config.c
··· 30 30 31 31 /***************************************************************************/ 32 32 33 - static struct mcf_platform_uart m5272_uart_platform[] = { 34 - { 35 - .mapbase = MCF_MBAR + MCFUART_BASE1, 36 - .irq = MCF_IRQ_UART1, 37 - }, 38 - { 39 - .mapbase = MCF_MBAR + MCFUART_BASE2, 40 - .irq = MCF_IRQ_UART2, 41 - }, 42 - { }, 43 - }; 44 - 45 - static struct platform_device m5272_uart = { 46 - .name = "mcfuart", 47 - .id = 0, 48 - .dev.platform_data = m5272_uart_platform, 49 - }; 50 - 51 - static struct resource m5272_fec_resources[] = { 52 - { 53 - .start = MCF_MBAR + 0x840, 54 - .end = MCF_MBAR + 0x840 + 0x1cf, 55 - .flags = IORESOURCE_MEM, 56 - }, 57 - { 58 - .start = MCF_IRQ_ERX, 59 - .end = MCF_IRQ_ERX, 60 - .flags = IORESOURCE_IRQ, 61 - }, 62 - { 63 - .start = MCF_IRQ_ETX, 64 - .end = MCF_IRQ_ETX, 65 - .flags = IORESOURCE_IRQ, 66 - }, 67 - { 68 - .start = MCF_IRQ_ENTC, 69 - .end = MCF_IRQ_ENTC, 70 - .flags = IORESOURCE_IRQ, 71 - }, 72 - }; 73 - 74 - static struct platform_device m5272_fec = { 75 - .name = "fec", 76 - .id = 0, 77 - .num_resources = ARRAY_SIZE(m5272_fec_resources), 78 - .resource = m5272_fec_resources, 79 - }; 80 - 81 - static struct platform_device *m5272_devices[] __initdata = { 82 - &m5272_uart, 83 - &m5272_fec, 84 - }; 85 - 86 - /***************************************************************************/ 87 - 88 - static void __init m5272_uart_init_line(int line, int irq) 33 + static void __init m5272_uarts_init(void) 89 34 { 90 35 u32 v; 91 36 92 - if ((line >= 0) && (line < 2)) { 93 - /* Enable the output lines for the serial ports */ 94 - v = readl(MCF_MBAR + MCFSIM_PBCNT); 95 - v = (v & ~0x000000ff) | 0x00000055; 96 - writel(v, MCF_MBAR + MCFSIM_PBCNT); 37 + /* Enable the output lines for the serial ports */ 38 + v = readl(MCF_MBAR + MCFSIM_PBCNT); 39 + v = (v & ~0x000000ff) | 0x00000055; 40 + writel(v, MCF_MBAR + MCFSIM_PBCNT); 97 41 98 - v = readl(MCF_MBAR + MCFSIM_PDCNT); 99 - v = (v & ~0x000003fc) | 0x000002a8; 100 - writel(v, MCF_MBAR + MCFSIM_PDCNT); 101 - } 102 - } 103 - 104 - static void __init m5272_uarts_init(void) 105 - { 106 - const int nrlines = ARRAY_SIZE(m5272_uart_platform); 107 - int line; 108 - 109 - for (line = 0; (line < nrlines); line++) 110 - m5272_uart_init_line(line, m5272_uart_platform[line].irq); 42 + v = readl(MCF_MBAR + MCFSIM_PDCNT); 43 + v = (v & ~0x000003fc) | 0x000002a8; 44 + writel(v, MCF_MBAR + MCFSIM_PDCNT); 111 45 } 112 46 113 47 /***************************************************************************/ ··· 80 146 #endif 81 147 82 148 mach_reset = m5272_cpu_reset; 149 + mach_sched_init = hw_timer_init; 83 150 } 84 151 85 152 /***************************************************************************/ ··· 102 167 { 103 168 m5272_uarts_init(); 104 169 fixed_phy_add(PHY_POLL, 0, &nettel_fixed_phy_status); 105 - platform_add_devices(m5272_devices, ARRAY_SIZE(m5272_devices)); 106 170 return 0; 107 171 } 108 172
+6 -290
arch/m68k/platform/527x/config.c
··· 16 16 #include <linux/param.h> 17 17 #include <linux/init.h> 18 18 #include <linux/io.h> 19 - #include <linux/spi/spi.h> 20 - #include <linux/gpio.h> 21 19 #include <asm/machdep.h> 22 20 #include <asm/coldfire.h> 23 21 #include <asm/mcfsim.h> 24 22 #include <asm/mcfuart.h> 25 - #include <asm/mcfqspi.h> 26 23 27 24 /***************************************************************************/ 28 25 29 - static struct mcf_platform_uart m527x_uart_platform[] = { 30 - { 31 - .mapbase = MCFUART_BASE1, 32 - .irq = MCFINT_VECBASE + MCFINT_UART0, 33 - }, 34 - { 35 - .mapbase = MCFUART_BASE2, 36 - .irq = MCFINT_VECBASE + MCFINT_UART1, 37 - }, 38 - { 39 - .mapbase = MCFUART_BASE3, 40 - .irq = MCFINT_VECBASE + MCFINT_UART2, 41 - }, 42 - { }, 43 - }; 44 - 45 - static struct platform_device m527x_uart = { 46 - .name = "mcfuart", 47 - .id = 0, 48 - .dev.platform_data = m527x_uart_platform, 49 - }; 50 - 51 - static struct resource m527x_fec0_resources[] = { 52 - { 53 - .start = MCFFEC_BASE0, 54 - .end = MCFFEC_BASE0 + MCFFEC_SIZE0 - 1, 55 - .flags = IORESOURCE_MEM, 56 - }, 57 - { 58 - .start = 64 + 23, 59 - .end = 64 + 23, 60 - .flags = IORESOURCE_IRQ, 61 - }, 62 - { 63 - .start = 64 + 27, 64 - .end = 64 + 27, 65 - .flags = IORESOURCE_IRQ, 66 - }, 67 - { 68 - .start = 64 + 29, 69 - .end = 64 + 29, 70 - .flags = IORESOURCE_IRQ, 71 - }, 72 - }; 73 - 74 - static struct resource m527x_fec1_resources[] = { 75 - { 76 - .start = MCFFEC_BASE1, 77 - .end = MCFFEC_BASE1 + MCFFEC_SIZE1 - 1, 78 - .flags = IORESOURCE_MEM, 79 - }, 80 - { 81 - .start = 128 + 23, 82 - .end = 128 + 23, 83 - .flags = IORESOURCE_IRQ, 84 - }, 85 - { 86 - .start = 128 + 27, 87 - .end = 128 + 27, 88 - .flags = IORESOURCE_IRQ, 89 - }, 90 - { 91 - .start = 128 + 29, 92 - .end = 128 + 29, 93 - .flags = IORESOURCE_IRQ, 94 - }, 95 - }; 96 - 97 - static struct platform_device m527x_fec[] = { 98 - { 99 - .name = "fec", 100 - .id = 0, 101 - .num_resources = ARRAY_SIZE(m527x_fec0_resources), 102 - .resource = m527x_fec0_resources, 103 - }, 104 - { 105 - .name = "fec", 106 - .id = 1, 107 - .num_resources = ARRAY_SIZE(m527x_fec1_resources), 108 - .resource = m527x_fec1_resources, 109 - }, 110 - }; 111 - 112 - #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 113 - static struct resource m527x_qspi_resources[] = { 114 - { 115 - .start = MCFQSPI_IOBASE, 116 - .end = MCFQSPI_IOBASE + MCFQSPI_IOSIZE - 1, 117 - .flags = IORESOURCE_MEM, 118 - }, 119 - { 120 - .start = MCFINT_VECBASE + MCFINT_QSPI, 121 - .end = MCFINT_VECBASE + MCFINT_QSPI, 122 - .flags = IORESOURCE_IRQ, 123 - }, 124 - }; 125 - 126 - #if defined(CONFIG_M5271) 127 - #define MCFQSPI_CS0 91 128 - #define MCFQSPI_CS1 92 129 - #define MCFQSPI_CS2 99 130 - #define MCFQSPI_CS3 103 131 - #elif defined(CONFIG_M5275) 132 - #define MCFQSPI_CS0 59 133 - #define MCFQSPI_CS1 60 134 - #define MCFQSPI_CS2 61 135 - #define MCFQSPI_CS3 62 136 - #endif 137 - 138 - static int m527x_cs_setup(struct mcfqspi_cs_control *cs_control) 139 - { 140 - int status; 141 - 142 - status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0"); 143 - if (status) { 144 - pr_debug("gpio_request for MCFQSPI_CS0 failed\n"); 145 - goto fail0; 146 - } 147 - status = gpio_direction_output(MCFQSPI_CS0, 1); 148 - if (status) { 149 - pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n"); 150 - goto fail1; 151 - } 152 - 153 - status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1"); 154 - if (status) { 155 - pr_debug("gpio_request for MCFQSPI_CS1 failed\n"); 156 - goto fail1; 157 - } 158 - status = gpio_direction_output(MCFQSPI_CS1, 1); 159 - if (status) { 160 - pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n"); 161 - goto fail2; 162 - } 163 - 164 - status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2"); 165 - if (status) { 166 - pr_debug("gpio_request for MCFQSPI_CS2 failed\n"); 167 - goto fail2; 168 - } 169 - status = gpio_direction_output(MCFQSPI_CS2, 1); 170 - if (status) { 171 - pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n"); 172 - goto fail3; 173 - } 174 - 175 - status = gpio_request(MCFQSPI_CS3, "MCFQSPI_CS3"); 176 - if (status) { 177 - pr_debug("gpio_request for MCFQSPI_CS3 failed\n"); 178 - goto fail3; 179 - } 180 - status = gpio_direction_output(MCFQSPI_CS3, 1); 181 - if (status) { 182 - pr_debug("gpio_direction_output for MCFQSPI_CS3 failed\n"); 183 - goto fail4; 184 - } 185 - 186 - return 0; 187 - 188 - fail4: 189 - gpio_free(MCFQSPI_CS3); 190 - fail3: 191 - gpio_free(MCFQSPI_CS2); 192 - fail2: 193 - gpio_free(MCFQSPI_CS1); 194 - fail1: 195 - gpio_free(MCFQSPI_CS0); 196 - fail0: 197 - return status; 198 - } 199 - 200 - static void m527x_cs_teardown(struct mcfqspi_cs_control *cs_control) 201 - { 202 - gpio_free(MCFQSPI_CS3); 203 - gpio_free(MCFQSPI_CS2); 204 - gpio_free(MCFQSPI_CS1); 205 - gpio_free(MCFQSPI_CS0); 206 - } 207 - 208 - static void m527x_cs_select(struct mcfqspi_cs_control *cs_control, 209 - u8 chip_select, bool cs_high) 210 - { 211 - switch (chip_select) { 212 - case 0: 213 - gpio_set_value(MCFQSPI_CS0, cs_high); 214 - break; 215 - case 1: 216 - gpio_set_value(MCFQSPI_CS1, cs_high); 217 - break; 218 - case 2: 219 - gpio_set_value(MCFQSPI_CS2, cs_high); 220 - break; 221 - case 3: 222 - gpio_set_value(MCFQSPI_CS3, cs_high); 223 - break; 224 - } 225 - } 226 - 227 - static void m527x_cs_deselect(struct mcfqspi_cs_control *cs_control, 228 - u8 chip_select, bool cs_high) 229 - { 230 - switch (chip_select) { 231 - case 0: 232 - gpio_set_value(MCFQSPI_CS0, !cs_high); 233 - break; 234 - case 1: 235 - gpio_set_value(MCFQSPI_CS1, !cs_high); 236 - break; 237 - case 2: 238 - gpio_set_value(MCFQSPI_CS2, !cs_high); 239 - break; 240 - case 3: 241 - gpio_set_value(MCFQSPI_CS3, !cs_high); 242 - break; 243 - } 244 - } 245 - 246 - static struct mcfqspi_cs_control m527x_cs_control = { 247 - .setup = m527x_cs_setup, 248 - .teardown = m527x_cs_teardown, 249 - .select = m527x_cs_select, 250 - .deselect = m527x_cs_deselect, 251 - }; 252 - 253 - static struct mcfqspi_platform_data m527x_qspi_data = { 254 - .bus_num = 0, 255 - .num_chipselect = 4, 256 - .cs_control = &m527x_cs_control, 257 - }; 258 - 259 - static struct platform_device m527x_qspi = { 260 - .name = "mcfqspi", 261 - .id = 0, 262 - .num_resources = ARRAY_SIZE(m527x_qspi_resources), 263 - .resource = m527x_qspi_resources, 264 - .dev.platform_data = &m527x_qspi_data, 265 - }; 26 + #ifdef CONFIG_SPI_COLDFIRE_QSPI 266 27 267 28 static void __init m527x_qspi_init(void) 268 29 { ··· 41 280 writew(0x003e, MCFGPIO_PAR_QSPI); 42 281 #endif 43 282 } 44 - #endif /* defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) */ 45 283 46 - static struct platform_device *m527x_devices[] __initdata = { 47 - &m527x_uart, 48 - &m527x_fec[0], 49 - #ifdef CONFIG_FEC2 50 - &m527x_fec[1], 51 - #endif 52 - #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 53 - &m527x_qspi, 54 - #endif 55 - }; 284 + #endif /* CONFIG_SPI_COLDFIRE_QSPI */ 56 285 57 286 /***************************************************************************/ 58 287 59 - static void __init m527x_uart_init_line(int line, int irq) 288 + static void __init m527x_uarts_init(void) 60 289 { 61 290 u16 sepmask; 62 - 63 - if ((line < 0) || (line > 2)) 64 - return; 65 291 66 292 /* 67 293 * External Pin Mask Setting & Enable External Pin for Interface 68 294 */ 69 295 sepmask = readw(MCF_IPSBAR + MCF_GPIO_PAR_UART); 70 - if (line == 0) 71 - sepmask |= UART0_ENABLE_MASK; 72 - else if (line == 1) 73 - sepmask |= UART1_ENABLE_MASK; 74 - else if (line == 2) 75 - sepmask |= UART2_ENABLE_MASK; 296 + sepmask |= UART0_ENABLE_MASK | UART1_ENABLE_MASK | UART2_ENABLE_MASK; 76 297 writew(sepmask, MCF_IPSBAR + MCF_GPIO_PAR_UART); 77 - } 78 - 79 - static void __init m527x_uarts_init(void) 80 - { 81 - const int nrlines = ARRAY_SIZE(m527x_uart_platform); 82 - int line; 83 - 84 - for (line = 0; (line < nrlines); line++) 85 - m527x_uart_init_line(line, m527x_uart_platform[line].irq); 86 298 } 87 299 88 300 /***************************************************************************/ ··· 87 353 88 354 /***************************************************************************/ 89 355 90 - static void m527x_cpu_reset(void) 91 - { 92 - local_irq_disable(); 93 - __raw_writeb(MCF_RCR_SWRESET, MCF_IPSBAR + MCF_RCR); 94 - } 95 - 96 - /***************************************************************************/ 97 - 98 356 void __init config_BSP(char *commandp, int size) 99 357 { 100 - mach_reset = m527x_cpu_reset; 358 + mach_sched_init = hw_timer_init; 101 359 m527x_uarts_init(); 102 360 m527x_fec_init(); 103 - #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 361 + #ifdef CONFIG_SPI_COLDFIRE_QSPI 104 362 m527x_qspi_init(); 105 363 #endif 106 364 } 107 - 108 - /***************************************************************************/ 109 - 110 - static int __init init_BSP(void) 111 - { 112 - platform_add_devices(m527x_devices, ARRAY_SIZE(m527x_devices)); 113 - return 0; 114 - } 115 - 116 - arch_initcall(init_BSP); 117 365 118 366 /***************************************************************************/
+8 -222
arch/m68k/platform/528x/config.c
··· 17 17 #include <linux/init.h> 18 18 #include <linux/platform_device.h> 19 19 #include <linux/io.h> 20 - #include <linux/spi/spi.h> 21 - #include <linux/gpio.h> 22 20 #include <asm/machdep.h> 23 21 #include <asm/coldfire.h> 24 22 #include <asm/mcfsim.h> 25 23 #include <asm/mcfuart.h> 26 - #include <asm/mcfqspi.h> 27 24 28 25 /***************************************************************************/ 29 26 30 - static struct mcf_platform_uart m528x_uart_platform[] = { 31 - { 32 - .mapbase = MCFUART_BASE1, 33 - .irq = MCFINT_VECBASE + MCFINT_UART0, 34 - }, 35 - { 36 - .mapbase = MCFUART_BASE2, 37 - .irq = MCFINT_VECBASE + MCFINT_UART0 + 1, 38 - }, 39 - { 40 - .mapbase = MCFUART_BASE3, 41 - .irq = MCFINT_VECBASE + MCFINT_UART0 + 2, 42 - }, 43 - { }, 44 - }; 45 - 46 - static struct platform_device m528x_uart = { 47 - .name = "mcfuart", 48 - .id = 0, 49 - .dev.platform_data = m528x_uart_platform, 50 - }; 51 - 52 - static struct resource m528x_fec_resources[] = { 53 - { 54 - .start = MCFFEC_BASE, 55 - .end = MCFFEC_BASE + MCFFEC_SIZE - 1, 56 - .flags = IORESOURCE_MEM, 57 - }, 58 - { 59 - .start = 64 + 23, 60 - .end = 64 + 23, 61 - .flags = IORESOURCE_IRQ, 62 - }, 63 - { 64 - .start = 64 + 27, 65 - .end = 64 + 27, 66 - .flags = IORESOURCE_IRQ, 67 - }, 68 - { 69 - .start = 64 + 29, 70 - .end = 64 + 29, 71 - .flags = IORESOURCE_IRQ, 72 - }, 73 - }; 74 - 75 - static struct platform_device m528x_fec = { 76 - .name = "fec", 77 - .id = 0, 78 - .num_resources = ARRAY_SIZE(m528x_fec_resources), 79 - .resource = m528x_fec_resources, 80 - }; 81 - 82 - #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 83 - static struct resource m528x_qspi_resources[] = { 84 - { 85 - .start = MCFQSPI_IOBASE, 86 - .end = MCFQSPI_IOBASE + MCFQSPI_IOSIZE - 1, 87 - .flags = IORESOURCE_MEM, 88 - }, 89 - { 90 - .start = MCFINT_VECBASE + MCFINT_QSPI, 91 - .end = MCFINT_VECBASE + MCFINT_QSPI, 92 - .flags = IORESOURCE_IRQ, 93 - }, 94 - }; 95 - 96 - #define MCFQSPI_CS0 147 97 - #define MCFQSPI_CS1 148 98 - #define MCFQSPI_CS2 149 99 - #define MCFQSPI_CS3 150 100 - 101 - static int m528x_cs_setup(struct mcfqspi_cs_control *cs_control) 102 - { 103 - int status; 104 - 105 - status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0"); 106 - if (status) { 107 - pr_debug("gpio_request for MCFQSPI_CS0 failed\n"); 108 - goto fail0; 109 - } 110 - status = gpio_direction_output(MCFQSPI_CS0, 1); 111 - if (status) { 112 - pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n"); 113 - goto fail1; 114 - } 115 - 116 - status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1"); 117 - if (status) { 118 - pr_debug("gpio_request for MCFQSPI_CS1 failed\n"); 119 - goto fail1; 120 - } 121 - status = gpio_direction_output(MCFQSPI_CS1, 1); 122 - if (status) { 123 - pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n"); 124 - goto fail2; 125 - } 126 - 127 - status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2"); 128 - if (status) { 129 - pr_debug("gpio_request for MCFQSPI_CS2 failed\n"); 130 - goto fail2; 131 - } 132 - status = gpio_direction_output(MCFQSPI_CS2, 1); 133 - if (status) { 134 - pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n"); 135 - goto fail3; 136 - } 137 - 138 - status = gpio_request(MCFQSPI_CS3, "MCFQSPI_CS3"); 139 - if (status) { 140 - pr_debug("gpio_request for MCFQSPI_CS3 failed\n"); 141 - goto fail3; 142 - } 143 - status = gpio_direction_output(MCFQSPI_CS3, 1); 144 - if (status) { 145 - pr_debug("gpio_direction_output for MCFQSPI_CS3 failed\n"); 146 - goto fail4; 147 - } 148 - 149 - return 0; 150 - 151 - fail4: 152 - gpio_free(MCFQSPI_CS3); 153 - fail3: 154 - gpio_free(MCFQSPI_CS2); 155 - fail2: 156 - gpio_free(MCFQSPI_CS1); 157 - fail1: 158 - gpio_free(MCFQSPI_CS0); 159 - fail0: 160 - return status; 161 - } 162 - 163 - static void m528x_cs_teardown(struct mcfqspi_cs_control *cs_control) 164 - { 165 - gpio_free(MCFQSPI_CS3); 166 - gpio_free(MCFQSPI_CS2); 167 - gpio_free(MCFQSPI_CS1); 168 - gpio_free(MCFQSPI_CS0); 169 - } 170 - 171 - static void m528x_cs_select(struct mcfqspi_cs_control *cs_control, 172 - u8 chip_select, bool cs_high) 173 - { 174 - gpio_set_value(MCFQSPI_CS0 + chip_select, cs_high); 175 - } 176 - 177 - static void m528x_cs_deselect(struct mcfqspi_cs_control *cs_control, 178 - u8 chip_select, bool cs_high) 179 - { 180 - gpio_set_value(MCFQSPI_CS0 + chip_select, !cs_high); 181 - } 182 - 183 - static struct mcfqspi_cs_control m528x_cs_control = { 184 - .setup = m528x_cs_setup, 185 - .teardown = m528x_cs_teardown, 186 - .select = m528x_cs_select, 187 - .deselect = m528x_cs_deselect, 188 - }; 189 - 190 - static struct mcfqspi_platform_data m528x_qspi_data = { 191 - .bus_num = 0, 192 - .num_chipselect = 4, 193 - .cs_control = &m528x_cs_control, 194 - }; 195 - 196 - static struct platform_device m528x_qspi = { 197 - .name = "mcfqspi", 198 - .id = 0, 199 - .num_resources = ARRAY_SIZE(m528x_qspi_resources), 200 - .resource = m528x_qspi_resources, 201 - .dev.platform_data = &m528x_qspi_data, 202 - }; 27 + #ifdef CONFIG_SPI_COLDFIRE_QSPI 203 28 204 29 static void __init m528x_qspi_init(void) 205 30 { 206 31 /* setup Port QS for QSPI with gpio CS control */ 207 32 __raw_writeb(0x07, MCFGPIO_PQSPAR); 208 33 } 209 - #endif /* defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) */ 210 34 211 - static struct platform_device *m528x_devices[] __initdata = { 212 - &m528x_uart, 213 - &m528x_fec, 214 - #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 215 - &m528x_qspi, 216 - #endif 217 - }; 35 + #endif /* CONFIG_SPI_COLDFIRE_QSPI */ 218 36 219 37 /***************************************************************************/ 220 38 221 - static void __init m528x_uart_init_line(int line, int irq) 39 + static void __init m528x_uarts_init(void) 222 40 { 223 41 u8 port; 224 42 225 - if ((line < 0) || (line > 2)) 226 - return; 227 - 228 43 /* make sure PUAPAR is set for UART0 and UART1 */ 229 - if (line < 2) { 230 - port = readb(MCF5282_GPIO_PUAPAR); 231 - port |= (0x03 << (line * 2)); 232 - writeb(port, MCF5282_GPIO_PUAPAR); 233 - } 234 - } 235 - 236 - static void __init m528x_uarts_init(void) 237 - { 238 - const int nrlines = ARRAY_SIZE(m528x_uart_platform); 239 - int line; 240 - 241 - for (line = 0; (line < nrlines); line++) 242 - m528x_uart_init_line(line, m528x_uart_platform[line].irq); 44 + port = readb(MCF5282_GPIO_PUAPAR); 45 + port |= 0x03 | (0x03 << 2); 46 + writeb(port, MCF5282_GPIO_PUAPAR); 243 47 } 244 48 245 49 /***************************************************************************/ ··· 56 252 v16 = readw(MCF_IPSBAR + 0x100056); 57 253 writew(v16 | 0xf00, MCF_IPSBAR + 0x100056); 58 254 writeb(0xc0, MCF_IPSBAR + 0x100058); 59 - } 60 - 61 - /***************************************************************************/ 62 - 63 - static void m528x_cpu_reset(void) 64 - { 65 - local_irq_disable(); 66 - __raw_writeb(MCF_RCR_SWRESET, MCF_IPSBAR + MCF_RCR); 67 255 } 68 256 69 257 /***************************************************************************/ ··· 95 299 #ifdef CONFIG_WILDFIREMOD 96 300 mach_halt = wildfiremod_halt; 97 301 #endif 98 - } 99 - 100 - /***************************************************************************/ 101 - 102 - static int __init init_BSP(void) 103 - { 104 - mach_reset = m528x_cpu_reset; 302 + mach_sched_init = hw_timer_init; 105 303 m528x_uarts_init(); 106 304 m528x_fec_init(); 107 - #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 305 + #ifdef CONFIG_SPI_COLDFIRE_QSPI 108 306 m528x_qspi_init(); 109 307 #endif 110 - platform_add_devices(m528x_devices, ARRAY_SIZE(m528x_devices)); 111 - return 0; 112 308 } 113 - 114 - arch_initcall(init_BSP); 115 309 116 310 /***************************************************************************/
+1 -90
arch/m68k/platform/5307/config.c
··· 16 16 #include <asm/machdep.h> 17 17 #include <asm/coldfire.h> 18 18 #include <asm/mcfsim.h> 19 - #include <asm/mcfuart.h> 20 19 #include <asm/mcfwdebug.h> 21 20 22 21 /***************************************************************************/ ··· 28 29 29 30 /***************************************************************************/ 30 31 31 - static struct mcf_platform_uart m5307_uart_platform[] = { 32 - { 33 - .mapbase = MCF_MBAR + MCFUART_BASE1, 34 - .irq = 73, 35 - }, 36 - { 37 - .mapbase = MCF_MBAR + MCFUART_BASE2, 38 - .irq = 74, 39 - }, 40 - { }, 41 - }; 42 - 43 - static struct platform_device m5307_uart = { 44 - .name = "mcfuart", 45 - .id = 0, 46 - .dev.platform_data = m5307_uart_platform, 47 - }; 48 - 49 - static struct platform_device *m5307_devices[] __initdata = { 50 - &m5307_uart, 51 - }; 52 - 53 - /***************************************************************************/ 54 - 55 - static void __init m5307_uart_init_line(int line, int irq) 56 - { 57 - if (line == 0) { 58 - writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); 59 - writeb(irq, MCF_MBAR + MCFUART_BASE1 + MCFUART_UIVR); 60 - mcf_mapirq2imr(irq, MCFINTC_UART0); 61 - } else if (line == 1) { 62 - writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); 63 - writeb(irq, MCF_MBAR + MCFUART_BASE2 + MCFUART_UIVR); 64 - mcf_mapirq2imr(irq, MCFINTC_UART1); 65 - } 66 - } 67 - 68 - static void __init m5307_uarts_init(void) 69 - { 70 - const int nrlines = ARRAY_SIZE(m5307_uart_platform); 71 - int line; 72 - 73 - for (line = 0; (line < nrlines); line++) 74 - m5307_uart_init_line(line, m5307_uart_platform[line].irq); 75 - } 76 - 77 - /***************************************************************************/ 78 - 79 - static void __init m5307_timers_init(void) 80 - { 81 - /* Timer1 is always used as system timer */ 82 - writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3, 83 - MCF_MBAR + MCFSIM_TIMER1ICR); 84 - mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1); 85 - 86 - #ifdef CONFIG_HIGHPROFILE 87 - /* Timer2 is to be used as a high speed profile timer */ 88 - writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3, 89 - MCF_MBAR + MCFSIM_TIMER2ICR); 90 - mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2); 91 - #endif 92 - } 93 - 94 - /***************************************************************************/ 95 - 96 - void m5307_cpu_reset(void) 97 - { 98 - local_irq_disable(); 99 - /* Set watchdog to soft reset, and enabled */ 100 - __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR); 101 - for (;;) 102 - /* wait for watchdog to timeout */; 103 - } 104 - 105 - /***************************************************************************/ 106 - 107 32 void __init config_BSP(char *commandp, int size) 108 33 { 109 34 #if defined(CONFIG_NETtel) || \ ··· 37 114 commandp[size-1] = 0; 38 115 #endif 39 116 40 - mach_reset = m5307_cpu_reset; 41 - m5307_timers_init(); 42 - m5307_uarts_init(); 117 + mach_sched_init = hw_timer_init; 43 118 44 119 /* Only support the external interrupts on their primary level */ 45 120 mcf_mapirq2imr(25, MCFINTC_EINT1); ··· 54 133 wdebug(MCFDEBUG_CSR, MCFDEBUG_CSR_PSTCLK); 55 134 #endif 56 135 } 57 - 58 - /***************************************************************************/ 59 - 60 - static int __init init_BSP(void) 61 - { 62 - platform_add_devices(m5307_devices, ARRAY_SIZE(m5307_devices)); 63 - return 0; 64 - } 65 - 66 - arch_initcall(init_BSP); 67 136 68 137 /***************************************************************************/
+12 -209
arch/m68k/platform/532x/config.c
··· 21 21 #include <linux/param.h> 22 22 #include <linux/init.h> 23 23 #include <linux/io.h> 24 - #include <linux/spi/spi.h> 25 - #include <linux/gpio.h> 26 24 #include <asm/machdep.h> 27 25 #include <asm/coldfire.h> 28 26 #include <asm/mcfsim.h> 29 27 #include <asm/mcfuart.h> 30 28 #include <asm/mcfdma.h> 31 29 #include <asm/mcfwdebug.h> 32 - #include <asm/mcfqspi.h> 33 30 34 31 /***************************************************************************/ 35 32 36 - static struct mcf_platform_uart m532x_uart_platform[] = { 37 - { 38 - .mapbase = MCFUART_BASE1, 39 - .irq = MCFINT_VECBASE + MCFINT_UART0, 40 - }, 41 - { 42 - .mapbase = MCFUART_BASE2, 43 - .irq = MCFINT_VECBASE + MCFINT_UART1, 44 - }, 45 - { 46 - .mapbase = MCFUART_BASE3, 47 - .irq = MCFINT_VECBASE + MCFINT_UART2, 48 - }, 49 - { }, 50 - }; 51 - 52 - static struct platform_device m532x_uart = { 53 - .name = "mcfuart", 54 - .id = 0, 55 - .dev.platform_data = m532x_uart_platform, 56 - }; 57 - 58 - static struct resource m532x_fec_resources[] = { 59 - { 60 - .start = 0xfc030000, 61 - .end = 0xfc0307ff, 62 - .flags = IORESOURCE_MEM, 63 - }, 64 - { 65 - .start = 64 + 36, 66 - .end = 64 + 36, 67 - .flags = IORESOURCE_IRQ, 68 - }, 69 - { 70 - .start = 64 + 40, 71 - .end = 64 + 40, 72 - .flags = IORESOURCE_IRQ, 73 - }, 74 - { 75 - .start = 64 + 42, 76 - .end = 64 + 42, 77 - .flags = IORESOURCE_IRQ, 78 - }, 79 - }; 80 - 81 - static struct platform_device m532x_fec = { 82 - .name = "fec", 83 - .id = 0, 84 - .num_resources = ARRAY_SIZE(m532x_fec_resources), 85 - .resource = m532x_fec_resources, 86 - }; 87 - 88 - #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 89 - static struct resource m532x_qspi_resources[] = { 90 - { 91 - .start = MCFQSPI_IOBASE, 92 - .end = MCFQSPI_IOBASE + MCFQSPI_IOSIZE - 1, 93 - .flags = IORESOURCE_MEM, 94 - }, 95 - { 96 - .start = MCFINT_VECBASE + MCFINT_QSPI, 97 - .end = MCFINT_VECBASE + MCFINT_QSPI, 98 - .flags = IORESOURCE_IRQ, 99 - }, 100 - }; 101 - 102 - #define MCFQSPI_CS0 84 103 - #define MCFQSPI_CS1 85 104 - #define MCFQSPI_CS2 86 105 - 106 - static int m532x_cs_setup(struct mcfqspi_cs_control *cs_control) 107 - { 108 - int status; 109 - 110 - status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0"); 111 - if (status) { 112 - pr_debug("gpio_request for MCFQSPI_CS0 failed\n"); 113 - goto fail0; 114 - } 115 - status = gpio_direction_output(MCFQSPI_CS0, 1); 116 - if (status) { 117 - pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n"); 118 - goto fail1; 119 - } 120 - 121 - status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1"); 122 - if (status) { 123 - pr_debug("gpio_request for MCFQSPI_CS1 failed\n"); 124 - goto fail1; 125 - } 126 - status = gpio_direction_output(MCFQSPI_CS1, 1); 127 - if (status) { 128 - pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n"); 129 - goto fail2; 130 - } 131 - 132 - status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2"); 133 - if (status) { 134 - pr_debug("gpio_request for MCFQSPI_CS2 failed\n"); 135 - goto fail2; 136 - } 137 - status = gpio_direction_output(MCFQSPI_CS2, 1); 138 - if (status) { 139 - pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n"); 140 - goto fail3; 141 - } 142 - 143 - return 0; 144 - 145 - fail3: 146 - gpio_free(MCFQSPI_CS2); 147 - fail2: 148 - gpio_free(MCFQSPI_CS1); 149 - fail1: 150 - gpio_free(MCFQSPI_CS0); 151 - fail0: 152 - return status; 153 - } 154 - 155 - static void m532x_cs_teardown(struct mcfqspi_cs_control *cs_control) 156 - { 157 - gpio_free(MCFQSPI_CS2); 158 - gpio_free(MCFQSPI_CS1); 159 - gpio_free(MCFQSPI_CS0); 160 - } 161 - 162 - static void m532x_cs_select(struct mcfqspi_cs_control *cs_control, 163 - u8 chip_select, bool cs_high) 164 - { 165 - gpio_set_value(MCFQSPI_CS0 + chip_select, cs_high); 166 - } 167 - 168 - static void m532x_cs_deselect(struct mcfqspi_cs_control *cs_control, 169 - u8 chip_select, bool cs_high) 170 - { 171 - gpio_set_value(MCFQSPI_CS0 + chip_select, !cs_high); 172 - } 173 - 174 - static struct mcfqspi_cs_control m532x_cs_control = { 175 - .setup = m532x_cs_setup, 176 - .teardown = m532x_cs_teardown, 177 - .select = m532x_cs_select, 178 - .deselect = m532x_cs_deselect, 179 - }; 180 - 181 - static struct mcfqspi_platform_data m532x_qspi_data = { 182 - .bus_num = 0, 183 - .num_chipselect = 3, 184 - .cs_control = &m532x_cs_control, 185 - }; 186 - 187 - static struct platform_device m532x_qspi = { 188 - .name = "mcfqspi", 189 - .id = 0, 190 - .num_resources = ARRAY_SIZE(m532x_qspi_resources), 191 - .resource = m532x_qspi_resources, 192 - .dev.platform_data = &m532x_qspi_data, 193 - }; 33 + #ifdef CONFIG_SPI_COLDFIRE_QSPI 194 34 195 35 static void __init m532x_qspi_init(void) 196 36 { 197 37 /* setup QSPS pins for QSPI with gpio CS control */ 198 38 writew(0x01f0, MCF_GPIO_PAR_QSPI); 199 39 } 200 - #endif /* defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) */ 201 40 202 - 203 - static struct platform_device *m532x_devices[] __initdata = { 204 - &m532x_uart, 205 - &m532x_fec, 206 - #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 207 - &m532x_qspi, 208 - #endif 209 - }; 41 + #endif /* CONFIG_SPI_COLDFIRE_QSPI */ 210 42 211 43 /***************************************************************************/ 212 44 213 - static void __init m532x_uart_init_line(int line, int irq) 214 - { 215 - if (line == 0) { 216 - /* GPIO initialization */ 217 - MCF_GPIO_PAR_UART |= 0x000F; 218 - } else if (line == 1) { 219 - /* GPIO initialization */ 220 - MCF_GPIO_PAR_UART |= 0x0FF0; 221 - } 222 - } 223 - 224 45 static void __init m532x_uarts_init(void) 225 46 { 226 - const int nrlines = ARRAY_SIZE(m532x_uart_platform); 227 - int line; 228 - 229 - for (line = 0; (line < nrlines); line++) 230 - m532x_uart_init_line(line, m532x_uart_platform[line].irq); 47 + /* UART GPIO initialization */ 48 + MCF_GPIO_PAR_UART |= 0x0FFF; 231 49 } 50 + 232 51 /***************************************************************************/ 233 52 234 53 static void __init m532x_fec_init(void) ··· 57 238 MCF_GPIO_PAR_FECI2C_PAR_MDIO_EMDIO); 58 239 MCF_GPIO_PAR_FEC = (MCF_GPIO_PAR_FEC_PAR_FEC_7W_FEC | 59 240 MCF_GPIO_PAR_FEC_PAR_FEC_MII_FEC); 60 - } 61 - 62 - /***************************************************************************/ 63 - 64 - static void m532x_cpu_reset(void) 65 - { 66 - local_irq_disable(); 67 - __raw_writeb(MCF_RCR_SWRESET, MCF_RCR); 68 241 } 69 242 70 243 /***************************************************************************/ ··· 74 263 } 75 264 #endif 76 265 266 + mach_sched_init = hw_timer_init; 267 + m532x_uarts_init(); 268 + m532x_fec_init(); 269 + #ifdef CONFIG_SPI_COLDFIRE_QSPI 270 + m532x_qspi_init(); 271 + #endif 272 + 77 273 #ifdef CONFIG_BDM_DISABLE 78 274 /* 79 275 * Disable the BDM clocking. This also turns off most of the rest of ··· 90 272 wdebug(MCFDEBUG_CSR, MCFDEBUG_CSR_PSTCLK); 91 273 #endif 92 274 } 93 - 94 - /***************************************************************************/ 95 - 96 - static int __init init_BSP(void) 97 - { 98 - m532x_uarts_init(); 99 - m532x_fec_init(); 100 - #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 101 - m532x_qspi_init(); 102 - #endif 103 - platform_add_devices(m532x_devices, ARRAY_SIZE(m532x_devices)); 104 - return 0; 105 - } 106 - 107 - arch_initcall(init_BSP); 108 275 109 276 /***************************************************************************/ 110 277 /* Board initialization */
+1 -90
arch/m68k/platform/5407/config.c
··· 16 16 #include <asm/machdep.h> 17 17 #include <asm/coldfire.h> 18 18 #include <asm/mcfsim.h> 19 - #include <asm/mcfuart.h> 20 - 21 - /***************************************************************************/ 22 - 23 - static struct mcf_platform_uart m5407_uart_platform[] = { 24 - { 25 - .mapbase = MCF_MBAR + MCFUART_BASE1, 26 - .irq = 73, 27 - }, 28 - { 29 - .mapbase = MCF_MBAR + MCFUART_BASE2, 30 - .irq = 74, 31 - }, 32 - { }, 33 - }; 34 - 35 - static struct platform_device m5407_uart = { 36 - .name = "mcfuart", 37 - .id = 0, 38 - .dev.platform_data = m5407_uart_platform, 39 - }; 40 - 41 - static struct platform_device *m5407_devices[] __initdata = { 42 - &m5407_uart, 43 - }; 44 - 45 - /***************************************************************************/ 46 - 47 - static void __init m5407_uart_init_line(int line, int irq) 48 - { 49 - if (line == 0) { 50 - writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); 51 - writeb(irq, MCF_MBAR + MCFUART_BASE1 + MCFUART_UIVR); 52 - mcf_mapirq2imr(irq, MCFINTC_UART0); 53 - } else if (line == 1) { 54 - writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); 55 - writeb(irq, MCF_MBAR + MCFUART_BASE2 + MCFUART_UIVR); 56 - mcf_mapirq2imr(irq, MCFINTC_UART1); 57 - } 58 - } 59 - 60 - static void __init m5407_uarts_init(void) 61 - { 62 - const int nrlines = ARRAY_SIZE(m5407_uart_platform); 63 - int line; 64 - 65 - for (line = 0; (line < nrlines); line++) 66 - m5407_uart_init_line(line, m5407_uart_platform[line].irq); 67 - } 68 - 69 - /***************************************************************************/ 70 - 71 - static void __init m5407_timers_init(void) 72 - { 73 - /* Timer1 is always used as system timer */ 74 - writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3, 75 - MCF_MBAR + MCFSIM_TIMER1ICR); 76 - mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1); 77 - 78 - #ifdef CONFIG_HIGHPROFILE 79 - /* Timer2 is to be used as a high speed profile timer */ 80 - writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3, 81 - MCF_MBAR + MCFSIM_TIMER2ICR); 82 - mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2); 83 - #endif 84 - } 85 - 86 - /***************************************************************************/ 87 - 88 - void m5407_cpu_reset(void) 89 - { 90 - local_irq_disable(); 91 - /* set watchdog to soft reset, and enabled */ 92 - __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR); 93 - for (;;) 94 - /* wait for watchdog to timeout */; 95 - } 96 19 97 20 /***************************************************************************/ 98 21 99 22 void __init config_BSP(char *commandp, int size) 100 23 { 101 - mach_reset = m5407_cpu_reset; 102 - m5407_timers_init(); 103 - m5407_uarts_init(); 24 + mach_sched_init = hw_timer_init; 104 25 105 26 /* Only support the external interrupts on their primary level */ 106 27 mcf_mapirq2imr(25, MCFINTC_EINT1); ··· 29 108 mcf_mapirq2imr(29, MCFINTC_EINT5); 30 109 mcf_mapirq2imr(31, MCFINTC_EINT7); 31 110 } 32 - 33 - /***************************************************************************/ 34 - 35 - static int __init init_BSP(void) 36 - { 37 - platform_add_devices(m5407_devices, ARRAY_SIZE(m5407_devices)); 38 - return 0; 39 - } 40 - 41 - arch_initcall(init_BSP); 42 111 43 112 /***************************************************************************/
+10 -67
arch/m68k/platform/54xx/config.c
··· 27 27 28 28 /***************************************************************************/ 29 29 30 - static struct mcf_platform_uart m54xx_uart_platform[] = { 31 - { 32 - .mapbase = MCF_MBAR + MCFUART_BASE1, 33 - .irq = 64 + 35, 34 - }, 35 - { 36 - .mapbase = MCF_MBAR + MCFUART_BASE2, 37 - .irq = 64 + 34, 38 - }, 39 - { 40 - .mapbase = MCF_MBAR + MCFUART_BASE3, 41 - .irq = 64 + 33, 42 - }, 43 - { 44 - .mapbase = MCF_MBAR + MCFUART_BASE4, 45 - .irq = 64 + 32, 46 - }, 47 - }; 48 - 49 - static struct platform_device m54xx_uart = { 50 - .name = "mcfuart", 51 - .id = 0, 52 - .dev.platform_data = m54xx_uart_platform, 53 - }; 54 - 55 - static struct platform_device *m54xx_devices[] __initdata = { 56 - &m54xx_uart, 57 - }; 58 - 59 - 60 - /***************************************************************************/ 61 - 62 - static void __init m54xx_uart_init_line(int line, int irq) 63 - { 64 - int rts_cts; 65 - 66 - /* enable io pins */ 67 - switch (line) { 68 - case 0: 69 - rts_cts = 0; break; 70 - case 1: 71 - rts_cts = MCF_PAR_PSC_RTS_RTS; break; 72 - case 2: 73 - rts_cts = MCF_PAR_PSC_RTS_RTS | MCF_PAR_PSC_CTS_CTS; break; 74 - case 3: 75 - rts_cts = 0; break; 76 - } 77 - __raw_writeb(MCF_PAR_PSC_TXD | rts_cts | MCF_PAR_PSC_RXD, 78 - MCF_MBAR + MCF_PAR_PSC(line)); 79 - } 80 - 81 30 static void __init m54xx_uarts_init(void) 82 31 { 83 - const int nrlines = ARRAY_SIZE(m54xx_uart_platform); 84 - int line; 85 - 86 - for (line = 0; (line < nrlines); line++) 87 - m54xx_uart_init_line(line, m54xx_uart_platform[line].irq); 32 + /* enable io pins */ 33 + __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD, 34 + MCF_MBAR + MCF_PAR_PSC(0)); 35 + __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD | MCF_PAR_PSC_RTS_RTS, 36 + MCF_MBAR + MCF_PAR_PSC(1)); 37 + __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD | MCF_PAR_PSC_RTS_RTS | 38 + MCF_PAR_PSC_CTS_CTS, MCF_MBAR + MCF_PAR_PSC(2)); 39 + __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD, 40 + MCF_MBAR + MCF_PAR_PSC(3)); 88 41 } 89 42 90 43 /***************************************************************************/ ··· 98 145 mmu_context_init(); 99 146 #endif 100 147 mach_reset = mcf54xx_reset; 148 + mach_sched_init = hw_timer_init; 101 149 m54xx_uarts_init(); 102 150 } 103 - 104 - /***************************************************************************/ 105 - 106 - static int __init init_BSP(void) 107 - { 108 - 109 - platform_add_devices(m54xx_devices, ARRAY_SIZE(m54xx_devices)); 110 - return 0; 111 - } 112 - 113 - arch_initcall(init_BSP); 114 151 115 152 /***************************************************************************/
+3 -2
arch/m68k/platform/68328/config.c
··· 17 17 18 18 #include <linux/types.h> 19 19 #include <linux/kernel.h> 20 + #include <linux/rtc.h> 20 21 #include <asm/system.h> 21 22 #include <asm/machdep.h> 22 23 #include <asm/MC68328.h> ··· 27 26 28 27 /***************************************************************************/ 29 28 30 - void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec); 29 + int m68328_hwclk(int set, struct rtc_time *t); 31 30 32 31 /***************************************************************************/ 33 32 ··· 49 48 printk(KERN_INFO "68328 support Kenneth Albanowski <kjahds@kjshds.com>\n"); 50 49 printk(KERN_INFO "68328/Pilot support Bernhard Kuhn <kuhn@lpr.e-technik.tu-muenchen.de>\n"); 51 50 52 - mach_gettod = m68328_timer_gettod; 51 + mach_hwclk = m68328_hwclk; 53 52 mach_reset = m68328_reset; 54 53 } 55 54
-2
arch/m68k/platform/68328/ints.c
··· 68 68 asmlinkage irqreturn_t inthandler6(void); 69 69 asmlinkage irqreturn_t inthandler7(void); 70 70 71 - extern e_vector *_ramvec; 72 - 73 71 /* The 68k family did not have a good way to determine the source 74 72 * of interrupts until later in the family. The EC000 core does 75 73 * not provide the vector number on the stack, we vector everything
+10 -6
arch/m68k/platform/68328/timers.c
··· 20 20 #include <linux/interrupt.h> 21 21 #include <linux/irq.h> 22 22 #include <linux/clocksource.h> 23 + #include <linux/rtc.h> 23 24 #include <asm/setup.h> 24 25 #include <asm/system.h> 25 26 #include <asm/pgtable.h> ··· 120 119 121 120 /***************************************************************************/ 122 121 123 - void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec) 122 + int m68328_hwclk(int set, struct rtc_time *t) 124 123 { 125 - long now = RTCTIME; 124 + if (!set) { 125 + long now = RTCTIME; 126 + t->tm_year = t->tm_mon = t->tm_mday = 1; 127 + t->tm_hour = (now >> 24) % 24; 128 + t->tm_min = (now >> 16) % 60; 129 + t->tm_sec = now % 60; 130 + } 126 131 127 - *year = *mon = *day = 1; 128 - *hour = (now >> 24) % 24; 129 - *min = (now >> 16) % 60; 130 - *sec = now % 60; 132 + return 0; 131 133 } 132 134 133 135 /***************************************************************************/
+1 -7
arch/m68k/platform/68360/config.c
··· 103 103 pquicc->timer_tgcr = tgcr_save; 104 104 } 105 105 106 - void BSP_gettod (int *yearp, int *monp, int *dayp, 107 - int *hourp, int *minp, int *secp) 108 - { 109 - } 110 - 111 106 int BSP_set_clock_mmss(unsigned long nowtime) 112 107 { 113 108 #if 0 ··· 176 181 scc1_hwaddr = "\00\01\02\03\04\05"; 177 182 #endif 178 183 179 - mach_gettod = BSP_gettod; 180 - mach_reset = BSP_reset; 184 + mach_reset = BSP_reset; 181 185 }
-2
arch/m68k/platform/68360/ints.c
··· 32 32 asmlinkage void bad_interrupt(void); 33 33 asmlinkage void inthandler(void); 34 34 35 - extern void *_ramvec[]; 36 - 37 35 static void intc_irq_unmask(struct irq_data *d) 38 36 { 39 37 pquicc->intr_cimr |= (1 << d->irq);
+3 -2
arch/m68k/platform/68EZ328/config.c
··· 15 15 16 16 #include <linux/types.h> 17 17 #include <linux/kernel.h> 18 + #include <linux/rtc.h> 18 19 #include <asm/system.h> 19 20 #include <asm/pgtable.h> 20 21 #include <asm/machdep.h> ··· 26 25 27 26 /***************************************************************************/ 28 27 29 - void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec); 28 + int m68328_hwclk(int set, struct rtc_time *t); 30 29 31 30 /***************************************************************************/ 32 31 ··· 70 69 else command[0] = 0; 71 70 #endif 72 71 73 - mach_gettod = m68328_timer_gettod; 72 + mach_hwclk = m68328_hwclk; 74 73 mach_reset = m68ez328_reset; 75 74 } 76 75
+3 -2
arch/m68k/platform/68VZ328/config.c
··· 20 20 #include <linux/netdevice.h> 21 21 #include <linux/interrupt.h> 22 22 #include <linux/irq.h> 23 + #include <linux/rtc.h> 23 24 24 25 #include <asm/system.h> 25 26 #include <asm/pgtable.h> ··· 34 33 35 34 /***************************************************************************/ 36 35 37 - void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec); 36 + int m68328_hwclk(int set, struct rtc_time *t); 38 37 39 38 /***************************************************************************/ 40 39 /* Init Drangon Engine hardware */ ··· 182 181 183 182 init_hardware(command, size); 184 183 185 - mach_gettod = m68328_timer_gettod; 184 + mach_hwclk = m68328_hwclk; 186 185 mach_reset = m68vz328_reset; 187 186 } 188 187
+11 -11
arch/m68k/platform/coldfire/Makefile
··· 14 14 15 15 asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1 16 16 17 - obj-$(CONFIG_COLDFIRE) += cache.o clk.o dma.o entry.o vectors.o 18 - obj-$(CONFIG_M5206) += timers.o intc.o 19 - obj-$(CONFIG_M5206e) += timers.o intc.o 20 - obj-$(CONFIG_M520x) += pit.o intc-simr.o 21 - obj-$(CONFIG_M523x) += pit.o dma_timer.o intc-2.o 22 - obj-$(CONFIG_M5249) += timers.o intc.o 23 - obj-$(CONFIG_M527x) += pit.o intc-2.o 17 + obj-$(CONFIG_COLDFIRE) += cache.o clk.o device.o dma.o entry.o vectors.o 18 + obj-$(CONFIG_M5206) += timers.o intc.o reset.o 19 + obj-$(CONFIG_M5206e) += timers.o intc.o reset.o 20 + obj-$(CONFIG_M520x) += pit.o intc-simr.o reset.o 21 + obj-$(CONFIG_M523x) += pit.o dma_timer.o intc-2.o reset.o 22 + obj-$(CONFIG_M5249) += timers.o intc.o reset.o 23 + obj-$(CONFIG_M527x) += pit.o intc-2.o reset.o 24 24 obj-$(CONFIG_M5272) += timers.o 25 - obj-$(CONFIG_M528x) += pit.o intc-2.o 26 - obj-$(CONFIG_M5307) += timers.o intc.o 27 - obj-$(CONFIG_M532x) += timers.o intc-simr.o 28 - obj-$(CONFIG_M5407) += timers.o intc.o 25 + obj-$(CONFIG_M528x) += pit.o intc-2.o reset.o 26 + obj-$(CONFIG_M5307) += timers.o intc.o reset.o 27 + obj-$(CONFIG_M532x) += timers.o intc-simr.o reset.o 28 + obj-$(CONFIG_M5407) += timers.o intc.o reset.o 29 29 obj-$(CONFIG_M54xx) += sltimers.o intc-2.o 30 30 31 31 obj-y += pinmux.o gpio.o
+318
arch/m68k/platform/coldfire/device.c
··· 1 + /* 2 + * device.c -- common ColdFire SoC device support 3 + * 4 + * (C) Copyright 2011, Greg Ungerer <gerg@uclinux.org> 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/kernel.h> 12 + #include <linux/init.h> 13 + #include <linux/io.h> 14 + #include <linux/spi/spi.h> 15 + #include <linux/gpio.h> 16 + #include <asm/traps.h> 17 + #include <asm/coldfire.h> 18 + #include <asm/mcfsim.h> 19 + #include <asm/mcfuart.h> 20 + #include <asm/mcfqspi.h> 21 + 22 + /* 23 + * All current ColdFire parts contain from 2, 3 or 4 UARTS. 24 + */ 25 + static struct mcf_platform_uart mcf_uart_platform_data[] = { 26 + { 27 + .mapbase = MCFUART_BASE0, 28 + .irq = MCF_IRQ_UART0, 29 + }, 30 + { 31 + .mapbase = MCFUART_BASE1, 32 + .irq = MCF_IRQ_UART1, 33 + }, 34 + #ifdef MCFUART_BASE2 35 + { 36 + .mapbase = MCFUART_BASE2, 37 + .irq = MCF_IRQ_UART2, 38 + }, 39 + #endif 40 + #ifdef MCFUART_BASE3 41 + { 42 + .mapbase = MCFUART_BASE3, 43 + .irq = MCF_IRQ_UART3, 44 + }, 45 + #endif 46 + { }, 47 + }; 48 + 49 + static struct platform_device mcf_uart = { 50 + .name = "mcfuart", 51 + .id = 0, 52 + .dev.platform_data = mcf_uart_platform_data, 53 + }; 54 + 55 + #ifdef CONFIG_FEC 56 + /* 57 + * Some ColdFire cores contain the Fast Ethernet Controller (FEC) 58 + * block. It is Freescale's own hardware block. Some ColdFires 59 + * have 2 of these. 60 + */ 61 + static struct resource mcf_fec0_resources[] = { 62 + { 63 + .start = MCFFEC_BASE0, 64 + .end = MCFFEC_BASE0 + MCFFEC_SIZE0 - 1, 65 + .flags = IORESOURCE_MEM, 66 + }, 67 + { 68 + .start = MCF_IRQ_FECRX0, 69 + .end = MCF_IRQ_FECRX0, 70 + .flags = IORESOURCE_IRQ, 71 + }, 72 + { 73 + .start = MCF_IRQ_FECTX0, 74 + .end = MCF_IRQ_FECTX0, 75 + .flags = IORESOURCE_IRQ, 76 + }, 77 + { 78 + .start = MCF_IRQ_FECENTC0, 79 + .end = MCF_IRQ_FECENTC0, 80 + .flags = IORESOURCE_IRQ, 81 + }, 82 + }; 83 + 84 + static struct platform_device mcf_fec0 = { 85 + .name = "fec", 86 + .id = 0, 87 + .num_resources = ARRAY_SIZE(mcf_fec0_resources), 88 + .resource = mcf_fec0_resources, 89 + }; 90 + 91 + #ifdef MCFFEC_BASE1 92 + static struct resource mcf_fec1_resources[] = { 93 + { 94 + .start = MCFFEC_BASE1, 95 + .end = MCFFEC_BASE1 + MCFFEC_SIZE1 - 1, 96 + .flags = IORESOURCE_MEM, 97 + }, 98 + { 99 + .start = MCF_IRQ_FECRX1, 100 + .end = MCF_IRQ_FECRX1, 101 + .flags = IORESOURCE_IRQ, 102 + }, 103 + { 104 + .start = MCF_IRQ_FECTX1, 105 + .end = MCF_IRQ_FECTX1, 106 + .flags = IORESOURCE_IRQ, 107 + }, 108 + { 109 + .start = MCF_IRQ_FECENTC1, 110 + .end = MCF_IRQ_FECENTC1, 111 + .flags = IORESOURCE_IRQ, 112 + }, 113 + }; 114 + 115 + static struct platform_device mcf_fec1 = { 116 + .name = "fec", 117 + .id = 0, 118 + .num_resources = ARRAY_SIZE(mcf_fec1_resources), 119 + .resource = mcf_fec1_resources, 120 + }; 121 + #endif /* MCFFEC_BASE1 */ 122 + #endif /* CONFIG_FEC */ 123 + 124 + #ifdef CONFIG_SPI_COLDFIRE_QSPI 125 + /* 126 + * The ColdFire QSPI module is an SPI protocol hardware block used 127 + * on a number of different ColdFire CPUs. 128 + */ 129 + static struct resource mcf_qspi_resources[] = { 130 + { 131 + .start = MCFQSPI_BASE, 132 + .end = MCFQSPI_BASE + MCFQSPI_SIZE - 1, 133 + .flags = IORESOURCE_MEM, 134 + }, 135 + { 136 + .start = MCF_IRQ_QSPI, 137 + .end = MCF_IRQ_QSPI, 138 + .flags = IORESOURCE_IRQ, 139 + }, 140 + }; 141 + 142 + static int mcf_cs_setup(struct mcfqspi_cs_control *cs_control) 143 + { 144 + int status; 145 + 146 + status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0"); 147 + if (status) { 148 + pr_debug("gpio_request for MCFQSPI_CS0 failed\n"); 149 + goto fail0; 150 + } 151 + status = gpio_direction_output(MCFQSPI_CS0, 1); 152 + if (status) { 153 + pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n"); 154 + goto fail1; 155 + } 156 + 157 + status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1"); 158 + if (status) { 159 + pr_debug("gpio_request for MCFQSPI_CS1 failed\n"); 160 + goto fail1; 161 + } 162 + status = gpio_direction_output(MCFQSPI_CS1, 1); 163 + if (status) { 164 + pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n"); 165 + goto fail2; 166 + } 167 + 168 + status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2"); 169 + if (status) { 170 + pr_debug("gpio_request for MCFQSPI_CS2 failed\n"); 171 + goto fail2; 172 + } 173 + status = gpio_direction_output(MCFQSPI_CS2, 1); 174 + if (status) { 175 + pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n"); 176 + goto fail3; 177 + } 178 + 179 + #ifdef MCFQSPI_CS3 180 + status = gpio_request(MCFQSPI_CS3, "MCFQSPI_CS3"); 181 + if (status) { 182 + pr_debug("gpio_request for MCFQSPI_CS3 failed\n"); 183 + goto fail3; 184 + } 185 + status = gpio_direction_output(MCFQSPI_CS3, 1); 186 + if (status) { 187 + pr_debug("gpio_direction_output for MCFQSPI_CS3 failed\n"); 188 + gpio_free(MCFQSPI_CS3); 189 + goto fail3; 190 + } 191 + #endif 192 + 193 + return 0; 194 + 195 + fail3: 196 + gpio_free(MCFQSPI_CS2); 197 + fail2: 198 + gpio_free(MCFQSPI_CS1); 199 + fail1: 200 + gpio_free(MCFQSPI_CS0); 201 + fail0: 202 + return status; 203 + } 204 + 205 + static void mcf_cs_teardown(struct mcfqspi_cs_control *cs_control) 206 + { 207 + #ifdef MCFQSPI_CS3 208 + gpio_free(MCFQSPI_CS3); 209 + #endif 210 + gpio_free(MCFQSPI_CS2); 211 + gpio_free(MCFQSPI_CS1); 212 + gpio_free(MCFQSPI_CS0); 213 + } 214 + 215 + static void mcf_cs_select(struct mcfqspi_cs_control *cs_control, 216 + u8 chip_select, bool cs_high) 217 + { 218 + switch (chip_select) { 219 + case 0: 220 + gpio_set_value(MCFQSPI_CS0, cs_high); 221 + break; 222 + case 1: 223 + gpio_set_value(MCFQSPI_CS1, cs_high); 224 + break; 225 + case 2: 226 + gpio_set_value(MCFQSPI_CS2, cs_high); 227 + break; 228 + #ifdef MCFQSPI_CS3 229 + case 3: 230 + gpio_set_value(MCFQSPI_CS3, cs_high); 231 + break; 232 + #endif 233 + } 234 + } 235 + 236 + static void mcf_cs_deselect(struct mcfqspi_cs_control *cs_control, 237 + u8 chip_select, bool cs_high) 238 + { 239 + switch (chip_select) { 240 + case 0: 241 + gpio_set_value(MCFQSPI_CS0, !cs_high); 242 + break; 243 + case 1: 244 + gpio_set_value(MCFQSPI_CS1, !cs_high); 245 + break; 246 + case 2: 247 + gpio_set_value(MCFQSPI_CS2, !cs_high); 248 + break; 249 + #ifdef MCFQSPI_CS3 250 + case 3: 251 + gpio_set_value(MCFQSPI_CS3, !cs_high); 252 + break; 253 + #endif 254 + } 255 + } 256 + 257 + static struct mcfqspi_cs_control mcf_cs_control = { 258 + .setup = mcf_cs_setup, 259 + .teardown = mcf_cs_teardown, 260 + .select = mcf_cs_select, 261 + .deselect = mcf_cs_deselect, 262 + }; 263 + 264 + static struct mcfqspi_platform_data mcf_qspi_data = { 265 + .bus_num = 0, 266 + .num_chipselect = 4, 267 + .cs_control = &mcf_cs_control, 268 + }; 269 + 270 + static struct platform_device mcf_qspi = { 271 + .name = "mcfqspi", 272 + .id = 0, 273 + .num_resources = ARRAY_SIZE(mcf_qspi_resources), 274 + .resource = mcf_qspi_resources, 275 + .dev.platform_data = &mcf_qspi_data, 276 + }; 277 + #endif /* CONFIG_SPI_COLDFIRE_QSPI */ 278 + 279 + static struct platform_device *mcf_devices[] __initdata = { 280 + &mcf_uart, 281 + #ifdef CONFIG_FEC 282 + &mcf_fec0, 283 + #ifdef MCFFEC_BASE1 284 + &mcf_fec1, 285 + #endif 286 + #endif 287 + #ifdef CONFIG_SPI_COLDFIRE_QSPI 288 + &mcf_qspi, 289 + #endif 290 + }; 291 + 292 + /* 293 + * Some ColdFire UARTs let you set the IRQ line to use. 294 + */ 295 + static void __init mcf_uart_set_irq(void) 296 + { 297 + #ifdef MCFUART_UIVR 298 + /* UART0 interrupt setup */ 299 + writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); 300 + writeb(MCF_IRQ_UART0, MCFUART_BASE0 + MCFUART_UIVR); 301 + mcf_mapirq2imr(MCF_IRQ_UART0, MCFINTC_UART0); 302 + 303 + /* UART1 interrupt setup */ 304 + writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); 305 + writeb(MCF_IRQ_UART1, MCFUART_BASE1 + MCFUART_UIVR); 306 + mcf_mapirq2imr(MCF_IRQ_UART1, MCFINTC_UART1); 307 + #endif 308 + } 309 + 310 + static int __init mcf_init_devices(void) 311 + { 312 + mcf_uart_set_irq(); 313 + platform_add_devices(mcf_devices, ARRAY_SIZE(mcf_devices)); 314 + return 0; 315 + } 316 + 317 + arch_initcall(mcf_init_devices); 318 +
+4
arch/m68k/platform/coldfire/head.S
··· 158 158 #if defined(CONFIG_UBOOT) 159 159 movel %sp,_init_sp /* save initial stack pointer */ 160 160 #endif 161 + #ifdef CONFIG_MBAR 162 + movel #CONFIG_MBAR+1,%d0 /* configured MBAR address */ 163 + movec %d0,%MBAR /* set it */ 164 + #endif 161 165 162 166 /* 163 167 * Do any platform or board specific setup now. Most boards
+1 -1
arch/m68k/platform/coldfire/pit.c
··· 149 149 150 150 /***************************************************************************/ 151 151 152 - void hw_timer_init(void) 152 + void hw_timer_init(irq_handler_t handler) 153 153 { 154 154 cf_pit_clockevent.cpumask = cpumask_of(smp_processor_id()); 155 155 cf_pit_clockevent.mult = div_sc(FREQ, NSEC_PER_SEC, 32);
+50
arch/m68k/platform/coldfire/reset.c
··· 1 + /* 2 + * reset.c -- common ColdFire SoC reset support 3 + * 4 + * (C) Copyright 2012, Greg Ungerer <gerg@uclinux.org> 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/kernel.h> 12 + #include <linux/init.h> 13 + #include <linux/io.h> 14 + #include <asm/machdep.h> 15 + #include <asm/coldfire.h> 16 + #include <asm/mcfsim.h> 17 + 18 + /* 19 + * There are 2 common methods amongst the ColdFure parts for reseting 20 + * the CPU. But there are couple of exceptions, the 5272 and the 547x 21 + * have something completely special to them, and we let their specific 22 + * subarch code handle them. 23 + */ 24 + 25 + #ifdef MCFSIM_SYPCR 26 + static void mcf_cpu_reset(void) 27 + { 28 + local_irq_disable(); 29 + /* Set watchdog to soft reset, and enabled */ 30 + __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR); 31 + for (;;) 32 + /* wait for watchdog to timeout */; 33 + } 34 + #endif 35 + 36 + #ifdef MCF_RCR 37 + static void mcf_cpu_reset(void) 38 + { 39 + local_irq_disable(); 40 + __raw_writeb(MCF_RCR_SWRESET, MCF_RCR); 41 + } 42 + #endif 43 + 44 + static int __init mcf_setup_reset(void) 45 + { 46 + mach_reset = mcf_cpu_reset; 47 + return 0; 48 + } 49 + 50 + arch_initcall(mcf_setup_reset);
+5 -2
arch/m68k/platform/coldfire/sltimers.c
··· 81 81 static u32 mcfslt_cycles_per_jiffy; 82 82 static u32 mcfslt_cnt; 83 83 84 + static irq_handler_t timer_interrupt; 85 + 84 86 static irqreturn_t mcfslt_tick(int irq, void *dummy) 85 87 { 86 88 /* Reset Slice Timer 0 */ 87 89 __raw_writel(MCFSLT_SSR_BE | MCFSLT_SSR_TE, TA(MCFSLT_SSR)); 88 90 mcfslt_cnt += mcfslt_cycles_per_jiffy; 89 - return arch_timer_interrupt(irq, dummy); 91 + return timer_interrupt(irq, dummy); 90 92 } 91 93 92 94 static struct irqaction mcfslt_timer_irq = { ··· 123 121 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 124 122 }; 125 123 126 - void hw_timer_init(void) 124 + void hw_timer_init(irq_handler_t handler) 127 125 { 128 126 mcfslt_cycles_per_jiffy = MCF_BUSCLK / HZ; 129 127 /* ··· 138 136 /* initialize mcfslt_cnt knowing that slice timers count down */ 139 137 mcfslt_cnt = mcfslt_cycles_per_jiffy; 140 138 139 + timer_interrupt = handler; 141 140 setup_irq(MCF_IRQ_TIMER, &mcfslt_timer_irq); 142 141 143 142 clocksource_register_hz(&mcfslt_clk, MCF_BUSCLK);
+25 -2
arch/m68k/platform/coldfire/timers.c
··· 47 47 static u32 mcftmr_cycles_per_jiffy; 48 48 static u32 mcftmr_cnt; 49 49 50 + static irq_handler_t timer_interrupt; 51 + 52 + /***************************************************************************/ 53 + 54 + static void init_timer_irq(void) 55 + { 56 + #ifdef MCFSIM_ICR_AUTOVEC 57 + /* Timer1 is always used as system timer */ 58 + writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3, 59 + MCF_MBAR + MCFSIM_TIMER1ICR); 60 + mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1); 61 + 62 + #ifdef CONFIG_HIGHPROFILE 63 + /* Timer2 is to be used as a high speed profile timer */ 64 + writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3, 65 + MCF_MBAR + MCFSIM_TIMER2ICR); 66 + mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2); 67 + #endif 68 + #endif /* MCFSIM_ICR_AUTOVEC */ 69 + } 70 + 50 71 /***************************************************************************/ 51 72 52 73 static irqreturn_t mcftmr_tick(int irq, void *dummy) ··· 76 55 __raw_writeb(MCFTIMER_TER_CAP | MCFTIMER_TER_REF, TA(MCFTIMER_TER)); 77 56 78 57 mcftmr_cnt += mcftmr_cycles_per_jiffy; 79 - return arch_timer_interrupt(irq, dummy); 58 + return timer_interrupt(irq, dummy); 80 59 } 81 60 82 61 /***************************************************************************/ ··· 115 94 116 95 /***************************************************************************/ 117 96 118 - void hw_timer_init(void) 97 + void hw_timer_init(irq_handler_t handler) 119 98 { 120 99 __raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR)); 121 100 mcftmr_cycles_per_jiffy = FREQ / HZ; ··· 131 110 132 111 clocksource_register_hz(&mcftmr_clk, FREQ); 133 112 113 + timer_interrupt = handler; 114 + init_timer_irq(); 134 115 setup_irq(MCF_IRQ_TIMER, &mcftmr_timer_irq); 135 116 136 117 #ifdef CONFIG_HIGHPROFILE
-2
arch/m68k/platform/coldfire/vectors.c
··· 33 33 34 34 /***************************************************************************/ 35 35 36 - extern e_vector *_ramvec; 37 - 38 36 /* Assembler routines */ 39 37 asmlinkage void buserr(void); 40 38 asmlinkage void trap(void);