From: Tony Lindgren <tony@atomide.com>
To: "Pali Rohár" <pali.rohar@gmail.com>
Cc: Juha Yrjola <juha.yrjola@solidboot.com>,
Russell King <linux@arm.linux.org.uk>,
Matt Mackall <mpm@selenic.com>,
Herbert Xu <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: Wed, 27 Mar 2013 14:09:18 -0700 [thread overview]
Message-ID: <20130327210918.GP10155@atomide.com> (raw)
In-Reply-To: <201302281905.48546@pali>
* Pali Rohár <pali.rohar@gmail.com> [130228 10:09]:
> --- /dev/null
> +++ b/drivers/char/hw_random/omap3-rom-asm.S
> @@ -0,0 +1,27 @@
> +/*
> + * Copyright (C) 2009 Nokia Corporation
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + */
> +
> +#include <linux/linkage.h>
> +#include <asm/assembler.h>
> +
> +ENTRY(omap3_rng_call_rom_asm)
> + .arch_extension sec
> + stmfd sp!, {r4-r12, lr}
> + stmfd sp!, {r0-r3}
> + bl v7_flush_dcache_all
> + ldmfd sp!, {r0-r3}
> + mov r6, #0xff
> + mov r12, r0
> + smc #1
> + mov r12, r0
> + bl v7_flush_dcache_all
> + mov r0, #0
> + mcr p15, 0, r0, c7, c5, 0
> + mov r0, r12
> + ldmfd sp!, {r4-r12, pc}
This part should be in arch/arm/mach-omap2 because of the
direct calls to v7_flush_dcache_all. Then you can pass a pointer
to this function in platform_data for now, and set it up based
on the compatible flag with device tree from driver later on.
> --- /dev/null
> +++ b/drivers/char/hw_random/omap3-rom-drv.c
> @@ -0,0 +1,167 @@
> +/*
> + * omap3-rom-drv.c - RNG driver for TI OMAP3 CPU family
> + *
> + * Copyright (C) 2009 Nokia Corporation
> + * Author: Juha Yrjola <juha.yrjola@solidboot.com>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2. This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/init.h>
> +#include <linux/random.h>
> +#include <linux/hw_random.h>
> +#include <linux/timer.h>
> +#include <linux/clk.h>
> +#include <linux/err.h>
> +#include <linux/platform_device.h>
> +
> +#include "../../../arch/arm/mach-omap2/soc.h"
NAK for this, this must be private to arch/arm/mach-omap2.
Instead, just create a minimal include/linux/platform_data/omap3-rom.h,
and pass the function pointer in the pdata if passed.
> +static int omap3_rom_rng_probe(struct platform_device *pdev)
> +{
> + printk(KERN_INFO "%s: initializing\n", omap3_rom_rng_name);
> + if (!cpu_is_omap34xx()) {
> + printk(KERN_ERR "%s: currently supports only OMAP34xx CPUs\n",
> + omap3_rom_rng_name);
> + return -ENODEV;
> + }
> + if (omap_type() == OMAP2_DEVICE_TYPE_GP) {
> + printk(KERN_ERR "%s: GP OMAPs not supported\n",
> + omap3_rom_rng_name);
> + return -ENODEV;
> + }
> +
> + setup_timer(&idle_timer, omap3_rom_idle_rng, 0);
> + rng_clk = clk_get_sys("omap_rng", "ick");
> + if (IS_ERR(rng_clk)) {
> + printk(KERN_ERR "%s: unable to get RNG clock\n",
> + omap3_rom_rng_name);
> + return IS_ERR(rng_clk);
> + }
> +
> + /* Leave the RNG in reset state. */
> + clk_prepare_enable(rng_clk);
> + omap3_rom_idle_rng(0);
> +
> + return hwrng_register(&omap3_rom_rng_ops);
> +}
You should replace the cpu_is_omap34xx() and omap_type() with
some flags that you pass in the pdata. These too can be then
deciphered based on the DT compatible flag later on. And then
you don't need to include soc.h.
Regards,
Tony
next prev parent reply other threads:[~2013-03-27 21:09 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-28 18:05 [PATCH] OMAP3 ROM Random Number Generator support Pali Rohár
2013-03-24 14:15 ` Pali Rohár
2013-03-27 21:09 ` Tony Lindgren [this message]
2013-03-27 22:03 ` Pali Rohár
2013-03-27 22:25 ` Tony Lindgren
2013-03-28 17:54 ` Pali Rohár
2013-03-28 21:44 ` Tony Lindgren
2013-03-31 9:28 ` Pali Rohár
2013-04-01 16:25 ` Tony Lindgren
2013-09-18 20:05 ` [PATCH 0/2] " Pali Rohár
2013-09-18 20:05 ` [PATCH 1/2] hwrng: " Pali Rohár
2013-09-18 20:22 ` Joe Perches
2013-09-18 20:50 ` Aaro Koskinen
2013-09-18 20:05 ` [PATCH 2/2] RX-51: Add support for OMAP3 ROM Random Number Generator Pali Rohár
2013-09-18 20:39 ` Tony Lindgren
2013-09-20 13:25 ` [PATCH v2 0/3] OMAP3 ROM Random Number Generator support Pali Rohár
2013-09-20 13:25 ` [PATCH v2 1/3] omap2: Change clk dev id for rng to omap3-rom-rng Pali Rohár
2013-09-20 16:23 ` Tony Lindgren
2013-09-20 16:41 ` Pali Rohár
2013-09-20 17:46 ` Tony Lindgren
2013-09-20 18:24 ` Pali Rohár
2013-09-20 18:31 ` Tony Lindgren
2013-09-20 13:25 ` [PATCH v2 2/3] hwrng: OMAP3 ROM Random Number Generator support Pali Rohár
2013-10-08 19:04 ` Tony Lindgren
2013-10-16 12:57 ` Herbert Xu
2013-11-18 21:51 ` Pali Rohár
2013-11-19 2:14 ` Herbert Xu
2013-11-23 9:37 ` Pali Rohár
2013-11-23 12:09 ` Sebastian Reichel
2013-09-20 13:25 ` [PATCH v2 3/3] RX-51: Add support for OMAP3 ROM Random Number Generator Pali Rohár
2013-10-08 19:06 ` Tony Lindgren
2013-03-28 9:52 ` [PATCH] OMAP3 ROM Random Number Generator support Russell King - ARM Linux
2013-03-28 17:24 ` Pali Rohár
-- strict thread matches above, loose matches on Subject: below --
2013-03-31 12:05 Ивайло Димитров
2013-03-31 12:43 ` Pali Rohár
2013-04-01 16:59 ` Tony Lindgren
2013-04-01 22:09 ` Aaro Koskinen
2013-04-01 20:37 Ивайло Димитров
2013-04-02 16:17 ` Tony Lindgren
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=20130327210918.GP10155@atomide.com \
--to=tony@atomide.com \
--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 \
/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;
as well as URLs for NNTP newsgroup(s).