Commit a4110eecf2944b2f8b47f38273cc3730ddd394a3
Committed by
Jason
1 parent
c6d8863015
Exists in
master
and in
57 other branches
ColdFire: Clean up checkpatch warnings for MCF547x and MCF548x
Signed-off-by: Alison Wang <b18965@freescale.com>
Showing 7 changed files with 158 additions and 144 deletions Inline Diff
arch/m68k/cpu/mcf547x_8x/cpu.c
| 1 | /* | 1 | /* |
| 2 | * | 2 | * |
| 3 | * (C) Copyright 2000-2003 | 3 | * (C) Copyright 2000-2003 |
| 4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | 4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. | 6 | * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc. |
| 7 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) | 7 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) |
| 8 | * | 8 | * |
| 9 | * See file CREDITS for list of people who contributed to this | 9 | * See file CREDITS for list of people who contributed to this |
| 10 | * project. | 10 | * project. |
| 11 | * | 11 | * |
| 12 | * This program is free software; you can redistribute it and/or | 12 | * This program is free software; you can redistribute it and/or |
| 13 | * modify it under the terms of the GNU General Public License as | 13 | * modify it under the terms of the GNU General Public License as |
| 14 | * published by the Free Software Foundation; either version 2 of | 14 | * published by the Free Software Foundation; either version 2 of |
| 15 | * the License, or (at your option) any later version. | 15 | * the License, or (at your option) any later version. |
| 16 | * | 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, | 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. | 20 | * GNU General Public License for more details. |
| 21 | * | 21 | * |
| 22 | * You should have received a copy of the GNU General Public License | 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with this program; if not, write to the Free Software | 23 | * along with this program; if not, write to the Free Software |
| 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 25 | * MA 02111-1307 USA | 25 | * MA 02111-1307 USA |
| 26 | */ | 26 | */ |
| 27 | 27 | ||
| 28 | #include <common.h> | 28 | #include <common.h> |
| 29 | #include <watchdog.h> | 29 | #include <watchdog.h> |
| 30 | #include <command.h> | 30 | #include <command.h> |
| 31 | #include <netdev.h> | 31 | #include <netdev.h> |
| 32 | 32 | ||
| 33 | #include <asm/immap.h> | 33 | #include <asm/immap.h> |
| 34 | #include <asm/io.h> | ||
| 34 | 35 | ||
| 35 | DECLARE_GLOBAL_DATA_PTR; | 36 | DECLARE_GLOBAL_DATA_PTR; |
| 36 | 37 | ||
| 37 | int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | 38 | int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
| 38 | { | 39 | { |
| 39 | volatile gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR); | 40 | gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR); |
| 40 | 41 | ||
| 41 | gptmr->pre = 10; | 42 | out_be16(&gptmr->pre, 10); |
| 42 | gptmr->cnt = 1; | 43 | out_be16(&gptmr->cnt, 1); |
| 43 | 44 | ||
| 44 | /* enable watchdog, set timeout to 0 and wait */ | 45 | /* enable watchdog, set timeout to 0 and wait */ |
| 45 | gptmr->mode = GPT_TMS_SGPIO; | 46 | out_8(&gptmr->mode, GPT_TMS_SGPIO); |
| 46 | gptmr->ctrl = GPT_CTRL_WDEN | GPT_CTRL_CE; | 47 | out_8(&gptmr->ctrl, GPT_CTRL_WDEN | GPT_CTRL_CE); |
| 47 | 48 | ||
| 48 | /* we don't return! */ | 49 | /* we don't return! */ |
| 49 | return 1; | 50 | return 1; |
| 50 | }; | 51 | }; |
| 51 | 52 | ||
| 52 | int checkcpu(void) | 53 | int checkcpu(void) |
| 53 | { | 54 | { |
| 54 | volatile siu_t *siu = (siu_t *) MMAP_SIU; | 55 | siu_t *siu = (siu_t *) MMAP_SIU; |
| 55 | u16 id = 0; | 56 | u16 id = 0; |
| 56 | 57 | ||
| 57 | puts("CPU: "); | 58 | puts("CPU: "); |
| 58 | 59 | ||
| 59 | switch ((siu->jtagid & 0x000FF000) >> 12) { | 60 | switch ((in_be32(&siu->jtagid) & 0x000FF000) >> 12) { |
| 60 | case 0x0C: | 61 | case 0x0C: |
| 61 | id = 5485; | 62 | id = 5485; |
| 62 | break; | 63 | break; |
| 63 | case 0x0D: | 64 | case 0x0D: |
| 64 | id = 5484; | 65 | id = 5484; |
| 65 | break; | 66 | break; |
| 66 | case 0x0E: | 67 | case 0x0E: |
| 67 | id = 5483; | 68 | id = 5483; |
| 68 | break; | 69 | break; |
| 69 | case 0x0F: | 70 | case 0x0F: |
| 70 | id = 5482; | 71 | id = 5482; |
| 71 | break; | 72 | break; |
| 72 | case 0x10: | 73 | case 0x10: |
| 73 | id = 5481; | 74 | id = 5481; |
| 74 | break; | 75 | break; |
| 75 | case 0x11: | 76 | case 0x11: |
| 76 | id = 5480; | 77 | id = 5480; |
| 77 | break; | 78 | break; |
| 78 | case 0x12: | 79 | case 0x12: |
| 79 | id = 5475; | 80 | id = 5475; |
| 80 | break; | 81 | break; |
| 81 | case 0x13: | 82 | case 0x13: |
| 82 | id = 5474; | 83 | id = 5474; |
| 83 | break; | 84 | break; |
| 84 | case 0x14: | 85 | case 0x14: |
| 85 | id = 5473; | 86 | id = 5473; |
| 86 | break; | 87 | break; |
| 87 | case 0x15: | 88 | case 0x15: |
| 88 | id = 5472; | 89 | id = 5472; |
| 89 | break; | 90 | break; |
| 90 | case 0x16: | 91 | case 0x16: |
| 91 | id = 5471; | 92 | id = 5471; |
| 92 | break; | 93 | break; |
| 93 | case 0x17: | 94 | case 0x17: |
| 94 | id = 5470; | 95 | id = 5470; |
| 95 | break; | 96 | break; |
| 96 | } | 97 | } |
| 97 | 98 | ||
| 98 | if (id) { | 99 | if (id) { |
| 99 | char buf1[32], buf2[32]; | 100 | char buf1[32], buf2[32]; |
| 100 | 101 | ||
| 101 | printf("Freescale MCF%d\n", id); | 102 | printf("Freescale MCF%d\n", id); |
| 102 | printf(" CPU CLK %s MHz BUS CLK %s MHz\n", | 103 | printf(" CPU CLK %s MHz BUS CLK %s MHz\n", |
| 103 | strmhz(buf1, gd->cpu_clk), | 104 | strmhz(buf1, gd->cpu_clk), |
| 104 | strmhz(buf2, gd->bus_clk)); | 105 | strmhz(buf2, gd->bus_clk)); |
| 105 | } | 106 | } |
| 106 | 107 | ||
| 107 | return 0; | 108 | return 0; |
| 108 | }; | 109 | }; |
| 109 | 110 | ||
| 110 | #if defined(CONFIG_HW_WATCHDOG) | 111 | #if defined(CONFIG_HW_WATCHDOG) |
| 111 | /* Called by macro WATCHDOG_RESET */ | 112 | /* Called by macro WATCHDOG_RESET */ |
| 112 | void hw_watchdog_reset(void) | 113 | void hw_watchdog_reset(void) |
| 113 | { | 114 | { |
| 114 | volatile gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR); | 115 | gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR); |
| 115 | 116 | ||
| 116 | gptmr->ocpw = 0xa5; | 117 | out_8(&gptmr->ocpw, 0xa5); |
| 117 | } | 118 | } |
| 118 | 119 | ||
| 119 | int watchdog_disable(void) | 120 | int watchdog_disable(void) |
| 120 | { | 121 | { |
| 121 | volatile gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR); | 122 | gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR); |
| 122 | 123 | ||
| 123 | /* UserManual, once the wdog is disabled, wdog cannot be re-enabled */ | 124 | /* UserManual, once the wdog is disabled, wdog cannot be re-enabled */ |
| 124 | gptmr->mode = 0; | 125 | out_8(&gptmr->mode, 0); |
| 125 | gptmr->ctrl = 0; | 126 | out_8(&gptmr->ctrl, 0); |
| 126 | 127 | ||
| 127 | puts("WATCHDOG:disabled\n"); | 128 | puts("WATCHDOG:disabled\n"); |
| 128 | 129 | ||
| 129 | return (0); | 130 | return (0); |
| 130 | } | 131 | } |
| 131 | 132 | ||
| 132 | int watchdog_init(void) | 133 | int watchdog_init(void) |
| 133 | { | 134 | { |
| 135 | gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR); | ||
| 134 | 136 | ||
| 135 | volatile gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR); | 137 | out_be16(&gptmr->pre, CONFIG_WATCHDOG_TIMEOUT); |
| 138 | out_be16(&gptmr->cnt, CONFIG_SYS_TIMER_PRESCALER * 1000); | ||
| 136 | 139 | ||
| 137 | gptmr->pre = CONFIG_WATCHDOG_TIMEOUT; | 140 | out_8(&gptmr->mode, GPT_TMS_SGPIO); |
| 138 | gptmr->cnt = CONFIG_SYS_TIMER_PRESCALER * 1000; | 141 | out_8(&gptmr->ctrl, GPT_CTRL_CE | GPT_CTRL_WDEN); |
| 139 | |||
| 140 | gptmr->mode = GPT_TMS_SGPIO; | ||
| 141 | gptmr->ctrl = GPT_CTRL_CE | GPT_CTRL_WDEN; | ||
| 142 | puts("WATCHDOG:enabled\n"); | 142 | puts("WATCHDOG:enabled\n"); |
| 143 | 143 | ||
| 144 | return (0); | 144 | return (0); |
| 145 | } | 145 | } |
| 146 | #endif /* CONFIG_HW_WATCHDOG */ | 146 | #endif /* CONFIG_HW_WATCHDOG */ |
| 147 | 147 | ||
| 148 | #if defined(CONFIG_FSLDMAFEC) || defined(CONFIG_MCFFEC) | 148 | #if defined(CONFIG_FSLDMAFEC) || defined(CONFIG_MCFFEC) |
| 149 | /* Default initializations for MCFFEC controllers. To override, | 149 | /* Default initializations for MCFFEC controllers. To override, |
| 150 | * create a board-specific function called: | 150 | * create a board-specific function called: |
| 151 | * int board_eth_init(bd_t *bis) | 151 | * int board_eth_init(bd_t *bis) |
| 152 | */ | 152 | */ |
| 153 | 153 | ||
| 154 | int cpu_eth_init(bd_t *bis) | 154 | int cpu_eth_init(bd_t *bis) |
| 155 | { | 155 | { |
| 156 | #if defined(CONFIG_FSLDMAFEC) | 156 | #if defined(CONFIG_FSLDMAFEC) |
| 157 | mcdmafec_initialize(bis); | 157 | mcdmafec_initialize(bis); |
| 158 | #endif | 158 | #endif |
| 159 | #if defined(CONFIG_MCFFEC) | 159 | #if defined(CONFIG_MCFFEC) |
| 160 | mcffec_initialize(bis); | 160 | mcffec_initialize(bis); |
| 161 | #endif | 161 | #endif |
| 162 | return 0; | 162 | return 0; |
arch/m68k/cpu/mcf547x_8x/cpu_init.c
| 1 | /* | 1 | /* |
| 2 | * | 2 | * |
| 3 | * (C) Copyright 2000-2003 | 3 | * (C) Copyright 2000-2003 |
| 4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | 4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 5 | * | 5 | * |
| 6 | * (C) Copyright 2007 Freescale Semiconductor, Inc. | 6 | * (C) Copyright 2007, 2012 Freescale Semiconductor, Inc. |
| 7 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) | 7 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) |
| 8 | * | 8 | * |
| 9 | * See file CREDITS for list of people who contributed to this | 9 | * See file CREDITS for list of people who contributed to this |
| 10 | * project. | 10 | * project. |
| 11 | * | 11 | * |
| 12 | * This program is free software; you can redistribute it and/or | 12 | * This program is free software; you can redistribute it and/or |
| 13 | * modify it under the terms of the GNU General Public License as | 13 | * modify it under the terms of the GNU General Public License as |
| 14 | * published by the Free Software Foundation; either version 2 of | 14 | * published by the Free Software Foundation; either version 2 of |
| 15 | * the License, or (at your option) any later version. | 15 | * the License, or (at your option) any later version. |
| 16 | * | 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, | 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. | 20 | * GNU General Public License for more details. |
| 21 | * | 21 | * |
| 22 | * You should have received a copy of the GNU General Public License | 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with this program; if not, write to the Free Software | 23 | * along with this program; if not, write to the Free Software |
| 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 25 | * MA 02111-1307 USA | 25 | * MA 02111-1307 USA |
| 26 | */ | 26 | */ |
| 27 | 27 | ||
| 28 | #include <common.h> | 28 | #include <common.h> |
| 29 | #include <MCD_dma.h> | 29 | #include <MCD_dma.h> |
| 30 | #include <asm/immap.h> | 30 | #include <asm/immap.h> |
| 31 | #include <asm/io.h> | ||
| 31 | 32 | ||
| 32 | #if defined(CONFIG_CMD_NET) | 33 | #if defined(CONFIG_CMD_NET) |
| 33 | #include <config.h> | 34 | #include <config.h> |
| 34 | #include <net.h> | 35 | #include <net.h> |
| 35 | #include <asm/fsl_mcdmafec.h> | 36 | #include <asm/fsl_mcdmafec.h> |
| 36 | #endif | 37 | #endif |
| 37 | 38 | ||
| 38 | /* | 39 | /* |
| 39 | * Breath some life into the CPU... | 40 | * Breath some life into the CPU... |
| 40 | * | 41 | * |
| 41 | * Set up the memory map, | 42 | * Set up the memory map, |
| 42 | * initialize a bunch of registers, | 43 | * initialize a bunch of registers, |
| 43 | * initialize the UPM's | 44 | * initialize the UPM's |
| 44 | */ | 45 | */ |
| 45 | void cpu_init_f(void) | 46 | void cpu_init_f(void) |
| 46 | { | 47 | { |
| 47 | volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; | 48 | gpio_t *gpio = (gpio_t *) MMAP_GPIO; |
| 48 | volatile fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS; | 49 | fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS; |
| 49 | volatile xlbarb_t *xlbarb = (volatile xlbarb_t *) MMAP_XARB; | 50 | xlbarb_t *xlbarb = (xlbarb_t *) MMAP_XARB; |
| 50 | 51 | ||
| 51 | xlbarb->adrto = 0x2000; | 52 | out_be32(&xlbarb->adrto, 0x2000); |
| 52 | xlbarb->datto = 0x2500; | 53 | out_be32(&xlbarb->datto, 0x2500); |
| 53 | xlbarb->busto = 0x3000; | 54 | out_be32(&xlbarb->busto, 0x3000); |
| 54 | 55 | ||
| 55 | xlbarb->cfg = XARB_CFG_AT | XARB_CFG_DT; | 56 | out_be32(&xlbarb->cfg, XARB_CFG_AT | XARB_CFG_DT); |
| 56 | 57 | ||
| 57 | /* Master Priority Enable */ | 58 | /* Master Priority Enable */ |
| 58 | xlbarb->prien = 0xff; | 59 | out_be32(&xlbarb->prien, 0xff); |
| 59 | xlbarb->pri = 0; | 60 | out_be32(&xlbarb->pri, 0); |
| 60 | 61 | ||
| 61 | #if (defined(CONFIG_SYS_CS0_BASE) && defined(CONFIG_SYS_CS0_MASK) && defined(CONFIG_SYS_CS0_CTRL)) | 62 | #if (defined(CONFIG_SYS_CS0_BASE) && defined(CONFIG_SYS_CS0_MASK) && defined(CONFIG_SYS_CS0_CTRL)) |
| 62 | fbcs->csar0 = CONFIG_SYS_CS0_BASE; | 63 | out_be32(&fbcs->csar0, CONFIG_SYS_CS0_BASE); |
| 63 | fbcs->cscr0 = CONFIG_SYS_CS0_CTRL; | 64 | out_be32(&fbcs->cscr0, CONFIG_SYS_CS0_CTRL); |
| 64 | fbcs->csmr0 = CONFIG_SYS_CS0_MASK; | 65 | out_be32(&fbcs->csmr0, CONFIG_SYS_CS0_MASK); |
| 65 | #endif | 66 | #endif |
| 66 | 67 | ||
| 67 | #if (defined(CONFIG_SYS_CS1_BASE) && defined(CONFIG_SYS_CS1_MASK) && defined(CONFIG_SYS_CS1_CTRL)) | 68 | #if (defined(CONFIG_SYS_CS1_BASE) && defined(CONFIG_SYS_CS1_MASK) && defined(CONFIG_SYS_CS1_CTRL)) |
| 68 | fbcs->csar1 = CONFIG_SYS_CS1_BASE; | 69 | out_be32(&fbcs->csar1, CONFIG_SYS_CS1_BASE); |
| 69 | fbcs->cscr1 = CONFIG_SYS_CS1_CTRL; | 70 | out_be32(&fbcs->cscr1, CONFIG_SYS_CS1_CTRL); |
| 70 | fbcs->csmr1 = CONFIG_SYS_CS1_MASK; | 71 | out_be32(&fbcs->csmr1, CONFIG_SYS_CS1_MASK); |
| 71 | #endif | 72 | #endif |
| 72 | 73 | ||
| 73 | #if (defined(CONFIG_SYS_CS2_BASE) && defined(CONFIG_SYS_CS2_MASK) && defined(CONFIG_SYS_CS2_CTRL)) | 74 | #if (defined(CONFIG_SYS_CS2_BASE) && defined(CONFIG_SYS_CS2_MASK) && defined(CONFIG_SYS_CS2_CTRL)) |
| 74 | fbcs->csar2 = CONFIG_SYS_CS2_BASE; | 75 | out_be32(&fbcs->csar2, CONFIG_SYS_CS2_BASE); |
| 75 | fbcs->cscr2 = CONFIG_SYS_CS2_CTRL; | 76 | out_be32(&fbcs->cscr2, CONFIG_SYS_CS2_CTRL); |
| 76 | fbcs->csmr2 = CONFIG_SYS_CS2_MASK; | 77 | out_be32(&fbcs->csmr2, CONFIG_SYS_CS2_MASK); |
| 77 | #endif | 78 | #endif |
| 78 | 79 | ||
| 79 | #if (defined(CONFIG_SYS_CS3_BASE) && defined(CONFIG_SYS_CS3_MASK) && defined(CONFIG_SYS_CS3_CTRL)) | 80 | #if (defined(CONFIG_SYS_CS3_BASE) && defined(CONFIG_SYS_CS3_MASK) && defined(CONFIG_SYS_CS3_CTRL)) |
| 80 | fbcs->csar3 = CONFIG_SYS_CS3_BASE; | 81 | out_be32(&fbcs->csar3, CONFIG_SYS_CS3_BASE); |
| 81 | fbcs->cscr3 = CONFIG_SYS_CS3_CTRL; | 82 | out_be32(&fbcs->cscr3, CONFIG_SYS_CS3_CTRL); |
| 82 | fbcs->csmr3 = CONFIG_SYS_CS3_MASK; | 83 | out_be32(&fbcs->csmr3, CONFIG_SYS_CS3_MASK); |
| 83 | #endif | 84 | #endif |
| 84 | 85 | ||
| 85 | #if (defined(CONFIG_SYS_CS4_BASE) && defined(CONFIG_SYS_CS4_MASK) && defined(CONFIG_SYS_CS4_CTRL)) | 86 | #if (defined(CONFIG_SYS_CS4_BASE) && defined(CONFIG_SYS_CS4_MASK) && defined(CONFIG_SYS_CS4_CTRL)) |
| 86 | fbcs->csar4 = CONFIG_SYS_CS4_BASE; | 87 | out_be32(&fbcs->csar4, CONFIG_SYS_CS4_BASE); |
| 87 | fbcs->cscr4 = CONFIG_SYS_CS4_CTRL; | 88 | out_be32(&fbcs->cscr4, CONFIG_SYS_CS4_CTRL); |
| 88 | fbcs->csmr4 = CONFIG_SYS_CS4_MASK; | 89 | out_be32(&fbcs->csmr4, CONFIG_SYS_CS4_MASK); |
| 89 | #endif | 90 | #endif |
| 90 | 91 | ||
| 91 | #if (defined(CONFIG_SYS_CS5_BASE) && defined(CONFIG_SYS_CS5_MASK) && defined(CONFIG_SYS_CS5_CTRL)) | 92 | #if (defined(CONFIG_SYS_CS5_BASE) && defined(CONFIG_SYS_CS5_MASK) && defined(CONFIG_SYS_CS5_CTRL)) |
| 92 | fbcs->csar5 = CONFIG_SYS_CS5_BASE; | 93 | out_be32(&fbcs->csar5, CONFIG_SYS_CS5_BASE); |
| 93 | fbcs->cscr5 = CONFIG_SYS_CS5_CTRL; | 94 | out_be32(&fbcs->cscr5, CONFIG_SYS_CS5_CTRL); |
| 94 | fbcs->csmr5 = CONFIG_SYS_CS5_MASK; | 95 | out_be32(&fbcs->csmr5, CONFIG_SYS_CS5_MASK); |
| 95 | #endif | 96 | #endif |
| 96 | 97 | ||
| 97 | #ifdef CONFIG_FSL_I2C | 98 | #ifdef CONFIG_FSL_I2C |
| 98 | gpio->par_feci2cirq = GPIO_PAR_FECI2CIRQ_SCL | GPIO_PAR_FECI2CIRQ_SDA; | 99 | out_be16(&gpio->par_feci2cirq, |
| 100 | GPIO_PAR_FECI2CIRQ_SCL | GPIO_PAR_FECI2CIRQ_SDA); | ||
| 99 | #endif | 101 | #endif |
| 100 | 102 | ||
| 101 | icache_enable(); | 103 | icache_enable(); |
| 102 | } | 104 | } |
| 103 | 105 | ||
| 104 | /* | 106 | /* |
| 105 | * initialize higher level parts of CPU like timers | 107 | * initialize higher level parts of CPU like timers |
| 106 | */ | 108 | */ |
| 107 | int cpu_init_r(void) | 109 | int cpu_init_r(void) |
| 108 | { | 110 | { |
| 109 | #if defined(CONFIG_CMD_NET) && defined(CONFIG_FSLDMAFEC) | 111 | #if defined(CONFIG_CMD_NET) && defined(CONFIG_FSLDMAFEC) |
| 110 | MCD_initDma((dmaRegs *) (MMAP_MCDMA), (void *)(MMAP_SRAM + 512), | 112 | MCD_initDma((dmaRegs *) (MMAP_MCDMA), (void *)(MMAP_SRAM + 512), |
| 111 | MCD_RELOC_TASKS); | 113 | MCD_RELOC_TASKS); |
| 112 | #endif | 114 | #endif |
| 113 | return (0); | 115 | return (0); |
| 114 | } | 116 | } |
| 115 | 117 | ||
| 116 | void uart_port_conf(int port) | 118 | void uart_port_conf(int port) |
| 117 | { | 119 | { |
| 118 | volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; | 120 | gpio_t *gpio = (gpio_t *) MMAP_GPIO; |
| 119 | volatile u8 *pscsicr = (u8 *) (CONFIG_SYS_UART_BASE + 0x40); | 121 | u8 *pscsicr = (u8 *) (CONFIG_SYS_UART_BASE + 0x40); |
| 120 | 122 | ||
| 121 | /* Setup Ports: */ | 123 | /* Setup Ports: */ |
| 122 | switch (port) { | 124 | switch (port) { |
| 123 | case 0: | 125 | case 0: |
| 124 | gpio->par_psc0 = (GPIO_PAR_PSC0_TXD0 | GPIO_PAR_PSC0_RXD0); | 126 | out_8(&gpio->par_psc0, GPIO_PAR_PSC0_TXD0 | GPIO_PAR_PSC0_RXD0); |
| 125 | break; | 127 | break; |
| 126 | case 1: | 128 | case 1: |
| 127 | gpio->par_psc1 = (GPIO_PAR_PSC1_TXD1 | GPIO_PAR_PSC1_RXD1); | 129 | out_8(&gpio->par_psc1, GPIO_PAR_PSC1_TXD1 | GPIO_PAR_PSC1_RXD1); |
| 128 | break; | 130 | break; |
| 129 | case 2: | 131 | case 2: |
| 130 | gpio->par_psc2 = (GPIO_PAR_PSC2_TXD2 | GPIO_PAR_PSC2_RXD2); | 132 | out_8(&gpio->par_psc2, GPIO_PAR_PSC2_TXD2 | GPIO_PAR_PSC2_RXD2); |
| 131 | break; | 133 | break; |
| 132 | case 3: | 134 | case 3: |
| 133 | gpio->par_psc3 = (GPIO_PAR_PSC3_TXD3 | GPIO_PAR_PSC3_RXD3); | 135 | out_8(&gpio->par_psc3, GPIO_PAR_PSC3_TXD3 | GPIO_PAR_PSC3_RXD3); |
| 134 | break; | 136 | break; |
| 135 | } | 137 | } |
| 136 | 138 | ||
| 137 | *pscsicr &= 0xF8; | 139 | clrbits_8(pscsicr, 0x07); |
| 138 | } | 140 | } |
| 139 | 141 | ||
| 140 | #if defined(CONFIG_CMD_NET) | 142 | #if defined(CONFIG_CMD_NET) |
| 141 | int fecpin_setclear(struct eth_device *dev, int setclear) | 143 | int fecpin_setclear(struct eth_device *dev, int setclear) |
| 142 | { | 144 | { |
| 143 | volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; | 145 | gpio_t *gpio = (gpio_t *) MMAP_GPIO; |
| 144 | struct fec_info_dma *info = (struct fec_info_dma *)dev->priv; | 146 | struct fec_info_dma *info = (struct fec_info_dma *)dev->priv; |
| 145 | 147 | ||
| 146 | if (setclear) { | 148 | if (setclear) { |
| 147 | if (info->iobase == CONFIG_SYS_FEC0_IOBASE) | 149 | if (info->iobase == CONFIG_SYS_FEC0_IOBASE) |
| 148 | gpio->par_feci2cirq |= 0xF000; | 150 | setbits_be16(&gpio->par_feci2cirq, 0xf000); |
| 149 | else | 151 | else |
| 150 | gpio->par_feci2cirq |= 0x0FC0; | 152 | setbits_be16(&gpio->par_feci2cirq, 0x0fc0); |
| 151 | } else { | 153 | } else { |
| 152 | if (info->iobase == CONFIG_SYS_FEC0_IOBASE) | 154 | if (info->iobase == CONFIG_SYS_FEC0_IOBASE) |
| 153 | gpio->par_feci2cirq &= 0x0FFF; | 155 | clrbits_be16(&gpio->par_feci2cirq, 0xf000); |
| 154 | else | 156 | else |
| 155 | gpio->par_feci2cirq &= 0xF03F; | 157 | clrbits_be16(&gpio->par_feci2cirq, 0x0fc0); |
| 156 | } | 158 | } |
| 157 | return 0; | 159 | return 0; |
| 158 | } | 160 | } |
| 159 | #endif | 161 | #endif |
| 160 | 162 |
arch/m68k/cpu/mcf547x_8x/interrupts.c
| 1 | /* | 1 | /* |
| 2 | * | 2 | * |
| 3 | * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. | 3 | * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc. |
| 4 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) | 4 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) |
| 5 | * | 5 | * |
| 6 | * See file CREDITS for list of people who contributed to this | 6 | * See file CREDITS for list of people who contributed to this |
| 7 | * project. | 7 | * project. |
| 8 | * | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License as | 10 | * modify it under the terms of the GNU General Public License as |
| 11 | * published by the Free Software Foundation; either version 2 of | 11 | * published by the Free Software Foundation; either version 2 of |
| 12 | * the License, or (at your option) any later version. | 12 | * the License, or (at your option) any later version. |
| 13 | * | 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, | 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. | 17 | * GNU General Public License for more details. |
| 18 | * | 18 | * |
| 19 | * You should have received a copy of the GNU General Public License | 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software | 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 22 | * MA 02111-1307 USA | 22 | * MA 02111-1307 USA |
| 23 | */ | 23 | */ |
| 24 | 24 | ||
| 25 | /* CPU specific interrupt routine */ | 25 | /* CPU specific interrupt routine */ |
| 26 | #include <common.h> | 26 | #include <common.h> |
| 27 | #include <asm/immap.h> | 27 | #include <asm/immap.h> |
| 28 | #include <asm/io.h> | ||
| 28 | 29 | ||
| 29 | int interrupt_init(void) | 30 | int interrupt_init(void) |
| 30 | { | 31 | { |
| 31 | volatile int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); | 32 | int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); |
| 32 | 33 | ||
| 33 | /* Make sure all interrupts are disabled */ | 34 | /* Make sure all interrupts are disabled */ |
| 34 | intp->imrh0 |= 0xFFFFFFFF; | 35 | setbits_be32(&intp->imrh0, 0xffffffff); |
| 35 | intp->imrl0 |= 0xFFFFFFFF; | 36 | setbits_be32(&intp->imrl0, 0xffffffff); |
| 36 | 37 | ||
| 37 | enable_interrupts(); | 38 | enable_interrupts(); |
| 38 | 39 | ||
| 39 | return 0; | 40 | return 0; |
| 40 | } | 41 | } |
| 41 | 42 | ||
| 42 | #if defined(CONFIG_SLTTMR) | 43 | #if defined(CONFIG_SLTTMR) |
| 43 | void dtimer_intr_setup(void) | 44 | void dtimer_intr_setup(void) |
| 44 | { | 45 | { |
| 45 | volatile int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); | 46 | int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); |
| 46 | 47 | ||
| 47 | intp->icr0[CONFIG_SYS_TMRINTR_NO] = CONFIG_SYS_TMRINTR_PRI; | 48 | out_8(&intp->icr0[CONFIG_SYS_TMRINTR_NO], CONFIG_SYS_TMRINTR_PRI); |
| 48 | intp->imrh0 &= ~CONFIG_SYS_TMRINTR_MASK; | 49 | clrbits_be32(&intp->imrh0, CONFIG_SYS_TMRINTR_MASK); |
| 49 | } | 50 | } |
| 50 | #endif | 51 | #endif |
| 51 | 52 |
arch/m68k/cpu/mcf547x_8x/pci.c
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. | 2 | * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc. |
| 3 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) | 3 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) |
| 4 | * | 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this | 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. | 6 | * project. |
| 7 | * | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or | 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as | 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of | 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. | 11 | * the License, or (at your option) any later version. |
| 12 | * | 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. | 16 | * GNU General Public License for more details. |
| 17 | * | 17 | * |
| 18 | * You should have received a copy of the GNU General Public License | 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software | 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | * MA 02111-1307 USA | 21 | * MA 02111-1307 USA |
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | /* | 24 | /* |
| 25 | * PCI Configuration space access support | 25 | * PCI Configuration space access support |
| 26 | */ | 26 | */ |
| 27 | #include <common.h> | 27 | #include <common.h> |
| 28 | #include <pci.h> | 28 | #include <pci.h> |
| 29 | #include <asm/io.h> | 29 | #include <asm/io.h> |
| 30 | #include <asm/immap.h> | 30 | #include <asm/immap.h> |
| 31 | 31 | ||
| 32 | #if defined(CONFIG_PCI) | 32 | #if defined(CONFIG_PCI) |
| 33 | /* System RAM mapped over PCI */ | 33 | /* System RAM mapped over PCI */ |
| 34 | #define CONFIG_SYS_PCI_SYS_MEM_BUS CONFIG_SYS_SDRAM_BASE | 34 | #define CONFIG_SYS_PCI_SYS_MEM_BUS CONFIG_SYS_SDRAM_BASE |
| 35 | #define CONFIG_SYS_PCI_SYS_MEM_PHYS CONFIG_SYS_SDRAM_BASE | 35 | #define CONFIG_SYS_PCI_SYS_MEM_PHYS CONFIG_SYS_SDRAM_BASE |
| 36 | #define CONFIG_SYS_PCI_SYS_MEM_SIZE (1024 * 1024 * 1024) | 36 | #define CONFIG_SYS_PCI_SYS_MEM_SIZE (1024 * 1024 * 1024) |
| 37 | 37 | ||
| 38 | #define cfg_read(val, addr, type, op) *val = op((type)(addr)); | 38 | #define cfg_read(val, addr, type, op) *val = op((type)(addr)); |
| 39 | #define cfg_write(val, addr, type, op) op((type *)(addr), (val)); | 39 | #define cfg_write(val, addr, type, op) op((type *)(addr), (val)); |
| 40 | 40 | ||
| 41 | #define PCI_OP(rw, size, type, op, mask) \ | 41 | #define PCI_OP(rw, size, type, op, mask) \ |
| 42 | int pci_##rw##_cfg_##size(struct pci_controller *hose, \ | 42 | int pci_##rw##_cfg_##size(struct pci_controller *hose, \ |
| 43 | pci_dev_t dev, int offset, type val) \ | 43 | pci_dev_t dev, int offset, type val) \ |
| 44 | { \ | 44 | { \ |
| 45 | u32 addr = 0; \ | 45 | u32 addr = 0; \ |
| 46 | u16 cfg_type = 0; \ | 46 | u16 cfg_type = 0; \ |
| 47 | addr = ((offset & 0xfc) | cfg_type | (dev) | 0x80000000); \ | 47 | addr = ((offset & 0xfc) | cfg_type | (dev) | 0x80000000); \ |
| 48 | out_be32(hose->cfg_addr, addr); \ | 48 | out_be32(hose->cfg_addr, addr); \ |
| 49 | cfg_##rw(val, hose->cfg_data + (offset & mask), type, op); \ | 49 | cfg_##rw(val, hose->cfg_data + (offset & mask), type, op); \ |
| 50 | __asm__ __volatile__("nop"); \ | 50 | __asm__ __volatile__("nop"); \ |
| 51 | __asm__ __volatile__("nop"); \ | 51 | __asm__ __volatile__("nop"); \ |
| 52 | out_be32(hose->cfg_addr, addr & 0x7fffffff); \ | 52 | out_be32(hose->cfg_addr, addr & 0x7fffffff); \ |
| 53 | return 0; \ | 53 | return 0; \ |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | PCI_OP(read, byte, u8 *, in_8, 3) | 56 | PCI_OP(read, byte, u8 *, in_8, 3) |
| 57 | PCI_OP(read, word, u16 *, in_le16, 2) | 57 | PCI_OP(read, word, u16 *, in_le16, 2) |
| 58 | PCI_OP(write, byte, u8, out_8, 3) | 58 | PCI_OP(write, byte, u8, out_8, 3) |
| 59 | PCI_OP(write, word, u16, out_le16, 2) | 59 | PCI_OP(write, word, u16, out_le16, 2) |
| 60 | PCI_OP(write, dword, u32, out_le32, 0) | 60 | PCI_OP(write, dword, u32, out_le32, 0) |
| 61 | 61 | ||
| 62 | int pci_read_cfg_dword(struct pci_controller *hose, pci_dev_t dev, | 62 | int pci_read_cfg_dword(struct pci_controller *hose, pci_dev_t dev, |
| 63 | int offset, u32 * val) | 63 | int offset, u32 * val) |
| 64 | { | 64 | { |
| 65 | u32 addr; | 65 | u32 addr; |
| 66 | u32 tmpv; | 66 | u32 tmpv; |
| 67 | u32 mask = 2; /* word access */ | 67 | u32 mask = 2; /* word access */ |
| 68 | /* Read lower 16 bits */ | 68 | /* Read lower 16 bits */ |
| 69 | addr = ((offset & 0xfc) | (dev) | 0x80000000); | 69 | addr = ((offset & 0xfc) | (dev) | 0x80000000); |
| 70 | out_be32(hose->cfg_addr, addr); | 70 | out_be32(hose->cfg_addr, addr); |
| 71 | *val = (u32) in_le16((u16 *) (hose->cfg_data + (offset & mask))); | 71 | *val = (u32) in_le16((u16 *) (hose->cfg_data + (offset & mask))); |
| 72 | __asm__ __volatile__("nop"); | 72 | __asm__ __volatile__("nop"); |
| 73 | out_be32(hose->cfg_addr, addr & 0x7fffffff); | 73 | out_be32(hose->cfg_addr, addr & 0x7fffffff); |
| 74 | 74 | ||
| 75 | /* Read upper 16 bits */ | 75 | /* Read upper 16 bits */ |
| 76 | offset += 2; | 76 | offset += 2; |
| 77 | addr = ((offset & 0xfc) | 1 | (dev) | 0x80000000); | 77 | addr = ((offset & 0xfc) | 1 | (dev) | 0x80000000); |
| 78 | out_be32(hose->cfg_addr, addr); | 78 | out_be32(hose->cfg_addr, addr); |
| 79 | tmpv = (u32) in_le16((u16 *) (hose->cfg_data + (offset & mask))); | 79 | tmpv = (u32) in_le16((u16 *) (hose->cfg_data + (offset & mask))); |
| 80 | __asm__ __volatile__("nop"); | 80 | __asm__ __volatile__("nop"); |
| 81 | out_be32(hose->cfg_addr, addr & 0x7fffffff); | 81 | out_be32(hose->cfg_addr, addr & 0x7fffffff); |
| 82 | 82 | ||
| 83 | /* combine results into dword value */ | 83 | /* combine results into dword value */ |
| 84 | *val = (tmpv << 16) | *val; | 84 | *val = (tmpv << 16) | *val; |
| 85 | 85 | ||
| 86 | return 0; | 86 | return 0; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | void pci_mcf547x_8x_init(struct pci_controller *hose) | 89 | void pci_mcf547x_8x_init(struct pci_controller *hose) |
| 90 | { | 90 | { |
| 91 | volatile pci_t *pci = (volatile pci_t *) MMAP_PCI; | 91 | pci_t *pci = (pci_t *) MMAP_PCI; |
| 92 | volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; | 92 | gpio_t *gpio = (gpio_t *) MMAP_GPIO; |
| 93 | 93 | ||
| 94 | /* Port configuration */ | 94 | /* Port configuration */ |
| 95 | gpio->par_pcibg = | 95 | out_be16(&gpio->par_pcibg, |
| 96 | GPIO_PAR_PCIBG_PCIBG0(3) | GPIO_PAR_PCIBG_PCIBG1(3) | | 96 | GPIO_PAR_PCIBG_PCIBG0(3) | GPIO_PAR_PCIBG_PCIBG1(3) | |
| 97 | GPIO_PAR_PCIBG_PCIBG2(3) | GPIO_PAR_PCIBG_PCIBG3(3) | | 97 | GPIO_PAR_PCIBG_PCIBG2(3) | GPIO_PAR_PCIBG_PCIBG3(3) | |
| 98 | GPIO_PAR_PCIBG_PCIBG4(3); | 98 | GPIO_PAR_PCIBG_PCIBG4(3)); |
| 99 | gpio->par_pcibr = | 99 | out_be16(&gpio->par_pcibr, |
| 100 | GPIO_PAR_PCIBR_PCIBR0(3) | GPIO_PAR_PCIBR_PCIBR1(3) | | 100 | GPIO_PAR_PCIBR_PCIBR0(3) | GPIO_PAR_PCIBR_PCIBR1(3) | |
| 101 | GPIO_PAR_PCIBR_PCIBR2(3) | GPIO_PAR_PCIBR_PCIBR3(3) | | 101 | GPIO_PAR_PCIBR_PCIBR2(3) | GPIO_PAR_PCIBR_PCIBR3(3) | |
| 102 | GPIO_PAR_PCIBR_PCIBR4(3); | 102 | GPIO_PAR_PCIBR_PCIBR4(3)); |
| 103 | 103 | ||
| 104 | /* Assert reset bit */ | 104 | /* Assert reset bit */ |
| 105 | pci->gscr |= PCI_GSCR_PR; | 105 | setbits_be32(&pci->gscr, PCI_GSCR_PR); |
| 106 | 106 | ||
| 107 | pci->tcr1 = PCI_TCR1_P; | 107 | out_be32(&pci->tcr1, PCI_TCR1_P); |
| 108 | 108 | ||
| 109 | /* Initiator windows */ | 109 | /* Initiator windows */ |
| 110 | pci->iw0btar = CONFIG_SYS_PCI_MEM_PHYS | (CONFIG_SYS_PCI_MEM_PHYS >> 16); | 110 | out_be32(&pci->iw0btar, |
| 111 | pci->iw1btar = CONFIG_SYS_PCI_IO_PHYS | (CONFIG_SYS_PCI_IO_PHYS >> 16); | 111 | CONFIG_SYS_PCI_MEM_PHYS | (CONFIG_SYS_PCI_MEM_PHYS >> 16)); |
| 112 | pci->iw2btar = CONFIG_SYS_PCI_CFG_PHYS | (CONFIG_SYS_PCI_CFG_PHYS >> 16); | 112 | out_be32(&pci->iw1btar, |
| 113 | CONFIG_SYS_PCI_IO_PHYS | (CONFIG_SYS_PCI_IO_PHYS >> 16)); | ||
| 114 | out_be32(&pci->iw2btar, | ||
| 115 | CONFIG_SYS_PCI_CFG_PHYS | (CONFIG_SYS_PCI_CFG_PHYS >> 16)); | ||
| 113 | 116 | ||
| 114 | pci->iwcr = | 117 | out_be32(&pci->iwcr, |
| 115 | PCI_IWCR_W0C_EN | PCI_IWCR_W1C_EN | PCI_IWCR_W1C_IO | | 118 | PCI_IWCR_W0C_EN | PCI_IWCR_W1C_EN | PCI_IWCR_W1C_IO | |
| 116 | PCI_IWCR_W2C_EN | PCI_IWCR_W2C_IO; | 119 | PCI_IWCR_W2C_EN | PCI_IWCR_W2C_IO); |
| 117 | 120 | ||
| 118 | pci->icr = 0; | 121 | out_be32(&pci->icr, 0); |
| 119 | 122 | ||
| 120 | /* Enable bus master and mem access */ | 123 | /* Enable bus master and mem access */ |
| 121 | pci->scr = PCI_SCR_B | PCI_SCR_M; | 124 | out_be32(&pci->scr, PCI_SCR_B | PCI_SCR_M); |
| 122 | 125 | ||
| 123 | /* Cache line size and master latency */ | 126 | /* Cache line size and master latency */ |
| 124 | pci->cr1 = PCI_CR1_CLS(8) | PCI_CR1_LTMR(0xF8); | 127 | out_be32(&pci->cr1, PCI_CR1_CLS(8) | PCI_CR1_LTMR(0xf8)); |
| 125 | pci->cr2 = 0; | 128 | out_be32(&pci->cr2, 0); |
| 126 | 129 | ||
| 127 | #ifdef CONFIG_SYS_PCI_BAR0 | 130 | #ifdef CONFIG_SYS_PCI_BAR0 |
| 128 | pci->bar0 = PCI_BAR_BAR0(CONFIG_SYS_PCI_BAR0); | 131 | out_be32(&pci->bar0, PCI_BAR_BAR0(CONFIG_SYS_PCI_BAR0)); |
| 129 | pci->tbatr0a = CONFIG_SYS_PCI_TBATR0 | PCI_TBATR_EN; | 132 | out_be32(&pci->tbatr0a, CONFIG_SYS_PCI_TBATR0 | PCI_TBATR_EN); |
| 130 | #endif | 133 | #endif |
| 131 | #ifdef CONFIG_SYS_PCI_BAR1 | 134 | #ifdef CONFIG_SYS_PCI_BAR1 |
| 132 | pci->bar1 = PCI_BAR_BAR1(CONFIG_SYS_PCI_BAR1); | 135 | out_be32(&pci->bar1, PCI_BAR_BAR1(CONFIG_SYS_PCI_BAR1)); |
| 133 | pci->tbatr1a = CONFIG_SYS_PCI_TBATR1 | PCI_TBATR_EN; | 136 | out_be32(&pci->tbatr1a, CONFIG_SYS_PCI_TBATR1 | PCI_TBATR_EN); |
| 134 | #endif | 137 | #endif |
| 135 | 138 | ||
| 136 | /* Deassert reset bit */ | 139 | /* Deassert reset bit */ |
| 137 | pci->gscr &= ~PCI_GSCR_PR; | 140 | clrbits_be32(&pci->gscr, PCI_GSCR_PR); |
| 138 | udelay(1000); | 141 | udelay(1000); |
| 139 | 142 | ||
| 140 | /* Enable PCI bus master support */ | 143 | /* Enable PCI bus master support */ |
| 141 | hose->first_busno = 0; | 144 | hose->first_busno = 0; |
| 142 | hose->last_busno = 0xff; | 145 | hose->last_busno = 0xff; |
| 143 | 146 | ||
| 144 | pci_set_region(hose->regions + 0, CONFIG_SYS_PCI_MEM_BUS, CONFIG_SYS_PCI_MEM_PHYS, | 147 | pci_set_region(hose->regions + 0, CONFIG_SYS_PCI_MEM_BUS, CONFIG_SYS_PCI_MEM_PHYS, |
| 145 | CONFIG_SYS_PCI_MEM_SIZE, PCI_REGION_MEM); | 148 | CONFIG_SYS_PCI_MEM_SIZE, PCI_REGION_MEM); |
| 146 | 149 | ||
| 147 | pci_set_region(hose->regions + 1, CONFIG_SYS_PCI_IO_BUS, CONFIG_SYS_PCI_IO_PHYS, | 150 | pci_set_region(hose->regions + 1, CONFIG_SYS_PCI_IO_BUS, CONFIG_SYS_PCI_IO_PHYS, |
| 148 | CONFIG_SYS_PCI_IO_SIZE, PCI_REGION_IO); | 151 | CONFIG_SYS_PCI_IO_SIZE, PCI_REGION_IO); |
| 149 | 152 | ||
| 150 | pci_set_region(hose->regions + 2, CONFIG_SYS_PCI_SYS_MEM_BUS, | 153 | pci_set_region(hose->regions + 2, CONFIG_SYS_PCI_SYS_MEM_BUS, |
| 151 | CONFIG_SYS_PCI_SYS_MEM_PHYS, CONFIG_SYS_PCI_SYS_MEM_SIZE, | 154 | CONFIG_SYS_PCI_SYS_MEM_PHYS, CONFIG_SYS_PCI_SYS_MEM_SIZE, |
| 152 | PCI_REGION_MEM | PCI_REGION_SYS_MEMORY); | 155 | PCI_REGION_MEM | PCI_REGION_SYS_MEMORY); |
| 153 | 156 | ||
| 154 | hose->region_count = 3; | 157 | hose->region_count = 3; |
| 155 | 158 | ||
| 156 | hose->cfg_addr = &(pci->car); | 159 | hose->cfg_addr = &(pci->car); |
| 157 | hose->cfg_data = (volatile unsigned char *)CONFIG_SYS_PCI_CFG_BUS; | 160 | hose->cfg_data = (volatile unsigned char *)CONFIG_SYS_PCI_CFG_BUS; |
| 158 | 161 | ||
| 159 | pci_set_ops(hose, pci_read_cfg_byte, pci_read_cfg_word, | 162 | pci_set_ops(hose, pci_read_cfg_byte, pci_read_cfg_word, |
| 160 | pci_read_cfg_dword, pci_write_cfg_byte, pci_write_cfg_word, | 163 | pci_read_cfg_dword, pci_write_cfg_byte, pci_write_cfg_word, |
| 161 | pci_write_cfg_dword); | 164 | pci_write_cfg_dword); |
| 162 | 165 | ||
| 163 | /* Hose scan */ | 166 | /* Hose scan */ |
| 164 | pci_register_hose(hose); | 167 | pci_register_hose(hose); |
| 165 | hose->last_busno = pci_hose_scan(hose); | 168 | hose->last_busno = pci_hose_scan(hose); |
| 166 | } | 169 | } |
| 167 | #endif /* CONFIG_PCI */ | 170 | #endif /* CONFIG_PCI */ |
| 168 | 171 |
arch/m68k/cpu/mcf547x_8x/slicetimer.c
| 1 | /* | 1 | /* |
| 2 | * (C) Copyright 2007 Freescale Semiconductor, Inc. | 2 | * (C) Copyright 2007, 2012 Freescale Semiconductor, Inc. |
| 3 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) | 3 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) |
| 4 | * | 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this | 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. | 6 | * project. |
| 7 | * | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or | 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as | 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of | 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. | 11 | * the License, or (at your option) any later version. |
| 12 | * | 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. | 16 | * GNU General Public License for more details. |
| 17 | * | 17 | * |
| 18 | * You should have received a copy of the GNU General Public License | 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software | 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | * MA 02111-1307 USA | 21 | * MA 02111-1307 USA |
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | #include <common.h> | 24 | #include <common.h> |
| 25 | 25 | ||
| 26 | #include <asm/timer.h> | 26 | #include <asm/timer.h> |
| 27 | #include <asm/immap.h> | 27 | #include <asm/immap.h> |
| 28 | #include <asm/io.h> | ||
| 28 | 29 | ||
| 29 | DECLARE_GLOBAL_DATA_PTR; | 30 | DECLARE_GLOBAL_DATA_PTR; |
| 30 | 31 | ||
| 31 | static ulong timestamp; | 32 | static ulong timestamp; |
| 32 | 33 | ||
| 33 | #if defined(CONFIG_SLTTMR) | 34 | #if defined(CONFIG_SLTTMR) |
| 34 | #ifndef CONFIG_SYS_UDELAY_BASE | 35 | #ifndef CONFIG_SYS_UDELAY_BASE |
| 35 | # error "uDelay base not defined!" | 36 | # error "uDelay base not defined!" |
| 36 | #endif | 37 | #endif |
| 37 | 38 | ||
| 38 | #if !defined(CONFIG_SYS_TMR_BASE) || !defined(CONFIG_SYS_INTR_BASE) || !defined(CONFIG_SYS_TMRINTR_NO) || !defined(CONFIG_SYS_TMRINTR_MASK) | 39 | #if !defined(CONFIG_SYS_TMR_BASE) || !defined(CONFIG_SYS_INTR_BASE) || !defined(CONFIG_SYS_TMRINTR_NO) || !defined(CONFIG_SYS_TMRINTR_MASK) |
| 39 | # error "TMR_BASE, INTR_BASE, TMRINTR_NO or TMRINTR_MASk not defined!" | 40 | # error "TMR_BASE, INTR_BASE, TMRINTR_NO or TMRINTR_MASk not defined!" |
| 40 | #endif | 41 | #endif |
| 41 | extern void dtimer_intr_setup(void); | 42 | extern void dtimer_intr_setup(void); |
| 42 | 43 | ||
| 43 | void __udelay(unsigned long usec) | 44 | void __udelay(unsigned long usec) |
| 44 | { | 45 | { |
| 45 | volatile slt_t *timerp = (slt_t *) (CONFIG_SYS_UDELAY_BASE); | 46 | slt_t *timerp = (slt_t *) (CONFIG_SYS_UDELAY_BASE); |
| 46 | u32 now, freq; | 47 | u32 now, freq; |
| 47 | 48 | ||
| 48 | /* 1 us period */ | 49 | /* 1 us period */ |
| 49 | freq = CONFIG_SYS_TIMER_PRESCALER; | 50 | freq = CONFIG_SYS_TIMER_PRESCALER; |
| 50 | 51 | ||
| 51 | timerp->cr = 0; /* Disable */ | 52 | /* Disable */ |
| 52 | timerp->tcnt = usec * freq; | 53 | out_be32(&timerp->cr, 0); |
| 53 | timerp->cr = SLT_CR_TEN; | 54 | out_be32(&timerp->tcnt, usec * freq); |
| 55 | out_be32(&timerp->cr, SLT_CR_TEN); | ||
| 54 | 56 | ||
| 55 | now = timerp->cnt; | 57 | now = in_be32(&timerp->cnt); |
| 56 | while (now != 0) | 58 | while (now != 0) |
| 57 | now = timerp->cnt; | 59 | now = in_be32(&timerp->cnt); |
| 58 | 60 | ||
| 59 | timerp->sr |= SLT_SR_ST; | 61 | setbits_be32(&timerp->sr, SLT_SR_ST); |
| 60 | timerp->cr = 0; | 62 | out_be32(&timerp->cr, 0); |
| 61 | } | 63 | } |
| 62 | 64 | ||
| 63 | void dtimer_interrupt(void *not_used) | 65 | void dtimer_interrupt(void *not_used) |
| 64 | { | 66 | { |
| 65 | volatile slt_t *timerp = (slt_t *) (CONFIG_SYS_TMR_BASE); | 67 | slt_t *timerp = (slt_t *) (CONFIG_SYS_TMR_BASE); |
| 66 | 68 | ||
| 67 | /* check for timer interrupt asserted */ | 69 | /* check for timer interrupt asserted */ |
| 68 | if ((CONFIG_SYS_TMRPND_REG & CONFIG_SYS_TMRINTR_MASK) == CONFIG_SYS_TMRINTR_PEND) { | 70 | if ((CONFIG_SYS_TMRPND_REG & CONFIG_SYS_TMRINTR_MASK) == CONFIG_SYS_TMRINTR_PEND) { |
| 69 | timerp->sr |= SLT_SR_ST; | 71 | setbits_be32(&timerp->sr, SLT_SR_ST); |
| 70 | timestamp++; | 72 | timestamp++; |
| 71 | return; | 73 | return; |
| 72 | } | 74 | } |
| 73 | } | 75 | } |
| 74 | 76 | ||
| 75 | int timer_init(void) | 77 | int timer_init(void) |
| 76 | { | 78 | { |
| 77 | volatile slt_t *timerp = (slt_t *) (CONFIG_SYS_TMR_BASE); | 79 | slt_t *timerp = (slt_t *) (CONFIG_SYS_TMR_BASE); |
| 78 | 80 | ||
| 79 | timestamp = 0; | 81 | timestamp = 0; |
| 80 | 82 | ||
| 81 | timerp->cr = 0; /* disable timer */ | 83 | /* disable timer */ |
| 82 | timerp->tcnt = 0; | 84 | out_be32(&timerp->cr, 0); |
| 83 | timerp->sr = SLT_SR_BE | SLT_SR_ST; /* clear status */ | 85 | out_be32(&timerp->tcnt, 0); |
| 86 | /* clear status */ | ||
| 87 | out_be32(&timerp->sr, SLT_SR_BE | SLT_SR_ST); | ||
| 84 | 88 | ||
| 85 | /* initialize and enable timer interrupt */ | 89 | /* initialize and enable timer interrupt */ |
| 86 | irq_install_handler(CONFIG_SYS_TMRINTR_NO, dtimer_interrupt, 0); | 90 | irq_install_handler(CONFIG_SYS_TMRINTR_NO, dtimer_interrupt, 0); |
| 87 | 91 | ||
| 88 | /* Interrupt every ms */ | 92 | /* Interrupt every ms */ |
| 89 | timerp->tcnt = 1000 * CONFIG_SYS_TIMER_PRESCALER; | 93 | out_be32(&timerp->tcnt, 1000 * CONFIG_SYS_TIMER_PRESCALER); |
| 90 | 94 | ||
| 91 | dtimer_intr_setup(); | 95 | dtimer_intr_setup(); |
| 92 | 96 | ||
| 93 | /* set a period of 1us, set timer mode to restart and | 97 | /* set a period of 1us, set timer mode to restart and |
| 94 | enable timer and interrupt */ | 98 | enable timer and interrupt */ |
| 95 | timerp->cr = SLT_CR_RUN | SLT_CR_IEN | SLT_CR_TEN; | 99 | out_be32(&timerp->cr, SLT_CR_RUN | SLT_CR_IEN | SLT_CR_TEN); |
| 96 | return 0; | 100 | return 0; |
| 97 | } | 101 | } |
| 98 | 102 | ||
| 99 | ulong get_timer(ulong base) | 103 | ulong get_timer(ulong base) |
| 100 | { | 104 | { |
| 101 | return (timestamp - base); | 105 | return (timestamp - base); |
| 102 | } | 106 | } |
| 103 | 107 | ||
| 104 | #endif /* CONFIG_SLTTMR */ | 108 | #endif /* CONFIG_SLTTMR */ |
| 105 | 109 |
board/freescale/m547xevb/m547xevb.c
| 1 | /* | 1 | /* |
| 2 | * (C) Copyright 2000-2003 | 2 | * (C) Copyright 2000-2003 |
| 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. | 5 | * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc. |
| 6 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) | 6 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) |
| 7 | * | 7 | * |
| 8 | * See file CREDITS for list of people who contributed to this | 8 | * See file CREDITS for list of people who contributed to this |
| 9 | * project. | 9 | * project. |
| 10 | * | 10 | * |
| 11 | * This program is free software; you can redistribute it and/or | 11 | * This program is free software; you can redistribute it and/or |
| 12 | * modify it under the terms of the GNU General Public License as | 12 | * modify it under the terms of the GNU General Public License as |
| 13 | * published by the Free Software Foundation; either version 2 of | 13 | * published by the Free Software Foundation; either version 2 of |
| 14 | * the License, or (at your option) any later version. | 14 | * the License, or (at your option) any later version. |
| 15 | * | 15 | * |
| 16 | * This program is distributed in the hope that it will be useful, | 16 | * This program is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. | 19 | * GNU General Public License for more details. |
| 20 | * | 20 | * |
| 21 | * You should have received a copy of the GNU General Public License | 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software | 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 24 | * MA 02111-1307 USA | 24 | * MA 02111-1307 USA |
| 25 | */ | 25 | */ |
| 26 | 26 | ||
| 27 | #include <config.h> | 27 | #include <config.h> |
| 28 | #include <common.h> | 28 | #include <common.h> |
| 29 | #include <pci.h> | 29 | #include <pci.h> |
| 30 | #include <asm/immap.h> | 30 | #include <asm/immap.h> |
| 31 | #include <asm/io.h> | ||
| 31 | 32 | ||
| 32 | DECLARE_GLOBAL_DATA_PTR; | 33 | DECLARE_GLOBAL_DATA_PTR; |
| 33 | 34 | ||
| 34 | int checkboard(void) | 35 | int checkboard(void) |
| 35 | { | 36 | { |
| 36 | puts("Board: "); | 37 | puts("Board: "); |
| 37 | puts("Freescale FireEngine 5475 EVB\n"); | 38 | puts("Freescale FireEngine 5475 EVB\n"); |
| 38 | return 0; | 39 | return 0; |
| 39 | }; | 40 | }; |
| 40 | 41 | ||
| 41 | phys_size_t initdram(int board_type) | 42 | phys_size_t initdram(int board_type) |
| 42 | { | 43 | { |
| 43 | volatile siu_t *siu = (siu_t *) (MMAP_SIU); | 44 | siu_t *siu = (siu_t *) (MMAP_SIU); |
| 44 | volatile sdram_t *sdram = (volatile sdram_t *)(MMAP_SDRAM); | 45 | sdram_t *sdram = (sdram_t *)(MMAP_SDRAM); |
| 45 | u32 dramsize, i; | 46 | u32 dramsize, i; |
| 46 | #ifdef CONFIG_SYS_DRAMSZ1 | 47 | #ifdef CONFIG_SYS_DRAMSZ1 |
| 47 | u32 temp; | 48 | u32 temp; |
| 48 | #endif | 49 | #endif |
| 49 | 50 | ||
| 50 | siu->drv = CONFIG_SYS_SDRAM_DRVSTRENGTH; | 51 | out_be32(&siu->drv, CONFIG_SYS_SDRAM_DRVSTRENGTH); |
| 51 | 52 | ||
| 52 | dramsize = CONFIG_SYS_DRAMSZ * 0x100000; | 53 | dramsize = CONFIG_SYS_DRAMSZ * 0x100000; |
| 53 | for (i = 0x13; i < 0x20; i++) { | 54 | for (i = 0x13; i < 0x20; i++) { |
| 54 | if (dramsize == (1 << i)) | 55 | if (dramsize == (1 << i)) |
| 55 | break; | 56 | break; |
| 56 | } | 57 | } |
| 57 | i--; | 58 | i--; |
| 58 | siu->cs0cfg = (CONFIG_SYS_SDRAM_BASE | i); | 59 | out_be32(&siu->cs0cfg, CONFIG_SYS_SDRAM_BASE | i); |
| 59 | 60 | ||
| 60 | #ifdef CONFIG_SYS_DRAMSZ1 | 61 | #ifdef CONFIG_SYS_DRAMSZ1 |
| 61 | temp = CONFIG_SYS_DRAMSZ1 * 0x100000; | 62 | temp = CONFIG_SYS_DRAMSZ1 * 0x100000; |
| 62 | for (i = 0x13; i < 0x20; i++) { | 63 | for (i = 0x13; i < 0x20; i++) { |
| 63 | if (temp == (1 << i)) | 64 | if (temp == (1 << i)) |
| 64 | break; | 65 | break; |
| 65 | } | 66 | } |
| 66 | i--; | 67 | i--; |
| 67 | dramsize += temp; | 68 | dramsize += temp; |
| 68 | siu->cs1cfg = ((CONFIG_SYS_SDRAM_BASE + temp) | i); | 69 | out_be32(&siu->cs1cfg, (CONFIG_SYS_SDRAM_BASE + temp) | i); |
| 69 | #endif | 70 | #endif |
| 70 | 71 | ||
| 71 | sdram->cfg1 = CONFIG_SYS_SDRAM_CFG1; | 72 | out_be32(&sdram->cfg1, CONFIG_SYS_SDRAM_CFG1); |
| 72 | sdram->cfg2 = CONFIG_SYS_SDRAM_CFG2; | 73 | out_be32(&sdram->cfg2, CONFIG_SYS_SDRAM_CFG2); |
| 73 | 74 | ||
| 74 | /* Issue PALL */ | 75 | /* Issue PALL */ |
| 75 | sdram->ctrl = CONFIG_SYS_SDRAM_CTRL | 2; | 76 | out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 2); |
| 76 | 77 | ||
| 77 | /* Issue LEMR */ | 78 | /* Issue LEMR */ |
| 78 | sdram->mode = CONFIG_SYS_SDRAM_EMOD; | 79 | out_be32(&sdram->mode, CONFIG_SYS_SDRAM_EMOD); |
| 79 | sdram->mode = (CONFIG_SYS_SDRAM_MODE | 0x04000000); | 80 | out_be32(&sdram->mode, CONFIG_SYS_SDRAM_MODE | 0x04000000); |
| 80 | 81 | ||
| 81 | udelay(500); | 82 | udelay(500); |
| 82 | 83 | ||
| 83 | /* Issue PALL */ | 84 | /* Issue PALL */ |
| 84 | sdram->ctrl = (CONFIG_SYS_SDRAM_CTRL | 2); | 85 | out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 2); |
| 85 | 86 | ||
| 86 | /* Perform two refresh cycles */ | 87 | /* Perform two refresh cycles */ |
| 87 | sdram->ctrl = CONFIG_SYS_SDRAM_CTRL | 4; | 88 | out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 4); |
| 88 | sdram->ctrl = CONFIG_SYS_SDRAM_CTRL | 4; | 89 | out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 4); |
| 89 | 90 | ||
| 90 | sdram->mode = CONFIG_SYS_SDRAM_MODE; | 91 | out_be32(&sdram->mode, CONFIG_SYS_SDRAM_MODE); |
| 91 | 92 | ||
| 92 | sdram->ctrl = (CONFIG_SYS_SDRAM_CTRL & ~0x80000000) | 0x10000F00; | 93 | out_be32(&sdram->ctrl, |
| 94 | (CONFIG_SYS_SDRAM_CTRL & ~0x80000000) | 0x10000F00); | ||
| 93 | 95 | ||
| 94 | udelay(100); | 96 | udelay(100); |
| 95 | 97 | ||
| 96 | return dramsize; | 98 | return dramsize; |
| 97 | }; | 99 | }; |
| 98 | 100 | ||
| 99 | int testdram(void) | 101 | int testdram(void) |
| 100 | { | 102 | { |
| 101 | /* TODO: XXX XXX XXX */ | 103 | /* TODO: XXX XXX XXX */ |
| 102 | printf("DRAM test not implemented!\n"); | 104 | printf("DRAM test not implemented!\n"); |
| 103 | 105 | ||
| 104 | return (0); | 106 | return (0); |
| 105 | } | 107 | } |
| 106 | 108 | ||
| 107 | #if defined(CONFIG_PCI) | 109 | #if defined(CONFIG_PCI) |
| 108 | /* | 110 | /* |
| 109 | * Initialize PCI devices, report devices found. | 111 | * Initialize PCI devices, report devices found. |
| 110 | */ | 112 | */ |
| 111 | static struct pci_controller hose; | 113 | static struct pci_controller hose; |
| 112 | extern void pci_mcf547x_8x_init(struct pci_controller *hose); | 114 | extern void pci_mcf547x_8x_init(struct pci_controller *hose); |
| 113 | 115 | ||
| 114 | void pci_init_board(void) | 116 | void pci_init_board(void) |
| 115 | { | 117 | { |
| 116 | pci_mcf547x_8x_init(&hose); | 118 | pci_mcf547x_8x_init(&hose); |
| 117 | } | 119 | } |
| 118 | #endif /* CONFIG_PCI */ | 120 | #endif /* CONFIG_PCI */ |
| 119 | 121 |
board/freescale/m548xevb/m548xevb.c
| 1 | /* | 1 | /* |
| 2 | * (C) Copyright 2000-2003 | 2 | * (C) Copyright 2000-2003 |
| 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. | 5 | * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc. |
| 6 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) | 6 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) |
| 7 | * | 7 | * |
| 8 | * See file CREDITS for list of people who contributed to this | 8 | * See file CREDITS for list of people who contributed to this |
| 9 | * project. | 9 | * project. |
| 10 | * | 10 | * |
| 11 | * This program is free software; you can redistribute it and/or | 11 | * This program is free software; you can redistribute it and/or |
| 12 | * modify it under the terms of the GNU General Public License as | 12 | * modify it under the terms of the GNU General Public License as |
| 13 | * published by the Free Software Foundation; either version 2 of | 13 | * published by the Free Software Foundation; either version 2 of |
| 14 | * the License, or (at your option) any later version. | 14 | * the License, or (at your option) any later version. |
| 15 | * | 15 | * |
| 16 | * This program is distributed in the hope that it will be useful, | 16 | * This program is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. | 19 | * GNU General Public License for more details. |
| 20 | * | 20 | * |
| 21 | * You should have received a copy of the GNU General Public License | 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software | 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 24 | * MA 02111-1307 USA | 24 | * MA 02111-1307 USA |
| 25 | */ | 25 | */ |
| 26 | 26 | ||
| 27 | #include <config.h> | 27 | #include <config.h> |
| 28 | #include <common.h> | 28 | #include <common.h> |
| 29 | #include <pci.h> | 29 | #include <pci.h> |
| 30 | #include <asm/immap.h> | 30 | #include <asm/immap.h> |
| 31 | #include <asm/io.h> | ||
| 31 | 32 | ||
| 32 | DECLARE_GLOBAL_DATA_PTR; | 33 | DECLARE_GLOBAL_DATA_PTR; |
| 33 | 34 | ||
| 34 | int checkboard(void) | 35 | int checkboard(void) |
| 35 | { | 36 | { |
| 36 | puts("Board: "); | 37 | puts("Board: "); |
| 37 | puts("Freescale FireEngine 5485 EVB\n"); | 38 | puts("Freescale FireEngine 5485 EVB\n"); |
| 38 | return 0; | 39 | return 0; |
| 39 | }; | 40 | }; |
| 40 | 41 | ||
| 41 | phys_size_t initdram(int board_type) | 42 | phys_size_t initdram(int board_type) |
| 42 | { | 43 | { |
| 43 | volatile siu_t *siu = (siu_t *) (MMAP_SIU); | 44 | siu_t *siu = (siu_t *) (MMAP_SIU); |
| 44 | volatile sdram_t *sdram = (volatile sdram_t *)(MMAP_SDRAM); | 45 | sdram_t *sdram = (sdram_t *)(MMAP_SDRAM); |
| 45 | u32 dramsize, i; | 46 | u32 dramsize, i; |
| 46 | #ifdef CONFIG_SYS_DRAMSZ1 | 47 | #ifdef CONFIG_SYS_DRAMSZ1 |
| 47 | u32 temp; | 48 | u32 temp; |
| 48 | #endif | 49 | #endif |
| 49 | 50 | ||
| 50 | siu->drv = CONFIG_SYS_SDRAM_DRVSTRENGTH; | 51 | out_be32(&siu->drv, CONFIG_SYS_SDRAM_DRVSTRENGTH); |
| 51 | 52 | ||
| 52 | dramsize = CONFIG_SYS_DRAMSZ * 0x100000; | 53 | dramsize = CONFIG_SYS_DRAMSZ * 0x100000; |
| 53 | for (i = 0x13; i < 0x20; i++) { | 54 | for (i = 0x13; i < 0x20; i++) { |
| 54 | if (dramsize == (1 << i)) | 55 | if (dramsize == (1 << i)) |
| 55 | break; | 56 | break; |
| 56 | } | 57 | } |
| 57 | i--; | 58 | i--; |
| 58 | siu->cs0cfg = (CONFIG_SYS_SDRAM_BASE | i); | 59 | out_be32(&siu->cs0cfg, CONFIG_SYS_SDRAM_BASE | i); |
| 59 | 60 | ||
| 60 | #ifdef CONFIG_SYS_DRAMSZ1 | 61 | #ifdef CONFIG_SYS_DRAMSZ1 |
| 61 | temp = CONFIG_SYS_DRAMSZ1 * 0x100000; | 62 | temp = CONFIG_SYS_DRAMSZ1 * 0x100000; |
| 62 | for (i = 0x13; i < 0x20; i++) { | 63 | for (i = 0x13; i < 0x20; i++) { |
| 63 | if (temp == (1 << i)) | 64 | if (temp == (1 << i)) |
| 64 | break; | 65 | break; |
| 65 | } | 66 | } |
| 66 | i--; | 67 | i--; |
| 67 | dramsize += temp; | 68 | dramsize += temp; |
| 68 | siu->cs1cfg = ((CONFIG_SYS_SDRAM_BASE + temp) | i); | 69 | out_be32(&siu->cs1cfg, (CONFIG_SYS_SDRAM_BASE + temp) | i); |
| 69 | #endif | 70 | #endif |
| 70 | 71 | ||
| 71 | sdram->cfg1 = CONFIG_SYS_SDRAM_CFG1; | 72 | out_be32(&sdram->cfg1, CONFIG_SYS_SDRAM_CFG1); |
| 72 | sdram->cfg2 = CONFIG_SYS_SDRAM_CFG2; | 73 | out_be32(&sdram->cfg2, CONFIG_SYS_SDRAM_CFG2); |
| 73 | 74 | ||
| 74 | /* Issue PALL */ | 75 | /* Issue PALL */ |
| 75 | sdram->ctrl = CONFIG_SYS_SDRAM_CTRL | 2; | 76 | out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 2); |
| 76 | 77 | ||
| 77 | /* Issue LEMR */ | 78 | /* Issue LEMR */ |
| 78 | sdram->mode = CONFIG_SYS_SDRAM_EMOD; | 79 | out_be32(&sdram->mode, CONFIG_SYS_SDRAM_EMOD); |
| 79 | sdram->mode = (CONFIG_SYS_SDRAM_MODE | 0x04000000); | 80 | out_be32(&sdram->mode, CONFIG_SYS_SDRAM_MODE | 0x04000000); |
| 80 | 81 | ||
| 81 | udelay(500); | 82 | udelay(500); |
| 82 | 83 | ||
| 83 | /* Issue PALL */ | 84 | /* Issue PALL */ |
| 84 | sdram->ctrl = (CONFIG_SYS_SDRAM_CTRL | 2); | 85 | out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 2); |
| 85 | 86 | ||
| 86 | /* Perform two refresh cycles */ | 87 | /* Perform two refresh cycles */ |
| 87 | sdram->ctrl = CONFIG_SYS_SDRAM_CTRL | 4; | 88 | out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 4); |
| 88 | sdram->ctrl = CONFIG_SYS_SDRAM_CTRL | 4; | 89 | out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 4); |
| 89 | 90 | ||
| 90 | sdram->mode = CONFIG_SYS_SDRAM_MODE; | 91 | out_be32(&sdram->mode, CONFIG_SYS_SDRAM_MODE); |
| 91 | 92 | ||
| 92 | sdram->ctrl = (CONFIG_SYS_SDRAM_CTRL & ~0x80000000) | 0x10000F00; | 93 | out_be32(&sdram->ctrl, |
| 94 | (CONFIG_SYS_SDRAM_CTRL & ~0x80000000) | 0x10000F00); | ||
| 93 | 95 | ||
| 94 | udelay(100); | 96 | udelay(100); |
| 95 | 97 | ||
| 96 | return dramsize; | 98 | return dramsize; |
| 97 | }; | 99 | }; |
| 98 | 100 | ||
| 99 | int testdram(void) | 101 | int testdram(void) |
| 100 | { | 102 | { |
| 101 | /* TODO: XXX XXX XXX */ | 103 | /* TODO: XXX XXX XXX */ |
| 102 | printf("DRAM test not implemented!\n"); | 104 | printf("DRAM test not implemented!\n"); |
| 103 | 105 | ||
| 104 | return (0); | 106 | return (0); |
| 105 | } | 107 | } |
| 106 | 108 | ||
| 107 | #if defined(CONFIG_PCI) | 109 | #if defined(CONFIG_PCI) |
| 108 | /* | 110 | /* |
| 109 | * Initialize PCI devices, report devices found. | 111 | * Initialize PCI devices, report devices found. |
| 110 | */ | 112 | */ |
| 111 | static struct pci_controller hose; | 113 | static struct pci_controller hose; |
| 112 | extern void pci_mcf547x_8x_init(struct pci_controller *hose); | 114 | extern void pci_mcf547x_8x_init(struct pci_controller *hose); |
| 113 | 115 | ||
| 114 | void pci_init_board(void) | 116 | void pci_init_board(void) |
| 115 | { | 117 | { |
| 116 | pci_mcf547x_8x_init(&hose); | 118 | pci_mcf547x_8x_init(&hose); |
| 117 | } | 119 | } |
| 118 | #endif /* CONFIG_PCI */ | 120 | #endif /* CONFIG_PCI */ |
| 119 | 121 |