Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /***************************************************************************/ |
| 2 | |
| 3 | /* |
| 4 | * linux/arch/m68knommu/platform/5307/config.c |
| 5 | * |
| 6 | * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com) |
| 7 | * Copyright (C) 2000, Lineo (www.lineo.com) |
| 8 | */ |
| 9 | |
| 10 | /***************************************************************************/ |
| 11 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <linux/kernel.h> |
| 13 | #include <linux/sched.h> |
| 14 | #include <linux/param.h> |
| 15 | #include <linux/init.h> |
| 16 | #include <linux/interrupt.h> |
| 17 | #include <asm/irq.h> |
| 18 | #include <asm/dma.h> |
| 19 | #include <asm/traps.h> |
| 20 | #include <asm/machdep.h> |
| 21 | #include <asm/coldfire.h> |
| 22 | #include <asm/mcftimer.h> |
| 23 | #include <asm/mcfsim.h> |
| 24 | #include <asm/mcfdma.h> |
| 25 | #include <asm/mcfwdebug.h> |
| 26 | |
| 27 | /***************************************************************************/ |
| 28 | |
| 29 | void coldfire_tick(void); |
Greg Ungerer | eaefd5f | 2007-02-07 12:03:19 +1000 | [diff] [blame] | 30 | void coldfire_timer_init(irq_handler_t handler); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | unsigned long coldfire_timer_offset(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | void coldfire_reset(void); |
| 33 | |
| 34 | extern unsigned int mcf_timervector; |
| 35 | extern unsigned int mcf_profilevector; |
| 36 | extern unsigned int mcf_timerlevel; |
| 37 | |
| 38 | /***************************************************************************/ |
| 39 | |
| 40 | /* |
| 41 | * Some platforms need software versions of the GPIO data registers. |
| 42 | */ |
| 43 | unsigned short ppdata; |
| 44 | unsigned char ledbank = 0xff; |
| 45 | |
| 46 | /***************************************************************************/ |
| 47 | |
| 48 | /* |
| 49 | * DMA channel base address table. |
| 50 | */ |
| 51 | unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = { |
| 52 | MCF_MBAR + MCFDMA_BASE0, |
| 53 | MCF_MBAR + MCFDMA_BASE1, |
| 54 | MCF_MBAR + MCFDMA_BASE2, |
| 55 | MCF_MBAR + MCFDMA_BASE3, |
| 56 | }; |
| 57 | |
| 58 | unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS]; |
| 59 | |
| 60 | /***************************************************************************/ |
| 61 | |
| 62 | void mcf_autovector(unsigned int vec) |
| 63 | { |
| 64 | volatile unsigned char *mbar; |
| 65 | |
| 66 | if ((vec >= 25) && (vec <= 31)) { |
| 67 | mbar = (volatile unsigned char *) MCF_MBAR; |
| 68 | vec = 0x1 << (vec - 24); |
| 69 | *(mbar + MCFSIM_AVR) |= vec; |
| 70 | mcf_setimr(mcf_getimr() & ~vec); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | /***************************************************************************/ |
| 75 | |
| 76 | void mcf_settimericr(unsigned int timer, unsigned int level) |
| 77 | { |
| 78 | volatile unsigned char *icrp; |
| 79 | unsigned int icr, imr; |
| 80 | |
| 81 | if (timer <= 2) { |
| 82 | switch (timer) { |
| 83 | case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break; |
| 84 | default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break; |
| 85 | } |
| 86 | |
| 87 | icrp = (volatile unsigned char *) (MCF_MBAR + icr); |
| 88 | *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3; |
| 89 | mcf_setimr(mcf_getimr() & ~imr); |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | /***************************************************************************/ |
| 94 | |
| 95 | int mcf_timerirqpending(int timer) |
| 96 | { |
| 97 | unsigned int imr = 0; |
| 98 | |
| 99 | switch (timer) { |
| 100 | case 1: imr = MCFSIM_IMR_TIMER1; break; |
| 101 | case 2: imr = MCFSIM_IMR_TIMER2; break; |
| 102 | default: break; |
| 103 | } |
| 104 | return (mcf_getipr() & imr); |
| 105 | } |
| 106 | |
| 107 | /***************************************************************************/ |
| 108 | |
| 109 | void config_BSP(char *commandp, int size) |
| 110 | { |
| 111 | mcf_setimr(MCFSIM_IMR_MASKALL); |
| 112 | |
Greg Ungerer | bc72450 | 2007-07-25 22:07:20 +1000 | [diff] [blame] | 113 | #if defined(CONFIG_NETtel) || defined(CONFIG_eLIA) || \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | defined(CONFIG_DISKtel) || defined(CONFIG_SECUREEDGEMP3) || \ |
| 115 | defined(CONFIG_CLEOPATRA) |
| 116 | /* Copy command line from FLASH to local buffer... */ |
| 117 | memcpy(commandp, (char *) 0xf0004000, size); |
| 118 | commandp[size-1] = 0; |
| 119 | /* Different timer setup - to prevent device clash */ |
| 120 | mcf_timervector = 30; |
| 121 | mcf_profilevector = 31; |
| 122 | mcf_timerlevel = 6; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | #endif |
| 124 | |
| 125 | mach_sched_init = coldfire_timer_init; |
| 126 | mach_tick = coldfire_tick; |
| 127 | mach_gettimeoffset = coldfire_timer_offset; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | mach_reset = coldfire_reset; |
| 129 | |
| 130 | #ifdef MCF_BDM_DISABLE |
| 131 | /* |
| 132 | * Disable the BDM clocking. This also turns off most of the rest of |
| 133 | * the BDM device. This is good for EMC reasons. This option is not |
| 134 | * incompatible with the memory protection option. |
| 135 | */ |
| 136 | wdebug(MCFDEBUG_CSR, MCFDEBUG_CSR_PSTCLK); |
| 137 | #endif |
| 138 | } |
| 139 | |
| 140 | /***************************************************************************/ |