1 // SPDX-License-Identifier: GPL-2.0 or later
3 * Copyright (C) 2020 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
7 #include <linux/errno.h>
9 #include <dm/uclass-internal.h>
15 * Assert the Denali NAND controller reset if found.
17 * On LD4, the bootstrap process starts running after power-on reset regardless
18 * of the boot mode, here the pin-mux is not necessarily set up for NAND, then
19 * the controller is stuck. Assert the controller reset here, and should be
20 * deasserted in the driver after the pin-mux is correctly handled. For other
21 * SoCs, the bootstrap runs only when the boot mode selects ONFi, but it is yet
22 * effective when the boot swap is on. So, the reset should be asserted anyway.
24 void uniphier_nand_reset_assert(void)
27 struct reset_ctl_bulk resets;
30 ret = uclass_find_first_device(UCLASS_MTD, &dev);
34 /* make sure this is the Denali NAND controller */
35 if (strcmp(dev->driver->name, "denali-nand-dt"))
38 ret = reset_get_bulk(dev, &resets);
42 reset_assert_bulk(&resets);