wdenk | 1fe2c70 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 1 | /* |
wdenk | 2552190 | 2003-09-13 19:01:12 +0000 | [diff] [blame] | 2 | * (C) Copyright 2002, 2003 |
wdenk | 1fe2c70 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 3 | * David Mueller, ELSOFT AG, d.mueller@elsoft.ch |
| 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 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 |
| 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 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 |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | * MA 02111-1307 USA |
| 22 | * |
| 23 | */ |
| 24 | /**************************************************************************** |
| 25 | * Global routines used for VCMA9 |
| 26 | *****************************************************************************/ |
| 27 | |
kevin.morfitt@fearnside-systems.co.uk | e0d8131 | 2009-11-17 18:30:34 +0900 | [diff] [blame] | 28 | #include <asm/arch/s3c24x0_cpu.h> |
wdenk | 1fe2c70 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 29 | |
| 30 | extern int mem_test(unsigned long start, unsigned long ramsize,int mode); |
| 31 | |
| 32 | void print_vcma9_info(void); |
| 33 | |
Jon Loeliger | 145318c | 2007-07-09 18:38:39 -0500 | [diff] [blame] | 34 | #if defined(CONFIG_CMD_NAND) |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 35 | typedef enum { |
| 36 | NFCE_LOW, |
| 37 | NFCE_HIGH |
| 38 | } NFCE_STATE; |
| 39 | |
| 40 | static inline void NF_Conf(u16 conf) |
| 41 | { |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 42 | struct s3c2410_nand * const nand = s3c2410_get_base_nand(); |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 43 | |
| 44 | nand->NFCONF = conf; |
| 45 | } |
| 46 | |
| 47 | static inline void NF_Cmd(u8 cmd) |
| 48 | { |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 49 | struct s3c2410_nand * const nand = s3c2410_get_base_nand(); |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 50 | |
| 51 | nand->NFCMD = cmd; |
| 52 | } |
| 53 | |
| 54 | static inline void NF_CmdW(u8 cmd) |
| 55 | { |
| 56 | NF_Cmd(cmd); |
| 57 | udelay(1); |
| 58 | } |
| 59 | |
| 60 | static inline void NF_Addr(u8 addr) |
| 61 | { |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 62 | struct s3c2410_nand * const nand = s3c2410_get_base_nand(); |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 63 | |
| 64 | nand->NFADDR = addr; |
| 65 | } |
| 66 | |
| 67 | static inline void NF_SetCE(NFCE_STATE s) |
| 68 | { |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 69 | struct s3c2410_nand * const nand = s3c2410_get_base_nand(); |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 70 | |
| 71 | switch (s) { |
| 72 | case NFCE_LOW: |
| 73 | nand->NFCONF &= ~(1<<11); |
| 74 | break; |
| 75 | |
| 76 | case NFCE_HIGH: |
| 77 | nand->NFCONF |= (1<<11); |
| 78 | break; |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | static inline void NF_WaitRB(void) |
| 83 | { |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 84 | struct s3c2410_nand * const nand = s3c2410_get_base_nand(); |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 85 | |
| 86 | while (!(nand->NFSTAT & (1<<0))); |
| 87 | } |
| 88 | |
| 89 | static inline void NF_Write(u8 data) |
| 90 | { |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 91 | struct s3c2410_nand * const nand = s3c2410_get_base_nand(); |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 92 | |
| 93 | nand->NFDATA = data; |
| 94 | } |
| 95 | |
| 96 | static inline u8 NF_Read(void) |
| 97 | { |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 98 | struct s3c2410_nand * const nand = s3c2410_get_base_nand(); |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 99 | |
| 100 | return(nand->NFDATA); |
| 101 | } |
| 102 | |
| 103 | static inline void NF_Init_ECC(void) |
| 104 | { |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 105 | struct s3c2410_nand * const nand = s3c2410_get_base_nand(); |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 106 | |
| 107 | nand->NFCONF |= (1<<12); |
| 108 | } |
| 109 | |
| 110 | static inline u32 NF_Read_ECC(void) |
| 111 | { |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 112 | struct s3c2410_nand * const nand = s3c2410_get_base_nand(); |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 113 | |
| 114 | return(nand->NFECC); |
| 115 | } |
| 116 | |
| 117 | #endif |
| 118 | |
wdenk | 2552190 | 2003-09-13 19:01:12 +0000 | [diff] [blame] | 119 | /* VCMA9 PLD regsiters */ |
| 120 | typedef struct { |
kevin.morfitt@fearnside-systems.co.uk | b193f82 | 2009-11-04 17:49:31 +0900 | [diff] [blame] | 121 | u8 ID; |
| 122 | u8 NIC; |
| 123 | u8 CAN; |
| 124 | u8 MISC; |
| 125 | u8 GPCD; |
| 126 | u8 BOARD; |
| 127 | u8 SDRAM; |
wdenk | 2552190 | 2003-09-13 19:01:12 +0000 | [diff] [blame] | 128 | } /*__attribute__((__packed__))*/ VCMA9_PLD; |
wdenk | 1fe2c70 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 129 | |
wdenk | 2552190 | 2003-09-13 19:01:12 +0000 | [diff] [blame] | 130 | #define VCMA9_PLD_BASE 0x2C000100 |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 131 | static inline VCMA9_PLD *VCMA9_get_base_PLD(void) |
wdenk | 2552190 | 2003-09-13 19:01:12 +0000 | [diff] [blame] | 132 | { |
| 133 | return (VCMA9_PLD * const)VCMA9_PLD_BASE; |
| 134 | } |