All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ley Foon Tan <lftan.linux@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [U-Boot, v3, 1/3] mmc: dwmmc: socfpga: Add reset ctrl to driver
Date: Thu, 31 May 2018 11:02:39 +0800	[thread overview]
Message-ID: <CAFiDJ58t2BQyJ9Tgzrge1qF1D7KDTJimkhtadnTusGzMfy+mfg@mail.gmail.com> (raw)
In-Reply-To: <20180525111635.GB21194@bill-the-cat.ec.rr.com>

On Fri, May 25, 2018 at 7:16 PM, Tom Rini <trini@konsulko.com> wrote:
> On Fri, May 25, 2018 at 10:45:53AM +0800, Ley Foon Tan wrote:
>> On Thu, May 24, 2018 at 8:39 PM, Tom Rini <trini@konsulko.com> wrote:
>> > On Tue, May 08, 2018 at 11:19:24AM +0800, Ley Foon Tan wrote:
>> >
>> >> Add code to reset all reset signals as in mmc DT node. A reset property is an optional feature,
>> >> so only print out a warning and do not fail if a reset property is not present.
>> >>
>> >> If a reset property is discovered, then use it to deassert, thus bringing the
>> >> IP out of reset.
>> >>
>> >> Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
>> >> Reviewed-by: Simon Glass <sjg@chromium.org>
>> >> ---
>> >>  drivers/mmc/socfpga_dw_mmc.c |   17 +++++++++++++++++
>> >>  1 files changed, 17 insertions(+), 0 deletions(-)
>> >>
>> >> diff --git a/drivers/mmc/socfpga_dw_mmc.c b/drivers/mmc/socfpga_dw_mmc.c
>> >> index fa0e449..eb7e64e 100644
>> >> --- a/drivers/mmc/socfpga_dw_mmc.c
>> >> +++ b/drivers/mmc/socfpga_dw_mmc.c
>> >> @@ -13,6 +13,7 @@
>> >>  #include <linux/libfdt.h>
>> >>  #include <linux/err.h>
>> >>  #include <malloc.h>
>> >> +#include <reset.h>
>> >>
>> >>  DECLARE_GLOBAL_DATA_PTR;
>> >>
>> >> @@ -33,6 +34,20 @@ struct dwmci_socfpga_priv_data {
>> >>       unsigned int            smplsel;
>> >>  };
>> >>
>> >> +static void socfpga_dwmci_reset(struct udevice *dev)
>> >> +{
>> >> +     struct reset_ctl_bulk reset_bulk;
>> >> +     int ret;
>> >> +
>> >> +     ret = reset_get_bulk(dev, &reset_bulk);
>> >> +     if (ret) {
>> >> +             dev_warn(dev, "Can't get reset: %d\n", ret);
>> >> +             return;
>> >> +     }
>> >> +
>> >> +     reset_deassert_bulk(&reset_bulk);
>> >> +}
>> >
>> > The driver doesn't depend on DM_RESET and this code hunk doesn't either
>> > so it fails to build on a number of platforms.  This type of comment
>> > applies to the whole series, and may be fixed differently in different
>> > cases (it might be OK to enforce DM_RESET for this driver, but not for
>> > the ns16550 driver).
>> >
>> > --
>> > Tom
>> >
>> include/reset.h has the DM_RESET wrapper, so it will not cause the
>> compilation error if the CONFIG_DM_RESET is disabled.
>>
>> I have tried compile the uboot with CONFIG_DM_RESET disabled,
>> compilation is fine.
>
> This whole series causes a good percent of the world to fail to link, so
> something is off about the wrappers or use of them.  See:
> https://travis-ci.org/trini/u-boot/jobs/382783645
>
This build is happened in SPL build, when CONF_DM_RESET is enabled,
but CONFIG_SPL_RESET_SUPPORT is disabled.
So, adding #ifdef CONFIG_DM_RESET checking in these peripherals also
can't resolve the compilation error.
Two possible fix below, or you have better suggestion.

(1) select SPL_RESET_SUPPORT when DM_RESET is enabled.

diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
index 33c39b7..b43cd89 100644
--- a/drivers/reset/Kconfig
+++ b/drivers/reset/Kconfig
@@ -3,6 +3,7 @@ menu "Reset Controller Support"
 config DM_RESET
        bool "Enable reset controllers using Driver Model"
        depends on DM && OF_CONTROL
+       select SPL_RESET_SUPPORT
        help



(2) Add CONFIG_SPL_RESET_SUPPORT checking in reset.h file

diff --git a/include/reset.h b/include/reset.h
index 201bafc..0ac0a47 100644
--- a/include/reset.h
+++ b/include/reset.h
@@ -77,7 +77,8 @@ struct reset_ctl_bulk {
        unsigned int count;
 };

-#ifdef CONFIG_DM_RESET
+#if (!defined(CONFIG_SPL_BUILD) && defined(CONFIG_DM_RESET)) ||        \
+    (defined(CONFIG_SPL_RESET_SUPPORT) && defined(CONFIG_DM_RESET))


Regards
Ley Foon

  parent reply	other threads:[~2018-05-31  3:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-08  3:19 [U-Boot] [PATCH v3 0/3] drivers: Add reset ctrl to drivers Ley Foon Tan
2018-05-08  3:19 ` [U-Boot] [PATCH v3 1/3] mmc: dwmmc: socfpga: Add reset ctrl to driver Ley Foon Tan
2018-05-13 22:01   ` Simon Glass
2018-05-24  2:27     ` Ley Foon Tan
2018-05-24 12:39   ` [U-Boot] [U-Boot, v3, " Tom Rini
2018-05-25  2:45     ` Ley Foon Tan
2018-05-25 11:16       ` Tom Rini
2018-05-29 13:30         ` Dinh Nguyen
2018-05-31  3:02         ` Ley Foon Tan [this message]
2018-05-31 11:16           ` Tom Rini
2018-06-01  2:01             ` Ley Foon Tan
2018-05-08  3:19 ` [U-Boot] [PATCH v3 2/3] serial: ns16550: " Ley Foon Tan
2018-05-24  2:25   ` Ley Foon Tan
2018-05-08  3:19 ` [U-Boot] [PATCH v3 3/3] net: designware: " Ley Foon Tan
2018-05-13 22:01   ` Simon Glass
2018-05-15 21:08   ` Joe Hershberger
2018-05-24  2:22     ` Ley Foon Tan
2018-06-12 20:50       ` Joe Hershberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFiDJ58t2BQyJ9Tgzrge1qF1D7KDTJimkhtadnTusGzMfy+mfg@mail.gmail.com \
    --to=lftan.linux@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.