OpenSBI Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nikita Shubin <nikita.shubin@maquefel.me>
To: opensbi@lists.infradead.org
Subject: [PATCH v2 0/5] I2C framework, reboot Unmatched via PMIC
Date: Wed, 20 Oct 2021 09:17:20 +0300	[thread overview]
Message-ID: <20211020091720.2ab43230@redslave.neermore.group> (raw)
In-Reply-To: <CA+zEjCuiEH0YRTztbo5MiV+6mP-Aivuot9gsPKYNyvypeiT80Q@mail.gmail.com>

Hello Alexandre!

On Wed, 20 Oct 2021 06:59:25 +0200
Alexandre Ghiti <alexandre.ghiti@canonical.com> wrote:

> On Fri, Oct 15, 2021 at 3:20 PM Nikita Shubin
> <nikita.shubin@maquefel.me> wrote:
> >
> > From: Nikita Shubin <n.shubin@yadro.com>
> >
> > This series introduce rebooting via i2c da9063 PMIC, currently on
> > SiFive Unmatched board.
> >
> > "gpio-poweroff" remains with default priority of 128 - default
> > priority, da9063 is 1 by default the least priority.
> >
> > da9063-reset {
> >         compatible = "da9063-reset";
> >         priority = <1>;
> > };
> >
> > Is required to be added as a child node of PMIC.
> >
> > tested via Linux and U-Boot with reset extension:
> >
> > OpenSBI:
> > Platform Reboot Device    : da9063-reset
> > Platform Shutdown Device  : gpio-reset
> >
> > v1 -> v2:
> > Added:
> > lib: sbi: add priority for reset handler
> >
> > Renamed read/write to smbus_write/smbus_read, as actually this
> > is not a "raw" read/write but a one with a register address
> > provided, later a "raw" version will be need but currently i don't
> > have anything to test it.
> >
> > To Xiang W:
> > I have analized your proposal of switching to sbi_list,
> > and switched i2c adapters array to list. Unfortunately
> > to switch drivers we require "init" functions.
> >
> > to Alexander Ghiti:
> >  
> > > No need for the struct i2c_adapter argument as it is globally
> > > accessible.  
> >
> > It looks like a more clean and reusable way to me, let's here more
> > opinions 
> > > Why should the da9063 device care about the adapter configuration
> > > here? I think It should just rely on an already
> > > configured/initialized i2c controller.  
> >
> > With clocks init added to sifive_i2c configure it can become usable
> > even if nobody cared about controller initialization.
> >  
> > > Establishing the link between the i2c device and its adapter
> > > should somehow be implicitly done by the i2c library, IMO the
> > > device should not care about its controller.  
> >
> > And how do you think it will look like ? In out case it's not a
> > separate driver/client entity but all togather for simplicity.
> >
> > Nikita Shubin (5):
> >   lib: utils/reset: add priority to gpio reset
> >   lib: utils/i2c: Add generic I2C configuration library
> >   lib: utils/i2c: Add simple FDT based I2C framework
> >   lib: utils/i2c: Add minimal SiFive I2C driver
> >   lib: utils/reset: Add generic da9063 reset driver
> >
> >  include/sbi_utils/i2c/fdt_i2c.h    |  26 +++
> >  include/sbi_utils/i2c/i2c.h        |  99 +++++++++++
> >  lib/utils/i2c/fdt_i2c.c            | 111 ++++++++++++
> >  lib/utils/i2c/fdt_i2c_sifive.c     | 271
> > +++++++++++++++++++++++++++++ lib/utils/i2c/i2c.c                |
> > 85 +++++++++ lib/utils/i2c/objects.mk           |  12 ++
> >  lib/utils/reset/fdt_reset.c        |   2 +
> >  lib/utils/reset/fdt_reset_da9063.c | 214 +++++++++++++++++++++++
> >  lib/utils/reset/fdt_reset_gpio.c   |  18 +-
> >  lib/utils/reset/objects.mk         |   1 +
> >  10 files changed, 836 insertions(+), 3 deletions(-)
> >  create mode 100644 include/sbi_utils/i2c/fdt_i2c.h
> >  create mode 100644 include/sbi_utils/i2c/i2c.h
> >  create mode 100644 lib/utils/i2c/fdt_i2c.c
> >  create mode 100644 lib/utils/i2c/fdt_i2c_sifive.c
> >  create mode 100644 lib/utils/i2c/i2c.c
> >  create mode 100644 lib/utils/i2c/objects.mk
> >  create mode 100644 lib/utils/reset/fdt_reset_da9063.c
> >
> > --
> > 2.31.1
> >  
> 
> I'm testing your patchset and although it seems to work from Linux, it
> fails when used from u-boot at the first smbus_write in
> da9063_sanity_check. Maybe it relies on some initialization done by
> the Linux driver?
> 

That's sound strange becouse i explicitly tested with u-boot SBI
extension, well in fact i tested mostly via u-boot because it's quicker
than booting Linux.

Do you have CONFIG_SYS_I2C_OCORES enabled ?

I tested on u-boot v2021.07 with Sifive Unmatched patches and SBI reset
extension applied. May it is time for configure ;) ?

Sharing my u-boot branch:
https://github.com/maquefel/u-boot/tree/yadro/riscv/unmatched-v2021.07


> Thanks,
> 
> Alex
> 
> 
> >
> > --
> > opensbi mailing list
> > opensbi at lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/opensbi  



  reply	other threads:[~2021-10-20  6:17 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-15 13:19 [PATCH v2 0/5] I2C framework, reboot Unmatched via PMIC Nikita Shubin
2021-10-15 13:19 ` [PATCH v2 1/5] lib: utils/reset: add priority to gpio reset Nikita Shubin
2021-10-15 13:19 ` [PATCH v2 2/5] lib: utils/i2c: Add generic I2C configuration library Nikita Shubin
2021-10-19 12:04   ` Alexandre Ghiti
2021-10-20  6:41     ` Nikita Shubin
2021-10-20  8:19       ` Alexandre Ghiti
2021-10-15 13:19 ` [PATCH v2 3/5] lib: utils/i2c: Add simple FDT based I2C framework Nikita Shubin
2021-10-19 12:05   ` Alexandre Ghiti
2021-10-20  6:49     ` Nikita Shubin
2021-10-15 13:19 ` [PATCH v2 4/5] lib: utils/i2c: Add minimal SiFive I2C driver Nikita Shubin
2021-10-19 12:34   ` Alexandre Ghiti
2021-10-20  6:51     ` Nikita Shubin
2021-10-15 13:19 ` [PATCH v2 5/5] lib: utils/reset: Add generic da9063 reset driver Nikita Shubin
2021-10-19 12:39   ` Alexandre Ghiti
2021-10-20  7:00     ` Nikita Shubin
2021-10-20  8:33       ` Alexandre Ghiti
2021-10-20  9:00         ` Nikita Shubin
2021-10-21  4:40           ` Alexandre Ghiti
2021-10-26  8:04   ` Heinrich Schuchardt
2021-10-26  9:40     ` Heinrich Schuchardt
2021-10-26 14:17       ` Nikita Shubin
2021-11-03  7:59       ` Nikita Shubin
2021-11-03 12:07         ` Heinrich Schuchardt
2021-11-03 12:13           ` Nikita Shubin
2021-11-04 13:06             ` Anup Patel
2021-10-15 13:44 ` [PATCH v2 0/5] I2C framework, reboot Unmatched via PMIC Jessica Clarke
     [not found]   ` <1372921634305615@mail.yandex.ru>
     [not found]     ` <32095245-4C98-4C9E-9DAF-68167106A968@jrtc27.com>
2021-10-15 14:05       ` Nikita Shubin
2021-10-15 14:21         ` Jessica Clarke
2021-10-15 15:05           ` Alexandre Ghiti
2021-10-19 11:57 ` Alexandre Ghiti
2021-10-20  7:26   ` Nikita Shubin
2021-10-20  8:11     ` Alexandre Ghiti
2021-10-20  8:42       ` Nikita Shubin
2021-10-21  4:34         ` Alexandre Ghiti
2021-10-20  4:59 ` Alexandre Ghiti
2021-10-20  6:17   ` Nikita Shubin [this message]
2021-10-26  6:34     ` Alexandre Ghiti
2021-10-26 14:30       ` Nikita Shubin

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=20211020091720.2ab43230@redslave.neermore.group \
    --to=nikita.shubin@maquefel.me \
    --cc=opensbi@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox