From 4678d674f0cacc983dca7f6b9933cd8291c9797c Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Thu, 1 Oct 2009 17:20:08 +0900 Subject: s5pc1xx: support onenand driver This patch includes the onenand driver for s5pc100 Signed-off-by: Minkyu Kang Signed-off-by: Kyungmin Park --- include/linux/mtd/onenand.h | 1 + include/linux/mtd/onenand_regs.h | 4 ++ include/linux/mtd/samsung_onenand.h | 131 ++++++++++++++++++++++++++++++++++++ 3 files changed, 136 insertions(+) create mode 100644 include/linux/mtd/samsung_onenand.h (limited to 'include/linux') diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h index 06f7bafeae1..9a6f31752ed 100644 --- a/include/linux/mtd/onenand.h +++ b/include/linux/mtd/onenand.h @@ -135,6 +135,7 @@ struct onenand_chip { #define ONENAND_HAS_CONT_LOCK (0x0001) #define ONENAND_HAS_UNLOCK_ALL (0x0002) #define ONENAND_HAS_2PLANE (0x0004) +#define ONENAND_RUNTIME_BADBLOCK_CHECK (0x0200) #define ONENAND_PAGEBUF_ALLOC (0x1000) #define ONENAND_OOBBUF_ALLOC (0x2000) diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h index fc63380d927..07fed1c60f6 100644 --- a/include/linux/mtd/onenand_regs.h +++ b/include/linux/mtd/onenand_regs.h @@ -121,6 +121,8 @@ #define ONENAND_CMD_LOCK_TIGHT (0x2C) #define ONENAND_CMD_UNLOCK_ALL (0x27) #define ONENAND_CMD_ERASE (0x94) +#define ONENAND_CMD_MULTIBLOCK_ERASE (0x95) +#define ONENAND_CMD_ERASE_VERIFY (0x71) #define ONENAND_CMD_RESET (0xF0) #define ONENAND_CMD_READID (0x90) @@ -184,7 +186,9 @@ * ECC Status Reigser FF00h (R) */ #define ONENAND_ECC_1BIT (1 << 0) +#define ONENAND_ECC_1BIT_ALL (0x5555) #define ONENAND_ECC_2BIT (1 << 1) #define ONENAND_ECC_2BIT_ALL (0xAAAA) +#define ONENAND_ECC_4BIT_UNCORRECTABLE (0x1010) #endif /* __ONENAND_REG_H */ diff --git a/include/linux/mtd/samsung_onenand.h b/include/linux/mtd/samsung_onenand.h new file mode 100644 index 00000000000..9865780d406 --- /dev/null +++ b/include/linux/mtd/samsung_onenand.h @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2005-2009 Samsung Electronics + * Minkyu Kang + * Kyungmin Park + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __SAMSUNG_ONENAND_H__ +#define __SAMSUNG_ONENAND_H__ + +/* + * OneNAND Controller + */ + +#ifndef __ASSEMBLY__ +struct samsung_onenand { + unsigned long mem_cfg; /* 0x0000 */ + unsigned char res1[0xc]; + unsigned long burst_len; /* 0x0010 */ + unsigned char res2[0xc]; + unsigned long mem_reset; /* 0x0020 */ + unsigned char res3[0xc]; + unsigned long int_err_stat; /* 0x0030 */ + unsigned char res4[0xc]; + unsigned long int_err_mask; /* 0x0040 */ + unsigned char res5[0xc]; + unsigned long int_err_ack; /* 0x0050 */ + unsigned char res6[0xc]; + unsigned long ecc_err_stat; /* 0x0060 */ + unsigned char res7[0xc]; + unsigned long manufact_id; /* 0x0070 */ + unsigned char res8[0xc]; + unsigned long device_id; /* 0x0080 */ + unsigned char res9[0xc]; + unsigned long data_buf_size; /* 0x0090 */ + unsigned char res10[0xc]; + unsigned long boot_buf_size; /* 0x00A0 */ + unsigned char res11[0xc]; + unsigned long buf_amount; /* 0x00B0 */ + unsigned char res12[0xc]; + unsigned long tech; /* 0x00C0 */ + unsigned char res13[0xc]; + unsigned long fba; /* 0x00D0 */ + unsigned char res14[0xc]; + unsigned long fpa; /* 0x00E0 */ + unsigned char res15[0xc]; + unsigned long fsa; /* 0x00F0 */ + unsigned char res16[0x3c]; + unsigned long sync_mode; /* 0x0130 */ + unsigned char res17[0xc]; + unsigned long trans_spare; /* 0x0140 */ + unsigned char res18[0x3c]; + unsigned long err_page_addr; /* 0x0180 */ + unsigned char res19[0x1c]; + unsigned long int_pin_en; /* 0x01A0 */ + unsigned char res20[0x1c]; + unsigned long acc_clock; /* 0x01C0 */ + unsigned char res21[0x1c]; + unsigned long err_blk_addr; /* 0x01E0 */ + unsigned char res22[0xc]; + unsigned long flash_ver_id; /* 0x01F0 */ + unsigned char res23[0x6c]; + unsigned long watchdog_cnt_low; /* 0x0260 */ + unsigned char res24[0xc]; + unsigned long watchdog_cnt_hi; /* 0x0270 */ + unsigned char res25[0xc]; + unsigned long sync_write; /* 0x0280 */ + unsigned char res26[0x1c]; + unsigned long cold_reset; /* 0x02A0 */ + unsigned char res27[0xc]; + unsigned long ddp_device; /* 0x02B0 */ + unsigned char res28[0xc]; + unsigned long multi_plane; /* 0x02C0 */ + unsigned char res29[0x1c]; + unsigned long trans_mode; /* 0x02E0 */ + unsigned char res30[0x1c]; + unsigned long ecc_err_stat2; /* 0x0300 */ + unsigned char res31[0xc]; + unsigned long ecc_err_stat3; /* 0x0310 */ + unsigned char res32[0xc]; + unsigned long ecc_err_stat4; /* 0x0320 */ + unsigned char res33[0x1c]; + unsigned long dev_page_size; /* 0x0340 */ + unsigned char res34[0x4c]; + unsigned long int_mon_status; /* 0x0390 */ +}; +#endif + +#define ONENAND_MEM_RESET_HOT 0x3 +#define ONENAND_MEM_RESET_COLD 0x2 +#define ONENAND_MEM_RESET_WARM 0x1 + +#define INT_ERR_ALL 0x3fff +#define CACHE_OP_ERR (1 << 13) +#define RST_CMP (1 << 12) +#define RDY_ACT (1 << 11) +#define INT_ACT (1 << 10) +#define UNSUP_CMD (1 << 9) +#define LOCKED_BLK (1 << 8) +#define BLK_RW_CMP (1 << 7) +#define ERS_CMP (1 << 6) +#define PGM_CMP (1 << 5) +#define LOAD_CMP (1 << 4) +#define ERS_FAIL (1 << 3) +#define PGM_FAIL (1 << 2) +#define INT_TO (1 << 1) +#define LD_FAIL_ECC_ERR (1 << 0) + +#define TSRF (1 << 0) + +/* common initialize function */ +extern void s3c_onenand_init(struct mtd_info *); + +#endif -- cgit v1.3.1 From f3807374787e4394efb767e2e8527887f57e51b8 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Thu, 15 Oct 2009 11:19:15 +0900 Subject: s5pc1xx: SMDKC100: fix compile warnings fix the following compile warnings warning: dereferencing type-punned pointer will break strict-aliasing rules Signed-off-by: Minkyu Kang --- drivers/serial/serial_s5pc1xx.c | 2 +- include/asm-arm/arch-s5pc1xx/clock.h | 88 ++++++++++++++++++------------------ include/asm-arm/arch-s5pc1xx/gpio.h | 12 ++--- include/asm-arm/arch-s5pc1xx/pwm.h | 36 +++++++-------- include/asm-arm/arch-s5pc1xx/uart.h | 18 ++++---- include/linux/mtd/samsung_onenand.h | 70 ++++++++++++++-------------- 6 files changed, 113 insertions(+), 113 deletions(-) (limited to 'include/linux') diff --git a/drivers/serial/serial_s5pc1xx.c b/drivers/serial/serial_s5pc1xx.c index 64c1dcc8ff0..68c06a9190f 100644 --- a/drivers/serial/serial_s5pc1xx.c +++ b/drivers/serial/serial_s5pc1xx.c @@ -74,7 +74,7 @@ void serial_setbrg_dev(const int dev_index) val = pclk / baudrate; writel(val / 16 - 1, &uart->ubrdiv); - writel(udivslot[val % 16], &uart->udivslot); + writew(udivslot[val % 16], &uart->udivslot); } /* diff --git a/include/asm-arm/arch-s5pc1xx/clock.h b/include/asm-arm/arch-s5pc1xx/clock.h index 0cad9225bd7..7b4eb899055 100644 --- a/include/asm-arm/arch-s5pc1xx/clock.h +++ b/include/asm-arm/arch-s5pc1xx/clock.h @@ -25,69 +25,69 @@ #ifndef __ASSEMBLY__ struct s5pc100_clock { - unsigned long apll_lock; - unsigned long mpll_lock; - unsigned long epll_lock; - unsigned long hpll_lock; + unsigned int apll_lock; + unsigned int mpll_lock; + unsigned int epll_lock; + unsigned int hpll_lock; unsigned char res1[0xf0]; - unsigned long apll_con; - unsigned long mpll_con; - unsigned long epll_con; - unsigned long hpll_con; + unsigned int apll_con; + unsigned int mpll_con; + unsigned int epll_con; + unsigned int hpll_con; unsigned char res2[0xf0]; - unsigned long src0; - unsigned long src1; - unsigned long src2; - unsigned long src3; + unsigned int src0; + unsigned int src1; + unsigned int src2; + unsigned int src3; unsigned char res3[0xf0]; - unsigned long div0; - unsigned long div1; - unsigned long div2; - unsigned long div3; - unsigned long div4; + unsigned int div0; + unsigned int div1; + unsigned int div2; + unsigned int div3; + unsigned int div4; unsigned char res4[0x1ec]; - unsigned long gate_d00; - unsigned long gate_d01; - unsigned long gate_d02; + unsigned int gate_d00; + unsigned int gate_d01; + unsigned int gate_d02; unsigned char res5[0x54]; - unsigned long gate_sclk0; - unsigned long gate_sclk1; + unsigned int gate_sclk0; + unsigned int gate_sclk1; }; struct s5pc110_clock { - unsigned long apll_lock; + unsigned int apll_lock; unsigned char res1[0x4]; - unsigned long mpll_lock; + unsigned int mpll_lock; unsigned char res2[0x4]; - unsigned long epll_lock; + unsigned int epll_lock; unsigned char res3[0xc]; - unsigned long vpll_lock; + unsigned int vpll_lock; unsigned char res4[0xdc]; - unsigned long apll_con; + unsigned int apll_con; unsigned char res5[0x4]; - unsigned long mpll_con; + unsigned int mpll_con; unsigned char res6[0x4]; - unsigned long epll_con; + unsigned int epll_con; unsigned char res7[0xc]; - unsigned long vpll_con; + unsigned int vpll_con; unsigned char res8[0xdc]; - unsigned long src0; - unsigned long src1; - unsigned long src2; - unsigned long src3; + unsigned int src0; + unsigned int src1; + unsigned int src2; + unsigned int src3; unsigned char res9[0xf0]; - unsigned long div0; - unsigned long div1; - unsigned long div2; - unsigned long div3; - unsigned long div4; + unsigned int div0; + unsigned int div1; + unsigned int div2; + unsigned int div3; + unsigned int div4; unsigned char res10[0x1ec]; - unsigned long gate_d00; - unsigned long gate_d01; - unsigned long gate_d02; + unsigned int gate_d00; + unsigned int gate_d01; + unsigned int gate_d02; unsigned char res11[0x54]; - unsigned long gate_sclk0; - unsigned long gate_sclk1; + unsigned int gate_sclk0; + unsigned int gate_sclk1; }; #endif diff --git a/include/asm-arm/arch-s5pc1xx/gpio.h b/include/asm-arm/arch-s5pc1xx/gpio.h index 00104053152..afbc7ea5ae5 100644 --- a/include/asm-arm/arch-s5pc1xx/gpio.h +++ b/include/asm-arm/arch-s5pc1xx/gpio.h @@ -23,12 +23,12 @@ #ifndef __ASSEMBLY__ struct s5pc1xx_gpio_bank { - unsigned long con; - unsigned long dat; - unsigned long pull; - unsigned long drv; - unsigned long pdn_con; - unsigned long pdn_pull; + unsigned int con; + unsigned int dat; + unsigned int pull; + unsigned int drv; + unsigned int pdn_con; + unsigned int pdn_pull; unsigned char res1[8]; }; diff --git a/include/asm-arm/arch-s5pc1xx/pwm.h b/include/asm-arm/arch-s5pc1xx/pwm.h index 53c23cd1469..e02a8d8fb3a 100644 --- a/include/asm-arm/arch-s5pc1xx/pwm.h +++ b/include/asm-arm/arch-s5pc1xx/pwm.h @@ -35,24 +35,24 @@ #ifndef __ASSEMBLY__ struct s5pc1xx_timer { - unsigned long tcfg0; - unsigned long tcfg1; - unsigned long tcon; - unsigned long tcntb0; - unsigned long tcmpb0; - unsigned long tcnto0; - unsigned long tcntb1; - unsigned long tcmpb1; - unsigned long tcnto1; - unsigned long tcntb2; - unsigned long tcmpb2; - unsigned long tcnto2; - unsigned long tcntb3; - unsigned long res1; - unsigned long tcnto3; - unsigned long tcntb4; - unsigned long tcnto4; - unsigned long tintcstat; + unsigned int tcfg0; + unsigned int tcfg1; + unsigned int tcon; + unsigned int tcntb0; + unsigned int tcmpb0; + unsigned int tcnto0; + unsigned int tcntb1; + unsigned int tcmpb1; + unsigned int tcnto1; + unsigned int tcntb2; + unsigned int tcmpb2; + unsigned int tcnto2; + unsigned int tcntb3; + unsigned int res1; + unsigned int tcnto3; + unsigned int tcntb4; + unsigned int tcnto4; + unsigned int tintcstat; }; #endif /* __ASSEMBLY__ */ diff --git a/include/asm-arm/arch-s5pc1xx/uart.h b/include/asm-arm/arch-s5pc1xx/uart.h index bd7d6b2dda9..140dbdc45fc 100644 --- a/include/asm-arm/arch-s5pc1xx/uart.h +++ b/include/asm-arm/arch-s5pc1xx/uart.h @@ -25,19 +25,19 @@ #ifndef __ASSEMBLY__ struct s5pc1xx_uart { - unsigned long ulcon; - unsigned long ucon; - unsigned long ufcon; - unsigned long umcon; - unsigned long utrstat; - unsigned long uerstat; - unsigned long ufstat; - unsigned long umstat; + unsigned int ulcon; + unsigned int ucon; + unsigned int ufcon; + unsigned int umcon; + unsigned int utrstat; + unsigned int uerstat; + unsigned int ufstat; + unsigned int umstat; unsigned char utxh; unsigned char res1[3]; unsigned char urxh; unsigned char res2[3]; - unsigned long ubrdiv; + unsigned int ubrdiv; unsigned short udivslot; unsigned char res3[2]; unsigned char res4[0x3d0]; diff --git a/include/linux/mtd/samsung_onenand.h b/include/linux/mtd/samsung_onenand.h index 9865780d406..021fa27f7dd 100644 --- a/include/linux/mtd/samsung_onenand.h +++ b/include/linux/mtd/samsung_onenand.h @@ -31,75 +31,75 @@ #ifndef __ASSEMBLY__ struct samsung_onenand { - unsigned long mem_cfg; /* 0x0000 */ + unsigned int mem_cfg; /* 0x0000 */ unsigned char res1[0xc]; - unsigned long burst_len; /* 0x0010 */ + unsigned int burst_len; /* 0x0010 */ unsigned char res2[0xc]; - unsigned long mem_reset; /* 0x0020 */ + unsigned int mem_reset; /* 0x0020 */ unsigned char res3[0xc]; - unsigned long int_err_stat; /* 0x0030 */ + unsigned int int_err_stat; /* 0x0030 */ unsigned char res4[0xc]; - unsigned long int_err_mask; /* 0x0040 */ + unsigned int int_err_mask; /* 0x0040 */ unsigned char res5[0xc]; - unsigned long int_err_ack; /* 0x0050 */ + unsigned int int_err_ack; /* 0x0050 */ unsigned char res6[0xc]; - unsigned long ecc_err_stat; /* 0x0060 */ + unsigned int ecc_err_stat; /* 0x0060 */ unsigned char res7[0xc]; - unsigned long manufact_id; /* 0x0070 */ + unsigned int manufact_id; /* 0x0070 */ unsigned char res8[0xc]; - unsigned long device_id; /* 0x0080 */ + unsigned int device_id; /* 0x0080 */ unsigned char res9[0xc]; - unsigned long data_buf_size; /* 0x0090 */ + unsigned int data_buf_size; /* 0x0090 */ unsigned char res10[0xc]; - unsigned long boot_buf_size; /* 0x00A0 */ + unsigned int boot_buf_size; /* 0x00A0 */ unsigned char res11[0xc]; - unsigned long buf_amount; /* 0x00B0 */ + unsigned int buf_amount; /* 0x00B0 */ unsigned char res12[0xc]; - unsigned long tech; /* 0x00C0 */ + unsigned int tech; /* 0x00C0 */ unsigned char res13[0xc]; - unsigned long fba; /* 0x00D0 */ + unsigned int fba; /* 0x00D0 */ unsigned char res14[0xc]; - unsigned long fpa; /* 0x00E0 */ + unsigned int fpa; /* 0x00E0 */ unsigned char res15[0xc]; - unsigned long fsa; /* 0x00F0 */ + unsigned int fsa; /* 0x00F0 */ unsigned char res16[0x3c]; - unsigned long sync_mode; /* 0x0130 */ + unsigned int sync_mode; /* 0x0130 */ unsigned char res17[0xc]; - unsigned long trans_spare; /* 0x0140 */ + unsigned int trans_spare; /* 0x0140 */ unsigned char res18[0x3c]; - unsigned long err_page_addr; /* 0x0180 */ + unsigned int err_page_addr; /* 0x0180 */ unsigned char res19[0x1c]; - unsigned long int_pin_en; /* 0x01A0 */ + unsigned int int_pin_en; /* 0x01A0 */ unsigned char res20[0x1c]; - unsigned long acc_clock; /* 0x01C0 */ + unsigned int acc_clock; /* 0x01C0 */ unsigned char res21[0x1c]; - unsigned long err_blk_addr; /* 0x01E0 */ + unsigned int err_blk_addr; /* 0x01E0 */ unsigned char res22[0xc]; - unsigned long flash_ver_id; /* 0x01F0 */ + unsigned int flash_ver_id; /* 0x01F0 */ unsigned char res23[0x6c]; - unsigned long watchdog_cnt_low; /* 0x0260 */ + unsigned int watchdog_cnt_low; /* 0x0260 */ unsigned char res24[0xc]; - unsigned long watchdog_cnt_hi; /* 0x0270 */ + unsigned int watchdog_cnt_hi; /* 0x0270 */ unsigned char res25[0xc]; - unsigned long sync_write; /* 0x0280 */ + unsigned int sync_write; /* 0x0280 */ unsigned char res26[0x1c]; - unsigned long cold_reset; /* 0x02A0 */ + unsigned int cold_reset; /* 0x02A0 */ unsigned char res27[0xc]; - unsigned long ddp_device; /* 0x02B0 */ + unsigned int ddp_device; /* 0x02B0 */ unsigned char res28[0xc]; - unsigned long multi_plane; /* 0x02C0 */ + unsigned int multi_plane; /* 0x02C0 */ unsigned char res29[0x1c]; - unsigned long trans_mode; /* 0x02E0 */ + unsigned int trans_mode; /* 0x02E0 */ unsigned char res30[0x1c]; - unsigned long ecc_err_stat2; /* 0x0300 */ + unsigned int ecc_err_stat2; /* 0x0300 */ unsigned char res31[0xc]; - unsigned long ecc_err_stat3; /* 0x0310 */ + unsigned int ecc_err_stat3; /* 0x0310 */ unsigned char res32[0xc]; - unsigned long ecc_err_stat4; /* 0x0320 */ + unsigned int ecc_err_stat4; /* 0x0320 */ unsigned char res33[0x1c]; - unsigned long dev_page_size; /* 0x0340 */ + unsigned int dev_page_size; /* 0x0340 */ unsigned char res34[0x4c]; - unsigned long int_mon_status; /* 0x0390 */ + unsigned int int_mon_status; /* 0x0390 */ }; #endif -- cgit v1.3.1