Grant Erickson | c821b5f | 2008-05-22 14:44:14 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2008 Nuovation System Designs, LLC |
| 3 | * Grant Erickson <gerickson@nuovations.com> |
| 4 | * |
Stefan Roese | fb95169 | 2009-09-28 17:33:45 +0200 | [diff] [blame] | 5 | * Copyright (c) 2007-2009 DENX Software Engineering, GmbH |
Grant Erickson | c821b5f | 2008-05-22 14:44:14 -0700 | [diff] [blame] | 6 | * Stefan Roese <sr@denx.de> |
| 7 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 8 | * SPDX-License-Identifier: GPL-2.0+ |
Grant Erickson | c821b5f | 2008-05-22 14:44:14 -0700 | [diff] [blame] | 9 | * |
| 10 | * Description: |
| 11 | * This file implements ECC initialization for PowerPC processors |
Stefan Roese | fb95169 | 2009-09-28 17:33:45 +0200 | [diff] [blame] | 12 | * using the IBM SDRAM DDR1 & DDR2 controller. |
Grant Erickson | c821b5f | 2008-05-22 14:44:14 -0700 | [diff] [blame] | 13 | */ |
| 14 | |
| 15 | #ifndef _ECC_H_ |
| 16 | #define _ECC_H_ |
| 17 | |
Stefan Roese | 39b32be | 2008-06-02 17:20:03 +0200 | [diff] [blame] | 18 | /* |
| 19 | * Since the IBM DDR controller used on 440GP/GX/EP/GR is not register |
| 20 | * compatible to the IBM DDR/2 controller used on 405EX/440SP/SPe/460EX/GT |
| 21 | * we need to make some processor dependant defines used later on by the |
| 22 | * driver. |
| 23 | */ |
| 24 | |
| 25 | /* For 440GP/GX/EP/GR */ |
| 26 | #if defined(CONFIG_SDRAM_PPC4xx_IBM_DDR) |
Stefan Roese | fb95169 | 2009-09-28 17:33:45 +0200 | [diff] [blame] | 27 | #define SDRAM_MCOPT1 SDRAM_CFG0 |
| 28 | #define SDRAM_MCOPT1_MCHK_MASK SDRAM_CFG0_MCHK_MASK |
| 29 | #define SDRAM_MCOPT1_MCHK_NON SDRAM_CFG0_MCHK_NON |
| 30 | #define SDRAM_MCOPT1_MCHK_GEN SDRAM_CFG0_MCHK_GEN |
| 31 | #define SDRAM_MCOPT1_MCHK_CHK SDRAM_CFG0_MCHK_CHK |
| 32 | #define SDRAM_MCOPT1_MCHK_CHK_REP SDRAM_CFG0_MCHK_CHK |
| 33 | #define SDRAM_MCOPT1_DMWD_MASK SDRAM_CFG0_DMWD_MASK |
| 34 | #define SDRAM_MCOPT1_DMWD_32 SDRAM_CFG0_DMWD_32 |
| 35 | |
| 36 | #define SDRAM_MCSTAT SDRAM0_MCSTS |
| 37 | #define SDRAM_MCSTAT_IDLE_MASK SDRAM_MCSTS_CIS |
| 38 | #define SDRAM_MCSTAT_IDLE_NOT SDRAM_MCSTS_IDLE_NOT |
| 39 | |
| 40 | #define SDRAM_ECCES SDRAM0_ECCESR |
Stefan Roese | 39b32be | 2008-06-02 17:20:03 +0200 | [diff] [blame] | 41 | #endif |
| 42 | |
Stefan Roese | fb95169 | 2009-09-28 17:33:45 +0200 | [diff] [blame] | 43 | void ecc_init(unsigned long * const start, unsigned long size); |
| 44 | void do_program_ecc(unsigned long tlb_word2_i_value); |
Stefan Roese | 39b32be | 2008-06-02 17:20:03 +0200 | [diff] [blame] | 45 | |
Stefan Roese | fb95169 | 2009-09-28 17:33:45 +0200 | [diff] [blame] | 46 | static void inline blank_string(int size) |
| 47 | { |
| 48 | int i; |
| 49 | |
| 50 | for (i = 0; i < size; i++) |
| 51 | putc('\b'); |
| 52 | for (i = 0; i < size; i++) |
| 53 | putc(' '); |
| 54 | for (i = 0; i < size; i++) |
| 55 | putc('\b'); |
| 56 | } |
Grant Erickson | c821b5f | 2008-05-22 14:44:14 -0700 | [diff] [blame] | 57 | |
| 58 | #endif /* _ECC_H_ */ |