mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 22:21:42 +00:00
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
This commit is contained in:
parent
68cce21e3c
commit
c86b63b82f
@ -1061,10 +1061,11 @@ enum {
|
||||
CS_SELECT_AUTO_DEVICE_ID_CFG = BIT(30),
|
||||
};
|
||||
|
||||
static int bcmnand_ctrl_poll_status(struct brcmnand_controller *ctrl,
|
||||
static int bcmnand_ctrl_poll_status(struct brcmnand_host *host,
|
||||
u32 mask, u32 expected_val,
|
||||
unsigned long timeout_ms)
|
||||
{
|
||||
struct brcmnand_controller *ctrl = host->ctrl;
|
||||
unsigned long limit;
|
||||
u32 val;
|
||||
|
||||
@ -1379,7 +1380,7 @@ static void brcmnand_wp(struct mtd_info *mtd, int wp)
|
||||
* make sure ctrl/flash ready before and after
|
||||
* changing state of #WP pin
|
||||
*/
|
||||
ret = bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY |
|
||||
ret = bcmnand_ctrl_poll_status(host, NAND_CTRL_RDY |
|
||||
NAND_STATUS_READY,
|
||||
NAND_CTRL_RDY |
|
||||
NAND_STATUS_READY, 0);
|
||||
@ -1389,7 +1390,7 @@ static void brcmnand_wp(struct mtd_info *mtd, int wp)
|
||||
brcmnand_set_wp(ctrl, wp);
|
||||
nand_status_op(chip, NULL);
|
||||
/* NAND_STATUS_WP 0x00 = protected, 0x80 = not protected */
|
||||
ret = bcmnand_ctrl_poll_status(ctrl,
|
||||
ret = bcmnand_ctrl_poll_status(host,
|
||||
NAND_CTRL_RDY |
|
||||
NAND_STATUS_READY |
|
||||
NAND_STATUS_WP,
|
||||
@ -1629,13 +1630,13 @@ static void brcmnand_send_cmd(struct brcmnand_host *host, int cmd)
|
||||
*/
|
||||
if (oops_in_progress) {
|
||||
if (ctrl->cmd_pending &&
|
||||
bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY, NAND_CTRL_RDY, 0))
|
||||
bcmnand_ctrl_poll_status(host, NAND_CTRL_RDY, NAND_CTRL_RDY, 0))
|
||||
return;
|
||||
} else
|
||||
BUG_ON(ctrl->cmd_pending != 0);
|
||||
ctrl->cmd_pending = cmd;
|
||||
|
||||
ret = bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY, NAND_CTRL_RDY, 0);
|
||||
ret = bcmnand_ctrl_poll_status(host, NAND_CTRL_RDY, NAND_CTRL_RDY, 0);
|
||||
WARN_ON(ret);
|
||||
|
||||
mb(); /* flush previous writes */
|
||||
@ -1664,7 +1665,7 @@ static bool brcmstb_nand_wait_for_completion(struct nand_chip *chip)
|
||||
if (mtd->oops_panic_write || ctrl->irq < 0) {
|
||||
/* switch to interrupt polling and PIO mode */
|
||||
disable_ctrl_irqs(ctrl);
|
||||
sts = bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY,
|
||||
sts = bcmnand_ctrl_poll_status(host, NAND_CTRL_RDY,
|
||||
NAND_CTRL_RDY, 0);
|
||||
err = sts < 0;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user