Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

memory: ti-aemif: Wrap CS timings into a struct

CS timings are store in the struct aemif_cs_data along with other CS
parameters. It isn't convenient for exposing CS timings to other drivers
without also exposing the other parameters.

Wrap the CS timings in a new struct aemif_cs_timings to simplify their
export in upcoming patches.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20241204094319.1050826-4-bastien.curutchet@bootlin.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

authored by

Bastien Curutchet and committed by
Krzysztof Kozlowski
30b4da67 b3d57e17

+33 -24
+33 -24
drivers/memory/ti-aemif.c
··· 80 80 ASIZE_MAX) 81 81 82 82 /** 83 - * struct aemif_cs_data: structure to hold cs parameters 84 - * @cs: chip-select number 83 + * struct aemif_cs_timings: structure to hold CS timings 85 84 * @wstrobe: write strobe width, number of cycles - 1 86 85 * @rstrobe: read strobe width, number of cycles - 1 87 86 * @wsetup: write setup width, number of cycles - 1 ··· 88 89 * @rsetup: read setup width, number of cycles - 1 89 90 * @rhold: read hold width, number of cycles - 1 90 91 * @ta: minimum turn around time, number of cycles - 1 91 - * @enable_ss: enable/disable select strobe mode 92 - * @enable_ew: enable/disable extended wait mode 93 - * @asize: width of the asynchronous device's data bus 94 92 */ 95 - struct aemif_cs_data { 96 - u8 cs; 93 + struct aemif_cs_timings { 97 94 u32 wstrobe; 98 95 u32 rstrobe; 99 96 u32 wsetup; ··· 97 102 u32 rsetup; 98 103 u32 rhold; 99 104 u32 ta; 105 + }; 106 + 107 + /** 108 + * struct aemif_cs_data: structure to hold CS parameters 109 + * @timings: timings configuration 110 + * @cs: chip-select number 111 + * @enable_ss: enable/disable select strobe mode 112 + * @enable_ew: enable/disable extended wait mode 113 + * @asize: width of the asynchronous device's data bus 114 + */ 115 + struct aemif_cs_data { 116 + struct aemif_cs_timings timings; 117 + u8 cs; 100 118 u8 enable_ss; 101 119 u8 enable_ew; 102 120 u8 asize; ··· 187 179 188 180 offset = A1CR_OFFSET + (data->cs - aemif->cs_offset) * 4; 189 181 190 - set = TA(data->ta) | 191 - RHOLD(data->rhold) | RSTROBE(data->rstrobe) | RSETUP(data->rsetup) | 192 - WHOLD(data->whold) | WSTROBE(data->wstrobe) | WSETUP(data->wsetup); 182 + set = TA(data->timings.ta) | 183 + RHOLD(data->timings.rhold) | RSTROBE(data->timings.rstrobe) | 184 + RSETUP(data->timings.rsetup) | WHOLD(data->timings.whold) | 185 + WSTROBE(data->timings.wstrobe) | WSETUP(data->timings.wsetup); 193 186 194 187 set |= (data->asize & ACR_ASIZE_MASK); 195 188 if (data->enable_ew) ··· 224 215 offset = A1CR_OFFSET + (data->cs - aemif->cs_offset) * 4; 225 216 val = readl(aemif->base + offset); 226 217 227 - data->ta = TA_VAL(val); 228 - data->rhold = RHOLD_VAL(val); 229 - data->rstrobe = RSTROBE_VAL(val); 230 - data->rsetup = RSETUP_VAL(val); 231 - data->whold = WHOLD_VAL(val); 232 - data->wstrobe = WSTROBE_VAL(val); 233 - data->wsetup = WSETUP_VAL(val); 218 + data->timings.ta = TA_VAL(val); 219 + data->timings.rhold = RHOLD_VAL(val); 220 + data->timings.rstrobe = RSTROBE_VAL(val); 221 + data->timings.rsetup = RSETUP_VAL(val); 222 + data->timings.whold = WHOLD_VAL(val); 223 + data->timings.wstrobe = WSTROBE_VAL(val); 224 + data->timings.wsetup = WSETUP_VAL(val); 234 225 data->enable_ew = EW_VAL(val); 235 226 data->enable_ss = SSTROBE_VAL(val); 236 227 data->asize = val & ASIZE_MAX; ··· 281 272 if (ret < 0) 282 273 return ret; 283 274 284 - data->ta = ret; 275 + data->timings.ta = ret; 285 276 } 286 277 287 278 if (!of_property_read_u32(np, "ti,cs-read-hold-ns", &val)) { ··· 289 280 if (ret < 0) 290 281 return ret; 291 282 292 - data->rhold = ret; 283 + data->timings.rhold = ret; 293 284 } 294 285 295 286 if (!of_property_read_u32(np, "ti,cs-read-strobe-ns", &val)) { ··· 297 288 if (ret < 0) 298 289 return ret; 299 290 300 - data->rstrobe = ret; 291 + data->timings.rstrobe = ret; 301 292 } 302 293 303 294 if (!of_property_read_u32(np, "ti,cs-read-setup-ns", &val)) { ··· 305 296 if (ret < 0) 306 297 return ret; 307 298 308 - data->rsetup = ret; 299 + data->timings.rsetup = ret; 309 300 } 310 301 311 302 if (!of_property_read_u32(np, "ti,cs-write-hold-ns", &val)) { ··· 313 304 if (ret < 0) 314 305 return ret; 315 306 316 - data->whold = ret; 307 + data->timings.whold = ret; 317 308 } 318 309 319 310 if (!of_property_read_u32(np, "ti,cs-write-strobe-ns", &val)) { ··· 321 312 if (ret < 0) 322 313 return ret; 323 314 324 - data->wstrobe = ret; 315 + data->timings.wstrobe = ret; 325 316 } 326 317 327 318 if (!of_property_read_u32(np, "ti,cs-write-setup-ns", &val)) { ··· 329 320 if (ret < 0) 330 321 return ret; 331 322 332 - data->wsetup = ret; 323 + data->timings.wsetup = ret; 333 324 } 334 325 335 326 if (!of_property_read_u32(np, "ti,cs-bus-width", &val))