blob: 246bcf8f3c747c9d3096ab2a713604376756fa7e [file] [log] [blame]
Minkyu Kang52aa4dc2009-10-01 17:20:08 +09001/*
2 * Copyright (C) 2005-2009 Samsung Electronics
3 * Minkyu Kang <mk7.kang@samsung.com>
4 * Kyungmin Park <kyungmin.park@samsung.com>
5 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Minkyu Kang52aa4dc2009-10-01 17:20:08 +09007 */
8
9#ifndef __SAMSUNG_ONENAND_H__
10#define __SAMSUNG_ONENAND_H__
11
12/*
13 * OneNAND Controller
14 */
15
16#ifndef __ASSEMBLY__
17struct samsung_onenand {
Minkyu Kangc6cb1842009-10-15 11:19:15 +090018 unsigned int mem_cfg; /* 0x0000 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090019 unsigned char res1[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090020 unsigned int burst_len; /* 0x0010 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090021 unsigned char res2[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090022 unsigned int mem_reset; /* 0x0020 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090023 unsigned char res3[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090024 unsigned int int_err_stat; /* 0x0030 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090025 unsigned char res4[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090026 unsigned int int_err_mask; /* 0x0040 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090027 unsigned char res5[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090028 unsigned int int_err_ack; /* 0x0050 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090029 unsigned char res6[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090030 unsigned int ecc_err_stat; /* 0x0060 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090031 unsigned char res7[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090032 unsigned int manufact_id; /* 0x0070 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090033 unsigned char res8[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090034 unsigned int device_id; /* 0x0080 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090035 unsigned char res9[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090036 unsigned int data_buf_size; /* 0x0090 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090037 unsigned char res10[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090038 unsigned int boot_buf_size; /* 0x00A0 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090039 unsigned char res11[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090040 unsigned int buf_amount; /* 0x00B0 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090041 unsigned char res12[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090042 unsigned int tech; /* 0x00C0 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090043 unsigned char res13[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090044 unsigned int fba; /* 0x00D0 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090045 unsigned char res14[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090046 unsigned int fpa; /* 0x00E0 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090047 unsigned char res15[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090048 unsigned int fsa; /* 0x00F0 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090049 unsigned char res16[0x3c];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090050 unsigned int sync_mode; /* 0x0130 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090051 unsigned char res17[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090052 unsigned int trans_spare; /* 0x0140 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090053 unsigned char res18[0x3c];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090054 unsigned int err_page_addr; /* 0x0180 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090055 unsigned char res19[0x1c];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090056 unsigned int int_pin_en; /* 0x01A0 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090057 unsigned char res20[0x1c];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090058 unsigned int acc_clock; /* 0x01C0 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090059 unsigned char res21[0x1c];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090060 unsigned int err_blk_addr; /* 0x01E0 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090061 unsigned char res22[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090062 unsigned int flash_ver_id; /* 0x01F0 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090063 unsigned char res23[0x6c];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090064 unsigned int watchdog_cnt_low; /* 0x0260 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090065 unsigned char res24[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090066 unsigned int watchdog_cnt_hi; /* 0x0270 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090067 unsigned char res25[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090068 unsigned int sync_write; /* 0x0280 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090069 unsigned char res26[0x1c];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090070 unsigned int cold_reset; /* 0x02A0 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090071 unsigned char res27[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090072 unsigned int ddp_device; /* 0x02B0 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090073 unsigned char res28[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090074 unsigned int multi_plane; /* 0x02C0 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090075 unsigned char res29[0x1c];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090076 unsigned int trans_mode; /* 0x02E0 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090077 unsigned char res30[0x1c];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090078 unsigned int ecc_err_stat2; /* 0x0300 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090079 unsigned char res31[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090080 unsigned int ecc_err_stat3; /* 0x0310 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090081 unsigned char res32[0xc];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090082 unsigned int ecc_err_stat4; /* 0x0320 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090083 unsigned char res33[0x1c];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090084 unsigned int dev_page_size; /* 0x0340 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090085 unsigned char res34[0x4c];
Minkyu Kangc6cb1842009-10-15 11:19:15 +090086 unsigned int int_mon_status; /* 0x0390 */
Minkyu Kang52aa4dc2009-10-01 17:20:08 +090087};
88#endif
89
90#define ONENAND_MEM_RESET_HOT 0x3
91#define ONENAND_MEM_RESET_COLD 0x2
92#define ONENAND_MEM_RESET_WARM 0x1
93
94#define INT_ERR_ALL 0x3fff
95#define CACHE_OP_ERR (1 << 13)
96#define RST_CMP (1 << 12)
97#define RDY_ACT (1 << 11)
98#define INT_ACT (1 << 10)
99#define UNSUP_CMD (1 << 9)
100#define LOCKED_BLK (1 << 8)
101#define BLK_RW_CMP (1 << 7)
102#define ERS_CMP (1 << 6)
103#define PGM_CMP (1 << 5)
104#define LOAD_CMP (1 << 4)
105#define ERS_FAIL (1 << 3)
106#define PGM_FAIL (1 << 2)
107#define INT_TO (1 << 1)
108#define LD_FAIL_ECC_ERR (1 << 0)
109
110#define TSRF (1 << 0)
111
112/* common initialize function */
113extern void s3c_onenand_init(struct mtd_info *);
Lukasz Majewski9d7ba322011-11-09 11:25:32 +0100114extern int s5pc110_chip_probe(struct mtd_info *);
115extern int s5pc210_chip_probe(struct mtd_info *);
Minkyu Kang52aa4dc2009-10-01 17:20:08 +0900116
117#endif