Skip to content

Commit c86b63b

Browse files
David Reganmiquelraynal
authored andcommitted
mtd: rawnand: brcmnand: pass host struct to bcmnand_ctrl_poll_status
Pass host struct to bcmnand_ctrl_poll_status instead of ctrl struct since real time status requires host, and ctrl is a member of host. Real time status is required for low level commands vs cached status since the NAND controller will not do an automatic status read at the end of a low level command as it would with a high level command. Signed-off-by: David Regan <dregan@broadcom.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20231125012438.15191-3-dregan@broadcom.com
1 parent 68cce21 commit c86b63b

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

drivers/mtd/nand/raw/brcmnand/brcmnand.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,10 +1061,11 @@ enum {
10611061
CS_SELECT_AUTO_DEVICE_ID_CFG = BIT(30),
10621062
};
10631063

1064-
static int bcmnand_ctrl_poll_status(struct brcmnand_controller *ctrl,
1064+
static int bcmnand_ctrl_poll_status(struct brcmnand_host *host,
10651065
u32 mask, u32 expected_val,
10661066
unsigned long timeout_ms)
10671067
{
1068+
struct brcmnand_controller *ctrl = host->ctrl;
10681069
unsigned long limit;
10691070
u32 val;
10701071

@@ -1379,7 +1380,7 @@ static void brcmnand_wp(struct mtd_info *mtd, int wp)
13791380
* make sure ctrl/flash ready before and after
13801381
* changing state of #WP pin
13811382
*/
1382-
ret = bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY |
1383+
ret = bcmnand_ctrl_poll_status(host, NAND_CTRL_RDY |
13831384
NAND_STATUS_READY,
13841385
NAND_CTRL_RDY |
13851386
NAND_STATUS_READY, 0);
@@ -1389,7 +1390,7 @@ static void brcmnand_wp(struct mtd_info *mtd, int wp)
13891390
brcmnand_set_wp(ctrl, wp);
13901391
nand_status_op(chip, NULL);
13911392
/* NAND_STATUS_WP 0x00 = protected, 0x80 = not protected */
1392-
ret = bcmnand_ctrl_poll_status(ctrl,
1393+
ret = bcmnand_ctrl_poll_status(host,
13931394
NAND_CTRL_RDY |
13941395
NAND_STATUS_READY |
13951396
NAND_STATUS_WP,
@@ -1629,13 +1630,13 @@ static void brcmnand_send_cmd(struct brcmnand_host *host, int cmd)
16291630
*/
16301631
if (oops_in_progress) {
16311632
if (ctrl->cmd_pending &&
1632-
bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY, NAND_CTRL_RDY, 0))
1633+
bcmnand_ctrl_poll_status(host, NAND_CTRL_RDY, NAND_CTRL_RDY, 0))
16331634
return;
16341635
} else
16351636
BUG_ON(ctrl->cmd_pending != 0);
16361637
ctrl->cmd_pending = cmd;
16371638

1638-
ret = bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY, NAND_CTRL_RDY, 0);
1639+
ret = bcmnand_ctrl_poll_status(host, NAND_CTRL_RDY, NAND_CTRL_RDY, 0);
16391640
WARN_ON(ret);
16401641

16411642
mb(); /* flush previous writes */
@@ -1664,7 +1665,7 @@ static bool brcmstb_nand_wait_for_completion(struct nand_chip *chip)
16641665
if (mtd->oops_panic_write || ctrl->irq < 0) {
16651666
/* switch to interrupt polling and PIO mode */
16661667
disable_ctrl_irqs(ctrl);
1667-
sts = bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY,
1668+
sts = bcmnand_ctrl_poll_status(host, NAND_CTRL_RDY,
16681669
NAND_CTRL_RDY, 0);
16691670
err = sts < 0;
16701671
} else {

0 commit comments

Comments
 (0)