diff options
Diffstat (limited to 'include/linux/mtd/sh_flctl.h')
-rw-r--r-- | include/linux/mtd/sh_flctl.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/include/linux/mtd/sh_flctl.h b/include/linux/mtd/sh_flctl.h index 9cf4c4c79555..a38e1fa8af01 100644 --- a/include/linux/mtd/sh_flctl.h +++ b/include/linux/mtd/sh_flctl.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/mtd/mtd.h> | 23 | #include <linux/mtd/mtd.h> |
24 | #include <linux/mtd/nand.h> | 24 | #include <linux/mtd/nand.h> |
25 | #include <linux/mtd/partitions.h> | 25 | #include <linux/mtd/partitions.h> |
26 | #include <linux/pm_qos.h> | ||
26 | 27 | ||
27 | /* FLCTL registers */ | 28 | /* FLCTL registers */ |
28 | #define FLCMNCR(f) (f->reg + 0x0) | 29 | #define FLCMNCR(f) (f->reg + 0x0) |
@@ -38,6 +39,7 @@ | |||
38 | #define FLDTFIFO(f) (f->reg + 0x24) | 39 | #define FLDTFIFO(f) (f->reg + 0x24) |
39 | #define FLECFIFO(f) (f->reg + 0x28) | 40 | #define FLECFIFO(f) (f->reg + 0x28) |
40 | #define FLTRCR(f) (f->reg + 0x2C) | 41 | #define FLTRCR(f) (f->reg + 0x2C) |
42 | #define FLHOLDCR(f) (f->reg + 0x38) | ||
41 | #define FL4ECCRESULT0(f) (f->reg + 0x80) | 43 | #define FL4ECCRESULT0(f) (f->reg + 0x80) |
42 | #define FL4ECCRESULT1(f) (f->reg + 0x84) | 44 | #define FL4ECCRESULT1(f) (f->reg + 0x84) |
43 | #define FL4ECCRESULT2(f) (f->reg + 0x88) | 45 | #define FL4ECCRESULT2(f) (f->reg + 0x88) |
@@ -67,6 +69,30 @@ | |||
67 | #define CE0_ENABLE (0x1 << 3) /* Chip Enable 0 */ | 69 | #define CE0_ENABLE (0x1 << 3) /* Chip Enable 0 */ |
68 | #define TYPESEL_SET (0x1 << 0) | 70 | #define TYPESEL_SET (0x1 << 0) |
69 | 71 | ||
72 | /* | ||
73 | * Clock settings using the PULSEx registers from FLCMNCR | ||
74 | * | ||
75 | * Some hardware uses bits called PULSEx instead of FCKSEL_E and QTSEL_E | ||
76 | * to control the clock divider used between the High-Speed Peripheral Clock | ||
77 | * and the FLCTL internal clock. If so, use CLK_8_BIT_xxx for connecting 8 bit | ||
78 | * and CLK_16_BIT_xxx for connecting 16 bit bus bandwith NAND chips. For the 16 | ||
79 | * bit version the divider is seperate for the pulse width of high and low | ||
80 | * signals. | ||
81 | */ | ||
82 | #define PULSE3 (0x1 << 27) | ||
83 | #define PULSE2 (0x1 << 17) | ||
84 | #define PULSE1 (0x1 << 15) | ||
85 | #define PULSE0 (0x1 << 9) | ||
86 | #define CLK_8B_0_5 PULSE1 | ||
87 | #define CLK_8B_1 0x0 | ||
88 | #define CLK_8B_1_5 (PULSE1 | PULSE2) | ||
89 | #define CLK_8B_2 PULSE0 | ||
90 | #define CLK_8B_3 (PULSE0 | PULSE1 | PULSE2) | ||
91 | #define CLK_8B_4 (PULSE0 | PULSE2) | ||
92 | #define CLK_16B_6L_2H PULSE0 | ||
93 | #define CLK_16B_9L_3H (PULSE0 | PULSE1 | PULSE2) | ||
94 | #define CLK_16B_12L_4H (PULSE0 | PULSE2) | ||
95 | |||
70 | /* FLCMDCR control bits */ | 96 | /* FLCMDCR control bits */ |
71 | #define ADRCNT2_E (0x1 << 31) /* 5byte address enable */ | 97 | #define ADRCNT2_E (0x1 << 31) /* 5byte address enable */ |
72 | #define ADRMD_E (0x1 << 26) /* Sector address access */ | 98 | #define ADRMD_E (0x1 << 26) /* Sector address access */ |
@@ -85,6 +111,15 @@ | |||
85 | #define TRSTRT (0x1 << 0) /* translation start */ | 111 | #define TRSTRT (0x1 << 0) /* translation start */ |
86 | #define TREND (0x1 << 1) /* translation end */ | 112 | #define TREND (0x1 << 1) /* translation end */ |
87 | 113 | ||
114 | /* | ||
115 | * FLHOLDCR control bits | ||
116 | * | ||
117 | * HOLDEN: Bus Occupancy Enable (inverted) | ||
118 | * Enable this bit when the external bus might be used in between transfers. | ||
119 | * If not set and the bus gets used by other modules, a deadlock occurs. | ||
120 | */ | ||
121 | #define HOLDEN (0x1 << 0) | ||
122 | |||
88 | /* FL4ECCCR control bits */ | 123 | /* FL4ECCCR control bits */ |
89 | #define _4ECCFA (0x1 << 2) /* 4 symbols correct fault */ | 124 | #define _4ECCFA (0x1 << 2) /* 4 symbols correct fault */ |
90 | #define _4ECCEND (0x1 << 1) /* 4 symbols end */ | 125 | #define _4ECCEND (0x1 << 1) /* 4 symbols end */ |
@@ -97,6 +132,7 @@ struct sh_flctl { | |||
97 | struct mtd_info mtd; | 132 | struct mtd_info mtd; |
98 | struct nand_chip chip; | 133 | struct nand_chip chip; |
99 | struct platform_device *pdev; | 134 | struct platform_device *pdev; |
135 | struct dev_pm_qos_request pm_qos; | ||
100 | void __iomem *reg; | 136 | void __iomem *reg; |
101 | 137 | ||
102 | uint8_t done_buff[2048 + 64]; /* max size 2048 + 64 */ | 138 | uint8_t done_buff[2048 + 64]; /* max size 2048 + 64 */ |
@@ -108,11 +144,14 @@ struct sh_flctl { | |||
108 | int erase1_page_addr; /* page_addr in ERASE1 cmd */ | 144 | int erase1_page_addr; /* page_addr in ERASE1 cmd */ |
109 | uint32_t erase_ADRCNT; /* bits of FLCMDCR in ERASE1 cmd */ | 145 | uint32_t erase_ADRCNT; /* bits of FLCMDCR in ERASE1 cmd */ |
110 | uint32_t rw_ADRCNT; /* bits of FLCMDCR in READ WRITE cmd */ | 146 | uint32_t rw_ADRCNT; /* bits of FLCMDCR in READ WRITE cmd */ |
147 | uint32_t flcmncr_base; /* base value of FLCMNCR */ | ||
111 | 148 | ||
112 | int hwecc_cant_correct[4]; | 149 | int hwecc_cant_correct[4]; |
113 | 150 | ||
114 | unsigned page_size:1; /* NAND page size (0 = 512, 1 = 2048) */ | 151 | unsigned page_size:1; /* NAND page size (0 = 512, 1 = 2048) */ |
115 | unsigned hwecc:1; /* Hardware ECC (0 = disabled, 1 = enabled) */ | 152 | unsigned hwecc:1; /* Hardware ECC (0 = disabled, 1 = enabled) */ |
153 | unsigned holden:1; /* Hardware has FLHOLDCR and HOLDEN is set */ | ||
154 | unsigned qos_request:1; /* QoS request to prevent deep power shutdown */ | ||
116 | }; | 155 | }; |
117 | 156 | ||
118 | struct sh_flctl_platform_data { | 157 | struct sh_flctl_platform_data { |
@@ -121,6 +160,7 @@ struct sh_flctl_platform_data { | |||
121 | unsigned long flcmncr_val; | 160 | unsigned long flcmncr_val; |
122 | 161 | ||
123 | unsigned has_hwecc:1; | 162 | unsigned has_hwecc:1; |
163 | unsigned use_holden:1; | ||
124 | }; | 164 | }; |
125 | 165 | ||
126 | static inline struct sh_flctl *mtd_to_flctl(struct mtd_info *mtdinfo) | 166 | static inline struct sh_flctl *mtd_to_flctl(struct mtd_info *mtdinfo) |