Commit Graph

28 Commits

Author SHA1 Message Date
Robert Jarzmik
ca26475bf0 ARM: pxa: fix GPIO double shifts
The commit 9bf448c66d ("ARM: pxa: use generic gpio operation instead of
gpio register") from Oct 17, 2011, leads to the following static checker
warning:
  arch/arm/mach-pxa/spitz_pm.c:172 spitz_charger_wakeup()
  warn: double left shift '!gpio_get_value(SPITZ_GPIO_KEY_INT)
        << (1 << ((SPITZ_GPIO_KEY_INT) & 31))'

As Dan reported, the value is shifted three times :
 - once by gpio_get_value(), which returns either 0 or BIT(gpio)
 - once by the shift operation '<<'
 - a last time by GPIO_bit(gpio) which is BIT(gpio)

Therefore the calculation lead to a chained or operator of :
 - (1 << gpio) << (1 << gpio) = (2^gpio)^gpio = 2 ^ (gpio * gpio)

It is be sheer luck the former statement works, only because each gpio
used is strictly smaller than 6, and therefore 2^(gpio^2) never
overflows a 32 bits value, and because it is used as a boolean value to
check a gpio activation.

As the xxx_charger_wakeup() functions are used as a true/false detection
mechanism, take that opportunity to change their prototypes from integer
return value to boolean one.

Fixes: 9bf448c66d ("ARM: pxa: use generic gpio operation instead of
gpio register")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
2016-09-09 18:07:59 +02:00
Arnd Bergmann
4c25c5d298 ARM: pxa: make more mach/*.h files local
Lots of header files are never included outside of a mach-pxa
directory and do not need to be made visible in include/mach,
so let's just move them all down one level.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2015-12-01 21:52:50 +01:00
Greg Kroah-Hartman
351a102dbf ARM: drivers: remove __dev* attributes.
CONFIG_HOTPLUG is going away as an option.  As a result, the __dev*
markings need to be removed.

This change removes the use of __devinit, __devexit_p, __devinitdata,
and __devexit from these drivers.

Based on patches originally written by Bill Pemberton, but redone by me
in order to handle some of the coding style issues better, by hand.

Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-03 15:57:04 -08:00
Rob Herring
23019a733b ARM: pxa: use common IOMEM definition
pxa was missed in the moving of IOMEM to a common definition, so lots of
IOMEM redefined warnings were introduced. So remove pxa IOMEM definition
and fix all the fallout.

Reported-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Eric Miao <eric.y.miao@gmail.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Haojian Zhuang <haojian.zhuang@marvell.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: rtc-linux@googlegroups.com
Cc: alsa-devel@alsa-project.org
2012-03-25 14:36:31 -05:00
Haojian Zhuang
6f7c047164 ARM: pxa: fix the build error because of missing gpio-pxa.h
arch/arm/mach-pxa/corgi_pm.c: In function ‘corgi_should_wakeup’:
arch/arm/mach-pxa/corgi_pm.c:102:2: error: implicit declaration of
function ‘GPIO_bit’
make[1]: *** [arch/arm/mach-pxa/corgi_pm.o] Error 1
make: *** [arch/arm/mach-pxa] Error 2

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2011-12-08 16:12:55 +00:00
Haojian Zhuang
9bf448c66d ARM: pxa: use generic gpio operation instead of gpio register
Remove the code of accessing gpio register. Use the generic read
operation instead.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
2011-11-14 21:07:59 +08:00
Eric Miao
04e4ad2354 [ARM] pxa: removed mostly unused and confusing two sharpsl.h
Only a small part of used code is moved into sharpsl_pm.h.

Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
2010-08-05 14:32:38 +08:00
Eric Miao
05732d7eb0 [ARM] pxa: use generic gpio_get_value() instead of READ_GPIO_BIT()
READ_GPIO_BIT() is no way generic by accessing GPIO registers directly,
replace it with gpio_get_value().

Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
2010-08-05 14:32:37 +08:00
Christoph Egger
13a542475d [ARM] pxa: removing dead BACKLIGHT_CORGI
BACKLIGHT_CORGI was later renamed to BACKLIGHT_GENERIC and has not been
used since then. As it's now safe to completely transition to LCD_CORGI
driver, which incorprates both the LCD and backlight device.

Signed-off-by: Christoph Egger <siccegge@cs.fau.de>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
2010-08-05 14:32:30 +08:00
Eric Miao
cb432b358d [ARM] pxa/corgi: cleanup GPIO configurations and low power mode settings
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
2010-05-11 17:25:00 +02:00
Eric Miao
e63f591a8c [ARM] pxa/corgi: use generic GPIO API and remove pxa_gpio_mode()
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
2010-05-11 17:25:00 +02:00
Pavel Machek
0ba01ebcb3 [ARM] pxa/zaurus: rename spitz_battery_levels_* to sharpsl_*
Battery power levels are shared between spitz and corgi, rename
variable to reflect it.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
2009-12-01 09:03:01 +08:00
Dmitry Eremin-Solenikov
d48898a3c8 [ARM] pxa/sharpsl_pm: merge pxa-specific code into generic one
As pxa now is the only user of sharpsl_pm we can drop several startup
functions into generic code thus dropping several global functions.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
2009-06-11 22:20:42 +08:00
Eric Miao
51c62982a3 [ARM] pxa: introduce pxa{25x,27x,300,320,930}.h for board usage
Considering the header mess ATM, it is not always possible to include
the correct header files within board code. Let's keep this simple:

  <mach/pxa25x.h>  - for pxa25x based platforms
  <mach/pxa27x.h>  - for pxa27x based platforms
  <mach/pxa300.h>  - for pxa300 based platforms
  <mach/pxa320.h>  - for pxa320 based platforms
  <mach/pxa930.h>  - for pxa930 based platforms

NOTE:

1. one header one board file, they are not compatible (i.e. they have
   conflicting definitions which won't compile if included together).

2. Unless strictly necessary, the following header files are considered
   to be SoC files use _only_, and is not recommended to be included in
   board code:

    <mach/hardware.h>
    <mach/pxa-regs.h>
    <mach/pxa2xx-regs.h>
    <mach/pxa3xx-regs.h>
    <mach/mfp.h>
    <mach/mfp-pxa2xx.h>
    <mach/mfp-pxa25x.h>
    <mach/mfp-pxa27x.h>
    <mach/mfp-pxa3xx.h>
    <mach/mfp-pxa300.h>
    <mach/mfp-pxa320.h>
    <mach/mfp-pxa930.h>

Signed-off-by: Eric Miao <eric.miao@marvell.com>
2009-03-09 21:22:36 +08:00
Dmitry Baryshkov
5cbff9603a [ARM] corgi_lcd: fix simultaneous compilation with corgi_bl
corgi_lcd has symbol conflict with corgi_bl driver.
Fix it by renaming common symbol in new corgi_lcd driver.

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
2008-10-29 11:45:37 +08:00
Eric Miao
6168cda927 [ARM] pxa/corgi: use generic GPIO API for SCOOP GPIOs
Original patch from Dmitry Baryshkov's inital scoop gpio conversion
work at http://git.infradead.org/users/dbaryshkov/zaurus-2.6.git.

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-09-23 22:04:39 +01:00
Russell King
a09e64fbc0 [ARM] Move include/asm-arm/arch-* to arch/arm/*/include/mach
This just leaves include/asm-arm/plat-* to deal with.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-08-07 09:55:48 +01:00
Russell King
be50972935 [ARM] Remove asm/hardware.h, use asm/arch/hardware.h instead
Remove includes of asm/hardware.h in addition to asm/arch/hardware.h.
Then, since asm/hardware.h only exists to include asm/arch/hardware.h,
update everything to directly include asm/arch/hardware.h and remove
asm/hardware.h.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-08-07 09:40:08 +01:00
Dmitry Baryshkov
043fbc099a [ARM] 5072/1: corgi_pm: don't register devices on non-corgi machines
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Acked-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-06-02 19:33:33 +01:00
Russell King
0b0a9df603 [ARM] pxa: separate out power manager and clock registers
The power manager and core clock registers aren't present in PXA3
CPUs.  Move them out of pxa-regs.h into pxa2xx-regs.h, and include
pxa2xx-regs.h where necessary.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-06-02 19:33:27 +01:00
Russell King
02a8e76979 [ARM] pxa: corgibl_limit_intensity build errors
If CONFIG_BACKLIGHT_CORGI is not selected, then corgibl_limit_intensity()
is not present.  However, both corgi_pm.c and sharp_pm.c reference this
symbol, resulting in a link error.

Wrap the references with the relevant ifdefs, and avoid the resulting
NULL pointer dereference by making the code in sharpsl_pm.c also
conditional on the config symbol.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-05-19 16:25:57 +01:00
eric miao
a683b14df8 [ARM] pxa: separate GPIOs and their mode definitions to pxa2xx-gpio.h
two reasons:
1. GPIO namings and their mode definitions are conceptually not part
   of the PXA register definitions

2. this is actually a temporary move in the transition of PXA2xx to
   use MFP-alike APIs (as what PXA3xx is now doing), so that legacy
   code will still work and new code can be added in step by step

Signed-off-by: eric miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-04-19 11:29:04 +01:00
Russell King
14fca61a98 [ARM] Yet more asm/apm-emulation.h stuff
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2007-03-02 11:58:57 +00:00
Ralf Baechle
75e7153abd [APM] ARM: Convert to use shared APM emulation.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2007-02-09 17:08:58 +00:00
Richard Purdie
f8703dc8cb [ARM] 3564/1: sharpsl_pm: Abstract some machine specific parameters
Patch from Richard Purdie

Abstract some machine specific parameters from the sharpsl_pm core
into the machine specific drivers. This allows the core to support
tosa/poodle.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-06-19 19:58:52 +01:00
Richard Purdie
2c041f4b9b [ARM] 3235/1: SharpSL PM: Fix a gcc4 build error
Patch from Richard Purdie

Fix a gcc4 build error (incomplete element type) in the pxa SharpSL
PM code.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-01-07 11:12:26 +00:00
Richard Purdie
b7557de41a [ARM] 3228/1: SharpSL: Move PM code to arch/arm/common
Patch from Richard Purdie

This patch moves a large chunk of the sharpsl_pm driver to
arch/arm/common so that it can be reused on other devices such as the
SL-5500 (collie). It also abstracts some functions from the core into
the machine and platform specific parts of the driver to aid reuse.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-01-05 20:44:55 +00:00
Richard Purdie
d72f25b0df [ARM] 3158/1: SharpSL: Add PM device driver for the SL-C7x0 machines.
Patch from Richard Purdie

Add a SharpSL PM device driver for the SL-C7x0 machines.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2005-11-13 10:07:46 +00:00