From: Jiri Slaby <jirislaby@gmail.com>
To: Bryan Wu <bryan.wu@analog.com>
Cc: linux-kernel@vger.kernel.org,
Mike Frysinger <michael.frysinger@analog.com>
Subject: Re: [PATCH 1/1] [Blackfin] char driver for Blackfin on-chip OTP memory
Date: Wed, 30 Jan 2008 12:00:03 +0100 [thread overview]
Message-ID: <47A058B3.6000009@gmail.com> (raw)
In-Reply-To: <1201689401-2892-1-git-send-email-bryan.wu@analog.com>
On 01/30/2008 11:36 AM, Bryan Wu wrote:
> From: Mike Frysinger <michael.frysinger@analog.com>
>
> initial char driver for otp memory
> (only read supported atm ... needs real examples/docs for write support)
>
> Signed-off-by: Mike Frysinger <michael.frysinger@analog.com>
> Signed-off-by: Bryan Wu <bryan.wu@analog.com>
> ---
> drivers/char/Kconfig | 28 +++++++
> drivers/char/Makefile | 1 +
> drivers/char/bfin-otp.c | 203 +++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 232 insertions(+), 0 deletions(-)
> create mode 100644 drivers/char/bfin-otp.c
>
[...]
> diff --git a/drivers/char/bfin-otp.c b/drivers/char/bfin-otp.c
> new file mode 100644
> index 0000000..896a987
> --- /dev/null
> +++ b/drivers/char/bfin-otp.c
> @@ -0,0 +1,203 @@
> +/*
> + * Blackfin On-Chip OTP Memory Interface
> + * Supports BF52x/BF54x
> + *
> + * Copyright 2007-2008 Analog Devices Inc.
> + *
> + * Enter bugs at http://blackfin.uclinux.org/
> + *
> + * Licensed under the GPL-2 or later.
> + */
> +
> +#include <linux/cdev.h>
> +#include <linux/device.h>
> +#include <linux/errno.h>
> +#include <linux/fs.h>
> +#include <linux/init.h>
> +#include <linux/module.h>
> +#include <linux/mutex.h>
> +#include <linux/types.h>
> +
> +#include <asm/blackfin.h>
> +#include <asm/uaccess.h>
> +
> +#define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args)
> +#define stampit() stamp("here i am")
> +
> +#define DRIVER_NAME "bfin-otp"
> +#define PFX DRIVER_NAME ": "
> +
> +DEFINE_MUTEX(bfin_otp_lock);
static?
> +
> +/* OTP Boot ROM functions */
> +#define _BOOTROM_OTP_COMMAND 0xEF000018
> +#define _BOOTROM_OTP_READ 0xEF00001A
> +#define _BOOTROM_OTP_WRITE 0xEF00001C
[...]
> +/**
> + * bfin_otp_init - Initialize module
> + *
> + * Registers the device and notifier handler. Actual device
> + * initialization is handled by bfin_otp_open().
> + */
> +static int __init bfin_otp_init(void)
> +{
> + int ret;
> +
> + stampit();
> +
> + ret = alloc_chrdev_region(&bfin_otp_dev_node, 0, 1, "otp");
> + if (ret) {
> + printk(KERN_ERR PFX "unable to get a char device\n");
> + return ret;
> + }
> +
> + cdev_init(&bfin_otp_cdev, &bfin_otp_fops);
> + bfin_otp_cdev.owner = THIS_MODULE;
> + bfin_otp_cdev.ops = &bfin_otp_fops;
You don't need to set the fops again.
> +
> + ret = cdev_add(&bfin_otp_cdev, bfin_otp_dev_node, 1);
> + if (ret) {
> + unregister_chrdev_region(bfin_otp_dev_node, 1);
> + printk(KERN_ERR PFX "unable to register char device\n");
> + return ret;
> + }
> +
> + bfin_otp_class = class_create(THIS_MODULE, "otp");
> + device_create(bfin_otp_class, NULL, bfin_otp_dev_node, "otp");
Anyway, wouldn't be easier/better to use misc.c functionality here
(misc_register() et al.)?
> +
> + printk(KERN_INFO PFX "initialized\n");
> +
> + return 0;
> +}
next prev parent reply other threads:[~2008-01-30 11:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-30 10:36 Bryan Wu
2008-01-30 11:00 ` Jiri Slaby [this message]
2008-01-30 12:39 ` Robin Getz
2008-01-30 13:08 ` Jiri Slaby
2008-01-30 13:15 ` Bryan Wu
2008-01-30 13:43 ` Jiri Slaby
2008-01-30 13:53 ` Jiri Slaby
2008-01-30 13:19 ` Mike Frysinger
2008-01-30 13:38 ` Jiri Slaby
2008-01-30 13:41 ` Mike Frysinger
2008-02-05 18:59 ` Mike Frysinger
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=47A058B3.6000009@gmail.com \
--to=jirislaby@gmail.com \
--cc=bryan.wu@analog.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.frysinger@analog.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
Powered by JetHome