Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
This commit is contained in:
commit
7b0a65f992
2
CREDITS
2
CREDITS
|
@ -1097,7 +1097,7 @@ S: 80050-430 - Curitiba - Paran
|
|||
S: Brazil
|
||||
|
||||
N: Kumar Gala
|
||||
E: kumar.gala@freescale.com
|
||||
E: galak@kernel.crashing.org
|
||||
D: Embedded PowerPC 6xx/7xx/74xx/82xx/83xx/85xx support
|
||||
S: Austin, Texas 78729
|
||||
S: USA
|
||||
|
|
|
@ -20,6 +20,12 @@ DOCBOOKS := wanbook.xml z8530book.xml mcabook.xml videobook.xml \
|
|||
# +--> DIR=file (htmldocs)
|
||||
# +--> man/ (mandocs)
|
||||
|
||||
|
||||
# for PDF and PS output you can choose between xmlto and docbook-utils tools
|
||||
PDF_METHOD = $(prefer-db2x)
|
||||
PS_METHOD = $(prefer-db2x)
|
||||
|
||||
|
||||
###
|
||||
# The targets that may be used.
|
||||
.PHONY: xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs
|
||||
|
@ -93,27 +99,39 @@ C-procfs-example = procfs_example.xml
|
|||
C-procfs-example2 = $(addprefix $(obj)/,$(C-procfs-example))
|
||||
$(obj)/procfs-guide.xml: $(C-procfs-example2)
|
||||
|
||||
###
|
||||
# Rules to generate postscript, PDF and HTML
|
||||
# db2html creates a directory. Generate a html file used for timestamp
|
||||
notfoundtemplate = echo "*** You have to install docbook-utils or xmlto ***"; \
|
||||
exit 1
|
||||
db2xtemplate = db2TYPE -o $(dir $@) $<
|
||||
xmltotemplate = xmlto TYPE $(XMLTOFLAGS) -o $(dir $@) $<
|
||||
|
||||
quiet_cmd_db2ps = XMLTO $@
|
||||
cmd_db2ps = xmlto ps $(XMLTOFLAGS) -o $(dir $@) $<
|
||||
# determine which methods are available
|
||||
ifeq ($(shell which db2ps >/dev/null 2>&1 && echo found),found)
|
||||
use-db2x = db2x
|
||||
prefer-db2x = db2x
|
||||
else
|
||||
use-db2x = notfound
|
||||
prefer-db2x = $(use-xmlto)
|
||||
endif
|
||||
ifeq ($(shell which xmlto >/dev/null 2>&1 && echo found),found)
|
||||
use-xmlto = xmlto
|
||||
prefer-xmlto = xmlto
|
||||
else
|
||||
use-xmlto = notfound
|
||||
prefer-xmlto = $(use-db2x)
|
||||
endif
|
||||
|
||||
# the commands, generated from the chosen template
|
||||
quiet_cmd_db2ps = PS $@
|
||||
cmd_db2ps = $(subst TYPE,ps, $($(PS_METHOD)template))
|
||||
%.ps : %.xml
|
||||
@(which xmlto > /dev/null 2>&1) || \
|
||||
(echo "*** You need to install xmlto ***"; \
|
||||
exit 1)
|
||||
$(call cmd,db2ps)
|
||||
|
||||
quiet_cmd_db2pdf = XMLTO $@
|
||||
cmd_db2pdf = xmlto pdf $(XMLTOFLAGS) -o $(dir $@) $<
|
||||
quiet_cmd_db2pdf = PDF $@
|
||||
cmd_db2pdf = $(subst TYPE,pdf, $($(PDF_METHOD)template))
|
||||
%.pdf : %.xml
|
||||
@(which xmlto > /dev/null 2>&1) || \
|
||||
(echo "*** You need to install xmlto ***"; \
|
||||
exit 1)
|
||||
$(call cmd,db2pdf)
|
||||
|
||||
quiet_cmd_db2html = XMLTO $@
|
||||
quiet_cmd_db2html = HTML $@
|
||||
cmd_db2html = xmlto xhtml $(XMLTOFLAGS) -o $(patsubst %.html,%,$@) $< && \
|
||||
echo '<a HREF="$(patsubst %.html,%,$(notdir $@))/index.html"> \
|
||||
Goto $(patsubst %.html,%,$(notdir $@))</a><p>' > $@
|
||||
|
@ -127,7 +145,7 @@ quiet_cmd_db2html = XMLTO $@
|
|||
@if [ ! -z "$(PNG-$(basename $(notdir $@)))" ]; then \
|
||||
cp $(PNG-$(basename $(notdir $@))) $(patsubst %.html,%,$@); fi
|
||||
|
||||
quiet_cmd_db2man = XMLTO $@
|
||||
quiet_cmd_db2man = MAN $@
|
||||
cmd_db2man = if grep -q refentry $<; then xmlto man $(XMLTOFLAGS) -o $(obj)/man $< ; gzip -f $(obj)/man/*.9; fi
|
||||
%.9 : %.xml
|
||||
@(which xmlto > /dev/null 2>&1) || \
|
||||
|
|
|
@ -68,9 +68,7 @@ X!Iinclude/linux/kobject.h
|
|||
|
||||
<sect1><title>Kernel utility functions</title>
|
||||
!Iinclude/linux/kernel.h
|
||||
<!-- This needs to clean up to make kernel-doc happy
|
||||
X!Ekernel/printk.c
|
||||
-->
|
||||
!Ekernel/printk.c
|
||||
!Ekernel/panic.c
|
||||
!Ekernel/sys.c
|
||||
!Ekernel/rcupdate.c
|
||||
|
|
|
@ -3,4 +3,5 @@
|
|||
<param name="chunk.quietly">1</param>
|
||||
<param name="funcsynopsis.style">ansi</param>
|
||||
<param name="funcsynopsis.tabular.threshold">80</param>
|
||||
<!-- <param name="paper.type">A4</param> -->
|
||||
</stylesheet>
|
||||
|
|
|
@ -115,6 +115,33 @@ boolean is return which indicates whether the resulting counter value
|
|||
is negative. It requires explicit memory barrier semantics around the
|
||||
operation.
|
||||
|
||||
Then:
|
||||
|
||||
int atomic_cmpxchg(atomic_t *v, int old, int new);
|
||||
|
||||
This performs an atomic compare exchange operation on the atomic value v,
|
||||
with the given old and new values. Like all atomic_xxx operations,
|
||||
atomic_cmpxchg will only satisfy its atomicity semantics as long as all
|
||||
other accesses of *v are performed through atomic_xxx operations.
|
||||
|
||||
atomic_cmpxchg requires explicit memory barriers around the operation.
|
||||
|
||||
The semantics for atomic_cmpxchg are the same as those defined for 'cas'
|
||||
below.
|
||||
|
||||
Finally:
|
||||
|
||||
int atomic_add_unless(atomic_t *v, int a, int u);
|
||||
|
||||
If the atomic value v is not equal to u, this function adds a to v, and
|
||||
returns non zero. If v is equal to u then it returns zero. This is done as
|
||||
an atomic operation.
|
||||
|
||||
atomic_add_unless requires explicit memory barriers around the operation.
|
||||
|
||||
atomic_inc_not_zero, equivalent to atomic_add_unless(v, 1, 0)
|
||||
|
||||
|
||||
If a caller requires memory barrier semantics around an atomic_t
|
||||
operation which does not return a value, a set of interfaces are
|
||||
defined which accomplish this:
|
||||
|
|
|
@ -30,7 +30,9 @@ the disk is not available then you have three options :-
|
|||
|
||||
(1) Hand copy the text from the screen and type it in after the machine
|
||||
has restarted. Messy but it is the only option if you have not
|
||||
planned for a crash.
|
||||
planned for a crash. Alternatively, you can take a picture of
|
||||
the screen with a digital camera - not nice, but better than
|
||||
nothing.
|
||||
|
||||
(2) Boot with a serial console (see Documentation/serial-console.txt),
|
||||
run a null modem to a second machine and capture the output there
|
||||
|
|
|
@ -140,3 +140,4 @@
|
|||
139 -> Prolink PixelView PlayTV MPEG2 PV-M4900
|
||||
140 -> Osprey 440 [0070:ff07]
|
||||
141 -> Asound Skyeye PCTV
|
||||
142 -> Sabrent TV-FM (bttv version)
|
||||
|
|
|
@ -80,3 +80,5 @@
|
|||
79 -> Sedna/MuchTV PC TV Cardbus TV/Radio (ITO25 Rev:2B)
|
||||
80 -> ASUS Digimatrix TV [1043:0210]
|
||||
81 -> Philips Tiger reference design [1131:2018]
|
||||
82 -> MSI TV@Anywhere plus [1462:6231]
|
||||
|
||||
|
|
|
@ -67,3 +67,4 @@ tuner=65 - Ymec TVF66T5-B/DFF
|
|||
tuner=66 - LG NTSC (TALN mini series)
|
||||
tuner=67 - Philips TD1316 Hybrid Tuner
|
||||
tuner=68 - Philips TUV1236D ATSC/NTSC dual in
|
||||
tuner=69 - Tena TNF 5335 MF
|
||||
|
|
12
MAINTAINERS
12
MAINTAINERS
|
@ -1565,7 +1565,7 @@ S: Maintained
|
|||
|
||||
LINUX FOR POWERPC EMBEDDED PPC83XX AND PPC85XX
|
||||
P: Kumar Gala
|
||||
M: kumar.gala@freescale.com
|
||||
M: galak@kernel.crashing.org
|
||||
W: http://www.penguinppc.org/
|
||||
L: linuxppc-embedded@ozlabs.org
|
||||
S: Maintained
|
||||
|
@ -1873,6 +1873,16 @@ L: linux-tr@linuxtr.net
|
|||
W: http://www.linuxtr.net
|
||||
S: Maintained
|
||||
|
||||
OMNIKEY CARDMAN 4000 DRIVER
|
||||
P: Harald Welte
|
||||
M: laforge@gnumonks.org
|
||||
S: Maintained
|
||||
|
||||
OMNIKEY CARDMAN 4040 DRIVER
|
||||
P: Harald Welte
|
||||
M: laforge@gnumonks.org
|
||||
S: Maintained
|
||||
|
||||
ONSTREAM SCSI TAPE DRIVER
|
||||
P: Willem Riede
|
||||
M: osst@riede.org
|
||||
|
|
13
Makefile
13
Makefile
|
@ -1193,6 +1193,17 @@ else
|
|||
__srctree = $(srctree)/
|
||||
endif
|
||||
|
||||
ifeq ($(ALLSOURCE_ARCHS),)
|
||||
ifeq ($(ARCH),um)
|
||||
ALLINCLUDE_ARCHS := $(ARCH) $(SUBARCH)
|
||||
else
|
||||
ALLINCLUDE_ARCHS := $(ARCH)
|
||||
endif
|
||||
else
|
||||
#Allow user to specify only ALLSOURCE_PATHS on the command line, keeping existing behaviour.
|
||||
ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS)
|
||||
endif
|
||||
|
||||
ALLSOURCE_ARCHS := $(ARCH)
|
||||
|
||||
define all-sources
|
||||
|
@ -1208,7 +1219,7 @@ define all-sources
|
|||
find $(__srctree)include $(RCS_FIND_IGNORE) \
|
||||
\( -name config -o -name 'asm-*' \) -prune \
|
||||
-o -name '*.[chS]' -print; \
|
||||
for ARCH in $(ALLSOURCE_ARCHS) ; do \
|
||||
for ARCH in $(ALLINCLUDE_ARCHS) ; do \
|
||||
find $(__srctree)include/asm-$${ARCH} $(RCS_FIND_IGNORE) \
|
||||
-name '*.[chS]' -print; \
|
||||
done ; \
|
||||
|
|
5
README
5
README
|
@ -81,6 +81,11 @@ INSTALLING the kernel:
|
|||
failed patches (xxx# or xxx.rej). If there are, either you or me has
|
||||
made a mistake.
|
||||
|
||||
Unlike patches for the 2.6.x kernels, patches for the 2.6.x.y kernels
|
||||
(also known as the -stable kernels) are not incremental but instead apply
|
||||
directly to the base 2.6.x kernel. Please read
|
||||
Documentation/applying-patches.txt for more information.
|
||||
|
||||
Alternatively, the script patch-kernel can be used to automate this
|
||||
process. It determines the current kernel version and applies any
|
||||
patches found.
|
||||
|
|
|
@ -702,6 +702,8 @@ menu "Device Drivers"
|
|||
|
||||
source "drivers/base/Kconfig"
|
||||
|
||||
source "drivers/connector/Kconfig"
|
||||
|
||||
if ALIGNMENT_TRAP
|
||||
source "drivers/mtd/Kconfig"
|
||||
endif
|
||||
|
|
|
@ -623,8 +623,6 @@ static int locomo_resume(struct platform_device *dev)
|
|||
locomo_writel(0x1, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KCMD);
|
||||
|
||||
spin_unlock_irqrestore(&lchip->lock, flags);
|
||||
|
||||
dev->power.saved_state = NULL;
|
||||
kfree(save);
|
||||
|
||||
return 0;
|
||||
|
@ -775,7 +773,7 @@ static int locomo_probe(struct platform_device *dev)
|
|||
|
||||
static int locomo_remove(struct platform_device *dev)
|
||||
{
|
||||
struct locomo *lchip = platform__get_drvdata(dev);
|
||||
struct locomo *lchip = platform_get_drvdata(dev);
|
||||
|
||||
if (lchip) {
|
||||
__locomo_remove(lchip);
|
||||
|
|
|
@ -153,7 +153,7 @@ int __init scoop_probe(struct platform_device *pdev)
|
|||
printk("Sharp Scoop Device found at 0x%08x -> 0x%08x\n",(unsigned int)mem->start,(unsigned int)devptr->base);
|
||||
|
||||
SCOOP_REG(devptr->base, SCOOP_MCR) = 0x0140;
|
||||
reset_scoop(dev);
|
||||
reset_scoop(&pdev->dev);
|
||||
SCOOP_REG(devptr->base, SCOOP_GPCR) = inf->io_dir & 0xffff;
|
||||
SCOOP_REG(devptr->base, SCOOP_GPWR) = inf->io_out & 0xffff;
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <linux/apm_bios.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/pm_legacy.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/list.h>
|
||||
|
|
|
@ -256,9 +256,7 @@ void __cpuexit cpu_die(void)
|
|||
asmlinkage void __cpuinit secondary_start_kernel(void)
|
||||
{
|
||||
struct mm_struct *mm = &init_mm;
|
||||
unsigned int cpu;
|
||||
|
||||
cpu = smp_processor_id();
|
||||
unsigned int cpu = smp_processor_id();
|
||||
|
||||
printk("CPU%u: Booted secondary processor\n", cpu);
|
||||
|
||||
|
|
|
@ -132,14 +132,14 @@ void __init footbridge_init_irq(void)
|
|||
static struct map_desc fb_common_io_desc[] __initdata = {
|
||||
{
|
||||
.virtual = ARMCSR_BASE,
|
||||
.pfn = DC21285_ARMCSR_BASE,
|
||||
.pfn = __phys_to_pfn(DC21285_ARMCSR_BASE),
|
||||
.length = ARMCSR_SIZE,
|
||||
.type = MT_DEVICE
|
||||
.type = MT_DEVICE,
|
||||
}, {
|
||||
.virtual = XBUS_BASE,
|
||||
.pfn = __phys_to_pfn(0x40000000),
|
||||
.length = XBUS_SIZE,
|
||||
.type = MT_DEVICE
|
||||
.type = MT_DEVICE,
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -153,28 +153,28 @@ static struct map_desc ebsa285_host_io_desc[] __initdata = {
|
|||
.virtual = PCIMEM_BASE,
|
||||
.pfn = __phys_to_pfn(DC21285_PCI_MEM),
|
||||
.length = PCIMEM_SIZE,
|
||||
.type = MT_DEVICE
|
||||
.type = MT_DEVICE,
|
||||
}, {
|
||||
.virtual = PCICFG0_BASE,
|
||||
.pfn = __phys_to_pfn(DC21285_PCI_TYPE_0_CONFIG),
|
||||
.length = PCICFG0_SIZE,
|
||||
.type = MT_DEVICE
|
||||
.type = MT_DEVICE,
|
||||
}, {
|
||||
.virtual = PCICFG1_BASE,
|
||||
.pfn = __phys_to_pfn(DC21285_PCI_TYPE_1_CONFIG),
|
||||
.length = PCICFG1_SIZE,
|
||||
.type = MT_DEVICE
|
||||
.type = MT_DEVICE,
|
||||
}, {
|
||||
.virtual = PCIIACK_BASE,
|
||||
.pfn = __phys_to_pfn(DC21285_PCI_IACK),
|
||||
.length = PCIIACK_SIZE,
|
||||
.type = MT_DEVICE
|
||||
.type = MT_DEVICE,
|
||||
}, {
|
||||
.virtual = PCIO_BASE,
|
||||
.pfn = __phys_to_pfn(DC21285_PCI_IO),
|
||||
.length = PCIO_SIZE,
|
||||
.type = MT_DEVICE
|
||||
}
|
||||
.type = MT_DEVICE,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -187,13 +187,13 @@ static struct map_desc co285_io_desc[] __initdata = {
|
|||
.virtual = PCIO_BASE,
|
||||
.pfn = __phys_to_pfn(DC21285_PCI_IO),
|
||||
.length = PCIO_SIZE,
|
||||
.type = MT_DEVICE
|
||||
.type = MT_DEVICE,
|
||||
}, {
|
||||
.virtual = PCIMEM_BASE,
|
||||
.pfn = __phys_to_pfn(DC21285_PCI_MEM),
|
||||
.length = PCIMEM_SIZE,
|
||||
.type = MT_DEVICE
|
||||
}
|
||||
.type = MT_DEVICE,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -72,6 +72,12 @@ config MACH_HUSKY
|
|||
depends PXA_SHARPSL_25x
|
||||
select PXA_SHARP_C7xx
|
||||
|
||||
config MACH_AKITA
|
||||
bool "Enable Sharp SL-1000 (Akita) Support"
|
||||
depends PXA_SHARPSL_27x
|
||||
select PXA_SHARP_Cxx00
|
||||
select MACH_SPITZ
|
||||
|
||||
config MACH_SPITZ
|
||||
bool "Enable Sharp Zaurus SL-3000 (Spitz) Support"
|
||||
depends PXA_SHARPSL_27x
|
||||
|
|
|
@ -11,8 +11,9 @@ obj-$(CONFIG_PXA27x) += pxa27x.o
|
|||
obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o
|
||||
obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o
|
||||
obj-$(CONFIG_ARCH_PXA_IDP) += idp.o
|
||||
obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o corgi_ssp.o corgi_lcd.o
|
||||
obj-$(CONFIG_PXA_SHARP_Cxx00) += spitz.o corgi_ssp.o corgi_lcd.o
|
||||
obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o corgi_pm.o
|
||||
obj-$(CONFIG_PXA_SHARP_Cxx00) += spitz.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o spitz_pm.o
|
||||
obj-$(CONFIG_MACH_AKITA) += akita-ioexp.o
|
||||
obj-$(CONFIG_MACH_POODLE) += poodle.o
|
||||
obj-$(CONFIG_MACH_TOSA) += tosa.o
|
||||
|
||||
|
|
223
arch/arm/mach-pxa/akita-ioexp.c
Normal file
223
arch/arm/mach-pxa/akita-ioexp.c
Normal file
|
@ -0,0 +1,223 @@
|
|||
/*
|
||||
* Support for the Extra GPIOs on the Sharp SL-C1000 (Akita)
|
||||
* (uses a Maxim MAX7310 8 Port IO Expander)
|
||||
*
|
||||
* Copyright 2005 Openedhand Ltd.
|
||||
*
|
||||
* Author: Richard Purdie <richard@openedhand.com>
|
||||
*
|
||||
* 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/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <asm/arch/akita.h>
|
||||
|
||||
/* MAX7310 Regiser Map */
|
||||
#define MAX7310_INPUT 0x00
|
||||
#define MAX7310_OUTPUT 0x01
|
||||
#define MAX7310_POLINV 0x02
|
||||
#define MAX7310_IODIR 0x03 /* 1 = Input, 0 = Output */
|
||||
#define MAX7310_TIMEOUT 0x04
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { 0x18, I2C_CLIENT_END };
|
||||
|
||||
/* I2C Magic */
|
||||
I2C_CLIENT_INSMOD;
|
||||
|
||||
static int max7310_write(struct i2c_client *client, int address, int data);
|
||||
static struct i2c_client max7310_template;
|
||||
static void akita_ioexp_work(void *private_);
|
||||
|
||||
static struct device *akita_ioexp_device;
|
||||
static unsigned char ioexp_output_value = AKITA_IOEXP_IO_OUT;
|
||||
DECLARE_WORK(akita_ioexp, akita_ioexp_work, NULL);
|
||||
|
||||
|
||||
/*
|
||||
* MAX7310 Access
|
||||
*/
|
||||
static int max7310_config(struct device *dev, int iomode, int polarity)
|
||||
{
|
||||
int ret;
|
||||
struct i2c_client *client = to_i2c_client(dev);
|
||||
|
||||
ret = max7310_write(client, MAX7310_POLINV, polarity);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = max7310_write(client, MAX7310_IODIR, iomode);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int max7310_set_ouputs(struct device *dev, int outputs)
|
||||
{
|
||||
struct i2c_client *client = to_i2c_client(dev);
|
||||
|
||||
return max7310_write(client, MAX7310_OUTPUT, outputs);
|
||||
}
|
||||
|
||||
/*
|
||||
* I2C Functions
|
||||
*/
|
||||
static int max7310_write(struct i2c_client *client, int address, int value)
|
||||
{
|
||||
u8 data[2];
|
||||
|
||||
data[0] = address & 0xff;
|
||||
data[1] = value & 0xff;
|
||||
|
||||
if (i2c_master_send(client, data, 2) == 2)
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int max7310_detect(struct i2c_adapter *adapter, int address, int kind)
|
||||
{
|
||||
struct i2c_client *new_client;
|
||||
int err;
|
||||
|
||||
if (!(new_client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL)))
|
||||
return -ENOMEM;
|
||||
|
||||
max7310_template.adapter = adapter;
|
||||
max7310_template.addr = address;
|
||||
|
||||
memcpy(new_client, &max7310_template, sizeof(struct i2c_client));
|
||||
|
||||
if ((err = i2c_attach_client(new_client))) {
|
||||
kfree(new_client);
|
||||
return err;
|
||||
}
|
||||
|
||||
max7310_config(&new_client->dev, AKITA_IOEXP_IO_DIR, 0);
|
||||
akita_ioexp_device = &new_client->dev;
|
||||
schedule_work(&akita_ioexp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int max7310_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_probe(adapter, &addr_data, max7310_detect);
|
||||
}
|
||||
|
||||
static int max7310_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
akita_ioexp_device = NULL;
|
||||
|
||||
if ((err = i2c_detach_client(client)))
|
||||
return err;
|
||||
|
||||
kfree(client);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct i2c_driver max7310_i2c_driver = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "akita-max7310",
|
||||
.id = I2C_DRIVERID_AKITAIOEXP,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = max7310_attach_adapter,
|
||||
.detach_client = max7310_detach_client,
|
||||
};
|
||||
|
||||
static struct i2c_client max7310_template = {
|
||||
name: "akita-max7310",
|
||||
flags: I2C_CLIENT_ALLOW_USE,
|
||||
driver: &max7310_i2c_driver,
|
||||
};
|
||||
|
||||
void akita_set_ioexp(struct device *dev, unsigned char bit)
|
||||
{
|
||||
ioexp_output_value |= bit;
|
||||
|
||||
if (akita_ioexp_device)
|
||||
schedule_work(&akita_ioexp);
|
||||
return;
|
||||
}
|
||||
|
||||
void akita_reset_ioexp(struct device *dev, unsigned char bit)
|
||||
{
|
||||
ioexp_output_value &= ~bit;
|
||||
|
||||
if (akita_ioexp_device)
|
||||
schedule_work(&akita_ioexp);
|
||||
return;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(akita_set_ioexp);
|
||||
EXPORT_SYMBOL(akita_reset_ioexp);
|
||||
|
||||
static void akita_ioexp_work(void *private_)
|
||||
{
|
||||
if (akita_ioexp_device)
|
||||
max7310_set_ouputs(akita_ioexp_device, ioexp_output_value);
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int akita_ioexp_suspend(struct platform_device *pdev, pm_message_t state)
|
||||
{
|
||||
flush_scheduled_work();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int akita_ioexp_resume(struct platform_device *pdev)
|
||||
{
|
||||
schedule_work(&akita_ioexp);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#define akita_ioexp_suspend NULL
|
||||
#define akita_ioexp_resume NULL
|
||||
#endif
|
||||
|
||||
static int __init akita_ioexp_probe(struct platform_device *pdev)
|
||||
{
|
||||
return i2c_add_driver(&max7310_i2c_driver);
|
||||
}
|
||||
|
||||
static int akita_ioexp_remove(struct platform_device *pdev)
|
||||
{
|
||||
i2c_del_driver(&max7310_i2c_driver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver akita_ioexp_driver = {
|
||||
.probe = akita_ioexp_probe,
|
||||
.remove = akita_ioexp_remove,
|
||||
.suspend = akita_ioexp_suspend,
|
||||
.resume = akita_ioexp_resume,
|
||||
.driver = {
|
||||
.name = "akita-ioexp",
|
||||
},
|
||||
};
|
||||
|
||||
static int __init akita_ioexp_init(void)
|
||||
{
|
||||
return platform_driver_register(&akita_ioexp_driver);
|
||||
}
|
||||
|
||||
static void __exit akita_ioexp_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&akita_ioexp_driver);
|
||||
}
|
||||
|
||||
MODULE_AUTHOR("Richard Purdie <rpurdie@openedhand.com>");
|
||||
MODULE_DESCRIPTION("Akita IO-Expander driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
fs_initcall(akita_ioexp_init);
|
||||
module_exit(akita_ioexp_exit);
|
||||
|
228
arch/arm/mach-pxa/corgi_pm.c
Normal file
228
arch/arm/mach-pxa/corgi_pm.c
Normal file
|
@ -0,0 +1,228 @@
|
|||
/*
|
||||
* Battery and Power Management code for the Sharp SL-C7xx
|
||||
*
|
||||
* Copyright (c) 2005 Richard Purdie
|
||||
*
|
||||
* 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/module.h>
|
||||
#include <linux/stat.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <asm/apm.h>
|
||||
#include <asm/irq.h>
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/hardware.h>
|
||||
#include <asm/hardware/scoop.h>
|
||||
|
||||
#include <asm/arch/sharpsl.h>
|
||||
#include <asm/arch/corgi.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include "sharpsl.h"
|
||||
|
||||
static void corgi_charger_init(void)
|
||||
{
|
||||
pxa_gpio_mode(CORGI_GPIO_ADC_TEMP_ON | GPIO_OUT);
|
||||
pxa_gpio_mode(CORGI_GPIO_CHRG_ON | GPIO_OUT);
|
||||
pxa_gpio_mode(CORGI_GPIO_CHRG_UKN | GPIO_OUT);
|
||||
pxa_gpio_mode(CORGI_GPIO_KEY_INT | GPIO_IN);
|
||||
}
|
||||
|
||||
static void corgi_charge_led(int val)
|
||||
{
|
||||
if (val == SHARPSL_LED_ERROR) {
|
||||
dev_dbg(sharpsl_pm.dev, "Charge LED Error\n");
|
||||
} else if (val == SHARPSL_LED_ON) {
|
||||
dev_dbg(sharpsl_pm.dev, "Charge LED On\n");
|
||||
GPSR0 = GPIO_bit(CORGI_GPIO_LED_ORANGE);
|
||||
} else {
|
||||
dev_dbg(sharpsl_pm.dev, "Charge LED Off\n");
|
||||
GPCR0 = GPIO_bit(CORGI_GPIO_LED_ORANGE);
|
||||
}
|
||||
}
|
||||
|
||||
static void corgi_measure_temp(int on)
|
||||
{
|
||||
if (on)
|
||||
GPSR(CORGI_GPIO_ADC_TEMP_ON) = GPIO_bit(CORGI_GPIO_ADC_TEMP_ON);
|
||||
else
|
||||
GPCR(CORGI_GPIO_ADC_TEMP_ON) = GPIO_bit(CORGI_GPIO_ADC_TEMP_ON);
|
||||
}
|
||||
|
||||
static void corgi_charge(int on)
|
||||
{
|
||||
if (on) {
|
||||
if (machine_is_corgi() && (sharpsl_pm.flags & SHARPSL_SUSPENDED)) {
|
||||
GPCR(CORGI_GPIO_CHRG_ON) = GPIO_bit(CORGI_GPIO_CHRG_ON);
|
||||
GPSR(CORGI_GPIO_CHRG_UKN) = GPIO_bit(CORGI_GPIO_CHRG_UKN);
|
||||
} else {
|
||||
GPSR(CORGI_GPIO_CHRG_ON) = GPIO_bit(CORGI_GPIO_CHRG_ON);
|
||||
GPCR(CORGI_GPIO_CHRG_UKN) = GPIO_bit(CORGI_GPIO_CHRG_UKN);
|
||||
}
|
||||
} else {
|
||||
GPCR(CORGI_GPIO_CHRG_ON) = GPIO_bit(CORGI_GPIO_CHRG_ON);
|
||||
GPCR(CORGI_GPIO_CHRG_UKN) = GPIO_bit(CORGI_GPIO_CHRG_UKN);
|
||||
}
|
||||
}
|
||||
|
||||
static void corgi_discharge(int on)
|
||||
{
|
||||
if (on)
|
||||
GPSR(CORGI_GPIO_DISCHARGE_ON) = GPIO_bit(CORGI_GPIO_DISCHARGE_ON);
|
||||
else
|
||||
GPCR(CORGI_GPIO_DISCHARGE_ON) = GPIO_bit(CORGI_GPIO_DISCHARGE_ON);
|
||||
}
|
||||
|
||||
static void corgi_presuspend(void)
|
||||
{
|
||||
int i;
|
||||
unsigned long wakeup_mask;
|
||||
|
||||
/* charging , so CHARGE_ON bit is HIGH during OFF. */
|
||||
if (READ_GPIO_BIT(CORGI_GPIO_CHRG_ON))
|
||||
PGSR1 |= GPIO_bit(CORGI_GPIO_CHRG_ON);
|
||||
else
|
||||
PGSR1 &= ~GPIO_bit(CORGI_GPIO_CHRG_ON);
|
||||
|
||||
if (READ_GPIO_BIT(CORGI_GPIO_LED_ORANGE))
|
||||
PGSR0 |= GPIO_bit(CORGI_GPIO_LED_ORANGE);
|
||||
else
|
||||
PGSR0 &= ~GPIO_bit(CORGI_GPIO_LED_ORANGE);
|
||||
|
||||
if (READ_GPIO_BIT(CORGI_GPIO_CHRG_UKN))
|
||||
PGSR1 |= GPIO_bit(CORGI_GPIO_CHRG_UKN);
|
||||
else
|
||||
PGSR1 &= ~GPIO_bit(CORGI_GPIO_CHRG_UKN);
|
||||
|
||||
/* Resume on keyboard power key */
|
||||
PGSR2 = (PGSR2 & ~CORGI_GPIO_ALL_STROBE_BIT) | CORGI_GPIO_STROBE_BIT(0);
|
||||
|
||||
wakeup_mask = GPIO_bit(CORGI_GPIO_KEY_INT) | GPIO_bit(CORGI_GPIO_WAKEUP) | GPIO_bit(CORGI_GPIO_AC_IN) | GPIO_bit(CORGI_GPIO_CHRG_FULL);
|
||||
|
||||
if (!machine_is_corgi())
|
||||
wakeup_mask |= GPIO_bit(CORGI_GPIO_MAIN_BAT_LOW);
|
||||
|
||||
PWER = wakeup_mask | PWER_RTC;
|
||||
PRER = wakeup_mask;
|
||||
PFER = wakeup_mask;
|
||||
|
||||
for (i = 0; i <=15; i++) {
|
||||
if (PRER & PFER & GPIO_bit(i)) {
|
||||
if (GPLR0 & GPIO_bit(i) )
|
||||
PRER &= ~GPIO_bit(i);
|
||||
else
|
||||
PFER &= ~GPIO_bit(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void corgi_postsuspend(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Check what brought us out of the suspend.
|
||||
* Return: 0 to sleep, otherwise wake
|
||||
*/
|
||||
static int corgi_should_wakeup(unsigned int resume_on_alarm)
|
||||
{
|
||||
int is_resume = 0;
|
||||
|
||||
dev_dbg(sharpsl_pm.dev, "GPLR0 = %x,%x\n", GPLR0, PEDR);
|
||||
|
||||
if ((PEDR & GPIO_bit(CORGI_GPIO_AC_IN))) {
|
||||
if (STATUS_AC_IN()) {
|
||||
/* charge on */
|
||||
dev_dbg(sharpsl_pm.dev, "ac insert\n");
|
||||
sharpsl_pm.flags |= SHARPSL_DO_OFFLINE_CHRG;
|
||||
} else {
|
||||
/* charge off */
|
||||
dev_dbg(sharpsl_pm.dev, "ac remove\n");
|
||||
CHARGE_LED_OFF();
|
||||
CHARGE_OFF();
|
||||
sharpsl_pm.charge_mode = CHRG_OFF;
|
||||
}
|
||||
}
|
||||
|
||||
if ((PEDR & GPIO_bit(CORGI_GPIO_CHRG_FULL)))
|
||||
dev_dbg(sharpsl_pm.dev, "Charge full interrupt\n");
|
||||
|
||||
if (PEDR & GPIO_bit(CORGI_GPIO_KEY_INT))
|
||||
is_resume |= GPIO_bit(CORGI_GPIO_KEY_INT);
|
||||
|
||||
if (PEDR & GPIO_bit(CORGI_GPIO_WAKEUP))
|
||||
is_resume |= GPIO_bit(CORGI_GPIO_WAKEUP);
|
||||
|
||||
if (resume_on_alarm && (PEDR & PWER_RTC))
|
||||
is_resume |= PWER_RTC;
|
||||
|
||||
dev_dbg(sharpsl_pm.dev, "is_resume: %x\n",is_resume);
|
||||
return is_resume;
|
||||
}
|
||||
|
||||
static unsigned long corgi_charger_wakeup(void)
|
||||
{
|
||||
return ~GPLR0 & ( GPIO_bit(CORGI_GPIO_AC_IN) | GPIO_bit(CORGI_GPIO_KEY_INT) | GPIO_bit(CORGI_GPIO_WAKEUP) );
|
||||
}
|
||||
|
||||
static int corgi_acin_status(void)
|
||||
{
|
||||
return ((GPLR(CORGI_GPIO_AC_IN) & GPIO_bit(CORGI_GPIO_AC_IN)) != 0);
|
||||
}
|
||||
|
||||
static struct sharpsl_charger_machinfo corgi_pm_machinfo = {
|
||||
.init = corgi_charger_init,
|
||||
.gpio_batlock = CORGI_GPIO_BAT_COVER,
|
||||
.gpio_acin = CORGI_GPIO_AC_IN,
|
||||
.gpio_batfull = CORGI_GPIO_CHRG_FULL,
|
||||
.status_acin = corgi_acin_status,
|
||||
.discharge = corgi_discharge,
|
||||
.charge = corgi_charge,
|
||||
.chargeled = corgi_charge_led,
|
||||
.measure_temp = corgi_measure_temp,
|
||||
.presuspend = corgi_presuspend,
|
||||
.postsuspend = corgi_postsuspend,
|
||||
.charger_wakeup = corgi_charger_wakeup,
|
||||
.should_wakeup = corgi_should_wakeup,
|
||||
.bat_levels = 40,
|
||||
.bat_levels_noac = spitz_battery_levels_noac,
|
||||
.bat_levels_acin = spitz_battery_levels_acin,
|
||||
.status_high_acin = 188,
|
||||
.status_low_acin = 178,
|
||||
.status_high_noac = 185,
|
||||
.status_low_noac = 175,
|
||||
};
|
||||
|
||||
static struct platform_device *corgipm_device;
|
||||
|
||||
static int __devinit corgipm_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
corgipm_device = platform_device_alloc("sharpsl-pm", -1);
|
||||
if (!corgipm_device)
|
||||
return -ENOMEM;
|
||||
|
||||
corgipm_device->dev.platform_data = &corgi_pm_machinfo;
|
||||
ret = platform_device_add(corgipm_device);
|
||||
|
||||
if (ret)
|
||||
platform_device_put(corgipm_device);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void corgipm_exit(void)
|
||||
{
|
||||
platform_device_unregister(corgipm_device);
|
||||
}
|
||||
|
||||
module_init(corgipm_init);
|
||||
module_exit(corgipm_exit);
|
|
@ -115,7 +115,7 @@ extern struct battery_thresh spitz_battery_levels_noac[];
|
|||
#define CHARGE_LED_ERR() sharpsl_pm.machinfo->chargeled(SHARPSL_LED_ERROR)
|
||||
#define DISCHARGE_ON() sharpsl_pm.machinfo->discharge(1)
|
||||
#define DISCHARGE_OFF() sharpsl_pm.machinfo->discharge(0)
|
||||
#define STATUS_AC_IN sharpsl_pm.machinfo->status_acin()
|
||||
#define STATUS_BATT_LOCKED READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batlock)
|
||||
#define STATUS_CHRG_FULL READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batfull)
|
||||
#define STATUS_FATAL READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_fatal)
|
||||
#define STATUS_AC_IN() sharpsl_pm.machinfo->status_acin()
|
||||
#define STATUS_BATT_LOCKED() READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batlock)
|
||||
#define STATUS_CHRG_FULL() READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batfull)
|
||||
#define STATUS_FATAL() READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_fatal)
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <linux/apm_bios.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include <asm/hardware.h>
|
||||
#include <asm/hardware/scoop.h>
|
||||
|
@ -45,15 +45,15 @@
|
|||
#define SHARPSL_WAIT_DISCHARGE_ON 100 /* 100 msec */
|
||||
#define SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP 10 /* 10 msec */
|
||||
#define SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT 10 /* 10 msec */
|
||||
#define SHARPSL_CHECK_BATTERY_WAIT_TIME_JKVAD 10 /* 10 msec */
|
||||
#define SHARPSL_CHECK_BATTERY_WAIT_TIME_ACIN 10 /* 10 msec */
|
||||
#define SHARPSL_CHARGE_WAIT_TIME 15 /* 15 msec */
|
||||
#define SHARPSL_CHARGE_CO_CHECK_TIME 5 /* 5 msec */
|
||||
#define SHARPSL_CHARGE_RETRY_CNT 1 /* eqv. 10 min */
|
||||
|
||||
#define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */
|
||||
#define SHARPSL_CHARGE_ON_TEMP 0xe0 /* 2.9V */
|
||||
#define SHARPSL_CHARGE_ON_JKVAD_HIGH 0x9b /* 6V */
|
||||
#define SHARPSL_CHARGE_ON_JKVAD_LOW 0x34 /* 2V */
|
||||
#define SHARPSL_CHARGE_ON_ACIN_HIGH 0x9b /* 6V */
|
||||
#define SHARPSL_CHARGE_ON_ACIN_LOW 0x34 /* 2V */
|
||||
#define SHARPSL_FATAL_ACIN_VOLT 182 /* 3.45V */
|
||||
#define SHARPSL_FATAL_NOACIN_VOLT 170 /* 3.40V */
|
||||
|
||||
|
@ -160,9 +160,10 @@ struct battery_thresh spitz_battery_levels_noac[] = {
|
|||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
static int sharpsl_read_MainBattery(void);
|
||||
static int sharpsl_read_main_battery(void);
|
||||
static int sharpsl_off_charge_battery(void);
|
||||
static int sharpsl_check_battery(int mode);
|
||||
static int sharpsl_check_battery_temp(void);
|
||||
static int sharpsl_check_battery_voltage(void);
|
||||
static int sharpsl_ac_check(void);
|
||||
static int sharpsl_fatal_check(void);
|
||||
static int sharpsl_average_value(int ad);
|
||||
|
@ -228,7 +229,7 @@ static void sharpsl_battery_thread(void *private_)
|
|||
if (!sharpsl_pm.machinfo)
|
||||
return;
|
||||
|
||||
sharpsl_pm.battstat.ac_status = (!(STATUS_AC_IN) ? APM_AC_OFFLINE : APM_AC_ONLINE);
|
||||
sharpsl_pm.battstat.ac_status = (STATUS_AC_IN() ? APM_AC_ONLINE : APM_AC_OFFLINE);
|
||||
|
||||
/* Corgi cannot confirm when battery fully charged so periodically kick! */
|
||||
if (machine_is_corgi() && (sharpsl_pm.charge_mode == CHRG_ON)
|
||||
|
@ -236,7 +237,7 @@ static void sharpsl_battery_thread(void *private_)
|
|||
schedule_work(&toggle_charger);
|
||||
|
||||
while(1) {
|
||||
voltage = sharpsl_read_MainBattery();
|
||||
voltage = sharpsl_read_main_battery();
|
||||
if (voltage > 0) break;
|
||||
if (i++ > 5) {
|
||||
voltage = sharpsl_pm.machinfo->bat_levels_noac[0].voltage;
|
||||
|
@ -317,10 +318,10 @@ static void sharpsl_charge_toggle(void *private_)
|
|||
{
|
||||
dev_dbg(sharpsl_pm.dev, "Toogling Charger at time: %lx\n", jiffies);
|
||||
|
||||
if (STATUS_AC_IN == 0) {
|
||||
if (STATUS_AC_IN() == 0) {
|
||||
sharpsl_charge_off();
|
||||
return;
|
||||
} else if ((sharpsl_check_battery(1) < 0) || (sharpsl_ac_check() < 0)) {
|
||||
} else if ((sharpsl_check_battery_temp() < 0) || (sharpsl_ac_check() < 0)) {
|
||||
sharpsl_charge_error();
|
||||
return;
|
||||
}
|
||||
|
@ -335,7 +336,7 @@ static void sharpsl_charge_toggle(void *private_)
|
|||
|
||||
static void sharpsl_ac_timer(unsigned long data)
|
||||
{
|
||||
int acin = STATUS_AC_IN;
|
||||
int acin = STATUS_AC_IN();
|
||||
|
||||
dev_dbg(sharpsl_pm.dev, "AC Status: %d\n",acin);
|
||||
|
||||
|
@ -364,7 +365,7 @@ static void sharpsl_chrg_full_timer(unsigned long data)
|
|||
|
||||
sharpsl_pm.full_count++;
|
||||
|
||||
if (STATUS_AC_IN == 0) {
|
||||
if (STATUS_AC_IN() == 0) {
|
||||
dev_dbg(sharpsl_pm.dev, "Charge Full: AC removed - stop charging!\n");
|
||||
if (sharpsl_pm.charge_mode == CHRG_ON)
|
||||
sharpsl_charge_off();
|
||||
|
@ -399,12 +400,12 @@ static irqreturn_t sharpsl_fatal_isr(int irq, void *dev_id, struct pt_regs *fp)
|
|||
{
|
||||
int is_fatal = 0;
|
||||
|
||||
if (STATUS_BATT_LOCKED == 0) {
|
||||
if (STATUS_BATT_LOCKED() == 0) {
|
||||
dev_err(sharpsl_pm.dev, "Battery now Unlocked! Suspending.\n");
|
||||
is_fatal = 1;
|
||||
}
|
||||
|
||||
if (sharpsl_pm.machinfo->gpio_fatal && (STATUS_FATAL == 0)) {
|
||||
if (sharpsl_pm.machinfo->gpio_fatal && (STATUS_FATAL() == 0)) {
|
||||
dev_err(sharpsl_pm.dev, "Fatal Batt Error! Suspending.\n");
|
||||
is_fatal = 1;
|
||||
}
|
||||
|
@ -461,12 +462,12 @@ static int read_max1111(int channel)
|
|||
| MAXCTRL_SGL | MAXCTRL_UNI | MAXCTRL_STR);
|
||||
}
|
||||
|
||||
static int sharpsl_read_MainBattery(void)
|
||||
static int sharpsl_read_main_battery(void)
|
||||
{
|
||||
return read_max1111(BATT_AD);
|
||||
}
|
||||
|
||||
static int sharpsl_read_Temp(void)
|
||||
static int sharpsl_read_temp(void)
|
||||
{
|
||||
int temp;
|
||||
|
||||
|
@ -480,7 +481,7 @@ static int sharpsl_read_Temp(void)
|
|||
return temp;
|
||||
}
|
||||
|
||||
static int sharpsl_read_jkvad(void)
|
||||
static int sharpsl_read_acin(void)
|
||||
{
|
||||
return read_max1111(JK_VAD);
|
||||
}
|
||||
|
@ -522,16 +523,14 @@ static int get_select_val(int *val)
|
|||
return (sum/3);
|
||||
}
|
||||
|
||||
/* mode 0 - Check temperature and voltage
|
||||
* 1 - Check temperature only */
|
||||
static int sharpsl_check_battery(int mode)
|
||||
static int sharpsl_check_battery_temp(void)
|
||||
{
|
||||
int val, i, buff[5];
|
||||
|
||||
/* Check battery temperature */
|
||||
for (i=0; i<5; i++) {
|
||||
mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP);
|
||||
buff[i] = sharpsl_read_Temp();
|
||||
buff[i] = sharpsl_read_temp();
|
||||
}
|
||||
|
||||
val = get_select_val(buff);
|
||||
|
@ -539,8 +538,13 @@ static int sharpsl_check_battery(int mode)
|
|||
dev_dbg(sharpsl_pm.dev, "Temperature: %d\n", val);
|
||||
if (val > SHARPSL_CHARGE_ON_TEMP)
|
||||
return -1;
|
||||
if (mode == 1)
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sharpsl_check_battery_voltage(void)
|
||||
{
|
||||
int val, i, buff[5];
|
||||
|
||||
/* disable charge, enable discharge */
|
||||
CHARGE_OFF();
|
||||
|
@ -552,7 +556,7 @@ static int sharpsl_check_battery(int mode)
|
|||
|
||||
/* Check battery voltage */
|
||||
for (i=0; i<5; i++) {
|
||||
buff[i] = sharpsl_read_MainBattery();
|
||||
buff[i] = sharpsl_read_main_battery();
|
||||
mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT);
|
||||
}
|
||||
|
||||
|
@ -575,14 +579,14 @@ static int sharpsl_ac_check(void)
|
|||
int temp, i, buff[5];
|
||||
|
||||
for (i=0; i<5; i++) {
|
||||
buff[i] = sharpsl_read_jkvad();
|
||||
mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_JKVAD);
|
||||
buff[i] = sharpsl_read_acin();
|
||||
mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_ACIN);
|
||||
}
|
||||
|
||||
temp = get_select_val(buff);
|
||||
dev_dbg(sharpsl_pm.dev, "AC Voltage: %d\n",temp);
|
||||
|
||||
if ((temp > SHARPSL_CHARGE_ON_JKVAD_HIGH) || (temp < SHARPSL_CHARGE_ON_JKVAD_LOW)) {
|
||||
if ((temp > SHARPSL_CHARGE_ON_ACIN_HIGH) || (temp < SHARPSL_CHARGE_ON_ACIN_LOW)) {
|
||||
dev_err(sharpsl_pm.dev, "Error: AC check failed.\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -591,7 +595,7 @@ static int sharpsl_ac_check(void)
|
|||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int sharpsl_pm_suspend(struct device *dev, pm_message_t state)
|
||||
static int sharpsl_pm_suspend(struct platform_device *pdev, pm_message_t state)
|
||||
{
|
||||
sharpsl_pm.flags |= SHARPSL_SUSPENDED;
|
||||
flush_scheduled_work();
|
||||
|
@ -604,7 +608,7 @@ static int sharpsl_pm_suspend(struct device *dev, pm_message_t state)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int sharpsl_pm_resume(struct device *dev)
|
||||
static int sharpsl_pm_resume(struct platform_device *pdev)
|
||||
{
|
||||
/* Clear the reset source indicators as they break the bootloader upon reboot */
|
||||
RCSR = 0x0f;
|
||||
|
@ -622,7 +626,7 @@ static void corgi_goto_sleep(unsigned long alarm_time, unsigned int alarm_enable
|
|||
dev_dbg(sharpsl_pm.dev, "Offline Charge Activate = %d\n",sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG);
|
||||
/* not charging and AC-IN! */
|
||||
|
||||
if ((sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG) && (STATUS_AC_IN != 0)) {
|
||||
if ((sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG) && (STATUS_AC_IN() != 0)) {
|
||||
dev_dbg(sharpsl_pm.dev, "Activating Offline Charger...\n");
|
||||
sharpsl_pm.charge_mode = CHRG_OFF;
|
||||
sharpsl_pm.flags &= ~SHARPSL_DO_OFFLINE_CHRG;
|
||||
|
@ -671,7 +675,7 @@ static int corgi_enter_suspend(unsigned long alarm_time, unsigned int alarm_enab
|
|||
dev_dbg(sharpsl_pm.dev, "User triggered wakeup in offline charger.\n");
|
||||
}
|
||||
|
||||
if ((STATUS_BATT_LOCKED == 0) || (sharpsl_fatal_check() < 0) )
|
||||
if ((STATUS_BATT_LOCKED() == 0) || (sharpsl_fatal_check() < 0) )
|
||||
{
|
||||
dev_err(sharpsl_pm.dev, "Fatal condition. Suspend.\n");
|
||||
corgi_goto_sleep(alarm_time, alarm_enable, state);
|
||||
|
@ -711,7 +715,7 @@ static int sharpsl_fatal_check(void)
|
|||
dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check entered\n");
|
||||
|
||||
/* Check AC-Adapter */
|
||||
acin = STATUS_AC_IN;
|
||||
acin = STATUS_AC_IN();
|
||||
|
||||
if (acin && (sharpsl_pm.charge_mode == CHRG_ON)) {
|
||||
CHARGE_OFF();
|
||||
|
@ -725,7 +729,7 @@ static int sharpsl_fatal_check(void)
|
|||
|
||||
/* Check battery : check inserting battery ? */
|
||||
for (i=0; i<5; i++) {
|
||||
buff[i] = sharpsl_read_MainBattery();
|
||||
buff[i] = sharpsl_read_main_battery();
|
||||
mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT);
|
||||
}
|
||||
|
||||
|
@ -739,7 +743,7 @@ static int sharpsl_fatal_check(void)
|
|||
}
|
||||
|
||||
temp = get_select_val(buff);
|
||||
dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check: acin: %d, discharge voltage: %d, no discharge: %d\n", acin, temp, sharpsl_read_MainBattery());
|
||||
dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check: acin: %d, discharge voltage: %d, no discharge: %d\n", acin, temp, sharpsl_read_main_battery());
|
||||
|
||||
if ((acin && (temp < SHARPSL_FATAL_ACIN_VOLT)) ||
|
||||
(!acin && (temp < SHARPSL_FATAL_NOACIN_VOLT)))
|
||||
|
@ -771,7 +775,7 @@ static int sharpsl_off_charge_battery(void)
|
|||
dev_dbg(sharpsl_pm.dev, "Offline Charger: Step 1\n");
|
||||
|
||||
/* AC Check */
|
||||
if ((sharpsl_ac_check() < 0) || (sharpsl_check_battery(1) < 0))
|
||||
if ((sharpsl_ac_check() < 0) || (sharpsl_check_battery_temp() < 0))
|
||||
return sharpsl_off_charge_error();
|
||||
|
||||
/* Start Charging */
|
||||
|
@ -793,7 +797,7 @@ static int sharpsl_off_charge_battery(void)
|
|||
|
||||
dev_dbg(sharpsl_pm.dev, "Offline Charger: Step 2\n");
|
||||
|
||||
if (sharpsl_check_battery(0) < 0)
|
||||
if ((sharpsl_check_battery_temp() < 0) || (sharpsl_check_battery_voltage() < 0))
|
||||
return sharpsl_off_charge_error();
|
||||
|
||||
CHARGE_OFF();
|
||||
|
@ -811,7 +815,7 @@ static int sharpsl_off_charge_battery(void)
|
|||
/* Check for timeout */
|
||||
if ((RCNR - time) > SHARPSL_WAIT_CO_TIME)
|
||||
return 1;
|
||||
if (STATUS_CHRG_FULL) {
|
||||
if (STATUS_CHRG_FULL()) {
|
||||
dev_dbg(sharpsl_pm.dev, "Offline Charger: Charge full occured. Retrying to check\n");
|
||||
sharpsl_pm.full_count++;
|
||||
CHARGE_OFF();
|
||||
|
@ -840,7 +844,7 @@ static int sharpsl_off_charge_battery(void)
|
|||
sharpsl_pm.full_count++;
|
||||
return 1;
|
||||
}
|
||||
if (STATUS_CHRG_FULL) {
|
||||
if (STATUS_CHRG_FULL()) {
|
||||
dev_dbg(sharpsl_pm.dev, "Offline Charger: Charging complete.\n");
|
||||
CHARGE_LED_OFF();
|
||||
CHARGE_OFF();
|
||||
|
@ -886,13 +890,13 @@ static struct pm_ops sharpsl_pm_ops = {
|
|||
.finish = pxa_pm_finish,
|
||||
};
|
||||
|
||||
static int __init sharpsl_pm_probe(struct device *dev)
|
||||
static int __init sharpsl_pm_probe(struct platform_device *pdev)
|
||||
{
|
||||
if (!dev->platform_data)
|
||||
if (!pdev->dev.platform_data)
|
||||
return -EINVAL;
|
||||
|
||||
sharpsl_pm.dev = dev;
|
||||
sharpsl_pm.machinfo = dev->platform_data;
|
||||
sharpsl_pm.dev = &pdev->dev;
|
||||
sharpsl_pm.machinfo = pdev->dev.platform_data;
|
||||
sharpsl_pm.charge_mode = CHRG_OFF;
|
||||
sharpsl_pm.flags = 0;
|
||||
|
||||
|
@ -935,8 +939,8 @@ static int __init sharpsl_pm_probe(struct device *dev)
|
|||
else set_irq_type(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull),IRQT_RISING);
|
||||
}
|
||||
|
||||
device_create_file(dev, &dev_attr_battery_percentage);
|
||||
device_create_file(dev, &dev_attr_battery_voltage);
|
||||
device_create_file(&pdev->dev, &dev_attr_battery_percentage);
|
||||
device_create_file(&pdev->dev, &dev_attr_battery_voltage);
|
||||
|
||||
apm_get_power_status = sharpsl_apm_get_power_status;
|
||||
|
||||
|
@ -947,12 +951,12 @@ static int __init sharpsl_pm_probe(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int sharpsl_pm_remove(struct device *dev)
|
||||
static int sharpsl_pm_remove(struct platform_device *pdev)
|
||||
{
|
||||
pm_set_ops(NULL);
|
||||
|
||||
device_remove_file(dev, &dev_attr_battery_percentage);
|
||||
device_remove_file(dev, &dev_attr_battery_voltage);
|
||||
device_remove_file(&pdev->dev, &dev_attr_battery_percentage);
|
||||
device_remove_file(&pdev->dev, &dev_attr_battery_voltage);
|
||||
|
||||
free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr);
|
||||
free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr);
|
||||
|
@ -969,23 +973,24 @@ static int sharpsl_pm_remove(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct device_driver sharpsl_pm_driver = {
|
||||
.name = "sharpsl-pm",
|
||||
.bus = &platform_bus_type,
|
||||
static struct platform_driver sharpsl_pm_driver = {
|
||||
.probe = sharpsl_pm_probe,
|
||||
.remove = sharpsl_pm_remove,
|
||||
.suspend = sharpsl_pm_suspend,
|
||||
.resume = sharpsl_pm_resume,
|
||||
.driver = {
|
||||
.name = "sharpsl-pm",
|
||||
},
|
||||
};
|
||||
|
||||
static int __devinit sharpsl_pm_init(void)
|
||||
{
|
||||
return driver_register(&sharpsl_pm_driver);
|
||||
return platform_driver_register(&sharpsl_pm_driver);
|
||||
}
|
||||
|
||||
static void sharpsl_pm_exit(void)
|
||||
{
|
||||
driver_unregister(&sharpsl_pm_driver);
|
||||
platform_driver_unregister(&sharpsl_pm_driver);
|
||||
}
|
||||
|
||||
late_initcall(sharpsl_pm_init);
|
||||
|
|
|
@ -345,6 +345,16 @@ static void spitz_irda_transceiver_mode(struct device *dev, int mode)
|
|||
reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MACH_AKITA
|
||||
static void akita_irda_transceiver_mode(struct device *dev, int mode)
|
||||
{
|
||||
if (mode & IR_OFF)
|
||||
akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON);
|
||||
else
|
||||
akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON);
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct pxaficp_platform_data spitz_ficp_platform_data = {
|
||||
.transceiver_cap = IR_SIRMODE | IR_OFF,
|
||||
.transceiver_mode = spitz_irda_transceiver_mode,
|
||||
|
@ -417,6 +427,32 @@ static void __init spitz_init(void)
|
|||
platform_device_register(&spitzscoop2_device);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MACH_AKITA
|
||||
/*
|
||||
* Akita IO Expander
|
||||
*/
|
||||
struct platform_device akitaioexp_device = {
|
||||
.name = "akita-ioexp",
|
||||
.id = -1,
|
||||
};
|
||||
|
||||
static void __init akita_init(void)
|
||||
{
|
||||
spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode;
|
||||
|
||||
/* We just pretend the second element of the array doesn't exist */
|
||||
spitz_pcmcia_config.num_devs = 1;
|
||||
platform_scoop_config = &spitz_pcmcia_config;
|
||||
spitz_bl_machinfo.set_bl_intensity = akita_bl_set_intensity;
|
||||
|
||||
platform_device_register(&akitaioexp_device);
|
||||
|
||||
spitzscoop_device.dev.parent = &akitaioexp_device.dev;
|
||||
common_init();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void __init fixup_spitz(struct machine_desc *desc,
|
||||
struct tag *tags, char **cmdline, struct meminfo *mi)
|
||||
{
|
||||
|
@ -452,3 +488,16 @@ MACHINE_START(BORZOI, "SHARP Borzoi")
|
|||
.timer = &pxa_timer,
|
||||
MACHINE_END
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MACH_AKITA
|
||||
MACHINE_START(AKITA, "SHARP Akita")
|
||||
.phys_ram = 0xa0000000,
|
||||
.phys_io = 0x40000000,
|
||||
.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
|
||||
.fixup = fixup_spitz,
|
||||
.map_io = pxa_map_io,
|
||||
.init_irq = pxa_init_irq,
|
||||
.init_machine = akita_init,
|
||||
.timer = &pxa_timer,
|
||||
MACHINE_END
|
||||
#endif
|
||||
|
|
233
arch/arm/mach-pxa/spitz_pm.c
Normal file
233
arch/arm/mach-pxa/spitz_pm.c
Normal file
|
@ -0,0 +1,233 @@
|
|||
/*
|
||||
* Battery and Power Management code for the Sharp SL-Cxx00
|
||||
*
|
||||
* Copyright (c) 2005 Richard Purdie
|
||||
*
|
||||
* 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/module.h>
|
||||
#include <linux/stat.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <asm/apm.h>
|
||||
#include <asm/irq.h>
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/hardware.h>
|
||||
#include <asm/hardware/scoop.h>
|
||||
|
||||
#include <asm/arch/sharpsl.h>
|
||||
#include <asm/arch/spitz.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include "sharpsl.h"
|
||||
|
||||
static int spitz_last_ac_status;
|
||||
|
||||
static void spitz_charger_init(void)
|
||||
{
|
||||
pxa_gpio_mode(SPITZ_GPIO_KEY_INT | GPIO_IN);
|
||||
pxa_gpio_mode(SPITZ_GPIO_SYNC | GPIO_IN);
|
||||
}
|
||||
|
||||
static void spitz_charge_led(int val)
|
||||
{
|
||||
if (val == SHARPSL_LED_ERROR) {
|
||||
dev_dbg(sharpsl_pm.dev, "Charge LED Error\n");
|
||||
} else if (val == SHARPSL_LED_ON) {
|
||||
dev_dbg(sharpsl_pm.dev, "Charge LED On\n");
|
||||
set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_ORANGE);
|
||||
} else {
|
||||
dev_dbg(sharpsl_pm.dev, "Charge LED Off\n");
|
||||
reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_ORANGE);
|
||||
}
|
||||
}
|
||||
|
||||
static void spitz_measure_temp(int on)
|
||||
{
|
||||
if (on)
|
||||
set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_ADC_TEMP_ON);
|
||||
else
|
||||
reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_ADC_TEMP_ON);
|
||||
}
|
||||
|
||||
static void spitz_charge(int on)
|
||||
{
|
||||
if (on) {
|
||||
if (sharpsl_pm.flags & SHARPSL_SUSPENDED) {
|
||||
set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_JK_B);
|
||||
reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CHRG_ON);
|
||||
} else {
|
||||
reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_JK_B);
|
||||
reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CHRG_ON);
|
||||
}
|
||||
} else {
|
||||
reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_JK_B);
|
||||
set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CHRG_ON);
|
||||
}
|
||||
}
|
||||
|
||||
static void spitz_discharge(int on)
|
||||
{
|
||||
if (on)
|
||||
set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_JK_A);
|
||||
else
|
||||
reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_JK_A);
|
||||
}
|
||||
|
||||
/* HACK - For unknown reasons, accurate voltage readings are only made with a load
|
||||
on the power bus which the green led on spitz provides */
|
||||
static void spitz_discharge1(int on)
|
||||
{
|
||||
if (on)
|
||||
set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_GREEN);
|
||||
else
|
||||
reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_GREEN);
|
||||
}
|
||||
|
||||
static void spitz_presuspend(void)
|
||||
{
|
||||
spitz_last_ac_status = STATUS_AC_IN();
|
||||
|
||||
/* GPIO Sleep Register */
|
||||
PGSR0 = 0x00144018;
|
||||
PGSR1 = 0x00EF0000;
|
||||
if (machine_is_akita()) {
|
||||
PGSR2 = 0x2121C000;
|
||||
PGSR3 = 0x00600400;
|
||||
} else {
|
||||
PGSR2 = 0x0121C000;
|
||||
PGSR3 = 0x00600000;
|
||||
}
|
||||
|
||||
PGSR0 &= ~SPITZ_GPIO_G0_STROBE_BIT;
|
||||
PGSR1 &= ~SPITZ_GPIO_G1_STROBE_BIT;
|
||||
PGSR2 &= ~SPITZ_GPIO_G2_STROBE_BIT;
|
||||
PGSR3 &= ~SPITZ_GPIO_G3_STROBE_BIT;
|
||||
PGSR2 |= GPIO_bit(SPITZ_GPIO_KEY_STROBE0);
|
||||
|
||||
pxa_gpio_mode(GPIO18_RDY|GPIO_OUT | GPIO_DFLT_HIGH);
|
||||
|
||||
PRER = GPIO_bit(SPITZ_GPIO_KEY_INT);
|
||||
PFER = GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET);
|
||||
PWER = GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET) | PWER_RTC;
|
||||
PKWR = GPIO_bit(SPITZ_GPIO_SYNC) | GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET);
|
||||
PKSR = 0xffffffff; // clear
|
||||
|
||||
/* nRESET_OUT Disable */
|
||||
PSLR |= PSLR_SL_ROD;
|
||||
|
||||
/* Clear reset status */
|
||||
RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
|
||||
|
||||
/* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
|
||||
PCFR = PCFR_GPR_EN | PCFR_OPDE;
|
||||
}
|
||||
|
||||
static void spitz_postsuspend(void)
|
||||
{
|
||||
pxa_gpio_mode(GPIO18_RDY_MD);
|
||||
pxa_gpio_mode(10 | GPIO_IN);
|
||||
}
|
||||
|
||||
static int spitz_should_wakeup(unsigned int resume_on_alarm)
|
||||
{
|
||||
int is_resume = 0;
|
||||
int acin = STATUS_AC_IN();
|
||||
|
||||
if (spitz_last_ac_status != acin) {
|
||||
if (acin) {
|
||||
/* charge on */
|
||||
sharpsl_pm.flags |= SHARPSL_DO_OFFLINE_CHRG;
|
||||
dev_dbg(sharpsl_pm.dev, "AC Inserted\n");
|
||||
} else {
|
||||
/* charge off */
|
||||
dev_dbg(sharpsl_pm.dev, "AC Removed\n");
|
||||
CHARGE_LED_OFF();
|
||||
CHARGE_OFF();
|
||||
sharpsl_pm.charge_mode = CHRG_OFF;
|
||||
}
|
||||
spitz_last_ac_status = acin;
|
||||
/* Return to suspend as this must be what we were woken for */
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (PEDR & GPIO_bit(SPITZ_GPIO_KEY_INT))
|
||||
is_resume |= GPIO_bit(SPITZ_GPIO_KEY_INT);
|
||||
|
||||
if (PKSR & GPIO_bit(SPITZ_GPIO_SYNC))
|
||||
is_resume |= GPIO_bit(SPITZ_GPIO_SYNC);
|
||||
|
||||
if (resume_on_alarm && (PEDR & PWER_RTC))
|
||||
is_resume |= PWER_RTC;
|
||||
|
||||
dev_dbg(sharpsl_pm.dev, "is_resume: %x\n",is_resume);
|
||||
return is_resume;
|
||||
}
|
||||
|
||||
static unsigned long spitz_charger_wakeup(void)
|
||||
{
|
||||
return (~GPLR0 & GPIO_bit(SPITZ_GPIO_KEY_INT)) | (GPLR0 & GPIO_bit(SPITZ_GPIO_SYNC));
|
||||
}
|
||||
|
||||
static int spitz_acin_status(void)
|
||||
{
|
||||
return (((~GPLR(SPITZ_GPIO_AC_IN)) & GPIO_bit(SPITZ_GPIO_AC_IN)) != 0);
|
||||
}
|
||||
|
||||
struct sharpsl_charger_machinfo spitz_pm_machinfo = {
|
||||
.init = spitz_charger_init,
|
||||
.gpio_batlock = SPITZ_GPIO_BAT_COVER,
|
||||
.gpio_acin = SPITZ_GPIO_AC_IN,
|
||||
.gpio_batfull = SPITZ_GPIO_CHRG_FULL,
|
||||
.gpio_fatal = SPITZ_GPIO_FATAL_BAT,
|
||||
.status_acin = spitz_acin_status,
|
||||
.discharge = spitz_discharge,
|
||||
.discharge1 = spitz_discharge1,
|
||||
.charge = spitz_charge,
|
||||
.chargeled = spitz_charge_led,
|
||||
.measure_temp = spitz_measure_temp,
|
||||
.presuspend = spitz_presuspend,
|
||||
.postsuspend = spitz_postsuspend,
|
||||
.charger_wakeup = spitz_charger_wakeup,
|
||||
.should_wakeup = spitz_should_wakeup,
|
||||
.bat_levels = 40,
|
||||
.bat_levels_noac = spitz_battery_levels_noac,
|
||||
.bat_levels_acin = spitz_battery_levels_acin,
|
||||
.status_high_acin = 188,
|
||||
.status_low_acin = 178,
|
||||
.status_high_noac = 185,
|
||||
.status_low_noac = 175,
|
||||
};
|
||||
|
||||
static struct platform_device *spitzpm_device;
|
||||
|
||||
static int __devinit spitzpm_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
spitzpm_device = platform_device_alloc("sharpsl-pm", -1);
|
||||
if (!spitzpm_device)
|
||||
return -ENOMEM;
|
||||
|
||||
spitzpm_device->dev.platform_data = &spitz_pm_machinfo;
|
||||
ret = platform_device_add(spitzpm_device);
|
||||
|
||||
if (ret)
|
||||
platform_device_put(spitzpm_device);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void spitzpm_exit(void)
|
||||
{
|
||||
platform_device_unregister(spitzpm_device);
|
||||
}
|
||||
|
||||
module_init(spitzpm_init);
|
||||
module_exit(spitzpm_exit);
|
|
@ -14,6 +14,7 @@
|
|||
#include <linux/config.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/pm_legacy.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/sysctl.h>
|
||||
|
|
|
@ -699,7 +699,7 @@ depends on PM && !X86_VISWS
|
|||
|
||||
config APM
|
||||
tristate "APM (Advanced Power Management) BIOS support"
|
||||
depends on PM
|
||||
depends on PM && PM_LEGACY
|
||||
---help---
|
||||
APM is a BIOS specification for saving power using several different
|
||||
techniques. This is mostly useful for battery powered laptops with
|
||||
|
|
|
@ -218,6 +218,7 @@
|
|||
#include <linux/time.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/pm_legacy.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/smp.h>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <linux/bitops.h>
|
||||
#include <linux/smp.h>
|
||||
#include <linux/thread_info.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
#include <asm/processor.h>
|
||||
#include <asm/msr.h>
|
||||
|
@ -264,5 +265,52 @@ __init int intel_cpu_init(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_X86_CMPXCHG
|
||||
unsigned long cmpxchg_386_u8(volatile void *ptr, u8 old, u8 new)
|
||||
{
|
||||
u8 prev;
|
||||
unsigned long flags;
|
||||
|
||||
/* Poor man's cmpxchg for 386. Unsuitable for SMP */
|
||||
local_irq_save(flags);
|
||||
prev = *(u8 *)ptr;
|
||||
if (prev == old)
|
||||
*(u8 *)ptr = new;
|
||||
local_irq_restore(flags);
|
||||
return prev;
|
||||
}
|
||||
EXPORT_SYMBOL(cmpxchg_386_u8);
|
||||
|
||||
unsigned long cmpxchg_386_u16(volatile void *ptr, u16 old, u16 new)
|
||||
{
|
||||
u16 prev;
|
||||
unsigned long flags;
|
||||
|
||||
/* Poor man's cmpxchg for 386. Unsuitable for SMP */
|
||||
local_irq_save(flags);
|
||||
prev = *(u16 *)ptr;
|
||||
if (prev == old)
|
||||
*(u16 *)ptr = new;
|
||||
local_irq_restore(flags);
|
||||
return prev;
|
||||
}
|
||||
EXPORT_SYMBOL(cmpxchg_386_u16);
|
||||
|
||||
unsigned long cmpxchg_386_u32(volatile void *ptr, u32 old, u32 new)
|
||||
{
|
||||
u32 prev;
|
||||
unsigned long flags;
|
||||
|
||||
/* Poor man's cmpxchg for 386. Unsuitable for SMP */
|
||||
local_irq_save(flags);
|
||||
prev = *(u32 *)ptr;
|
||||
if (prev == old)
|
||||
*(u32 *)ptr = new;
|
||||
local_irq_restore(flags);
|
||||
return prev;
|
||||
}
|
||||
EXPORT_SYMBOL(cmpxchg_386_u32);
|
||||
#endif
|
||||
|
||||
// arch_initcall(intel_cpu_init);
|
||||
|
||||
|
|
|
@ -560,11 +560,10 @@ nmi_stack_fixup:
|
|||
nmi_debug_stack_check:
|
||||
cmpw $__KERNEL_CS,16(%esp)
|
||||
jne nmi_stack_correct
|
||||
cmpl $debug - 1,(%esp)
|
||||
jle nmi_stack_correct
|
||||
cmpl $debug,(%esp)
|
||||
jb nmi_stack_correct
|
||||
cmpl $debug_esp_fix_insn,(%esp)
|
||||
jle nmi_debug_stack_fixup
|
||||
nmi_debug_stack_fixup:
|
||||
ja nmi_stack_correct
|
||||
FIX_STACK(24,nmi_stack_correct, 1)
|
||||
jmp nmi_stack_correct
|
||||
|
||||
|
|
|
@ -25,8 +25,9 @@ static int __init init_pit(char* override)
|
|||
{
|
||||
/* check clock override */
|
||||
if (override[0] && strncmp(override,"pit",3))
|
||||
printk(KERN_ERR "Warning: clock= override failed. Defaulting to PIT\n");
|
||||
|
||||
printk(KERN_ERR "Warning: clock= override failed. Defaulting "
|
||||
"to PIT\n");
|
||||
init_cpu_khz();
|
||||
count_p = LATCH;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <linux/proc_fs.h>
|
||||
#include <linux/efi.h>
|
||||
#include <linux/memory_hotplug.h>
|
||||
#include <linux/initrd.h>
|
||||
|
||||
#include <asm/processor.h>
|
||||
#include <asm/system.h>
|
||||
|
@ -267,7 +268,7 @@ static void __init permanent_kmaps_init(pgd_t *pgd_base)
|
|||
pkmap_page_table = pte;
|
||||
}
|
||||
|
||||
void __devinit free_new_highpage(struct page *page)
|
||||
static void __devinit free_new_highpage(struct page *page)
|
||||
{
|
||||
set_page_count(page, 1);
|
||||
__free_page(page);
|
||||
|
|
|
@ -381,10 +381,8 @@ fpsp_done:
|
|||
.Lnotkern:
|
||||
SAVE_ALL_INT
|
||||
GET_CURRENT(%d0)
|
||||
tstb %curptr@(TASK_NEEDRESCHED)
|
||||
jne ret_from_exception | deliver signals,
|
||||
| reschedule etc..
|
||||
RESTORE_ALL
|
||||
| deliver signals, reschedule etc..
|
||||
jra ret_from_exception
|
||||
|
||||
|
|
||||
| mem_write --- write to user or supervisor address space
|
||||
|
|
|
@ -75,10 +75,8 @@ _060_isp_done:
|
|||
.Lnotkern:
|
||||
SAVE_ALL_INT
|
||||
GET_CURRENT(%d0)
|
||||
tstb %curptr@(TASK_NEEDRESCHED)
|
||||
jne ret_from_exception | deliver signals,
|
||||
| reschedule etc..
|
||||
RESTORE_ALL
|
||||
| deliver signals, reschedule etc..
|
||||
jra ret_from_exception
|
||||
|
||||
|
|
||||
| _060_real_chk():
|
||||
|
|
|
@ -25,12 +25,8 @@ int main(void)
|
|||
DEFINE(TASK_STATE, offsetof(struct task_struct, state));
|
||||
DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags));
|
||||
DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace));
|
||||
DEFINE(TASK_WORK, offsetof(struct task_struct, thread.work));
|
||||
DEFINE(TASK_NEEDRESCHED, offsetof(struct task_struct, thread.work.need_resched));
|
||||
DEFINE(TASK_SYSCALL_TRACE, offsetof(struct task_struct, thread.work.syscall_trace));
|
||||
DEFINE(TASK_SIGPENDING, offsetof(struct task_struct, thread.work.sigpending));
|
||||
DEFINE(TASK_NOTIFY_RESUME, offsetof(struct task_struct, thread.work.notify_resume));
|
||||
DEFINE(TASK_THREAD, offsetof(struct task_struct, thread));
|
||||
DEFINE(TASK_INFO, offsetof(struct task_struct, thread.info));
|
||||
DEFINE(TASK_MM, offsetof(struct task_struct, mm));
|
||||
DEFINE(TASK_ACTIVE_MM, offsetof(struct task_struct, active_mm));
|
||||
|
||||
|
@ -45,6 +41,10 @@ int main(void)
|
|||
DEFINE(THREAD_FPCNTL, offsetof(struct thread_struct, fpcntl));
|
||||
DEFINE(THREAD_FPSTATE, offsetof(struct thread_struct, fpstate));
|
||||
|
||||
/* offsets into the thread_info struct */
|
||||
DEFINE(TINFO_PREEMPT, offsetof(struct thread_info, preempt_count));
|
||||
DEFINE(TINFO_FLAGS, offsetof(struct thread_info, flags));
|
||||
|
||||
/* offsets into the pt_regs */
|
||||
DEFINE(PT_D0, offsetof(struct pt_regs, d0));
|
||||
DEFINE(PT_ORIG_D0, offsetof(struct pt_regs, orig_d0));
|
||||
|
|
|
@ -44,9 +44,7 @@
|
|||
|
||||
#include <asm/asm-offsets.h>
|
||||
|
||||
.globl system_call, buserr, trap
|
||||
.globl resume, ret_from_exception
|
||||
.globl ret_from_signal
|
||||
.globl system_call, buserr, trap, resume
|
||||
.globl inthandler, sys_call_table
|
||||
.globl sys_fork, sys_clone, sys_vfork
|
||||
.globl ret_from_interrupt, bad_interrupt
|
||||
|
@ -58,7 +56,7 @@ ENTRY(buserr)
|
|||
movel %sp,%sp@- | stack frame pointer argument
|
||||
bsrl buserr_c
|
||||
addql #4,%sp
|
||||
jra ret_from_exception
|
||||
jra .Lret_from_exception
|
||||
|
||||
ENTRY(trap)
|
||||
SAVE_ALL_INT
|
||||
|
@ -66,7 +64,7 @@ ENTRY(trap)
|
|||
movel %sp,%sp@- | stack frame pointer argument
|
||||
bsrl trap_c
|
||||
addql #4,%sp
|
||||
jra ret_from_exception
|
||||
jra .Lret_from_exception
|
||||
|
||||
| After a fork we jump here directly from resume,
|
||||
| so that %d1 contains the previous task
|
||||
|
@ -75,30 +73,31 @@ ENTRY(ret_from_fork)
|
|||
movel %d1,%sp@-
|
||||
jsr schedule_tail
|
||||
addql #4,%sp
|
||||
jra ret_from_exception
|
||||
jra .Lret_from_exception
|
||||
|
||||
badsys:
|
||||
movel #-ENOSYS,%sp@(PT_D0)
|
||||
jra ret_from_exception
|
||||
|
||||
do_trace:
|
||||
do_trace_entry:
|
||||
movel #-ENOSYS,%sp@(PT_D0) | needed for strace
|
||||
subql #4,%sp
|
||||
SAVE_SWITCH_STACK
|
||||
jbsr syscall_trace
|
||||
RESTORE_SWITCH_STACK
|
||||
addql #4,%sp
|
||||
movel %sp@(PT_ORIG_D0),%d1
|
||||
movel #-ENOSYS,%d0
|
||||
cmpl #NR_syscalls,%d1
|
||||
jcc 1f
|
||||
jbsr @(sys_call_table,%d1:l:4)@(0)
|
||||
1: movel %d0,%sp@(PT_D0) | save the return value
|
||||
subql #4,%sp | dummy return address
|
||||
movel %sp@(PT_ORIG_D0),%d0
|
||||
cmpl #NR_syscalls,%d0
|
||||
jcs syscall
|
||||
badsys:
|
||||
movel #-ENOSYS,%sp@(PT_D0)
|
||||
jra ret_from_syscall
|
||||
|
||||
do_trace_exit:
|
||||
subql #4,%sp
|
||||
SAVE_SWITCH_STACK
|
||||
jbsr syscall_trace
|
||||
RESTORE_SWITCH_STACK
|
||||
addql #4,%sp
|
||||
jra .Lret_from_exception
|
||||
|
||||
ret_from_signal:
|
||||
ENTRY(ret_from_signal)
|
||||
RESTORE_SWITCH_STACK
|
||||
addql #4,%sp
|
||||
/* on 68040 complete pending writebacks if any */
|
||||
|
@ -111,7 +110,7 @@ ret_from_signal:
|
|||
addql #4,%sp
|
||||
1:
|
||||
#endif
|
||||
jra ret_from_exception
|
||||
jra .Lret_from_exception
|
||||
|
||||
ENTRY(system_call)
|
||||
SAVE_ALL_SYS
|
||||
|
@ -120,30 +119,34 @@ ENTRY(system_call)
|
|||
| save top of frame
|
||||
movel %sp,%curptr@(TASK_THREAD+THREAD_ESP0)
|
||||
|
||||
tstb %curptr@(TASK_SYSCALL_TRACE)
|
||||
jne do_trace
|
||||
| syscall trace?
|
||||
tstb %curptr@(TASK_INFO+TINFO_FLAGS+2)
|
||||
jmi do_trace_entry
|
||||
cmpl #NR_syscalls,%d0
|
||||
jcc badsys
|
||||
syscall:
|
||||
jbsr @(sys_call_table,%d0:l:4)@(0)
|
||||
movel %d0,%sp@(PT_D0) | save the return value
|
||||
|
||||
ret_from_syscall:
|
||||
|oriw #0x0700,%sr
|
||||
movel %curptr@(TASK_WORK),%d0
|
||||
movew %curptr@(TASK_INFO+TINFO_FLAGS+2),%d0
|
||||
jne syscall_exit_work
|
||||
1: RESTORE_ALL
|
||||
|
||||
syscall_exit_work:
|
||||
btst #5,%sp@(PT_SR) | check if returning to kernel
|
||||
bnes 1b | if so, skip resched, signals
|
||||
tstw %d0
|
||||
jeq do_signal_return
|
||||
tstb %d0
|
||||
jne do_delayed_trace
|
||||
|
||||
lslw #1,%d0
|
||||
jcs do_trace_exit
|
||||
jmi do_delayed_trace
|
||||
lslw #8,%d0
|
||||
jmi do_signal_return
|
||||
pea resume_userspace
|
||||
jmp schedule
|
||||
jra schedule
|
||||
|
||||
ret_from_exception:
|
||||
|
||||
ENTRY(ret_from_exception)
|
||||
.Lret_from_exception:
|
||||
btst #5,%sp@(PT_SR) | check if returning to kernel
|
||||
bnes 1f | if so, skip resched, signals
|
||||
| only allow interrupts when we are really the last one on the
|
||||
|
@ -152,19 +155,18 @@ ret_from_exception:
|
|||
andw #ALLOWINT,%sr
|
||||
|
||||
resume_userspace:
|
||||
movel %curptr@(TASK_WORK),%d0
|
||||
lsrl #8,%d0
|
||||
moveb %curptr@(TASK_INFO+TINFO_FLAGS+3),%d0
|
||||
jne exit_work
|
||||
1: RESTORE_ALL
|
||||
|
||||
exit_work:
|
||||
| save top of frame
|
||||
movel %sp,%curptr@(TASK_THREAD+THREAD_ESP0)
|
||||
tstb %d0
|
||||
jeq do_signal_return
|
||||
|
||||
lslb #1,%d0
|
||||
jmi do_signal_return
|
||||
pea resume_userspace
|
||||
jmp schedule
|
||||
jra schedule
|
||||
|
||||
|
||||
do_signal_return:
|
||||
|andw #ALLOWINT,%sr
|
||||
|
@ -254,7 +256,7 @@ ret_from_interrupt:
|
|||
|
||||
/* check if we need to do software interrupts */
|
||||
tstl irq_stat+CPUSTAT_SOFTIRQ_PENDING
|
||||
jeq ret_from_exception
|
||||
jeq .Lret_from_exception
|
||||
pea ret_from_exception
|
||||
jra do_softirq
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ static inline void singlestep_disable(struct task_struct *child)
|
|||
{
|
||||
unsigned long tmp = get_reg(child, PT_SR) & ~(TRACE_BITS << 16);
|
||||
put_reg(child, PT_SR, tmp);
|
||||
child->thread.work.delayed_trace = 0;
|
||||
clear_tsk_thread_flag(child, TIF_DELAYED_TRACE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -118,7 +118,7 @@ static inline void singlestep_disable(struct task_struct *child)
|
|||
void ptrace_disable(struct task_struct *child)
|
||||
{
|
||||
singlestep_disable(child);
|
||||
child->thread.work.syscall_trace = 0;
|
||||
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
}
|
||||
|
||||
long arch_ptrace(struct task_struct *child, long request, long addr, long data)
|
||||
|
@ -198,9 +198,9 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
|
|||
goto out_eio;
|
||||
|
||||
if (request == PTRACE_SYSCALL)
|
||||
child->thread.work.syscall_trace = ~0;
|
||||
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
else
|
||||
child->thread.work.syscall_trace = 0;
|
||||
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
child->exit_code = data;
|
||||
singlestep_disable(child);
|
||||
wake_up_process(child);
|
||||
|
@ -223,10 +223,10 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
|
|||
if (!valid_signal(data))
|
||||
goto out_eio;
|
||||
|
||||
child->thread.work.syscall_trace = 0;
|
||||
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
tmp = get_reg(child, PT_SR) | (TRACE_BITS << 16);
|
||||
put_reg(child, PT_SR, tmp);
|
||||
child->thread.work.delayed_trace = 1;
|
||||
set_tsk_thread_flag(child, TIF_DELAYED_TRACE);
|
||||
|
||||
child->exit_code = data;
|
||||
/* give it a chance to run. */
|
||||
|
@ -288,9 +288,6 @@ out_eio:
|
|||
|
||||
asmlinkage void syscall_trace(void)
|
||||
{
|
||||
if (!current->thread.work.delayed_trace &&
|
||||
!current->thread.work.syscall_trace)
|
||||
return;
|
||||
ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
|
||||
? 0x80 : 0));
|
||||
/*
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <linux/config.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/pm_legacy.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/sysctl.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
|
|
@ -348,7 +348,7 @@ endpoint_stall(endpoint_t * ep)
|
|||
{
|
||||
u32 cs;
|
||||
|
||||
warn(__FUNCTION__);
|
||||
warn("%s", __FUNCTION__);
|
||||
|
||||
cs = au_readl(ep->reg->ctrl_stat) | USBDEV_CS_STALL;
|
||||
au_writel(cs, ep->reg->ctrl_stat);
|
||||
|
@ -360,7 +360,7 @@ endpoint_unstall(endpoint_t * ep)
|
|||
{
|
||||
u32 cs;
|
||||
|
||||
warn(__FUNCTION__);
|
||||
warn("%s", __FUNCTION__);
|
||||
|
||||
cs = au_readl(ep->reg->ctrl_stat) & ~USBDEV_CS_STALL;
|
||||
au_writel(cs, ep->reg->ctrl_stat);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* Copyright 2002-2004 MontaVista Software, Inc.
|
||||
* PowerPC 44x support, Matt Porter <mporter@kernel.crashing.org>
|
||||
* Copyright 2004 Freescale Semiconductor, Inc
|
||||
* PowerPC e500 modifications, Kumar Gala <kumar.gala@freescale.com>
|
||||
* PowerPC e500 modifications, Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Modifications by Kumar Gala (kumar.gala@freescale.com) to support
|
||||
* Modifications by Kumar Gala (galak@kernel.crashing.org) to support
|
||||
* E500 Book E processors.
|
||||
*
|
||||
* Copyright 2004 Freescale Semiconductor, Inc
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* Copyright (c) 2004 Freescale Semiconductor, Inc
|
||||
*
|
||||
* Author: Andy Fleming
|
||||
* Maintainer: Kumar Gala <Kumar.Gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <linux/cpumask.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/sysrq.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
#include <asm/ptrace.h>
|
||||
#include <asm/string.h>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* Copyright 2002-2004 MontaVista Software, Inc.
|
||||
* PowerPC 44x support, Matt Porter <mporter@kernel.crashing.org>
|
||||
* Copyright 2004 Freescale Semiconductor, Inc
|
||||
* PowerPC e500 modifications, Kumar Gala <kumar.gala@freescale.com>
|
||||
* PowerPC e500 modifications, Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Modifications by Kumar Gala (kumar.gala@freescale.com) to support
|
||||
* Modifications by Kumar Gala (galak@kernel.crashing.org) to support
|
||||
* E500 Book E processors.
|
||||
*
|
||||
* Copyright 2004 Freescale Semiconductor, Inc
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC834x SYS board specific routines
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2005 Freescale Semiconductor Inc.
|
||||
*
|
||||
|
@ -73,12 +73,19 @@ mpc83xx_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
|
|||
* A B C D
|
||||
*/
|
||||
{
|
||||
{PIRQA, PIRQB, PIRQC, PIRQD}, /* idsel 0x11 */
|
||||
{PIRQC, PIRQD, PIRQA, PIRQB}, /* idsel 0x12 */
|
||||
{PIRQD, PIRQA, PIRQB, PIRQC} /* idsel 0x13 */
|
||||
{PIRQA, PIRQB, PIRQC, PIRQD}, /* idsel 0x11 */
|
||||
{PIRQC, PIRQD, PIRQA, PIRQB}, /* idsel 0x12 */
|
||||
{PIRQD, PIRQA, PIRQB, PIRQC}, /* idsel 0x13 */
|
||||
{0, 0, 0, 0},
|
||||
{PIRQA, PIRQB, PIRQC, PIRQD}, /* idsel 0x15 */
|
||||
{PIRQD, PIRQA, PIRQB, PIRQC}, /* idsel 0x16 */
|
||||
{PIRQC, PIRQD, PIRQA, PIRQB}, /* idsel 0x17 */
|
||||
{PIRQB, PIRQC, PIRQD, PIRQA}, /* idsel 0x18 */
|
||||
{0, 0, 0, 0}, /* idsel 0x19 */
|
||||
{0, 0, 0, 0}, /* idsel 0x20 */
|
||||
};
|
||||
|
||||
const long min_idsel = 0x11, max_idsel = 0x13, irqs_per_slot = 4;
|
||||
const long min_idsel = 0x11, max_idsel = 0x20, irqs_per_slot = 4;
|
||||
return PCI_IRQ_TABLE_LOOKUP;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC834X SYS common board definitions
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2005 Freescale Semiconductor, Inc.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC8540ADS board specific routines
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2004 Freescale Semiconductor Inc.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC8540ADS board definitions
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2004 Freescale Semiconductor Inc.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC8555CDS board definitions
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2004 Freescale Semiconductor Inc.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC8560ADS board specific routines
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2004 Freescale Semiconductor Inc.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC8540ADS board definitions
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2004 Freescale Semiconductor Inc.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC85xx ADS board common routines
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2004 Freescale Semiconductor Inc.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC85XX ADS common board definitions
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2004 Freescale Semiconductor Inc.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC85xx CDS board specific routines
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2004 Freescale Semiconductor, Inc
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC85xx CDS board definitions
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2004 Freescale Semiconductor, Inc
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Wind River SBC8560 board specific routines
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala
|
||||
*
|
||||
* Copyright 2004 Freescale Semiconductor Inc.
|
||||
*
|
||||
|
|
|
@ -2317,6 +2317,14 @@ static struct pmac_mb_def pmac_mb_defs[] = {
|
|||
PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
|
||||
PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
|
||||
},
|
||||
{ "PowerBook5,8", "PowerBook G4 15\"",
|
||||
PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
|
||||
PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
|
||||
},
|
||||
{ "PowerBook5,9", "PowerBook G4 17\"",
|
||||
PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
|
||||
PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
|
||||
},
|
||||
{ "PowerBook6,1", "PowerBook G4 12\"",
|
||||
PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
|
||||
PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* PQ2ADS platform support
|
||||
*
|
||||
* Author: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Author: Kumar Gala <galak@kernel.crashing.org>
|
||||
* Derived from: est8260_setup.c by Allen Curtis
|
||||
*
|
||||
* Copyright 2004 Freescale Semiconductor, Inc.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* IPIC private definitions and structure.
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2005 Freescale Semiconductor, Inc
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC83xx Device descriptions
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2005 Freescale Semiconductor Inc.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC83xx System descriptions
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2005 Freescale Semiconductor Inc.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC85xx Device descriptions
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2005 Freescale Semiconductor Inc.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC85xx System descriptions
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2005 Freescale Semiconductor Inc.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC8xx Device descriptions
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2005 MontaVista Software, Inc. by Vitaly Bordug<vbordug@ru.mvista.com>
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC8xx System descriptions
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2005 MontaVista Software, Inc. by Vitaly Bordug <vbordug@ru.mvista.com>
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC83XX common board code
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2005 Freescale Semiconductor Inc.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC83XX common board definitions
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2005 Freescale Semiconductor Inc.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC85xx support routines
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2004 Freescale Semiconductor Inc.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC85xx support routines
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2004 Freescale Semiconductor Inc.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC85XX common board code
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2004 Freescale Semiconductor Inc.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* MPC85XX common board definitions
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2004 Freescale Semiconductor Inc.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* PPC System library functions
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* Copyright 2005 Freescale Semiconductor Inc.
|
||||
* Copyright 2005 MontaVista, Inc. by Vitaly Bordug <vbordug@ru.mvista.com>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* PQ2 Device descriptions
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* 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
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* PQ2 System descriptions
|
||||
*
|
||||
* Maintainer: Kumar Gala <kumar.gala@freescale.com>
|
||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||
*
|
||||
* 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
|
||||
|
|
|
@ -1261,6 +1261,7 @@ prom_n_addr_cells(struct device_node* np)
|
|||
/* No #address-cells property for the root node, default to 1 */
|
||||
return 1;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(prom_n_addr_cells);
|
||||
|
||||
int
|
||||
prom_n_size_cells(struct device_node* np)
|
||||
|
@ -1276,6 +1277,7 @@ prom_n_size_cells(struct device_node* np)
|
|||
/* No #size-cells property for the root node, default to 1 */
|
||||
return 1;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(prom_n_size_cells);
|
||||
|
||||
/**
|
||||
* Work out the sense (active-low level / active-high edge)
|
||||
|
|
|
@ -37,17 +37,43 @@ int __atomic_add_return(int i, atomic_t *v)
|
|||
spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(__atomic_add_return);
|
||||
|
||||
int atomic_cmpxchg(atomic_t *v, int old, int new)
|
||||
{
|
||||
int ret;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(ATOMIC_HASH(v), flags);
|
||||
ret = v->counter;
|
||||
if (likely(ret == old))
|
||||
v->counter = new;
|
||||
|
||||
spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int atomic_add_unless(atomic_t *v, int a, int u)
|
||||
{
|
||||
int ret;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(ATOMIC_HASH(v), flags);
|
||||
ret = v->counter;
|
||||
if (ret != u)
|
||||
v->counter += a;
|
||||
spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
|
||||
return ret != u;
|
||||
}
|
||||
|
||||
static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
|
||||
/* Atomic operations are already serializing */
|
||||
void atomic_set(atomic_t *v, int i)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(ATOMIC_HASH(v), flags);
|
||||
|
||||
v->counter = i;
|
||||
|
||||
spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(__atomic_add_return);
|
||||
EXPORT_SYMBOL(atomic_set);
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
*/
|
||||
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/bitops.h>
|
||||
|
||||
#include <asm/bitext.h>
|
||||
|
|
|
@ -7,7 +7,6 @@ config UML
|
|||
bool
|
||||
default y
|
||||
|
||||
# XXX: does UM have a mmu/swap?
|
||||
config MMU
|
||||
bool
|
||||
default y
|
||||
|
@ -36,12 +35,6 @@ config IRQ_RELEASE_METHOD
|
|||
bool
|
||||
default y
|
||||
|
||||
menu "Host processor type and features"
|
||||
|
||||
source "arch/i386/Kconfig.cpu"
|
||||
|
||||
endmenu
|
||||
|
||||
menu "UML-specific options"
|
||||
|
||||
config MODE_TT
|
||||
|
@ -209,7 +202,8 @@ config MAGIC_SYSRQ
|
|||
config SMP
|
||||
bool "Symmetric multi-processing support (EXPERIMENTAL)"
|
||||
default n
|
||||
depends on (MODE_TT && EXPERIMENTAL && !SMP_BROKEN) || (BROKEN && SMP_BROKEN)
|
||||
#SMP_BROKEN is for x86_64.
|
||||
depends on MODE_TT && EXPERIMENTAL && (!SMP_BROKEN || (BROKEN && SMP_BROKEN))
|
||||
help
|
||||
This option enables UML SMP support.
|
||||
It is NOT related to having a real SMP box. Not directly, at least.
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
menu "Host processor type and features"
|
||||
|
||||
source "arch/i386/Kconfig.cpu"
|
||||
|
||||
endmenu
|
||||
|
||||
config UML_X86
|
||||
bool
|
||||
default y
|
||||
|
@ -42,7 +48,3 @@ config ARCH_HAS_SC_SIGNALS
|
|||
config ARCH_REUSE_HOST_VSYSCALL_AREA
|
||||
bool
|
||||
default y
|
||||
|
||||
config X86_CMPXCHG
|
||||
bool
|
||||
default y
|
||||
|
|
|
@ -35,4 +35,3 @@ cflags-y += $(call cc-option,-mpreferred-stack-boundary=2)
|
|||
|
||||
CFLAGS += $(cflags-y)
|
||||
USER_CFLAGS += $(cflags-y)
|
||||
|
||||
|
|
|
@ -89,8 +89,7 @@ static int not_configged_write(int fd, const char *buf, int len, void *data)
|
|||
return(-EIO);
|
||||
}
|
||||
|
||||
static int not_configged_console_write(int fd, const char *buf, int len,
|
||||
void *data)
|
||||
static int not_configged_console_write(int fd, const char *buf, int len)
|
||||
{
|
||||
my_puts("Using a channel type which is configured out of "
|
||||
"UML\n");
|
||||
|
@ -299,7 +298,7 @@ int console_write_chan(struct list_head *chans, const char *buf, int len)
|
|||
chan = list_entry(ele, struct chan, list);
|
||||
if(!chan->output || (chan->ops->console_write == NULL))
|
||||
continue;
|
||||
n = chan->ops->console_write(chan->fd, buf, len, chan->data);
|
||||
n = chan->ops->console_write(chan->fd, buf, len);
|
||||
if(chan->primary) ret = n;
|
||||
}
|
||||
return(ret);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "choose-mode.h"
|
||||
#include "mode.h"
|
||||
|
||||
int generic_console_write(int fd, const char *buf, int n, void *unused)
|
||||
int generic_console_write(int fd, const char *buf, int n)
|
||||
{
|
||||
struct termios save, new;
|
||||
int err;
|
||||
|
|
|
@ -98,7 +98,7 @@ static int connect_to_switch(struct daemon_data *pri)
|
|||
printk("daemon_open : control setup request failed, err = %d\n",
|
||||
-n);
|
||||
err = -ENOTCONN;
|
||||
goto out;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
n = os_read_file(pri->control, sun, sizeof(*sun));
|
||||
|
@ -106,12 +106,14 @@ static int connect_to_switch(struct daemon_data *pri)
|
|||
printk("daemon_open : read of data socket failed, err = %d\n",
|
||||
-n);
|
||||
err = -ENOTCONN;
|
||||
goto out_close;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
pri->data_addr = sun;
|
||||
return(fd);
|
||||
|
||||
out_free:
|
||||
kfree(sun);
|
||||
out_close:
|
||||
os_close_file(fd);
|
||||
out:
|
||||
|
|
|
@ -76,13 +76,6 @@ static void fd_close(int fd, void *d)
|
|||
}
|
||||
}
|
||||
|
||||
static int fd_console_write(int fd, const char *buf, int n, void *d)
|
||||
{
|
||||
struct fd_chan *data = d;
|
||||
|
||||
return(generic_console_write(fd, buf, n, &data->tt));
|
||||
}
|
||||
|
||||
struct chan_ops fd_ops = {
|
||||
.type = "fd",
|
||||
.init = fd_init,
|
||||
|
@ -90,7 +83,7 @@ struct chan_ops fd_ops = {
|
|||
.close = fd_close,
|
||||
.read = generic_read,
|
||||
.write = generic_write,
|
||||
.console_write = fd_console_write,
|
||||
.console_write = generic_console_write,
|
||||
.window_size = generic_window_size,
|
||||
.free = generic_free,
|
||||
.winch = 1,
|
||||
|
|
|
@ -54,7 +54,7 @@ static int mcast_open(void *data)
|
|||
struct mcast_data *pri = data;
|
||||
struct sockaddr_in *sin = pri->mcast_addr;
|
||||
struct ip_mreq mreq;
|
||||
int fd, yes = 1, err = 0;
|
||||
int fd, yes = 1, err = -EINVAL;
|
||||
|
||||
|
||||
if ((sin->sin_addr.s_addr == 0) || (sin->sin_port == 0))
|
||||
|
@ -63,40 +63,40 @@ static int mcast_open(void *data)
|
|||
fd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
|
||||
if (fd < 0){
|
||||
err = -errno;
|
||||
printk("mcast_open : data socket failed, errno = %d\n",
|
||||
errno);
|
||||
err = -errno;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0) {
|
||||
err = -errno;
|
||||
printk("mcast_open: SO_REUSEADDR failed, errno = %d\n",
|
||||
errno);
|
||||
err = -errno;
|
||||
goto out_close;
|
||||
}
|
||||
|
||||
/* set ttl according to config */
|
||||
if (setsockopt(fd, SOL_IP, IP_MULTICAST_TTL, &pri->ttl,
|
||||
sizeof(pri->ttl)) < 0) {
|
||||
err = -errno;
|
||||
printk("mcast_open: IP_MULTICAST_TTL failed, error = %d\n",
|
||||
errno);
|
||||
err = -errno;
|
||||
goto out_close;
|
||||
}
|
||||
|
||||
/* set LOOP, so data does get fed back to local sockets */
|
||||
if (setsockopt(fd, SOL_IP, IP_MULTICAST_LOOP, &yes, sizeof(yes)) < 0) {
|
||||
err = -errno;
|
||||
printk("mcast_open: IP_MULTICAST_LOOP failed, error = %d\n",
|
||||
errno);
|
||||
err = -errno;
|
||||
goto out_close;
|
||||
}
|
||||
|
||||
/* bind socket to mcast address */
|
||||
if (bind(fd, (struct sockaddr *) sin, sizeof(*sin)) < 0) {
|
||||
printk("mcast_open : data bind failed, errno = %d\n", errno);
|
||||
err = -errno;
|
||||
printk("mcast_open : data bind failed, errno = %d\n", errno);
|
||||
goto out_close;
|
||||
}
|
||||
|
||||
|
@ -105,22 +105,22 @@ static int mcast_open(void *data)
|
|||
mreq.imr_interface.s_addr = 0;
|
||||
if (setsockopt(fd, SOL_IP, IP_ADD_MEMBERSHIP,
|
||||
&mreq, sizeof(mreq)) < 0) {
|
||||
err = -errno;
|
||||
printk("mcast_open: IP_ADD_MEMBERSHIP failed, error = %d\n",
|
||||
errno);
|
||||
printk("There appears not to be a multicast-capable network "
|
||||
"interface on the host.\n");
|
||||
printk("eth0 should be configured in order to use the "
|
||||
"multicast transport.\n");
|
||||
err = -errno;
|
||||
goto out_close;
|
||||
goto out_close;
|
||||
}
|
||||
|
||||
return fd;
|
||||
|
||||
out_close:
|
||||
os_close_file(fd);
|
||||
os_close_file(fd);
|
||||
out:
|
||||
return err;
|
||||
return err;
|
||||
}
|
||||
|
||||
static void mcast_close(int fd, void *data)
|
||||
|
|
|
@ -100,13 +100,6 @@ static void port_close(int fd, void *d)
|
|||
os_close_file(fd);
|
||||
}
|
||||
|
||||
static int port_console_write(int fd, const char *buf, int n, void *d)
|
||||
{
|
||||
struct port_chan *data = d;
|
||||
|
||||
return(generic_console_write(fd, buf, n, &data->tt));
|
||||
}
|
||||
|
||||
struct chan_ops port_ops = {
|
||||
.type = "port",
|
||||
.init = port_init,
|
||||
|
@ -114,7 +107,7 @@ struct chan_ops port_ops = {
|
|||
.close = port_close,
|
||||
.read = generic_read,
|
||||
.write = generic_write,
|
||||
.console_write = port_console_write,
|
||||
.console_write = generic_console_write,
|
||||
.window_size = generic_window_size,
|
||||
.free = port_free,
|
||||
.winch = 1,
|
||||
|
|
|
@ -118,13 +118,6 @@ static int pty_open(int input, int output, int primary, void *d,
|
|||
return(fd);
|
||||
}
|
||||
|
||||
static int pty_console_write(int fd, const char *buf, int n, void *d)
|
||||
{
|
||||
struct pty_chan *data = d;
|
||||
|
||||
return(generic_console_write(fd, buf, n, &data->tt));
|
||||
}
|
||||
|
||||
struct chan_ops pty_ops = {
|
||||
.type = "pty",
|
||||
.init = pty_chan_init,
|
||||
|
@ -132,7 +125,7 @@ struct chan_ops pty_ops = {
|
|||
.close = generic_close,
|
||||
.read = generic_read,
|
||||
.write = generic_write,
|
||||
.console_write = pty_console_write,
|
||||
.console_write = generic_console_write,
|
||||
.window_size = generic_window_size,
|
||||
.free = generic_free,
|
||||
.winch = 0,
|
||||
|
@ -145,7 +138,7 @@ struct chan_ops pts_ops = {
|
|||
.close = generic_close,
|
||||
.read = generic_read,
|
||||
.write = generic_write,
|
||||
.console_write = pty_console_write,
|
||||
.console_write = generic_console_write,
|
||||
.window_size = generic_window_size,
|
||||
.free = generic_free,
|
||||
.winch = 0,
|
||||
|
|
|
@ -60,13 +60,6 @@ static int tty_open(int input, int output, int primary, void *d,
|
|||
return(fd);
|
||||
}
|
||||
|
||||
static int tty_console_write(int fd, const char *buf, int n, void *d)
|
||||
{
|
||||
struct tty_chan *data = d;
|
||||
|
||||
return(generic_console_write(fd, buf, n, &data->tt));
|
||||
}
|
||||
|
||||
struct chan_ops tty_ops = {
|
||||
.type = "tty",
|
||||
.init = tty_chan_init,
|
||||
|
@ -74,7 +67,7 @@ struct chan_ops tty_ops = {
|
|||
.close = generic_close,
|
||||
.read = generic_read,
|
||||
.write = generic_write,
|
||||
.console_write = tty_console_write,
|
||||
.console_write = generic_console_write,
|
||||
.window_size = generic_window_size,
|
||||
.free = generic_free,
|
||||
.winch = 0,
|
||||
|
|
|
@ -194,13 +194,6 @@ static void xterm_free(void *d)
|
|||
free(d);
|
||||
}
|
||||
|
||||
static int xterm_console_write(int fd, const char *buf, int n, void *d)
|
||||
{
|
||||
struct xterm_chan *data = d;
|
||||
|
||||
return(generic_console_write(fd, buf, n, &data->tt));
|
||||
}
|
||||
|
||||
struct chan_ops xterm_ops = {
|
||||
.type = "xterm",
|
||||
.init = xterm_init,
|
||||
|
@ -208,7 +201,7 @@ struct chan_ops xterm_ops = {
|
|||
.close = xterm_close,
|
||||
.read = generic_read,
|
||||
.write = generic_write,
|
||||
.console_write = xterm_console_write,
|
||||
.console_write = generic_console_write,
|
||||
.window_size = generic_window_size,
|
||||
.free = xterm_free,
|
||||
.winch = 1,
|
||||
|
|
|
@ -25,7 +25,7 @@ struct chan_ops {
|
|||
void (*close)(int, void *);
|
||||
int (*read)(int, char *, void *);
|
||||
int (*write)(int, const char *, int, void *);
|
||||
int (*console_write)(int, const char *, int, void *);
|
||||
int (*console_write)(int, const char *, int);
|
||||
int (*window_size)(int, void *, unsigned short *, unsigned short *);
|
||||
void (*free)(void *);
|
||||
int winch;
|
||||
|
@ -37,7 +37,7 @@ extern struct chan_ops fd_ops, null_ops, port_ops, pts_ops, pty_ops, tty_ops,
|
|||
extern void generic_close(int fd, void *unused);
|
||||
extern int generic_read(int fd, char *c_out, void *unused);
|
||||
extern int generic_write(int fd, const char *buf, int n, void *unused);
|
||||
extern int generic_console_write(int fd, const char *buf, int n, void *state);
|
||||
extern int generic_console_write(int fd, const char *buf, int n);
|
||||
extern int generic_window_size(int fd, void *unused, unsigned short *rows_out,
|
||||
unsigned short *cols_out);
|
||||
extern void generic_free(void *data);
|
||||
|
|
|
@ -17,8 +17,25 @@
|
|||
#include "uaccess-skas.h"
|
||||
#endif
|
||||
|
||||
#define __under_task_size(addr, size) \
|
||||
(((unsigned long) (addr) < TASK_SIZE) && \
|
||||
(((unsigned long) (addr) + (size)) < TASK_SIZE))
|
||||
|
||||
#define __access_ok_vsyscall(type, addr, size) \
|
||||
((type == VERIFY_READ) && \
|
||||
((unsigned long) (addr) >= FIXADDR_USER_START) && \
|
||||
((unsigned long) (addr) + (size) <= FIXADDR_USER_END) && \
|
||||
((unsigned long) (addr) + (size) >= (unsigned long)(addr)))
|
||||
|
||||
#define __addr_range_nowrap(addr, size) \
|
||||
((unsigned long) (addr) <= ((unsigned long) (addr) + (size)))
|
||||
|
||||
#define access_ok(type, addr, size) \
|
||||
CHOOSE_MODE_PROC(access_ok_tt, access_ok_skas, type, addr, size)
|
||||
(__addr_range_nowrap(addr, size) && \
|
||||
(__under_task_size(addr, size) || \
|
||||
__access_ok_vsyscall(type, addr, size) || \
|
||||
segment_eq(get_fs(), KERNEL_DS) || \
|
||||
CHOOSE_MODE_PROC(access_ok_tt, access_ok_skas, type, addr, size)))
|
||||
|
||||
static inline int copy_from_user(void *to, const void __user *from, int n)
|
||||
{
|
||||
|
|
|
@ -9,14 +9,8 @@
|
|||
#include "asm/errno.h"
|
||||
#include "asm/fixmap.h"
|
||||
|
||||
#define access_ok_skas(type, addr, size) \
|
||||
((segment_eq(get_fs(), KERNEL_DS)) || \
|
||||
(((unsigned long) (addr) < TASK_SIZE) && \
|
||||
((unsigned long) (addr) + (size) <= TASK_SIZE)) || \
|
||||
((type == VERIFY_READ ) && \
|
||||
((unsigned long) (addr) >= FIXADDR_USER_START) && \
|
||||
((unsigned long) (addr) + (size) <= FIXADDR_USER_END) && \
|
||||
((unsigned long) (addr) + (size) >= (unsigned long)(addr))))
|
||||
/* No SKAS-specific checking. */
|
||||
#define access_ok_skas(type, addr, size) 0
|
||||
|
||||
extern int copy_from_user_skas(void *to, const void __user *from, int n);
|
||||
extern int copy_to_user_skas(void __user *to, const void *from, int n);
|
||||
|
|
|
@ -143,7 +143,7 @@ int copy_from_user_skas(void *to, const void __user *from, int n)
|
|||
return(0);
|
||||
}
|
||||
|
||||
return(access_ok_skas(VERIFY_READ, from, n) ?
|
||||
return(access_ok(VERIFY_READ, from, n) ?
|
||||
buffer_op((unsigned long) from, n, 0, copy_chunk_from_user, &to):
|
||||
n);
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ int copy_to_user_skas(void __user *to, const void *from, int n)
|
|||
return(0);
|
||||
}
|
||||
|
||||
return(access_ok_skas(VERIFY_WRITE, to, n) ?
|
||||
return(access_ok(VERIFY_WRITE, to, n) ?
|
||||
buffer_op((unsigned long) to, n, 1, copy_chunk_to_user, &from) :
|
||||
n);
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ int strncpy_from_user_skas(char *dst, const char __user *src, int count)
|
|||
return(strnlen(dst, count));
|
||||
}
|
||||
|
||||
if(!access_ok_skas(VERIFY_READ, src, 1))
|
||||
if(!access_ok(VERIFY_READ, src, 1))
|
||||
return(-EFAULT);
|
||||
|
||||
n = buffer_op((unsigned long) src, count, 0, strncpy_chunk_from_user,
|
||||
|
@ -221,7 +221,7 @@ int clear_user_skas(void __user *mem, int len)
|
|||
return(0);
|
||||
}
|
||||
|
||||
return(access_ok_skas(VERIFY_WRITE, mem, len) ?
|
||||
return(access_ok(VERIFY_WRITE, mem, len) ?
|
||||
buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL) : len);
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,16 @@ survive:
|
|||
pte = pte_offset_kernel(pmd, address);
|
||||
} while(!pte_present(*pte));
|
||||
err = 0;
|
||||
/* The below warning was added in place of
|
||||
* pte_mkyoung(); if (is_write) pte_mkdirty();
|
||||
* If it's triggered, we'd see normally a hang here (a clean pte is
|
||||
* marked read-only to emulate the dirty bit).
|
||||
* However, the generic code can mark a PTE writable but clean on a
|
||||
* concurrent read fault, triggering this harmlessly. So comment it out.
|
||||
*/
|
||||
#if 0
|
||||
WARN_ON(!pte_young(*pte) || (is_write && !pte_dirty(*pte)));
|
||||
#endif
|
||||
flush_tlb_page(vma, address);
|
||||
out:
|
||||
up_read(&mm->mmap_sem);
|
||||
|
|
|
@ -19,19 +19,13 @@
|
|||
extern unsigned long end_vm;
|
||||
extern unsigned long uml_physmem;
|
||||
|
||||
#define under_task_size(addr, size) \
|
||||
(((unsigned long) (addr) < TASK_SIZE) && \
|
||||
(((unsigned long) (addr) + (size)) < TASK_SIZE))
|
||||
|
||||
#define is_stack(addr, size) \
|
||||
(((unsigned long) (addr) < STACK_TOP) && \
|
||||
((unsigned long) (addr) >= STACK_TOP - ABOVE_KMEM) && \
|
||||
(((unsigned long) (addr) + (size)) <= STACK_TOP))
|
||||
|
||||
#define access_ok_tt(type, addr, size) \
|
||||
((type == VERIFY_READ) || (segment_eq(get_fs(), KERNEL_DS)) || \
|
||||
(((unsigned long) (addr) <= ((unsigned long) (addr) + (size))) && \
|
||||
(under_task_size(addr, size) || is_stack(addr, size))))
|
||||
(is_stack(addr, size))
|
||||
|
||||
extern unsigned long get_fault_addr(void);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
int copy_from_user_tt(void *to, const void __user *from, int n)
|
||||
{
|
||||
if(!access_ok_tt(VERIFY_READ, from, n))
|
||||
if(!access_ok(VERIFY_READ, from, n))
|
||||
return(n);
|
||||
|
||||
return(__do_copy_from_user(to, from, n, ¤t->thread.fault_addr,
|
||||
|
@ -17,7 +17,7 @@ int copy_from_user_tt(void *to, const void __user *from, int n)
|
|||
|
||||
int copy_to_user_tt(void __user *to, const void *from, int n)
|
||||
{
|
||||
if(!access_ok_tt(VERIFY_WRITE, to, n))
|
||||
if(!access_ok(VERIFY_WRITE, to, n))
|
||||
return(n);
|
||||
|
||||
return(__do_copy_to_user(to, from, n, ¤t->thread.fault_addr,
|
||||
|
@ -28,7 +28,7 @@ int strncpy_from_user_tt(char *dst, const char __user *src, int count)
|
|||
{
|
||||
int n;
|
||||
|
||||
if(!access_ok_tt(VERIFY_READ, src, 1))
|
||||
if(!access_ok(VERIFY_READ, src, 1))
|
||||
return(-EFAULT);
|
||||
|
||||
n = __do_strncpy_from_user(dst, src, count,
|
||||
|
@ -47,7 +47,7 @@ int __clear_user_tt(void __user *mem, int len)
|
|||
|
||||
int clear_user_tt(void __user *mem, int len)
|
||||
{
|
||||
if(!access_ok_tt(VERIFY_WRITE, mem, len))
|
||||
if(!access_ok(VERIFY_WRITE, mem, len))
|
||||
return(len);
|
||||
|
||||
return(__do_clear_user(mem, len, ¤t->thread.fault_addr,
|
||||
|
|
|
@ -515,7 +515,7 @@ void i8254_timer_resume(void)
|
|||
}
|
||||
|
||||
static struct sysdev_class timer_sysclass = {
|
||||
set_kset_name("timer"),
|
||||
set_kset_name("timer_pit"),
|
||||
.resume = timer_resume,
|
||||
};
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <linux/list.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/pm_legacy.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#ifdef CONFIG_X86
|
||||
|
@ -754,7 +755,7 @@ static int __init acpi_init(void)
|
|||
result = acpi_bus_init();
|
||||
|
||||
if (!result) {
|
||||
#ifdef CONFIG_PM
|
||||
#ifdef CONFIG_PM_LEGACY
|
||||
if (!PM_IS_ACTIVE())
|
||||
pm_active = 1;
|
||||
else {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue