mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 06:02:05 +00:00
055a251214
This extends the API somewhat to allow for platform-specific VCR reading and writing. Some platforms (like SH4-202) implement the VCR in a split VCRL and VCRH, but end up being in reverse order or have other quirks that need to be dealt with, so we add a set of superhyway_ops per-bus to accomodate this. We also have to extend the per-device resources somewhat, as some devices now conveniently split control and data blocks. So we allow a platform to register its set of SuperHyway devices via superhyway_add_devices() with the control block always ordered as the first resource (as this is the one that userspace cares about). Signed-off-by: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
46 lines
1.3 KiB
C
46 lines
1.3 KiB
C
/*
|
|
* drivers/sh/superhyway/superhyway-sysfs.c
|
|
*
|
|
* SuperHyway Bus sysfs interface
|
|
*
|
|
* Copyright (C) 2004, 2005 Paul Mundt <lethal@linux-sh.org>
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
* for more details.
|
|
*/
|
|
#include <linux/kernel.h>
|
|
#include <linux/device.h>
|
|
#include <linux/types.h>
|
|
#include <linux/superhyway.h>
|
|
|
|
#define superhyway_ro_attr(name, fmt, field) \
|
|
static ssize_t name##_show(struct device *dev, struct device_attribute *attr, char *buf) \
|
|
{ \
|
|
struct superhyway_device *s = to_superhyway_device(dev); \
|
|
return sprintf(buf, fmt, s->field); \
|
|
}
|
|
|
|
/* VCR flags */
|
|
superhyway_ro_attr(perr_flags, "0x%02x\n", vcr.perr_flags);
|
|
superhyway_ro_attr(merr_flags, "0x%02x\n", vcr.merr_flags);
|
|
superhyway_ro_attr(mod_vers, "0x%04x\n", vcr.mod_vers);
|
|
superhyway_ro_attr(mod_id, "0x%04x\n", vcr.mod_id);
|
|
superhyway_ro_attr(bot_mb, "0x%02x\n", vcr.bot_mb);
|
|
superhyway_ro_attr(top_mb, "0x%02x\n", vcr.top_mb);
|
|
|
|
/* Misc */
|
|
superhyway_ro_attr(resource, "0x%08lx\n", resource[0].start);
|
|
|
|
struct device_attribute superhyway_dev_attrs[] = {
|
|
__ATTR_RO(perr_flags),
|
|
__ATTR_RO(merr_flags),
|
|
__ATTR_RO(mod_vers),
|
|
__ATTR_RO(mod_id),
|
|
__ATTR_RO(bot_mb),
|
|
__ATTR_RO(top_mb),
|
|
__ATTR_RO(resource),
|
|
__ATTR_NULL,
|
|
};
|
|
|