All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] i2c: mvtwsi: avoid writing to twsi_control_flags prior to relocation
Date: Fri, 13 May 2016 07:49:19 +0200	[thread overview]
Message-ID: <57356ADF.8060405@denx.de> (raw)
In-Reply-To: <CAFOYHZA6a-EG11OAP7LP96ZWGjfYrDwFAd2Ca6UYUyN4zwc-xA@mail.gmail.com>

Hi Chris,

On 13.05.2016 03:20, Chris Packham wrote:
> On Fri, May 13, 2016 at 10:35 AM, Chris Packham <judge.packham@gmail.com> wrote:
>> On Thu, May 12, 2016 at 9:50 PM, Stefan Roese <sr@denx.de> wrote:
>>> Hi Chris,
>>>
>>>
>>> On 12.05.2016 04:55, Chris Packham wrote:
> <snip>
>>>>          struct mvtwsi_registers *twsi = twsi_get_base(adap);
>>>>          /* ensure controller will be enabled by any twsi*() function */
>>>> -       twsi_control_flags = MVTWSI_CONTROL_TWSIEN;
>>>> +       if (gd->flags & GD_FLG_RELOC)
>>>> +               twsi_control_flags = MVTWSI_CONTROL_TWSIEN;
>>>>          /* reset controller */
>>>>          writel(0, &twsi->soft_reset);
>>>>          /* wait 2 ms -- this is what the Marvell LSP does */
>>>
>>>
>>> I've stumbled over this global data variable also before and would
>>> very much like to get rid of it. Can't you move this variable into
>>> a (newly created) private data struct instead?
>>
>> I'll take a look. The other deficiency with my solution is that
>> although it avoids the hang the driver still won't work because the
>> state that is reflected in twsi_control_flags will either cause a new
>> hang or not be updated.
>>
>
> Actually I might need some pointers on this. Where could I keep such a
> private data struct. About the only thing I can think of is either to
> add to arch_global_data or pass a flags variable through the call
> chain.

I've checked and you are correct. Unfortunately we are missing a private 
pointer in the legacy "struct i2c_adapter". So perhaps
the flags variable is the way to go (for the non-DM I2C driver).

Thanks,
Stefan

  reply	other threads:[~2016-05-13  5:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-12  2:55 [U-Boot] [PATCH 0/1] i2c: mvtwsi: running from flash ROM Chris Packham
2016-05-12  2:55 ` [U-Boot] [PATCH] i2c: mvtwsi: avoid writing to twsi_control_flags prior to relocation Chris Packham
2016-05-12  9:50   ` Stefan Roese
2016-05-12 22:35     ` Chris Packham
2016-05-13  1:20       ` Chris Packham
2016-05-13  5:49         ` Stefan Roese [this message]
2016-05-13  3:19       ` [U-Boot] [PATCH v2] i2c: mvtwsi: Eliminate twsi_control_flags Chris Packham

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=57356ADF.8060405@denx.de \
    --to=sr@denx.de \
    --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.