mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-27 09:02:06 +00:00
mtd: rawnand: tegra: Stop implementing ->select_chip()
Now that the CS to be selected is kept in chip->cur_cs and passed in nand_operation->cs, we can get rid of the ->select_chip() implementation and replace it by an internal function which is called from the chip->exec_op() and chip->ecc.read/write_xxx() hooks. Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
This commit is contained in:
parent
b25251414f
commit
2ace451cae
1 changed files with 13 additions and 17 deletions
|
@ -454,27 +454,22 @@ static const struct nand_op_parser tegra_nand_op_parser = NAND_OP_PARSER(
|
||||||
NAND_OP_PARSER_PAT_DATA_IN_ELEM(true, 4)),
|
NAND_OP_PARSER_PAT_DATA_IN_ELEM(true, 4)),
|
||||||
);
|
);
|
||||||
|
|
||||||
static int tegra_nand_exec_op(struct nand_chip *chip,
|
static void tegra_nand_select_target(struct nand_chip *chip,
|
||||||
const struct nand_operation *op,
|
unsigned int die_nr)
|
||||||
bool check_only)
|
|
||||||
{
|
|
||||||
return nand_op_parser_exec_op(chip, &tegra_nand_op_parser, op,
|
|
||||||
check_only);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void tegra_nand_select_chip(struct nand_chip *chip, int die_nr)
|
|
||||||
{
|
{
|
||||||
struct tegra_nand_chip *nand = to_tegra_chip(chip);
|
struct tegra_nand_chip *nand = to_tegra_chip(chip);
|
||||||
struct tegra_nand_controller *ctrl = to_tegra_ctrl(chip->controller);
|
struct tegra_nand_controller *ctrl = to_tegra_ctrl(chip->controller);
|
||||||
|
|
||||||
WARN_ON(die_nr >= (int)ARRAY_SIZE(nand->cs));
|
ctrl->cur_cs = nand->cs[die_nr];
|
||||||
|
|
||||||
if (die_nr < 0 || die_nr > 0) {
|
|
||||||
ctrl->cur_cs = -1;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctrl->cur_cs = nand->cs[die_nr];
|
static int tegra_nand_exec_op(struct nand_chip *chip,
|
||||||
|
const struct nand_operation *op,
|
||||||
|
bool check_only)
|
||||||
|
{
|
||||||
|
tegra_nand_select_target(chip, op->cs);
|
||||||
|
return nand_op_parser_exec_op(chip, &tegra_nand_op_parser, op,
|
||||||
|
check_only);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tegra_nand_hw_ecc(struct tegra_nand_controller *ctrl,
|
static void tegra_nand_hw_ecc(struct tegra_nand_controller *ctrl,
|
||||||
|
@ -503,6 +498,8 @@ static int tegra_nand_page_xfer(struct mtd_info *mtd, struct nand_chip *chip,
|
||||||
u32 addr1, cmd, dma_ctrl;
|
u32 addr1, cmd, dma_ctrl;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
tegra_nand_select_target(chip, chip->cur_cs);
|
||||||
|
|
||||||
if (read) {
|
if (read) {
|
||||||
writel_relaxed(NAND_CMD_READ0, ctrl->regs + CMD_REG1);
|
writel_relaxed(NAND_CMD_READ0, ctrl->regs + CMD_REG1);
|
||||||
writel_relaxed(NAND_CMD_READSTART, ctrl->regs + CMD_REG2);
|
writel_relaxed(NAND_CMD_READSTART, ctrl->regs + CMD_REG2);
|
||||||
|
@ -1116,7 +1113,6 @@ static int tegra_nand_chips_init(struct device *dev,
|
||||||
|
|
||||||
chip->options = NAND_NO_SUBPAGE_WRITE | NAND_USE_BOUNCE_BUFFER;
|
chip->options = NAND_NO_SUBPAGE_WRITE | NAND_USE_BOUNCE_BUFFER;
|
||||||
chip->exec_op = tegra_nand_exec_op;
|
chip->exec_op = tegra_nand_exec_op;
|
||||||
chip->select_chip = tegra_nand_select_chip;
|
|
||||||
chip->setup_data_interface = tegra_nand_setup_data_interface;
|
chip->setup_data_interface = tegra_nand_setup_data_interface;
|
||||||
|
|
||||||
ret = nand_scan(chip, 1);
|
ret = nand_scan(chip, 1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue