All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "Peng.Zhou" <peng.zhou@mediatek.com>,
	Eric Biggers <ebiggers@kernel.org>,
	linux-block <linux-block@vger.kernel.org>,
	Chaotian Jing <chaotian.jing@mediatek.com>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Satya Tangirala <satyat@google.com>,
	Wulin Li <wulin.li@mediatek.com>, Arnd Bergmann <arnd@arndb.de>,
	Sudeep Holla <sudeep.holla@arm.com>
Subject: Re: [PATCH v2 2/4] mmc: Mediatek: enable crypto hardware engine
Date: Tue, 23 Mar 2021 14:37:35 +0100	[thread overview]
Message-ID: <CAPDyKFoCjv7S_2yyVZOAgwbEEZV5H_dmQxQGFVTt7awSE3Ss8Q@mail.gmail.com> (raw)
In-Reply-To: <CACRpkdapAOq7NtZDOgnugvTmO0+Yh+EoCVod-s_akPfs2=Sj9Q@mail.gmail.com>

On Mon, 22 Mar 2021 at 14:45, Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Tue, Mar 16, 2021 at 2:56 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> > It looks like we have a couple of options to support this. I suggest
> > we consider the two below, but perhaps others (Arnd/Linus?) have
> > better ideas?
>
> Admittedly it's a bit hard to shoehorn this in as it is not a standard
> resource (clk, regulator, genpd, reset, gpio...)

In my opinion, I wouldn't object if we would model this as phy, simply
because I think it would be the easiest way. Although, I agree, it's
not a perfect fit.

>
> There is drivers/soc and then you end up with the same custom
> abstraction that qcom is using. The upside to using that
> is that we can #ifdef it to static stubs in the .h file if this SoC
> is not used, so I would go for that.
>
> See for example qcom_scm_ice_invalidate_key() used from
> drivers/firmware/qcom_scm.c, header is at
> include/linux/qcom_scm.h and here you find:
> #if IS_ENABLED(CONFIG_QCOM_SCM)
> and if not, there are some stubs.

Please, no. As discussed and also pointed out by Arnd in another
thread, generic drivers must remain portable and must not get
sprinkled with SoC specific code. If not, we would be moving backwards
and increasing the fragmentation of the kernel.

The qcom case is about programming a crypto key, which seems rather
specific to me. I can't figure out another generic way to support
this, but using the SoC specific calls.

The Mediatek case is about turning on/off a resource to activate the
device. If the phy framework doesn't work for us (or another), then at
least we should fall back to use runtime PM + PM domain provider
(genpd), because this would solve the problem. SoC specific code, like
the SMC call can then be called from the genpd provider driver and
abstracted from generic drivers.

Additionally, in this case the mmc driver has already runtime PM
support deployed, which means some of the work has already been
completed.

>
> Yours,
> Linus Walleij

Kind regards
Uffe

  reply	other threads:[~2021-03-23 13:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09  1:57 [PATCH v2 2/4] mmc: Mediatek: enable crypto hardware engine Peng Zhou
2021-03-11 11:16 ` Ulf Hansson
2021-03-11 13:48 ` Linus Walleij
2021-03-11 19:08   ` Eric Biggers
2021-03-12  9:05     ` Ulf Hansson
2021-03-12 10:47       ` Arnd Bergmann
     [not found]       ` <1615884533.21508.118.camel@mbjsdccf07>
2021-03-16 10:09         ` Ulf Hansson
     [not found]           ` <1615893329.21508.128.camel@mbjsdccf07>
2021-03-16 13:55             ` Ulf Hansson
2021-03-22 13:45               ` Linus Walleij
2021-03-23 13:37                 ` Ulf Hansson [this message]
2021-03-15 13:41     ` Linus Walleij
2021-03-15 23:02       ` Eric Biggers

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=CAPDyKFoCjv7S_2yyVZOAgwbEEZV5H_dmQxQGFVTt7awSE3Ss8Q@mail.gmail.com \
    --to=ulf.hansson@linaro.org \
    --cc=adrian.hunter@intel.com \
    --cc=arnd@arndb.de \
    --cc=chaotian.jing@mediatek.com \
    --cc=devicetree@vger.kernel.org \
    --cc=ebiggers@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=peng.zhou@mediatek.com \
    --cc=satyat@google.com \
    --cc=sudeep.holla@arm.com \
    --cc=wulin.li@mediatek.com \
    /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.