Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /***************************************************************************/ |
| 2 | |
| 3 | /* |
| 4 | * linux/arch/m68knommu/platform/5272/config.c |
| 5 | * |
| 6 | * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com) |
| 7 | * Copyright (C) 2001-2002, SnapGear Inc. (www.snapgear.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 | |
| 26 | /***************************************************************************/ |
| 27 | |
| 28 | void coldfire_tick(void); |
Greg Ungerer | eaefd5f | 2007-02-07 12:03:19 +1000 | [diff] [blame] | 29 | void coldfire_timer_init(irq_handler_t handler); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | unsigned long coldfire_timer_offset(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | void coldfire_reset(void); |
| 32 | |
| 33 | extern unsigned int mcf_timervector; |
| 34 | extern unsigned int mcf_profilevector; |
| 35 | extern unsigned int mcf_timerlevel; |
| 36 | |
| 37 | /***************************************************************************/ |
| 38 | |
| 39 | /* |
| 40 | * Some platforms need software versions of the GPIO data registers. |
| 41 | */ |
| 42 | unsigned short ppdata; |
| 43 | unsigned char ledbank = 0xff; |
| 44 | |
| 45 | /***************************************************************************/ |
| 46 | |
| 47 | /* |
| 48 | * DMA channel base address table. |
| 49 | */ |
| 50 | unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = { |
| 51 | MCF_MBAR + MCFDMA_BASE0, |
| 52 | }; |
| 53 | |
| 54 | unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS]; |
| 55 | |
| 56 | /***************************************************************************/ |
| 57 | |
| 58 | void mcf_disableall(void) |
| 59 | { |
| 60 | volatile unsigned long *icrp; |
| 61 | |
| 62 | icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1); |
| 63 | icrp[0] = 0x88888888; |
| 64 | icrp[1] = 0x88888888; |
| 65 | icrp[2] = 0x88888888; |
| 66 | icrp[3] = 0x88888888; |
| 67 | } |
| 68 | |
| 69 | /***************************************************************************/ |
| 70 | |
| 71 | void mcf_autovector(unsigned int vec) |
| 72 | { |
| 73 | /* Everything is auto-vectored on the 5272 */ |
| 74 | } |
| 75 | |
| 76 | /***************************************************************************/ |
| 77 | |
| 78 | void mcf_settimericr(int timer, int level) |
| 79 | { |
| 80 | volatile unsigned long *icrp; |
| 81 | |
| 82 | if ((timer >= 1 ) && (timer <= 4)) { |
| 83 | icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1); |
| 84 | *icrp = (0x8 | level) << ((4 - timer) * 4); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | /***************************************************************************/ |
| 89 | |
| 90 | int mcf_timerirqpending(int timer) |
| 91 | { |
| 92 | volatile unsigned long *icrp; |
| 93 | |
| 94 | if ((timer >= 1 ) && (timer <= 4)) { |
| 95 | icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1); |
| 96 | return (*icrp & (0x8 << ((4 - timer) * 4))); |
| 97 | } |
| 98 | return 0; |
| 99 | } |
| 100 | |
| 101 | /***************************************************************************/ |
| 102 | |
| 103 | void config_BSP(char *commandp, int size) |
| 104 | { |
Greg Ungerer | a796266 | 2005-09-09 09:32:14 +1000 | [diff] [blame] | 105 | #if defined (CONFIG_MOD5272) |
| 106 | volatile unsigned char *pivrp; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | |
| 108 | /* Set base of device vectors to be 64 */ |
Greg Ungerer | a796266 | 2005-09-09 09:32:14 +1000 | [diff] [blame] | 109 | pivrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_PIVR); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | *pivrp = 0x40; |
| 111 | #endif |
| 112 | |
| 113 | mcf_disableall(); |
| 114 | |
Greg Ungerer | bc72450 | 2007-07-25 22:07:20 +1000 | [diff] [blame] | 115 | #if defined(CONFIG_NETtel) || defined(CONFIG_SCALES) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | /* Copy command line from FLASH to local buffer... */ |
| 117 | memcpy(commandp, (char *) 0xf0004000, size); |
| 118 | commandp[size-1] = 0; |
| 119 | #elif defined(CONFIG_MTD_KeyTechnology) |
| 120 | /* Copy command line from FLASH to local buffer... */ |
| 121 | memcpy(commandp, (char *) 0xffe06000, size); |
| 122 | commandp[size-1] = 0; |
| 123 | #elif defined(CONFIG_CANCam) |
| 124 | /* Copy command line from FLASH to local buffer... */ |
| 125 | memcpy(commandp, (char *) 0xf0010000, size); |
| 126 | commandp[size-1] = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | #endif |
| 128 | |
| 129 | mcf_timervector = 69; |
| 130 | mcf_profilevector = 70; |
| 131 | mach_sched_init = coldfire_timer_init; |
| 132 | mach_tick = coldfire_tick; |
| 133 | mach_gettimeoffset = coldfire_timer_offset; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | mach_reset = coldfire_reset; |
| 135 | } |
| 136 | |
| 137 | /***************************************************************************/ |