All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ивайло Димитров" <freemangordon@abv.bg>
To: "Pali Rohár" <pali.rohar@gmail.com>
Cc: tony@atomide.com, juha.yrjola@solidboot.com,
	linux@arm.linux.org.uk, mpm@selenic.com,
	herbert@gondor.apana.org.au, linux-omap@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] OMAP3 ROM Random Number Generator support
Date: Sun, 31 Mar 2013 15:05:42 +0300 (EEST)	[thread overview]
Message-ID: <2059303614.30062.1364731542427.JavaMail.apache@mail83.abv.bg> (raw)

 
Hi Pali,

Yep, the code looks almost identical, I guess with some tweaks all SMC code from that patch could be removed and instead used the one from SMC PPA API. 

What I don't get, is why one needs to disable/enable fiqs/irqs:

+static int call_sec_rom(u32 appl_id, u32 proc_id, u32 flag, ...)
+{
+	va_list ap;
+	u32 ret;
+	u32 val;
+
+	va_start(ap, flag);
+	val = *(u32 *) &ap;
+	local_irq_disable();
+	local_fiq_disable();
+	ret = omap3_rom_rng_call(appl_id, proc_id, flag,
+				 (u32) virt_to_phys((void *) val));
+	local_fiq_enable();
+	local_irq_enable();
+	va_end(ap);
+
+	return ret;
+}

Do you have any idea why is that needed? Any other code I've ever seen to call SM, does not disable fiqs/irqs, is RNG SMC somehow special? I know this is Nokia's code, but still, if we can get some understanding...

Regards,
Ivo

 >-------- Оригинално писмо --------
 >От:  Pali Rohár 
 >Относно: Re: [PATCH] OMAP3 ROM Random Number Generator support
 >До: Tony Lindgren 
 >Изпратено на: Неделя, 2013, Март 31 12:28:12 EEST
 >
 >
 >On Thursday 28 March 2013 22:44:11 Tony Lindgren wrote:
 >> * Pali Rohár  [130328 10:58]:
 >> > Here is new version of patch:
 >> > 
 >> > --- a/arch/arm/mach-omap2/devices.c
 >> > +++ b/arch/arm/mach-omap2/devices.c
 >> > @@ -486,6 +486,23 @@ static void omap_init_mcspi(void)
 >> > 
 >> >  static inline void omap_init_mcspi(void) {}
 >> >  #endif
 >> > 
 >> > +extern u32 *omap3_rom_rng_call(u32 id, u32 proc, u32 flags,
 >> > u32 va_ptr); +
 >> > +static struct platform_device omap3_rom_rng_device = {
 >> > +	.name		= &quot;omap3-rom-rng&quot;,
 >> > +	.id		= -1,
 >> > +	.dev	= {
 >> > +		.platform_data	= omap3_rom_rng_call,
 >> > +	},
 >> > +};
 >> > +
 >> > +static void omap_init_rom_rng(void)
 >> > +{
 >> > +	if (!cpu_is_omap34xx() || omap_type() ==
 >> > OMAP2_DEVICE_TYPE_GP) +		return;
 >> > +	platform_device_register(&amp;omap3_rom_rng_device);
 >> > +}
 >> > +
 >> > 
 >> >  /**
 >> >  
 >> >   * omap_init_rng - bind the RNG hwmod to the RNG
 >> >   omap_device *
 >> 
 >> This driver probably only works on Nokia boards because of the
 >> different SMC call numbering. Until it's been verified on some
 >> other HS omap34xx, I'd probably register this only from the
 >> Nokia board-*.c file.
 >> 
 >
 >Freemangordon, can you look at this smc and errara 430973 code if 
 >they could be merged? Really omap3_rom_rng_call function looks 
 >like n900 specific.
 >
 >Link: https://lkml.org/lkml/2013/3/28/398
 >
 >> > --- /dev/null
 >> > +++ b/drivers/char/hw_random/omap3-rom-rng.c
 >> > +static int omap3_rom_rng_probe(struct platform_device
 >> > *pdev) +{
 >> > +	printk(KERN_INFO &quot;%s: initializing&#92;n&quot;,
 >> > omap3_rom_rng_name); +
 >> > +	omap3_rom_rng_call = pdev->dev.platform_data;
 >> > +	if (!omap3_rom_rng_call) {
 >> > +		printk(KERN_ERR &quot;%s: omap3_rom_rng_call is NULL&#92;n&quot;,
 >> > +		       omap3_rom_rng_name);
 >> > +		return -EINVAL;
 >> > +	}
 >> > +
 >> > +	setup_timer(&amp;idle_timer, omap3_rom_idle_rng, 0);
 >> > +	rng_clk = clk_get_sys(&quot;omap_rng&quot;, &quot;ick&quot;);
 >> > +	if (IS_ERR(rng_clk)) {
 >> > +		printk(KERN_ERR &quot;%s: unable to get RNG clock&#92;n&quot;,
 >> > +		       omap3_rom_rng_name);
 >> > +		return IS_ERR(rng_clk);
 >> > +	}
 >> 
 >> You can use regular clk_get if you add the alias to
 >> struct omap_clk omap3xxx_clks table.
 >> 
 >> Regards,
 >> 
 >> Tony
 >
 >Tony, can you show me how?
 >
 >-- 
 >Pali Rohár
 >pali.rohar@gmail.com
 >

WARNING: multiple messages have this Message-ID (diff)
From: "Ивайло Димитров" <freemangordon@abv.bg>
To: "Pali Rohár" <pali.rohar@gmail.com>
Cc: tony@atomide.com, juha.yrjola@solidboot.com,
	linux@arm.linux.org.uk, mpm@selenic.com,
	herbert@gondor.hengli.com.au, linux-omap@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] OMAP3 ROM Random Number Generator support
Date: Sun, 31 Mar 2013 15:05:42 +0300 (EEST)	[thread overview]
Message-ID: <2059303614.30062.1364731542427.JavaMail.apache@mail83.abv.bg> (raw)

 
Hi Pali,

Yep, the code looks almost identical, I guess with some tweaks all SMC code from that patch could be removed and instead used the one from SMC PPA API. 

What I don't get, is why one needs to disable/enable fiqs/irqs:

+static int call_sec_rom(u32 appl_id, u32 proc_id, u32 flag, ...)
+{
+	va_list ap;
+	u32 ret;
+	u32 val;
+
+	va_start(ap, flag);
+	val = *(u32 *) &ap;
+	local_irq_disable();
+	local_fiq_disable();
+	ret = omap3_rom_rng_call(appl_id, proc_id, flag,
+				 (u32) virt_to_phys((void *) val));
+	local_fiq_enable();
+	local_irq_enable();
+	va_end(ap);
+
+	return ret;
+}

Do you have any idea why is that needed? Any other code I've ever seen to call SM, does not disable fiqs/irqs, is RNG SMC somehow special? I know this is Nokia's code, but still, if we can get some understanding...

Regards,
Ivo

 >-------- Оригинално писмо --------
 >От:  Pali Rohár 
 >Относно: Re: [PATCH] OMAP3 ROM Random Number Generator support
 >До: Tony Lindgren 
 >Изпратено на: Неделя, 2013, Март 31 12:28:12 EEST
 >
 >
 >On Thursday 28 March 2013 22:44:11 Tony Lindgren wrote:
 >> * Pali Rohár  [130328 10:58]:
 >> > Here is new version of patch:
 >> > 
 >> > --- a/arch/arm/mach-omap2/devices.c
 >> > +++ b/arch/arm/mach-omap2/devices.c
 >> > @@ -486,6 +486,23 @@ static void omap_init_mcspi(void)
 >> > 
 >> >  static inline void omap_init_mcspi(void) {}
 >> >  #endif
 >> > 
 >> > +extern u32 *omap3_rom_rng_call(u32 id, u32 proc, u32 flags,
 >> > u32 va_ptr); +
 >> > +static struct platform_device omap3_rom_rng_device = {
 >> > +	.name		= &quot;omap3-rom-rng&quot;,
 >> > +	.id		= -1,
 >> > +	.dev	= {
 >> > +		.platform_data	= omap3_rom_rng_call,
 >> > +	},
 >> > +};
 >> > +
 >> > +static void omap_init_rom_rng(void)
 >> > +{
 >> > +	if (!cpu_is_omap34xx() || omap_type() ==
 >> > OMAP2_DEVICE_TYPE_GP) +		return;
 >> > +	platform_device_register(&amp;omap3_rom_rng_device);
 >> > +}
 >> > +
 >> > 
 >> >  /**
 >> >  
 >> >   * omap_init_rng - bind the RNG hwmod to the RNG
 >> >   omap_device *
 >> 
 >> This driver probably only works on Nokia boards because of the
 >> different SMC call numbering. Until it's been verified on some
 >> other HS omap34xx, I'd probably register this only from the
 >> Nokia board-*.c file.
 >> 
 >
 >Freemangordon, can you look at this smc and errara 430973 code if 
 >they could be merged? Really omap3_rom_rng_call function looks 
 >like n900 specific.
 >
 >Link: https://lkml.org/lkml/2013/3/28/398
 >
 >> > --- /dev/null
 >> > +++ b/drivers/char/hw_random/omap3-rom-rng.c
 >> > +static int omap3_rom_rng_probe(struct platform_device
 >> > *pdev) +{
 >> > +	printk(KERN_INFO &quot;%s: initializing&#92;n&quot;,
 >> > omap3_rom_rng_name); +
 >> > +	omap3_rom_rng_call = pdev->dev.platform_data;
 >> > +	if (!omap3_rom_rng_call) {
 >> > +		printk(KERN_ERR &quot;%s: omap3_rom_rng_call is NULL&#92;n&quot;,
 >> > +		       omap3_rom_rng_name);
 >> > +		return -EINVAL;
 >> > +	}
 >> > +
 >> > +	setup_timer(&amp;idle_timer, omap3_rom_idle_rng, 0);
 >> > +	rng_clk = clk_get_sys(&quot;omap_rng&quot;, &quot;ick&quot;);
 >> > +	if (IS_ERR(rng_clk)) {
 >> > +		printk(KERN_ERR &quot;%s: unable to get RNG clock&#92;n&quot;,
 >> > +		       omap3_rom_rng_name);
 >> > +		return IS_ERR(rng_clk);
 >> > +	}
 >> 
 >> You can use regular clk_get if you add the alias to
 >> struct omap_clk omap3xxx_clks table.
 >> 
 >> Regards,
 >> 
 >> Tony
 >
 >Tony, can you show me how?
 >
 >-- 
 >Pali Rohár
 >pali.rohar@gmail.com
 >

             reply	other threads:[~2013-03-31 12:05 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-31 12:05 Ивайло Димитров [this message]
2013-03-31 12:05 ` [PATCH] OMAP3 ROM Random Number Generator support Ивайло Димитров
2013-03-31 12:43 ` Pali Rohár
2013-03-31 12:43   ` Pali Rohár
2013-04-01 16:59 ` Tony Lindgren
2013-04-01 16:59   ` Tony Lindgren
2013-04-01 22:09 ` Aaro Koskinen
2013-04-01 22:09   ` Aaro Koskinen
  -- strict thread matches above, loose matches on Subject: below --
2013-04-01 20:37 Ивайло Димитров
2013-04-01 20:37 ` Ивайло Димитров
2013-04-02 16:17 ` Tony Lindgren
2013-04-02 16:17   ` Tony Lindgren
2013-02-28 18:05 Pali Rohár
2013-02-28 18:05 ` Pali Rohár
2013-03-24 14:15 ` Pali Rohár
2013-03-24 14:15   ` Pali Rohár
2013-03-27 21:09 ` Tony Lindgren
2013-03-27 21:09   ` Tony Lindgren
2013-03-27 22:03   ` Pali Rohár
2013-03-27 22:03     ` Pali Rohár
2013-03-27 22:25     ` Tony Lindgren
2013-03-27 22:25       ` Tony Lindgren
2013-03-28 17:54       ` Pali Rohár
2013-03-28 17:54         ` Pali Rohár
2013-03-28 21:44         ` Tony Lindgren
2013-03-28 21:44           ` Tony Lindgren
2013-03-31  9:28           ` Pali Rohár
2013-03-31  9:28             ` Pali Rohár
2013-04-01 16:25             ` Tony Lindgren
2013-04-01 16:25               ` Tony Lindgren
2013-03-28  9:52   ` Russell King - ARM Linux
2013-03-28  9:52     ` Russell King - ARM Linux
2013-03-28 17:24     ` Pali Rohár
2013-03-28 17:24       ` Pali Rohár

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=2059303614.30062.1364731542427.JavaMail.apache@mail83.abv.bg \
    --to=freemangordon@abv.bg \
    --cc=herbert@gondor.apana.org.au \
    --cc=juha.yrjola@solidboot.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mpm@selenic.com \
    --cc=pali.rohar@gmail.com \
    --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.