Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1473722

Re: [PATCH 5/5] misc: sram: add Atmel securam support

From Alexandre Belloni <alexandre.belloni@free-electrons.com>
Newsgroups linux.kernel
Subject Re: [PATCH 5/5] misc: sram: add Atmel securam support
Date 2016-08-31 19:10 +0200
Message-ID <schbs-59T-53@gated-at.bofh.it> (permalink)
References <scgp4-4D4-11@gated-at.bofh.it> <scgp5-4D4-33@gated-at.bofh.it> <scgS5-4O7-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 31/08/2016 at 18:45:37 +0200, Philipp Zabel wrote :
> Hi Alexandre,
> 
> Am Mittwoch, den 31.08.2016, 18:11 +0200 schrieb Alexandre Belloni:
> > The Atmel secure SRAM is connected to a security module and may be erased
> > automatically under certain conditions. For that reason, it is necessary to
> > wait for the security module to flag that SRAM accesses are allowed before
> > accessing it.
> > 
> > Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> > ---
> > Cc: Arnd Bergmann <arnd@arndb.de>
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Cc: Philipp Zabel <p.zabel@pengutronix.de>
> > Cc: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
> >  drivers/misc/sram.c | 52 +++++++++++++++++++++++++++++++++++++++++++++-------
> >  1 file changed, 45 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c
> > index f84b53d6ce50..8d411c64d07f 100644
> > --- a/drivers/misc/sram.c
> > +++ b/drivers/misc/sram.c
> > @@ -19,12 +19,16 @@
> >   */
> >  
> >  #include <linux/clk.h>
> > +#include <linux/delay.h>
> >  #include <linux/genalloc.h>
> >  #include <linux/io.h>
> >  #include <linux/list_sort.h>
> >  #include <linux/of_address.h>
> >  #include <linux/platform_device.h>
> > +#include <linux/regmap.h>
> >  #include <linux/slab.h>
> > +#include <linux/mfd/syscon.h>
> > +#include <soc/at91/atmel-secumod.h>
> >  
> >  #define SRAM_GRANULARITY	32
> >  
> > @@ -334,12 +338,43 @@ static int sram_reserve_regions(struct sram_dev *sram, struct resource *res)
> >  	return ret;
> >  }
> >  
> > +static int atmel_securam_wait(void)
> > +{
> > +	struct regmap *regmap;
> > +	unsigned long timeout = jiffies + HZ;
> 
> Can this really take up to a second?
> 

Well, probably not but it can take some time. My understanding is that
it can take up to almost half a second (4096 bytes at 8kHz). But quite
frankly, by the time linux is starting, the delay has probably already
expired so the while loop is unlikely to run.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] Atmel sama5d2 security module support Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-08-31 18:20 +0200
  [PATCH 1/5] Documentation: dt: atmel-at91: Document secumod bindings Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-08-31 18:20 +0200
    Re: [PATCH 1/5] Documentation: dt: atmel-at91: Document secumod  bindings Rob Herring <robh@kernel.org> - 2016-09-06 23:50 +0200
  [PATCH 5/5] misc: sram: add Atmel securam support Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-08-31 18:20 +0200
    Re: [PATCH 5/5] misc: sram: add Atmel securam support Philipp Zabel <p.zabel@pengutronix.de> - 2016-08-31 18:50 +0200
      Re: [PATCH 5/5] misc: sram: add Atmel securam support Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-08-31 19:10 +0200
  [PATCH 4/5] misc: sram: document new compatible Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-08-31 18:20 +0200
    Re: [PATCH 4/5] misc: sram: document new compatible Rob Herring <robh@kernel.org> - 2016-09-06 23:50 +0200
  [PATCH 2/5] ARM: dts: at91: sama5d2: Add secumod node Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-08-31 18:20 +0200

csiph-web