All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Menon <nm@ti.com>
To: Tony Lindgren <tony@atomide.com>
Cc: "Grygorii Strashko" <grygorii.strashko@ti.com>,
	"H. Nikolaus Schaller" <hns@goldelico.com>,
	"Laxman Dewangan" <ldewangan@nvidia.com>,
	"Benoît Cousson" <bcousson@baylibre.com>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Pawel Moll" <pawel.moll@arm.com>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Ian Campbell" <ijc+devicetree@hellion.org.uk>,
	"Kumar Gala" <galak@codeaurora.org>,
	"Russell King" <linux@arm.linux.org.uk>,
	linux-omap <linux-omap@vger.kernel.org>,
	devicetree@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	"Marek Belisko" <marek@goldelico.com>,
	"Gražvydas Ignotas" <notasas@gmail.com>,
	Keerthy <j-keerthy@ti.com>
Subject: Re: [PATCH 1/3] ARM: dts: omap5-board-common: enable rtc and charging of backup battery
Date: Wed, 13 Jan 2016 12:18:06 -0600	[thread overview]
Message-ID: <569694DE.5050709@ti.com> (raw)
In-Reply-To: <20160113180006.GJ12777@atomide.com>

On 01/13/2016 12:00 PM, Tony Lindgren wrote:
> * Nishanth Menon <nm@ti.com> [160113 09:30]:
>> On 01/13/2016 10:48 AM, Tony Lindgren wrote:
>>>
>>> So if we start changing things to GPIO mode, we really need some
>>> further explanations and neeed to handle the GPIO pin properly in
>>> the TWL driver. And it should be done in a separate patch for all
>>> of the TWL SoCs.
>>
>> That does not make sense to me. The original intent of MSECURE is to use
>> PMIC control (in specific certain usecases - which are no longer
>> relevant) in trustzone or equivalent secure processor modes. when such a
>> mode is not planned on being used, you just tell PMIC that it is always
>> in secure mode. In fact, there was discussion internally that MSECURE
>> should never even have been connected to SoC if the SoC was GP SoC - but
>> ofcourse, the want to have a consistent reference schematics for evms
>> (since EVMs have HS/Non-HS parts) trumped such talk.
>>
>> trying to split this up into further steps adds 0 additional
>> functionality - what is the pmic driver supposed to do with the GPIO even?
>>
>> in *real* HS product devices, in fact, the register space is really
>> firewalled out
> 
> Right, OK here we are finally getting some answers to the "why" part :)
> 
> And I also have few more "why" question in mind. If this change from
> msecure to GPIO muxing is so important.
> 
> Why it was never fixed in the mainline kernel for omap4 and omap5 and
> it was just sitting in various TI trees?
> 
> And it sounds like any kind of muxing on HS devices here for this
> pin will oops the device?
> 

It depends on what the secure firewall does - unfortunately HS devices
are basically lego blocks that way. In the original usecase where
specific function like MSECURE was desired, the 4k chunk for padconf
registers would be firewalled away and only setup for access from
trustzone or a specific "trusted" processor like IPU M3/DSP.

>> The last TI product kernel tree that seriously focussed on OMAP5/OMAP4
>> was
>> http://git.omapzoom.org/?p=kernel/omap.git;a=shortlog;h=refs/heads/p-linux-omap-3.4
>> things changed definitions (in terms of descope) since then.. but
>> anyways.. thought I'd just pitch it out here.
>>
>> sevm: - this board got scrapped
>> http://git.omapzoom.org/?p=kernel/omap.git;a=blob;f=arch/arm/mach-omap2/board-omap5evm.c;h=bd8d71d75cc3da921856bb2004230e4cd6505328;hb=refs/heads/p-linux-omap-3.4#l1097
>>
>> omap5-panda is the omap5uevm/evm now:
>> http://git.omapzoom.org/?p=kernel/omap.git;a=blob;f=arch/arm/mach-omap2/board-omap5panda.c;h=6113bc0e04625a1bd794b3f169581c67ad3b42ff;hb=refs/heads/p-linux-omap-3.4#l816
> 
> OK
> 
>>> I don't have anything against adding GPIO handling to the TWL driver
>>> so it can be optionally specified. But that's clearly a separate patch
>>
>> TWL/TPS driver will need no change in the proposal I made with "gpio
>> hog" mechanism (Documentation/devicetree/bindings/gpio/gpio.txt -
>> gpio-hog property) - just a dt change for the right configuration.
> 
> OK. So are we sure the TWL driver will never have to toggle this pin?
> 
> Again, that's another "why" that I have no clue about and that is not
> documented anywhere.
> 

It is not necessary for the functions we just described -MSECURE
function by itself is not something to be controlled by "non secure"
software (which is probably weird to us, but that is what security team
folks call HLOS like Linux). I dont recollect any recent product that
actually uses MSECURE the way we originally defined it. For the sake of
debate, Lets take a theoretical case where such a function might be
desired: in such a case, "non-secure" software should generate an SMC
service call into secure world for "setting RTC time"; When ARM enters
trustzone mode, MSECURE will be auto asserted by SoC. the secure
firmware will then have an I2C driver that will send a RTC set time
register access for the RTC time to be set.


In the above definition, we should not even have an TWL RTC driver,
instead a custom TWL-SMC-RTC driver will need to be written that will
access RTC on TWL/TPS over SMC calls to secure service. infact, if DSP
was desired for the "secure access", then a DSP-RPROC-RTC driver will
have to be written. The "generic definition" then became "MSECURE" and
was envisaged to protect further stuff eventually beyond RTC(I dont
recollect more than RTC unfortunately). In all such cases, you'd not use
MSECURE in GPIO mode - that will just defeat it's original purpose.
Instead you'd set it up as MSECURE in  secure boot software(even before
HLOS starts), then firewall the region off from access by non-secure
software, finally write a shim driver to send non-secure requests to the
secure world - which will determine who of the actors can actually do
which actions..

As you already see it is ridiculously round about way of protecting RTC
time.. but anyways, for what ever reason, that was mandatory function to
support on certain product lines.


I hope this helps.

>>> and should be done by somebody who knows more about the issue and has
>>> a test case needing the GPIO logic for this pin.
>>
>> Since my explanation does not seem to suffice, alright - we can wait for
>> the right person, then.
> 
> Sorry don't take it personally. I'm just trying to make sense of the
> "why do we need to do this change?" part. Especially if I need to make
> the change and write the commit log.

Not a problem, just trying to share what I can given that not all
thought process and background work that takes place inside TI is either
"logical" or in many cases fails to reach public documentation :( .

-- 
Regards,
Nishanth Menon

  parent reply	other threads:[~2016-01-13 18:18 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-05 12:01 [PATCH 0/3] Enable twl603x-GPADC for some OMAP4/OMAP5 boards and Palmas-RTC for OMAP5 H. Nikolaus Schaller
2016-01-05 12:01 ` [PATCH 1/3] ARM: dts: omap5-board-common: enable rtc and charging of backup battery H. Nikolaus Schaller
2016-01-05 12:01   ` H. Nikolaus Schaller
2016-01-05 23:40   ` Nishanth Menon
2016-01-05 23:40     ` Nishanth Menon
2016-01-06  1:00     ` Tony Lindgren
2016-01-06  1:00       ` Tony Lindgren
2016-01-06  8:11       ` H. Nikolaus Schaller
2016-01-06 16:41         ` Tony Lindgren
2016-01-06 16:41           ` Tony Lindgren
2016-01-06 16:47           ` H. Nikolaus Schaller
2016-01-06 17:09             ` Tony Lindgren
2016-01-06 17:09               ` Tony Lindgren
2016-01-08 17:49               ` H. Nikolaus Schaller
2016-01-08 18:15                 ` Tony Lindgren
2016-01-08 18:32                   ` H. Nikolaus Schaller
2016-01-08 18:32                     ` H. Nikolaus Schaller
2016-01-08 19:04                     ` Tony Lindgren
2016-01-08 19:31                       ` H. Nikolaus Schaller
2016-01-11 20:24                         ` Tony Lindgren
2016-01-12  0:09                           ` Tony Lindgren
2016-01-12  0:09                             ` Tony Lindgren
2016-01-12 13:30                             ` H. Nikolaus Schaller
2016-01-12 13:30                               ` H. Nikolaus Schaller
2016-01-12 21:27                               ` H. Nikolaus Schaller
2016-01-12 21:37                                 ` Nishanth Menon
2016-01-12 21:37                                   ` Nishanth Menon
2016-01-12 22:13                                   ` Tony Lindgren
2016-01-12 22:13                                     ` Tony Lindgren
2016-01-13 10:25                                 ` H. Nikolaus Schaller
2016-01-13 14:55                                   ` Nishanth Menon
2016-01-13 15:14                                     ` Grygorii Strashko
2016-01-13 15:14                                       ` Grygorii Strashko
2016-01-13 16:48                                       ` Tony Lindgren
2016-01-13 17:12                                         ` Grygorii Strashko
2016-01-13 17:38                                           ` Nishanth Menon
2016-01-13 18:00                                             ` H. Nikolaus Schaller
2016-01-13 18:23                                               ` Nishanth Menon
2016-01-13 17:29                                         ` Nishanth Menon
2016-01-13 18:00                                           ` Tony Lindgren
2016-01-13 18:08                                             ` H. Nikolaus Schaller
2016-01-13 18:08                                               ` H. Nikolaus Schaller
2016-01-13 18:31                                               ` Nishanth Menon
2016-01-13 18:31                                                 ` Nishanth Menon
2016-01-13 18:44                                                 ` H. Nikolaus Schaller
2016-01-13 18:44                                                   ` H. Nikolaus Schaller
2016-01-13 19:05                                                   ` Nishanth Menon
2016-01-13 19:22                                                     ` Grygorii Strashko
2016-01-13 19:40                                                     ` Tony Lindgren
2016-01-13 22:32                                                       ` Nishanth Menon
2016-01-14 10:01                                                         ` Keerthy
2016-01-14 17:39                                                           ` Nishanth Menon
2016-01-14 17:39                                                             ` Nishanth Menon
2016-01-14 18:35                                                             ` Tony Lindgren
2016-01-14 18:35                                                               ` Tony Lindgren
2016-01-15 14:33                                                               ` H. Nikolaus Schaller
2016-01-15 15:47                                                                 ` Tony Lindgren
2016-01-15 17:10                                                                   ` Tony Lindgren
2016-01-15 17:10                                                                     ` Tony Lindgren
2016-01-15 18:11                                                                   ` H. Nikolaus Schaller
2016-08-25  2:43                                                     ` Matthijs van Duin
2016-01-13 18:18                                             ` Nishanth Menon [this message]
2016-01-06  7:42     ` H. Nikolaus Schaller
2016-01-06  8:13       ` Laxman Dewangan
2016-01-06  8:13         ` Laxman Dewangan
2016-01-06 14:36         ` Nishanth Menon
2016-01-06 19:34           ` Rob Herring
2016-01-06 19:34             ` Rob Herring
2016-01-06 19:53             ` Nishanth Menon
2016-01-06 19:53               ` Nishanth Menon
2016-01-08 19:33               ` Rob Herring
2016-01-05 12:01 ` [PATCH 2/3] ARM: dts: omap5-board-common: enable iio gpadc for Palmas H. Nikolaus Schaller
2016-01-05 12:01   ` H. Nikolaus Schaller
2016-01-05 12:01 ` [PATCH 3/3] ARM: dts: twl6030: add gpadc H. Nikolaus Schaller
2016-01-05 12:01   ` H. Nikolaus Schaller

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=569694DE.5050709@ti.com \
    --to=nm@ti.com \
    --cc=bcousson@baylibre.com \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=grygorii.strashko@ti.com \
    --cc=hns@goldelico.com \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=j-keerthy@ti.com \
    --cc=ldewangan@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=marek@goldelico.com \
    --cc=mark.rutland@arm.com \
    --cc=notasas@gmail.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=tony@atomide.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.