Commit fca18b6a authored by Anton Blanchard's avatar Anton Blanchard

Merge samba.org:/scratch/anton/linux-2.5

into samba.org:/scratch/anton/tmp3
parents 3f90ad0c 97ef4805
......@@ -207,6 +207,7 @@ S: Maintained
AGPGART DRIVER
P: Dave Jones
M: davej@codemonkey.org.uk
W: http://www.codemonkey.org.uk/agp/
S: Maintained
AHA152X SCSI DRIVER
......@@ -771,25 +772,22 @@ M: jes@trained-monkey.org
L: linux-hippi@sunsite.dk
S: Maintained
HP (was COMPAQ) FIBRE CHANNEL 64-bit/66MHz PCI non-intelligent HBA
P: Stephen Cameron
M: arrays@hp.com
M: steve.cameron@hp.com
L: cpqfc-discuss@lists.sourceforge.net
S: Odd Fixes
COMPAQ FIBRE CHANNEL 64-bit/66MHz PCI non-intelligent HBA
P: Chase Maupin
M: Chase Maupin (support@compaq.com)
L: compaqandlinux@cpqlin.van-dijk.net
S: Supported
HP (was COMPAQ) SMART2 RAID DRIVER
P: Stephen Cameron
M: arrays@hp.com
M: steve.cameron@hp.com
L: cpqarray-discuss@lists.sourceforge.net
S: Odd Fixes
COMPAQ SMART2 RAID DRIVER
P: Francis Wiran
M: Francis Wiran <support@compaq.com>
L: compaqandlinux@cpqlin.van-dijk.net
S: Supported
HP (was COMPAQ) SMART CISS RAID DRIVER
P: Stephen Cameron
M: arrays@hp.com
M: steve.cameron@hp.com
L: cciss-discuss@lists.sourceforge.net
COMPAQ SMART CISS RAID DRIVER
P: Mike Miller, Michael Ni
M: Mike Miller, Michael Ni <support@compaq.com>
L: compaqandlinux@cpqlin.van-dijk.net
S: Supported
HP100: Driver for HP 10/100 Mbit/s Voice Grade Network Adapter Series
......
......@@ -297,7 +297,7 @@ config PCI
config PCI_DOMAINS
bool
default PCI
default y
config ALPHA_CORE_AGP
bool
......
......@@ -377,6 +377,15 @@ config ARM_THUMB
If you don't know what this all is, saying Y is a safe choice.
config CPU_BIG_ENDIAN
bool "Build big-endian kernel"
depends on ARCH_SUPPORTS_BIG_ENDIAN
help
Say Y if you plan on running a kernel in big-endian mode.
Note that your board must be properly built and your board
port must properly enable and big-endian related features
of your chipset/board/processor.
config CPU_ICACHE_DISABLE
bool "Disable I-Cache"
depends on CPU_ARM920T || CPU_ARM922T || CPU_ARM926T || CPU_ARM1020
......
......@@ -24,6 +24,12 @@ ifeq ($(CONFIG_DEBUG_INFO),y)
CFLAGS +=-g
endif
ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
CFLAGS += -mbig-endian
AS += -EB
LD += -EB
endif
# Select CPU dependent flags. Note that order of declaration is important;
# the options further down the list override previous items.
#
......@@ -34,10 +40,7 @@ apcs-$(CONFIG_CPU_26) :=-mapcs-26 -mcpu=arm3
# Note that GCC does not numerically define an architecture version
# macro, but instead defines a whole series of macros which makes
# testing for a specific architecture or later rather impossible.
#
# Note - GCC does accept -march=armv5te, but someone messed up the assembler or the
# gcc specs file - this needs fixing properly - ie in gcc and/or binutils.
arch-$(CONFIG_CPU_32v5) :=-D__LINUX_ARM_ARCH__=5 -march=armv5t
arch-$(CONFIG_CPU_32v5) :=-D__LINUX_ARM_ARCH__=5 -march=armv5te
arch-$(CONFIG_CPU_32v4) :=-D__LINUX_ARM_ARCH__=4 -march=armv4
arch-$(CONFIG_CPU_32v3) :=-D__LINUX_ARM_ARCH__=3 -march=armv3
......@@ -50,13 +53,13 @@ tune-$(CONFIG_CPU_ARM922T) :=-mtune=arm9tdmi
tune-$(CONFIG_CPU_ARM926T) :=-mtune=arm9tdmi
tune-$(CONFIG_CPU_SA110) :=-mtune=strongarm110
tune-$(CONFIG_CPU_SA1100) :=-mtune=strongarm1100
tune-$(CONFIG_CPU_XSCALE) :=-mtune=strongarm -Wa,-mxscale #-mtune=xscale
tune-$(CONFIG_CPU_XSCALE) :=-mtune=xscale
# Force -mno-fpu to be passed to the assembler. Some versions of gcc don't
# do this with -msoft-float
CFLAGS_BOOT :=$(apcs-y) $(arch-y) $(tune-y) -mshort-load-bytes -msoft-float -Wa,-mno-fpu -Uarm
CFLAGS +=$(apcs-y) $(arch-y) $(tune-y) -mshort-load-bytes -msoft-float -Wa,-mno-fpu -Uarm
AFLAGS +=$(apcs-y) $(arch-y) $(tune-y) -mno-fpu -msoft-float -Wa,-mno-fpu
AFLAGS +=$(apcs-y) $(arch-y) $(tune-y) -msoft-float -Wa,-mno-fpu
#Default value
DATAADDR := .
......@@ -76,7 +79,11 @@ endif
ifeq ($(CONFIG_CPU_32),y)
PROCESSOR := armv
head-y := arch/arm/kernel/head.o arch/arm/kernel/init_task.o
LDFLAGS_BLOB += --oformat elf32-littlearm
ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
LDFLAGS_BLOB += --oformat elf32-bigarm
else
LDFLAGS_BLOB += --oformat elf32-littlearm
endif
textaddr-y := 0xC0008000
endif
......
#include <linux/linkage.h>
#ifndef __ARMEB__
ql .req r0 @ quotient low
qh .req r1 @ quotient high
dl .req r3 @ divisor low
dh .req r2 @ divisor high
onl .req r0 @ original dividend low
onh .req r1 @ original dividend high
nl .req r4 @ dividend low
nh .req r5 @ dividend high
res .req r4 @ result
#else
ql .req r1
qh .req r0
onl .req r1
onh .req r0
nl .req r5
nh .req r4
res .req r5
#endif
dl .req r3 @ divisor low
dh .req r2 @ divsor high
ENTRY(do_div64)
stmfd sp!, {r4, r5, lr}
mov nl, r0
movs nh, r1 @ if high bits are zero
mov nl, onl
movs nh, onh @ if high bits are zero
movne lr, #33
moveq lr, #1 @ only divide low bits
moveq nh, r0
moveq nh, onl
1: cmp nh, dh
bls 2f
add lr, lr, #1
movs dh, dh, lsl #1 @ left justify divisor
movs dh, dh, lsl #1 @ left justify disor
bpl 1b
2: movs nh, r1
2: movs nh, onh
moveq dl, dh
moveq dh, #0
movne dl, #0
......@@ -38,5 +53,5 @@ ENTRY(do_div64)
subs lr, lr, #1
bne 3b
mov r2, nl
mov r2, res
ldmfd sp!, {r4, r5, pc}
......@@ -13,7 +13,7 @@
#include <linux/module.h>
#include <linux/ioport.h>
#include <linux/ptrace.h>
#include <linux/device.h>
#include <linux/sysdev.h>
#include <asm/hardware.h>
#include <asm/irq.h>
......@@ -211,25 +211,16 @@ static struct resource irq_resource = {
.end = 0x9005ffff,
};
struct sa1100irq_state {
static struct {
unsigned int saved;
unsigned int icmr;
unsigned int iclr;
unsigned int iccr;
};
} sa1100irq_state;
static int sa1100irq_suspend(struct device *dev, u32 state, u32 level)
{
struct sa1100irq_state *st;
if (!dev->saved_state && level == SUSPEND_NOTIFY)
dev->saved_state = kmalloc(sizeof(struct sa1100irq_state),
GFP_KERNEL);
if (!dev->saved_state)
return -ENOMEM;
if (level == SUSPEND_POWER_DOWN) {
st = (struct sa1100irq_state *)dev->saved_state;
struct sa1100irq_state *st = &sa1100irq_state;
st->saved = 1;
st->icmr = ICMR;
......@@ -253,17 +244,13 @@ static int sa1100irq_suspend(struct device *dev, u32 state, u32 level)
* Clear any pending GPIO interrupts.
*/
GEDR = GEDR;
}
return 0;
}
static int sa1100irq_resume(struct device *dev, u32 level)
static int sa1100irq_resume(struct sys_device *dev)
{
struct sa1100irq_state *st;
if (level == RESUME_POWER_ON) {
st = (struct sa1100irq_state *)dev->saved_state;
dev->saved_state = NULL;
struct sa1100irq_state *st = &sa1100irq_state;
if (st->saved) {
ICCR = st->iccr;
......@@ -274,31 +261,23 @@ static int sa1100irq_resume(struct device *dev, u32 level)
ICMR = st->icmr;
}
kfree(st);
}
return 0;
}
static struct device_driver sa1100irq_driver = {
.name = "sa11x0-irq",
.bus = &system_bus_type,
static struct sysdev_class sa1100irq_sysclass = {
set_kset_name("sa11x0-irq"),
.suspend = sa1100irq_suspend,
.resume = sa1100irq_resume,
};
static struct sys_device sa1100irq_device = {
.name = "irq",
.id = 0,
.dev = {
.name = "Intel SA11x0 [Interrupt Controller]",
.driver = &sa1100irq_driver,
},
.cls = &sa1100irq_sysclass,
};
static int __init sa1100irq_init_devicefs(void)
{
driver_register(&sa1100irq_driver);
sysdev_class_register(&sa1100irq_sysclass);
return sys_device_register(&sa1100irq_device);
}
......
......@@ -10,6 +10,7 @@
*
* Errata 5: Processor may fail to execute a FID/VID change in presence of interrupt.
* - We cli/sti on stepping A0 CPUs around the FID/VID transition.
* (ADDENDUM: This seems to be needed on more systems, so we do it unconditionally now).
* Errata 15: Processors with half frequency multipliers may hang upon wakeup from disconnect.
* - We disable half multipliers if ACPI is used on A0 stepping CPUs.
*/
......@@ -259,7 +260,6 @@ static void change_speed (unsigned int index)
/* Now do the magic poking into the MSRs. */
if (have_a0 == 1) /* A0 errata 5 */
__asm__("\tcli\n");
if (freqs.old > freqs.new) {
......@@ -272,8 +272,6 @@ static void change_speed (unsigned int index)
change_FID(vid);
}
if (have_a0 == 1)
__asm__("\tsti\n");
cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
......
......@@ -1160,7 +1160,8 @@ void __init setup_IO_APIC_irqs(void)
entry.delivery_mode = INT_DELIVERY_MODE;
entry.dest_mode = INT_DEST_MODE;
entry.mask = 0; /* enable IRQ */
entry.dest.logical.logical_dest = TARGET_CPUS;
entry.dest.logical.logical_dest =
cpu_mask_to_apicid(TARGET_CPUS);
idx = find_irq_entry(apic,pin,mp_INT);
if (idx == -1) {
......@@ -1239,7 +1240,7 @@ void __init setup_ExtINT_IRQ0_pin(unsigned int pin, int vector)
*/
entry.dest_mode = INT_DEST_MODE;
entry.mask = 0; /* unmask IRQ now */
entry.dest.logical.logical_dest = TARGET_CPUS;
entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS);
entry.delivery_mode = INT_DELIVERY_MODE;
entry.polarity = 0;
entry.trigger = 0;
......@@ -2309,7 +2310,7 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq)
entry.delivery_mode = INT_DELIVERY_MODE;
entry.dest_mode = INT_DEST_MODE;
entry.dest.logical.logical_dest = TARGET_CPUS;
entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS);
entry.mask = 1; /* Disabled (masked) */
entry.trigger = 1; /* Level sensitive */
entry.polarity = 1; /* Low active */
......
......@@ -114,10 +114,16 @@ void __init get_memcfg_numa_flat(void)
*/
static void __init find_max_pfn_node(int nid)
{
if (node_start_pfn[nid] >= node_end_pfn[nid])
BUG();
if (node_end_pfn[nid] > max_pfn)
node_end_pfn[nid] = max_pfn;
/*
* if a user has given mem=XXXX, then we need to make sure
* that the node _starts_ before that, too, not just ends
*/
if (node_start_pfn[nid] > max_pfn)
node_start_pfn[nid] = max_pfn;
if (node_start_pfn[nid] > node_end_pfn[nid])
BUG();
}
/*
......
......@@ -144,8 +144,8 @@ EXPORT_SYMBOL(acpi_bus_unregister_driver);
#include <linux/pci.h>
extern int acpi_pci_irq_enable(struct pci_dev *dev);
EXPORT_SYMBOL(acpi_pci_irq_enable);
extern int acpi_pci_irq_lookup (int segment, int bus, int device, int pin);
EXPORT_SYMBOL(acpi_pci_irq_lookup);
EXPORT_SYMBOL(acpi_pci_register_driver);
EXPORT_SYMBOL(acpi_pci_unregister_driver);
#endif /*CONFIG_ACPI_PCI */
#ifdef CONFIG_ACPI_EC
......
......@@ -38,6 +38,7 @@
#include <acpi/acpi.h>
#include <asm/io.h>
#include <acpi/acpi_bus.h>
#include <asm/uaccess.h>
#ifdef CONFIG_ACPI_EFI
#include <linux/efi.h>
......@@ -948,19 +949,22 @@ acpi_os_get_line(char *buffer)
return 0;
}
/*
* We just have to assume we're dealing with valid memory
*/
/* Assumes no unreadable holes inbetween */
BOOLEAN
acpi_os_readable(void *ptr, u32 len)
{
#if defined(__i386__) || defined(__x86_64__)
char tmp;
return !__get_user(tmp, (char *)ptr) && !__get_user(tmp, (char *)ptr + len - 1);
#endif
return 1;
}
BOOLEAN
acpi_os_writable(void *ptr, u32 len)
{
/* could do dummy write (racy) or a kernel page table lookup.
The later may be difficult at early boot when kmap doesn't work yet. */
return 1;
}
......
......@@ -229,22 +229,20 @@ acpi_pci_irq_add_prt (
PCI Interrupt Routing Support
-------------------------------------------------------------------------- */
int
acpi_pci_irq_lookup (
int segment,
int bus,
int device,
int pin)
static int
acpi_pci_irq_lookup (struct pci_bus *bus, int device, int pin)
{
struct acpi_prt_entry *entry = NULL;
int segment = pci_domain_nr(bus);
int bus_nr = bus->number;
ACPI_FUNCTION_TRACE("acpi_pci_irq_lookup");
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Searching for PRT entry for %02x:%02x:%02x[%c]\n",
segment, bus, device, ('A' + pin)));
segment, bus_nr, device, ('A' + pin)));
entry = acpi_pci_irq_find_prt_entry(segment, bus, device, pin);
entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin);
if (!entry) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "PRT entry not found\n"));
return_VALUE(0);
......@@ -288,7 +286,8 @@ acpi_pci_irq_derive (
while (!irq && bridge->bus->self) {
pin = (pin + PCI_SLOT(bridge->devfn)) % 4;
bridge = bridge->bus->self;
irq = acpi_pci_irq_lookup(0, bridge->bus->number, PCI_SLOT(bridge->devfn), pin);
irq = acpi_pci_irq_lookup(bridge->bus,
PCI_SLOT(bridge->devfn), pin);
}
if (!irq) {
......@@ -331,7 +330,7 @@ acpi_pci_irq_enable (
* First we check the PCI IRQ routing table (PRT) for an IRQ. PRT
* values override any BIOS-assigned IRQs set during boot.
*/
irq = acpi_pci_irq_lookup(0, dev->bus->number, PCI_SLOT(dev->devfn), pin);
irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin);
/*
* If no PRT entry was found, we'll try to derive an IRQ from the
......
......@@ -59,17 +59,63 @@ static struct acpi_driver acpi_pci_root_driver = {
},
};
struct acpi_pci_root {
struct acpi_pci_root {
struct list_head node;
acpi_handle handle;
struct acpi_pci_id id;
struct pci_bus *bus;
u64 mem_tra;
u64 io_tra;
};
};
struct list_head acpi_pci_roots;
static struct acpi_pci_driver *sub_driver;
int acpi_pci_register_driver(struct acpi_pci_driver *driver)
{
int n = 0;
struct list_head *entry;
struct acpi_pci_driver **pptr = &sub_driver;
while (*pptr)
pptr = &(*pptr)->next;
*pptr = driver;
if (!driver->add)
return 0;
list_for_each(entry, &acpi_pci_roots) {
struct acpi_pci_root *root;
root = list_entry(entry, struct acpi_pci_root, node);
driver->add(root->handle);
n++;
}
return n;
}
void acpi_pci_unregister_driver(struct acpi_pci_driver *driver)
{
struct list_head *entry;
struct acpi_pci_driver **pptr = &sub_driver;
while (*pptr) {
if (*pptr != driver)
continue;
*pptr = (*pptr)->next;
break;
}
if (!driver->remove)
return;
list_for_each(entry, &acpi_pci_roots) {
struct acpi_pci_root *root;
root = list_entry(entry, struct acpi_pci_root, node);
driver->remove(root->handle);
}
}
void
acpi_pci_get_translations (
......
......@@ -214,6 +214,10 @@ acpi_suspend (
{
acpi_status status;
/* Suspend is hard to get right on SMP. */
if (num_online_cpus() != 1)
return AE_ERROR;
/* get out if state is invalid */
if (state < ACPI_STATE_S1 || state > ACPI_STATE_S5)
return AE_ERROR;
......@@ -226,7 +230,10 @@ acpi_suspend (
* TBD: S1 can be done without device_suspend. Make a CONFIG_XX
* to handle however when S1 failed without device_suspend.
*/
freeze_processes(); /* device_suspend needs processes to be stopped */
if (freeze_processes()) {
thaw_processes();
return AE_ERROR; /* device_suspend needs processes to be stopped */
}
/* do we have a wakeup address for S2 and S3? */
/* Here, we support only S4BIOS, those we set the wakeup address */
......
......@@ -56,7 +56,7 @@ static char *acpi_table_signatures[ACPI_TABLE_COUNT] = {
[ACPI_SRAT] = "SRAT",
[ACPI_SSDT] = "SSDT",
[ACPI_SPMI] = "SPMI",
[ACPI_HPET] = "HPET"
[ACPI_HPET] = "HPET",
};
/* System Description Table (RSDT/XSDT) */
......
......@@ -430,7 +430,7 @@ acpi_thermal_call_usermode (
ACPI_FUNCTION_TRACE("acpi_thermal_call_usermode");
if (!path)
return_VALUE(-EINVAL);;
return_VALUE(-EINVAL);
argv[0] = path;
......
......@@ -264,8 +264,6 @@ int class_device_add(struct class_device *class_dev)
return -EINVAL;
parent = class_get(class_dev->class);
if (class_dev->dev)
get_device(class_dev->dev);
pr_debug("CLASS: registering class device: ID = '%s'\n",
class_dev->class_id);
......
......@@ -13,13 +13,6 @@ static struct sysdev_class memblk_class = {
set_kset_name("memblk"),
};
static struct device_driver memblk_driver = {
.name = "memblk",
.bus = &system_bus_type,
};
/*
* register_memblk - Setup a driverfs device for a MemBlk
* @num - MemBlk number to use when creating the device.
......@@ -37,7 +30,7 @@ int __init register_memblk(struct memblk *memblk, int num, struct node *root)
error = sys_device_register(&memblk->sysdev);
if (!error)
error = sysfs_create_link(&root->sysdev.kobj,
&memblk->sysdev,kobj,
&memblk->sysdev.kobj,
memblk->sysdev.kobj.name);
return error;
}
......
......@@ -2,7 +2,7 @@
* drivers/base/node.c - basic Node class support
*/
#include <linux/device.h>
#include <linux/sysdev.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/mm.h>
......@@ -14,18 +14,17 @@ static struct sysdev_class node_class = {
};
static ssize_t node_read_cpumap(struct device * dev, char * buf)
static ssize_t node_read_cpumap(struct sys_device * dev, char * buf)
{
struct node *node_dev = to_node(to_root(dev));
struct node *node_dev = to_node(dev);
return sprintf(buf,"%lx\n",node_dev->cpumap);
}
static SYSDEV_ATTR(cpumap,S_IRUGO,node_read_cpumap,NULL);
#define K(x) ((x) << (PAGE_SHIFT - 10))
static ssize_t node_read_meminfo(struct device * dev, char * buf)
static ssize_t node_read_meminfo(struct sys_device * dev, char * buf)
{
struct sys_root *node = to_root(dev);
int nid = node->id;
int nid = dev->id;
struct sysinfo i;
si_meminfo_node(&i, nid);
return sprintf(buf, "\n"
......@@ -64,8 +63,8 @@ int __init register_node(struct node *node, int num, struct node *parent)
error = sys_device_register(&node->sysdev);
if (!error){
sys_device_create_file(&node->sysroot.dev, &attr_cpumap);
sys_device_create_file(&node->sysroot.dev, &attr_meminfo);
sysdev_create_file(&node->sysdev, &attr_cpumap);
sysdev_create_file(&node->sysdev, &attr_meminfo);
}
return error;
}
......
......@@ -10,7 +10,7 @@
*
*/
#define DEBUG
#undef DEBUG
#include <linux/device.h>
#include <linux/module.h>
......@@ -49,19 +49,19 @@ extern int sysdev_restore(void);
*/
int device_suspend(u32 state, u32 level)
{
struct list_head * node;
struct device * dev;
int error = 0;
printk(KERN_EMERG "Suspending devices\n");
down_write(&devices_subsys.rwsem);
list_for_each(node,&devices_subsys.kset.list) {
struct device * dev = to_dev(node);
list_for_each_entry_reverse(dev,&devices_subsys.kset.list,kobj.entry) {
if (dev->driver && dev->driver->suspend) {
pr_debug("suspending device %s\n",dev->name);
error = dev->driver->suspend(dev,state,level);
if (error)
printk(KERN_ERR "%s: suspend returned %d\n",dev->name,error);
printk(KERN_ERR "%s: suspend returned %d\n",
dev->name,error);
}
}
up_write(&devices_subsys.rwsem);
......@@ -93,7 +93,7 @@ int device_suspend(u32 state, u32 level)
*/
void device_resume(u32 level)
{
struct list_head * node;
struct device * dev;
switch (level) {
case RESUME_POWER_ON:
......@@ -107,8 +107,7 @@ void device_resume(u32 level)
}
down_write(&devices_subsys.rwsem);
list_for_each_prev(node,&devices_subsys.kset.list) {
struct device * dev = to_dev(node);
list_for_each_entry(dev,&devices_subsys.kset.list,kobj.entry) {
if (dev->driver && dev->driver->resume) {
pr_debug("resuming device %s\n",dev->name);
dev->driver->resume(dev,level);
......@@ -124,13 +123,12 @@ void device_resume(u32 level)
*/
void device_shutdown(void)
{
struct list_head * entry;
struct device * dev;
printk(KERN_EMERG "Shutting down devices\n");
down_write(&devices_subsys.rwsem);
list_for_each(entry,&devices_subsys.kset.list) {
struct device * dev = to_dev(entry);
list_for_each_entry_reverse(dev,&devices_subsys.kset.list,kobj.entry) {
pr_debug("shutting down %s: ",dev->name);
if (dev->driver && dev->driver->shutdown) {
pr_debug("Ok\n");
......
......@@ -12,7 +12,7 @@
* add themselves as children of the system bus.
*/
#define DEBUG
#undef DEBUG
#include <linux/sysdev.h>
#include <linux/err.h>
......@@ -62,6 +62,19 @@ static struct kobj_type ktype_sysdev = {
.sysfs_ops = &sysfs_ops,
};
int sysdev_create_file(struct sys_device * s, struct sysdev_attribute * a)
{
return sysfs_create_file(&s->kobj,&a->attr);
}
void sysdev_remove_file(struct sys_device * s, struct sysdev_attribute * a)
{
sysfs_remove_file(&s->kobj,&a->attr);
}
/*
* declare system_subsys
*/
......@@ -104,9 +117,16 @@ int sysdev_driver_register(struct sysdev_class * cls,
struct sysdev_driver * drv)
{
down_write(&system_subsys.rwsem);
if (cls && kset_get(&cls->kset))
if (cls && kset_get(&cls->kset)) {
list_add_tail(&drv->entry,&cls->drivers);
else
/* If devices of this class already exist, tell the driver */
if (drv->add) {
struct sys_device *dev;
list_for_each_entry(dev, &cls->kset.list, kobj.entry)
drv->add(dev);
}
} else
list_add_tail(&drv->entry,&global_drivers);
up_write(&system_subsys.rwsem);
return 0;
......@@ -123,8 +143,14 @@ void sysdev_driver_unregister(struct sysdev_class * cls,
{
down_write(&system_subsys.rwsem);
list_del_init(&drv->entry);
if (cls)
if (cls) {
if (drv->remove) {
struct sys_device *dev;
list_for_each_entry(dev, &cls->kset.list, kobj.entry)
drv->remove(dev);
}
kset_put(&cls->kset);
}
up_write(&system_subsys.rwsem);
}
......@@ -157,7 +183,7 @@ int sys_device_register(struct sys_device * sysdev)
if (!error) {
struct sysdev_driver * drv;
down_read(&system_subsys.rwsem);
down_write(&system_subsys.rwsem);
/* Generic notification is implicit, because it's that
* code that should have called us.
*/
......@@ -173,7 +199,7 @@ int sys_device_register(struct sys_device * sysdev)
if (drv->add)
drv->add(sysdev);
}
up_read(&system_subsys.rwsem);
up_write(&system_subsys.rwsem);
}
return error;
}
......@@ -182,7 +208,7 @@ void sys_device_unregister(struct sys_device * sysdev)
{
struct sysdev_driver * drv;
down_read(&system_subsys.rwsem);
down_write(&system_subsys.rwsem);
list_for_each_entry(drv,&global_drivers,entry) {
if (drv->remove)
drv->remove(sysdev);
......@@ -192,7 +218,10 @@ void sys_device_unregister(struct sys_device * sysdev)
if (drv->remove)
drv->remove(sysdev);
}
up_read(&system_subsys.rwsem);
list_del_init(&sysdev->entry);
up_write(&system_subsys.rwsem);
kobject_unregister(&sysdev->kobj);
}
......
......@@ -1028,7 +1028,7 @@ static int ida_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
int diskinfo[4];
struct hd_geometry *geo = (struct hd_geometry *)arg;
ida_ioctl_t *io = (ida_ioctl_t*)arg;
ida_ioctl_t my_io;
ida_ioctl_t *my_io;
switch(cmd) {
case HDIO_GETGEO:
......@@ -1051,12 +1051,24 @@ static int ida_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
return -EFAULT;
return 0;
case IDAPASSTHRU:
if (!capable(CAP_SYS_RAWIO)) return -EPERM;
if (copy_from_user(&my_io, io, sizeof(my_io)))
return -EFAULT;
error = ida_ctlr_ioctl(host, drv - host->drv, &my_io);
if (error) return error;
return copy_to_user(io, &my_io, sizeof(my_io)) ? -EFAULT : 0;
if (!capable(CAP_SYS_RAWIO))
return -EPERM;
my_io = kmalloc(sizeof(ida_ioctl_t), GFP_KERNEL);
if (!my_io)
return -ENOMEM;
error = -EFAULT;
if (copy_from_user(my_io, io, sizeof(*my_io)))
goto out_passthru;
error = ida_ctlr_ioctl(host, drv - host->drv, my_io);
if (error)
goto out_passthru;
error = -EFAULT;
if (copy_to_user(io, &my_io, sizeof(*my_io)))
goto out_passthru;
error = 0;
out_passthru:
kfree(my_io);
return error;
case IDAGETCTLRSIG:
if (!arg) return -EINVAL;
put_user(host->ctlr_sig, (int*)arg);
......
......@@ -278,12 +278,13 @@ static int __init agp_amdk8_probe(struct pci_dev *pdev,
default: revstring="??";
break;
}
printk ("Detected AMD 8151 AGP Bridge rev %s", revstring);
printk (KERN_INFO PFX "Detected AMD 8151 AGP Bridge rev %s\n", revstring);
/*
* Work around errata.
* Chips before B2 stepping incorrectly reporting v3.5
*/
if (rev_id < 0x13) {
printk (KERN_INFO PFX "Correcting AGP revision (reports 3.5, is really 3.0)\n");
bridge->major_version = 3;
bridge->minor_version = 0;
}
......
......@@ -300,7 +300,6 @@ static struct agp_memory *agp_allocate_memory_wrap(size_t pg_count, u32 type)
struct agp_memory *memory;
memory = agp_allocate_memory(pg_count, type);
printk(KERN_DEBUG "agp_allocate_memory: %p\n", memory);
if (memory == NULL)
return NULL;
......
......@@ -447,7 +447,7 @@ static int intel_i830_insert_entries(struct agp_memory *mem,off_t pg_start,
printk (KERN_DEBUG "pg_start == 0x%.8lx,intel_i830_private.gtt_entries == 0x%.8x\n",
pg_start,intel_i830_private.gtt_entries);
printk ("Trying to insert into local/stolen memory\n");
printk (KERN_INFO PFX "Trying to insert into local/stolen memory\n");
return (-EINVAL);
}
......@@ -483,7 +483,7 @@ static int intel_i830_remove_entries(struct agp_memory *mem,off_t pg_start,
global_cache_flush();
if (pg_start < intel_i830_private.gtt_entries) {
printk ("Trying to disable local/stolen memory\n");
printk (KERN_INFO PFX "Trying to disable local/stolen memory\n");
return (-EINVAL);
}
......@@ -645,7 +645,7 @@ static int intel_815_configure(void)
/* the Intel 815 chipset spec. says that bits 29-31 in the
* ATTBASE register are reserved -> try not to write them */
if (agp_bridge->gatt_bus_addr & INTEL_815_ATTBASE_MASK) {
printk (KERN_EMERG "gatt bus addr too high");
printk (KERN_EMERG PFX "gatt bus addr too high");
return -EINVAL;
}
......
......@@ -240,7 +240,7 @@ static void serverworks_tlbflush(struct agp_memory *temp)
while(INREG8(serverworks_private.registers,
SVWRKS_POSTFLUSH) == 0x01) {
if((signed)(end - jiffies) <= 0) {
printk(KERN_ERR "Posted write buffer flush took more"
printk(KERN_ERR PFX "Posted write buffer flush took more"
"then 3 seconds\n");
}
}
......@@ -249,7 +249,7 @@ static void serverworks_tlbflush(struct agp_memory *temp)
while(INREG32(serverworks_private.registers,
SVWRKS_DIRFLUSH) == 0x00000001) {
if((signed)(end - jiffies) <= 0) {
printk(KERN_ERR "TLB flush took more"
printk(KERN_ERR PFX "TLB flush took more"
"then 3 seconds\n");
}
}
......@@ -447,8 +447,7 @@ static int __init agp_serverworks_probe(struct pci_dev *pdev,
PCI_DEVFN(0, 1));
if (!bridge_dev) {
printk(KERN_INFO PFX "agpgart: Detected a Serverworks "
"Chipset, but could not find the secondary "
"device.\n");
"Chipset, but could not find the secondary device.\n");
return -ENODEV;
}
......@@ -470,8 +469,8 @@ static int __init agp_serverworks_probe(struct pci_dev *pdev,
if (temp & PCI_BASE_ADDRESS_MEM_TYPE_64) {
pci_read_config_dword(pdev, SVWRKS_APSIZE + 4, &temp2);
if (temp2 != 0) {
printk("Detected 64 bit aperture address, but top "
"bits are not zero. Disabling agp\n");
printk(KERN_INFO PFX "Detected 64 bit aperture address, "
"but top bits are not zero. Disabling agp\n");
return -ENODEV;
}
serverworks_private.mm_addr_ofs = 0x18;
......@@ -483,8 +482,8 @@ static int __init agp_serverworks_probe(struct pci_dev *pdev,
pci_read_config_dword(pdev,
serverworks_private.mm_addr_ofs + 4, &temp2);
if (temp2 != 0) {
printk("Detected 64 bit MMIO address, but top "
"bits are not zero. Disabling agp\n");
printk(KERN_INFO PFX "Detected 64 bit MMIO address, "
"but top bits are not zero. Disabling agp\n");
return -ENODEV;
}
}
......
......@@ -29,6 +29,10 @@
#include <asm/io.h>
#include <asm/pgalloc.h>
#ifdef CONFIG_IA64
# include <linux/efi.h>
#endif
#ifdef CONFIG_FB
extern void fbmem_init(void);
#endif
......@@ -36,6 +40,45 @@ extern void fbmem_init(void);
extern void tapechar_init(void);
#endif
/*
* Architectures vary in how they handle caching for addresses
* outside of main memory.
*
*/
static inline int uncached_access(struct file *file, unsigned long addr)
{
#if defined(__i386__)
/*
* On the PPro and successors, the MTRRs are used to set
* memory types for physical addresses outside main memory,
* so blindly setting PCD or PWT on those pages is wrong.
* For Pentiums and earlier, the surround logic should disable
* caching for the high addresses through the KEN pin, but
* we maintain the tradition of paranoia in this code.
*/
if (file->f_flags & O_SYNC)
return 1;
return !( test_bit(X86_FEATURE_MTRR, boot_cpu_data.x86_capability) ||
test_bit(X86_FEATURE_K6_MTRR, boot_cpu_data.x86_capability) ||
test_bit(X86_FEATURE_CYRIX_ARR, boot_cpu_data.x86_capability) ||
test_bit(X86_FEATURE_CENTAUR_MCR, boot_cpu_data.x86_capability) )
&& addr >= __pa(high_memory);
#elif defined(CONFIG_IA64)
/*
* On ia64, we ignore O_SYNC because we cannot tolerate memory attribute aliases.
*/
return !(efi_mem_attributes(addr) & EFI_MEMORY_WB);
#else
/*
* Accessing memory above the top the kernel knows about or through a file pointer
* that was marked O_SYNC will be done non-cached.
*/
if (file->f_flags & O_SYNC)
return 1;
return addr >= __pa(high_memory);
#endif
}
static ssize_t do_write_mem(struct file * file, void *p, unsigned long realp,
const char * buf, size_t count, loff_t *ppos)
{
......@@ -116,77 +159,16 @@ static ssize_t write_mem(struct file * file, const char * buf,
return do_write_mem(file, __va(p), p, buf, count, ppos);
}
#ifndef pgprot_noncached
/*
* This should probably be per-architecture in <asm/pgtable.h>
*/
static inline pgprot_t pgprot_noncached(pgprot_t _prot)
{
unsigned long prot = pgprot_val(_prot);
#if defined(__i386__) || defined(__x86_64__)
/* On PPro and successors, PCD alone doesn't always mean
uncached because of interactions with the MTRRs. PCD | PWT
means definitely uncached. */
if (boot_cpu_data.x86 > 3)
prot |= _PAGE_PCD | _PAGE_PWT;
#elif defined(__powerpc__)
prot |= _PAGE_NO_CACHE | _PAGE_GUARDED;
#elif defined(__mc68000__) && defined(CONFIG_MMU)
#ifdef SUN3_PAGE_NOCACHE
if (MMU_IS_SUN3)
prot |= SUN3_PAGE_NOCACHE;
else
#endif
if (MMU_IS_851 || MMU_IS_030)
prot |= _PAGE_NOCACHE030;
/* Use no-cache mode, serialized */
else if (MMU_IS_040 || MMU_IS_060)
prot = (prot & _CACHEMASK040) | _PAGE_NOCACHE_S;
#endif
return __pgprot(prot);
}
#endif /* !pgprot_noncached */
/*
* Architectures vary in how they handle caching for addresses
* outside of main memory.
*/
static inline int noncached_address(unsigned long addr)
{
#if defined(__i386__)
/*
* On the PPro and successors, the MTRRs are used to set
* memory types for physical addresses outside main memory,
* so blindly setting PCD or PWT on those pages is wrong.
* For Pentiums and earlier, the surround logic should disable
* caching for the high addresses through the KEN pin, but
* we maintain the tradition of paranoia in this code.
*/
return !( test_bit(X86_FEATURE_MTRR, boot_cpu_data.x86_capability) ||
test_bit(X86_FEATURE_K6_MTRR, boot_cpu_data.x86_capability) ||
test_bit(X86_FEATURE_CYRIX_ARR, boot_cpu_data.x86_capability) ||
test_bit(X86_FEATURE_CENTAUR_MCR, boot_cpu_data.x86_capability) )
&& addr >= __pa(high_memory);
#else
return addr >= __pa(high_memory);
#endif
}
static int mmap_mem(struct file * file, struct vm_area_struct * vma)
{
unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
int uncached;
/*
* Accessing memory above the top the kernel knows about or
* through a file pointer that was marked O_SYNC will be
* done non-cached.
*/
if (noncached_address(offset) || (file->f_flags & O_SYNC))
uncached = uncached_access(file, offset);
#ifdef pgprot_noncached
if (uncached)
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
#endif
/* Don't try to swap out physical pages.. */
vma->vm_flags |= VM_RESERVED;
......@@ -194,7 +176,7 @@ static int mmap_mem(struct file * file, struct vm_area_struct * vma)
/*
* Don't dump addresses that are not real memory to a core file.
*/
if (offset >= __pa(high_memory) || (file->f_flags & O_SYNC))
if (uncached)
vma->vm_flags |= VM_IO;
if (remap_page_range(vma, vma->vm_start, offset, vma->vm_end-vma->vm_start,
......@@ -713,4 +695,4 @@ static int __init chr_dev_init(void)
return 0;
}
subsys_initcall(chr_dev_init);
fs_initcall(chr_dev_init);
......@@ -284,12 +284,13 @@ static ssize_t rtc_read(struct file *file, char *buf,
add_wait_queue(&rtc_wait, &wait);
current->state = TASK_INTERRUPTIBLE;
do {
/* First make it right. Then make it fast. Putting this whole
* block within the parentheses of a while would be too
* confusing. And no, xchg() is not the answer. */
__set_current_state(TASK_INTERRUPTIBLE);
spin_lock_irq (&rtc_lock);
data = rtc_irq_data;
rtc_irq_data = 0;
......
......@@ -193,6 +193,10 @@ config I2C_IBM_OCP_ADAP
tristate "IBM on-chip I2C Adapter"
depends on I2C_IBM_OCP_ALGO
config I2C_IOP3XX
tristate "Intel XScale IOP3xx on-chip I2C interface"
depends on ARCH_IOP3XX && I2C
config I2C_CHARDEV
tristate "I2C device interface"
depends on I2C
......
......@@ -16,4 +16,5 @@ obj-$(CONFIG_ITE_I2C_ADAP) += i2c-adap-ite.o
obj-$(CONFIG_SCx200_I2C) += scx200_i2c.o
obj-$(CONFIG_SCx200_ACB) += scx200_acb.o
obj-$(CONFIG_I2C_SENSOR) += i2c-sensor.o
obj-$(CONFIG_I2C_IOP3XX) += i2c-iop3xx.o
obj-y += busses/ chips/
......@@ -47,6 +47,21 @@ config SENSORS_LM75
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
config SENSORS_LM85
tristate " National Semiconductors LM85 and compatibles"
depends on I2C && EXPERIMENTAL
help
If you say yes here you get support for National Semiconductor LM85
sensor chips and clones: ADT7463 and ADM1027.
This can also be built as a module which can be inserted and
removed while the kernel is running.
The module will be called lm85.
You will also need the latest user-space utilties: you can find them
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
config SENSORS_VIA686A
tristate " VIA686A"
depends on I2C && EXPERIMENTAL
......@@ -76,8 +91,8 @@ config SENSORS_W83781D
config I2C_SENSOR
tristate
default y if SENSORS_ADM1021=y || SENSORS_IT87=y || SENSORS_LM75=y || SENSORS_VIA686A=y || SENSORS_W83781D=y
default m if SENSORS_ADM1021=m || SENSORS_IT87=m || SENSORS_LM75=m || SENSORS_VIA686A=m || SENSORS_W83781D=m
default y if SENSORS_ADM1021=y || SENSORS_IT87=y || SENSORS_LM75=y || SENSORS_VIA686A=y || SENSORS_W83781D=y || SENSORS_LM85=y
default m if SENSORS_ADM1021=m || SENSORS_IT87=m || SENSORS_LM75=m || SENSORS_VIA686A=m || SENSORS_W83781D=m || SENSORS_LM85=m
default n
endmenu
......@@ -5,5 +5,6 @@
obj-$(CONFIG_SENSORS_ADM1021) += adm1021.o
obj-$(CONFIG_SENSORS_IT87) += it87.o
obj-$(CONFIG_SENSORS_LM75) += lm75.o
obj-$(CONFIG_SENSORS_LM85) += lm85.o
obj-$(CONFIG_SENSORS_VIA686A) += via686a.o
obj-$(CONFIG_SENSORS_W83781D) += w83781d.o
This diff is collapsed.
......@@ -510,7 +510,7 @@ int i2c_master_send(struct i2c_client *client,const char *buf ,int count)
msg.addr = client->addr;
msg.flags = client->flags & I2C_M_TEN;
msg.len = count;
(const char *)msg.buf = buf;
msg.buf = (char *)buf;
DEB2(dev_dbg(&client->adapter->dev, "master_send: writing %d bytes.\n",
count));
......@@ -861,13 +861,13 @@ int i2c_smbus_check_pec(u16 addr, u8 command, int size, u8 partial,
return 0;
}
extern s32 i2c_smbus_write_quick(struct i2c_client * client, u8 value)
s32 i2c_smbus_write_quick(struct i2c_client *client, u8 value)
{
return i2c_smbus_xfer(client->adapter,client->addr,client->flags,
value,0,I2C_SMBUS_QUICK,NULL);
}
extern s32 i2c_smbus_read_byte(struct i2c_client * client)
s32 i2c_smbus_read_byte(struct i2c_client *client)
{
union i2c_smbus_data data;
if (i2c_smbus_xfer(client->adapter,client->addr,client->flags,
......@@ -877,14 +877,14 @@ extern s32 i2c_smbus_read_byte(struct i2c_client * client)
return 0x0FF & data.byte;
}
extern s32 i2c_smbus_write_byte(struct i2c_client * client, u8 value)
s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value)
{
union i2c_smbus_data data; /* only for PEC */
return i2c_smbus_xfer(client->adapter,client->addr,client->flags,
I2C_SMBUS_WRITE,value, I2C_SMBUS_BYTE,&data);
}
extern s32 i2c_smbus_read_byte_data(struct i2c_client * client, u8 command)
s32 i2c_smbus_read_byte_data(struct i2c_client *client, u8 command)
{
union i2c_smbus_data data;
if (i2c_smbus_xfer(client->adapter,client->addr,client->flags,
......@@ -894,8 +894,7 @@ extern s32 i2c_smbus_read_byte_data(struct i2c_client * client, u8 command)
return 0x0FF & data.byte;
}
extern s32 i2c_smbus_write_byte_data(struct i2c_client * client, u8 command,
u8 value)
s32 i2c_smbus_write_byte_data(struct i2c_client *client, u8 command, u8 value)
{
union i2c_smbus_data data;
data.byte = value;
......@@ -904,7 +903,7 @@ extern s32 i2c_smbus_write_byte_data(struct i2c_client * client, u8 command,
I2C_SMBUS_BYTE_DATA,&data);
}
extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command)
s32 i2c_smbus_read_word_data(struct i2c_client *client, u8 command)
{
union i2c_smbus_data data;
if (i2c_smbus_xfer(client->adapter,client->addr,client->flags,
......@@ -914,8 +913,7 @@ extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command)
return 0x0FFFF & data.word;
}
extern s32 i2c_smbus_write_word_data(struct i2c_client * client,
u8 command, u16 value)
s32 i2c_smbus_write_word_data(struct i2c_client *client, u8 command, u16 value)
{
union i2c_smbus_data data;
data.word = value;
......@@ -924,8 +922,7 @@ extern s32 i2c_smbus_write_word_data(struct i2c_client * client,
I2C_SMBUS_WORD_DATA,&data);
}
extern s32 i2c_smbus_process_call(struct i2c_client * client,
u8 command, u16 value)
s32 i2c_smbus_process_call(struct i2c_client *client, u8 command, u16 value)
{
union i2c_smbus_data data;
data.word = value;
......@@ -938,8 +935,7 @@ extern s32 i2c_smbus_process_call(struct i2c_client * client,
}
/* Returns the number of read bytes */
extern s32 i2c_smbus_read_block_data(struct i2c_client * client,
u8 command, u8 *values)
s32 i2c_smbus_read_block_data(struct i2c_client *client, u8 command, u8 *values)
{
union i2c_smbus_data data;
int i;
......@@ -954,8 +950,7 @@ extern s32 i2c_smbus_read_block_data(struct i2c_client * client,
}
}
extern s32 i2c_smbus_write_block_data(struct i2c_client * client,
u8 command, u8 length, u8 *values)
s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command, u8 length, u8 *values)
{
union i2c_smbus_data data;
int i;
......@@ -970,8 +965,7 @@ extern s32 i2c_smbus_write_block_data(struct i2c_client * client,
}
/* Returns the number of read bytes */
extern s32 i2c_smbus_block_process_call(struct i2c_client * client,
u8 command, u8 length, u8 *values)
s32 i2c_smbus_block_process_call(struct i2c_client *client, u8 command, u8 length, u8 *values)
{
union i2c_smbus_data data;
int i;
......@@ -990,8 +984,7 @@ extern s32 i2c_smbus_block_process_call(struct i2c_client * client,
}
/* Returns the number of read bytes */
extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client,
u8 command, u8 *values)
s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, u8 command, u8 *values)
{
union i2c_smbus_data data;
int i;
......@@ -1006,8 +999,7 @@ extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client,
}
}
extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client,
u8 command, u8 length, u8 *values)
s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, u8 command, u8 length, u8 *values)
{
union i2c_smbus_data data;
int i;
......
......@@ -122,7 +122,7 @@ static ssize_t show_dev(struct class_device *class_dev, char *buf)
}
static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL);
static ssize_t i2cdev_read (struct file *file, char *buf, size_t count,
static ssize_t i2cdev_read (struct file *file, char __user *buf, size_t count,
loff_t *offset)
{
char *tmp;
......@@ -147,7 +147,7 @@ static ssize_t i2cdev_read (struct file *file, char *buf, size_t count,
return ret;
}
static ssize_t i2cdev_write (struct file *file, const char *buf, size_t count,
static ssize_t i2cdev_write (struct file *file, const char __user *buf, size_t count,
loff_t *offset)
{
int ret;
......@@ -211,12 +211,12 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
return 0;
case I2C_FUNCS:
funcs = i2c_get_functionality(client->adapter);
return (copy_to_user((unsigned long *)arg,&funcs,
return (copy_to_user((unsigned long __user *)arg, &funcs,
sizeof(unsigned long)))?-EFAULT:0;
case I2C_RDWR:
if (copy_from_user(&rdwr_arg,
(struct i2c_rdwr_ioctl_data *)arg,
(struct i2c_rdwr_ioctl_data __user *)arg,
sizeof(rdwr_arg)))
return -EFAULT;
......@@ -284,7 +284,7 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
case I2C_SMBUS:
if (copy_from_user(&data_arg,
(struct i2c_smbus_ioctl_data *) arg,
(struct i2c_smbus_ioctl_data __user *) arg,
sizeof(struct i2c_smbus_ioctl_data)))
return -EFAULT;
if ((data_arg.size != I2C_SMBUS_BYTE) &&
......
This diff is collapsed.
/* ------------------------------------------------------------------------- */
/* i2c-iop3xx.h algorithm driver definitions private to i2c-iop3xx.c */
/* ------------------------------------------------------------------------- */
/* Copyright (C) 2003 Peter Milne, D-TACQ Solutions Ltd
* <Peter dot Milne at D hyphen TACQ dot com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 2.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* ------------------------------------------------------------------------- */
#ifndef I2C_IOP3XX_H
#define I2C_IOP3XX_H 1
/*
* iop321 hardware bit definitions
*/
#define IOP321_ICR_FAST_MODE 0x8000 /* 1=400kBps, 0=100kBps */
#define IOP321_ICR_UNIT_RESET 0x4000 /* 1=RESET */
#define IOP321_ICR_SADIE 0x2000 /* 1=Slave Detect Interrupt Enable */
#define IOP321_ICR_ALDIE 0x1000 /* 1=Arb Loss Detect Interrupt Enable */
#define IOP321_ICR_SSDIE 0x0800 /* 1=Slave STOP Detect Interrupt Enable */
#define IOP321_ICR_BERRIE 0x0400 /* 1=Bus Error Interrupt Enable */
#define IOP321_ICR_RXFULLIE 0x0200 /* 1=Receive Full Interrupt Enable */
#define IOP321_ICR_TXEMPTYIE 0x0100 /* 1=Transmit Empty Interrupt Enable */
#define IOP321_ICR_GCD 0x0080 /* 1=General Call Disable */
/*
* IOP321_ICR_GCD: 1 disables response as slave. "This bit must be set
* when sending a master mode general call message from the I2C unit"
*/
#define IOP321_ICR_UE 0x0040 /* 1=Unit Enable */
/*
* "NOTE: To avoid I2C bus integrity problems,
* the user needs to ensure that the GPIO Output Data Register -
* GPOD bits associated with an I2C port are cleared prior to setting
* the enable bit for that I2C serial port.
* The user prepares to enable I2C port 0 and
* I2C port 1 by clearing GPOD bits 7:6 and GPOD bits 5:4, respectively.
*/
#define IOP321_ICR_SCLEN 0x0020 /* 1=SCL enable for master mode */
#define IOP321_ICR_MABORT 0x0010 /* 1=Send a STOP with no data
* NB TBYTE must be clear */
#define IOP321_ICR_TBYTE 0x0008 /* 1=Send/Receive a byte. i2c clears */
#define IOP321_ICR_NACK 0x0004 /* 1=reply with NACK */
#define IOP321_ICR_MSTOP 0x0002 /* 1=send a STOP after next data byte */
#define IOP321_ICR_MSTART 0x0001 /* 1=initiate a START */
#define IOP321_ISR_BERRD 0x0400 /* 1=BUS ERROR Detected */
#define IOP321_ISR_SAD 0x0200 /* 1=Slave ADdress Detected */
#define IOP321_ISR_GCAD 0x0100 /* 1=General Call Address Detected */
#define IOP321_ISR_RXFULL 0x0080 /* 1=Receive Full */
#define IOP321_ISR_TXEMPTY 0x0040 /* 1=Transmit Empty */
#define IOP321_ISR_ALD 0x0020 /* 1=Arbitration Loss Detected */
#define IOP321_ISR_SSD 0x0010 /* 1=Slave STOP Detected */
#define IOP321_ISR_BBUSY 0x0008 /* 1=Bus BUSY */
#define IOP321_ISR_UNITBUSY 0x0004 /* 1=Unit Busy */
#define IOP321_ISR_NACK 0x0002 /* 1=Unit Rx or Tx a NACK */
#define IOP321_ISR_RXREAD 0x0001 /* 1=READ 0=WRITE (R/W bit of slave addr */
#define IOP321_ISR_CLEARBITS 0x07f0
#define IOP321_ISAR_SAMASK 0x007f
#define IOP321_IDBR_MASK 0x00ff
#define IOP321_IBMR_SCL 0x0002
#define IOP321_IBMR_SDA 0x0001
#define IOP321_GPOD_I2C0 0x00c0 /* clear these bits to enable ch0 */
#define IOP321_GPOD_I2C1 0x0030 /* clear these bits to enable ch1 */
#define MYSAR 0x02 /* SWAG a suitable slave address */
#define I2C_ERR 321
#define I2C_ERR_BERR (I2C_ERR+0)
#define I2C_ERR_ALD (I2C_ERR+1)
struct iop3xx_biu { /* Bus Interface Unit - the hardware */
/* physical hardware defs - regs*/
u32 *CR;
u32 *SR;
u32 *SAR;
u32 *DBR;
u32 *BMR;
/* irq bit vector */
u32 irq;
/* stored flags */
u32 SR_enabled, SR_received;
};
struct i2c_algo_iop3xx_data {
int channel;
wait_queue_head_t waitq;
spinlock_t lock;
int timeout;
struct iop3xx_biu* biu;
};
#define REGION_START(adap) ((u32)((adap)->biu->CR))
#define REGION_END(adap) ((u32)((adap)->biu->BMR+1))
#define REGION_LENGTH(adap) (REGION_END(adap)-REGION_START(adap))
#define IRQ_STATUS_MASK(adap) (1<<adap->biu->irq)
#endif /* I2C_IOP3XX_H */
......@@ -29,8 +29,8 @@ config PCMCIA
and ds. If you want to compile it as a module, say M here and
read <file:Documentation/modules.txt>.
config CARDBUS
bool "CardBus support"
config YENTA
tristate "CardBus yenta-compatible bridge support"
depends on PCMCIA && PCI
---help---
CardBus is a bus mastering architecture for PC-cards, which allows
......@@ -48,6 +48,11 @@ config CARDBUS
If unsure, say Y.
config CARDBUS
bool
depends on YENTA
default y if YENTA
config I82092
tristate "i82092 compatible bridge support"
depends on PCMCIA && PCI
......@@ -58,7 +63,7 @@ config I82092
config I82365
tristate "i82365 compatible bridge support"
depends on PCMCIA
depends on PCMCIA && ISA
help
Say Y here to include support for ISA-bus PCMCIA host bridges that
are register compatible with the Intel i82365. These are found on
......
......@@ -3,9 +3,7 @@
#
obj-$(CONFIG_PCMCIA) += pcmcia_core.o ds.o
ifeq ($(CONFIG_CARDBUS),y)
obj-$(CONFIG_PCMCIA) += yenta_socket.o
endif
obj-$(CONFIG_YENTA) += yenta.o
obj-$(CONFIG_I82365) += i82365.o
obj-$(CONFIG_I82092) += i82092.o
......@@ -14,8 +12,6 @@ obj-$(CONFIG_HD64465_PCMCIA) += hd64465_ss.o
obj-$(CONFIG_PCMCIA_SA1100) += sa11xx_core.o sa1100_cs.o
obj-$(CONFIG_PCMCIA_SA1111) += sa11xx_core.o sa1111_cs.o
yenta_socket-y += pci_socket.o yenta.o
pcmcia_core-y += cistpl.o rsrc_mgr.o bulkmem.o cs.o
pcmcia_core-$(CONFIG_CARDBUS) += cardbus.o
......
......@@ -63,7 +63,7 @@ static int do_mtd_request(memory_handle_t handle, mtd_request_t *req,
{
int ret, tries;
client_t *mtd;
socket_info_t *s;
struct pcmcia_socket *s;
mtd = handle->mtd;
if (mtd == NULL)
......@@ -130,7 +130,7 @@ static void retry_erase(erase_busy_t *busy, u_int cause)
eraseq_entry_t *erase = busy->erase;
mtd_request_t req;
client_t *mtd;
socket_info_t *s;
struct pcmcia_socket *s;
int ret;
DEBUG(2, "cs: trying erase request 0x%p...\n", busy);
......@@ -259,27 +259,27 @@ static int mtd_modify_window(window_handle_t win, mtd_mod_win_t *req)
win->ctl.flags |= MAP_ATTRIB;
win->ctl.speed = req->AccessSpeed;
win->ctl.card_start = req->CardOffset;
win->sock->ss_entry->set_mem_map(win->sock->sock, &win->ctl);
win->sock->ss_entry->set_mem_map(win->sock, &win->ctl);
return CS_SUCCESS;
}
static int mtd_set_vpp(client_handle_t handle, mtd_vpp_req_t *req)
{
socket_info_t *s;
struct pcmcia_socket *s;
if (CHECK_HANDLE(handle))
return CS_BAD_HANDLE;
if (req->Vpp1 != req->Vpp2)
return CS_BAD_VPP;
s = SOCKET(handle);
s->socket.Vpp = req->Vpp1;
if (s->ss_entry->set_socket(s->sock, &s->socket))
if (s->ss_entry->set_socket(s, &s->socket))
return CS_BAD_VPP;
return CS_SUCCESS;
}
static int mtd_rdy_mask(client_handle_t handle, mtd_rdy_req_t *req)
{
socket_info_t *s;
struct pcmcia_socket *s;
if (CHECK_HANDLE(handle))
return CS_BAD_HANDLE;
s = SOCKET(handle);
......@@ -287,7 +287,7 @@ static int mtd_rdy_mask(client_handle_t handle, mtd_rdy_req_t *req)
s->socket.csc_mask |= SS_READY;
else
s->socket.csc_mask &= ~SS_READY;
if (s->ss_entry->set_socket(s->sock, &s->socket))
if (s->ss_entry->set_socket(s, &s->socket))
return CS_GENERAL_FAILURE;
return CS_SUCCESS;
}
......@@ -417,7 +417,7 @@ static int match_region(client_handle_t handle, memory_handle_t list,
int pcmcia_get_first_region(client_handle_t handle, region_info_t *rgn)
{
socket_info_t *s = SOCKET(handle);
struct pcmcia_socket *s = SOCKET(handle);
if (CHECK_HANDLE(handle))
return CS_BAD_HANDLE;
......@@ -450,7 +450,7 @@ int pcmcia_get_next_region(client_handle_t handle, region_info_t *rgn)
int pcmcia_register_mtd(client_handle_t handle, mtd_reg_t *reg)
{
memory_handle_t list;
socket_info_t *s;
struct pcmcia_socket *s;
if (CHECK_HANDLE(handle))
return CS_BAD_HANDLE;
......@@ -533,12 +533,12 @@ int pcmcia_check_erase_queue(eraseq_handle_t eraseq)
int pcmcia_open_memory(client_handle_t *handle, open_mem_t *open, memory_handle_t *mh)
{
socket_info_t *s;
struct pcmcia_socket *s;
memory_handle_t region;
if ((handle == NULL) || CHECK_HANDLE(*handle))
return CS_BAD_HANDLE;
s = SOCKET(*handle);
s = (*handle)->Socket;
if (open->Attributes & MEMORY_TYPE_AM)
region = s->a_region;
else
......
......@@ -119,11 +119,11 @@ static u_int xlate_rom_addr(u_char * b, u_int addr)
These are similar to setup_cis_mem and release_cis_mem for 16-bit
cards. The "result" that is used externally is the cb_cis_virt
pointer in the socket_info_t structure.
pointer in the struct pcmcia_socket structure.
=====================================================================*/
static void cb_release_cis_mem(socket_info_t * s)
static void cb_release_cis_mem(struct pcmcia_socket * s)
{
if (s->cb_cis_virt) {
DEBUG(1, "cs: cb_release_cis_mem()\n");
......@@ -133,7 +133,7 @@ static void cb_release_cis_mem(socket_info_t * s)
}
}
static int cb_setup_cis_mem(socket_info_t * s, struct resource *res)
static int cb_setup_cis_mem(struct pcmcia_socket * s, struct resource *res)
{
unsigned int start, size;
......@@ -162,7 +162,7 @@ static int cb_setup_cis_mem(socket_info_t * s, struct resource *res)
=====================================================================*/
int read_cb_mem(socket_info_t * s, int space, u_int addr, u_int len, void *ptr)
int read_cb_mem(struct pcmcia_socket * s, int space, u_int addr, u_int len, void *ptr)
{
struct pci_dev *dev;
struct resource *res;
......@@ -237,7 +237,7 @@ static void cardbus_assign_irqs(struct pci_bus *bus, int irq)
}
}
int cb_alloc(socket_info_t * s)
int cb_alloc(struct pcmcia_socket * s)
{
struct pci_bus *bus = s->cap.cb_dev->subordinate;
struct pci_dev *dev;
......@@ -266,7 +266,7 @@ int cb_alloc(socket_info_t * s)
return CS_SUCCESS;
}
void cb_free(socket_info_t * s)
void cb_free(struct pcmcia_socket * s)
{
struct pci_dev *bridge = s->cap.cb_dev;
......
......@@ -82,11 +82,11 @@ static const u_int exponent[] = {
INT_MODULE_PARM(cis_width, 0); /* 16-bit CIS? */
void release_cis_mem(socket_info_t *s)
void release_cis_mem(struct pcmcia_socket *s)
{
if (s->cis_mem.sys_start != 0) {
s->cis_mem.flags &= ~MAP_ACTIVE;
s->ss_entry->set_mem_map(s->sock, &s->cis_mem);
s->ss_entry->set_mem_map(s, &s->cis_mem);
if (!(s->cap.features & SS_CAP_STATIC_MAP))
release_mem_region(s->cis_mem.sys_start, s->cap.map_size);
iounmap(s->cis_virt);
......@@ -101,7 +101,7 @@ void release_cis_mem(socket_info_t *s)
* map the memory space.
*/
static unsigned char *
set_cis_map(socket_info_t *s, unsigned int card_offset, unsigned int flags)
set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flags)
{
pccard_mem_map *mem = &s->cis_mem;
if (!(s->cap.features & SS_CAP_STATIC_MAP) &&
......@@ -119,7 +119,7 @@ set_cis_map(socket_info_t *s, unsigned int card_offset, unsigned int flags)
}
mem->card_start = card_offset;
mem->flags = flags;
s->ss_entry->set_mem_map(s->sock, mem);
s->ss_entry->set_mem_map(s, mem);
if (s->cap.features & SS_CAP_STATIC_MAP) {
if (s->cis_virt)
iounmap(s->cis_virt);
......@@ -139,7 +139,7 @@ set_cis_map(socket_info_t *s, unsigned int card_offset, unsigned int flags)
#define IS_ATTR 1
#define IS_INDIRECT 8
int read_cis_mem(socket_info_t *s, int attr, u_int addr,
int read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
u_int len, void *ptr)
{
u_char *sys, *end, *buf = ptr;
......@@ -202,7 +202,7 @@ int read_cis_mem(socket_info_t *s, int attr, u_int addr,
return 0;
}
void write_cis_mem(socket_info_t *s, int attr, u_int addr,
void write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
u_int len, void *ptr)
{
u_char *sys, *end, *buf = ptr;
......@@ -266,7 +266,7 @@ void write_cis_mem(socket_info_t *s, int attr, u_int addr,
======================================================================*/
static void read_cis_cache(socket_info_t *s, int attr, u_int addr,
static void read_cis_cache(struct pcmcia_socket *s, int attr, u_int addr,
u_int len, void *ptr)
{
struct cis_cache_entry *cis;
......@@ -306,7 +306,7 @@ static void read_cis_cache(socket_info_t *s, int attr, u_int addr,
}
static void
remove_cis_cache(socket_info_t *s, int attr, u_int addr, u_int len)
remove_cis_cache(struct pcmcia_socket *s, int attr, u_int addr, u_int len)
{
struct cis_cache_entry *cis;
......@@ -318,7 +318,7 @@ remove_cis_cache(socket_info_t *s, int attr, u_int addr, u_int len)
}
}
void destroy_cis_cache(socket_info_t *s)
void destroy_cis_cache(struct pcmcia_socket *s)
{
struct list_head *l, *n;
......@@ -337,7 +337,7 @@ void destroy_cis_cache(socket_info_t *s)
======================================================================*/
int verify_cis_cache(socket_info_t *s)
int verify_cis_cache(struct pcmcia_socket *s)
{
struct cis_cache_entry *cis;
char buf[256];
......@@ -369,7 +369,7 @@ int verify_cis_cache(socket_info_t *s)
int pcmcia_replace_cis(client_handle_t handle, cisdump_t *cis)
{
socket_info_t *s;
struct pcmcia_socket *s;
if (CHECK_HANDLE(handle))
return CS_BAD_HANDLE;
s = SOCKET(handle);
......@@ -409,7 +409,7 @@ int pcmcia_get_next_tuple(client_handle_t handle, tuple_t *tuple);
int pcmcia_get_first_tuple(client_handle_t handle, tuple_t *tuple)
{
socket_info_t *s;
struct pcmcia_socket *s;
if (CHECK_HANDLE(handle))
return CS_BAD_HANDLE;
s = SOCKET(handle);
......@@ -445,7 +445,7 @@ int pcmcia_get_first_tuple(client_handle_t handle, tuple_t *tuple)
return pcmcia_get_next_tuple(handle, tuple);
}
static int follow_link(socket_info_t *s, tuple_t *tuple)
static int follow_link(struct pcmcia_socket *s, tuple_t *tuple)
{
u_char link[5];
u_int ofs;
......@@ -487,7 +487,7 @@ static int follow_link(socket_info_t *s, tuple_t *tuple)
int pcmcia_get_next_tuple(client_handle_t handle, tuple_t *tuple)
{
socket_info_t *s;
struct pcmcia_socket *s;
u_char link[2], tmp;
int ofs, i, attr;
......@@ -588,7 +588,7 @@ int pcmcia_get_next_tuple(client_handle_t handle, tuple_t *tuple)
int pcmcia_get_tuple_data(client_handle_t handle, tuple_t *tuple)
{
socket_info_t *s;
struct pcmcia_socket *s;
u_int len;
if (CHECK_HANDLE(handle))
......
This diff is collapsed.
......@@ -21,13 +21,6 @@
#include <linux/config.h>
typedef struct erase_busy_t {
eraseq_entry_t *erase;
client_handle_t client;
struct timer_list timeout;
struct erase_busy_t *prev, *next;
} erase_busy_t;
#define ERASEQ_MAGIC 0xFA67
typedef struct eraseq_t {
u_short eraseq_magic;
......@@ -39,7 +32,7 @@ typedef struct eraseq_t {
#define CLIENT_MAGIC 0x51E6
typedef struct client_t {
u_short client_magic;
socket_t Socket;
struct pcmcia_socket *Socket;
u_char Function;
dev_info_t dev_info;
u_int Attributes;
......@@ -63,23 +56,6 @@ typedef struct client_t {
#define CLIENT_WIN_REQ(i) (0x20<<(i))
#define CLIENT_CARDBUS 0x8000
typedef struct io_window_t {
u_int Attributes;
ioaddr_t BasePort, NumPorts;
ioaddr_t InUse, Config;
} io_window_t;
#define WINDOW_MAGIC 0xB35C
typedef struct window_t {
u_short magic;
u_short index;
client_handle_t handle;
struct socket_info_t *sock;
u_long base;
u_long size;
pccard_mem_map ctl;
} window_t;
#define REGION_MAGIC 0xE3C9
typedef struct region_t {
u_short region_magic;
......@@ -108,12 +84,6 @@ typedef struct config_t {
} irq;
} config_t;
/* Maximum number of IO windows per socket */
#define MAX_IO_WIN 2
/* Maximum number of memory windows per socket */
#define MAX_WIN 4
struct cis_cache_entry {
struct list_head node;
unsigned int addr;
......@@ -122,48 +92,6 @@ struct cis_cache_entry {
unsigned char cache[0];
};
typedef struct socket_info_t {
spinlock_t lock;
struct pccard_operations * ss_entry;
u_int sock;
socket_state_t socket;
socket_cap_t cap;
u_int state;
u_short functions;
u_short lock_count;
client_handle_t clients;
u_int real_clients;
pccard_mem_map cis_mem;
u_char *cis_virt;
config_t *config;
#ifdef CONFIG_CARDBUS
struct resource * cb_cis_res;
u_char *cb_cis_virt;
#endif
struct {
u_int AssignedIRQ;
u_int Config;
} irq;
io_window_t io[MAX_IO_WIN];
window_t win[MAX_WIN];
region_t *c_region, *a_region;
erase_busy_t erase_busy;
struct list_head cis_cache;
u_int fake_cis_len;
char *fake_cis;
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *proc;
#endif
struct semaphore skt_sem; /* protects socket h/w state */
struct task_struct *thread;
struct completion thread_done;
wait_queue_head_t thread_wait;
spinlock_t thread_lock; /* protects thread_events */
unsigned int thread_events;
} socket_info_t;
/* Flags in config state */
#define CONFIG_LOCKED 0x01
#define CONFIG_IRQ_REQ 0x02
......@@ -187,7 +115,7 @@ typedef struct socket_info_t {
#define CHECK_SOCKET(s) \
(((s) >= sockets) || (socket_table[s]->ss_entry == NULL))
#define SOCKET(h) (socket_table[(h)->Socket])
#define SOCKET(h) (h->Socket)
#define CONFIG(h) (&SOCKET(h)->config[(h)->Function])
#define CHECK_REGION(r) \
......@@ -200,19 +128,19 @@ typedef struct socket_info_t {
((h)->event_handler((e), (p), &(h)->event_callback_args))
/* In cardbus.c */
int cb_alloc(socket_info_t *s);
void cb_free(socket_info_t *s);
int read_cb_mem(socket_info_t *s, int space, u_int addr, u_int len, void *ptr);
int cb_alloc(struct pcmcia_socket *s);
void cb_free(struct pcmcia_socket *s);
int read_cb_mem(struct pcmcia_socket *s, int space, u_int addr, u_int len, void *ptr);
/* In cistpl.c */
int read_cis_mem(socket_info_t *s, int attr,
int read_cis_mem(struct pcmcia_socket *s, int attr,
u_int addr, u_int len, void *ptr);
void write_cis_mem(socket_info_t *s, int attr,
void write_cis_mem(struct pcmcia_socket *s, int attr,
u_int addr, u_int len, void *ptr);
void release_cis_mem(socket_info_t *s);
void destroy_cis_cache(socket_info_t *s);
int verify_cis_cache(socket_info_t *s);
void preload_cis_cache(socket_info_t *s);
void release_cis_mem(struct pcmcia_socket *s);
void destroy_cis_cache(struct pcmcia_socket *s);
int verify_cis_cache(struct pcmcia_socket *s);
void preload_cis_cache(struct pcmcia_socket *s);
int get_first_tuple(client_handle_t handle, tuple_t *tuple);
int get_next_tuple(client_handle_t handle, tuple_t *tuple);
int get_tuple_data(client_handle_t handle, tuple_t *tuple);
......@@ -236,11 +164,11 @@ int write_memory(memory_handle_t handle, mem_op_t *req, caddr_t buf);
int copy_memory(memory_handle_t handle, copy_op_t *req);
/* In rsrc_mgr */
void validate_mem(socket_info_t *s);
void validate_mem(struct pcmcia_socket *s);
int find_io_region(ioaddr_t *base, ioaddr_t num, ioaddr_t align,
char *name, socket_info_t *s);
char *name, struct pcmcia_socket *s);
int find_mem_region(u_long *base, u_long num, u_long align,
int force_low, char *name, socket_info_t *s);
int force_low, char *name, struct pcmcia_socket *s);
int try_irq(u_int Attributes, int irq, int specific);
void undo_irq(u_int Attributes, int irq);
int adjust_resource_info(client_handle_t handle, adjust_t *adj);
......@@ -250,9 +178,8 @@ int proc_read_io(char *buf, char **start, off_t pos,
int proc_read_mem(char *buf, char **start, off_t pos,
int count, int *eof, void *data);
#define MAX_SOCK 8
extern socket_t sockets;
extern socket_info_t *socket_table[MAX_SOCK];
extern struct rw_semaphore pcmcia_socket_list_rwsem;
extern struct list_head pcmcia_socket_list;
#ifdef CONFIG_PROC_FS
extern struct proc_dir_entry *proc_pccard;
......
......@@ -107,8 +107,7 @@ struct pcmcia_bus_socket {
struct work_struct removal;
socket_bind_t *bind;
struct device *socket_dev;
struct list_head socket_list;
unsigned int socket_no; /* deprecated */
struct pcmcia_socket *parent;
};
#define SOCKET_PRESENT 0x01
......@@ -122,10 +121,6 @@ static dev_info_t dev_info = "Driver Services";
static int major_dev = -1;
/* list of all sockets registered with the pcmcia bus driver */
static DECLARE_RWSEM(bus_socket_list_rwsem);
static LIST_HEAD(bus_socket_list);
extern struct proc_dir_entry *proc_pccard;
/*====================================================================*/
......@@ -164,20 +159,6 @@ EXPORT_SYMBOL(pcmcia_register_driver);
*/
void pcmcia_unregister_driver(struct pcmcia_driver *driver)
{
socket_bind_t *b;
struct pcmcia_bus_socket *bus_sock;
if (driver->use_count > 0) {
/* Blank out any left-over device instances */
driver->attach = NULL; driver->detach = NULL;
down_read(&bus_socket_list_rwsem);
list_for_each_entry(bus_sock, &bus_socket_list, socket_list) {
for (b = bus_sock->bind; b; b = b->next)
if (b->driver == driver)
b->instance = NULL;
}
up_read(&bus_socket_list_rwsem);
}
driver_unregister(&driver->drv);
}
EXPORT_SYMBOL(pcmcia_unregister_driver);
......@@ -319,14 +300,14 @@ static int bind_mtd(struct pcmcia_bus_socket *bus_sock, mtd_info_t *mtd_info)
bind_req.dev_info = &mtd_info->dev_info;
bind_req.Attributes = mtd_info->Attributes;
bind_req.Socket = bus_sock->socket_no;
bind_req.Socket = bus_sock->parent;
bind_req.CardOffset = mtd_info->CardOffset;
ret = pcmcia_bind_mtd(&bind_req);
if (ret != CS_SUCCESS) {
cs_error(NULL, BindMTD, ret);
printk(KERN_NOTICE "ds: unable to bind MTD '%s' to socket %d"
" offset 0x%x\n",
(char *)bind_req.dev_info, bus_sock->socket_no, bind_req.CardOffset);
(char *)bind_req.dev_info, bus_sock->parent->sock, bind_req.CardOffset);
return -ENODEV;
}
return 0;
......@@ -351,7 +332,7 @@ static int bind_request(struct pcmcia_bus_socket *s, bind_info_t *bind_info)
if (!s)
return -EINVAL;
DEBUG(2, "bind_request(%d, '%s')\n", s->socket_no,
DEBUG(2, "bind_request(%d, '%s')\n", s->parent->sock,
(char *)bind_info->dev_info);
driver = get_pcmcia_driver(&bind_info->dev_info);
if (!driver)
......@@ -366,14 +347,18 @@ static int bind_request(struct pcmcia_bus_socket *s, bind_info_t *bind_info)
return -EBUSY;
}
bind_req.Socket = s->socket_no;
if (!try_module_get(driver->owner))
return -EINVAL;
bind_req.Socket = s->parent;
bind_req.Function = bind_info->function;
bind_req.dev_info = (dev_info_t *) driver->drv.name;
ret = pcmcia_bind_device(&bind_req);
if (ret != CS_SUCCESS) {
cs_error(NULL, BindDevice, ret);
printk(KERN_NOTICE "ds: unable to bind '%s' to socket %d\n",
(char *)dev_info, s->socket_no);
(char *)dev_info, s->parent->sock);
module_put(driver->owner);
return -ENODEV;
}
......@@ -383,6 +368,7 @@ static int bind_request(struct pcmcia_bus_socket *s, bind_info_t *bind_info)
if (!b)
{
driver->use_count--;
module_put(driver->owner);
return -ENOMEM;
}
b->driver = driver;
......@@ -396,6 +382,7 @@ static int bind_request(struct pcmcia_bus_socket *s, bind_info_t *bind_info)
if (b->instance == NULL) {
printk(KERN_NOTICE "ds: unable to create instance "
"of '%s'!\n", (char *)bind_info->dev_info);
module_put(driver->owner);
return -ENODEV;
}
}
......@@ -476,7 +463,7 @@ static int unbind_request(struct pcmcia_bus_socket *s, bind_info_t *bind_info)
{
socket_bind_t **b, *c;
DEBUG(2, "unbind_request(%d, '%s')\n", s->socket_no,
DEBUG(2, "unbind_request(%d, '%s')\n", s->parent->sock,
(char *)bind_info->dev_info);
for (b = &s->bind; *b; b = &(*b)->next)
if ((strcmp((char *)(*b)->driver->drv.name,
......@@ -492,9 +479,9 @@ static int unbind_request(struct pcmcia_bus_socket *s, bind_info_t *bind_info)
if (c->instance)
c->driver->detach(c->instance);
}
module_put(c->driver->owner);
*b = c->next;
kfree(c);
return 0;
} /* unbind_request */
......@@ -832,13 +819,13 @@ static struct file_operations ds_fops = {
.poll = ds_poll,
};
static int __devinit pcmcia_bus_add_socket(struct device *dev, unsigned int socket_nr)
static int __devinit pcmcia_bus_add_socket(struct class_device *class_dev)
{
struct pcmcia_socket *socket = class_dev->class_data;
client_reg_t client_reg;
bind_req_t bind;
struct pcmcia_bus_socket *s, *tmp_s;
struct pcmcia_bus_socket *s;
int ret;
int i;
s = kmalloc(sizeof(struct pcmcia_bus_socket), GFP_KERNEL);
if(!s)
......@@ -855,28 +842,15 @@ static int __devinit pcmcia_bus_add_socket(struct device *dev, unsigned int sock
init_waitqueue_head(&s->queue);
init_waitqueue_head(&s->request);
/* find the lowest, unused socket no. Please note that this is a
* temporary workaround until "struct pcmcia_socket" is introduced
* into cs.c which will include this number, and which will be
* accessible to ds.c directly */
i = 0;
next_try:
list_for_each_entry(tmp_s, &bus_socket_list, socket_list) {
if (tmp_s->socket_no == i) {
i++;
goto next_try;
}
}
s->socket_no = i;
/* initialize data */
s->socket_dev = dev;
s->socket_dev = socket->dev.dev;
INIT_WORK(&s->removal, handle_removal, s);
s->parent = socket;
/* Set up hotline to Card Services */
client_reg.dev_info = bind.dev_info = &dev_info;
bind.Socket = s->socket_no;
bind.Socket = socket;
bind.Function = BIND_FN_ALL;
ret = pcmcia_bind_device(&bind);
if (ret != CS_SUCCESS) {
......@@ -901,50 +875,26 @@ static int __devinit pcmcia_bus_add_socket(struct device *dev, unsigned int sock
return -EINVAL;
}
list_add(&s->socket_list, &bus_socket_list);
socket->pcmcia = s;
return 0;
}
static int pcmcia_bus_add_socket_dev(struct class_device *class_dev)
static void pcmcia_bus_remove_socket(struct class_device *class_dev)
{
struct pcmcia_socket_class_data *cls_d = class_get_devdata(class_dev);
unsigned int i;
unsigned int ret = 0;
struct pcmcia_socket *socket = class_dev->class_data;
if (!cls_d)
return -ENODEV;
down_write(&bus_socket_list_rwsem);
for (i = 0; i < cls_d->nsock; i++)
ret += pcmcia_bus_add_socket(class_dev->dev, i);
up_write(&bus_socket_list_rwsem);
return ret;
}
static void pcmcia_bus_remove_socket_dev(struct class_device *class_dev)
{
struct pcmcia_socket_class_data *cls_d = class_get_devdata(class_dev);
struct list_head *list_loop;
struct list_head *tmp_storage;
if (!cls_d)
if (!socket || !socket->pcmcia)
return;
flush_scheduled_work();
down_write(&bus_socket_list_rwsem);
list_for_each_safe(list_loop, tmp_storage, &bus_socket_list) {
struct pcmcia_bus_socket *bus_sock = container_of(list_loop, struct pcmcia_bus_socket, socket_list);
if (bus_sock->socket_dev == class_dev->dev) {
pcmcia_deregister_client(bus_sock->handle);
list_del(&bus_sock->socket_list);
kfree(bus_sock);
}
}
up_write(&bus_socket_list_rwsem);
pcmcia_deregister_client(socket->pcmcia->handle);
kfree(socket->pcmcia);
socket->pcmcia = NULL;
return;
}
......@@ -952,8 +902,8 @@ static void pcmcia_bus_remove_socket_dev(struct class_device *class_dev)
/* the pcmcia_bus_interface is used to handle pcmcia socket devices */
static struct class_interface pcmcia_bus_interface = {
.class = &pcmcia_socket_class,
.add = &pcmcia_bus_add_socket_dev,
.remove = &pcmcia_bus_remove_socket_dev,
.add = &pcmcia_bus_add_socket,
.remove = &pcmcia_bus_remove_socket,
};
......@@ -1008,17 +958,12 @@ module_exit(exit_pcmcia_bus);
/* helpers for backwards-compatible functions */
static struct pcmcia_bus_socket * get_socket_info_by_nr(unsigned int nr)
{
struct pcmcia_bus_socket * s;
down_read(&bus_socket_list_rwsem);
list_for_each_entry(s, &bus_socket_list, socket_list)
if (s->socket_no == nr) {
up_read(&bus_socket_list_rwsem);
return s;
}
up_read(&bus_socket_list_rwsem);
struct pcmcia_socket * s = pcmcia_get_socket_by_nr(nr);
if (s && s->pcmcia)
return s->pcmcia;
else
return NULL;
}
......
This diff is collapsed.
......@@ -28,16 +28,16 @@ static irqreturn_t i82092aa_interrupt(int irq, void *dev, struct pt_regs *regs);
static int i82092aa_get_status(unsigned int sock, u_int *value);
static int i82092aa_get_socket(unsigned int sock, socket_state_t *state);
static int i82092aa_set_socket(unsigned int sock, socket_state_t *state);
static int i82092aa_set_io_map(unsigned int sock, struct pccard_io_map *io);
static int i82092aa_set_mem_map(unsigned int sock, struct pccard_mem_map *mem);
static int i82092aa_init(unsigned int s);
static int i82092aa_suspend(unsigned int sock);
static int i82092aa_register_callback(unsigned int sock, void (*handler)(void *, unsigned int), void * info);
static int i82092aa_inquire_socket(unsigned int sock, socket_cap_t *cap);
static void i82092aa_proc_setup(unsigned int sock, struct proc_dir_entry *base);
static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value);
static int i82092aa_get_socket(struct pcmcia_socket *socket, socket_state_t *state);
static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *state);
static int i82092aa_set_io_map(struct pcmcia_socket *socket, struct pccard_io_map *io);
static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_map *mem);
static int i82092aa_init(struct pcmcia_socket *socket);
static int i82092aa_suspend(struct pcmcia_socket *socket);
static int i82092aa_register_callback(struct pcmcia_socket *socket, void (*handler)(void *, unsigned int), void * info);
static int i82092aa_inquire_socket(struct pcmcia_socket *socket, socket_cap_t *cap);
static void i82092aa_proc_setup(struct pcmcia_socket *socket, struct proc_dir_entry *base);
#endif
This diff is collapsed.
This diff is collapsed.
/*
* drivers/pcmcia/pci_socket.h
*
* (C) Copyright 1999 Linus Torvalds
*/
#ifndef __PCI_SOCKET_H
#define __PCI_SOCKET_H
struct pci_socket_ops;
struct socket_info_t;
typedef struct pci_socket {
struct pci_dev *dev;
int cb_irq, io_irq;
void *base;
void (*handler)(void *, unsigned int);
void *info;
struct pci_socket_ops *op;
socket_cap_t cap;
spinlock_t event_lock;
unsigned int events;
struct work_struct tq_task;
struct timer_list poll_timer;
struct pcmcia_socket_class_data cls_d;
/* A few words of private data for the low-level driver.. */
unsigned int private[8];
} pci_socket_t;
struct pci_socket_ops {
int (*open)(struct pci_socket *);
void (*close)(struct pci_socket *);
int (*init)(struct pci_socket *);
int (*suspend)(struct pci_socket *);
int (*get_status)(struct pci_socket *, unsigned int *);
int (*get_socket)(struct pci_socket *, socket_state_t *);
int (*set_socket)(struct pci_socket *, socket_state_t *);
int (*set_io_map)(struct pci_socket *, struct pccard_io_map *);
int (*set_mem_map)(struct pci_socket *, struct pccard_mem_map *);
void (*proc_setup)(struct pci_socket *, struct proc_dir_entry *base);
};
extern struct pci_socket_ops yenta_operations;
extern struct pci_socket_ops ricoh_operations;
#endif
......@@ -125,11 +125,26 @@
#define rl_mem(socket) ((socket)->private[3])
#define rl_config(socket) ((socket)->private[4])
static int ricoh_init(struct pcmcia_socket *sock)
{
struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
yenta_init(sock);
config_writew(socket, RL5C4XX_MISC, rl_misc(socket));
config_writew(socket, RL5C4XX_16BIT_CTL, rl_ctl(socket));
config_writew(socket, RL5C4XX_16BIT_IO_0, rl_io(socket));
config_writew(socket, RL5C4XX_16BIT_MEM_0, rl_mem(socket));
config_writew(socket, RL5C4XX_CONFIG, rl_config(socket));
return 0;
}
/*
* Magic Ricoh initialization code.. Save state at
* beginning, re-initialize it after suspend.
*/
static int ricoh_open(pci_socket_t *socket)
static int ricoh_override(struct yenta_socket *socket)
{
rl_misc(socket) = config_readw(socket, RL5C4XX_MISC);
rl_ctl(socket) = config_readw(socket, RL5C4XX_16BIT_CTL);
......@@ -146,35 +161,11 @@ static int ricoh_open(pci_socket_t *socket)
rl_config(socket) |= RL5C4XX_CONFIG_PREFETCH;
}
return 0;
}
static int ricoh_init(pci_socket_t *socket)
{
yenta_init(socket);
config_writew(socket, RL5C4XX_MISC, rl_misc(socket));
config_writew(socket, RL5C4XX_16BIT_CTL, rl_ctl(socket));
config_writew(socket, RL5C4XX_16BIT_IO_0, rl_io(socket));
config_writew(socket, RL5C4XX_16BIT_MEM_0, rl_mem(socket));
config_writew(socket, RL5C4XX_CONFIG, rl_config(socket));
socket->socket.ss_entry->init = ricoh_init;
return 0;
}
static struct pci_socket_ops ricoh_ops = {
ricoh_open,
yenta_close,
ricoh_init,
yenta_suspend,
yenta_get_status,
yenta_get_socket,
yenta_set_socket,
yenta_set_io_map,
yenta_set_mem_map,
yenta_proc_setup
};
#endif /* CONFIG_CARDBUS */
#endif /* _LINUX_RICOH_H */
This diff is collapsed.
......@@ -106,19 +106,10 @@ static struct device_driver sa11x0_pcmcia_driver = {
.remove = sa11xx_drv_pcmcia_remove,
.name = "sa11x0-pcmcia",
.bus = &platform_bus_type,
.devclass = &pcmcia_socket_class,
.suspend = pcmcia_socket_dev_suspend,
.resume = pcmcia_socket_dev_resume,
};
static struct platform_device sa11x0_pcmcia_device = {
.name = "sa11x0-pcmcia",
.id = 0,
.dev = {
.name = "Intel Corporation SA11x0 [PCMCIA]",
},
};
/* sa11x0_pcmcia_init()
* ^^^^^^^^^^^^^^^^^^^^
*
......@@ -129,16 +120,7 @@ static struct platform_device sa11x0_pcmcia_device = {
*/
static int __init sa11x0_pcmcia_init(void)
{
int ret;
ret = driver_register(&sa11x0_pcmcia_driver);
if (ret == 0) {
ret = platform_device_register(&sa11x0_pcmcia_device);
if (ret)
driver_unregister(&sa11x0_pcmcia_driver);
}
return ret;
return driver_register(&sa11x0_pcmcia_driver);
}
/* sa11x0_pcmcia_exit()
......@@ -148,7 +130,6 @@ static int __init sa11x0_pcmcia_init(void)
*/
static void __exit sa11x0_pcmcia_exit(void)
{
platform_device_unregister(&sa11x0_pcmcia_device);
driver_unregister(&sa11x0_pcmcia_driver);
}
......
This diff is collapsed.
......@@ -44,6 +44,8 @@ struct pcmcia_state {
* use when responding to a Card Services query of some kind.
*/
struct sa1100_pcmcia_socket {
struct pcmcia_socket socket;
/*
* Info from low level handler
*/
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -2189,11 +2189,11 @@ int uart_register_driver(struct uart_driver *drv)
void uart_unregister_driver(struct uart_driver *drv)
{
struct tty_driver *p = drv->tty_driver;
drv->tty_driver = NULL;
tty_unregister_driver(p);
kfree(drv->state);
kfree(drv->tty_driver->termios);
kfree(drv->tty_driver);
kfree(p->termios);
kfree(p);
drv->tty_driver = NULL;
}
struct tty_driver *uart_console_device(struct console *co, int *index)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -6,7 +6,7 @@
#define APIC_DFR_VALUE (APIC_DFR_CLUSTER)
#define TARGET_CPUS (0xf)
#define TARGET_CPUS (~0UL)
#define NO_BALANCE_IRQ (1)
#define esr_disable (1)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment