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.

mtd: spinand: Give the bus interface to the configuration helper

The chip configuration hook is the one responsible to actually switch
the switch between bus interfaces. It is natural to give it the bus
interface we expect with a new parameter. For now the only value we can
give is SSDR, but this is subject to change in the future, so add a bit
of extra logic in the implementations of this callback to make sure
both the core and the chip driver are aligned on the request.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

+26 -10
+1 -1
drivers/mtd/nand/spi/core.c
··· 1604 1604 return ret; 1605 1605 1606 1606 if (spinand->configure_chip) { 1607 - ret = spinand->configure_chip(spinand); 1607 + ret = spinand->configure_chip(spinand, SSDR); 1608 1608 if (ret) 1609 1609 return ret; 1610 1610 }
+21 -7
drivers/mtd/nand/spi/winbond.c
··· 311 311 return -EINVAL; 312 312 } 313 313 314 - static int w25n0xjw_hs_cfg(struct spinand_device *spinand) 314 + static int w25n0xjw_hs_cfg(struct spinand_device *spinand, 315 + enum spinand_bus_interface iface) 315 316 { 316 317 const struct spi_mem_op *op; 317 318 bool hs; 318 319 u8 sr4; 319 320 int ret; 321 + 322 + if (iface != SSDR) 323 + return -EOPNOTSUPP; 320 324 321 325 op = spinand->op_templates->read_cache; 322 326 if (op->cmd.dtr || op->addr.dtr || op->dummy.dtr || op->data.dtr) ··· 375 371 return 0; 376 372 } 377 373 378 - static int w35n0xjw_vcr_cfg(struct spinand_device *spinand) 374 + static int w35n0xjw_vcr_cfg(struct spinand_device *spinand, 375 + enum spinand_bus_interface iface) 379 376 { 380 - const struct spi_mem_op *op; 377 + const struct spi_mem_op *ref_op; 381 378 unsigned int dummy_cycles; 382 379 bool dtr, single; 383 380 u8 io_mode; 384 381 int ret; 385 382 386 - op = spinand->op_templates->read_cache; 383 + switch (iface) { 384 + case SSDR: 385 + ref_op = spinand->ssdr_op_templates.read_cache; 386 + break; 387 + default: 388 + return -EOPNOTSUPP; 389 + }; 387 390 388 - dummy_cycles = ((op->dummy.nbytes * 8) / op->dummy.buswidth) / (op->dummy.dtr ? 2 : 1); 391 + dummy_cycles = ((ref_op->dummy.nbytes * 8) / ref_op->dummy.buswidth) / 392 + (ref_op->dummy.dtr ? 2 : 1); 389 393 switch (dummy_cycles) { 390 394 case 8: 391 395 case 12: ··· 410 398 if (ret) 411 399 return ret; 412 400 413 - single = (op->cmd.buswidth == 1 && op->addr.buswidth == 1 && op->data.buswidth == 1); 414 - dtr = (op->cmd.dtr && op->addr.dtr && op->data.dtr); 401 + single = (ref_op->cmd.buswidth == 1 && 402 + ref_op->addr.buswidth == 1 && 403 + ref_op->data.buswidth == 1); 404 + dtr = (ref_op->cmd.dtr && ref_op->addr.dtr && ref_op->data.dtr); 415 405 if (single && !dtr) 416 406 io_mode = W35N01JW_VCR_IO_MODE_SINGLE_SDR; 417 407 else if (!single && !dtr)
+4 -2
include/linux/mtd/spinand.h
··· 530 530 const struct spinand_op_variants *vendor_ops; 531 531 int (*select_target)(struct spinand_device *spinand, 532 532 unsigned int target); 533 - int (*configure_chip)(struct spinand_device *spinand); 533 + int (*configure_chip)(struct spinand_device *spinand, 534 + enum spinand_bus_interface iface); 534 535 int (*set_cont_read)(struct spinand_device *spinand, 535 536 bool enable); 536 537 struct spinand_fact_otp fact_otp; ··· 706 705 const struct spinand_manufacturer *manufacturer; 707 706 void *priv; 708 707 709 - int (*configure_chip)(struct spinand_device *spinand); 708 + int (*configure_chip)(struct spinand_device *spinand, 709 + enum spinand_bus_interface iface); 710 710 bool cont_read_possible; 711 711 int (*set_cont_read)(struct spinand_device *spinand, 712 712 bool enable);