Merge branch 'pxa' into devel
Conflicts: arch/arm/configs/em_x270_defconfig arch/arm/configs/xm_x270_defconfig
This commit is contained in:
commit
044e5f45e4
133 changed files with 9914 additions and 3440 deletions
25
MAINTAINERS
25
MAINTAINERS
|
@ -475,11 +475,28 @@ M: kernel@wantstofly.org
|
|||
L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
|
||||
S: Maintained
|
||||
|
||||
ARM/COMPULAB CM-X270/EM-X270 MACHINE SUPPORT
|
||||
P: Mike Rapoport
|
||||
M: mike@compulab.co.il
|
||||
L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
|
||||
S: Maintained
|
||||
|
||||
ARM/CORGI MACHINE SUPPORT
|
||||
P: Richard Purdie
|
||||
M: rpurdie@rpsys.net
|
||||
S: Maintained
|
||||
|
||||
ARM/EZX SMARTPHONES (A780, A910, A1200, E680, ROKR E2 and ROKR E6)
|
||||
P: Daniel Ribeiro
|
||||
M: drwyrm@gmail.com
|
||||
P: Stefan Schmidt
|
||||
M: stefan@openezx.org
|
||||
P: Harald Welte
|
||||
M: laforge@openezx.org
|
||||
L: openezx-devel@lists.openezx.org (subscribers-only)
|
||||
W: http://www.openezx.org/
|
||||
S: Maintained
|
||||
|
||||
ARM/GLOMATION GESBC9312SX MACHINE SUPPORT
|
||||
P: Lennert Buytenhek
|
||||
M: kernel@wantstofly.org
|
||||
|
@ -567,10 +584,18 @@ L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
|
|||
S: Maintained
|
||||
|
||||
ARM/TOSA MACHINE SUPPORT
|
||||
P: Dmitry Baryshkov
|
||||
M: dbaryshkov@gmail.com
|
||||
P: Dirk Opfer
|
||||
M: dirk@opfer-online.de
|
||||
S: Maintained
|
||||
|
||||
ARM/PALMTX SUPPORT
|
||||
P: Marek Vasut
|
||||
M: marek.vasut@gmail.com
|
||||
W: http://hackndev.com
|
||||
S: Maintained
|
||||
|
||||
ARM/PLEB SUPPORT
|
||||
P: Peter Chubb
|
||||
M: pleb@gelato.unsw.edu.au
|
||||
|
|
|
@ -22,6 +22,9 @@ config ARM
|
|||
Europe. There is an ARM Linux project with a web page at
|
||||
<http://www.arm.linux.org.uk/>.
|
||||
|
||||
config HAVE_PWM
|
||||
bool
|
||||
|
||||
config SYS_SUPPORTS_APM_EMULATION
|
||||
bool
|
||||
|
||||
|
|
|
@ -627,7 +627,7 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq)
|
|||
if (!sachip)
|
||||
return -ENOMEM;
|
||||
|
||||
sachip->clk = clk_get(me, "GPIO27_CLK");
|
||||
sachip->clk = clk_get(me, "SA1111_CLK");
|
||||
if (!sachip->clk) {
|
||||
ret = PTR_ERR(sachip->clk);
|
||||
goto err_free;
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <asm/irq.h>
|
||||
#include <asm/arch/pm.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-regs.h>
|
||||
#include <asm/arch/sharpsl.h>
|
||||
#include <asm/hardware/sharpsl_pm.h>
|
||||
|
||||
|
@ -157,6 +158,7 @@ static void sharpsl_battery_thread(struct work_struct *private_)
|
|||
dev_dbg(sharpsl_pm.dev, "Battery: voltage: %d, status: %d, percentage: %d, time: %ld\n", voltage,
|
||||
sharpsl_pm.battstat.mainbat_status, sharpsl_pm.battstat.mainbat_percent, jiffies);
|
||||
|
||||
#ifdef CONFIG_BACKLIGHT_CORGI
|
||||
/* If battery is low. limit backlight intensity to save power. */
|
||||
if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE)
|
||||
&& ((sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_LOW) ||
|
||||
|
@ -169,6 +171,7 @@ static void sharpsl_battery_thread(struct work_struct *private_)
|
|||
sharpsl_pm.machinfo->backlight_limit(0);
|
||||
sharpsl_pm.flags &= ~SHARPSL_BL_LIMIT;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Suspend if critical battery level */
|
||||
if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE)
|
||||
|
|
File diff suppressed because it is too large
Load diff
1614
arch/arm/configs/ezx_defconfig
Normal file
1614
arch/arm/configs/ezx_defconfig
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -326,11 +326,11 @@ static struct resource ixp4xx_udc_resources[] = {
|
|||
};
|
||||
|
||||
/*
|
||||
* USB device controller. The IXP4xx uses the same controller as PXA2XX,
|
||||
* USB device controller. The IXP4xx uses the same controller as PXA25X,
|
||||
* so we just use the same device.
|
||||
*/
|
||||
static struct platform_device ixp4xx_udc_device = {
|
||||
.name = "pxa2xx-udc",
|
||||
.name = "pxa25x-udc",
|
||||
.id = -1,
|
||||
.num_resources = 2,
|
||||
.resource = ixp4xx_udc_resources,
|
||||
|
|
|
@ -16,19 +16,24 @@ config CPU_PXA310
|
|||
config CPU_PXA320
|
||||
bool "PXA320 (codename Monahans-P)"
|
||||
|
||||
config CPU_PXA930
|
||||
bool "PXA930 (codename Tavor-P)"
|
||||
|
||||
endmenu
|
||||
|
||||
endif
|
||||
|
||||
choice
|
||||
prompt "Select target board"
|
||||
|
||||
config ARCH_GUMSTIX
|
||||
bool "Gumstix XScale boards"
|
||||
help
|
||||
Say Y here if you intend to run this kernel on a
|
||||
Gumstix Full Function Minature Computer.
|
||||
|
||||
config MACH_GUMSTIX_F
|
||||
bool "Basix, Connex, ws-200ax, ws-400ax systems"
|
||||
depends on ARCH_GUMSTIX
|
||||
select PXA25x
|
||||
|
||||
config ARCH_LUBBOCK
|
||||
bool "Intel DBPXA250 Development Platform"
|
||||
select PXA25x
|
||||
|
@ -37,10 +42,12 @@ config ARCH_LUBBOCK
|
|||
config MACH_LOGICPD_PXA270
|
||||
bool "LogicPD PXA270 Card Engine Development Platform"
|
||||
select PXA27x
|
||||
select HAVE_PWM
|
||||
|
||||
config MACH_MAINSTONE
|
||||
bool "Intel HCDDBBVA0 Development Platform"
|
||||
select PXA27x
|
||||
select HAVE_PWM
|
||||
|
||||
config ARCH_PXA_IDP
|
||||
bool "Accelent Xscale IDP"
|
||||
|
@ -57,6 +64,57 @@ config PXA_SHARPSL
|
|||
SL-C3000 (Spitz), SL-C3100 (Borzoi) or SL-C6000x (Tosa)
|
||||
handheld computer.
|
||||
|
||||
config MACH_POODLE
|
||||
bool "Enable Sharp SL-5600 (Poodle) Support"
|
||||
depends on PXA_SHARPSL
|
||||
select PXA25x
|
||||
select SHARP_LOCOMO
|
||||
select PXA_SSP
|
||||
|
||||
config MACH_CORGI
|
||||
bool "Enable Sharp SL-C700 (Corgi) Support"
|
||||
depends on PXA_SHARPSL
|
||||
select PXA25x
|
||||
select PXA_SHARP_C7xx
|
||||
|
||||
config MACH_SHEPHERD
|
||||
bool "Enable Sharp SL-C750 (Shepherd) Support"
|
||||
depends on PXA_SHARPSL
|
||||
select PXA25x
|
||||
select PXA_SHARP_C7xx
|
||||
|
||||
config MACH_HUSKY
|
||||
bool "Enable Sharp SL-C760 (Husky) Support"
|
||||
depends on PXA_SHARPSL
|
||||
select PXA25x
|
||||
select PXA_SHARP_C7xx
|
||||
|
||||
config MACH_AKITA
|
||||
bool "Enable Sharp SL-1000 (Akita) Support"
|
||||
depends on PXA_SHARPSL
|
||||
select PXA27x
|
||||
select PXA_SHARP_Cxx00
|
||||
select MACH_SPITZ
|
||||
select I2C
|
||||
select I2C_PXA
|
||||
|
||||
config MACH_SPITZ
|
||||
bool "Enable Sharp Zaurus SL-3000 (Spitz) Support"
|
||||
depends on PXA_SHARPSL
|
||||
select PXA27x
|
||||
select PXA_SHARP_Cxx00
|
||||
|
||||
config MACH_BORZOI
|
||||
bool "Enable Sharp Zaurus SL-3100 (Borzoi) Support"
|
||||
depends on PXA_SHARPSL
|
||||
select PXA27x
|
||||
select PXA_SHARP_Cxx00
|
||||
|
||||
config MACH_TOSA
|
||||
bool "Enable Sharp SL-6000x (Tosa) Support"
|
||||
depends on PXA_SHARPSL
|
||||
select PXA25x
|
||||
|
||||
config ARCH_PXA_ESERIES
|
||||
bool "PXA based Toshiba e-series PDAs"
|
||||
select PXA25x
|
||||
|
@ -69,10 +127,19 @@ config MACH_E330
|
|||
Say Y here if you intend to run this kernel on a Toshiba
|
||||
e330 family PDA.
|
||||
|
||||
config MACH_E350
|
||||
bool "Toshiba e350"
|
||||
default y
|
||||
depends on ARCH_PXA_ESERIES
|
||||
help
|
||||
Say Y here if you intend to run this kernel on a Toshiba
|
||||
e350 family PDA.
|
||||
|
||||
config MACH_E740
|
||||
bool "Toshiba e740"
|
||||
default y
|
||||
depends on ARCH_PXA_ESERIES
|
||||
select FB_W100
|
||||
help
|
||||
Say Y here if you intend to run this kernel on a Toshiba
|
||||
e740 family PDA.
|
||||
|
@ -81,6 +148,7 @@ config MACH_E750
|
|||
bool "Toshiba e750"
|
||||
default y
|
||||
depends on ARCH_PXA_ESERIES
|
||||
select FB_W100
|
||||
help
|
||||
Say Y here if you intend to run this kernel on a Toshiba
|
||||
e750 family PDA.
|
||||
|
@ -97,6 +165,7 @@ config MACH_E800
|
|||
bool "Toshiba e800"
|
||||
default y
|
||||
depends on ARCH_PXA_ESERIES
|
||||
select FB_W100
|
||||
help
|
||||
Say Y here if you intend to run this kernel on a Toshiba
|
||||
e800 family PDA.
|
||||
|
@ -105,6 +174,10 @@ config MACH_TRIZEPS4
|
|||
bool "Keith und Koep Trizeps4 DIMM-Module"
|
||||
select PXA27x
|
||||
|
||||
config MACH_TRIZEPS4_CONXS
|
||||
bool "ConXS Eval Board"
|
||||
depends on MACH_TRIZEPS4
|
||||
|
||||
config MACH_EM_X270
|
||||
bool "CompuLab EM-x270 platform"
|
||||
select PXA27x
|
||||
|
@ -114,14 +187,25 @@ config MACH_COLIBRI
|
|||
select PXA27x
|
||||
|
||||
config MACH_ZYLONITE
|
||||
bool "PXA3xx Development Platform"
|
||||
bool "PXA3xx Development Platform (aka Zylonite)"
|
||||
select PXA3xx
|
||||
select HAVE_PWM
|
||||
|
||||
config MACH_LITTLETON
|
||||
bool "PXA3xx Form Factor Platform (aka Littleton)"
|
||||
select PXA3xx
|
||||
select PXA_SSP
|
||||
|
||||
config MACH_TAVOREVB
|
||||
bool "PXA930 Evaluation Board (aka TavorEVB)"
|
||||
select PXA3xx
|
||||
select PXA930
|
||||
|
||||
config MACH_SAAR
|
||||
bool "PXA930 Handheld Platform (aka SAAR)"
|
||||
select PXA3xx
|
||||
select PXA930
|
||||
|
||||
config MACH_ARMCORE
|
||||
bool "CompuLab CM-X270 modules"
|
||||
select PXA27x
|
||||
|
@ -129,7 +213,6 @@ config MACH_ARMCORE
|
|||
|
||||
config MACH_MAGICIAN
|
||||
bool "Enable HTC Magician Support"
|
||||
depends on ARCH_PXA
|
||||
select PXA27x
|
||||
select IWMMXT
|
||||
|
||||
|
@ -137,109 +220,81 @@ config MACH_PCM027
|
|||
bool "Phytec phyCORE-PXA270 CPU module (PCM-027)"
|
||||
select PXA27x
|
||||
select IWMMXT
|
||||
select PXA_SSP
|
||||
|
||||
endchoice
|
||||
config ARCH_PXA_PALM
|
||||
bool "PXA based Palm PDAs"
|
||||
select HAVE_PWM
|
||||
|
||||
choice
|
||||
prompt "Used baseboard"
|
||||
depends on MACH_PCM027
|
||||
config MACH_PALMTX
|
||||
bool "Palm T|X"
|
||||
default y
|
||||
depends on ARCH_PXA_PALM
|
||||
select PXA27x
|
||||
select IWMMXT
|
||||
help
|
||||
Say Y here if you intend to run this kernel on a Palm T|X
|
||||
handheld computer.
|
||||
|
||||
config MACH_PCM990_BASEBOARD
|
||||
bool "PHYTEC PCM-990 development board"
|
||||
select HAVE_PWM
|
||||
depends on MACH_PCM027
|
||||
|
||||
choice
|
||||
prompt "display on pcm990"
|
||||
depends on MACH_PCM990_BASEBOARD
|
||||
|
||||
config PCM990_DISPLAY_SHARP
|
||||
bool "sharp lq084v1dg21 stn display"
|
||||
|
||||
config PCM990_DISPLAY_NEC
|
||||
bool "nec nl6448bc20_18d tft display"
|
||||
|
||||
config PCM990_DISPLAY_NONE
|
||||
bool "no display"
|
||||
|
||||
endchoice
|
||||
|
||||
if PXA_SHARPSL
|
||||
|
||||
choice
|
||||
prompt "Select target Sharp Zaurus device range"
|
||||
|
||||
config PXA_SHARPSL_25x
|
||||
bool "Sharp PXA25x models (SL-5600, SL-C7xx and SL-C6000x)"
|
||||
select PXA25x
|
||||
|
||||
config PXA_SHARPSL_27x
|
||||
bool "Sharp PXA270 models (SL-Cxx00)"
|
||||
config PXA_EZX
|
||||
bool "Motorola EZX Platform"
|
||||
select PXA27x
|
||||
select IWMMXT
|
||||
select HAVE_PWM
|
||||
|
||||
endchoice
|
||||
config MACH_EZX_A780
|
||||
bool "Motorola EZX A780"
|
||||
default y
|
||||
depends on PXA_EZX
|
||||
|
||||
endif
|
||||
config MACH_EZX_E680
|
||||
bool "Motorola EZX E680"
|
||||
default y
|
||||
depends on PXA_EZX
|
||||
|
||||
if ARCH_GUMSTIX
|
||||
config MACH_EZX_A1200
|
||||
bool "Motorola EZX A1200"
|
||||
default y
|
||||
depends on PXA_EZX
|
||||
|
||||
choice
|
||||
prompt "Select target Gumstix board"
|
||||
config MACH_EZX_A910
|
||||
bool "Motorola EZX A910"
|
||||
default y
|
||||
depends on PXA_EZX
|
||||
|
||||
config MACH_GUMSTIX_F
|
||||
bool "Basix, Connex, ws-200ax, ws-400ax systems"
|
||||
select PXA25x
|
||||
config MACH_EZX_E6
|
||||
bool "Motorola EZX E6"
|
||||
default y
|
||||
depends on PXA_EZX
|
||||
|
||||
endchoice
|
||||
|
||||
endif
|
||||
|
||||
|
||||
if MACH_TRIZEPS4
|
||||
|
||||
choice
|
||||
prompt "Select base board for Trizeps 4 module"
|
||||
|
||||
config MACH_TRIZEPS4_CONXS
|
||||
bool "ConXS Eval Board"
|
||||
|
||||
config MACH_TRIZEPS4_ANY
|
||||
bool "another Board"
|
||||
|
||||
endchoice
|
||||
|
||||
endif
|
||||
config MACH_EZX_E2
|
||||
bool "Motorola EZX E2"
|
||||
default y
|
||||
depends on PXA_EZX
|
||||
|
||||
endmenu
|
||||
|
||||
config MACH_POODLE
|
||||
bool "Enable Sharp SL-5600 (Poodle) Support"
|
||||
depends on PXA_SHARPSL_25x
|
||||
select SHARP_LOCOMO
|
||||
select PXA_SSP
|
||||
|
||||
config MACH_CORGI
|
||||
bool "Enable Sharp SL-C700 (Corgi) Support"
|
||||
depends on PXA_SHARPSL_25x
|
||||
select PXA_SHARP_C7xx
|
||||
|
||||
config MACH_SHEPHERD
|
||||
bool "Enable Sharp SL-C750 (Shepherd) Support"
|
||||
depends on PXA_SHARPSL_25x
|
||||
select PXA_SHARP_C7xx
|
||||
|
||||
config MACH_HUSKY
|
||||
bool "Enable Sharp SL-C760 (Husky) Support"
|
||||
depends on PXA_SHARPSL_25x
|
||||
select PXA_SHARP_C7xx
|
||||
|
||||
config MACH_AKITA
|
||||
bool "Enable Sharp SL-1000 (Akita) Support"
|
||||
depends on PXA_SHARPSL_27x
|
||||
select PXA_SHARP_Cxx00
|
||||
select MACH_SPITZ
|
||||
select I2C
|
||||
select I2C_PXA
|
||||
|
||||
config MACH_SPITZ
|
||||
bool "Enable Sharp Zaurus SL-3000 (Spitz) Support"
|
||||
depends on PXA_SHARPSL_27x
|
||||
select PXA_SHARP_Cxx00
|
||||
|
||||
config MACH_BORZOI
|
||||
bool "Enable Sharp Zaurus SL-3100 (Borzoi) Support"
|
||||
depends on PXA_SHARPSL_27x
|
||||
select PXA_SHARP_Cxx00
|
||||
|
||||
config MACH_TOSA
|
||||
bool "Enable Sharp SL-6000x (Tosa) Support"
|
||||
depends on PXA_SHARPSL_25x
|
||||
|
||||
config PXA25x
|
||||
bool
|
||||
help
|
||||
|
@ -273,4 +328,19 @@ config PXA_SSP
|
|||
tristate
|
||||
help
|
||||
Enable support for PXA2xx SSP ports
|
||||
|
||||
config PXA_PWM
|
||||
tristate
|
||||
default BACKLIGHT_PWM
|
||||
help
|
||||
Enable support for PXA2xx/PXA3xx PWM controllers
|
||||
|
||||
config TOSA_BT
|
||||
tristate "Control the state of built-in bluetooth chip on Sharp SL-6000"
|
||||
depends on MACH_TOSA
|
||||
select RFKILL
|
||||
help
|
||||
This is a simple driver that is able to control
|
||||
the state of built in bluetooth chip on tosa.
|
||||
|
||||
endif
|
||||
|
|
|
@ -4,19 +4,21 @@
|
|||
|
||||
# Common support (must be linked before board specific support)
|
||||
obj-y += clock.o devices.o generic.o irq.o dma.o \
|
||||
time.o gpio.o
|
||||
time.o gpio.o reset.o
|
||||
obj-$(CONFIG_PM) += pm.o sleep.o standby.o
|
||||
obj-$(CONFIG_CPU_FREQ) += cpu-pxa.o
|
||||
|
||||
# Generic drivers that other drivers may depend upon
|
||||
obj-$(CONFIG_PXA_SSP) += ssp.o
|
||||
obj-$(CONFIG_PXA_PWM) += pwm.o
|
||||
|
||||
# SoC-specific code
|
||||
obj-$(CONFIG_PXA25x) += mfp-pxa2xx.o pxa25x.o
|
||||
obj-$(CONFIG_PXA27x) += mfp-pxa2xx.o pxa27x.o
|
||||
obj-$(CONFIG_PXA25x) += mfp-pxa2xx.o pxa2xx.o pxa25x.o
|
||||
obj-$(CONFIG_PXA27x) += mfp-pxa2xx.o pxa2xx.o pxa27x.o
|
||||
obj-$(CONFIG_PXA3xx) += mfp-pxa3xx.o pxa3xx.o smemc.o
|
||||
obj-$(CONFIG_CPU_PXA300) += pxa300.o
|
||||
obj-$(CONFIG_CPU_PXA320) += pxa320.o
|
||||
obj-$(CONFIG_CPU_PXA930) += pxa930.o
|
||||
|
||||
# Specific board support
|
||||
obj-$(CONFIG_ARCH_GUMSTIX) += gumstix.o
|
||||
|
@ -35,7 +37,12 @@ obj-$(CONFIG_MACH_PCM990_BASEBOARD) += pcm990-baseboard.o
|
|||
obj-$(CONFIG_MACH_TOSA) += tosa.o
|
||||
obj-$(CONFIG_MACH_EM_X270) += em-x270.o
|
||||
obj-$(CONFIG_MACH_MAGICIAN) += magician.o
|
||||
obj-$(CONFIG_ARCH_PXA_ESERIES) += eseries.o
|
||||
obj-$(CONFIG_ARCH_PXA_ESERIES) += eseries.o eseries_udc.o
|
||||
obj-$(CONFIG_MACH_E740) += e740_lcd.o
|
||||
obj-$(CONFIG_MACH_E750) += e750_lcd.o
|
||||
obj-$(CONFIG_MACH_E400) += e400_lcd.o
|
||||
obj-$(CONFIG_MACH_E800) += e800_lcd.o
|
||||
obj-$(CONFIG_MACH_PALMTX) += palmtx.o
|
||||
|
||||
ifeq ($(CONFIG_MACH_ZYLONITE),y)
|
||||
obj-y += zylonite.o
|
||||
|
@ -43,8 +50,11 @@ ifeq ($(CONFIG_MACH_ZYLONITE),y)
|
|||
obj-$(CONFIG_CPU_PXA320) += zylonite_pxa320.o
|
||||
endif
|
||||
obj-$(CONFIG_MACH_LITTLETON) += littleton.o
|
||||
obj-$(CONFIG_MACH_TAVOREVB) += tavorevb.o
|
||||
obj-$(CONFIG_MACH_SAAR) += saar.o
|
||||
|
||||
obj-$(CONFIG_MACH_ARMCORE) += cm-x270.o
|
||||
obj-$(CONFIG_PXA_EZX) += ezx.o
|
||||
|
||||
# Support for blinky lights
|
||||
led-y := leds.o
|
||||
|
@ -58,3 +68,5 @@ obj-$(CONFIG_LEDS) += $(led-y)
|
|||
ifeq ($(CONFIG_PCI),y)
|
||||
obj-$(CONFIG_MACH_ARMCORE) += cm-x270-pci.o
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_TOSA_BT) += tosa-bt.o
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <linux/platform_device.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-regs.h>
|
||||
#include <asm/arch/pxa2xx-gpio.h>
|
||||
#include <asm/hardware.h>
|
||||
|
||||
|
@ -47,6 +47,9 @@ struct clk *clk_get(struct device *dev, const char *id)
|
|||
clk = p;
|
||||
mutex_unlock(&clocks_mutex);
|
||||
|
||||
if (!IS_ERR(clk) && clk->ops == NULL)
|
||||
clk = clk->other;
|
||||
|
||||
return clk;
|
||||
}
|
||||
EXPORT_SYMBOL(clk_get);
|
||||
|
@ -98,21 +101,6 @@ unsigned long clk_get_rate(struct clk *clk)
|
|||
EXPORT_SYMBOL(clk_get_rate);
|
||||
|
||||
|
||||
static void clk_gpio27_enable(struct clk *clk)
|
||||
{
|
||||
pxa_gpio_mode(GPIO11_3_6MHz_MD);
|
||||
}
|
||||
|
||||
static void clk_gpio27_disable(struct clk *clk)
|
||||
{
|
||||
}
|
||||
|
||||
static const struct clkops clk_gpio27_ops = {
|
||||
.enable = clk_gpio27_enable,
|
||||
.disable = clk_gpio27_disable,
|
||||
};
|
||||
|
||||
|
||||
void clk_cken_enable(struct clk *clk)
|
||||
{
|
||||
CKEN |= 1 << clk->cken;
|
||||
|
@ -128,14 +116,6 @@ const struct clkops clk_cken_ops = {
|
|||
.disable = clk_cken_disable,
|
||||
};
|
||||
|
||||
static struct clk common_clks[] = {
|
||||
{
|
||||
.name = "GPIO27_CLK",
|
||||
.ops = &clk_gpio27_ops,
|
||||
.rate = 3686400,
|
||||
},
|
||||
};
|
||||
|
||||
void clks_register(struct clk *clks, size_t num)
|
||||
{
|
||||
int i;
|
||||
|
@ -145,10 +125,3 @@ void clks_register(struct clk *clks, size_t num)
|
|||
list_add(&clks[i].node, &clocks);
|
||||
mutex_unlock(&clocks_mutex);
|
||||
}
|
||||
|
||||
static int __init clk_init(void)
|
||||
{
|
||||
clks_register(common_clks, ARRAY_SIZE(common_clks));
|
||||
return 0;
|
||||
}
|
||||
arch_initcall(clk_init);
|
||||
|
|
|
@ -15,6 +15,7 @@ struct clk {
|
|||
unsigned int cken;
|
||||
unsigned int delay;
|
||||
unsigned int enabled;
|
||||
struct clk *other;
|
||||
};
|
||||
|
||||
#define INIT_CKEN(_name, _cken, _rate, _delay, _dev) \
|
||||
|
@ -35,9 +36,53 @@ struct clk {
|
|||
.cken = CKEN_##_cken, \
|
||||
}
|
||||
|
||||
/*
|
||||
* This is a placeholder to alias one clock device+name pair
|
||||
* to another struct clk.
|
||||
*/
|
||||
#define INIT_CKOTHER(_name, _other, _dev) \
|
||||
{ \
|
||||
.name = _name, \
|
||||
.dev = _dev, \
|
||||
.other = _other, \
|
||||
}
|
||||
|
||||
#define INIT_CLK(_name, _ops, _rate, _delay, _dev) \
|
||||
{ \
|
||||
.name = _name, \
|
||||
.dev = _dev, \
|
||||
.ops = _ops, \
|
||||
.rate = _rate, \
|
||||
.delay = _delay, \
|
||||
}
|
||||
|
||||
extern const struct clkops clk_cken_ops;
|
||||
|
||||
void clk_cken_enable(struct clk *clk);
|
||||
void clk_cken_disable(struct clk *clk);
|
||||
|
||||
#ifdef CONFIG_PXA3xx
|
||||
#define PXA3xx_CKEN(_name, _cken, _rate, _delay, _dev) \
|
||||
{ \
|
||||
.name = _name, \
|
||||
.dev = _dev, \
|
||||
.ops = &clk_pxa3xx_cken_ops, \
|
||||
.rate = _rate, \
|
||||
.cken = CKEN_##_cken, \
|
||||
.delay = _delay, \
|
||||
}
|
||||
|
||||
#define PXA3xx_CK(_name, _cken, _ops, _dev) \
|
||||
{ \
|
||||
.name = _name, \
|
||||
.dev = _dev, \
|
||||
.ops = _ops, \
|
||||
.cken = CKEN_##_cken, \
|
||||
}
|
||||
|
||||
extern const struct clkops clk_pxa3xx_cken_ops;
|
||||
extern void clk_pxa3xx_cken_enable(struct clk *);
|
||||
extern void clk_pxa3xx_cken_disable(struct clk *);
|
||||
#endif
|
||||
|
||||
void clks_register(struct clk *clks, size_t num);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*
|
||||
* Bits taken from various places.
|
||||
*
|
||||
* Copyright (C) 2007 Compulab, Ltd.
|
||||
* Copyright (C) 2007, 2008 Compulab, Ltd.
|
||||
* Mike Rapoport <mike@compulab.co.il>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -19,16 +19,16 @@
|
|||
#include <linux/device.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#include <asm/mach/pci.h>
|
||||
#include <asm/arch/cm-x270.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-gpio.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include <asm/hardware/it8152.h>
|
||||
|
||||
unsigned long it8152_base_address = CMX270_IT8152_VIRT;
|
||||
unsigned long it8152_base_address;
|
||||
static int cmx270_it8152_irq_gpio;
|
||||
|
||||
/*
|
||||
* Only first 64MB of memory can be accessed via PCI.
|
||||
|
@ -41,36 +41,39 @@ void __init cmx270_pci_adjust_zones(int node, unsigned long *zone_size,
|
|||
{
|
||||
unsigned int sz = SZ_64M >> PAGE_SHIFT;
|
||||
|
||||
pr_info("Adjusting zones for CM-x270\n");
|
||||
if (machine_is_armcore()) {
|
||||
pr_info("Adjusting zones for CM-X270\n");
|
||||
|
||||
/*
|
||||
* Only adjust if > 64M on current system
|
||||
*/
|
||||
if (node || (zone_size[0] <= sz))
|
||||
return;
|
||||
/*
|
||||
* Only adjust if > 64M on current system
|
||||
*/
|
||||
if (node || (zone_size[0] <= sz))
|
||||
return;
|
||||
|
||||
zone_size[1] = zone_size[0] - sz;
|
||||
zone_size[0] = sz;
|
||||
zhole_size[1] = zhole_size[0];
|
||||
zhole_size[0] = 0;
|
||||
zone_size[1] = zone_size[0] - sz;
|
||||
zone_size[0] = sz;
|
||||
zhole_size[1] = zhole_size[0];
|
||||
zhole_size[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void cmx270_it8152_irq_demux(unsigned int irq, struct irq_desc *desc)
|
||||
{
|
||||
/* clear our parent irq */
|
||||
GEDR(GPIO_IT8152_IRQ) = GPIO_bit(GPIO_IT8152_IRQ);
|
||||
GEDR(cmx270_it8152_irq_gpio) = GPIO_bit(cmx270_it8152_irq_gpio);
|
||||
|
||||
it8152_irq_demux(irq, desc);
|
||||
}
|
||||
|
||||
void __cmx270_pci_init_irq(void)
|
||||
void __cmx270_pci_init_irq(int irq_gpio)
|
||||
{
|
||||
it8152_init_irq();
|
||||
pxa_gpio_mode(IRQ_TO_GPIO(GPIO_IT8152_IRQ));
|
||||
set_irq_type(IRQ_GPIO(GPIO_IT8152_IRQ), IRQT_RISING);
|
||||
|
||||
set_irq_chained_handler(IRQ_GPIO(GPIO_IT8152_IRQ),
|
||||
cmx270_it8152_irq_demux);
|
||||
cmx270_it8152_irq_gpio = irq_gpio;
|
||||
|
||||
set_irq_type(gpio_to_irq(irq_gpio), IRQT_RISING);
|
||||
|
||||
set_irq_chained_handler(gpio_to_irq(irq_gpio), cmx270_it8152_irq_demux);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
@ -113,8 +116,8 @@ static int __init cmx270_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
|
|||
|
||||
/*
|
||||
Here comes the ugly part. The routing is baseboard specific,
|
||||
but defining a platform for each possible base of CM-x270 is
|
||||
unrealistic. Here we keep mapping for ATXBase and SB-x270.
|
||||
but defining a platform for each possible base of CM-X270 is
|
||||
unrealistic. Here we keep mapping for ATXBase and SB-X270.
|
||||
*/
|
||||
/* ATXBASE PCI slot */
|
||||
if (slot == 7)
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
extern void __cmx270_pci_init_irq(void);
|
||||
extern void __cmx270_pci_init_irq(int irq_gpio);
|
||||
extern void __cmx270_pci_suspend(void);
|
||||
extern void __cmx270_pci_resume(void);
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
#define cmx270_pci_init_irq __cmx270_pci_init_irq
|
||||
#define cmx270_pci_suspend __cmx270_pci_suspend
|
||||
#define cmx270_pci_resume __cmx270_pci_resume
|
||||
#define cmx270_pci_init_irq(x) __cmx270_pci_init_irq(x)
|
||||
#define cmx270_pci_suspend(x) __cmx270_pci_suspend(x)
|
||||
#define cmx270_pci_resume(x) __cmx270_pci_resume(x)
|
||||
#else
|
||||
#define cmx270_pci_init_irq() do {} while (0)
|
||||
#define cmx270_pci_suspend() do {} while (0)
|
||||
#define cmx270_pci_resume() do {} while (0)
|
||||
#define cmx270_pci_init_irq(x) do {} while (0)
|
||||
#define cmx270_pci_suspend(x) do {} while (0)
|
||||
#define cmx270_pci_resume(x) do {} while (0)
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* linux/arch/arm/mach-pxa/cm-x270.c
|
||||
*
|
||||
* Copyright (C) 2007 CompuLab, Ltd.
|
||||
* Copyright (C) 2007, 2008 CompuLab, Ltd.
|
||||
* Mike Rapoport <mike@compulab.co.il>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -9,43 +9,156 @@
|
|||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/sysdev.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#include <linux/dm9000.h>
|
||||
#include <linux/rtc-v3020.h>
|
||||
#include <linux/serial_8250.h>
|
||||
|
||||
#include <video/mbxfb.h>
|
||||
#include <linux/leds.h>
|
||||
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-regs.h>
|
||||
#include <asm/arch/pxa2xx-gpio.h>
|
||||
#include <asm/arch/mfp-pxa27x.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/audio.h>
|
||||
#include <asm/arch/pxafb.h>
|
||||
#include <asm/arch/ohci.h>
|
||||
#include <asm/arch/mmc.h>
|
||||
#include <asm/arch/bitfield.h>
|
||||
#include <asm/arch/cm-x270.h>
|
||||
|
||||
#include <asm/hardware/it8152.h>
|
||||
|
||||
#include "generic.h"
|
||||
#include "cm-x270-pci.h"
|
||||
|
||||
/* virtual addresses for statically mapped regions */
|
||||
#define CMX270_VIRT_BASE (0xe8000000)
|
||||
#define CMX270_IT8152_VIRT (CMX270_VIRT_BASE)
|
||||
|
||||
#define RTC_PHYS_BASE (PXA_CS1_PHYS + (5 << 22))
|
||||
#define DM9000_PHYS_BASE (PXA_CS1_PHYS + (6 << 22))
|
||||
|
||||
static struct resource cmx270_dm9k_resource[] = {
|
||||
/* GPIO IRQ usage */
|
||||
#define GPIO10_ETHIRQ (10)
|
||||
#define GPIO22_IT8152_IRQ (22)
|
||||
#define GPIO83_MMC_IRQ (83)
|
||||
#define GPIO95_GFXIRQ (95)
|
||||
|
||||
#define CMX270_ETHIRQ IRQ_GPIO(GPIO10_ETHIRQ)
|
||||
#define CMX270_IT8152_IRQ IRQ_GPIO(GPIO22_IT8152_IRQ)
|
||||
#define CMX270_MMC_IRQ IRQ_GPIO(GPIO83_MMC_IRQ)
|
||||
#define CMX270_GFXIRQ IRQ_GPIO(GPIO95_GFXIRQ)
|
||||
|
||||
/* MMC power enable */
|
||||
#define GPIO105_MMC_POWER (105)
|
||||
|
||||
static unsigned long cmx270_pin_config[] = {
|
||||
/* AC'97 */
|
||||
GPIO28_AC97_BITCLK,
|
||||
GPIO29_AC97_SDATA_IN_0,
|
||||
GPIO30_AC97_SDATA_OUT,
|
||||
GPIO31_AC97_SYNC,
|
||||
GPIO98_AC97_SYSCLK,
|
||||
GPIO113_AC97_nRESET,
|
||||
|
||||
/* BTUART */
|
||||
GPIO42_BTUART_RXD,
|
||||
GPIO43_BTUART_TXD,
|
||||
GPIO44_BTUART_CTS,
|
||||
GPIO45_BTUART_RTS,
|
||||
|
||||
/* STUART */
|
||||
GPIO46_STUART_RXD,
|
||||
GPIO47_STUART_TXD,
|
||||
|
||||
/* MCI controller */
|
||||
GPIO32_MMC_CLK,
|
||||
GPIO112_MMC_CMD,
|
||||
GPIO92_MMC_DAT_0,
|
||||
GPIO109_MMC_DAT_1,
|
||||
GPIO110_MMC_DAT_2,
|
||||
GPIO111_MMC_DAT_3,
|
||||
|
||||
/* LCD */
|
||||
GPIO58_LCD_LDD_0,
|
||||
GPIO59_LCD_LDD_1,
|
||||
GPIO60_LCD_LDD_2,
|
||||
GPIO61_LCD_LDD_3,
|
||||
GPIO62_LCD_LDD_4,
|
||||
GPIO63_LCD_LDD_5,
|
||||
GPIO64_LCD_LDD_6,
|
||||
GPIO65_LCD_LDD_7,
|
||||
GPIO66_LCD_LDD_8,
|
||||
GPIO67_LCD_LDD_9,
|
||||
GPIO68_LCD_LDD_10,
|
||||
GPIO69_LCD_LDD_11,
|
||||
GPIO70_LCD_LDD_12,
|
||||
GPIO71_LCD_LDD_13,
|
||||
GPIO72_LCD_LDD_14,
|
||||
GPIO73_LCD_LDD_15,
|
||||
GPIO74_LCD_FCLK,
|
||||
GPIO75_LCD_LCLK,
|
||||
GPIO76_LCD_PCLK,
|
||||
GPIO77_LCD_BIAS,
|
||||
|
||||
/* I2C */
|
||||
GPIO117_I2C_SCL,
|
||||
GPIO118_I2C_SDA,
|
||||
|
||||
/* SSP1 */
|
||||
GPIO23_SSP1_SCLK,
|
||||
GPIO24_SSP1_SFRM,
|
||||
GPIO25_SSP1_TXD,
|
||||
GPIO26_SSP1_RXD,
|
||||
|
||||
/* SSP2 */
|
||||
GPIO19_SSP2_SCLK,
|
||||
GPIO14_SSP2_SFRM,
|
||||
GPIO87_SSP2_TXD,
|
||||
GPIO88_SSP2_RXD,
|
||||
|
||||
/* PC Card */
|
||||
GPIO48_nPOE,
|
||||
GPIO49_nPWE,
|
||||
GPIO50_nPIOR,
|
||||
GPIO51_nPIOW,
|
||||
GPIO85_nPCE_1,
|
||||
GPIO54_nPCE_2,
|
||||
GPIO55_nPREG,
|
||||
GPIO56_nPWAIT,
|
||||
GPIO57_nIOIS16,
|
||||
|
||||
/* SDRAM and local bus */
|
||||
GPIO15_nCS_1,
|
||||
GPIO78_nCS_2,
|
||||
GPIO79_nCS_3,
|
||||
GPIO80_nCS_4,
|
||||
GPIO33_nCS_5,
|
||||
GPIO49_nPWE,
|
||||
GPIO18_RDY,
|
||||
|
||||
/* GPIO */
|
||||
GPIO0_GPIO | WAKEUP_ON_EDGE_BOTH,
|
||||
GPIO105_GPIO | MFP_LPM_DRIVE_HIGH, /* MMC/SD power */
|
||||
GPIO53_GPIO, /* PC card reset */
|
||||
|
||||
/* NAND controls */
|
||||
GPIO11_GPIO | MFP_LPM_DRIVE_HIGH, /* NAND CE# */
|
||||
GPIO89_GPIO, /* NAND Ready/Busy */
|
||||
|
||||
/* interrupts */
|
||||
GPIO10_GPIO, /* DM9000 interrupt */
|
||||
GPIO83_GPIO, /* MMC card detect */
|
||||
};
|
||||
|
||||
#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
|
||||
static struct resource cmx270_dm9000_resource[] = {
|
||||
[0] = {
|
||||
.start = DM9000_PHYS_BASE,
|
||||
.end = DM9000_PHYS_BASE + 4,
|
||||
|
@ -63,37 +176,45 @@ static struct resource cmx270_dm9k_resource[] = {
|
|||
}
|
||||
};
|
||||
|
||||
/* for the moment we limit ourselves to 32bit IO until some
|
||||
* better IO routines can be written and tested
|
||||
*/
|
||||
static struct dm9000_plat_data cmx270_dm9k_platdata = {
|
||||
static struct dm9000_plat_data cmx270_dm9000_platdata = {
|
||||
.flags = DM9000_PLATF_32BITONLY,
|
||||
};
|
||||
|
||||
/* Ethernet device */
|
||||
static struct platform_device cmx270_device_dm9k = {
|
||||
static struct platform_device cmx270_dm9000_device = {
|
||||
.name = "dm9000",
|
||||
.id = 0,
|
||||
.num_resources = ARRAY_SIZE(cmx270_dm9k_resource),
|
||||
.resource = cmx270_dm9k_resource,
|
||||
.num_resources = ARRAY_SIZE(cmx270_dm9000_resource),
|
||||
.resource = cmx270_dm9000_resource,
|
||||
.dev = {
|
||||
.platform_data = &cmx270_dm9k_platdata,
|
||||
.platform_data = &cmx270_dm9000_platdata,
|
||||
}
|
||||
};
|
||||
|
||||
/* audio device */
|
||||
static struct platform_device cmx270_audio_device = {
|
||||
.name = "pxa2xx-ac97",
|
||||
.id = -1,
|
||||
};
|
||||
static void __init cmx270_init_dm9000(void)
|
||||
{
|
||||
platform_device_register(&cmx270_dm9000_device);
|
||||
}
|
||||
#else
|
||||
static inline void cmx270_init_dm9000(void) {}
|
||||
#endif
|
||||
|
||||
/* touchscreen controller */
|
||||
/* UCB1400 touchscreen controller */
|
||||
#if defined(CONFIG_TOUCHSCREEN_UCB1400) || defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
|
||||
static struct platform_device cmx270_ts_device = {
|
||||
.name = "ucb1400_ts",
|
||||
.id = -1,
|
||||
};
|
||||
|
||||
/* RTC */
|
||||
static void __init cmx270_init_touchscreen(void)
|
||||
{
|
||||
platform_device_register(&cmx270_ts_device);
|
||||
}
|
||||
#else
|
||||
static inline void cmx270_init_touchscreen(void) {}
|
||||
#endif
|
||||
|
||||
/* V3020 RTC */
|
||||
#if defined(CONFIG_RTC_DRV_V3020) || defined(CONFIG_RTC_DRV_V3020_MODULE)
|
||||
static struct resource cmx270_v3020_resource[] = {
|
||||
[0] = {
|
||||
.start = RTC_PHYS_BASE,
|
||||
|
@ -116,28 +237,67 @@ static struct platform_device cmx270_rtc_device = {
|
|||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* CM-X270 LEDs
|
||||
*/
|
||||
static struct platform_device cmx270_led_device = {
|
||||
.name = "cm-x270-led",
|
||||
.id = -1,
|
||||
static void __init cmx270_init_rtc(void)
|
||||
{
|
||||
platform_device_register(&cmx270_rtc_device);
|
||||
}
|
||||
#else
|
||||
static inline void cmx270_init_rtc(void) {}
|
||||
#endif
|
||||
|
||||
/* CM-X270 LEDs */
|
||||
#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
|
||||
static struct gpio_led cmx270_leds[] = {
|
||||
[0] = {
|
||||
.name = "cm-x270:red",
|
||||
.default_trigger = "nand-disk",
|
||||
.gpio = 93,
|
||||
.active_low = 1,
|
||||
},
|
||||
[1] = {
|
||||
.name = "cm-x270:green",
|
||||
.default_trigger = "heartbeat",
|
||||
.gpio = 94,
|
||||
.active_low = 1,
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpio_led_platform_data cmx270_gpio_led_pdata = {
|
||||
.num_leds = ARRAY_SIZE(cmx270_leds),
|
||||
.leds = cmx270_leds,
|
||||
};
|
||||
|
||||
static struct platform_device cmx270_led_device = {
|
||||
.name = "leds-gpio",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &cmx270_gpio_led_pdata,
|
||||
},
|
||||
};
|
||||
|
||||
static void __init cmx270_init_leds(void)
|
||||
{
|
||||
platform_device_register(&cmx270_led_device);
|
||||
}
|
||||
#else
|
||||
static inline void cmx270_init_leds(void) {}
|
||||
#endif
|
||||
|
||||
/* 2700G graphics */
|
||||
#if defined(CONFIG_FB_MBX) || defined(CONFIG_FB_MBX_MODULE)
|
||||
static u64 fb_dma_mask = ~(u64)0;
|
||||
|
||||
static struct resource cmx270_2700G_resource[] = {
|
||||
/* frame buffer memory including ODFB and External SDRAM */
|
||||
[0] = {
|
||||
.start = MARATHON_PHYS,
|
||||
.end = MARATHON_PHYS + 0x02000000,
|
||||
.start = PXA_CS2_PHYS,
|
||||
.end = PXA_CS2_PHYS + 0x01ffffff,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
/* Marathon registers */
|
||||
[1] = {
|
||||
.start = MARATHON_PHYS + 0x03fe0000,
|
||||
.end = MARATHON_PHYS + 0x03ffffff,
|
||||
.start = PXA_CS2_PHYS + 0x03fe0000,
|
||||
.end = PXA_CS2_PHYS + 0x03ffffff,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
};
|
||||
|
@ -205,44 +365,15 @@ static struct platform_device cmx270_2700G = {
|
|||
.id = -1,
|
||||
};
|
||||
|
||||
static u64 ata_dma_mask = ~(u64)0;
|
||||
|
||||
static struct platform_device cmx270_ata = {
|
||||
.name = "pata_cm_x270",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.dma_mask = &ata_dma_mask,
|
||||
.coherent_dma_mask = 0xffffffff,
|
||||
},
|
||||
};
|
||||
|
||||
/* platform devices */
|
||||
static struct platform_device *platform_devices[] __initdata = {
|
||||
&cmx270_device_dm9k,
|
||||
&cmx270_audio_device,
|
||||
&cmx270_rtc_device,
|
||||
&cmx270_2700G,
|
||||
&cmx270_led_device,
|
||||
&cmx270_ts_device,
|
||||
&cmx270_ata,
|
||||
};
|
||||
|
||||
/* Map PCI companion and IDE/General Purpose CS statically */
|
||||
static struct map_desc cmx270_io_desc[] __initdata = {
|
||||
[0] = { /* IDE/general purpose space */
|
||||
.virtual = CMX270_IDE104_VIRT,
|
||||
.pfn = __phys_to_pfn(CMX270_IDE104_PHYS),
|
||||
.length = SZ_64M - SZ_8M,
|
||||
.type = MT_DEVICE
|
||||
},
|
||||
[1] = { /* PCI bridge */
|
||||
.virtual = CMX270_IT8152_VIRT,
|
||||
.pfn = __phys_to_pfn(CMX270_IT8152_PHYS),
|
||||
.length = SZ_64M,
|
||||
.type = MT_DEVICE
|
||||
},
|
||||
};
|
||||
static void __init cmx270_init_2700G(void)
|
||||
{
|
||||
platform_device_register(&cmx270_2700G);
|
||||
}
|
||||
#else
|
||||
static inline void cmx270_init_2700G(void) {}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
|
||||
/*
|
||||
Display definitions
|
||||
keep these for backwards compatibility, although symbolic names (as
|
||||
|
@ -452,7 +583,16 @@ static int __init cmx270_set_display(char *str)
|
|||
*/
|
||||
__setup("monitor=", cmx270_set_display);
|
||||
|
||||
static void __init cmx270_init_display(void)
|
||||
{
|
||||
set_pxa_fb_info(cmx270_display);
|
||||
}
|
||||
#else
|
||||
static inline void cmx270_init_display(void) {}
|
||||
#endif
|
||||
|
||||
/* PXA27x OHCI controller setup */
|
||||
#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
|
||||
static int cmx270_ohci_init(struct device *dev)
|
||||
{
|
||||
/* Set the Power Control Polarity Low */
|
||||
|
@ -467,35 +607,37 @@ static struct pxaohci_platform_data cmx270_ohci_platform_data = {
|
|||
.init = cmx270_ohci_init,
|
||||
};
|
||||
|
||||
static void __init cmx270_init_ohci(void)
|
||||
{
|
||||
pxa_set_ohci_info(&cmx270_ohci_platform_data);
|
||||
}
|
||||
#else
|
||||
static inline void cmx270_init_ohci(void) {}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE)
|
||||
static int cmx270_mci_init(struct device *dev,
|
||||
irq_handler_t cmx270_detect_int,
|
||||
void *data)
|
||||
{
|
||||
int err;
|
||||
|
||||
/*
|
||||
* setup GPIO for PXA27x MMC controller
|
||||
*/
|
||||
pxa_gpio_mode(GPIO32_MMCCLK_MD);
|
||||
pxa_gpio_mode(GPIO112_MMCCMD_MD);
|
||||
pxa_gpio_mode(GPIO92_MMCDAT0_MD);
|
||||
pxa_gpio_mode(GPIO109_MMCDAT1_MD);
|
||||
pxa_gpio_mode(GPIO110_MMCDAT2_MD);
|
||||
pxa_gpio_mode(GPIO111_MMCDAT3_MD);
|
||||
err = gpio_request(GPIO105_MMC_POWER, "MMC/SD power");
|
||||
if (err) {
|
||||
dev_warn(dev, "power gpio unavailable\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
/* SB-X270 uses GPIO105 as SD power enable */
|
||||
pxa_gpio_mode(105 | GPIO_OUT);
|
||||
|
||||
/* card detect IRQ on GPIO 83 */
|
||||
pxa_gpio_mode(IRQ_TO_GPIO(CMX270_MMC_IRQ));
|
||||
gpio_direction_output(GPIO105_MMC_POWER, 0);
|
||||
|
||||
err = request_irq(CMX270_MMC_IRQ, cmx270_detect_int,
|
||||
IRQF_DISABLED | IRQF_TRIGGER_FALLING,
|
||||
"MMC card detect", data);
|
||||
if (err)
|
||||
printk(KERN_ERR "cmx270_mci_init: MMC/SD: can't"
|
||||
" request MMC card detect IRQ\n");
|
||||
if (err) {
|
||||
gpio_free(GPIO105_MMC_POWER);
|
||||
dev_err(dev, "cmx270_mci_init: MMC/SD: can't"
|
||||
" request MMC card detect IRQ\n");
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
@ -505,17 +647,18 @@ static void cmx270_mci_setpower(struct device *dev, unsigned int vdd)
|
|||
struct pxamci_platform_data *p_d = dev->platform_data;
|
||||
|
||||
if ((1 << vdd) & p_d->ocr_mask) {
|
||||
printk(KERN_DEBUG "%s: on\n", __func__);
|
||||
GPCR(105) = GPIO_bit(105);
|
||||
dev_dbg(dev, "power on\n");
|
||||
gpio_set_value(GPIO105_MMC_POWER, 0);
|
||||
} else {
|
||||
GPSR(105) = GPIO_bit(105);
|
||||
printk(KERN_DEBUG "%s: off\n", __func__);
|
||||
gpio_set_value(GPIO105_MMC_POWER, 1);
|
||||
dev_dbg(dev, "power off\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void cmx270_mci_exit(struct device *dev, void *data)
|
||||
{
|
||||
free_irq(CMX270_MMC_IRQ, data);
|
||||
gpio_free(GPIO105_MMC_POWER);
|
||||
}
|
||||
|
||||
static struct pxamci_platform_data cmx270_mci_platform_data = {
|
||||
|
@ -525,6 +668,14 @@ static struct pxamci_platform_data cmx270_mci_platform_data = {
|
|||
.exit = cmx270_mci_exit,
|
||||
};
|
||||
|
||||
static void __init cmx270_init_mmc(void)
|
||||
{
|
||||
pxa_set_mci_info(&cmx270_mci_platform_data);
|
||||
}
|
||||
#else
|
||||
static inline void cmx270_init_mmc(void) {}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static unsigned long sleep_save_msc[10];
|
||||
|
||||
|
@ -586,52 +737,63 @@ static int __init cmx270_pm_init(void)
|
|||
static int __init cmx270_pm_init(void) { return 0; }
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SND_PXA2XX_AC97) || defined(CONFIG_SND_PXA2XX_AC97_MODULE)
|
||||
static void __init cmx270_init_ac97(void)
|
||||
{
|
||||
pxa_set_ac97_info(NULL);
|
||||
}
|
||||
#else
|
||||
static inline void cmx270_init_ac97(void) {}
|
||||
#endif
|
||||
|
||||
static void __init cmx270_init(void)
|
||||
{
|
||||
cmx270_pm_init();
|
||||
|
||||
set_pxa_fb_info(cmx270_display);
|
||||
pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx270_pin_config));
|
||||
|
||||
/* register CM-X270 platform devices */
|
||||
platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
|
||||
|
||||
/* set MCI and OHCI platform parameters */
|
||||
pxa_set_mci_info(&cmx270_mci_platform_data);
|
||||
pxa_set_ohci_info(&cmx270_ohci_platform_data);
|
||||
|
||||
/* This enables the STUART */
|
||||
pxa_gpio_mode(GPIO46_STRXD_MD);
|
||||
pxa_gpio_mode(GPIO47_STTXD_MD);
|
||||
|
||||
/* This enables the BTUART */
|
||||
pxa_gpio_mode(GPIO42_BTRXD_MD);
|
||||
pxa_gpio_mode(GPIO43_BTTXD_MD);
|
||||
pxa_gpio_mode(GPIO44_BTCTS_MD);
|
||||
pxa_gpio_mode(GPIO45_BTRTS_MD);
|
||||
cmx270_init_dm9000();
|
||||
cmx270_init_rtc();
|
||||
cmx270_init_display();
|
||||
cmx270_init_mmc();
|
||||
cmx270_init_ohci();
|
||||
cmx270_init_ac97();
|
||||
cmx270_init_touchscreen();
|
||||
cmx270_init_leds();
|
||||
cmx270_init_2700G();
|
||||
}
|
||||
|
||||
static void __init cmx270_init_irq(void)
|
||||
{
|
||||
pxa27x_init_irq();
|
||||
|
||||
|
||||
cmx270_pci_init_irq();
|
||||
|
||||
/* Setup interrupt for dm9000 */
|
||||
pxa_gpio_mode(IRQ_TO_GPIO(CMX270_ETHIRQ));
|
||||
set_irq_type(CMX270_ETHIRQ, IRQT_RISING);
|
||||
|
||||
/* Setup interrupt for 2700G */
|
||||
pxa_gpio_mode(IRQ_TO_GPIO(CMX270_GFXIRQ));
|
||||
set_irq_type(CMX270_GFXIRQ, IRQT_FALLING);
|
||||
cmx270_pci_init_irq(GPIO22_IT8152_IRQ);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
/* Map PCI companion statically */
|
||||
static struct map_desc cmx270_io_desc[] __initdata = {
|
||||
[0] = { /* PCI bridge */
|
||||
.virtual = CMX270_IT8152_VIRT,
|
||||
.pfn = __phys_to_pfn(PXA_CS4_PHYS),
|
||||
.length = SZ_64M,
|
||||
.type = MT_DEVICE
|
||||
},
|
||||
};
|
||||
|
||||
static void __init cmx270_map_io(void)
|
||||
{
|
||||
pxa_map_io();
|
||||
iotable_init(cmx270_io_desc, ARRAY_SIZE(cmx270_io_desc));
|
||||
}
|
||||
|
||||
it8152_base_address = CMX270_IT8152_VIRT;
|
||||
}
|
||||
#else
|
||||
static void __init cmx270_map_io(void)
|
||||
{
|
||||
pxa_map_io();
|
||||
}
|
||||
#endif
|
||||
|
||||
MACHINE_START(ARMCORE, "Compulab CM-x270")
|
||||
.boot_params = 0xa0000100,
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <asm/mach/irq.h>
|
||||
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-regs.h>
|
||||
#include <asm/arch/pxa2xx-gpio.h>
|
||||
#include <asm/arch/irda.h>
|
||||
#include <asm/arch/mmc.h>
|
||||
|
@ -464,6 +465,7 @@ static void corgi_irda_transceiver_mode(struct device *dev, int mode)
|
|||
GPSR(CORGI_GPIO_IR_ON) = GPIO_bit(CORGI_GPIO_IR_ON);
|
||||
else
|
||||
GPCR(CORGI_GPIO_IR_ON) = GPIO_bit(CORGI_GPIO_IR_ON);
|
||||
pxa2xx_transceiver_mode(dev, mode);
|
||||
}
|
||||
|
||||
static struct pxaficp_platform_data corgi_ficp_platform_data = {
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <asm/arch/sharpsl.h>
|
||||
#include <asm/arch/corgi.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-regs.h>
|
||||
#include <asm/arch/pxa2xx-gpio.h>
|
||||
#include "sharpsl.h"
|
||||
|
||||
|
@ -204,7 +205,9 @@ static struct sharpsl_charger_machinfo corgi_pm_machinfo = {
|
|||
.read_devdata = corgipm_read_devdata,
|
||||
.charger_wakeup = corgi_charger_wakeup,
|
||||
.should_wakeup = corgi_should_wakeup,
|
||||
#ifdef CONFIG_BACKLIGHT_CORGI
|
||||
.backlight_limit = corgibl_limit_intensity,
|
||||
#endif
|
||||
.charge_on_volt = SHARPSL_CHARGE_ON_VOLT,
|
||||
.charge_on_temp = SHARPSL_CHARGE_ON_TEMP,
|
||||
.charge_acin_high = SHARPSL_CHARGE_ON_ACIN_HIGH,
|
||||
|
@ -226,6 +229,10 @@ static int __devinit corgipm_init(void)
|
|||
{
|
||||
int ret;
|
||||
|
||||
if (!machine_is_corgi() && !machine_is_shepherd()
|
||||
&& !machine_is_husky())
|
||||
return -ENODEV;
|
||||
|
||||
corgipm_device = platform_device_alloc("sharpsl-pm", -1);
|
||||
if (!corgipm_device)
|
||||
return -ENOMEM;
|
||||
|
|
|
@ -10,11 +10,16 @@
|
|||
#include <asm/arch/mmc.h>
|
||||
#include <asm/arch/irda.h>
|
||||
#include <asm/arch/i2c.h>
|
||||
#include <asm/arch/mfp-pxa27x.h>
|
||||
#include <asm/arch/ohci.h>
|
||||
#include <asm/arch/pxa27x_keypad.h>
|
||||
#include <asm/arch/pxa2xx_spi.h>
|
||||
#include <asm/arch/camera.h>
|
||||
#include <asm/arch/audio.h>
|
||||
#include <asm/arch/pxa3xx_nand.h>
|
||||
|
||||
#include "devices.h"
|
||||
#include "generic.h"
|
||||
|
||||
void __init pxa_register_device(struct platform_device *dev, void *data)
|
||||
{
|
||||
|
@ -91,8 +96,19 @@ static struct resource pxa2xx_udc_resources[] = {
|
|||
|
||||
static u64 udc_dma_mask = ~(u32)0;
|
||||
|
||||
struct platform_device pxa_device_udc = {
|
||||
.name = "pxa2xx-udc",
|
||||
struct platform_device pxa25x_device_udc = {
|
||||
.name = "pxa25x-udc",
|
||||
.id = -1,
|
||||
.resource = pxa2xx_udc_resources,
|
||||
.num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
|
||||
.dev = {
|
||||
.platform_data = &pxa_udc_info,
|
||||
.dma_mask = &udc_dma_mask,
|
||||
}
|
||||
};
|
||||
|
||||
struct platform_device pxa27x_device_udc = {
|
||||
.name = "pxa27x-udc",
|
||||
.id = -1,
|
||||
.resource = pxa2xx_udc_resources,
|
||||
.num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
|
||||
|
@ -233,8 +249,15 @@ struct platform_device pxa_device_i2c = {
|
|||
.num_resources = ARRAY_SIZE(pxai2c_resources),
|
||||
};
|
||||
|
||||
static unsigned long pxa27x_i2c_mfp_cfg[] = {
|
||||
GPIO117_I2C_SCL,
|
||||
GPIO118_I2C_SDA,
|
||||
};
|
||||
|
||||
void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
|
||||
{
|
||||
if (cpu_is_pxa27x())
|
||||
pxa2xx_mfp_config(ARRAY_AND_SIZE(pxa27x_i2c_mfp_cfg));
|
||||
pxa_register_device(&pxa_device_i2c, info);
|
||||
}
|
||||
|
||||
|
@ -278,8 +301,69 @@ struct platform_device pxa_device_rtc = {
|
|||
.id = -1,
|
||||
};
|
||||
|
||||
static struct resource pxa_ac97_resources[] = {
|
||||
[0] = {
|
||||
.start = 0x40500000,
|
||||
.end = 0x40500000 + 0xfff,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
[1] = {
|
||||
.start = IRQ_AC97,
|
||||
.end = IRQ_AC97,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
static u64 pxa_ac97_dmamask = 0xffffffffUL;
|
||||
|
||||
struct platform_device pxa_device_ac97 = {
|
||||
.name = "pxa2xx-ac97",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.dma_mask = &pxa_ac97_dmamask,
|
||||
.coherent_dma_mask = 0xffffffff,
|
||||
},
|
||||
.num_resources = ARRAY_SIZE(pxa_ac97_resources),
|
||||
.resource = pxa_ac97_resources,
|
||||
};
|
||||
|
||||
void __init pxa_set_ac97_info(pxa2xx_audio_ops_t *ops)
|
||||
{
|
||||
pxa_register_device(&pxa_device_ac97, ops);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PXA25x
|
||||
|
||||
static struct resource pxa25x_resource_pwm0[] = {
|
||||
[0] = {
|
||||
.start = 0x40b00000,
|
||||
.end = 0x40b0000f,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
};
|
||||
|
||||
struct platform_device pxa25x_device_pwm0 = {
|
||||
.name = "pxa25x-pwm",
|
||||
.id = 0,
|
||||
.resource = pxa25x_resource_pwm0,
|
||||
.num_resources = ARRAY_SIZE(pxa25x_resource_pwm0),
|
||||
};
|
||||
|
||||
static struct resource pxa25x_resource_pwm1[] = {
|
||||
[0] = {
|
||||
.start = 0x40c00000,
|
||||
.end = 0x40c0000f,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
};
|
||||
|
||||
struct platform_device pxa25x_device_pwm1 = {
|
||||
.name = "pxa25x-pwm",
|
||||
.id = 1,
|
||||
.resource = pxa25x_resource_pwm1,
|
||||
.num_resources = ARRAY_SIZE(pxa25x_resource_pwm1),
|
||||
};
|
||||
|
||||
static u64 pxa25x_ssp_dma_mask = DMA_BIT_MASK(32);
|
||||
|
||||
static struct resource pxa25x_resource_ssp[] = {
|
||||
|
@ -568,6 +652,36 @@ struct platform_device pxa27x_device_ssp3 = {
|
|||
.num_resources = ARRAY_SIZE(pxa27x_resource_ssp3),
|
||||
};
|
||||
|
||||
static struct resource pxa27x_resource_pwm0[] = {
|
||||
[0] = {
|
||||
.start = 0x40b00000,
|
||||
.end = 0x40b0001f,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
};
|
||||
|
||||
struct platform_device pxa27x_device_pwm0 = {
|
||||
.name = "pxa27x-pwm",
|
||||
.id = 0,
|
||||
.resource = pxa27x_resource_pwm0,
|
||||
.num_resources = ARRAY_SIZE(pxa27x_resource_pwm0),
|
||||
};
|
||||
|
||||
static struct resource pxa27x_resource_pwm1[] = {
|
||||
[0] = {
|
||||
.start = 0x40c00000,
|
||||
.end = 0x40c0001f,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
};
|
||||
|
||||
struct platform_device pxa27x_device_pwm1 = {
|
||||
.name = "pxa27x-pwm",
|
||||
.id = 1,
|
||||
.resource = pxa27x_resource_pwm1,
|
||||
.num_resources = ARRAY_SIZE(pxa27x_resource_pwm1),
|
||||
};
|
||||
|
||||
static struct resource pxa27x_resource_camera[] = {
|
||||
[0] = {
|
||||
.start = 0x50000000,
|
||||
|
@ -718,4 +832,63 @@ void __init pxa3xx_set_mci3_info(struct pxamci_platform_data *info)
|
|||
pxa_register_device(&pxa3xx_device_mci3, info);
|
||||
}
|
||||
|
||||
static struct resource pxa3xx_resources_nand[] = {
|
||||
[0] = {
|
||||
.start = 0x43100000,
|
||||
.end = 0x43100053,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
[1] = {
|
||||
.start = IRQ_NAND,
|
||||
.end = IRQ_NAND,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
[2] = {
|
||||
/* DRCMR for Data DMA */
|
||||
.start = 97,
|
||||
.end = 97,
|
||||
.flags = IORESOURCE_DMA,
|
||||
},
|
||||
[3] = {
|
||||
/* DRCMR for Command DMA */
|
||||
.start = 99,
|
||||
.end = 99,
|
||||
.flags = IORESOURCE_DMA,
|
||||
},
|
||||
};
|
||||
|
||||
static u64 pxa3xx_nand_dma_mask = DMA_BIT_MASK(32);
|
||||
|
||||
struct platform_device pxa3xx_device_nand = {
|
||||
.name = "pxa3xx-nand",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.dma_mask = &pxa3xx_nand_dma_mask,
|
||||
.coherent_dma_mask = DMA_BIT_MASK(32),
|
||||
},
|
||||
.num_resources = ARRAY_SIZE(pxa3xx_resources_nand),
|
||||
.resource = pxa3xx_resources_nand,
|
||||
};
|
||||
|
||||
void __init pxa3xx_set_nand_info(struct pxa3xx_nand_platform_data *info)
|
||||
{
|
||||
pxa_register_device(&pxa3xx_device_nand, info);
|
||||
}
|
||||
#endif /* CONFIG_PXA3xx */
|
||||
|
||||
/* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1.
|
||||
* See comment in arch/arm/mach-pxa/ssp.c::ssp_probe() */
|
||||
void __init pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info)
|
||||
{
|
||||
struct platform_device *pd;
|
||||
|
||||
pd = platform_device_alloc("pxa2xx-spi", id);
|
||||
if (pd == NULL) {
|
||||
printk(KERN_ERR "pxa2xx-spi: failed to allocate device id %d\n",
|
||||
id);
|
||||
return;
|
||||
}
|
||||
|
||||
pd->dev.platform_data = info;
|
||||
platform_device_add(pd);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
extern struct platform_device pxa_device_mci;
|
||||
extern struct platform_device pxa3xx_device_mci2;
|
||||
extern struct platform_device pxa3xx_device_mci3;
|
||||
extern struct platform_device pxa_device_udc;
|
||||
extern struct platform_device pxa25x_device_udc;
|
||||
extern struct platform_device pxa27x_device_udc;
|
||||
extern struct platform_device pxa_device_fb;
|
||||
extern struct platform_device pxa_device_ffuart;
|
||||
extern struct platform_device pxa_device_btuart;
|
||||
|
@ -11,6 +12,7 @@ extern struct platform_device pxa_device_i2c;
|
|||
extern struct platform_device pxa_device_i2s;
|
||||
extern struct platform_device pxa_device_ficp;
|
||||
extern struct platform_device pxa_device_rtc;
|
||||
extern struct platform_device pxa_device_ac97;
|
||||
|
||||
extern struct platform_device pxa27x_device_i2c_power;
|
||||
extern struct platform_device pxa27x_device_ohci;
|
||||
|
@ -24,4 +26,11 @@ extern struct platform_device pxa27x_device_ssp2;
|
|||
extern struct platform_device pxa27x_device_ssp3;
|
||||
extern struct platform_device pxa3xx_device_ssp4;
|
||||
|
||||
extern struct platform_device pxa25x_device_pwm0;
|
||||
extern struct platform_device pxa25x_device_pwm1;
|
||||
extern struct platform_device pxa27x_device_pwm0;
|
||||
extern struct platform_device pxa27x_device_pwm1;
|
||||
|
||||
extern struct platform_device pxa3xx_device_nand;
|
||||
|
||||
void __init pxa_register_device(struct platform_device *dev, void *data);
|
||||
|
|
56
arch/arm/mach-pxa/e400_lcd.c
Normal file
56
arch/arm/mach-pxa/e400_lcd.c
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* e400_lcd.c
|
||||
*
|
||||
* (c) 2005 Ian Molton <spyro@f2s.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/module.h>
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxafb.h>
|
||||
|
||||
static struct pxafb_mode_info e400_pxafb_mode_info = {
|
||||
.pixclock = 140703,
|
||||
.xres = 240,
|
||||
.yres = 320,
|
||||
.bpp = 16,
|
||||
.hsync_len = 4,
|
||||
.left_margin = 28,
|
||||
.right_margin = 8,
|
||||
.vsync_len = 3,
|
||||
.upper_margin = 5,
|
||||
.lower_margin = 6,
|
||||
.sync = 0,
|
||||
};
|
||||
|
||||
static struct pxafb_mach_info e400_pxafb_mach_info = {
|
||||
.modes = &e400_pxafb_mode_info,
|
||||
.num_modes = 1,
|
||||
.lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
|
||||
.lccr3 = 0,
|
||||
.pxafb_backlight_power = NULL,
|
||||
};
|
||||
|
||||
static int __init e400_lcd_init(void)
|
||||
{
|
||||
if (!machine_is_e400())
|
||||
return -ENODEV;
|
||||
|
||||
set_pxa_fb_info(&e400_pxafb_mach_info);
|
||||
return 0;
|
||||
}
|
||||
|
||||
module_init(e400_lcd_init);
|
||||
|
||||
MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
|
||||
MODULE_DESCRIPTION("e400 lcd driver");
|
||||
MODULE_LICENSE("GPLv2");
|
||||
|
123
arch/arm/mach-pxa/e740_lcd.c
Normal file
123
arch/arm/mach-pxa/e740_lcd.c
Normal file
|
@ -0,0 +1,123 @@
|
|||
/* e740_lcd.c
|
||||
*
|
||||
* This file contains the definitions for the LCD timings and functions
|
||||
* to control the LCD power / frontlighting via the w100fb driver.
|
||||
*
|
||||
* (c) 2005 Ian Molton <spyro@f2s.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/module.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include <video/w100fb.h>
|
||||
|
||||
/*
|
||||
**potential** shutdown routine - to be investigated
|
||||
devmem2 0x0c010528 w 0xff3fff00
|
||||
devmem2 0x0c010190 w 0x7FFF8000
|
||||
devmem2 0x0c0101b0 w 0x00FF0000
|
||||
devmem2 0x0c01008c w 0x00000000
|
||||
devmem2 0x0c010080 w 0x000000bf
|
||||
devmem2 0x0c010098 w 0x00000015
|
||||
devmem2 0x0c010088 w 0x4b000204
|
||||
devmem2 0x0c010098 w 0x0000001d
|
||||
*/
|
||||
|
||||
static struct w100_gen_regs e740_lcd_regs = {
|
||||
.lcd_format = 0x00008023,
|
||||
.lcdd_cntl1 = 0x0f000000,
|
||||
.lcdd_cntl2 = 0x0003ffff,
|
||||
.genlcd_cntl1 = 0x00ffff03,
|
||||
.genlcd_cntl2 = 0x003c0f03,
|
||||
.genlcd_cntl3 = 0x000143aa,
|
||||
};
|
||||
|
||||
static struct w100_mode e740_lcd_mode = {
|
||||
.xres = 240,
|
||||
.yres = 320,
|
||||
.left_margin = 20,
|
||||
.right_margin = 28,
|
||||
.upper_margin = 9,
|
||||
.lower_margin = 8,
|
||||
.crtc_ss = 0x80140013,
|
||||
.crtc_ls = 0x81150110,
|
||||
.crtc_gs = 0x80050005,
|
||||
.crtc_vpos_gs = 0x000a0009,
|
||||
.crtc_rev = 0x0040010a,
|
||||
.crtc_dclk = 0xa906000a,
|
||||
.crtc_gclk = 0x80050108,
|
||||
.crtc_goe = 0x80050108,
|
||||
.pll_freq = 57,
|
||||
.pixclk_divider = 4,
|
||||
.pixclk_divider_rotated = 4,
|
||||
.pixclk_src = CLK_SRC_XTAL,
|
||||
.sysclk_divider = 1,
|
||||
.sysclk_src = CLK_SRC_PLL,
|
||||
.crtc_ps1_active = 0x41060010,
|
||||
};
|
||||
|
||||
|
||||
static struct w100_gpio_regs e740_w100_gpio_info = {
|
||||
.init_data1 = 0x21002103,
|
||||
.gpio_dir1 = 0xffffdeff,
|
||||
.gpio_oe1 = 0x03c00643,
|
||||
.init_data2 = 0x003f003f,
|
||||
.gpio_dir2 = 0xffffffff,
|
||||
.gpio_oe2 = 0x000000ff,
|
||||
};
|
||||
|
||||
static struct w100fb_mach_info e740_fb_info = {
|
||||
.modelist = &e740_lcd_mode,
|
||||
.num_modes = 1,
|
||||
.regs = &e740_lcd_regs,
|
||||
.gpio = &e740_w100_gpio_info,
|
||||
.xtal_freq = 14318000,
|
||||
.xtal_dbl = 1,
|
||||
};
|
||||
|
||||
static struct resource e740_fb_resources[] = {
|
||||
[0] = {
|
||||
.start = 0x0c000000,
|
||||
.end = 0x0cffffff,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
};
|
||||
|
||||
/* ----------------------- device declarations -------------------------- */
|
||||
|
||||
|
||||
static struct platform_device e740_fb_device = {
|
||||
.name = "w100fb",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &e740_fb_info,
|
||||
},
|
||||
.num_resources = ARRAY_SIZE(e740_fb_resources),
|
||||
.resource = e740_fb_resources,
|
||||
};
|
||||
|
||||
static int e740_lcd_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!machine_is_e740())
|
||||
return -ENODEV;
|
||||
|
||||
return platform_device_register(&e740_fb_device);
|
||||
}
|
||||
|
||||
module_init(e740_lcd_init);
|
||||
|
||||
MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
|
||||
MODULE_DESCRIPTION("e740 lcd driver");
|
||||
MODULE_LICENSE("GPLv2");
|
109
arch/arm/mach-pxa/e750_lcd.c
Normal file
109
arch/arm/mach-pxa/e750_lcd.c
Normal file
|
@ -0,0 +1,109 @@
|
|||
/* e750_lcd.c
|
||||
*
|
||||
* This file contains the definitions for the LCD timings and functions
|
||||
* to control the LCD power / frontlighting via the w100fb driver.
|
||||
*
|
||||
* (c) 2005 Ian Molton <spyro@f2s.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/module.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include <video/w100fb.h>
|
||||
|
||||
static struct w100_gen_regs e750_lcd_regs = {
|
||||
.lcd_format = 0x00008003,
|
||||
.lcdd_cntl1 = 0x00000000,
|
||||
.lcdd_cntl2 = 0x0003ffff,
|
||||
.genlcd_cntl1 = 0x00fff003,
|
||||
.genlcd_cntl2 = 0x003c0f03,
|
||||
.genlcd_cntl3 = 0x000143aa,
|
||||
};
|
||||
|
||||
static struct w100_mode e750_lcd_mode = {
|
||||
.xres = 240,
|
||||
.yres = 320,
|
||||
.left_margin = 21,
|
||||
.right_margin = 22,
|
||||
.upper_margin = 5,
|
||||
.lower_margin = 4,
|
||||
.crtc_ss = 0x80150014,
|
||||
.crtc_ls = 0x8014000d,
|
||||
.crtc_gs = 0xc1000005,
|
||||
.crtc_vpos_gs = 0x00020147,
|
||||
.crtc_rev = 0x0040010a,
|
||||
.crtc_dclk = 0xa1700030,
|
||||
.crtc_gclk = 0x80cc0015,
|
||||
.crtc_goe = 0x80cc0015,
|
||||
.crtc_ps1_active = 0x61060017,
|
||||
.pll_freq = 57,
|
||||
.pixclk_divider = 4,
|
||||
.pixclk_divider_rotated = 4,
|
||||
.pixclk_src = CLK_SRC_XTAL,
|
||||
.sysclk_divider = 1,
|
||||
.sysclk_src = CLK_SRC_PLL,
|
||||
};
|
||||
|
||||
|
||||
static struct w100_gpio_regs e750_w100_gpio_info = {
|
||||
.init_data1 = 0x01192f1b,
|
||||
.gpio_dir1 = 0xd5ffdeff,
|
||||
.gpio_oe1 = 0x000020bf,
|
||||
.init_data2 = 0x010f010f,
|
||||
.gpio_dir2 = 0xffffffff,
|
||||
.gpio_oe2 = 0x000001cf,
|
||||
};
|
||||
|
||||
static struct w100fb_mach_info e750_fb_info = {
|
||||
.modelist = &e750_lcd_mode,
|
||||
.num_modes = 1,
|
||||
.regs = &e750_lcd_regs,
|
||||
.gpio = &e750_w100_gpio_info,
|
||||
.xtal_freq = 14318000,
|
||||
.xtal_dbl = 1,
|
||||
};
|
||||
|
||||
static struct resource e750_fb_resources[] = {
|
||||
[0] = {
|
||||
.start = 0x0c000000,
|
||||
.end = 0x0cffffff,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
};
|
||||
|
||||
/* ----------------------- device declarations -------------------------- */
|
||||
|
||||
|
||||
static struct platform_device e750_fb_device = {
|
||||
.name = "w100fb",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &e750_fb_info,
|
||||
},
|
||||
.num_resources = ARRAY_SIZE(e750_fb_resources),
|
||||
.resource = e750_fb_resources,
|
||||
};
|
||||
|
||||
static int e750_lcd_init(void)
|
||||
{
|
||||
if (!machine_is_e750())
|
||||
return -ENODEV;
|
||||
|
||||
return platform_device_register(&e750_fb_device);
|
||||
}
|
||||
|
||||
module_init(e750_lcd_init);
|
||||
|
||||
MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
|
||||
MODULE_DESCRIPTION("e750 lcd driver");
|
||||
MODULE_LICENSE("GPLv2");
|
159
arch/arm/mach-pxa/e800_lcd.c
Normal file
159
arch/arm/mach-pxa/e800_lcd.c
Normal file
|
@ -0,0 +1,159 @@
|
|||
/* e800_lcd.c
|
||||
*
|
||||
* This file contains the definitions for the LCD timings and functions
|
||||
* to control the LCD power / frontlighting via the w100fb driver.
|
||||
*
|
||||
* (c) 2005 Ian Molton <spyro@f2s.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/module.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include <video/w100fb.h>
|
||||
|
||||
static struct w100_gen_regs e800_lcd_regs = {
|
||||
.lcd_format = 0x00008003,
|
||||
.lcdd_cntl1 = 0x02a00000,
|
||||
.lcdd_cntl2 = 0x0003ffff,
|
||||
.genlcd_cntl1 = 0x000ff2a3,
|
||||
.genlcd_cntl2 = 0x000002a3,
|
||||
.genlcd_cntl3 = 0x000102aa,
|
||||
};
|
||||
|
||||
static struct w100_mode e800_lcd_mode[2] = {
|
||||
[0] = {
|
||||
.xres = 480,
|
||||
.yres = 640,
|
||||
.left_margin = 52,
|
||||
.right_margin = 148,
|
||||
.upper_margin = 2,
|
||||
.lower_margin = 6,
|
||||
.crtc_ss = 0x80350034,
|
||||
.crtc_ls = 0x802b0026,
|
||||
.crtc_gs = 0x80160016,
|
||||
.crtc_vpos_gs = 0x00020003,
|
||||
.crtc_rev = 0x0040001d,
|
||||
.crtc_dclk = 0xe0000000,
|
||||
.crtc_gclk = 0x82a50049,
|
||||
.crtc_goe = 0x80ee001c,
|
||||
.crtc_ps1_active = 0x00000000,
|
||||
.pll_freq = 128,
|
||||
.pixclk_divider = 4,
|
||||
.pixclk_divider_rotated = 6,
|
||||
.pixclk_src = CLK_SRC_PLL,
|
||||
.sysclk_divider = 0,
|
||||
.sysclk_src = CLK_SRC_PLL,
|
||||
},
|
||||
[1] = {
|
||||
.xres = 240,
|
||||
.yres = 320,
|
||||
.left_margin = 15,
|
||||
.right_margin = 88,
|
||||
.upper_margin = 0,
|
||||
.lower_margin = 7,
|
||||
.crtc_ss = 0xd010000f,
|
||||
.crtc_ls = 0x80070003,
|
||||
.crtc_gs = 0x80000000,
|
||||
.crtc_vpos_gs = 0x01460147,
|
||||
.crtc_rev = 0x00400003,
|
||||
.crtc_dclk = 0xa1700030,
|
||||
.crtc_gclk = 0x814b0008,
|
||||
.crtc_goe = 0x80cc0015,
|
||||
.crtc_ps1_active = 0x00000000,
|
||||
.pll_freq = 100,
|
||||
.pixclk_divider = 6, /* Wince uses 14 which gives a 7MHz pclk. */
|
||||
.pixclk_divider_rotated = 6, /* we want a 14MHz one (much nicer to look at) */
|
||||
.pixclk_src = CLK_SRC_PLL,
|
||||
.sysclk_divider = 0,
|
||||
.sysclk_src = CLK_SRC_PLL,
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static struct w100_gpio_regs e800_w100_gpio_info = {
|
||||
.init_data1 = 0xc13fc019,
|
||||
.gpio_dir1 = 0x3e40df7f,
|
||||
.gpio_oe1 = 0x003c3000,
|
||||
.init_data2 = 0x00000000,
|
||||
.gpio_dir2 = 0x00000000,
|
||||
.gpio_oe2 = 0x00000000,
|
||||
};
|
||||
|
||||
static struct w100_mem_info e800_w100_mem_info = {
|
||||
.ext_cntl = 0x09640011,
|
||||
.sdram_mode_reg = 0x00600021,
|
||||
.ext_timing_cntl = 0x10001545,
|
||||
.io_cntl = 0x7ddd7333,
|
||||
.size = 0x1fffff,
|
||||
};
|
||||
|
||||
static void e800_tg_change(struct w100fb_par *par)
|
||||
{
|
||||
unsigned long tmp;
|
||||
|
||||
tmp = w100fb_gpio_read(W100_GPIO_PORT_A);
|
||||
if (par->mode->xres == 480)
|
||||
tmp |= 0x100;
|
||||
else
|
||||
tmp &= ~0x100;
|
||||
w100fb_gpio_write(W100_GPIO_PORT_A, tmp);
|
||||
}
|
||||
|
||||
static struct w100_tg_info e800_tg_info = {
|
||||
.change = e800_tg_change,
|
||||
};
|
||||
|
||||
static struct w100fb_mach_info e800_fb_info = {
|
||||
.modelist = e800_lcd_mode,
|
||||
.num_modes = 2,
|
||||
.regs = &e800_lcd_regs,
|
||||
.gpio = &e800_w100_gpio_info,
|
||||
.mem = &e800_w100_mem_info,
|
||||
.tg = &e800_tg_info,
|
||||
.xtal_freq = 16000000,
|
||||
};
|
||||
|
||||
static struct resource e800_fb_resources[] = {
|
||||
[0] = {
|
||||
.start = 0x0c000000,
|
||||
.end = 0x0cffffff,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
};
|
||||
|
||||
/* ----------------------- device declarations -------------------------- */
|
||||
|
||||
|
||||
static struct platform_device e800_fb_device = {
|
||||
.name = "w100fb",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &e800_fb_info,
|
||||
},
|
||||
.num_resources = ARRAY_SIZE(e800_fb_resources),
|
||||
.resource = e800_fb_resources,
|
||||
};
|
||||
|
||||
static int e800_lcd_init(void)
|
||||
{
|
||||
if (!machine_is_e800())
|
||||
return -ENODEV;
|
||||
|
||||
return platform_device_register(&e800_fb_device);
|
||||
}
|
||||
|
||||
module_init(e800_lcd_init);
|
||||
|
||||
MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
|
||||
MODULE_DESCRIPTION("e800 lcd driver");
|
||||
MODULE_LICENSE("GPLv2");
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Support for CompuLab EM-x270 platform
|
||||
* Support for CompuLab EM-X270 platform
|
||||
*
|
||||
* Copyright (C) 2007 CompuLab, Ltd.
|
||||
* Copyright (C) 2007, 2008 CompuLab, Ltd.
|
||||
* Author: Mike Rapoport <mike@compulab.co.il>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -14,29 +14,159 @@
|
|||
|
||||
#include <linux/dm9000.h>
|
||||
#include <linux/rtc-v3020.h>
|
||||
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/gpio_keys.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include <asm/mach/arch.h>
|
||||
|
||||
#include <asm/arch/mfp-pxa27x.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-gpio.h>
|
||||
#include <asm/arch/pxa27x-udc.h>
|
||||
#include <asm/arch/audio.h>
|
||||
#include <asm/arch/pxafb.h>
|
||||
#include <asm/arch/ohci.h>
|
||||
#include <asm/arch/mmc.h>
|
||||
#include <asm/arch/bitfield.h>
|
||||
#include <asm/arch/pxa27x_keypad.h>
|
||||
|
||||
#include "generic.h"
|
||||
|
||||
/* GPIO IRQ usage */
|
||||
#define EM_X270_MMC_PD (105)
|
||||
#define EM_X270_ETHIRQ IRQ_GPIO(41)
|
||||
#define EM_X270_MMC_IRQ IRQ_GPIO(13)
|
||||
#define GPIO41_ETHIRQ (41)
|
||||
#define GPIO13_MMC_CD (13)
|
||||
#define EM_X270_ETHIRQ IRQ_GPIO(GPIO41_ETHIRQ)
|
||||
#define EM_X270_MMC_CD IRQ_GPIO(GPIO13_MMC_CD)
|
||||
|
||||
static struct resource em_x270_dm9k_resource[] = {
|
||||
/* NAND control GPIOs */
|
||||
#define GPIO11_NAND_CS (11)
|
||||
#define GPIO56_NAND_RB (56)
|
||||
|
||||
static unsigned long em_x270_pin_config[] = {
|
||||
/* AC'97 */
|
||||
GPIO28_AC97_BITCLK,
|
||||
GPIO29_AC97_SDATA_IN_0,
|
||||
GPIO30_AC97_SDATA_OUT,
|
||||
GPIO31_AC97_SYNC,
|
||||
GPIO98_AC97_SYSCLK,
|
||||
GPIO113_AC97_nRESET,
|
||||
|
||||
/* BTUART */
|
||||
GPIO42_BTUART_RXD,
|
||||
GPIO43_BTUART_TXD,
|
||||
GPIO44_BTUART_CTS,
|
||||
GPIO45_BTUART_RTS,
|
||||
|
||||
/* STUART */
|
||||
GPIO46_STUART_RXD,
|
||||
GPIO47_STUART_TXD,
|
||||
|
||||
/* MCI controller */
|
||||
GPIO32_MMC_CLK,
|
||||
GPIO112_MMC_CMD,
|
||||
GPIO92_MMC_DAT_0,
|
||||
GPIO109_MMC_DAT_1,
|
||||
GPIO110_MMC_DAT_2,
|
||||
GPIO111_MMC_DAT_3,
|
||||
|
||||
/* LCD */
|
||||
GPIO58_LCD_LDD_0,
|
||||
GPIO59_LCD_LDD_1,
|
||||
GPIO60_LCD_LDD_2,
|
||||
GPIO61_LCD_LDD_3,
|
||||
GPIO62_LCD_LDD_4,
|
||||
GPIO63_LCD_LDD_5,
|
||||
GPIO64_LCD_LDD_6,
|
||||
GPIO65_LCD_LDD_7,
|
||||
GPIO66_LCD_LDD_8,
|
||||
GPIO67_LCD_LDD_9,
|
||||
GPIO68_LCD_LDD_10,
|
||||
GPIO69_LCD_LDD_11,
|
||||
GPIO70_LCD_LDD_12,
|
||||
GPIO71_LCD_LDD_13,
|
||||
GPIO72_LCD_LDD_14,
|
||||
GPIO73_LCD_LDD_15,
|
||||
GPIO74_LCD_FCLK,
|
||||
GPIO75_LCD_LCLK,
|
||||
GPIO76_LCD_PCLK,
|
||||
GPIO77_LCD_BIAS,
|
||||
|
||||
/* QCI */
|
||||
GPIO84_CIF_FV,
|
||||
GPIO25_CIF_LV,
|
||||
GPIO53_CIF_MCLK,
|
||||
GPIO54_CIF_PCLK,
|
||||
GPIO81_CIF_DD_0,
|
||||
GPIO55_CIF_DD_1,
|
||||
GPIO51_CIF_DD_2,
|
||||
GPIO50_CIF_DD_3,
|
||||
GPIO52_CIF_DD_4,
|
||||
GPIO48_CIF_DD_5,
|
||||
GPIO17_CIF_DD_6,
|
||||
GPIO12_CIF_DD_7,
|
||||
|
||||
/* I2C */
|
||||
GPIO117_I2C_SCL,
|
||||
GPIO118_I2C_SDA,
|
||||
|
||||
/* Keypad */
|
||||
GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
|
||||
GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
|
||||
GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
|
||||
GPIO34_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
|
||||
GPIO39_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
|
||||
GPIO99_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH,
|
||||
GPIO91_KP_MKIN_6 | WAKEUP_ON_LEVEL_HIGH,
|
||||
GPIO36_KP_MKIN_7 | WAKEUP_ON_LEVEL_HIGH,
|
||||
GPIO103_KP_MKOUT_0,
|
||||
GPIO104_KP_MKOUT_1,
|
||||
GPIO105_KP_MKOUT_2,
|
||||
GPIO106_KP_MKOUT_3,
|
||||
GPIO107_KP_MKOUT_4,
|
||||
GPIO108_KP_MKOUT_5,
|
||||
GPIO96_KP_MKOUT_6,
|
||||
GPIO22_KP_MKOUT_7,
|
||||
|
||||
/* SSP1 */
|
||||
GPIO26_SSP1_RXD,
|
||||
GPIO23_SSP1_SCLK,
|
||||
GPIO24_SSP1_SFRM,
|
||||
GPIO57_SSP1_TXD,
|
||||
|
||||
/* SSP2 */
|
||||
GPIO19_SSP2_SCLK,
|
||||
GPIO14_SSP2_SFRM,
|
||||
GPIO89_SSP2_TXD,
|
||||
GPIO88_SSP2_RXD,
|
||||
|
||||
/* SDRAM and local bus */
|
||||
GPIO15_nCS_1,
|
||||
GPIO78_nCS_2,
|
||||
GPIO79_nCS_3,
|
||||
GPIO80_nCS_4,
|
||||
GPIO49_nPWE,
|
||||
GPIO18_RDY,
|
||||
|
||||
/* GPIO */
|
||||
GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH,
|
||||
|
||||
/* power controls */
|
||||
GPIO20_GPIO | MFP_LPM_DRIVE_LOW, /* GPRS_PWEN */
|
||||
GPIO115_GPIO | MFP_LPM_DRIVE_LOW, /* WLAN_PWEN */
|
||||
|
||||
/* NAND controls */
|
||||
GPIO11_GPIO | MFP_LPM_DRIVE_HIGH, /* NAND CE# */
|
||||
GPIO56_GPIO, /* NAND Ready/Busy */
|
||||
|
||||
/* interrupts */
|
||||
GPIO13_GPIO, /* MMC card detect */
|
||||
GPIO41_GPIO, /* DM9000 interrupt */
|
||||
};
|
||||
|
||||
#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
|
||||
static struct resource em_x270_dm9000_resource[] = {
|
||||
[0] = {
|
||||
.start = PXA_CS2_PHYS,
|
||||
.end = PXA_CS2_PHYS + 3,
|
||||
|
@ -54,38 +184,30 @@ static struct resource em_x270_dm9k_resource[] = {
|
|||
}
|
||||
};
|
||||
|
||||
/* for the moment we limit ourselves to 32bit IO until some
|
||||
* better IO routines can be written and tested
|
||||
*/
|
||||
static struct dm9000_plat_data em_x270_dm9k_platdata = {
|
||||
static struct dm9000_plat_data em_x270_dm9000_platdata = {
|
||||
.flags = DM9000_PLATF_32BITONLY,
|
||||
};
|
||||
|
||||
/* Ethernet device */
|
||||
static struct platform_device em_x270_dm9k = {
|
||||
static struct platform_device em_x270_dm9000 = {
|
||||
.name = "dm9000",
|
||||
.id = 0,
|
||||
.num_resources = ARRAY_SIZE(em_x270_dm9k_resource),
|
||||
.resource = em_x270_dm9k_resource,
|
||||
.num_resources = ARRAY_SIZE(em_x270_dm9000_resource),
|
||||
.resource = em_x270_dm9000_resource,
|
||||
.dev = {
|
||||
.platform_data = &em_x270_dm9k_platdata,
|
||||
.platform_data = &em_x270_dm9000_platdata,
|
||||
}
|
||||
};
|
||||
|
||||
/* audio device */
|
||||
static struct platform_device em_x270_audio = {
|
||||
.name = "pxa2xx-ac97",
|
||||
.id = -1,
|
||||
};
|
||||
static void __init em_x270_init_dm9000(void)
|
||||
{
|
||||
platform_device_register(&em_x270_dm9000);
|
||||
}
|
||||
#else
|
||||
static inline void em_x270_init_dm9000(void) {}
|
||||
#endif
|
||||
|
||||
/* WM9712 touchscreen controller. Hopefully the driver will make it to
|
||||
* the mainstream sometime */
|
||||
static struct platform_device em_x270_ts = {
|
||||
.name = "wm97xx-ts",
|
||||
.id = -1,
|
||||
};
|
||||
|
||||
/* RTC */
|
||||
/* V3020 RTC */
|
||||
#if defined(CONFIG_RTC_DRV_V3020) || defined(CONFIG_RTC_DRV_V3020_MODULE)
|
||||
static struct resource em_x270_v3020_resource[] = {
|
||||
[0] = {
|
||||
.start = PXA_CS4_PHYS,
|
||||
|
@ -108,20 +230,26 @@ static struct platform_device em_x270_rtc = {
|
|||
}
|
||||
};
|
||||
|
||||
/* NAND flash */
|
||||
#define GPIO_NAND_CS (11)
|
||||
#define GPIO_NAND_RB (56)
|
||||
static void __init em_x270_init_rtc(void)
|
||||
{
|
||||
platform_device_register(&em_x270_rtc);
|
||||
}
|
||||
#else
|
||||
static inline void em_x270_init_rtc(void) {}
|
||||
#endif
|
||||
|
||||
/* NAND flash */
|
||||
#if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
|
||||
static inline void nand_cs_on(void)
|
||||
{
|
||||
GPCR(GPIO_NAND_CS) = GPIO_bit(GPIO_NAND_CS);
|
||||
gpio_set_value(GPIO11_NAND_CS, 0);
|
||||
}
|
||||
|
||||
static void nand_cs_off(void)
|
||||
{
|
||||
dsb();
|
||||
|
||||
GPSR(GPIO_NAND_CS) = GPIO_bit(GPIO_NAND_CS);
|
||||
gpio_set_value(GPIO11_NAND_CS, 1);
|
||||
}
|
||||
|
||||
/* hardware specific access to control-lines */
|
||||
|
@ -161,7 +289,7 @@ static int em_x270_nand_device_ready(struct mtd_info *mtd)
|
|||
{
|
||||
dsb();
|
||||
|
||||
return GPLR(GPIO_NAND_RB) & GPIO_bit(GPIO_NAND_RB);
|
||||
return gpio_get_value(GPIO56_NAND_RB);
|
||||
}
|
||||
|
||||
static struct mtd_partition em_x270_partition_info[] = {
|
||||
|
@ -214,17 +342,35 @@ static struct platform_device em_x270_nand = {
|
|||
}
|
||||
};
|
||||
|
||||
/* platform devices */
|
||||
static struct platform_device *platform_devices[] __initdata = {
|
||||
&em_x270_dm9k,
|
||||
&em_x270_audio,
|
||||
&em_x270_ts,
|
||||
&em_x270_rtc,
|
||||
&em_x270_nand,
|
||||
};
|
||||
static void __init em_x270_init_nand(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = gpio_request(GPIO11_NAND_CS, "NAND CS");
|
||||
if (err) {
|
||||
pr_warning("EM-X270: failed to request NAND CS gpio\n");
|
||||
return;
|
||||
}
|
||||
|
||||
gpio_direction_output(GPIO11_NAND_CS, 1);
|
||||
|
||||
err = gpio_request(GPIO56_NAND_RB, "NAND R/B");
|
||||
if (err) {
|
||||
pr_warning("EM-X270: failed to request NAND R/B gpio\n");
|
||||
gpio_free(GPIO11_NAND_CS);
|
||||
return;
|
||||
}
|
||||
|
||||
gpio_direction_input(GPIO56_NAND_RB);
|
||||
|
||||
platform_device_register(&em_x270_nand);
|
||||
}
|
||||
#else
|
||||
static inline void em_x270_init_nand(void) {}
|
||||
#endif
|
||||
|
||||
/* PXA27x OHCI controller setup */
|
||||
#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
|
||||
static int em_x270_ohci_init(struct device *dev)
|
||||
{
|
||||
/* Set the Power Control Polarity Low */
|
||||
|
@ -242,27 +388,23 @@ static struct pxaohci_platform_data em_x270_ohci_platform_data = {
|
|||
.init = em_x270_ohci_init,
|
||||
};
|
||||
|
||||
static void __init em_x270_init_ohci(void)
|
||||
{
|
||||
pxa_set_ohci_info(&em_x270_ohci_platform_data);
|
||||
}
|
||||
#else
|
||||
static inline void em_x270_init_ohci(void) {}
|
||||
#endif
|
||||
|
||||
/* MCI controller setup */
|
||||
#if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE)
|
||||
static int em_x270_mci_init(struct device *dev,
|
||||
irq_handler_t em_x270_detect_int,
|
||||
void *data)
|
||||
{
|
||||
int err;
|
||||
|
||||
/* setup GPIO for PXA27x MMC controller */
|
||||
pxa_gpio_mode(GPIO32_MMCCLK_MD);
|
||||
pxa_gpio_mode(GPIO112_MMCCMD_MD);
|
||||
pxa_gpio_mode(GPIO92_MMCDAT0_MD);
|
||||
pxa_gpio_mode(GPIO109_MMCDAT1_MD);
|
||||
pxa_gpio_mode(GPIO110_MMCDAT2_MD);
|
||||
pxa_gpio_mode(GPIO111_MMCDAT3_MD);
|
||||
|
||||
/* EM-X270 uses GPIO13 as SD power enable */
|
||||
pxa_gpio_mode(EM_X270_MMC_PD | GPIO_OUT);
|
||||
|
||||
err = request_irq(EM_X270_MMC_IRQ, em_x270_detect_int,
|
||||
IRQF_DISABLED | IRQF_TRIGGER_FALLING,
|
||||
"MMC card detect", data);
|
||||
int err = request_irq(EM_X270_MMC_CD, em_x270_detect_int,
|
||||
IRQF_DISABLED | IRQF_TRIGGER_FALLING,
|
||||
"MMC card detect", data);
|
||||
if (err) {
|
||||
printk(KERN_ERR "%s: can't request MMC card detect IRQ: %d\n",
|
||||
__func__, err);
|
||||
|
@ -284,7 +426,8 @@ static void em_x270_mci_setpower(struct device *dev, unsigned int vdd)
|
|||
|
||||
static void em_x270_mci_exit(struct device *dev, void *data)
|
||||
{
|
||||
free_irq(EM_X270_MMC_IRQ, data);
|
||||
int irq = gpio_to_irq(GPIO13_MMC_CD);
|
||||
free_irq(irq, data);
|
||||
}
|
||||
|
||||
static struct pxamci_platform_data em_x270_mci_platform_data = {
|
||||
|
@ -294,7 +437,16 @@ static struct pxamci_platform_data em_x270_mci_platform_data = {
|
|||
.exit = em_x270_mci_exit,
|
||||
};
|
||||
|
||||
static void __init em_x270_init_mmc(void)
|
||||
{
|
||||
pxa_set_mci_info(&em_x270_mci_platform_data);
|
||||
}
|
||||
#else
|
||||
static inline void em_x270_init_mmc(void) {}
|
||||
#endif
|
||||
|
||||
/* LCD 480x640 */
|
||||
#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
|
||||
static struct pxafb_mode_info em_x270_lcd_mode = {
|
||||
.pixclock = 50000,
|
||||
.bpp = 16,
|
||||
|
@ -312,39 +464,96 @@ static struct pxafb_mode_info em_x270_lcd_mode = {
|
|||
static struct pxafb_mach_info em_x270_lcd = {
|
||||
.modes = &em_x270_lcd_mode,
|
||||
.num_modes = 1,
|
||||
.cmap_inverse = 0,
|
||||
.cmap_static = 0,
|
||||
.lccr0 = LCCR0_PAS,
|
||||
.lccr3 = LCCR3_PixClkDiv(0x01) | LCCR3_Acb(0xff),
|
||||
.lcd_conn = LCD_COLOR_TFT_16BPP,
|
||||
};
|
||||
static void __init em_x270_init_lcd(void)
|
||||
{
|
||||
set_pxa_fb_info(&em_x270_lcd);
|
||||
}
|
||||
#else
|
||||
static inline void em_x270_init_lcd(void) {}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SND_PXA2XX_AC97) || defined(CONFIG_SND_PXA2XX_AC97_MODULE)
|
||||
static void __init em_x270_init_ac97(void)
|
||||
{
|
||||
pxa_set_ac97_info(NULL);
|
||||
}
|
||||
#else
|
||||
static inline void em_x270_init_ac97(void) {}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
|
||||
static unsigned int em_x270_matrix_keys[] = {
|
||||
KEY(0, 0, KEY_A), KEY(1, 0, KEY_UP), KEY(2, 1, KEY_B),
|
||||
KEY(0, 2, KEY_LEFT), KEY(1, 1, KEY_ENTER), KEY(2, 0, KEY_RIGHT),
|
||||
KEY(0, 1, KEY_C), KEY(1, 2, KEY_DOWN), KEY(2, 2, KEY_D),
|
||||
};
|
||||
|
||||
struct pxa27x_keypad_platform_data em_x270_keypad_info = {
|
||||
/* code map for the matrix keys */
|
||||
.matrix_key_rows = 3,
|
||||
.matrix_key_cols = 3,
|
||||
.matrix_key_map = em_x270_matrix_keys,
|
||||
.matrix_key_map_size = ARRAY_SIZE(em_x270_matrix_keys),
|
||||
};
|
||||
|
||||
static void __init em_x270_init_keypad(void)
|
||||
{
|
||||
pxa_set_keypad_info(&em_x270_keypad_info);
|
||||
}
|
||||
#else
|
||||
static inline void em_x270_init_keypad(void) {}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
|
||||
static struct gpio_keys_button gpio_keys_button[] = {
|
||||
[0] = {
|
||||
.desc = "sleep/wakeup",
|
||||
.code = KEY_SUSPEND,
|
||||
.type = EV_PWR,
|
||||
.gpio = 1,
|
||||
.wakeup = 1,
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpio_keys_platform_data em_x270_gpio_keys_data = {
|
||||
.buttons = gpio_keys_button,
|
||||
.nbuttons = 1,
|
||||
};
|
||||
|
||||
static struct platform_device em_x270_gpio_keys = {
|
||||
.name = "gpio-keys",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &em_x270_gpio_keys_data,
|
||||
},
|
||||
};
|
||||
|
||||
static void __init em_x270_init_gpio_keys(void)
|
||||
{
|
||||
platform_device_register(&em_x270_gpio_keys);
|
||||
}
|
||||
#else
|
||||
static inline void em_x270_init_gpio_keys(void) {}
|
||||
#endif
|
||||
|
||||
static void __init em_x270_init(void)
|
||||
{
|
||||
/* setup LCD */
|
||||
set_pxa_fb_info(&em_x270_lcd);
|
||||
pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_pin_config));
|
||||
|
||||
/* register EM-X270 platform devices */
|
||||
platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
|
||||
|
||||
/* set MCI and OHCI platform parameters */
|
||||
pxa_set_mci_info(&em_x270_mci_platform_data);
|
||||
pxa_set_ohci_info(&em_x270_ohci_platform_data);
|
||||
|
||||
/* setup STUART GPIOs */
|
||||
pxa_gpio_mode(GPIO46_STRXD_MD);
|
||||
pxa_gpio_mode(GPIO47_STTXD_MD);
|
||||
|
||||
/* setup BTUART GPIOs */
|
||||
pxa_gpio_mode(GPIO42_BTRXD_MD);
|
||||
pxa_gpio_mode(GPIO43_BTTXD_MD);
|
||||
pxa_gpio_mode(GPIO44_BTCTS_MD);
|
||||
pxa_gpio_mode(GPIO45_BTRTS_MD);
|
||||
|
||||
/* Setup interrupt for dm9000 */
|
||||
set_irq_type(EM_X270_ETHIRQ, IRQT_RISING);
|
||||
em_x270_init_dm9000();
|
||||
em_x270_init_rtc();
|
||||
em_x270_init_nand();
|
||||
em_x270_init_lcd();
|
||||
em_x270_init_mmc();
|
||||
em_x270_init_ohci();
|
||||
em_x270_init_keypad();
|
||||
em_x270_init_gpio_keys();
|
||||
em_x270_init_ac97();
|
||||
}
|
||||
|
||||
MACHINE_START(EM_X270, "Compulab EM-x270")
|
||||
MACHINE_START(EM_X270, "Compulab EM-X270")
|
||||
.boot_params = 0xa0000100,
|
||||
.phys_io = 0x40000000,
|
||||
.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include <asm/arch/hardware.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include <generic.h>
|
||||
#include "generic.h"
|
||||
|
||||
/* Only e800 has 128MB RAM */
|
||||
static void __init eseries_fixup(struct machine_desc *desc,
|
||||
|
@ -47,6 +47,19 @@ MACHINE_START(E330, "Toshiba e330")
|
|||
MACHINE_END
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MACH_E350
|
||||
MACHINE_START(E350, "Toshiba e350")
|
||||
/* Maintainer: Ian Molton (spyro@f2s.com) */
|
||||
.phys_io = 0x40000000,
|
||||
.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
|
||||
.boot_params = 0xa0000100,
|
||||
.map_io = pxa_map_io,
|
||||
.init_irq = pxa25x_init_irq,
|
||||
.fixup = eseries_fixup,
|
||||
.timer = &pxa_timer,
|
||||
MACHINE_END
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MACH_E740
|
||||
MACHINE_START(E740, "Toshiba e740")
|
||||
/* Maintainer: Ian Molton (spyro@f2s.com) */
|
||||
|
|
57
arch/arm/mach-pxa/eseries_udc.c
Normal file
57
arch/arm/mach-pxa/eseries_udc.c
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* UDC functions for the Toshiba e-series PDAs
|
||||
*
|
||||
* Copyright (c) Ian Molton 2003
|
||||
*
|
||||
* 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 kind, whether express
|
||||
* or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/device.h>
|
||||
|
||||
#include <asm/arch/udc.h>
|
||||
#include <asm/arch/eseries-gpio.h>
|
||||
#include <asm/arch/hardware.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/mach/map.h>
|
||||
#include <asm/domain.h>
|
||||
|
||||
/* local PXA generic code */
|
||||
#include "generic.h"
|
||||
|
||||
static struct pxa2xx_udc_mach_info e7xx_udc_mach_info = {
|
||||
.gpio_vbus = GPIO_E7XX_USB_DISC,
|
||||
.gpio_pullup = GPIO_E7XX_USB_PULLUP,
|
||||
.gpio_pullup_inverted = 1
|
||||
};
|
||||
|
||||
static struct pxa2xx_udc_mach_info e800_udc_mach_info = {
|
||||
.gpio_vbus = GPIO_E800_USB_DISC,
|
||||
.gpio_pullup = GPIO_E800_USB_PULLUP,
|
||||
.gpio_pullup_inverted = 1
|
||||
};
|
||||
|
||||
static int __init eseries_udc_init(void)
|
||||
{
|
||||
if (machine_is_e330() || machine_is_e350() ||
|
||||
machine_is_e740() || machine_is_e750() ||
|
||||
machine_is_e400())
|
||||
pxa_set_udc_info(&e7xx_udc_mach_info);
|
||||
else if (machine_is_e800())
|
||||
pxa_set_udc_info(&e800_udc_mach_info);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
module_init(eseries_udc_init);
|
||||
|
||||
MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
|
||||
MODULE_DESCRIPTION("eseries UDC support");
|
||||
MODULE_LICENSE("GPLv2");
|
220
arch/arm/mach-pxa/ezx.c
Normal file
220
arch/arm/mach-pxa/ezx.c
Normal file
|
@ -0,0 +1,220 @@
|
|||
/*
|
||||
* ezx.c - Common code for the EZX platform.
|
||||
*
|
||||
* Copyright (C) 2005-2006 Harald Welte <laforge@openezx.org>,
|
||||
* 2007-2008 Daniel Ribeiro <drwyrm@gmail.com>,
|
||||
* 2007-2008 Stefan Schmidt <stefan@datenfreihafen.org>
|
||||
*
|
||||
* 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/delay.h>
|
||||
#include <linux/pwm_backlight.h>
|
||||
|
||||
#include <asm/setup.h>
|
||||
#include <asm/arch/pxafb.h>
|
||||
#include <asm/arch/ohci.h>
|
||||
#include <asm/arch/i2c.h>
|
||||
|
||||
#include <asm/arch/mfp-pxa27x.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-regs.h>
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/mach/arch.h>
|
||||
|
||||
#include "devices.h"
|
||||
#include "generic.h"
|
||||
|
||||
static struct platform_pwm_backlight_data ezx_backlight_data = {
|
||||
.pwm_id = 0,
|
||||
.max_brightness = 1023,
|
||||
.dft_brightness = 1023,
|
||||
.pwm_period_ns = 78770,
|
||||
};
|
||||
|
||||
static struct platform_device ezx_backlight_device = {
|
||||
.name = "pwm-backlight",
|
||||
.dev = {
|
||||
.parent = &pxa27x_device_pwm0.dev,
|
||||
.platform_data = &ezx_backlight_data,
|
||||
},
|
||||
};
|
||||
|
||||
static struct pxafb_mode_info mode_ezx_old = {
|
||||
.pixclock = 150000,
|
||||
.xres = 240,
|
||||
.yres = 320,
|
||||
.bpp = 16,
|
||||
.hsync_len = 10,
|
||||
.left_margin = 20,
|
||||
.right_margin = 10,
|
||||
.vsync_len = 2,
|
||||
.upper_margin = 3,
|
||||
.lower_margin = 2,
|
||||
.sync = 0,
|
||||
};
|
||||
|
||||
static struct pxafb_mach_info ezx_fb_info_1 = {
|
||||
.modes = &mode_ezx_old,
|
||||
.num_modes = 1,
|
||||
.lcd_conn = LCD_COLOR_TFT_16BPP,
|
||||
};
|
||||
|
||||
static struct pxafb_mode_info mode_72r89803y01 = {
|
||||
.pixclock = 192308,
|
||||
.xres = 240,
|
||||
.yres = 320,
|
||||
.bpp = 32,
|
||||
.depth = 18,
|
||||
.hsync_len = 10,
|
||||
.left_margin = 20,
|
||||
.right_margin = 10,
|
||||
.vsync_len = 2,
|
||||
.upper_margin = 3,
|
||||
.lower_margin = 2,
|
||||
.sync = 0,
|
||||
};
|
||||
|
||||
static struct pxafb_mach_info ezx_fb_info_2 = {
|
||||
.modes = &mode_72r89803y01,
|
||||
.num_modes = 1,
|
||||
.lcd_conn = LCD_COLOR_TFT_18BPP,
|
||||
};
|
||||
|
||||
static struct platform_device *devices[] __initdata = {
|
||||
&ezx_backlight_device,
|
||||
};
|
||||
|
||||
static unsigned long ezx_pin_config[] __initdata = {
|
||||
/* PWM backlight */
|
||||
GPIO16_PWM0_OUT,
|
||||
|
||||
/* BTUART */
|
||||
GPIO42_BTUART_RXD,
|
||||
GPIO43_BTUART_TXD,
|
||||
GPIO44_BTUART_CTS,
|
||||
GPIO45_BTUART_RTS,
|
||||
|
||||
/* STUART */
|
||||
GPIO46_STUART_RXD,
|
||||
GPIO47_STUART_TXD,
|
||||
|
||||
/* For A780 support (connected with Neptune GSM chip) */
|
||||
GPIO30_USB_P3_2, /* ICL_TXENB */
|
||||
GPIO31_USB_P3_6, /* ICL_VPOUT */
|
||||
GPIO90_USB_P3_5, /* ICL_VPIN */
|
||||
GPIO91_USB_P3_1, /* ICL_XRXD */
|
||||
GPIO56_USB_P3_4, /* ICL_VMOUT */
|
||||
GPIO113_USB_P3_3, /* /ICL_VMIN */
|
||||
};
|
||||
|
||||
static void __init ezx_init(void)
|
||||
{
|
||||
pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
|
||||
pxa_set_i2c_info(NULL);
|
||||
if (machine_is_ezx_a780() || machine_is_ezx_e680())
|
||||
set_pxa_fb_info(&ezx_fb_info_1);
|
||||
else
|
||||
set_pxa_fb_info(&ezx_fb_info_2);
|
||||
|
||||
platform_add_devices(devices, ARRAY_SIZE(devices));
|
||||
}
|
||||
|
||||
static void __init ezx_fixup(struct machine_desc *desc, struct tag *tags,
|
||||
char **cmdline, struct meminfo *mi)
|
||||
{
|
||||
/* We have two ram chips. First one with 32MB at 0xA0000000 and a second
|
||||
* 16MB one at 0xAC000000
|
||||
*/
|
||||
mi->nr_banks = 2;
|
||||
mi->bank[0].start = 0xa0000000;
|
||||
mi->bank[0].node = 0;
|
||||
mi->bank[0].size = (32*1024*1024);
|
||||
mi->bank[1].start = 0xac000000;
|
||||
mi->bank[1].node = 1;
|
||||
mi->bank[1].size = (16*1024*1024);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MACH_EZX_A780
|
||||
MACHINE_START(EZX_A780, "Motorola EZX A780")
|
||||
.phys_io = 0x40000000,
|
||||
.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
|
||||
.fixup = ezx_fixup,
|
||||
.boot_params = 0xa0000100,
|
||||
.map_io = pxa_map_io,
|
||||
.init_irq = pxa27x_init_irq,
|
||||
.timer = &pxa_timer,
|
||||
.init_machine = &ezx_init,
|
||||
MACHINE_END
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MACH_EZX_E680
|
||||
MACHINE_START(EZX_E680, "Motorola EZX E680")
|
||||
.phys_io = 0x40000000,
|
||||
.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
|
||||
.fixup = ezx_fixup,
|
||||
.boot_params = 0xa0000100,
|
||||
.map_io = pxa_map_io,
|
||||
.init_irq = pxa27x_init_irq,
|
||||
.timer = &pxa_timer,
|
||||
.init_machine = &ezx_init,
|
||||
MACHINE_END
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MACH_EZX_A1200
|
||||
MACHINE_START(EZX_A1200, "Motorola EZX A1200")
|
||||
.phys_io = 0x40000000,
|
||||
.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
|
||||
.fixup = ezx_fixup,
|
||||
.boot_params = 0xa0000100,
|
||||
.map_io = pxa_map_io,
|
||||
.init_irq = pxa27x_init_irq,
|
||||
.timer = &pxa_timer,
|
||||
.init_machine = &ezx_init,
|
||||
MACHINE_END
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MACH_EZX_A910
|
||||
MACHINE_START(EZX_A910, "Motorola EZX A910")
|
||||
.phys_io = 0x40000000,
|
||||
.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
|
||||
.fixup = ezx_fixup,
|
||||
.boot_params = 0xa0000100,
|
||||
.map_io = pxa_map_io,
|
||||
.init_irq = pxa27x_init_irq,
|
||||
.timer = &pxa_timer,
|
||||
.init_machine = &ezx_init,
|
||||
MACHINE_END
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MACH_EZX_E6
|
||||
MACHINE_START(EZX_E6, "Motorola EZX E6")
|
||||
.phys_io = 0x40000000,
|
||||
.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
|
||||
.fixup = ezx_fixup,
|
||||
.boot_params = 0xa0000100,
|
||||
.map_io = pxa_map_io,
|
||||
.init_irq = pxa27x_init_irq,
|
||||
.timer = &pxa_timer,
|
||||
.init_machine = &ezx_init,
|
||||
MACHINE_END
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MACH_EZX_E2
|
||||
MACHINE_START(EZX_E2, "Motorola EZX E2")
|
||||
.phys_io = 0x40000000,
|
||||
.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
|
||||
.fixup = ezx_fixup,
|
||||
.boot_params = 0xa0000100,
|
||||
.map_io = pxa_map_io,
|
||||
.init_irq = pxa27x_init_irq,
|
||||
.timer = &pxa_timer,
|
||||
.init_machine = &ezx_init,
|
||||
MACHINE_END
|
||||
#endif
|
|
@ -59,23 +59,6 @@ unsigned int get_memclk_frequency_10khz(void)
|
|||
}
|
||||
EXPORT_SYMBOL(get_memclk_frequency_10khz);
|
||||
|
||||
/*
|
||||
* Routine to safely enable or disable a clock in the CKEN
|
||||
*/
|
||||
void __pxa_set_cken(int clock, int enable)
|
||||
{
|
||||
unsigned long flags;
|
||||
local_irq_save(flags);
|
||||
|
||||
if (enable)
|
||||
CKEN |= (1 << clock);
|
||||
else
|
||||
CKEN &= ~(1 << clock);
|
||||
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
EXPORT_SYMBOL(__pxa_set_cken);
|
||||
|
||||
/*
|
||||
* Intel PXA2xx internal register mapping.
|
||||
*
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <asm/irq.h>
|
||||
#include <asm/mach/irq.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-gpio.h>
|
||||
|
||||
#include "generic.h"
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <linux/delay.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/smc91x.h>
|
||||
|
||||
#include <asm/types.h>
|
||||
#include <asm/setup.h>
|
||||
|
@ -38,6 +39,7 @@
|
|||
#include <asm/arch/pxafb.h>
|
||||
#include <asm/arch/ssp.h>
|
||||
#include <asm/arch/pxa27x_keypad.h>
|
||||
#include <asm/arch/pxa3xx_nand.h>
|
||||
#include <asm/arch/littleton.h>
|
||||
|
||||
#include "generic.h"
|
||||
|
@ -101,18 +103,26 @@ static struct resource smc91x_resources[] = {
|
|||
[1] = {
|
||||
.start = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)),
|
||||
.end = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)),
|
||||
.flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
|
||||
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
|
||||
}
|
||||
};
|
||||
|
||||
static struct smc91x_platdata littleton_smc91x_info = {
|
||||
.flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT |
|
||||
SMC91X_NOWAIT | SMC91X_USE_DMA,
|
||||
};
|
||||
|
||||
static struct platform_device smc91x_device = {
|
||||
.name = "smc91x",
|
||||
.id = 0,
|
||||
.num_resources = ARRAY_SIZE(smc91x_resources),
|
||||
.resource = smc91x_resources,
|
||||
.dev = {
|
||||
.platform_data = &littleton_smc91x_info,
|
||||
},
|
||||
};
|
||||
|
||||
#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULES)
|
||||
#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
|
||||
/* use bit 30, 31 as the indicator of command parameter number */
|
||||
#define CMD0(x) ((0x00000000) | ((x) << 9))
|
||||
#define CMD1(x, x1) ((0x40000000) | ((x) << 9) | 0x100 | (x1))
|
||||
|
@ -311,9 +321,9 @@ static void littleton_init_lcd(void)
|
|||
}
|
||||
#else
|
||||
static inline void littleton_init_lcd(void) {};
|
||||
#endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULES */
|
||||
#endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
|
||||
|
||||
#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULES)
|
||||
#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
|
||||
static unsigned int littleton_matrix_key_map[] = {
|
||||
/* KEY(row, col, key_code) */
|
||||
KEY(1, 3, KEY_0), KEY(0, 0, KEY_1), KEY(1, 0, KEY_2), KEY(2, 0, KEY_3),
|
||||
|
@ -361,6 +371,57 @@ static void __init littleton_init_keypad(void)
|
|||
static inline void littleton_init_keypad(void) {}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)
|
||||
static struct mtd_partition littleton_nand_partitions[] = {
|
||||
[0] = {
|
||||
.name = "Bootloader",
|
||||
.offset = 0,
|
||||
.size = 0x060000,
|
||||
.mask_flags = MTD_WRITEABLE, /* force read-only */
|
||||
},
|
||||
[1] = {
|
||||
.name = "Kernel",
|
||||
.offset = 0x060000,
|
||||
.size = 0x200000,
|
||||
.mask_flags = MTD_WRITEABLE, /* force read-only */
|
||||
},
|
||||
[2] = {
|
||||
.name = "Filesystem",
|
||||
.offset = 0x0260000,
|
||||
.size = 0x3000000, /* 48M - rootfs */
|
||||
},
|
||||
[3] = {
|
||||
.name = "MassStorage",
|
||||
.offset = 0x3260000,
|
||||
.size = 0x3d40000,
|
||||
},
|
||||
[4] = {
|
||||
.name = "BBT",
|
||||
.offset = 0x6FA0000,
|
||||
.size = 0x80000,
|
||||
.mask_flags = MTD_WRITEABLE, /* force read-only */
|
||||
},
|
||||
/* NOTE: we reserve some blocks at the end of the NAND flash for
|
||||
* bad block management, and the max number of relocation blocks
|
||||
* differs on different platforms. Please take care with it when
|
||||
* defining the partition table.
|
||||
*/
|
||||
};
|
||||
|
||||
static struct pxa3xx_nand_platform_data littleton_nand_info = {
|
||||
.enable_arbiter = 1,
|
||||
.parts = littleton_nand_partitions,
|
||||
.nr_parts = ARRAY_SIZE(littleton_nand_partitions),
|
||||
};
|
||||
|
||||
static void __init littleton_init_nand(void)
|
||||
{
|
||||
pxa3xx_set_nand_info(&littleton_nand_info);
|
||||
}
|
||||
#else
|
||||
static inline void littleton_init_nand(void) {}
|
||||
#endif /* CONFIG_MTD_NAND_PXA3xx || CONFIG_MTD_NAND_PXA3xx_MODULE */
|
||||
|
||||
static void __init littleton_init(void)
|
||||
{
|
||||
/* initialize MFP configurations */
|
||||
|
@ -374,6 +435,7 @@ static void __init littleton_init(void)
|
|||
|
||||
littleton_init_lcd();
|
||||
littleton_init_keypad();
|
||||
littleton_init_nand();
|
||||
}
|
||||
|
||||
MACHINE_START(LITTLETON, "Marvell Form Factor Development Platform (aka Littleton)")
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <linux/ioport.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/pwm_backlight.h>
|
||||
|
||||
#include <asm/types.h>
|
||||
#include <asm/setup.h>
|
||||
|
@ -134,9 +135,12 @@ static struct sys_device lpd270_irq_device = {
|
|||
|
||||
static int __init lpd270_irq_device_init(void)
|
||||
{
|
||||
int ret = sysdev_class_register(&lpd270_irq_sysclass);
|
||||
if (ret == 0)
|
||||
ret = sysdev_register(&lpd270_irq_device);
|
||||
int ret = -ENODEV;
|
||||
if (machine_is_logicpd_pxa270()) {
|
||||
ret = sysdev_class_register(&lpd270_irq_sysclass);
|
||||
if (ret == 0)
|
||||
ret = sysdev_register(&lpd270_irq_device);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -164,11 +168,6 @@ static struct platform_device smc91x_device = {
|
|||
.resource = smc91x_resources,
|
||||
};
|
||||
|
||||
static struct platform_device lpd270_audio_device = {
|
||||
.name = "pxa2xx-ac97",
|
||||
.id = -1,
|
||||
};
|
||||
|
||||
static struct resource lpd270_flash_resources[] = {
|
||||
[0] = {
|
||||
.start = PXA_CS0_PHYS,
|
||||
|
@ -233,21 +232,20 @@ static struct platform_device lpd270_flash_device[2] = {
|
|||
},
|
||||
};
|
||||
|
||||
static void lpd270_backlight_power(int on)
|
||||
{
|
||||
if (on) {
|
||||
pxa_gpio_mode(GPIO16_PWM0_MD);
|
||||
pxa_set_cken(CKEN_PWM0, 1);
|
||||
PWM_CTRL0 = 0;
|
||||
PWM_PWDUTY0 = 0x3ff;
|
||||
PWM_PERVAL0 = 0x3ff;
|
||||
} else {
|
||||
PWM_CTRL0 = 0;
|
||||
PWM_PWDUTY0 = 0x0;
|
||||
PWM_PERVAL0 = 0x3FF;
|
||||
pxa_set_cken(CKEN_PWM0, 0);
|
||||
}
|
||||
}
|
||||
static struct platform_pwm_backlight_data lpd270_backlight_data = {
|
||||
.pwm_id = 0,
|
||||
.max_brightness = 1,
|
||||
.dft_brightness = 1,
|
||||
.pwm_period_ns = 78770,
|
||||
};
|
||||
|
||||
static struct platform_device lpd270_backlight_device = {
|
||||
.name = "pwm-backlight",
|
||||
.dev = {
|
||||
.parent = &pxa27x_device_pwm0.dev,
|
||||
.platform_data = &lpd270_backlight_data,
|
||||
},
|
||||
};
|
||||
|
||||
/* 5.7" TFT QVGA (LoLo display number 1) */
|
||||
static struct pxafb_mode_info sharp_lq057q3dc02_mode = {
|
||||
|
@ -269,7 +267,6 @@ static struct pxafb_mach_info sharp_lq057q3dc02 = {
|
|||
.num_modes = 1,
|
||||
.lccr0 = 0x07800080,
|
||||
.lccr3 = 0x00400000,
|
||||
.pxafb_backlight_power = lpd270_backlight_power,
|
||||
};
|
||||
|
||||
/* 12.1" TFT SVGA (LoLo display number 2) */
|
||||
|
@ -292,7 +289,6 @@ static struct pxafb_mach_info sharp_lq121s1dg31 = {
|
|||
.num_modes = 1,
|
||||
.lccr0 = 0x07800080,
|
||||
.lccr3 = 0x00400000,
|
||||
.pxafb_backlight_power = lpd270_backlight_power,
|
||||
};
|
||||
|
||||
/* 3.6" TFT QVGA (LoLo display number 3) */
|
||||
|
@ -315,7 +311,6 @@ static struct pxafb_mach_info sharp_lq036q1da01 = {
|
|||
.num_modes = 1,
|
||||
.lccr0 = 0x07800080,
|
||||
.lccr3 = 0x00400000,
|
||||
.pxafb_backlight_power = lpd270_backlight_power,
|
||||
};
|
||||
|
||||
/* 6.4" TFT VGA (LoLo display number 5) */
|
||||
|
@ -338,7 +333,6 @@ static struct pxafb_mach_info sharp_lq64d343 = {
|
|||
.num_modes = 1,
|
||||
.lccr0 = 0x07800080,
|
||||
.lccr3 = 0x00400000,
|
||||
.pxafb_backlight_power = lpd270_backlight_power,
|
||||
};
|
||||
|
||||
/* 10.4" TFT VGA (LoLo display number 7) */
|
||||
|
@ -361,7 +355,6 @@ static struct pxafb_mach_info sharp_lq10d368 = {
|
|||
.num_modes = 1,
|
||||
.lccr0 = 0x07800080,
|
||||
.lccr3 = 0x00400000,
|
||||
.pxafb_backlight_power = lpd270_backlight_power,
|
||||
};
|
||||
|
||||
/* 3.5" TFT QVGA (LoLo display number 8) */
|
||||
|
@ -384,7 +377,6 @@ static struct pxafb_mach_info sharp_lq035q7db02_20 = {
|
|||
.num_modes = 1,
|
||||
.lccr0 = 0x07800080,
|
||||
.lccr3 = 0x00400000,
|
||||
.pxafb_backlight_power = lpd270_backlight_power,
|
||||
};
|
||||
|
||||
static struct pxafb_mach_info *lpd270_lcd_to_use;
|
||||
|
@ -414,7 +406,7 @@ __setup("lcd=", lpd270_set_lcd);
|
|||
|
||||
static struct platform_device *platform_devices[] __initdata = {
|
||||
&smc91x_device,
|
||||
&lpd270_audio_device,
|
||||
&lpd270_backlight_device,
|
||||
&lpd270_flash_device[0],
|
||||
&lpd270_flash_device[1],
|
||||
};
|
||||
|
@ -454,9 +446,12 @@ static void __init lpd270_init(void)
|
|||
* On LogicPD PXA270, we route AC97_SYSCLK via GPIO45.
|
||||
*/
|
||||
pxa_gpio_mode(GPIO45_SYSCLK_AC97_MD);
|
||||
pxa_gpio_mode(GPIO16_PWM0_MD);
|
||||
|
||||
platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
|
||||
|
||||
pxa_set_ac97_info(NULL);
|
||||
|
||||
if (lpd270_lcd_to_use != NULL)
|
||||
set_pxa_fb_info(lpd270_lcd_to_use);
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <linux/interrupt.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/smc91x.h>
|
||||
|
||||
#include <linux/spi/spi.h>
|
||||
#include <linux/spi/ads7846.h>
|
||||
|
@ -43,6 +44,7 @@
|
|||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-regs.h>
|
||||
#include <asm/arch/mfp-pxa25x.h>
|
||||
#include <asm/arch/audio.h>
|
||||
#include <asm/arch/lubbock.h>
|
||||
#include <asm/arch/udc.h>
|
||||
#include <asm/arch/irda.h>
|
||||
|
@ -196,11 +198,6 @@ static struct pxa2xx_udc_mach_info udc_info __initdata = {
|
|||
// no D+ pullup; lubbock can't connect/disconnect in software
|
||||
};
|
||||
|
||||
static struct platform_device lub_audio_device = {
|
||||
.name = "pxa2xx-ac97",
|
||||
.id = -1,
|
||||
};
|
||||
|
||||
static struct resource sa1111_resources[] = {
|
||||
[0] = {
|
||||
.start = 0x10000000,
|
||||
|
@ -230,14 +227,6 @@ static struct pxa2xx_spi_master pxa_ssp_master_info = {
|
|||
.num_chipselect = 0,
|
||||
};
|
||||
|
||||
static struct platform_device pxa_ssp = {
|
||||
.name = "pxa2xx-spi",
|
||||
.id = 1,
|
||||
.dev = {
|
||||
.platform_data = &pxa_ssp_master_info,
|
||||
},
|
||||
};
|
||||
|
||||
static int lubbock_ads7846_pendown_state(void)
|
||||
{
|
||||
/* TS_BUSY is bit 8 in LUB_MISC_RD, but pendown is irq-only */
|
||||
|
@ -296,11 +285,18 @@ static struct resource smc91x_resources[] = {
|
|||
},
|
||||
};
|
||||
|
||||
static struct smc91x_platdata lubbock_smc91x_info = {
|
||||
.flags = SMC91X_USE_16BIT | SMC91X_NOWAIT | SMC91X_IO_SHIFT_2,
|
||||
};
|
||||
|
||||
static struct platform_device smc91x_device = {
|
||||
.name = "smc91x",
|
||||
.id = -1,
|
||||
.num_resources = ARRAY_SIZE(smc91x_resources),
|
||||
.resource = smc91x_resources,
|
||||
.dev = {
|
||||
.platform_data = &lubbock_smc91x_info,
|
||||
},
|
||||
};
|
||||
|
||||
static struct resource flash_resources[] = {
|
||||
|
@ -368,11 +364,9 @@ static struct platform_device lubbock_flash_device[2] = {
|
|||
|
||||
static struct platform_device *devices[] __initdata = {
|
||||
&sa1111_device,
|
||||
&lub_audio_device,
|
||||
&smc91x_device,
|
||||
&lubbock_flash_device[0],
|
||||
&lubbock_flash_device[1],
|
||||
&pxa_ssp,
|
||||
};
|
||||
|
||||
static struct pxafb_mode_info sharp_lm8v31_mode = {
|
||||
|
@ -476,6 +470,7 @@ static void lubbock_irda_transceiver_mode(struct device *dev, int mode)
|
|||
} else if (mode & IR_FIRMODE) {
|
||||
LUB_MISC_WR |= 1 << 4;
|
||||
}
|
||||
pxa2xx_transceiver_mode(dev, mode);
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
|
@ -494,6 +489,7 @@ static void __init lubbock_init(void)
|
|||
set_pxa_fb_info(&sharp_lm8v31);
|
||||
pxa_set_mci_info(&lubbock_mci_platform_data);
|
||||
pxa_set_ficp_info(&lubbock_ficp_platform_data);
|
||||
pxa_set_ac97_info(NULL);
|
||||
|
||||
lubbock_flash_data[0].width = lubbock_flash_data[1].width =
|
||||
(BOOT_DEF & 1) ? 2 : 4;
|
||||
|
@ -505,6 +501,7 @@ static void __init lubbock_init(void)
|
|||
lubbock_flash_data[flashboot].name = "boot-rom";
|
||||
(void) platform_add_devices(devices, ARRAY_SIZE(devices));
|
||||
|
||||
pxa2xx_set_spi_info(1, &pxa_ssp_master_info);
|
||||
spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
|
||||
}
|
||||
|
||||
|
|
|
@ -17,31 +17,32 @@
|
|||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/gpio_keys.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/mfd/htc-egpio.h>
|
||||
#include <linux/mfd/htc-pasic3.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/map.h>
|
||||
#include <linux/mtd/physmap.h>
|
||||
#include <linux/pda_power.h>
|
||||
#include <linux/pwm_backlight.h>
|
||||
|
||||
#include <asm/gpio.h>
|
||||
#include <asm/hardware.h>
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/arch/magician.h>
|
||||
#include <asm/arch/mfp-pxa27x.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-regs.h>
|
||||
#include <asm/arch/pxafb.h>
|
||||
#include <asm/arch/i2c.h>
|
||||
#include <asm/arch/mmc.h>
|
||||
#include <asm/arch/irda.h>
|
||||
#include <asm/arch/ohci.h>
|
||||
|
||||
#include "devices.h"
|
||||
#include "generic.h"
|
||||
|
||||
static unsigned long magician_pin_config[] = {
|
||||
static unsigned long magician_pin_config[] __initdata = {
|
||||
|
||||
/* SDRAM and Static Memory I/O Signals */
|
||||
GPIO20_nSDCS_2,
|
||||
|
@ -131,6 +132,7 @@ static unsigned long magician_pin_config[] = {
|
|||
static void magician_irda_transceiver_mode(struct device *dev, int mode)
|
||||
{
|
||||
gpio_set_value(GPIO83_MAGICIAN_nIR_EN, mode & IR_OFF);
|
||||
pxa2xx_transceiver_mode(dev, mode);
|
||||
}
|
||||
|
||||
static struct pxaficp_platform_data magician_ficp_info = {
|
||||
|
@ -348,40 +350,59 @@ static struct pxafb_mach_info samsung_info = {
|
|||
* Backlight
|
||||
*/
|
||||
|
||||
static void magician_set_bl_intensity(int intensity)
|
||||
static int magician_backlight_init(struct device *dev)
|
||||
{
|
||||
if (intensity) {
|
||||
PWM_CTRL0 = 1;
|
||||
PWM_PERVAL0 = 0xc8;
|
||||
if (intensity > 0xc7) {
|
||||
PWM_PWDUTY0 = intensity - 0x48;
|
||||
gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 1);
|
||||
} else {
|
||||
PWM_PWDUTY0 = intensity;
|
||||
gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 0);
|
||||
}
|
||||
gpio_set_value(EGPIO_MAGICIAN_BL_POWER, 1);
|
||||
pxa_set_cken(CKEN_PWM0, 1);
|
||||
int ret;
|
||||
|
||||
ret = gpio_request(EGPIO_MAGICIAN_BL_POWER, "BL_POWER");
|
||||
if (ret)
|
||||
goto err;
|
||||
ret = gpio_request(EGPIO_MAGICIAN_BL_POWER2, "BL_POWER2");
|
||||
if (ret)
|
||||
goto err2;
|
||||
return 0;
|
||||
|
||||
err2:
|
||||
gpio_free(EGPIO_MAGICIAN_BL_POWER);
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int magician_backlight_notify(int brightness)
|
||||
{
|
||||
gpio_set_value(EGPIO_MAGICIAN_BL_POWER, brightness);
|
||||
if (brightness >= 200) {
|
||||
gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 1);
|
||||
return brightness - 72;
|
||||
} else {
|
||||
/* PWM_PWDUTY0 = intensity; */
|
||||
gpio_set_value(EGPIO_MAGICIAN_BL_POWER, 0);
|
||||
pxa_set_cken(CKEN_PWM0, 0);
|
||||
gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 0);
|
||||
return brightness;
|
||||
}
|
||||
}
|
||||
|
||||
static struct generic_bl_info backlight_info = {
|
||||
.default_intensity = 0x64,
|
||||
.limit_mask = 0x0b,
|
||||
.max_intensity = 0xc7+0x48,
|
||||
.set_bl_intensity = magician_set_bl_intensity,
|
||||
static void magician_backlight_exit(struct device *dev)
|
||||
{
|
||||
gpio_free(EGPIO_MAGICIAN_BL_POWER);
|
||||
gpio_free(EGPIO_MAGICIAN_BL_POWER2);
|
||||
}
|
||||
|
||||
static struct platform_pwm_backlight_data backlight_data = {
|
||||
.pwm_id = 0,
|
||||
.max_brightness = 272,
|
||||
.dft_brightness = 100,
|
||||
.pwm_period_ns = 30923,
|
||||
.init = magician_backlight_init,
|
||||
.notify = magician_backlight_notify,
|
||||
.exit = magician_backlight_exit,
|
||||
};
|
||||
|
||||
static struct platform_device backlight = {
|
||||
.name = "generic-bl",
|
||||
.dev = {
|
||||
.platform_data = &backlight_info,
|
||||
},
|
||||
.name = "pwm-backlight",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.parent = &pxa27x_device_pwm0.dev,
|
||||
.platform_data = &backlight_data,
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -490,6 +511,37 @@ static struct platform_device pasic3 = {
|
|||
* External power
|
||||
*/
|
||||
|
||||
static int power_supply_init(struct device *dev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = gpio_request(EGPIO_MAGICIAN_CABLE_STATE_AC, "CABLE_STATE_AC");
|
||||
if (ret)
|
||||
goto err_cs_ac;
|
||||
ret = gpio_request(EGPIO_MAGICIAN_CABLE_STATE_USB, "CABLE_STATE_USB");
|
||||
if (ret)
|
||||
goto err_cs_usb;
|
||||
ret = gpio_request(EGPIO_MAGICIAN_CHARGE_EN, "CHARGE_EN");
|
||||
if (ret)
|
||||
goto err_chg_en;
|
||||
ret = gpio_request(GPIO30_MAGICIAN_nCHARGE_EN, "nCHARGE_EN");
|
||||
if (!ret)
|
||||
ret = gpio_direction_output(GPIO30_MAGICIAN_nCHARGE_EN, 0);
|
||||
if (ret)
|
||||
goto err_nchg_en;
|
||||
|
||||
return 0;
|
||||
|
||||
err_nchg_en:
|
||||
gpio_free(EGPIO_MAGICIAN_CHARGE_EN);
|
||||
err_chg_en:
|
||||
gpio_free(EGPIO_MAGICIAN_CABLE_STATE_USB);
|
||||
err_cs_usb:
|
||||
gpio_free(EGPIO_MAGICIAN_CABLE_STATE_AC);
|
||||
err_cs_ac:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int magician_is_ac_online(void)
|
||||
{
|
||||
return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_AC);
|
||||
|
@ -506,14 +558,24 @@ static void magician_set_charge(int flags)
|
|||
gpio_set_value(EGPIO_MAGICIAN_CHARGE_EN, flags);
|
||||
}
|
||||
|
||||
static void power_supply_exit(struct device *dev)
|
||||
{
|
||||
gpio_free(GPIO30_MAGICIAN_nCHARGE_EN);
|
||||
gpio_free(EGPIO_MAGICIAN_CHARGE_EN);
|
||||
gpio_free(EGPIO_MAGICIAN_CABLE_STATE_USB);
|
||||
gpio_free(EGPIO_MAGICIAN_CABLE_STATE_AC);
|
||||
}
|
||||
|
||||
static char *magician_supplicants[] = {
|
||||
"ds2760-battery.0", "backup-battery"
|
||||
};
|
||||
|
||||
static struct pda_power_pdata power_supply_info = {
|
||||
.init = power_supply_init,
|
||||
.is_ac_online = magician_is_ac_online,
|
||||
.is_usb_online = magician_is_usb_online,
|
||||
.set_charge = magician_set_charge,
|
||||
.exit = power_supply_exit,
|
||||
.supplied_to = magician_supplicants,
|
||||
.num_supplicants = ARRAY_SIZE(magician_supplicants),
|
||||
};
|
||||
|
|
|
@ -23,9 +23,10 @@
|
|||
#include <linux/ioport.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/backlight.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/gpio_keys.h>
|
||||
#include <linux/pwm_backlight.h>
|
||||
#include <linux/smc91x.h>
|
||||
|
||||
#include <asm/types.h>
|
||||
#include <asm/setup.h>
|
||||
|
@ -110,9 +111,9 @@ static unsigned long mainstone_pin_config[] = {
|
|||
GPIO45_AC97_SYSCLK,
|
||||
|
||||
/* Keypad */
|
||||
GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,
|
||||
GPIO94_KP_DKIN_1 | WAKEUP_ON_LEVEL_HIGH,
|
||||
GPIO95_KP_DKIN_2 | WAKEUP_ON_LEVEL_HIGH,
|
||||
GPIO93_KP_DKIN_0,
|
||||
GPIO94_KP_DKIN_1,
|
||||
GPIO95_KP_DKIN_2,
|
||||
GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
|
||||
GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
|
||||
GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
|
||||
|
@ -240,11 +241,19 @@ static struct resource smc91x_resources[] = {
|
|||
}
|
||||
};
|
||||
|
||||
static struct smc91x_platdata mainstone_smc91x_info = {
|
||||
.flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT | SMC91X_USE_32BIT |
|
||||
SMC91X_NOWAIT | SMC91X_USE_DMA,
|
||||
};
|
||||
|
||||
static struct platform_device smc91x_device = {
|
||||
.name = "smc91x",
|
||||
.id = 0,
|
||||
.num_resources = ARRAY_SIZE(smc91x_resources),
|
||||
.resource = smc91x_resources,
|
||||
.dev = {
|
||||
.platform_data = &mainstone_smc91x_info,
|
||||
},
|
||||
};
|
||||
|
||||
static int mst_audio_startup(struct snd_pcm_substream *substream, void *priv)
|
||||
|
@ -280,12 +289,6 @@ static pxa2xx_audio_ops_t mst_audio_ops = {
|
|||
.resume = mst_audio_resume,
|
||||
};
|
||||
|
||||
static struct platform_device mst_audio_device = {
|
||||
.name = "pxa2xx-ac97",
|
||||
.id = -1,
|
||||
.dev = { .platform_data = &mst_audio_ops },
|
||||
};
|
||||
|
||||
static struct resource flash_resources[] = {
|
||||
[0] = {
|
||||
.start = PXA_CS0_PHYS,
|
||||
|
@ -349,56 +352,27 @@ static struct platform_device mst_flash_device[2] = {
|
|||
},
|
||||
};
|
||||
|
||||
#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
|
||||
static int mainstone_backlight_update_status(struct backlight_device *bl)
|
||||
{
|
||||
int brightness = bl->props.brightness;
|
||||
#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
|
||||
static struct platform_pwm_backlight_data mainstone_backlight_data = {
|
||||
.pwm_id = 0,
|
||||
.max_brightness = 1023,
|
||||
.dft_brightness = 1023,
|
||||
.pwm_period_ns = 78770,
|
||||
};
|
||||
|
||||
if (bl->props.power != FB_BLANK_UNBLANK ||
|
||||
bl->props.fb_blank != FB_BLANK_UNBLANK)
|
||||
brightness = 0;
|
||||
|
||||
if (brightness != 0)
|
||||
pxa_set_cken(CKEN_PWM0, 1);
|
||||
|
||||
PWM_CTRL0 = 0;
|
||||
PWM_PWDUTY0 = brightness;
|
||||
PWM_PERVAL0 = bl->props.max_brightness;
|
||||
|
||||
if (brightness == 0)
|
||||
pxa_set_cken(CKEN_PWM0, 0);
|
||||
return 0; /* pointless return value */
|
||||
}
|
||||
|
||||
static int mainstone_backlight_get_brightness(struct backlight_device *bl)
|
||||
{
|
||||
return PWM_PWDUTY0;
|
||||
}
|
||||
|
||||
static /*const*/ struct backlight_ops mainstone_backlight_ops = {
|
||||
.update_status = mainstone_backlight_update_status,
|
||||
.get_brightness = mainstone_backlight_get_brightness,
|
||||
static struct platform_device mainstone_backlight_device = {
|
||||
.name = "pwm-backlight",
|
||||
.dev = {
|
||||
.parent = &pxa27x_device_pwm0.dev,
|
||||
.platform_data = &mainstone_backlight_data,
|
||||
},
|
||||
};
|
||||
|
||||
static void __init mainstone_backlight_register(void)
|
||||
{
|
||||
struct backlight_device *bl;
|
||||
|
||||
bl = backlight_device_register("mainstone-bl", &pxa_device_fb.dev,
|
||||
NULL, &mainstone_backlight_ops);
|
||||
if (IS_ERR(bl)) {
|
||||
printk(KERN_ERR "mainstone: unable to register backlight: %ld\n",
|
||||
PTR_ERR(bl));
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* broken design - register-then-setup interfaces are
|
||||
* utterly broken by definition.
|
||||
*/
|
||||
bl->props.max_brightness = 1023;
|
||||
bl->props.brightness = 1023;
|
||||
backlight_update_status(bl);
|
||||
int ret = platform_device_register(&mainstone_backlight_device);
|
||||
if (ret)
|
||||
printk(KERN_ERR "mainstone: failed to register backlight device: %d\n", ret);
|
||||
}
|
||||
#else
|
||||
#define mainstone_backlight_register() do { } while (0)
|
||||
|
@ -490,6 +464,7 @@ static void mainstone_irda_transceiver_mode(struct device *dev, int mode)
|
|||
} else if (mode & IR_FIRMODE) {
|
||||
MST_MSCWR1 |= MST_MSCWR1_IRDA_FIR;
|
||||
}
|
||||
pxa2xx_transceiver_mode(dev, mode);
|
||||
if (mode & IR_OFF) {
|
||||
MST_MSCWR1 = (MST_MSCWR1 & ~MST_MSCWR1_IRDA_MASK) | MST_MSCWR1_IRDA_OFF;
|
||||
} else {
|
||||
|
@ -528,7 +503,6 @@ static struct platform_device mst_gpio_keys_device = {
|
|||
|
||||
static struct platform_device *platform_devices[] __initdata = {
|
||||
&smc91x_device,
|
||||
&mst_audio_device,
|
||||
&mst_flash_device[0],
|
||||
&mst_flash_device[1],
|
||||
&mst_gpio_keys_device,
|
||||
|
@ -549,7 +523,7 @@ static struct pxaohci_platform_data mainstone_ohci_platform_data = {
|
|||
.init = mainstone_ohci_init,
|
||||
};
|
||||
|
||||
#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULES)
|
||||
#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
|
||||
static unsigned int mainstone_matrix_keys[] = {
|
||||
KEY(0, 0, KEY_A), KEY(1, 0, KEY_B), KEY(2, 0, KEY_C),
|
||||
KEY(3, 0, KEY_D), KEY(4, 0, KEY_E), KEY(5, 0, KEY_F),
|
||||
|
@ -638,6 +612,7 @@ static void __init mainstone_init(void)
|
|||
pxa_set_ficp_info(&mainstone_ficp_platform_data);
|
||||
pxa_set_ohci_info(&mainstone_ohci_platform_data);
|
||||
pxa_set_i2c_info(NULL);
|
||||
pxa_set_ac97_info(&mst_audio_ops);
|
||||
|
||||
mainstone_init_keypad();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <asm/arch/hardware.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-regs.h>
|
||||
#include <asm/arch/mfp-pxa2xx.h>
|
||||
|
||||
#include "generic.h"
|
||||
|
@ -38,6 +39,28 @@ struct gpio_desc {
|
|||
|
||||
static struct gpio_desc gpio_desc[MFP_PIN_GPIO127 + 1];
|
||||
|
||||
static int __mfp_config_lpm(unsigned gpio, unsigned long lpm)
|
||||
{
|
||||
unsigned mask = GPIO_bit(gpio);
|
||||
|
||||
/* low power state */
|
||||
switch (lpm) {
|
||||
case MFP_LPM_DRIVE_HIGH:
|
||||
PGSR(gpio) |= mask;
|
||||
break;
|
||||
case MFP_LPM_DRIVE_LOW:
|
||||
PGSR(gpio) &= ~mask;
|
||||
break;
|
||||
case MFP_LPM_INPUT:
|
||||
break;
|
||||
default:
|
||||
pr_warning("%s: invalid low power state for GPIO%d\n",
|
||||
__func__, gpio);
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __mfp_config_gpio(unsigned gpio, unsigned long c)
|
||||
{
|
||||
unsigned long gafr, mask = GPIO_bit(gpio);
|
||||
|
@ -56,21 +79,8 @@ static int __mfp_config_gpio(unsigned gpio, unsigned long c)
|
|||
else
|
||||
GPDR(gpio) &= ~mask;
|
||||
|
||||
/* low power state */
|
||||
switch (c & MFP_LPM_STATE_MASK) {
|
||||
case MFP_LPM_DRIVE_HIGH:
|
||||
PGSR(gpio) |= mask;
|
||||
break;
|
||||
case MFP_LPM_DRIVE_LOW:
|
||||
PGSR(gpio) &= ~mask;
|
||||
break;
|
||||
case MFP_LPM_INPUT:
|
||||
break;
|
||||
default:
|
||||
pr_warning("%s: invalid low power state for GPIO%d\n",
|
||||
__func__, gpio);
|
||||
if (__mfp_config_lpm(gpio, c & MFP_LPM_STATE_MASK))
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* give early warning if MFP_LPM_CAN_WAKEUP is set on the
|
||||
* configurations of those pins not able to wakeup
|
||||
|
@ -90,6 +100,18 @@ static int __mfp_config_gpio(unsigned gpio, unsigned long c)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline int __mfp_validate(int mfp)
|
||||
{
|
||||
int gpio = mfp_to_gpio(mfp);
|
||||
|
||||
if ((mfp > MFP_PIN_GPIO127) || !gpio_desc[gpio].valid) {
|
||||
pr_warning("%s: GPIO%d is invalid pin\n", __func__, gpio);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return gpio;
|
||||
}
|
||||
|
||||
void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
@ -98,13 +120,9 @@ void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num)
|
|||
|
||||
for (i = 0, c = mfp_cfgs; i < num; i++, c++) {
|
||||
|
||||
gpio = mfp_to_gpio(MFP_PIN(*c));
|
||||
|
||||
if (!gpio_desc[gpio].valid) {
|
||||
pr_warning("%s: GPIO%d is invalid pin\n",
|
||||
__func__, gpio);
|
||||
gpio = __mfp_validate(MFP_PIN(*c));
|
||||
if (gpio < 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
local_irq_save(flags);
|
||||
|
||||
|
@ -115,6 +133,20 @@ void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num)
|
|||
}
|
||||
}
|
||||
|
||||
void pxa2xx_mfp_set_lpm(int mfp, unsigned long lpm)
|
||||
{
|
||||
unsigned long flags;
|
||||
int gpio;
|
||||
|
||||
gpio = __mfp_validate(mfp);
|
||||
if (gpio < 0)
|
||||
return;
|
||||
|
||||
local_irq_save(flags);
|
||||
__mfp_config_lpm(gpio, lpm);
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
int gpio_set_wake(unsigned int gpio, unsigned int on)
|
||||
{
|
||||
struct gpio_desc *d;
|
||||
|
|
416
arch/arm/mach-pxa/palmtx.c
Normal file
416
arch/arm/mach-pxa/palmtx.c
Normal file
|
@ -0,0 +1,416 @@
|
|||
/*
|
||||
* Hardware definitions for PalmTX
|
||||
*
|
||||
* Author: Marek Vasut <marek.vasut@gmail.com>
|
||||
*
|
||||
* Based on work of:
|
||||
* Alex Osborne <ato@meshy.org>
|
||||
* Cristiano P. <cristianop@users.sourceforge.net>
|
||||
* Jan Herman <2hp@seznam.cz>
|
||||
* Michal Hrusecky
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* (find more info at www.hackndev.com)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/gpio_keys.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/pda_power.h>
|
||||
#include <linux/pwm_backlight.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include <asm/arch/audio.h>
|
||||
#include <asm/arch/palmtx.h>
|
||||
#include <asm/arch/mmc.h>
|
||||
#include <asm/arch/pxafb.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/mfp-pxa27x.h>
|
||||
#include <asm/arch/irda.h>
|
||||
#include <asm/arch/pxa27x_keypad.h>
|
||||
#include <asm/arch/udc.h>
|
||||
|
||||
#include "generic.h"
|
||||
#include "devices.h"
|
||||
|
||||
/******************************************************************************
|
||||
* Pin configuration
|
||||
******************************************************************************/
|
||||
static unsigned long palmtx_pin_config[] __initdata = {
|
||||
/* MMC */
|
||||
GPIO32_MMC_CLK,
|
||||
GPIO92_MMC_DAT_0,
|
||||
GPIO109_MMC_DAT_1,
|
||||
GPIO110_MMC_DAT_2,
|
||||
GPIO111_MMC_DAT_3,
|
||||
GPIO112_MMC_CMD,
|
||||
|
||||
/* AC97 */
|
||||
GPIO28_AC97_BITCLK,
|
||||
GPIO29_AC97_SDATA_IN_0,
|
||||
GPIO30_AC97_SDATA_OUT,
|
||||
GPIO31_AC97_SYNC,
|
||||
|
||||
/* IrDA */
|
||||
GPIO46_FICP_RXD,
|
||||
GPIO47_FICP_TXD,
|
||||
|
||||
/* PWM */
|
||||
GPIO16_PWM0_OUT,
|
||||
|
||||
/* USB */
|
||||
GPIO13_GPIO,
|
||||
|
||||
/* PCMCIA */
|
||||
GPIO48_nPOE,
|
||||
GPIO49_nPWE,
|
||||
GPIO50_nPIOR,
|
||||
GPIO51_nPIOW,
|
||||
GPIO85_nPCE_1,
|
||||
GPIO54_nPCE_2,
|
||||
GPIO79_PSKTSEL,
|
||||
GPIO55_nPREG,
|
||||
GPIO56_nPWAIT,
|
||||
GPIO57_nIOIS16,
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* SD/MMC card controller
|
||||
******************************************************************************/
|
||||
static int palmtx_mci_init(struct device *dev, irq_handler_t palmtx_detect_int,
|
||||
void *data)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
/* Setup an interrupt for detecting card insert/remove events */
|
||||
err = request_irq(IRQ_GPIO_PALMTX_SD_DETECT_N, palmtx_detect_int,
|
||||
IRQF_DISABLED | IRQF_SAMPLE_RANDOM |
|
||||
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
|
||||
"SD/MMC card detect", data);
|
||||
if (err) {
|
||||
printk(KERN_ERR "%s: cannot request SD/MMC card detect IRQ\n",
|
||||
__func__);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = gpio_request(GPIO_NR_PALMTX_SD_POWER, "SD_POWER");
|
||||
if (err)
|
||||
goto pwr_err;
|
||||
|
||||
err = gpio_request(GPIO_NR_PALMTX_SD_READONLY, "SD_READONLY");
|
||||
if (err)
|
||||
goto ro_err;
|
||||
|
||||
printk(KERN_DEBUG "%s: irq registered\n", __func__);
|
||||
|
||||
return 0;
|
||||
|
||||
ro_err:
|
||||
gpio_free(GPIO_NR_PALMTX_SD_POWER);
|
||||
pwr_err:
|
||||
free_irq(IRQ_GPIO_PALMTX_SD_DETECT_N, data);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void palmtx_mci_exit(struct device *dev, void *data)
|
||||
{
|
||||
gpio_free(GPIO_NR_PALMTX_SD_READONLY);
|
||||
gpio_free(GPIO_NR_PALMTX_SD_POWER);
|
||||
free_irq(IRQ_GPIO_PALMTX_SD_DETECT_N, data);
|
||||
}
|
||||
|
||||
static void palmtx_mci_power(struct device *dev, unsigned int vdd)
|
||||
{
|
||||
struct pxamci_platform_data *p_d = dev->platform_data;
|
||||
gpio_set_value(GPIO_NR_PALMTX_SD_POWER, p_d->ocr_mask & (1 << vdd));
|
||||
}
|
||||
|
||||
static int palmtx_mci_get_ro(struct device *dev)
|
||||
{
|
||||
return gpio_get_value(GPIO_NR_PALMTX_SD_READONLY);
|
||||
}
|
||||
|
||||
static struct pxamci_platform_data palmtx_mci_platform_data = {
|
||||
.ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
|
||||
.setpower = palmtx_mci_power,
|
||||
.get_ro = palmtx_mci_get_ro,
|
||||
.init = palmtx_mci_init,
|
||||
.exit = palmtx_mci_exit,
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* GPIO keyboard
|
||||
******************************************************************************/
|
||||
static unsigned int palmtx_matrix_keys[] = {
|
||||
KEY(0, 0, KEY_POWER),
|
||||
KEY(0, 1, KEY_F1),
|
||||
KEY(0, 2, KEY_ENTER),
|
||||
|
||||
KEY(1, 0, KEY_F2),
|
||||
KEY(1, 1, KEY_F3),
|
||||
KEY(1, 2, KEY_F4),
|
||||
|
||||
KEY(2, 0, KEY_UP),
|
||||
KEY(2, 2, KEY_DOWN),
|
||||
|
||||
KEY(3, 0, KEY_RIGHT),
|
||||
KEY(3, 2, KEY_LEFT),
|
||||
|
||||
};
|
||||
|
||||
static struct pxa27x_keypad_platform_data palmtx_keypad_platform_data = {
|
||||
.matrix_key_rows = 4,
|
||||
.matrix_key_cols = 3,
|
||||
.matrix_key_map = palmtx_matrix_keys,
|
||||
.matrix_key_map_size = ARRAY_SIZE(palmtx_matrix_keys),
|
||||
|
||||
.debounce_interval = 30,
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* GPIO keys
|
||||
******************************************************************************/
|
||||
static struct gpio_keys_button palmtx_pxa_buttons[] = {
|
||||
{KEY_F8, GPIO_NR_PALMTX_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
|
||||
};
|
||||
|
||||
static struct gpio_keys_platform_data palmtx_pxa_keys_data = {
|
||||
.buttons = palmtx_pxa_buttons,
|
||||
.nbuttons = ARRAY_SIZE(palmtx_pxa_buttons),
|
||||
};
|
||||
|
||||
static struct platform_device palmtx_pxa_keys = {
|
||||
.name = "gpio-keys",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &palmtx_pxa_keys_data,
|
||||
},
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* Backlight
|
||||
******************************************************************************/
|
||||
static int palmtx_backlight_init(struct device *dev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = gpio_request(GPIO_NR_PALMTX_BL_POWER, "BL POWER");
|
||||
if (ret)
|
||||
goto err;
|
||||
ret = gpio_request(GPIO_NR_PALMTX_LCD_POWER, "LCD POWER");
|
||||
if (ret)
|
||||
goto err2;
|
||||
|
||||
return 0;
|
||||
err2:
|
||||
gpio_free(GPIO_NR_PALMTX_BL_POWER);
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int palmtx_backlight_notify(int brightness)
|
||||
{
|
||||
gpio_set_value(GPIO_NR_PALMTX_BL_POWER, brightness);
|
||||
gpio_set_value(GPIO_NR_PALMTX_LCD_POWER, brightness);
|
||||
return brightness;
|
||||
}
|
||||
|
||||
static void palmtx_backlight_exit(struct device *dev)
|
||||
{
|
||||
gpio_free(GPIO_NR_PALMTX_BL_POWER);
|
||||
gpio_free(GPIO_NR_PALMTX_LCD_POWER);
|
||||
}
|
||||
|
||||
static struct platform_pwm_backlight_data palmtx_backlight_data = {
|
||||
.pwm_id = 0,
|
||||
.max_brightness = PALMTX_MAX_INTENSITY,
|
||||
.dft_brightness = PALMTX_MAX_INTENSITY,
|
||||
.pwm_period_ns = PALMTX_PERIOD_NS,
|
||||
.init = palmtx_backlight_init,
|
||||
.notify = palmtx_backlight_notify,
|
||||
.exit = palmtx_backlight_exit,
|
||||
};
|
||||
|
||||
static struct platform_device palmtx_backlight = {
|
||||
.name = "pwm-backlight",
|
||||
.dev = {
|
||||
.parent = &pxa27x_device_pwm0.dev,
|
||||
.platform_data = &palmtx_backlight_data,
|
||||
},
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* IrDA
|
||||
******************************************************************************/
|
||||
static void palmtx_irda_transceiver_mode(struct device *dev, int mode)
|
||||
{
|
||||
gpio_set_value(GPIO_NR_PALMTX_IR_DISABLE, mode & IR_OFF);
|
||||
pxa2xx_transceiver_mode(dev, mode);
|
||||
}
|
||||
|
||||
static struct pxaficp_platform_data palmtx_ficp_platform_data = {
|
||||
.transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
|
||||
.transceiver_mode = palmtx_irda_transceiver_mode,
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* UDC
|
||||
******************************************************************************/
|
||||
static void palmtx_udc_command(int cmd)
|
||||
{
|
||||
gpio_set_value(GPIO_NR_PALMTX_USB_POWER, !cmd);
|
||||
udelay(50);
|
||||
gpio_set_value(GPIO_NR_PALMTX_USB_PULLUP, !cmd);
|
||||
}
|
||||
|
||||
static struct pxa2xx_udc_mach_info palmtx_udc_info __initdata = {
|
||||
.gpio_vbus = GPIO_NR_PALMTX_USB_DETECT_N,
|
||||
.gpio_vbus_inverted = 1,
|
||||
.udc_command = palmtx_udc_command,
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* Power supply
|
||||
******************************************************************************/
|
||||
static int power_supply_init(struct device *dev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = gpio_request(GPIO_NR_PALMTX_POWER_DETECT, "CABLE_STATE_AC");
|
||||
if (ret)
|
||||
goto err_cs_ac;
|
||||
|
||||
ret = gpio_request(GPIO_NR_PALMTX_USB_DETECT_N, "CABLE_STATE_USB");
|
||||
if (ret)
|
||||
goto err_cs_usb;
|
||||
|
||||
return 0;
|
||||
|
||||
err_cs_usb:
|
||||
gpio_free(GPIO_NR_PALMTX_POWER_DETECT);
|
||||
err_cs_ac:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int palmtx_is_ac_online(void)
|
||||
{
|
||||
return gpio_get_value(GPIO_NR_PALMTX_POWER_DETECT);
|
||||
}
|
||||
|
||||
static int palmtx_is_usb_online(void)
|
||||
{
|
||||
return !gpio_get_value(GPIO_NR_PALMTX_USB_DETECT_N);
|
||||
}
|
||||
|
||||
static void power_supply_exit(struct device *dev)
|
||||
{
|
||||
gpio_free(GPIO_NR_PALMTX_USB_DETECT_N);
|
||||
gpio_free(GPIO_NR_PALMTX_POWER_DETECT);
|
||||
}
|
||||
|
||||
static char *palmtx_supplicants[] = {
|
||||
"main-battery",
|
||||
};
|
||||
|
||||
static struct pda_power_pdata power_supply_info = {
|
||||
.init = power_supply_init,
|
||||
.is_ac_online = palmtx_is_ac_online,
|
||||
.is_usb_online = palmtx_is_usb_online,
|
||||
.exit = power_supply_exit,
|
||||
.supplied_to = palmtx_supplicants,
|
||||
.num_supplicants = ARRAY_SIZE(palmtx_supplicants),
|
||||
};
|
||||
|
||||
static struct platform_device power_supply = {
|
||||
.name = "pda-power",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &power_supply_info,
|
||||
},
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* Framebuffer
|
||||
******************************************************************************/
|
||||
static struct pxafb_mode_info palmtx_lcd_modes[] = {
|
||||
{
|
||||
.pixclock = 57692,
|
||||
.xres = 320,
|
||||
.yres = 480,
|
||||
.bpp = 16,
|
||||
|
||||
.left_margin = 32,
|
||||
.right_margin = 1,
|
||||
.upper_margin = 7,
|
||||
.lower_margin = 1,
|
||||
|
||||
.hsync_len = 4,
|
||||
.vsync_len = 1,
|
||||
},
|
||||
};
|
||||
|
||||
static struct pxafb_mach_info palmtx_lcd_screen = {
|
||||
.modes = palmtx_lcd_modes,
|
||||
.num_modes = ARRAY_SIZE(palmtx_lcd_modes),
|
||||
.lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* Machine init
|
||||
******************************************************************************/
|
||||
static struct platform_device *devices[] __initdata = {
|
||||
#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
|
||||
&palmtx_pxa_keys,
|
||||
#endif
|
||||
&palmtx_backlight,
|
||||
&power_supply,
|
||||
};
|
||||
|
||||
static struct map_desc palmtx_io_desc[] __initdata = {
|
||||
{
|
||||
.virtual = PALMTX_PCMCIA_VIRT,
|
||||
.pfn = __phys_to_pfn(PALMTX_PCMCIA_PHYS),
|
||||
.length = PALMTX_PCMCIA_SIZE,
|
||||
.type = MT_DEVICE
|
||||
},
|
||||
};
|
||||
|
||||
static void __init palmtx_map_io(void)
|
||||
{
|
||||
pxa_map_io();
|
||||
iotable_init(palmtx_io_desc, ARRAY_SIZE(palmtx_io_desc));
|
||||
}
|
||||
|
||||
static void __init palmtx_init(void)
|
||||
{
|
||||
pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config));
|
||||
|
||||
set_pxa_fb_info(&palmtx_lcd_screen);
|
||||
pxa_set_mci_info(&palmtx_mci_platform_data);
|
||||
pxa_set_udc_info(&palmtx_udc_info);
|
||||
pxa_set_ac97_info(NULL);
|
||||
pxa_set_ficp_info(&palmtx_ficp_platform_data);
|
||||
pxa_set_keypad_info(&palmtx_keypad_platform_data);
|
||||
|
||||
platform_add_devices(devices, ARRAY_SIZE(devices));
|
||||
}
|
||||
|
||||
MACHINE_START(PALMTX, "Palm T|X")
|
||||
.phys_io = PALMTX_PHYS_IO_START,
|
||||
.io_pg_offst = io_p2v(0x40000000),
|
||||
.boot_params = 0xa0000100,
|
||||
.map_io = palmtx_map_io,
|
||||
.init_irq = pxa27x_init_irq,
|
||||
.timer = &pxa_timer,
|
||||
.init_machine = palmtx_init
|
||||
MACHINE_END
|
|
@ -24,7 +24,9 @@
|
|||
#include <linux/platform_device.h>
|
||||
#include <linux/mtd/physmap.h>
|
||||
#include <linux/spi/spi.h>
|
||||
#include <linux/spi/max7301.h>
|
||||
#include <linux/leds.h>
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/arch/hardware.h>
|
||||
|
@ -108,6 +110,32 @@ static struct platform_device smc91x_device = {
|
|||
.resource = smc91x_resources,
|
||||
};
|
||||
|
||||
/*
|
||||
* SPI host and devices
|
||||
*/
|
||||
static struct pxa2xx_spi_master pxa_ssp_master_info = {
|
||||
.num_chipselect = 1,
|
||||
};
|
||||
|
||||
static struct max7301_platform_data max7301_info = {
|
||||
.base = -1,
|
||||
};
|
||||
|
||||
/* bus_num must match id in pxa2xx_set_spi_info() call */
|
||||
static struct spi_board_info spi_board_info[] __initdata = {
|
||||
{
|
||||
.modalias = "max7301",
|
||||
.platform_data = &max7301_info,
|
||||
.max_speed_hz = 13000000,
|
||||
.bus_num = 1,
|
||||
.chip_select = 0,
|
||||
.mode = SPI_MODE_0,
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* NOR flash
|
||||
*/
|
||||
static struct physmap_flash_data pcm027_flash_data = {
|
||||
.width = 4,
|
||||
};
|
||||
|
@ -190,6 +218,9 @@ static void __init pcm027_init(void)
|
|||
#ifdef CONFIG_MACH_PCM990_BASEBOARD
|
||||
pcm990_baseboard_init();
|
||||
#endif
|
||||
|
||||
pxa2xx_set_spi_info(1, &pxa_ssp_master_info);
|
||||
spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
|
||||
}
|
||||
|
||||
static void __init pcm027_map_io(void)
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <linux/platform_device.h>
|
||||
#include <linux/ide.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/pwm_backlight.h>
|
||||
|
||||
#include <media/soc_camera.h>
|
||||
|
||||
|
@ -32,13 +33,120 @@
|
|||
#include <asm/arch/camera.h>
|
||||
#include <asm/mach/map.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-gpio.h>
|
||||
#include <asm/arch/audio.h>
|
||||
#include <asm/arch/mmc.h>
|
||||
#include <asm/arch/ohci.h>
|
||||
#include <asm/arch/pcm990_baseboard.h>
|
||||
#include <asm/arch/pxafb.h>
|
||||
#include <asm/arch/mfp-pxa27x.h>
|
||||
|
||||
#include "devices.h"
|
||||
#include "generic.h"
|
||||
|
||||
static unsigned long pcm990_pin_config[] __initdata = {
|
||||
/* MMC */
|
||||
GPIO32_MMC_CLK,
|
||||
GPIO112_MMC_CMD,
|
||||
GPIO92_MMC_DAT_0,
|
||||
GPIO109_MMC_DAT_1,
|
||||
GPIO110_MMC_DAT_2,
|
||||
GPIO111_MMC_DAT_3,
|
||||
/* USB */
|
||||
GPIO88_USBH1_PWR,
|
||||
GPIO89_USBH1_PEN,
|
||||
/* PWM0 */
|
||||
GPIO16_PWM0_OUT,
|
||||
};
|
||||
|
||||
/*
|
||||
* The PCM-990 development baseboard uses PCM-027's hardeware in the
|
||||
* pcm990_lcd_power - control power supply to the LCD
|
||||
* @on: 0 = switch off, 1 = switch on
|
||||
*
|
||||
* Called by the pxafb driver
|
||||
*/
|
||||
#ifndef CONFIG_PCM990_DISPLAY_NONE
|
||||
static void pcm990_lcd_power(int on, struct fb_var_screeninfo *var)
|
||||
{
|
||||
if (on) {
|
||||
/* enable LCD-Latches
|
||||
* power on LCD
|
||||
*/
|
||||
__PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG3) =
|
||||
PCM990_CTRL_LCDPWR + PCM990_CTRL_LCDON;
|
||||
} else {
|
||||
/* disable LCD-Latches
|
||||
* power off LCD
|
||||
*/
|
||||
__PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG3) = 0x00;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PCM990_DISPLAY_SHARP)
|
||||
static struct pxafb_mode_info fb_info_sharp_lq084v1dg21 = {
|
||||
.pixclock = 28000,
|
||||
.xres = 640,
|
||||
.yres = 480,
|
||||
.bpp = 16,
|
||||
.hsync_len = 20,
|
||||
.left_margin = 103,
|
||||
.right_margin = 47,
|
||||
.vsync_len = 6,
|
||||
.upper_margin = 28,
|
||||
.lower_margin = 5,
|
||||
.sync = 0,
|
||||
.cmap_greyscale = 0,
|
||||
};
|
||||
|
||||
static struct pxafb_mach_info pcm990_fbinfo __initdata = {
|
||||
.modes = &fb_info_sharp_lq084v1dg21,
|
||||
.num_modes = 1,
|
||||
.lccr0 = LCCR0_PAS,
|
||||
.lccr3 = LCCR3_PCP,
|
||||
.pxafb_lcd_power = pcm990_lcd_power,
|
||||
};
|
||||
#elif defined(CONFIG_PCM990_DISPLAY_NEC)
|
||||
struct pxafb_mode_info fb_info_nec_nl6448bc20_18d = {
|
||||
.pixclock = 39720,
|
||||
.xres = 640,
|
||||
.yres = 480,
|
||||
.bpp = 16,
|
||||
.hsync_len = 32,
|
||||
.left_margin = 16,
|
||||
.right_margin = 48,
|
||||
.vsync_len = 2,
|
||||
.upper_margin = 12,
|
||||
.lower_margin = 17,
|
||||
.sync = 0,
|
||||
.cmap_greyscale = 0,
|
||||
};
|
||||
|
||||
static struct pxafb_mach_info pcm990_fbinfo __initdata = {
|
||||
.modes = &fb_info_nec_nl6448bc20_18d,
|
||||
.num_modes = 1,
|
||||
.lccr0 = LCCR0_Act,
|
||||
.lccr3 = LCCR3_PixFlEdg,
|
||||
.pxafb_lcd_power = pcm990_lcd_power,
|
||||
};
|
||||
#endif
|
||||
|
||||
static struct platform_pwm_backlight_data pcm990_backlight_data = {
|
||||
.pwm_id = 0,
|
||||
.max_brightness = 1023,
|
||||
.dft_brightness = 1023,
|
||||
.pwm_period_ns = 78770,
|
||||
};
|
||||
|
||||
static struct platform_device pcm990_backlight_device = {
|
||||
.name = "pwm-backlight",
|
||||
.dev = {
|
||||
.parent = &pxa27x_device_pwm0.dev,
|
||||
.platform_data = &pcm990_backlight_data,
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* The PCM-990 development baseboard uses PCM-027's hardware in the
|
||||
* following way:
|
||||
*
|
||||
* - LCD support is in use
|
||||
|
@ -185,16 +293,6 @@ static int pcm990_mci_init(struct device *dev, irq_handler_t mci_detect_int,
|
|||
{
|
||||
int err;
|
||||
|
||||
/*
|
||||
* enable GPIO for PXA27x MMC controller
|
||||
*/
|
||||
pxa_gpio_mode(GPIO32_MMCCLK_MD);
|
||||
pxa_gpio_mode(GPIO112_MMCCMD_MD);
|
||||
pxa_gpio_mode(GPIO92_MMCDAT0_MD);
|
||||
pxa_gpio_mode(GPIO109_MMCDAT1_MD);
|
||||
pxa_gpio_mode(GPIO110_MMCDAT2_MD);
|
||||
pxa_gpio_mode(GPIO111_MMCDAT3_MD);
|
||||
|
||||
err = request_irq(PCM027_MMCDET_IRQ, mci_detect_int, IRQF_DISABLED,
|
||||
"MMC card detect", data);
|
||||
if (err)
|
||||
|
@ -241,8 +339,6 @@ static struct pxamci_platform_data pcm990_mci_platform_data = {
|
|||
*/
|
||||
static int pcm990_ohci_init(struct device *dev)
|
||||
{
|
||||
pxa_gpio_mode(PCM990_USB_OVERCURRENT);
|
||||
pxa_gpio_mode(PCM990_USB_PWR_EN);
|
||||
/*
|
||||
* disable USB port 2 and 3
|
||||
* power sense is active low
|
||||
|
@ -269,23 +365,27 @@ static struct pxaohci_platform_data pcm990_ohci_platform_data = {
|
|||
* PXA27x Camera specific stuff
|
||||
*/
|
||||
#if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE)
|
||||
static unsigned long pcm990_camera_pin_config[] = {
|
||||
/* CIF */
|
||||
GPIO98_CIF_DD_0,
|
||||
GPIO105_CIF_DD_1,
|
||||
GPIO104_CIF_DD_2,
|
||||
GPIO103_CIF_DD_3,
|
||||
GPIO95_CIF_DD_4,
|
||||
GPIO94_CIF_DD_5,
|
||||
GPIO93_CIF_DD_6,
|
||||
GPIO108_CIF_DD_7,
|
||||
GPIO107_CIF_DD_8,
|
||||
GPIO106_CIF_DD_9,
|
||||
GPIO42_CIF_MCLK,
|
||||
GPIO45_CIF_PCLK,
|
||||
GPIO43_CIF_FV,
|
||||
GPIO44_CIF_LV,
|
||||
};
|
||||
|
||||
static int pcm990_pxacamera_init(struct device *dev)
|
||||
{
|
||||
pxa_gpio_mode(GPIO98_CIF_DD_0_MD);
|
||||
pxa_gpio_mode(GPIO105_CIF_DD_1_MD);
|
||||
pxa_gpio_mode(GPIO104_CIF_DD_2_MD);
|
||||
pxa_gpio_mode(GPIO103_CIF_DD_3_MD);
|
||||
pxa_gpio_mode(GPIO95_CIF_DD_4_MD);
|
||||
pxa_gpio_mode(GPIO94_CIF_DD_5_MD);
|
||||
pxa_gpio_mode(GPIO93_CIF_DD_6_MD);
|
||||
pxa_gpio_mode(GPIO108_CIF_DD_7_MD);
|
||||
pxa_gpio_mode(GPIO107_CIF_DD_8_MD);
|
||||
pxa_gpio_mode(GPIO106_CIF_DD_9_MD);
|
||||
pxa_gpio_mode(GPIO42_CIF_MCLK_MD);
|
||||
pxa_gpio_mode(GPIO45_CIF_PCLK_MD);
|
||||
pxa_gpio_mode(GPIO43_CIF_FV_MD);
|
||||
pxa_gpio_mode(GPIO44_CIF_LV_MD);
|
||||
|
||||
pxa2xx_mfp_config(ARRAY_AND_SIZE(pcm990_camera_pin_config));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -332,36 +432,6 @@ static struct i2c_board_info __initdata pcm990_i2c_devices[] = {
|
|||
};
|
||||
#endif /* CONFIG_VIDEO_PXA27x ||CONFIG_VIDEO_PXA27x_MODULE */
|
||||
|
||||
/*
|
||||
* AC97 support
|
||||
* Note: The connected AC97 mixer also reports interrupts at PCM990_AC97_IRQ
|
||||
*/
|
||||
static struct resource pxa27x_ac97_resources[] = {
|
||||
[0] = {
|
||||
.start = 0x40500000,
|
||||
.end = 0x40500000 + 0xfff,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
[1] = {
|
||||
.start = IRQ_AC97,
|
||||
.end = IRQ_AC97,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
static u64 pxa_ac97_dmamask = 0xffffffffUL;
|
||||
|
||||
static struct platform_device pxa27x_device_ac97 = {
|
||||
.name = "pxa2xx-ac97",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.dma_mask = &pxa_ac97_dmamask,
|
||||
.coherent_dma_mask = 0xffffffff,
|
||||
},
|
||||
.num_resources = ARRAY_SIZE(pxa27x_ac97_resources),
|
||||
.resource = pxa27x_ac97_resources,
|
||||
};
|
||||
|
||||
/*
|
||||
* enable generic access to the base board control CPLDs U6 and U7
|
||||
*/
|
||||
|
@ -387,13 +457,18 @@ static struct map_desc pcm990_io_desc[] __initdata = {
|
|||
*/
|
||||
void __init pcm990_baseboard_init(void)
|
||||
{
|
||||
pxa2xx_mfp_config(ARRAY_AND_SIZE(pcm990_pin_config));
|
||||
|
||||
/* register CPLD access */
|
||||
iotable_init(pcm990_io_desc, ARRAY_SIZE(pcm990_io_desc));
|
||||
iotable_init(ARRAY_AND_SIZE(pcm990_io_desc));
|
||||
|
||||
/* register CPLD's IRQ controller */
|
||||
pcm990_init_irq();
|
||||
|
||||
platform_device_register(&pxa27x_device_ac97);
|
||||
#ifndef CONFIG_PCM990_DISPLAY_NONE
|
||||
set_pxa_fb_info(&pcm990_fbinfo);
|
||||
#endif
|
||||
platform_device_register(&pcm990_backlight_device);
|
||||
|
||||
/* MMC */
|
||||
pxa_set_mci_info(&pcm990_mci_platform_data);
|
||||
|
@ -402,13 +477,13 @@ void __init pcm990_baseboard_init(void)
|
|||
pxa_set_ohci_info(&pcm990_ohci_platform_data);
|
||||
|
||||
pxa_set_i2c_info(NULL);
|
||||
pxa_set_ac97_info(NULL);
|
||||
|
||||
#if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE)
|
||||
pxa_set_camera_info(&pcm990_pxacamera_platform_data);
|
||||
|
||||
i2c_register_board_info(0, pcm990_i2c_devices,
|
||||
ARRAY_SIZE(pcm990_i2c_devices));
|
||||
i2c_register_board_info(0, ARRAY_AND_SIZE(pcm990_i2c_devices));
|
||||
#endif
|
||||
|
||||
printk(KERN_INFO"PCM-990 Evaluation baseboard initialized\n");
|
||||
printk(KERN_INFO "PCM-990 Evaluation baseboard initialized\n");
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <asm/mach/irq.h>
|
||||
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-regs.h>
|
||||
#include <asm/arch/pxa2xx-gpio.h>
|
||||
#include <asm/arch/mmc.h>
|
||||
#include <asm/arch/udc.h>
|
||||
|
@ -266,6 +267,7 @@ static void poodle_irda_transceiver_mode(struct device *dev, int mode)
|
|||
} else {
|
||||
GPCR(POODLE_GPIO_IR_ON) = GPIO_bit(POODLE_GPIO_IR_ON);
|
||||
}
|
||||
pxa2xx_transceiver_mode(dev, mode);
|
||||
}
|
||||
|
||||
static struct pxaficp_platform_data poodle_ficp_platform_data = {
|
||||
|
|
319
arch/arm/mach-pxa/pwm.c
Normal file
319
arch/arm/mach-pxa/pwm.c
Normal file
|
@ -0,0 +1,319 @@
|
|||
/*
|
||||
* linux/arch/arm/mach-pxa/pwm.c
|
||||
*
|
||||
* simple driver for PWM (Pulse Width Modulator) controller
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 2008-02-13 initial version
|
||||
* eric miao <eric.miao@marvell.com>
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/pwm.h>
|
||||
|
||||
#include <asm/div64.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
|
||||
/* PWM registers and bits definitions */
|
||||
#define PWMCR (0x00)
|
||||
#define PWMDCR (0x04)
|
||||
#define PWMPCR (0x08)
|
||||
|
||||
#define PWMCR_SD (1 << 6)
|
||||
#define PWMDCR_FD (1 << 10)
|
||||
|
||||
struct pwm_device {
|
||||
struct list_head node;
|
||||
struct platform_device *pdev;
|
||||
|
||||
const char *label;
|
||||
struct clk *clk;
|
||||
int clk_enabled;
|
||||
void __iomem *mmio_base;
|
||||
|
||||
unsigned int use_count;
|
||||
unsigned int pwm_id;
|
||||
};
|
||||
|
||||
/*
|
||||
* period_ns = 10^9 * (PRESCALE + 1) * (PV + 1) / PWM_CLK_RATE
|
||||
* duty_ns = 10^9 * (PRESCALE + 1) * DC / PWM_CLK_RATE
|
||||
*/
|
||||
int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
|
||||
{
|
||||
unsigned long long c;
|
||||
unsigned long period_cycles, prescale, pv, dc;
|
||||
|
||||
if (pwm == NULL || period_ns == 0 || duty_ns > period_ns)
|
||||
return -EINVAL;
|
||||
|
||||
c = clk_get_rate(pwm->clk);
|
||||
c = c * period_ns;
|
||||
do_div(c, 1000000000);
|
||||
period_cycles = c;
|
||||
|
||||
if (period_cycles < 0)
|
||||
period_cycles = 1;
|
||||
prescale = (period_cycles - 1) / 1024;
|
||||
pv = period_cycles / (prescale + 1) - 1;
|
||||
|
||||
if (prescale > 63)
|
||||
return -EINVAL;
|
||||
|
||||
if (duty_ns == period_ns)
|
||||
dc = PWMDCR_FD;
|
||||
else
|
||||
dc = (pv + 1) * duty_ns / period_ns;
|
||||
|
||||
/* NOTE: the clock to PWM has to be enabled first
|
||||
* before writing to the registers
|
||||
*/
|
||||
clk_enable(pwm->clk);
|
||||
__raw_writel(prescale, pwm->mmio_base + PWMCR);
|
||||
__raw_writel(dc, pwm->mmio_base + PWMDCR);
|
||||
__raw_writel(pv, pwm->mmio_base + PWMPCR);
|
||||
clk_disable(pwm->clk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(pwm_config);
|
||||
|
||||
int pwm_enable(struct pwm_device *pwm)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (!pwm->clk_enabled) {
|
||||
rc = clk_enable(pwm->clk);
|
||||
if (!rc)
|
||||
pwm->clk_enabled = 1;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
EXPORT_SYMBOL(pwm_enable);
|
||||
|
||||
void pwm_disable(struct pwm_device *pwm)
|
||||
{
|
||||
if (pwm->clk_enabled) {
|
||||
clk_disable(pwm->clk);
|
||||
pwm->clk_enabled = 0;
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(pwm_disable);
|
||||
|
||||
static DEFINE_MUTEX(pwm_lock);
|
||||
static LIST_HEAD(pwm_list);
|
||||
|
||||
struct pwm_device *pwm_request(int pwm_id, const char *label)
|
||||
{
|
||||
struct pwm_device *pwm;
|
||||
int found = 0;
|
||||
|
||||
mutex_lock(&pwm_lock);
|
||||
|
||||
list_for_each_entry(pwm, &pwm_list, node) {
|
||||
if (pwm->pwm_id == pwm_id) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
if (pwm->use_count == 0) {
|
||||
pwm->use_count++;
|
||||
pwm->label = label;
|
||||
} else
|
||||
pwm = ERR_PTR(-EBUSY);
|
||||
} else
|
||||
pwm = ERR_PTR(-ENOENT);
|
||||
|
||||
mutex_unlock(&pwm_lock);
|
||||
return pwm;
|
||||
}
|
||||
EXPORT_SYMBOL(pwm_request);
|
||||
|
||||
void pwm_free(struct pwm_device *pwm)
|
||||
{
|
||||
mutex_lock(&pwm_lock);
|
||||
|
||||
if (pwm->use_count) {
|
||||
pwm->use_count--;
|
||||
pwm->label = NULL;
|
||||
} else
|
||||
pr_warning("PWM device already freed\n");
|
||||
|
||||
mutex_unlock(&pwm_lock);
|
||||
}
|
||||
EXPORT_SYMBOL(pwm_free);
|
||||
|
||||
static inline void __add_pwm(struct pwm_device *pwm)
|
||||
{
|
||||
mutex_lock(&pwm_lock);
|
||||
list_add_tail(&pwm->node, &pwm_list);
|
||||
mutex_unlock(&pwm_lock);
|
||||
}
|
||||
|
||||
static struct pwm_device *pwm_probe(struct platform_device *pdev,
|
||||
unsigned int pwm_id, struct pwm_device *parent_pwm)
|
||||
{
|
||||
struct pwm_device *pwm;
|
||||
struct resource *r;
|
||||
int ret = 0;
|
||||
|
||||
pwm = kzalloc(sizeof(struct pwm_device), GFP_KERNEL);
|
||||
if (pwm == NULL) {
|
||||
dev_err(&pdev->dev, "failed to allocate memory\n");
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
pwm->clk = clk_get(&pdev->dev, "PWMCLK");
|
||||
if (IS_ERR(pwm->clk)) {
|
||||
ret = PTR_ERR(pwm->clk);
|
||||
goto err_free;
|
||||
}
|
||||
pwm->clk_enabled = 0;
|
||||
|
||||
pwm->use_count = 0;
|
||||
pwm->pwm_id = pwm_id;
|
||||
pwm->pdev = pdev;
|
||||
|
||||
if (parent_pwm != NULL) {
|
||||
/* registers for the second PWM has offset of 0x10 */
|
||||
pwm->mmio_base = parent_pwm->mmio_base + 0x10;
|
||||
__add_pwm(pwm);
|
||||
return pwm;
|
||||
}
|
||||
|
||||
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (r == NULL) {
|
||||
dev_err(&pdev->dev, "no memory resource defined\n");
|
||||
ret = -ENODEV;
|
||||
goto err_free_clk;
|
||||
}
|
||||
|
||||
r = request_mem_region(r->start, r->end - r->start + 1, pdev->name);
|
||||
if (r == NULL) {
|
||||
dev_err(&pdev->dev, "failed to request memory resource\n");
|
||||
ret = -EBUSY;
|
||||
goto err_free_clk;
|
||||
}
|
||||
|
||||
pwm->mmio_base = ioremap(r->start, r->end - r->start + 1);
|
||||
if (pwm->mmio_base == NULL) {
|
||||
dev_err(&pdev->dev, "failed to ioremap() registers\n");
|
||||
ret = -ENODEV;
|
||||
goto err_free_mem;
|
||||
}
|
||||
|
||||
__add_pwm(pwm);
|
||||
platform_set_drvdata(pdev, pwm);
|
||||
return pwm;
|
||||
|
||||
err_free_mem:
|
||||
release_mem_region(r->start, r->end - r->start + 1);
|
||||
err_free_clk:
|
||||
clk_put(pwm->clk);
|
||||
err_free:
|
||||
kfree(pwm);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
static int __devinit pxa25x_pwm_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct pwm_device *pwm = pwm_probe(pdev, pdev->id, NULL);
|
||||
|
||||
if (IS_ERR(pwm))
|
||||
return PTR_ERR(pwm);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __devinit pxa27x_pwm_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct pwm_device *pwm;
|
||||
|
||||
pwm = pwm_probe(pdev, pdev->id, NULL);
|
||||
if (IS_ERR(pwm))
|
||||
return PTR_ERR(pwm);
|
||||
|
||||
pwm = pwm_probe(pdev, pdev->id + 2, pwm);
|
||||
if (IS_ERR(pwm))
|
||||
return PTR_ERR(pwm);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __devexit pwm_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct pwm_device *pwm;
|
||||
struct resource *r;
|
||||
|
||||
pwm = platform_get_drvdata(pdev);
|
||||
if (pwm == NULL)
|
||||
return -ENODEV;
|
||||
|
||||
mutex_lock(&pwm_lock);
|
||||
list_del(&pwm->node);
|
||||
mutex_unlock(&pwm_lock);
|
||||
|
||||
iounmap(pwm->mmio_base);
|
||||
|
||||
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
release_mem_region(r->start, r->end - r->start + 1);
|
||||
|
||||
clk_put(pwm->clk);
|
||||
kfree(pwm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver pxa25x_pwm_driver = {
|
||||
.driver = {
|
||||
.name = "pxa25x-pwm",
|
||||
},
|
||||
.probe = pxa25x_pwm_probe,
|
||||
.remove = __devexit_p(pwm_remove),
|
||||
};
|
||||
|
||||
static struct platform_driver pxa27x_pwm_driver = {
|
||||
.driver = {
|
||||
.name = "pxa27x-pwm",
|
||||
},
|
||||
.probe = pxa27x_pwm_probe,
|
||||
.remove = __devexit_p(pwm_remove),
|
||||
};
|
||||
|
||||
static int __init pwm_init(void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = platform_driver_register(&pxa25x_pwm_driver);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "failed to register pxa25x_pwm_driver\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = platform_driver_register(&pxa27x_pwm_driver);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "failed to register pxa27x_pwm_driver\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
arch_initcall(pwm_init);
|
||||
|
||||
static void __exit pwm_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&pxa25x_pwm_driver);
|
||||
platform_driver_unregister(&pxa27x_pwm_driver);
|
||||
}
|
||||
module_exit(pwm_exit);
|
||||
|
||||
MODULE_LICENSE("GPL v2");
|
|
@ -26,6 +26,7 @@
|
|||
#include <asm/hardware.h>
|
||||
#include <asm/arch/irqs.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-regs.h>
|
||||
#include <asm/arch/mfp-pxa25x.h>
|
||||
#include <asm/arch/pm.h>
|
||||
#include <asm/arch/dma.h>
|
||||
|
@ -108,6 +109,52 @@ static const struct clkops clk_pxa25x_lcd_ops = {
|
|||
.getrate = clk_pxa25x_lcd_getrate,
|
||||
};
|
||||
|
||||
static unsigned long gpio12_config_32k[] = {
|
||||
GPIO12_32KHz,
|
||||
};
|
||||
|
||||
static unsigned long gpio12_config_gpio[] = {
|
||||
GPIO12_GPIO,
|
||||
};
|
||||
|
||||
static void clk_gpio12_enable(struct clk *clk)
|
||||
{
|
||||
pxa2xx_mfp_config(gpio12_config_32k, 1);
|
||||
}
|
||||
|
||||
static void clk_gpio12_disable(struct clk *clk)
|
||||
{
|
||||
pxa2xx_mfp_config(gpio12_config_gpio, 1);
|
||||
}
|
||||
|
||||
static const struct clkops clk_pxa25x_gpio12_ops = {
|
||||
.enable = clk_gpio12_enable,
|
||||
.disable = clk_gpio12_disable,
|
||||
};
|
||||
|
||||
static unsigned long gpio11_config_3m6[] = {
|
||||
GPIO11_3_6MHz,
|
||||
};
|
||||
|
||||
static unsigned long gpio11_config_gpio[] = {
|
||||
GPIO11_GPIO,
|
||||
};
|
||||
|
||||
static void clk_gpio11_enable(struct clk *clk)
|
||||
{
|
||||
pxa2xx_mfp_config(gpio11_config_3m6, 1);
|
||||
}
|
||||
|
||||
static void clk_gpio11_disable(struct clk *clk)
|
||||
{
|
||||
pxa2xx_mfp_config(gpio11_config_gpio, 1);
|
||||
}
|
||||
|
||||
static const struct clkops clk_pxa25x_gpio11_ops = {
|
||||
.enable = clk_gpio11_enable,
|
||||
.disable = clk_gpio11_disable,
|
||||
};
|
||||
|
||||
/*
|
||||
* 3.6864MHz -> OST, GPIO, SSP, PWM, PLLs (95.842MHz, 147.456MHz)
|
||||
* 95.842MHz -> MMC 19.169MHz, I2C 31.949MHz, FICP 47.923MHz, USB 47.923MHz
|
||||
|
@ -117,29 +164,40 @@ static struct clk pxa25x_hwuart_clk =
|
|||
INIT_CKEN("UARTCLK", HWUART, 14745600, 1, &pxa_device_hwuart.dev)
|
||||
;
|
||||
|
||||
/*
|
||||
* PXA 2xx clock declarations. Order is important (see aliases below)
|
||||
* Please be careful not to disrupt the ordering.
|
||||
*/
|
||||
static struct clk pxa25x_clks[] = {
|
||||
INIT_CK("LCDCLK", LCD, &clk_pxa25x_lcd_ops, &pxa_device_fb.dev),
|
||||
INIT_CKEN("UARTCLK", FFUART, 14745600, 1, &pxa_device_ffuart.dev),
|
||||
INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev),
|
||||
INIT_CKEN("UARTCLK", STUART, 14745600, 1, NULL),
|
||||
INIT_CKEN("UDCCLK", USB, 47923000, 5, &pxa_device_udc.dev),
|
||||
INIT_CKEN("UDCCLK", USB, 47923000, 5, &pxa25x_device_udc.dev),
|
||||
INIT_CLK("GPIO11_CLK", &clk_pxa25x_gpio11_ops, 3686400, 0, NULL),
|
||||
INIT_CLK("GPIO12_CLK", &clk_pxa25x_gpio12_ops, 32768, 0, NULL),
|
||||
INIT_CKEN("MMCCLK", MMC, 19169000, 0, &pxa_device_mci.dev),
|
||||
INIT_CKEN("I2CCLK", I2C, 31949000, 0, &pxa_device_i2c.dev),
|
||||
|
||||
INIT_CKEN("SSPCLK", SSP, 3686400, 0, &pxa25x_device_ssp.dev),
|
||||
INIT_CKEN("SSPCLK", NSSP, 3686400, 0, &pxa25x_device_nssp.dev),
|
||||
INIT_CKEN("SSPCLK", ASSP, 3686400, 0, &pxa25x_device_assp.dev),
|
||||
INIT_CKEN("PWMCLK", PWM0, 3686400, 0, &pxa25x_device_pwm0.dev),
|
||||
INIT_CKEN("PWMCLK", PWM1, 3686400, 0, &pxa25x_device_pwm1.dev),
|
||||
|
||||
INIT_CKEN("AC97CLK", AC97, 24576000, 0, NULL),
|
||||
|
||||
/*
|
||||
INIT_CKEN("PWMCLK", PWM0, 3686400, 0, NULL),
|
||||
INIT_CKEN("PWMCLK", PWM0, 3686400, 0, NULL),
|
||||
INIT_CKEN("I2SCLK", I2S, 14745600, 0, NULL),
|
||||
*/
|
||||
INIT_CKEN("FICPCLK", FICP, 47923000, 0, NULL),
|
||||
};
|
||||
|
||||
static struct clk pxa2xx_clk_aliases[] = {
|
||||
INIT_CKOTHER("GPIO7_CLK", &pxa25x_clks[4], NULL),
|
||||
INIT_CKOTHER("SA1111_CLK", &pxa25x_clks[5], NULL),
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
#define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x
|
||||
|
@ -260,7 +318,7 @@ void __init pxa25x_init_irq(void)
|
|||
}
|
||||
|
||||
static struct platform_device *pxa25x_devices[] __initdata = {
|
||||
&pxa_device_udc,
|
||||
&pxa25x_device_udc,
|
||||
&pxa_device_ffuart,
|
||||
&pxa_device_btuart,
|
||||
&pxa_device_stuart,
|
||||
|
@ -269,6 +327,8 @@ static struct platform_device *pxa25x_devices[] __initdata = {
|
|||
&pxa25x_device_ssp,
|
||||
&pxa25x_device_nssp,
|
||||
&pxa25x_device_assp,
|
||||
&pxa25x_device_pwm0,
|
||||
&pxa25x_device_pwm1,
|
||||
};
|
||||
|
||||
static struct sys_device pxa25x_sysdev[] = {
|
||||
|
@ -284,7 +344,7 @@ static int __init pxa25x_init(void)
|
|||
int i, ret = 0;
|
||||
|
||||
/* Only add HWUART for PXA255/26x; PXA210/250/27x do not have it. */
|
||||
if (cpu_is_pxa25x())
|
||||
if (cpu_is_pxa255())
|
||||
clks_register(&pxa25x_hwuart_clk, 1);
|
||||
|
||||
if (cpu_is_pxa21x() || cpu_is_pxa25x()) {
|
||||
|
@ -308,9 +368,11 @@ static int __init pxa25x_init(void)
|
|||
}
|
||||
|
||||
/* Only add HWUART for PXA255/26x; PXA210/250/27x do not have it. */
|
||||
if (cpu_is_pxa25x())
|
||||
if (cpu_is_pxa255())
|
||||
ret = platform_device_register(&pxa_device_hwuart);
|
||||
|
||||
clks_register(pxa2xx_clk_aliases, ARRAY_SIZE(pxa2xx_clk_aliases));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ static struct clk pxa27x_clks[] = {
|
|||
|
||||
INIT_CKEN("I2SCLK", I2S, 14682000, 0, &pxa_device_i2s.dev),
|
||||
INIT_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev),
|
||||
INIT_CKEN("UDCCLK", USB, 48000000, 5, &pxa_device_udc.dev),
|
||||
INIT_CKEN("UDCCLK", USB, 48000000, 5, &pxa27x_device_udc.dev),
|
||||
INIT_CKEN("MMCCLK", MMC, 19500000, 0, &pxa_device_mci.dev),
|
||||
INIT_CKEN("FICPCLK", FICP, 48000000, 0, &pxa_device_ficp.dev),
|
||||
|
||||
|
@ -157,12 +157,13 @@ static struct clk pxa27x_clks[] = {
|
|||
INIT_CKEN("SSPCLK", SSP1, 13000000, 0, &pxa27x_device_ssp1.dev),
|
||||
INIT_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev),
|
||||
INIT_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev),
|
||||
INIT_CKEN("PWMCLK", PWM0, 13000000, 0, &pxa27x_device_pwm0.dev),
|
||||
INIT_CKEN("PWMCLK", PWM1, 13000000, 0, &pxa27x_device_pwm1.dev),
|
||||
|
||||
INIT_CKEN("AC97CLK", AC97, 24576000, 0, NULL),
|
||||
INIT_CKEN("AC97CONFCLK", AC97CONF, 24576000, 0, NULL),
|
||||
|
||||
/*
|
||||
INIT_CKEN("PWMCLK", PWM0, 13000000, 0, NULL),
|
||||
INIT_CKEN("MSLCLK", MSL, 48000000, 0, NULL),
|
||||
INIT_CKEN("USIMCLK", USIM, 48000000, 0, NULL),
|
||||
INIT_CKEN("MSTKCLK", MEMSTK, 19500000, 0, NULL),
|
||||
|
@ -349,11 +350,14 @@ struct platform_device pxa27x_device_i2c_power = {
|
|||
|
||||
void __init pxa_set_i2c_power_info(struct i2c_pxa_platform_data *info)
|
||||
{
|
||||
local_irq_disable();
|
||||
PCFR |= PCFR_PI2CEN;
|
||||
local_irq_enable();
|
||||
pxa27x_device_i2c_power.dev.platform_data = info;
|
||||
}
|
||||
|
||||
static struct platform_device *devices[] __initdata = {
|
||||
&pxa_device_udc,
|
||||
&pxa27x_device_udc,
|
||||
&pxa_device_ffuart,
|
||||
&pxa_device_btuart,
|
||||
&pxa_device_stuart,
|
||||
|
@ -363,6 +367,8 @@ static struct platform_device *devices[] __initdata = {
|
|||
&pxa27x_device_ssp1,
|
||||
&pxa27x_device_ssp2,
|
||||
&pxa27x_device_ssp3,
|
||||
&pxa27x_device_pwm0,
|
||||
&pxa27x_device_pwm1,
|
||||
};
|
||||
|
||||
static struct sys_device pxa27x_sysdev[] = {
|
||||
|
|
46
arch/arm/mach-pxa/pxa2xx.c
Normal file
46
arch/arm/mach-pxa/pxa2xx.c
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* linux/arch/arm/mach-pxa/pxa2xx.c
|
||||
*
|
||||
* code specific to pxa2xx
|
||||
*
|
||||
* Copyright (C) 2008 Dmitry Baryshkov
|
||||
*
|
||||
* 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/kernel.h>
|
||||
#include <linux/device.h>
|
||||
|
||||
#include <asm/arch/mfp-pxa2xx.h>
|
||||
#include <asm/arch/mfp-pxa25x.h>
|
||||
#include <asm/arch/irda.h>
|
||||
|
||||
static unsigned long pxa2xx_mfp_fir[] = {
|
||||
GPIO46_FICP_RXD,
|
||||
GPIO47_FICP_TXD,
|
||||
};
|
||||
|
||||
static unsigned long pxa2xx_mfp_sir[] = {
|
||||
GPIO46_STUART_RXD,
|
||||
GPIO47_STUART_TXD,
|
||||
};
|
||||
|
||||
static unsigned long pxa2xx_mfp_off[] = {
|
||||
GPIO46_GPIO | MFP_LPM_DRIVE_LOW,
|
||||
GPIO47_GPIO | MFP_LPM_DRIVE_LOW,
|
||||
};
|
||||
|
||||
void pxa2xx_transceiver_mode(struct device *dev, int mode)
|
||||
{
|
||||
if (mode & IR_OFF) {
|
||||
pxa2xx_mfp_config(pxa2xx_mfp_off, ARRAY_SIZE(pxa2xx_mfp_off));
|
||||
} else if (mode & IR_SIRMODE) {
|
||||
pxa2xx_mfp_config(pxa2xx_mfp_sir, ARRAY_SIZE(pxa2xx_mfp_sir));
|
||||
} else if (mode & IR_FIRMODE) {
|
||||
pxa2xx_mfp_config(pxa2xx_mfp_fir, ARRAY_SIZE(pxa2xx_mfp_fir));
|
||||
} else
|
||||
BUG();
|
||||
}
|
|
@ -15,10 +15,16 @@
|
|||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include <asm/hardware.h>
|
||||
#include <asm/arch/pxa3xx-regs.h>
|
||||
#include <asm/arch/mfp-pxa300.h>
|
||||
|
||||
#include "generic.h"
|
||||
#include "devices.h"
|
||||
#include "clock.h"
|
||||
|
||||
static struct pxa3xx_mfp_addr_map pxa300_mfp_addr_map[] __initdata = {
|
||||
|
||||
MFP_ADDR_X(GPIO0, GPIO2, 0x00b4),
|
||||
|
@ -79,15 +85,26 @@ static struct pxa3xx_mfp_addr_map pxa310_mfp_addr_map[] __initdata = {
|
|||
MFP_ADDR_END,
|
||||
};
|
||||
|
||||
static struct clk common_clks[] = {
|
||||
PXA3xx_CKEN("NANDCLK", NAND, 156000000, 0, &pxa3xx_device_nand.dev),
|
||||
};
|
||||
|
||||
static struct clk pxa310_clks[] = {
|
||||
PXA3xx_CKEN("MMCCLK", MMC3, 19500000, 0, &pxa3xx_device_mci3.dev),
|
||||
};
|
||||
|
||||
static int __init pxa300_init(void)
|
||||
{
|
||||
if (cpu_is_pxa300() || cpu_is_pxa310()) {
|
||||
pxa3xx_init_mfp();
|
||||
pxa3xx_mfp_init_addr(pxa300_mfp_addr_map);
|
||||
clks_register(ARRAY_AND_SIZE(common_clks));
|
||||
}
|
||||
|
||||
if (cpu_is_pxa310())
|
||||
if (cpu_is_pxa310()) {
|
||||
pxa3xx_mfp_init_addr(pxa310_mfp_addr_map);
|
||||
clks_register(ARRAY_AND_SIZE(pxa310_clks));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -15,11 +15,17 @@
|
|||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include <asm/hardware.h>
|
||||
#include <asm/arch/mfp.h>
|
||||
#include <asm/arch/pxa3xx-regs.h>
|
||||
#include <asm/arch/mfp-pxa320.h>
|
||||
|
||||
#include "generic.h"
|
||||
#include "devices.h"
|
||||
#include "clock.h"
|
||||
|
||||
static struct pxa3xx_mfp_addr_map pxa320_mfp_addr_map[] __initdata = {
|
||||
|
||||
MFP_ADDR_X(GPIO0, GPIO4, 0x0124),
|
||||
|
@ -74,16 +80,17 @@ static struct pxa3xx_mfp_addr_map pxa320_mfp_addr_map[] __initdata = {
|
|||
MFP_ADDR_END,
|
||||
};
|
||||
|
||||
static void __init pxa320_init_mfp(void)
|
||||
{
|
||||
pxa3xx_init_mfp();
|
||||
pxa3xx_mfp_init_addr(pxa320_mfp_addr_map);
|
||||
}
|
||||
static struct clk pxa320_clks[] = {
|
||||
PXA3xx_CKEN("NANDCLK", NAND, 104000000, 0, &pxa3xx_device_nand.dev),
|
||||
};
|
||||
|
||||
static int __init pxa320_init(void)
|
||||
{
|
||||
if (cpu_is_pxa320())
|
||||
pxa320_init_mfp();
|
||||
if (cpu_is_pxa320()) {
|
||||
pxa3xx_init_mfp();
|
||||
pxa3xx_mfp_init_addr(pxa320_mfp_addr_map);
|
||||
clks_register(ARRAY_AND_SIZE(pxa320_clks));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ static unsigned long clk_pxa3xx_hsio_getrate(struct clk *clk)
|
|||
return hsio_clk;
|
||||
}
|
||||
|
||||
static void clk_pxa3xx_cken_enable(struct clk *clk)
|
||||
void clk_pxa3xx_cken_enable(struct clk *clk)
|
||||
{
|
||||
unsigned long mask = 1ul << (clk->cken & 0x1f);
|
||||
|
||||
|
@ -154,7 +154,7 @@ static void clk_pxa3xx_cken_enable(struct clk *clk)
|
|||
CKENB |= mask;
|
||||
}
|
||||
|
||||
static void clk_pxa3xx_cken_disable(struct clk *clk)
|
||||
void clk_pxa3xx_cken_disable(struct clk *clk)
|
||||
{
|
||||
unsigned long mask = 1ul << (clk->cken & 0x1f);
|
||||
|
||||
|
@ -164,7 +164,7 @@ static void clk_pxa3xx_cken_disable(struct clk *clk)
|
|||
CKENB &= ~mask;
|
||||
}
|
||||
|
||||
static const struct clkops clk_pxa3xx_cken_ops = {
|
||||
const struct clkops clk_pxa3xx_cken_ops = {
|
||||
.enable = clk_pxa3xx_cken_enable,
|
||||
.disable = clk_pxa3xx_cken_disable,
|
||||
};
|
||||
|
@ -196,24 +196,6 @@ static const struct clkops clk_pout_ops = {
|
|||
.disable = clk_pout_disable,
|
||||
};
|
||||
|
||||
#define PXA3xx_CKEN(_name, _cken, _rate, _delay, _dev) \
|
||||
{ \
|
||||
.name = _name, \
|
||||
.dev = _dev, \
|
||||
.ops = &clk_pxa3xx_cken_ops, \
|
||||
.rate = _rate, \
|
||||
.cken = CKEN_##_cken, \
|
||||
.delay = _delay, \
|
||||
}
|
||||
|
||||
#define PXA3xx_CK(_name, _cken, _ops, _dev) \
|
||||
{ \
|
||||
.name = _name, \
|
||||
.dev = _dev, \
|
||||
.ops = _ops, \
|
||||
.cken = CKEN_##_cken, \
|
||||
}
|
||||
|
||||
static struct clk pxa3xx_clks[] = {
|
||||
{
|
||||
.name = "CLK_POUT",
|
||||
|
@ -231,7 +213,7 @@ static struct clk pxa3xx_clks[] = {
|
|||
PXA3xx_CKEN("UARTCLK", STUART, 14857000, 1, NULL),
|
||||
|
||||
PXA3xx_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev),
|
||||
PXA3xx_CKEN("UDCCLK", UDC, 48000000, 5, &pxa_device_udc.dev),
|
||||
PXA3xx_CKEN("UDCCLK", UDC, 48000000, 5, &pxa27x_device_udc.dev),
|
||||
PXA3xx_CKEN("USBCLK", USBH, 48000000, 0, &pxa27x_device_ohci.dev),
|
||||
PXA3xx_CKEN("KBDCLK", KEYPAD, 32768, 0, &pxa27x_device_keypad.dev),
|
||||
|
||||
|
@ -239,10 +221,11 @@ static struct clk pxa3xx_clks[] = {
|
|||
PXA3xx_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev),
|
||||
PXA3xx_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev),
|
||||
PXA3xx_CKEN("SSPCLK", SSP4, 13000000, 0, &pxa3xx_device_ssp4.dev),
|
||||
PXA3xx_CKEN("PWMCLK", PWM0, 13000000, 0, &pxa27x_device_pwm0.dev),
|
||||
PXA3xx_CKEN("PWMCLK", PWM1, 13000000, 0, &pxa27x_device_pwm1.dev),
|
||||
|
||||
PXA3xx_CKEN("MMCCLK", MMC1, 19500000, 0, &pxa_device_mci.dev),
|
||||
PXA3xx_CKEN("MMCCLK", MMC2, 19500000, 0, &pxa3xx_device_mci2.dev),
|
||||
PXA3xx_CKEN("MMCCLK", MMC3, 19500000, 0, &pxa3xx_device_mci3.dev),
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
@ -520,7 +503,7 @@ void __init pxa3xx_init_irq(void)
|
|||
*/
|
||||
|
||||
static struct platform_device *devices[] __initdata = {
|
||||
&pxa_device_udc,
|
||||
/* &pxa_device_udc, The UDC driver is PXA25x only */
|
||||
&pxa_device_ffuart,
|
||||
&pxa_device_btuart,
|
||||
&pxa_device_stuart,
|
||||
|
@ -530,6 +513,8 @@ static struct platform_device *devices[] __initdata = {
|
|||
&pxa27x_device_ssp2,
|
||||
&pxa27x_device_ssp3,
|
||||
&pxa3xx_device_ssp4,
|
||||
&pxa27x_device_pwm0,
|
||||
&pxa27x_device_pwm1,
|
||||
};
|
||||
|
||||
static struct sys_device pxa3xx_sysdev[] = {
|
||||
|
|
190
arch/arm/mach-pxa/pxa930.c
Normal file
190
arch/arm/mach-pxa/pxa930.c
Normal file
|
@ -0,0 +1,190 @@
|
|||
/*
|
||||
* linux/arch/arm/mach-pxa/pxa930.c
|
||||
*
|
||||
* Code specific to PXA930
|
||||
*
|
||||
* Copyright (C) 2007-2008 Marvell Internation Ltd.
|
||||
*
|
||||
* 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/kernel.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
|
||||
#include <asm/hardware.h>
|
||||
#include <asm/arch/mfp-pxa930.h>
|
||||
|
||||
static struct pxa3xx_mfp_addr_map pxa930_mfp_addr_map[] __initdata = {
|
||||
|
||||
MFP_ADDR(GPIO0, 0x02e0),
|
||||
MFP_ADDR(GPIO1, 0x02dc),
|
||||
MFP_ADDR(GPIO2, 0x02e8),
|
||||
MFP_ADDR(GPIO3, 0x02d8),
|
||||
MFP_ADDR(GPIO4, 0x02e4),
|
||||
MFP_ADDR(GPIO5, 0x02ec),
|
||||
MFP_ADDR(GPIO6, 0x02f8),
|
||||
MFP_ADDR(GPIO7, 0x02fc),
|
||||
MFP_ADDR(GPIO8, 0x0300),
|
||||
MFP_ADDR(GPIO9, 0x02d4),
|
||||
MFP_ADDR(GPIO10, 0x02f4),
|
||||
MFP_ADDR(GPIO11, 0x02f0),
|
||||
MFP_ADDR(GPIO12, 0x0304),
|
||||
MFP_ADDR(GPIO13, 0x0310),
|
||||
MFP_ADDR(GPIO14, 0x0308),
|
||||
MFP_ADDR(GPIO15, 0x030c),
|
||||
MFP_ADDR(GPIO16, 0x04e8),
|
||||
MFP_ADDR(GPIO17, 0x04f4),
|
||||
MFP_ADDR(GPIO18, 0x04f8),
|
||||
MFP_ADDR(GPIO19, 0x04fc),
|
||||
MFP_ADDR(GPIO20, 0x0518),
|
||||
MFP_ADDR(GPIO21, 0x051c),
|
||||
MFP_ADDR(GPIO22, 0x04ec),
|
||||
MFP_ADDR(GPIO23, 0x0500),
|
||||
MFP_ADDR(GPIO24, 0x04f0),
|
||||
MFP_ADDR(GPIO25, 0x0504),
|
||||
MFP_ADDR(GPIO26, 0x0510),
|
||||
MFP_ADDR(GPIO27, 0x0514),
|
||||
MFP_ADDR(GPIO28, 0x0520),
|
||||
MFP_ADDR(GPIO29, 0x0600),
|
||||
MFP_ADDR(GPIO30, 0x0618),
|
||||
MFP_ADDR(GPIO31, 0x0610),
|
||||
MFP_ADDR(GPIO32, 0x060c),
|
||||
MFP_ADDR(GPIO33, 0x061c),
|
||||
MFP_ADDR(GPIO34, 0x0620),
|
||||
MFP_ADDR(GPIO35, 0x0628),
|
||||
MFP_ADDR(GPIO36, 0x062c),
|
||||
MFP_ADDR(GPIO37, 0x0630),
|
||||
MFP_ADDR(GPIO38, 0x0634),
|
||||
MFP_ADDR(GPIO39, 0x0638),
|
||||
MFP_ADDR(GPIO40, 0x063c),
|
||||
MFP_ADDR(GPIO41, 0x0614),
|
||||
MFP_ADDR(GPIO42, 0x0624),
|
||||
MFP_ADDR(GPIO43, 0x0608),
|
||||
MFP_ADDR(GPIO44, 0x0604),
|
||||
MFP_ADDR(GPIO45, 0x050c),
|
||||
MFP_ADDR(GPIO46, 0x0508),
|
||||
MFP_ADDR(GPIO47, 0x02bc),
|
||||
MFP_ADDR(GPIO48, 0x02b4),
|
||||
MFP_ADDR(GPIO49, 0x02b8),
|
||||
MFP_ADDR(GPIO50, 0x02c8),
|
||||
MFP_ADDR(GPIO51, 0x02c0),
|
||||
MFP_ADDR(GPIO52, 0x02c4),
|
||||
MFP_ADDR(GPIO53, 0x02d0),
|
||||
MFP_ADDR(GPIO54, 0x02cc),
|
||||
MFP_ADDR(GPIO55, 0x029c),
|
||||
MFP_ADDR(GPIO56, 0x02a0),
|
||||
MFP_ADDR(GPIO57, 0x0294),
|
||||
MFP_ADDR(GPIO58, 0x0298),
|
||||
MFP_ADDR(GPIO59, 0x02a4),
|
||||
MFP_ADDR(GPIO60, 0x02a8),
|
||||
MFP_ADDR(GPIO61, 0x02b0),
|
||||
MFP_ADDR(GPIO62, 0x02ac),
|
||||
MFP_ADDR(GPIO63, 0x0640),
|
||||
MFP_ADDR(GPIO64, 0x065c),
|
||||
MFP_ADDR(GPIO65, 0x0648),
|
||||
MFP_ADDR(GPIO66, 0x0644),
|
||||
MFP_ADDR(GPIO67, 0x0674),
|
||||
MFP_ADDR(GPIO68, 0x0658),
|
||||
MFP_ADDR(GPIO69, 0x0654),
|
||||
MFP_ADDR(GPIO70, 0x0660),
|
||||
MFP_ADDR(GPIO71, 0x0668),
|
||||
MFP_ADDR(GPIO72, 0x0664),
|
||||
MFP_ADDR(GPIO73, 0x0650),
|
||||
MFP_ADDR(GPIO74, 0x066c),
|
||||
MFP_ADDR(GPIO75, 0x064c),
|
||||
MFP_ADDR(GPIO76, 0x0670),
|
||||
MFP_ADDR(GPIO77, 0x0678),
|
||||
MFP_ADDR(GPIO78, 0x067c),
|
||||
MFP_ADDR(GPIO79, 0x0694),
|
||||
MFP_ADDR(GPIO80, 0x069c),
|
||||
MFP_ADDR(GPIO81, 0x06a0),
|
||||
MFP_ADDR(GPIO82, 0x06a4),
|
||||
MFP_ADDR(GPIO83, 0x0698),
|
||||
MFP_ADDR(GPIO84, 0x06bc),
|
||||
MFP_ADDR(GPIO85, 0x06b4),
|
||||
MFP_ADDR(GPIO86, 0x06b0),
|
||||
MFP_ADDR(GPIO87, 0x06c0),
|
||||
MFP_ADDR(GPIO88, 0x06c4),
|
||||
MFP_ADDR(GPIO89, 0x06ac),
|
||||
MFP_ADDR(GPIO90, 0x0680),
|
||||
MFP_ADDR(GPIO91, 0x0684),
|
||||
MFP_ADDR(GPIO92, 0x0688),
|
||||
MFP_ADDR(GPIO93, 0x0690),
|
||||
MFP_ADDR(GPIO94, 0x068c),
|
||||
MFP_ADDR(GPIO95, 0x06a8),
|
||||
MFP_ADDR(GPIO96, 0x06b8),
|
||||
MFP_ADDR(GPIO97, 0x0410),
|
||||
MFP_ADDR(GPIO98, 0x0418),
|
||||
MFP_ADDR(GPIO99, 0x041c),
|
||||
MFP_ADDR(GPIO100, 0x0414),
|
||||
MFP_ADDR(GPIO101, 0x0408),
|
||||
MFP_ADDR(GPIO102, 0x0324),
|
||||
MFP_ADDR(GPIO103, 0x040c),
|
||||
MFP_ADDR(GPIO104, 0x0400),
|
||||
MFP_ADDR(GPIO105, 0x0328),
|
||||
MFP_ADDR(GPIO106, 0x0404),
|
||||
|
||||
MFP_ADDR(nXCVREN, 0x0204),
|
||||
MFP_ADDR(DF_CLE_nOE, 0x020c),
|
||||
MFP_ADDR(DF_nADV1_ALE, 0x0218),
|
||||
MFP_ADDR(DF_SCLK_E, 0x0214),
|
||||
MFP_ADDR(DF_SCLK_S, 0x0210),
|
||||
MFP_ADDR(nBE0, 0x021c),
|
||||
MFP_ADDR(nBE1, 0x0220),
|
||||
MFP_ADDR(DF_nADV2_ALE, 0x0224),
|
||||
MFP_ADDR(DF_INT_RnB, 0x0228),
|
||||
MFP_ADDR(DF_nCS0, 0x022c),
|
||||
MFP_ADDR(DF_nCS1, 0x0230),
|
||||
MFP_ADDR(nLUA, 0x0254),
|
||||
MFP_ADDR(nLLA, 0x0258),
|
||||
MFP_ADDR(DF_nWE, 0x0234),
|
||||
MFP_ADDR(DF_nRE_nOE, 0x0238),
|
||||
MFP_ADDR(DF_ADDR0, 0x024c),
|
||||
MFP_ADDR(DF_ADDR1, 0x0250),
|
||||
MFP_ADDR(DF_ADDR2, 0x025c),
|
||||
MFP_ADDR(DF_ADDR3, 0x0260),
|
||||
MFP_ADDR(DF_IO0, 0x023c),
|
||||
MFP_ADDR(DF_IO1, 0x0240),
|
||||
MFP_ADDR(DF_IO2, 0x0244),
|
||||
MFP_ADDR(DF_IO3, 0x0248),
|
||||
MFP_ADDR(DF_IO4, 0x0264),
|
||||
MFP_ADDR(DF_IO5, 0x0268),
|
||||
MFP_ADDR(DF_IO6, 0x026c),
|
||||
MFP_ADDR(DF_IO7, 0x0270),
|
||||
MFP_ADDR(DF_IO8, 0x0274),
|
||||
MFP_ADDR(DF_IO9, 0x0278),
|
||||
MFP_ADDR(DF_IO10, 0x027c),
|
||||
MFP_ADDR(DF_IO11, 0x0280),
|
||||
MFP_ADDR(DF_IO12, 0x0284),
|
||||
MFP_ADDR(DF_IO13, 0x0288),
|
||||
MFP_ADDR(DF_IO14, 0x028c),
|
||||
MFP_ADDR(DF_IO15, 0x0290),
|
||||
|
||||
MFP_ADDR(GSIM_UIO, 0x0314),
|
||||
MFP_ADDR(GSIM_UCLK, 0x0318),
|
||||
MFP_ADDR(GSIM_UDET, 0x031c),
|
||||
MFP_ADDR(GSIM_nURST, 0x0320),
|
||||
|
||||
MFP_ADDR(PMIC_INT, 0x06c8),
|
||||
|
||||
MFP_ADDR(RDY, 0x0200),
|
||||
|
||||
MFP_ADDR_END,
|
||||
};
|
||||
|
||||
static int __init pxa930_init(void)
|
||||
{
|
||||
if (cpu_is_pxa930()) {
|
||||
pxa3xx_init_mfp();
|
||||
pxa3xx_mfp_init_addr(pxa930_mfp_addr_map);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
core_initcall(pxa930_init);
|
96
arch/arm/mach-pxa/reset.c
Normal file
96
arch/arm/mach-pxa/reset.c
Normal file
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* 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/module.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/proc-fns.h>
|
||||
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-regs.h>
|
||||
|
||||
static void do_hw_reset(void);
|
||||
|
||||
static int reset_gpio = -1;
|
||||
|
||||
int init_gpio_reset(int gpio)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = gpio_request(gpio, "reset generator");
|
||||
if (rc) {
|
||||
printk(KERN_ERR "Can't request reset_gpio\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
rc = gpio_direction_input(gpio);
|
||||
if (rc) {
|
||||
printk(KERN_ERR "Can't configure reset_gpio for input\n");
|
||||
gpio_free(gpio);
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
if (!rc)
|
||||
reset_gpio = gpio;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* Trigger GPIO reset.
|
||||
* This covers various types of logic connecting gpio pin
|
||||
* to RESET pins (nRESET or GPIO_RESET):
|
||||
*/
|
||||
static void do_gpio_reset(void)
|
||||
{
|
||||
BUG_ON(reset_gpio == -1);
|
||||
|
||||
/* drive it low */
|
||||
gpio_direction_output(reset_gpio, 0);
|
||||
mdelay(2);
|
||||
/* rising edge or drive high */
|
||||
gpio_set_value(reset_gpio, 1);
|
||||
mdelay(2);
|
||||
/* falling edge */
|
||||
gpio_set_value(reset_gpio, 0);
|
||||
|
||||
/* give it some time */
|
||||
mdelay(10);
|
||||
|
||||
WARN_ON(1);
|
||||
/* fallback */
|
||||
do_hw_reset();
|
||||
}
|
||||
|
||||
static void do_hw_reset(void)
|
||||
{
|
||||
/* Initialize the watchdog and let it fire */
|
||||
OWER = OWER_WME;
|
||||
OSSR = OSSR_M3;
|
||||
OSMR3 = OSCR + 368640; /* ... in 100 ms */
|
||||
}
|
||||
|
||||
void arch_reset(char mode)
|
||||
{
|
||||
if (cpu_is_pxa2xx())
|
||||
RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
|
||||
|
||||
switch (mode) {
|
||||
case 's':
|
||||
/* Jump into ROM at address 0 */
|
||||
cpu_reset(0);
|
||||
break;
|
||||
case 'h':
|
||||
do_hw_reset();
|
||||
break;
|
||||
case 'g':
|
||||
do_gpio_reset();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
84
arch/arm/mach-pxa/saar.c
Normal file
84
arch/arm/mach-pxa/saar.c
Normal file
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* linux/arch/arm/mach-pxa/saar.c
|
||||
*
|
||||
* Support for the Marvell PXA930 Handheld Platform (aka SAAR)
|
||||
*
|
||||
* Copyright (C) 2007-2008 Marvell International Ltd.
|
||||
*
|
||||
* 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
|
||||
* publishhed by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/smc91x.h>
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/hardware.h>
|
||||
#include <asm/arch/pxa3xx-regs.h>
|
||||
#include <asm/arch/mfp-pxa930.h>
|
||||
|
||||
#include "devices.h"
|
||||
#include "generic.h"
|
||||
|
||||
/* SAAR MFP configurations */
|
||||
static mfp_cfg_t saar_mfp_cfg[] __initdata = {
|
||||
/* Ethernet */
|
||||
DF_nCS1_nCS3,
|
||||
GPIO97_GPIO,
|
||||
};
|
||||
|
||||
#define SAAR_ETH_PHYS (0x14000000)
|
||||
|
||||
static struct resource smc91x_resources[] = {
|
||||
[0] = {
|
||||
.start = (SAAR_ETH_PHYS + 0x300),
|
||||
.end = (SAAR_ETH_PHYS + 0xfffff),
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
[1] = {
|
||||
.start = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97)),
|
||||
.end = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97)),
|
||||
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
|
||||
}
|
||||
};
|
||||
|
||||
static struct smc91x_platdata saar_smc91x_info = {
|
||||
.flags = SMC91X_USE_16BIT | SMC91X_NOWAIT | SMC91X_USE_DMA,
|
||||
};
|
||||
|
||||
static struct platform_device smc91x_device = {
|
||||
.name = "smc91x",
|
||||
.id = 0,
|
||||
.num_resources = ARRAY_SIZE(smc91x_resources),
|
||||
.resource = smc91x_resources,
|
||||
.dev = {
|
||||
.platform_data = &saar_smc91x_info,
|
||||
},
|
||||
};
|
||||
|
||||
static void __init saar_init(void)
|
||||
{
|
||||
/* initialize MFP configurations */
|
||||
pxa3xx_mfp_config(ARRAY_AND_SIZE(saar_mfp_cfg));
|
||||
|
||||
platform_device_register(&smc91x_device);
|
||||
}
|
||||
|
||||
MACHINE_START(SAAR, "PXA930 Handheld Platform (aka SAAR)")
|
||||
/* Maintainer: Eric Miao <eric.miao@marvell.com> */
|
||||
.phys_io = 0x40000000,
|
||||
.boot_params = 0xa0000100,
|
||||
.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
|
||||
.map_io = pxa_map_io,
|
||||
.init_irq = pxa3xx_init_irq,
|
||||
.timer = &pxa_timer,
|
||||
.init_machine = saar_init,
|
||||
MACHINE_END
|
|
@ -38,6 +38,7 @@
|
|||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-regs.h>
|
||||
#include <asm/arch/pxa2xx-gpio.h>
|
||||
#include <asm/arch/pxa27x-udc.h>
|
||||
#include <asm/arch/irda.h>
|
||||
#include <asm/arch/mmc.h>
|
||||
#include <asm/arch/ohci.h>
|
||||
|
@ -450,6 +451,7 @@ static void spitz_irda_transceiver_mode(struct device *dev, int mode)
|
|||
set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON);
|
||||
else
|
||||
reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON);
|
||||
pxa2xx_transceiver_mode(dev, mode);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MACH_AKITA
|
||||
|
@ -459,6 +461,7 @@ static void akita_irda_transceiver_mode(struct device *dev, int mode)
|
|||
akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON);
|
||||
else
|
||||
akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON);
|
||||
pxa2xx_transceiver_mode(dev, mode);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -529,11 +532,7 @@ static struct platform_device *devices[] __initdata = {
|
|||
|
||||
static void spitz_poweroff(void)
|
||||
{
|
||||
pxa_gpio_mode(SPITZ_GPIO_ON_RESET | GPIO_OUT);
|
||||
GPSR(SPITZ_GPIO_ON_RESET) = GPIO_bit(SPITZ_GPIO_ON_RESET);
|
||||
|
||||
mdelay(1000);
|
||||
arm_machine_restart('h');
|
||||
arm_machine_restart('g');
|
||||
}
|
||||
|
||||
static void spitz_restart(char mode)
|
||||
|
@ -547,6 +546,7 @@ static void spitz_restart(char mode)
|
|||
|
||||
static void __init common_init(void)
|
||||
{
|
||||
init_gpio_reset(SPITZ_GPIO_ON_RESET);
|
||||
pm_power_off = spitz_poweroff;
|
||||
arm_pm_restart = spitz_restart;
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <asm/arch/sharpsl.h>
|
||||
#include <asm/arch/spitz.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-regs.h>
|
||||
#include <asm/arch/pxa2xx-gpio.h>
|
||||
#include "sharpsl.h"
|
||||
|
||||
|
@ -207,7 +208,9 @@ struct sharpsl_charger_machinfo spitz_pm_machinfo = {
|
|||
.read_devdata = spitzpm_read_devdata,
|
||||
.charger_wakeup = spitz_charger_wakeup,
|
||||
.should_wakeup = spitz_should_wakeup,
|
||||
#ifdef CONFIG_BACKLIGHT_CORGI
|
||||
.backlight_limit = corgibl_limit_intensity,
|
||||
#endif
|
||||
.charge_on_volt = SHARPSL_CHARGE_ON_VOLT,
|
||||
.charge_on_temp = SHARPSL_CHARGE_ON_TEMP,
|
||||
.charge_acin_high = SHARPSL_CHARGE_ON_ACIN_HIGH,
|
||||
|
@ -229,6 +232,10 @@ static int __devinit spitzpm_init(void)
|
|||
{
|
||||
int ret;
|
||||
|
||||
if (!machine_is_spitz() && !machine_is_akita()
|
||||
&& !machine_is_borzoi())
|
||||
return -ENODEV;
|
||||
|
||||
spitzpm_device = platform_device_alloc("sharpsl-pm", -1);
|
||||
if (!spitzpm_device)
|
||||
return -ENOMEM;
|
||||
|
|
|
@ -14,13 +14,6 @@
|
|||
* IO-based SSP applications and allows easy port setup for DMA access.
|
||||
*
|
||||
* Author: Liam Girdwood <liam.girdwood@wolfsonmicro.com>
|
||||
*
|
||||
* Revision history:
|
||||
* 22nd Aug 2003 Initial version.
|
||||
* 20th Dec 2004 Added ssp_config for changing port config without
|
||||
* closing the port.
|
||||
* 4th Aug 2005 Added option to disable irq handler registration and
|
||||
* cleaned up irq and clock detection.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
@ -285,7 +278,7 @@ int ssp_init(struct ssp_dev *dev, u32 port, u32 init_flags)
|
|||
goto out_region;
|
||||
dev->irq = ssp->irq;
|
||||
} else
|
||||
dev->irq = 0;
|
||||
dev->irq = NO_IRQ;
|
||||
|
||||
/* turn on SSP port clock */
|
||||
clk_enable(ssp->clk);
|
||||
|
@ -306,7 +299,8 @@ void ssp_exit(struct ssp_dev *dev)
|
|||
struct ssp_device *ssp = dev->ssp;
|
||||
|
||||
ssp_disable(dev);
|
||||
free_irq(dev->irq, dev);
|
||||
if (dev->irq != NO_IRQ)
|
||||
free_irq(dev->irq, dev);
|
||||
clk_disable(ssp->clk);
|
||||
ssp_free(ssp);
|
||||
}
|
||||
|
@ -360,6 +354,7 @@ static int __devinit ssp_probe(struct platform_device *pdev, int type)
|
|||
dev_err(&pdev->dev, "failed to allocate memory");
|
||||
return -ENOMEM;
|
||||
}
|
||||
ssp->pdev = pdev;
|
||||
|
||||
ssp->clk = clk_get(&pdev->dev, "SSPCLK");
|
||||
if (IS_ERR(ssp->clk)) {
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <asm/hardware.h>
|
||||
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-regs.h>
|
||||
|
||||
.text
|
||||
|
||||
|
@ -35,20 +36,20 @@ ENTRY(pxa_cpu_standby)
|
|||
|
||||
#ifdef CONFIG_PXA3xx
|
||||
|
||||
#define MDCNFG 0x0000
|
||||
#define MDCNFG_DMCEN (1 << 30)
|
||||
#define DDR_HCAL 0x0060
|
||||
#define DDR_HCAL_HCRNG 0x1f
|
||||
#define DDR_HCAL_HCPROG (1 << 28)
|
||||
#define DDR_HCAL_HCEN (1 << 31)
|
||||
#define DMCIER 0x0070
|
||||
#define DMCIER_EDLP (1 << 29)
|
||||
#define DMCISR 0x0078
|
||||
#define RCOMP 0x0100
|
||||
#define RCOMP_SWEVAL (1 << 31)
|
||||
#define PXA3_MDCNFG 0x0000
|
||||
#define PXA3_MDCNFG_DMCEN (1 << 30)
|
||||
#define PXA3_DDR_HCAL 0x0060
|
||||
#define PXA3_DDR_HCAL_HCRNG 0x1f
|
||||
#define PXA3_DDR_HCAL_HCPROG (1 << 28)
|
||||
#define PXA3_DDR_HCAL_HCEN (1 << 31)
|
||||
#define PXA3_DMCIER 0x0070
|
||||
#define PXA3_DMCIER_EDLP (1 << 29)
|
||||
#define PXA3_DMCISR 0x0078
|
||||
#define PXA3_RCOMP 0x0100
|
||||
#define PXA3_RCOMP_SWEVAL (1 << 31)
|
||||
|
||||
ENTRY(pm_enter_standby_start)
|
||||
mov r1, #0xf6000000 @ DMEMC_REG_BASE (MDCNFG)
|
||||
mov r1, #0xf6000000 @ DMEMC_REG_BASE (PXA3_MDCNFG)
|
||||
add r1, r1, #0x00100000
|
||||
|
||||
/*
|
||||
|
@ -59,54 +60,54 @@ ENTRY(pm_enter_standby_start)
|
|||
* This also means that only the dynamic memory controller
|
||||
* can be reliably accessed in the code following standby.
|
||||
*/
|
||||
ldr r2, [r1] @ Dummy read MDCNFG
|
||||
ldr r2, [r1] @ Dummy read PXA3_MDCNFG
|
||||
|
||||
mcr p14, 0, r0, c7, c0, 0
|
||||
.rept 8
|
||||
nop
|
||||
.endr
|
||||
|
||||
ldr r0, [r1, #DDR_HCAL] @ Clear (and wait for) HCEN
|
||||
bic r0, r0, #DDR_HCAL_HCEN
|
||||
str r0, [r1, #DDR_HCAL]
|
||||
1: ldr r0, [r1, #DDR_HCAL]
|
||||
tst r0, #DDR_HCAL_HCEN
|
||||
ldr r0, [r1, #PXA3_DDR_HCAL] @ Clear (and wait for) HCEN
|
||||
bic r0, r0, #PXA3_DDR_HCAL_HCEN
|
||||
str r0, [r1, #PXA3_DDR_HCAL]
|
||||
1: ldr r0, [r1, #PXA3_DDR_HCAL]
|
||||
tst r0, #PXA3_DDR_HCAL_HCEN
|
||||
bne 1b
|
||||
|
||||
ldr r0, [r1, #RCOMP] @ Initiate RCOMP
|
||||
orr r0, r0, #RCOMP_SWEVAL
|
||||
str r0, [r1, #RCOMP]
|
||||
ldr r0, [r1, #PXA3_RCOMP] @ Initiate RCOMP
|
||||
orr r0, r0, #PXA3_RCOMP_SWEVAL
|
||||
str r0, [r1, #PXA3_RCOMP]
|
||||
|
||||
mov r0, #~0 @ Clear interrupts
|
||||
str r0, [r1, #DMCISR]
|
||||
mov r0, #~0 @ Clear interrupts
|
||||
str r0, [r1, #PXA3_DMCISR]
|
||||
|
||||
ldr r0, [r1, #DMCIER] @ set DMIER[EDLP]
|
||||
orr r0, r0, #DMCIER_EDLP
|
||||
str r0, [r1, #DMCIER]
|
||||
ldr r0, [r1, #PXA3_DMCIER] @ set DMIER[EDLP]
|
||||
orr r0, r0, #PXA3_DMCIER_EDLP
|
||||
str r0, [r1, #PXA3_DMCIER]
|
||||
|
||||
ldr r0, [r1, #DDR_HCAL] @ clear HCRNG, set HCPROG, HCEN
|
||||
bic r0, r0, #DDR_HCAL_HCRNG
|
||||
orr r0, r0, #DDR_HCAL_HCEN | DDR_HCAL_HCPROG
|
||||
str r0, [r1, #DDR_HCAL]
|
||||
ldr r0, [r1, #PXA3_DDR_HCAL] @ clear HCRNG, set HCPROG, HCEN
|
||||
bic r0, r0, #PXA3_DDR_HCAL_HCRNG
|
||||
orr r0, r0, #PXA3_DDR_HCAL_HCEN | PXA3_DDR_HCAL_HCPROG
|
||||
str r0, [r1, #PXA3_DDR_HCAL]
|
||||
|
||||
1: ldr r0, [r1, #DMCISR]
|
||||
tst r0, #DMCIER_EDLP
|
||||
1: ldr r0, [r1, #PXA3_DMCISR]
|
||||
tst r0, #PXA3_DMCIER_EDLP
|
||||
beq 1b
|
||||
|
||||
ldr r0, [r1, #MDCNFG] @ set MDCNFG[DMCEN]
|
||||
orr r0, r0, #MDCNFG_DMCEN
|
||||
str r0, [r1, #MDCNFG]
|
||||
1: ldr r0, [r1, #MDCNFG]
|
||||
tst r0, #MDCNFG_DMCEN
|
||||
ldr r0, [r1, #PXA3_MDCNFG] @ set PXA3_MDCNFG[DMCEN]
|
||||
orr r0, r0, #PXA3_MDCNFG_DMCEN
|
||||
str r0, [r1, #PXA3_MDCNFG]
|
||||
1: ldr r0, [r1, #PXA3_MDCNFG]
|
||||
tst r0, #PXA3_MDCNFG_DMCEN
|
||||
beq 1b
|
||||
|
||||
ldr r0, [r1, #DDR_HCAL] @ set DDR_HCAL[HCRNG]
|
||||
ldr r0, [r1, #PXA3_DDR_HCAL] @ set PXA3_DDR_HCAL[HCRNG]
|
||||
orr r0, r0, #2 @ HCRNG
|
||||
str r0, [r1, #DDR_HCAL]
|
||||
str r0, [r1, #PXA3_DDR_HCAL]
|
||||
|
||||
ldr r0, [r1, #DMCIER] @ Clear the interrupt
|
||||
ldr r0, [r1, #PXA3_DMCIER] @ Clear the interrupt
|
||||
bic r0, r0, #0x20000000
|
||||
str r0, [r1, #DMCIER]
|
||||
str r0, [r1, #PXA3_DMCIER]
|
||||
|
||||
mov pc, lr
|
||||
ENTRY(pm_enter_standby_end)
|
||||
|
|
84
arch/arm/mach-pxa/tavorevb.c
Normal file
84
arch/arm/mach-pxa/tavorevb.c
Normal file
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* linux/arch/arm/mach-pxa/tavorevb.c
|
||||
*
|
||||
* Support for the Marvell PXA930 Evaluation Board
|
||||
*
|
||||
* Copyright (C) 2007-2008 Marvell International Ltd.
|
||||
*
|
||||
* 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
|
||||
* publishhed by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/smc91x.h>
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/hardware.h>
|
||||
#include <asm/arch/pxa3xx-regs.h>
|
||||
#include <asm/arch/mfp-pxa930.h>
|
||||
|
||||
#include "devices.h"
|
||||
#include "generic.h"
|
||||
|
||||
/* Tavor EVB MFP configurations */
|
||||
static mfp_cfg_t tavorevb_mfp_cfg[] __initdata = {
|
||||
/* Ethernet */
|
||||
DF_nCS1_nCS3,
|
||||
GPIO47_GPIO,
|
||||
};
|
||||
|
||||
#define TAVOREVB_ETH_PHYS (0x14000000)
|
||||
|
||||
static struct resource smc91x_resources[] = {
|
||||
[0] = {
|
||||
.start = (TAVOREVB_ETH_PHYS + 0x300),
|
||||
.end = (TAVOREVB_ETH_PHYS + 0xfffff),
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
[1] = {
|
||||
.start = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO47)),
|
||||
.end = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO47)),
|
||||
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
|
||||
}
|
||||
};
|
||||
|
||||
static struct smc91x_platdata tavorevb_smc91x_info = {
|
||||
.flags = SMC91X_USE_16BIT | SMC91X_NOWAIT | SMC91X_USE_DMA,
|
||||
};
|
||||
|
||||
static struct platform_device smc91x_device = {
|
||||
.name = "smc91x",
|
||||
.id = 0,
|
||||
.num_resources = ARRAY_SIZE(smc91x_resources),
|
||||
.resource = smc91x_resources,
|
||||
.dev = {
|
||||
.platform_data = &tavorevb_smc91x_info,
|
||||
},
|
||||
};
|
||||
|
||||
static void __init tavorevb_init(void)
|
||||
{
|
||||
/* initialize MFP configurations */
|
||||
pxa3xx_mfp_config(ARRAY_AND_SIZE(tavorevb_mfp_cfg));
|
||||
|
||||
platform_device_register(&smc91x_device);
|
||||
}
|
||||
|
||||
MACHINE_START(TAVOREVB, "PXA930 Evaluation Board (aka TavorEVB)")
|
||||
/* Maintainer: Eric Miao <eric.miao@marvell.com> */
|
||||
.phys_io = 0x40000000,
|
||||
.boot_params = 0xa0000100,
|
||||
.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
|
||||
.map_io = pxa_map_io,
|
||||
.init_irq = pxa3xx_init_irq,
|
||||
.timer = &pxa_timer,
|
||||
.init_machine = tavorevb_init,
|
||||
MACHINE_END
|
150
arch/arm/mach-pxa/tosa-bt.c
Normal file
150
arch/arm/mach-pxa/tosa-bt.c
Normal file
|
@ -0,0 +1,150 @@
|
|||
/*
|
||||
* Bluetooth built-in chip control
|
||||
*
|
||||
* Copyright (c) 2008 Dmitry Baryshkov
|
||||
*
|
||||
* 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/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/rfkill.h>
|
||||
|
||||
#include <asm/arch/tosa_bt.h>
|
||||
|
||||
static void tosa_bt_on(struct tosa_bt_data *data)
|
||||
{
|
||||
gpio_set_value(data->gpio_reset, 0);
|
||||
gpio_set_value(data->gpio_pwr, 1);
|
||||
gpio_set_value(data->gpio_reset, 1);
|
||||
mdelay(20);
|
||||
gpio_set_value(data->gpio_reset, 0);
|
||||
}
|
||||
|
||||
static void tosa_bt_off(struct tosa_bt_data *data)
|
||||
{
|
||||
gpio_set_value(data->gpio_reset, 1);
|
||||
mdelay(10);
|
||||
gpio_set_value(data->gpio_pwr, 0);
|
||||
gpio_set_value(data->gpio_reset, 0);
|
||||
}
|
||||
|
||||
static int tosa_bt_toggle_radio(void *data, enum rfkill_state state)
|
||||
{
|
||||
pr_info("BT_RADIO going: %s\n",
|
||||
state == RFKILL_STATE_ON ? "on" : "off");
|
||||
|
||||
if (state == RFKILL_STATE_ON) {
|
||||
pr_info("TOSA_BT: going ON\n");
|
||||
tosa_bt_on(data);
|
||||
} else {
|
||||
pr_info("TOSA_BT: going OFF\n");
|
||||
tosa_bt_off(data);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tosa_bt_probe(struct platform_device *dev)
|
||||
{
|
||||
int rc;
|
||||
struct rfkill *rfk;
|
||||
|
||||
struct tosa_bt_data *data = dev->dev.platform_data;
|
||||
|
||||
rc = gpio_request(data->gpio_reset, "Bluetooth reset");
|
||||
if (rc)
|
||||
goto err_reset;
|
||||
rc = gpio_direction_output(data->gpio_reset, 0);
|
||||
if (rc)
|
||||
goto err_reset_dir;
|
||||
rc = gpio_request(data->gpio_pwr, "Bluetooth power");
|
||||
if (rc)
|
||||
goto err_pwr;
|
||||
rc = gpio_direction_output(data->gpio_pwr, 0);
|
||||
if (rc)
|
||||
goto err_pwr_dir;
|
||||
|
||||
rfk = rfkill_allocate(&dev->dev, RFKILL_TYPE_BLUETOOTH);
|
||||
if (!rfk) {
|
||||
rc = -ENOMEM;
|
||||
goto err_rfk_alloc;
|
||||
}
|
||||
|
||||
rfk->name = "tosa-bt";
|
||||
rfk->toggle_radio = tosa_bt_toggle_radio;
|
||||
rfk->data = data;
|
||||
#ifdef CONFIG_RFKILL_LEDS
|
||||
rfk->led_trigger.name = "tosa-bt";
|
||||
#endif
|
||||
|
||||
rc = rfkill_register(rfk);
|
||||
if (rc)
|
||||
goto err_rfkill;
|
||||
|
||||
platform_set_drvdata(dev, rfk);
|
||||
|
||||
return 0;
|
||||
|
||||
err_rfkill:
|
||||
if (rfk)
|
||||
rfkill_free(rfk);
|
||||
rfk = NULL;
|
||||
err_rfk_alloc:
|
||||
tosa_bt_off(data);
|
||||
err_pwr_dir:
|
||||
gpio_free(data->gpio_pwr);
|
||||
err_pwr:
|
||||
err_reset_dir:
|
||||
gpio_free(data->gpio_reset);
|
||||
err_reset:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int __devexit tosa_bt_remove(struct platform_device *dev)
|
||||
{
|
||||
struct tosa_bt_data *data = dev->dev.platform_data;
|
||||
struct rfkill *rfk = platform_get_drvdata(dev);
|
||||
|
||||
platform_set_drvdata(dev, NULL);
|
||||
|
||||
if (rfk)
|
||||
rfkill_unregister(rfk);
|
||||
rfk = NULL;
|
||||
|
||||
tosa_bt_off(data);
|
||||
|
||||
gpio_free(data->gpio_pwr);
|
||||
gpio_free(data->gpio_reset);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver tosa_bt_driver = {
|
||||
.probe = tosa_bt_probe,
|
||||
.remove = __devexit_p(tosa_bt_remove),
|
||||
|
||||
.driver = {
|
||||
.name = "tosa-bt",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
static int __init tosa_bt_init(void)
|
||||
{
|
||||
return platform_driver_register(&tosa_bt_driver);
|
||||
}
|
||||
|
||||
static void __exit tosa_bt_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&tosa_bt_driver);
|
||||
}
|
||||
|
||||
module_init(tosa_bt_init);
|
||||
module_exit(tosa_bt_exit);
|
|
@ -18,30 +18,31 @@
|
|||
#include <linux/major.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/mmc/host.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/mmc/host.h>
|
||||
#include <linux/mfd/tc6393xb.h>
|
||||
#include <linux/mfd/tmio.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/gpio_keys.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/pda_power.h>
|
||||
#include <linux/rfkill.h>
|
||||
|
||||
#include <asm/setup.h>
|
||||
#include <asm/memory.h>
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/hardware.h>
|
||||
#include <asm/irq.h>
|
||||
#include <asm/system.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-regs.h>
|
||||
#include <asm/arch/mfp-pxa25x.h>
|
||||
#include <asm/arch/irda.h>
|
||||
#include <asm/arch/i2c.h>
|
||||
#include <asm/arch/mmc.h>
|
||||
#include <asm/arch/udc.h>
|
||||
#include <asm/arch/tosa_bt.h>
|
||||
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach/map.h>
|
||||
#include <asm/mach/irq.h>
|
||||
#include <asm/arch/tosa.h>
|
||||
|
||||
#include <asm/hardware/scoop.h>
|
||||
|
@ -86,7 +87,7 @@ static unsigned long tosa_pin_config[] = {
|
|||
GPIO6_MMC_CLK,
|
||||
GPIO8_MMC_CS0,
|
||||
GPIO9_GPIO, /* Detect */
|
||||
// GPIO10 nSD_INT
|
||||
GPIO10_GPIO, /* nSD_INT */
|
||||
|
||||
/* CF */
|
||||
GPIO13_GPIO, /* CD_IRQ */
|
||||
|
@ -124,34 +125,34 @@ static unsigned long tosa_pin_config[] = {
|
|||
GPIO44_BTUART_CTS,
|
||||
GPIO45_BTUART_RTS,
|
||||
|
||||
/* IrDA */
|
||||
GPIO46_STUART_RXD,
|
||||
GPIO47_STUART_TXD,
|
||||
|
||||
/* Keybd */
|
||||
GPIO58_GPIO,
|
||||
GPIO59_GPIO,
|
||||
GPIO60_GPIO,
|
||||
GPIO61_GPIO,
|
||||
GPIO62_GPIO,
|
||||
GPIO63_GPIO,
|
||||
GPIO64_GPIO,
|
||||
GPIO65_GPIO,
|
||||
GPIO66_GPIO,
|
||||
GPIO67_GPIO,
|
||||
GPIO68_GPIO,
|
||||
GPIO69_GPIO,
|
||||
GPIO70_GPIO,
|
||||
GPIO71_GPIO,
|
||||
GPIO72_GPIO,
|
||||
GPIO73_GPIO,
|
||||
GPIO74_GPIO,
|
||||
GPIO75_GPIO,
|
||||
GPIO58_GPIO | MFP_LPM_DRIVE_LOW,
|
||||
GPIO59_GPIO | MFP_LPM_DRIVE_LOW,
|
||||
GPIO60_GPIO | MFP_LPM_DRIVE_LOW,
|
||||
GPIO61_GPIO | MFP_LPM_DRIVE_LOW,
|
||||
GPIO62_GPIO | MFP_LPM_DRIVE_LOW,
|
||||
GPIO63_GPIO | MFP_LPM_DRIVE_LOW,
|
||||
GPIO64_GPIO | MFP_LPM_DRIVE_LOW,
|
||||
GPIO65_GPIO | MFP_LPM_DRIVE_LOW,
|
||||
GPIO66_GPIO | MFP_LPM_DRIVE_LOW,
|
||||
GPIO67_GPIO | MFP_LPM_DRIVE_LOW,
|
||||
GPIO68_GPIO | MFP_LPM_DRIVE_LOW,
|
||||
GPIO69_GPIO | MFP_LPM_DRIVE_LOW,
|
||||
GPIO70_GPIO | MFP_LPM_DRIVE_LOW,
|
||||
GPIO71_GPIO | MFP_LPM_DRIVE_LOW,
|
||||
GPIO72_GPIO | MFP_LPM_DRIVE_LOW,
|
||||
GPIO73_GPIO | MFP_LPM_DRIVE_LOW,
|
||||
GPIO74_GPIO | MFP_LPM_DRIVE_LOW,
|
||||
GPIO75_GPIO | MFP_LPM_DRIVE_LOW,
|
||||
|
||||
/* SPI */
|
||||
GPIO81_SSP2_CLK_OUT,
|
||||
GPIO82_SSP2_FRM_OUT,
|
||||
GPIO83_SSP2_TXD,
|
||||
|
||||
/* IrDA is managed in other way */
|
||||
GPIO46_GPIO,
|
||||
GPIO47_GPIO,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -249,6 +250,15 @@ static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void
|
|||
|
||||
tosa_mci_platform_data.detect_delay = msecs_to_jiffies(250);
|
||||
|
||||
err = gpio_request(TOSA_GPIO_nSD_DETECT, "MMC/SD card detect");
|
||||
if (err) {
|
||||
printk(KERN_ERR "tosa_mci_init: can't request nSD_DETECT gpio\n");
|
||||
goto err_gpio_detect;
|
||||
}
|
||||
err = gpio_direction_input(TOSA_GPIO_nSD_DETECT);
|
||||
if (err)
|
||||
goto err_gpio_detect_dir;
|
||||
|
||||
err = request_irq(TOSA_IRQ_GPIO_nSD_DETECT, tosa_detect_int,
|
||||
IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
|
||||
"MMC/SD card detect", data);
|
||||
|
@ -257,7 +267,7 @@ static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void
|
|||
goto err_irq;
|
||||
}
|
||||
|
||||
err = gpio_request(TOSA_GPIO_SD_WP, "sd_wp");
|
||||
err = gpio_request(TOSA_GPIO_SD_WP, "SD Write Protect");
|
||||
if (err) {
|
||||
printk(KERN_ERR "tosa_mci_init: can't request SD_WP gpio\n");
|
||||
goto err_gpio_wp;
|
||||
|
@ -266,7 +276,7 @@ static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void
|
|||
if (err)
|
||||
goto err_gpio_wp_dir;
|
||||
|
||||
err = gpio_request(TOSA_GPIO_PWR_ON, "sd_pwr");
|
||||
err = gpio_request(TOSA_GPIO_PWR_ON, "SD Power");
|
||||
if (err) {
|
||||
printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n");
|
||||
goto err_gpio_pwr;
|
||||
|
@ -275,8 +285,20 @@ static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void
|
|||
if (err)
|
||||
goto err_gpio_pwr_dir;
|
||||
|
||||
err = gpio_request(TOSA_GPIO_nSD_INT, "SD Int");
|
||||
if (err) {
|
||||
printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n");
|
||||
goto err_gpio_int;
|
||||
}
|
||||
err = gpio_direction_input(TOSA_GPIO_nSD_INT);
|
||||
if (err)
|
||||
goto err_gpio_int_dir;
|
||||
|
||||
return 0;
|
||||
|
||||
err_gpio_int_dir:
|
||||
gpio_free(TOSA_GPIO_nSD_INT);
|
||||
err_gpio_int:
|
||||
err_gpio_pwr_dir:
|
||||
gpio_free(TOSA_GPIO_PWR_ON);
|
||||
err_gpio_pwr:
|
||||
|
@ -285,6 +307,9 @@ static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void
|
|||
err_gpio_wp:
|
||||
free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data);
|
||||
err_irq:
|
||||
err_gpio_detect_dir:
|
||||
gpio_free(TOSA_GPIO_nSD_DETECT);
|
||||
err_gpio_detect:
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -306,9 +331,11 @@ static int tosa_mci_get_ro(struct device *dev)
|
|||
|
||||
static void tosa_mci_exit(struct device *dev, void *data)
|
||||
{
|
||||
gpio_free(TOSA_GPIO_nSD_INT);
|
||||
gpio_free(TOSA_GPIO_PWR_ON);
|
||||
gpio_free(TOSA_GPIO_SD_WP);
|
||||
free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data);
|
||||
gpio_free(TOSA_GPIO_nSD_DETECT);
|
||||
}
|
||||
|
||||
static struct pxamci_platform_data tosa_mci_platform_data = {
|
||||
|
@ -322,29 +349,55 @@ static struct pxamci_platform_data tosa_mci_platform_data = {
|
|||
/*
|
||||
* Irda
|
||||
*/
|
||||
static void tosa_irda_transceiver_mode(struct device *dev, int mode)
|
||||
{
|
||||
if (mode & IR_OFF) {
|
||||
gpio_set_value(TOSA_GPIO_IR_POWERDWN, 0);
|
||||
pxa2xx_transceiver_mode(dev, mode);
|
||||
gpio_direction_output(TOSA_GPIO_IRDA_TX, 0);
|
||||
} else {
|
||||
pxa2xx_transceiver_mode(dev, mode);
|
||||
gpio_set_value(TOSA_GPIO_IR_POWERDWN, 1);
|
||||
}
|
||||
}
|
||||
|
||||
static int tosa_irda_startup(struct device *dev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = gpio_request(TOSA_GPIO_IRDA_TX, "IrDA TX");
|
||||
if (ret)
|
||||
goto err_tx;
|
||||
ret = gpio_direction_output(TOSA_GPIO_IRDA_TX, 0);
|
||||
if (ret)
|
||||
goto err_tx_dir;
|
||||
|
||||
ret = gpio_request(TOSA_GPIO_IR_POWERDWN, "IrDA powerdown");
|
||||
if (ret)
|
||||
return ret;
|
||||
goto err_pwr;
|
||||
|
||||
ret = gpio_direction_output(TOSA_GPIO_IR_POWERDWN, 0);
|
||||
if (ret)
|
||||
gpio_free(TOSA_GPIO_IR_POWERDWN);
|
||||
goto err_pwr_dir;
|
||||
|
||||
tosa_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF);
|
||||
|
||||
return 0;
|
||||
|
||||
err_pwr_dir:
|
||||
gpio_free(TOSA_GPIO_IR_POWERDWN);
|
||||
err_pwr:
|
||||
err_tx_dir:
|
||||
gpio_free(TOSA_GPIO_IRDA_TX);
|
||||
err_tx:
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
static void tosa_irda_shutdown(struct device *dev)
|
||||
{
|
||||
tosa_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF);
|
||||
gpio_free(TOSA_GPIO_IR_POWERDWN);
|
||||
}
|
||||
|
||||
static void tosa_irda_transceiver_mode(struct device *dev, int mode)
|
||||
{
|
||||
gpio_set_value(TOSA_GPIO_IR_POWERDWN, !(mode & IR_OFF));
|
||||
gpio_free(TOSA_GPIO_IRDA_TX);
|
||||
}
|
||||
|
||||
static struct pxaficp_platform_data tosa_ficp_platform_data = {
|
||||
|
@ -354,6 +407,70 @@ static struct pxaficp_platform_data tosa_ficp_platform_data = {
|
|||
.shutdown = tosa_irda_shutdown,
|
||||
};
|
||||
|
||||
/*
|
||||
* Tosa AC IN
|
||||
*/
|
||||
static int tosa_power_init(struct device *dev)
|
||||
{
|
||||
int ret = gpio_request(TOSA_GPIO_AC_IN, "ac in");
|
||||
if (ret)
|
||||
goto err_gpio_req;
|
||||
|
||||
ret = gpio_direction_input(TOSA_GPIO_AC_IN);
|
||||
if (ret)
|
||||
goto err_gpio_in;
|
||||
|
||||
return 0;
|
||||
|
||||
err_gpio_in:
|
||||
gpio_free(TOSA_GPIO_AC_IN);
|
||||
err_gpio_req:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void tosa_power_exit(struct device *dev)
|
||||
{
|
||||
gpio_free(TOSA_GPIO_AC_IN);
|
||||
}
|
||||
|
||||
static int tosa_power_ac_online(void)
|
||||
{
|
||||
return gpio_get_value(TOSA_GPIO_AC_IN) == 0;
|
||||
}
|
||||
|
||||
static char *tosa_ac_supplied_to[] = {
|
||||
"main-battery",
|
||||
"backup-battery",
|
||||
"jacket-battery",
|
||||
};
|
||||
|
||||
static struct pda_power_pdata tosa_power_data = {
|
||||
.init = tosa_power_init,
|
||||
.is_ac_online = tosa_power_ac_online,
|
||||
.exit = tosa_power_exit,
|
||||
.supplied_to = tosa_ac_supplied_to,
|
||||
.num_supplicants = ARRAY_SIZE(tosa_ac_supplied_to),
|
||||
};
|
||||
|
||||
static struct resource tosa_power_resource[] = {
|
||||
{
|
||||
.name = "ac",
|
||||
.start = gpio_to_irq(TOSA_GPIO_AC_IN),
|
||||
.end = gpio_to_irq(TOSA_GPIO_AC_IN),
|
||||
.flags = IORESOURCE_IRQ |
|
||||
IORESOURCE_IRQ_HIGHEDGE |
|
||||
IORESOURCE_IRQ_LOWEDGE,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device tosa_power_device = {
|
||||
.name = "pda-power",
|
||||
.id = -1,
|
||||
.dev.platform_data = &tosa_power_data,
|
||||
.resource = tosa_power_resource,
|
||||
.num_resources = ARRAY_SIZE(tosa_power_resource),
|
||||
};
|
||||
|
||||
/*
|
||||
* Tosa Keyboard
|
||||
*/
|
||||
|
@ -439,7 +556,7 @@ static struct gpio_led tosa_gpio_leds[] = {
|
|||
},
|
||||
{
|
||||
.name = "tosa:blue:bluetooth",
|
||||
.default_trigger = "none",
|
||||
.default_trigger = "tosa-bt",
|
||||
.gpio = TOSA_GPIO_BT_LED,
|
||||
},
|
||||
};
|
||||
|
@ -457,21 +574,184 @@ static struct platform_device tosaled_device = {
|
|||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* Toshiba Mobile IO Controller
|
||||
*/
|
||||
static struct resource tc6393xb_resources[] = {
|
||||
[0] = {
|
||||
.start = TOSA_LCDC_PHYS,
|
||||
.end = TOSA_LCDC_PHYS + 0x3ffffff,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
|
||||
[1] = {
|
||||
.start = TOSA_IRQ_GPIO_TC6393XB_INT,
|
||||
.end = TOSA_IRQ_GPIO_TC6393XB_INT,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
static int tosa_tc6393xb_enable(struct platform_device *dev)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = gpio_request(TOSA_GPIO_TC6393XB_REST_IN, "tc6393xb #pclr");
|
||||
if (rc)
|
||||
goto err_req_pclr;
|
||||
rc = gpio_request(TOSA_GPIO_TC6393XB_SUSPEND, "tc6393xb #suspend");
|
||||
if (rc)
|
||||
goto err_req_suspend;
|
||||
rc = gpio_request(TOSA_GPIO_TC6393XB_L3V_ON, "l3v");
|
||||
if (rc)
|
||||
goto err_req_l3v;
|
||||
rc = gpio_direction_output(TOSA_GPIO_TC6393XB_L3V_ON, 0);
|
||||
if (rc)
|
||||
goto err_dir_l3v;
|
||||
rc = gpio_direction_output(TOSA_GPIO_TC6393XB_SUSPEND, 0);
|
||||
if (rc)
|
||||
goto err_dir_suspend;
|
||||
rc = gpio_direction_output(TOSA_GPIO_TC6393XB_REST_IN, 0);
|
||||
if (rc)
|
||||
goto err_dir_pclr;
|
||||
|
||||
mdelay(1);
|
||||
|
||||
gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 1);
|
||||
|
||||
mdelay(10);
|
||||
|
||||
gpio_set_value(TOSA_GPIO_TC6393XB_REST_IN, 1);
|
||||
gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 1);
|
||||
|
||||
return 0;
|
||||
err_dir_pclr:
|
||||
err_dir_suspend:
|
||||
err_dir_l3v:
|
||||
gpio_free(TOSA_GPIO_TC6393XB_L3V_ON);
|
||||
err_req_l3v:
|
||||
gpio_free(TOSA_GPIO_TC6393XB_SUSPEND);
|
||||
err_req_suspend:
|
||||
gpio_free(TOSA_GPIO_TC6393XB_REST_IN);
|
||||
err_req_pclr:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int tosa_tc6393xb_disable(struct platform_device *dev)
|
||||
{
|
||||
gpio_free(TOSA_GPIO_TC6393XB_L3V_ON);
|
||||
gpio_free(TOSA_GPIO_TC6393XB_SUSPEND);
|
||||
gpio_free(TOSA_GPIO_TC6393XB_REST_IN);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tosa_tc6393xb_resume(struct platform_device *dev)
|
||||
{
|
||||
gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 1);
|
||||
mdelay(10);
|
||||
gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 1);
|
||||
mdelay(10);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tosa_tc6393xb_suspend(struct platform_device *dev)
|
||||
{
|
||||
gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 0);
|
||||
gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct mtd_partition tosa_nand_partition[] = {
|
||||
{
|
||||
.name = "smf",
|
||||
.offset = 0,
|
||||
.size = 7 * 1024 * 1024,
|
||||
},
|
||||
{
|
||||
.name = "root",
|
||||
.offset = MTDPART_OFS_APPEND,
|
||||
.size = 28 * 1024 * 1024,
|
||||
},
|
||||
{
|
||||
.name = "home",
|
||||
.offset = MTDPART_OFS_APPEND,
|
||||
.size = MTDPART_SIZ_FULL,
|
||||
},
|
||||
};
|
||||
|
||||
static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
|
||||
|
||||
static struct nand_bbt_descr tosa_tc6393xb_nand_bbt = {
|
||||
.options = 0,
|
||||
.offs = 4,
|
||||
.len = 2,
|
||||
.pattern = scan_ff_pattern
|
||||
};
|
||||
|
||||
static struct tmio_nand_data tosa_tc6393xb_nand_config = {
|
||||
.num_partitions = ARRAY_SIZE(tosa_nand_partition),
|
||||
.partition = tosa_nand_partition,
|
||||
.badblock_pattern = &tosa_tc6393xb_nand_bbt,
|
||||
};
|
||||
|
||||
static struct tc6393xb_platform_data tosa_tc6393xb_setup = {
|
||||
.scr_pll2cr = 0x0cc1,
|
||||
.scr_gper = 0x3300,
|
||||
.scr_gpo_dsr =
|
||||
TOSA_TC6393XB_GPIO_BIT(TOSA_GPIO_CARD_VCC_ON),
|
||||
.scr_gpo_doecr =
|
||||
TOSA_TC6393XB_GPIO_BIT(TOSA_GPIO_CARD_VCC_ON),
|
||||
|
||||
.irq_base = IRQ_BOARD_START,
|
||||
.gpio_base = TOSA_TC6393XB_GPIO_BASE,
|
||||
|
||||
.enable = tosa_tc6393xb_enable,
|
||||
.disable = tosa_tc6393xb_disable,
|
||||
.suspend = tosa_tc6393xb_suspend,
|
||||
.resume = tosa_tc6393xb_resume,
|
||||
|
||||
.nand_data = &tosa_tc6393xb_nand_config,
|
||||
};
|
||||
|
||||
|
||||
static struct platform_device tc6393xb_device = {
|
||||
.name = "tc6393xb",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &tosa_tc6393xb_setup,
|
||||
},
|
||||
.num_resources = ARRAY_SIZE(tc6393xb_resources),
|
||||
.resource = tc6393xb_resources,
|
||||
};
|
||||
|
||||
static struct tosa_bt_data tosa_bt_data = {
|
||||
.gpio_pwr = TOSA_GPIO_BT_PWR_EN,
|
||||
.gpio_reset = TOSA_GPIO_BT_RESET,
|
||||
};
|
||||
|
||||
static struct platform_device tosa_bt_device = {
|
||||
.name = "tosa-bt",
|
||||
.id = -1,
|
||||
.dev.platform_data = &tosa_bt_data,
|
||||
};
|
||||
|
||||
|
||||
static struct platform_device *devices[] __initdata = {
|
||||
&tosascoop_device,
|
||||
&tosascoop_jc_device,
|
||||
&tc6393xb_device,
|
||||
&tosa_power_device,
|
||||
&tosakbd_device,
|
||||
&tosa_gpio_keys_device,
|
||||
&tosaled_device,
|
||||
&tosa_bt_device,
|
||||
};
|
||||
|
||||
static void tosa_poweroff(void)
|
||||
{
|
||||
gpio_direction_output(TOSA_GPIO_ON_RESET, 0);
|
||||
gpio_set_value(TOSA_GPIO_ON_RESET, 1);
|
||||
|
||||
mdelay(1000);
|
||||
arm_machine_restart('h');
|
||||
arm_machine_restart('g');
|
||||
}
|
||||
|
||||
static void tosa_restart(char mode)
|
||||
|
@ -485,10 +765,14 @@ static void tosa_restart(char mode)
|
|||
|
||||
static void __init tosa_init(void)
|
||||
{
|
||||
int dummy;
|
||||
|
||||
pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_config));
|
||||
gpio_set_wake(MFP_PIN_GPIO1, 1);
|
||||
/* We can't pass to gpio-keys since it will drop the Reset altfunc */
|
||||
|
||||
init_gpio_reset(TOSA_GPIO_ON_RESET);
|
||||
|
||||
pm_power_off = tosa_poweroff;
|
||||
arm_pm_restart = tosa_restart;
|
||||
|
||||
|
@ -497,6 +781,10 @@ static void __init tosa_init(void)
|
|||
/* enable batt_fault */
|
||||
PMCR = 0x01;
|
||||
|
||||
dummy = gpiochip_reserve(TOSA_SCOOP_GPIO_BASE, 12);
|
||||
dummy = gpiochip_reserve(TOSA_SCOOP_JC_GPIO_BASE, 12);
|
||||
dummy = gpiochip_reserve(TOSA_TC6393XB_GPIO_BASE, 16);
|
||||
|
||||
pxa_set_mci_info(&tosa_mci_platform_data);
|
||||
pxa_set_udc_info(&udc_info);
|
||||
pxa_set_ficp_info(&tosa_ficp_platform_data);
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <asm/mach/flash.h>
|
||||
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-regs.h>
|
||||
#include <asm/arch/pxa2xx-gpio.h>
|
||||
#include <asm/arch/trizeps4.h>
|
||||
#include <asm/arch/audio.h>
|
||||
|
@ -175,19 +176,10 @@ static struct platform_device uart_devices = {
|
|||
.resource = NULL,
|
||||
};
|
||||
|
||||
/********************************************************************************************
|
||||
* PXA270 ac97 sound codec
|
||||
********************************************************************************************/
|
||||
static struct platform_device ac97_audio_device = {
|
||||
.name = "pxa2xx-ac97",
|
||||
.id = -1,
|
||||
};
|
||||
|
||||
static struct platform_device * trizeps4_devices[] __initdata = {
|
||||
&flash_device,
|
||||
&uart_devices,
|
||||
&dm9000_device,
|
||||
&ac97_audio_device,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_MACH_TRIZEPS4_CONXS
|
||||
|
@ -262,6 +254,7 @@ static void board_irda_mode(struct device *dev, int mode)
|
|||
/* Fast mode */
|
||||
trizeps_conxs_ircr |= ConXS_IRCR_MODE;
|
||||
}
|
||||
pxa2xx_transceiver_mode(dev, mode);
|
||||
if (mode & IR_OFF) {
|
||||
trizeps_conxs_ircr |= ConXS_IRCR_SD;
|
||||
} else {
|
||||
|
@ -438,6 +431,7 @@ static void __init trizeps4_init(void)
|
|||
pxa_set_mci_info(&trizeps4_mci_platform_data);
|
||||
pxa_set_ficp_info(&trizeps4_ficp_platform_data);
|
||||
pxa_set_ohci_info(&trizeps4_ohci_platform_data);
|
||||
pxa_set_ac97_info(NULL);
|
||||
}
|
||||
|
||||
static void __init trizeps4_map_io(void)
|
||||
|
@ -487,6 +481,7 @@ static void __init trizeps4_map_io(void)
|
|||
ConXS_BCR = trizeps_conxs_bcr;
|
||||
#endif
|
||||
|
||||
#warning FIXME - accessing PM registers directly is deprecated
|
||||
PWER = 0x00000002;
|
||||
PFER = 0x00000000;
|
||||
PRER = 0x00000002;
|
||||
|
|
|
@ -18,23 +18,29 @@
|
|||
#include <linux/interrupt.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pwm_backlight.h>
|
||||
#include <linux/smc91x.h>
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/hardware.h>
|
||||
#include <asm/arch/audio.h>
|
||||
#include <asm/arch/gpio.h>
|
||||
#include <asm/arch/pxafb.h>
|
||||
#include <asm/arch/zylonite.h>
|
||||
#include <asm/arch/mmc.h>
|
||||
#include <asm/arch/pxa27x_keypad.h>
|
||||
#include <asm/arch/pxa3xx_nand.h>
|
||||
|
||||
#include "devices.h"
|
||||
#include "generic.h"
|
||||
|
||||
#define MAX_SLOTS 3
|
||||
struct platform_mmc_slot zylonite_mmc_slot[MAX_SLOTS];
|
||||
|
||||
int gpio_backlight;
|
||||
int gpio_eth_irq;
|
||||
int gpio_debug_led1;
|
||||
int gpio_debug_led2;
|
||||
|
||||
int wm9713_irq;
|
||||
|
||||
|
@ -54,18 +60,72 @@ static struct resource smc91x_resources[] = {
|
|||
}
|
||||
};
|
||||
|
||||
static struct smc91x_platdata zylonite_smc91x_info = {
|
||||
.flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT |
|
||||
SMC91X_NOWAIT | SMC91X_USE_DMA,
|
||||
};
|
||||
|
||||
static struct platform_device smc91x_device = {
|
||||
.name = "smc91x",
|
||||
.id = 0,
|
||||
.num_resources = ARRAY_SIZE(smc91x_resources),
|
||||
.resource = smc91x_resources,
|
||||
.dev = {
|
||||
.platform_data = &zylonite_smc91x_info,
|
||||
},
|
||||
};
|
||||
|
||||
#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
|
||||
static void zylonite_backlight_power(int on)
|
||||
#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
|
||||
static struct gpio_led zylonite_debug_leds[] = {
|
||||
[0] = {
|
||||
.name = "zylonite:yellow:1",
|
||||
.default_trigger = "heartbeat",
|
||||
},
|
||||
[1] = {
|
||||
.name = "zylonite:yellow:2",
|
||||
.default_trigger = "default-on",
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpio_led_platform_data zylonite_debug_leds_info = {
|
||||
.leds = zylonite_debug_leds,
|
||||
.num_leds = ARRAY_SIZE(zylonite_debug_leds),
|
||||
};
|
||||
|
||||
static struct platform_device zylonite_device_leds = {
|
||||
.name = "leds-gpio",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &zylonite_debug_leds_info,
|
||||
}
|
||||
};
|
||||
|
||||
static void __init zylonite_init_leds(void)
|
||||
{
|
||||
gpio_set_value(gpio_backlight, on);
|
||||
zylonite_debug_leds[0].gpio = gpio_debug_led1;
|
||||
zylonite_debug_leds[1].gpio = gpio_debug_led2;
|
||||
|
||||
platform_device_register(&zylonite_device_leds);
|
||||
}
|
||||
#else
|
||||
static inline void zylonite_init_leds(void) {}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
|
||||
static struct platform_pwm_backlight_data zylonite_backlight_data = {
|
||||
.pwm_id = 3,
|
||||
.max_brightness = 100,
|
||||
.dft_brightness = 100,
|
||||
.pwm_period_ns = 10000,
|
||||
};
|
||||
|
||||
static struct platform_device zylonite_backlight_device = {
|
||||
.name = "pwm-backlight",
|
||||
.dev = {
|
||||
.parent = &pxa27x_device_pwm1.dev,
|
||||
.platform_data = &zylonite_backlight_data,
|
||||
},
|
||||
};
|
||||
|
||||
static struct pxafb_mode_info toshiba_ltm035a776c_mode = {
|
||||
.pixclock = 110000,
|
||||
|
@ -98,7 +158,6 @@ static struct pxafb_mode_info toshiba_ltm04c380k_mode = {
|
|||
static struct pxafb_mach_info zylonite_toshiba_lcd_info = {
|
||||
.num_modes = 1,
|
||||
.lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
|
||||
.pxafb_backlight_power = zylonite_backlight_power,
|
||||
};
|
||||
|
||||
static struct pxafb_mode_info sharp_ls037_modes[] = {
|
||||
|
@ -134,13 +193,11 @@ static struct pxafb_mach_info zylonite_sharp_lcd_info = {
|
|||
.modes = sharp_ls037_modes,
|
||||
.num_modes = 2,
|
||||
.lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
|
||||
.pxafb_backlight_power = zylonite_backlight_power,
|
||||
};
|
||||
|
||||
static void __init zylonite_init_lcd(void)
|
||||
{
|
||||
/* backlight GPIO: output, default on */
|
||||
gpio_direction_output(gpio_backlight, 1);
|
||||
platform_device_register(&zylonite_backlight_device);
|
||||
|
||||
if (lcd_id & 0x20) {
|
||||
set_pxa_fb_info(&zylonite_sharp_lcd_info);
|
||||
|
@ -250,7 +307,7 @@ static void __init zylonite_init_mmc(void)
|
|||
static inline void zylonite_init_mmc(void) {}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULES)
|
||||
#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
|
||||
static unsigned int zylonite_matrix_key_map[] = {
|
||||
/* KEY(row, col, key_code) */
|
||||
KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D),
|
||||
|
@ -315,6 +372,57 @@ static void __init zylonite_init_keypad(void)
|
|||
static inline void zylonite_init_keypad(void) {}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)
|
||||
static struct mtd_partition zylonite_nand_partitions[] = {
|
||||
[0] = {
|
||||
.name = "Bootloader",
|
||||
.offset = 0,
|
||||
.size = 0x060000,
|
||||
.mask_flags = MTD_WRITEABLE, /* force read-only */
|
||||
},
|
||||
[1] = {
|
||||
.name = "Kernel",
|
||||
.offset = 0x060000,
|
||||
.size = 0x200000,
|
||||
.mask_flags = MTD_WRITEABLE, /* force read-only */
|
||||
},
|
||||
[2] = {
|
||||
.name = "Filesystem",
|
||||
.offset = 0x0260000,
|
||||
.size = 0x3000000, /* 48M - rootfs */
|
||||
},
|
||||
[3] = {
|
||||
.name = "MassStorage",
|
||||
.offset = 0x3260000,
|
||||
.size = 0x3d40000,
|
||||
},
|
||||
[4] = {
|
||||
.name = "BBT",
|
||||
.offset = 0x6FA0000,
|
||||
.size = 0x80000,
|
||||
.mask_flags = MTD_WRITEABLE, /* force read-only */
|
||||
},
|
||||
/* NOTE: we reserve some blocks at the end of the NAND flash for
|
||||
* bad block management, and the max number of relocation blocks
|
||||
* differs on different platforms. Please take care with it when
|
||||
* defining the partition table.
|
||||
*/
|
||||
};
|
||||
|
||||
static struct pxa3xx_nand_platform_data zylonite_nand_info = {
|
||||
.enable_arbiter = 1,
|
||||
.parts = zylonite_nand_partitions,
|
||||
.nr_parts = ARRAY_SIZE(zylonite_nand_partitions),
|
||||
};
|
||||
|
||||
static void __init zylonite_init_nand(void)
|
||||
{
|
||||
pxa3xx_set_nand_info(&zylonite_nand_info);
|
||||
}
|
||||
#else
|
||||
static inline void zylonite_init_nand(void) {}
|
||||
#endif /* CONFIG_MTD_NAND_PXA3xx || CONFIG_MTD_NAND_PXA3xx_MODULE */
|
||||
|
||||
static void __init zylonite_init(void)
|
||||
{
|
||||
/* board-processor specific initialization */
|
||||
|
@ -329,9 +437,12 @@ static void __init zylonite_init(void)
|
|||
smc91x_resources[1].end = gpio_to_irq(gpio_eth_irq);
|
||||
platform_device_register(&smc91x_device);
|
||||
|
||||
pxa_set_ac97_info(NULL);
|
||||
zylonite_init_lcd();
|
||||
zylonite_init_mmc();
|
||||
zylonite_init_keypad();
|
||||
zylonite_init_nand();
|
||||
zylonite_init_leds();
|
||||
}
|
||||
|
||||
MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)")
|
||||
|
|
|
@ -16,9 +16,12 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/i2c/pca953x.h>
|
||||
|
||||
#include <asm/gpio.h>
|
||||
#include <asm/arch/mfp-pxa300.h>
|
||||
#include <asm/arch/i2c.h>
|
||||
#include <asm/arch/zylonite.h>
|
||||
|
||||
#include "generic.h"
|
||||
|
@ -50,6 +53,7 @@ static mfp_cfg_t common_mfp_cfg[] __initdata = {
|
|||
GPIO75_LCD_BIAS,
|
||||
GPIO76_LCD_VSYNC,
|
||||
GPIO127_LCD_CS_N,
|
||||
GPIO20_PWM3_OUT, /* backlight */
|
||||
|
||||
/* BTUART */
|
||||
GPIO111_UART2_RTS,
|
||||
|
@ -108,6 +112,10 @@ static mfp_cfg_t common_mfp_cfg[] __initdata = {
|
|||
GPIO12_MMC2_DAT3,
|
||||
GPIO13_MMC2_CLK,
|
||||
GPIO14_MMC2_CMD,
|
||||
|
||||
/* Standard I2C */
|
||||
GPIO21_I2C_SCL,
|
||||
GPIO22_I2C_SDA,
|
||||
};
|
||||
|
||||
static mfp_cfg_t pxa300_mfp_cfg[] __initdata = {
|
||||
|
@ -191,6 +199,39 @@ static void __init zylonite_detect_lcd_panel(void)
|
|||
pxa3xx_mfp_write(lcd_detect_pins[i], mfpr_save[i]);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
|
||||
static struct pca953x_platform_data gpio_exp[] = {
|
||||
[0] = {
|
||||
.gpio_base = 128,
|
||||
},
|
||||
[1] = {
|
||||
.gpio_base = 144,
|
||||
},
|
||||
};
|
||||
|
||||
struct i2c_board_info zylonite_i2c_board_info[] = {
|
||||
{
|
||||
.type = "pca9539",
|
||||
.addr = 0x74,
|
||||
.platform_data = &gpio_exp[0],
|
||||
.irq = IRQ_GPIO(18),
|
||||
}, {
|
||||
.type = "pca9539",
|
||||
.addr = 0x75,
|
||||
.platform_data = &gpio_exp[1],
|
||||
.irq = IRQ_GPIO(19),
|
||||
},
|
||||
};
|
||||
|
||||
static void __init zylonite_init_i2c(void)
|
||||
{
|
||||
pxa_set_i2c_info(NULL);
|
||||
i2c_register_board_info(0, ARRAY_AND_SIZE(zylonite_i2c_board_info));
|
||||
}
|
||||
#else
|
||||
static inline void zylonite_init_i2c(void) {}
|
||||
#endif
|
||||
|
||||
void __init zylonite_pxa300_init(void)
|
||||
{
|
||||
if (cpu_is_pxa300() || cpu_is_pxa310()) {
|
||||
|
@ -200,15 +241,14 @@ void __init zylonite_pxa300_init(void)
|
|||
/* detect LCD panel */
|
||||
zylonite_detect_lcd_panel();
|
||||
|
||||
/* GPIO pin assignment */
|
||||
gpio_backlight = mfp_to_gpio(MFP_PIN_GPIO20);
|
||||
|
||||
/* MMC card detect & write protect for controller 0 */
|
||||
zylonite_mmc_slot[0].gpio_cd = EXT_GPIO(0);
|
||||
zylonite_mmc_slot[0].gpio_wp = EXT_GPIO(2);
|
||||
|
||||
/* WM9713 IRQ */
|
||||
wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO26);
|
||||
|
||||
zylonite_init_i2c();
|
||||
}
|
||||
|
||||
if (cpu_is_pxa300()) {
|
||||
|
@ -224,4 +264,8 @@ void __init zylonite_pxa300_init(void)
|
|||
zylonite_mmc_slot[2].gpio_cd = EXT_GPIO(30);
|
||||
zylonite_mmc_slot[2].gpio_wp = EXT_GPIO(31);
|
||||
}
|
||||
|
||||
/* GPIOs for Debug LEDs */
|
||||
gpio_debug_led1 = EXT_GPIO(25);
|
||||
gpio_debug_led2 = EXT_GPIO(26);
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ static mfp_cfg_t mfp_cfg[] __initdata = {
|
|||
GPIO15_2_LCD_LCLK,
|
||||
GPIO16_2_LCD_PCLK,
|
||||
GPIO17_2_LCD_BIAS,
|
||||
GPIO14_PWM3_OUT, /* backlight */
|
||||
|
||||
/* FFUART */
|
||||
GPIO41_UART1_RXD | MFP_LPM_EDGE_FALL,
|
||||
|
@ -115,6 +116,10 @@ static mfp_cfg_t mfp_cfg[] __initdata = {
|
|||
GPIO27_MMC2_DAT3,
|
||||
GPIO28_MMC2_CLK,
|
||||
GPIO29_MMC2_CMD,
|
||||
|
||||
/* Debug LEDs */
|
||||
GPIO1_2_GPIO | MFP_LPM_DRIVE_HIGH,
|
||||
GPIO4_2_GPIO | MFP_LPM_DRIVE_HIGH,
|
||||
};
|
||||
|
||||
#define NUM_LCD_DETECT_PINS 7
|
||||
|
@ -187,8 +192,9 @@ void __init zylonite_pxa320_init(void)
|
|||
zylonite_detect_lcd_panel();
|
||||
|
||||
/* GPIO pin assignment */
|
||||
gpio_backlight = mfp_to_gpio(MFP_PIN_GPIO14);
|
||||
gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO9);
|
||||
gpio_debug_led1 = mfp_to_gpio(MFP_PIN_GPIO1_2);
|
||||
gpio_debug_led2 = mfp_to_gpio(MFP_PIN_GPIO4_2);
|
||||
|
||||
/* MMC card detect & write protect for controller 0 */
|
||||
zylonite_mmc_slot[0].gpio_cd = mfp_to_gpio(MFP_PIN_GPIO1);
|
||||
|
|
|
@ -103,7 +103,7 @@ static void clk_gpio27_disable(void)
|
|||
}
|
||||
|
||||
static struct clk clk_gpio27 = {
|
||||
.name = "GPIO27_CLK",
|
||||
.name = "SA1111_CLK",
|
||||
.rate = 3686400,
|
||||
.enable = clk_gpio27_enable,
|
||||
.disable = clk_gpio27_disable,
|
||||
|
|
|
@ -76,3 +76,5 @@ obj-$(CONFIG_CPU_V7) += proc-v7.o
|
|||
|
||||
obj-$(CONFIG_CACHE_FEROCEON_L2) += cache-feroceon-l2.o
|
||||
obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o
|
||||
obj-$(CONFIG_CACHE_XSC3L2) += cache-xsc3l2.o
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#
|
||||
# http://www.arm.linux.org.uk/developer/machines/?action=new
|
||||
#
|
||||
# Last update: Mon Jul 7 16:25:39 2008
|
||||
# Last update: Sun Jul 13 12:04:05 2008
|
||||
#
|
||||
# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
|
||||
#
|
||||
|
@ -1812,3 +1812,11 @@ jade MACH_JADE JADE 1821
|
|||
ks8695_softplc MACH_KS8695_SOFTPLC KS8695_SOFTPLC 1822
|
||||
gprisc4 MACH_GPRISC4 GPRISC4 1823
|
||||
stamp9260 MACH_STAMP9260 STAMP9260 1824
|
||||
smdk6430 MACH_SMDK6430 SMDK6430 1825
|
||||
smdkc100 MACH_SMDKC100 SMDKC100 1826
|
||||
tavorevb MACH_TAVOREVB TAVOREVB 1827
|
||||
saar MACH_SAAR SAAR 1828
|
||||
deister_eyecam MACH_DEISTER_EYECAM DEISTER_EYECAM 1829
|
||||
at91sam9m10ek MACH_AT91SAM9M10EK AT91SAM9M10EK 1830
|
||||
linkstation_produo MACH_LINKSTATION_PRODUO LINKSTATION_PRODUO 1831
|
||||
hit_b0 MACH_HIT_B0 HIT_B0 1832
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
static struct smc91x_platdata smc91x_info = {
|
||||
.flags = SMC91X_USE_16BIT,
|
||||
.irq_flags = IRQF_TRIGGER_HIGH,
|
||||
};
|
||||
|
||||
static struct resource smc91x_eth_resources[] = {
|
||||
|
@ -42,7 +41,7 @@ static struct resource smc91x_eth_resources[] = {
|
|||
},
|
||||
[1] = {
|
||||
.start = 32, /* IRQ0 */
|
||||
.flags = IORESOURCE_IRQ,
|
||||
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include <asm/io.h>
|
||||
#include <asm/arch/i2c.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-gpio.h>
|
||||
|
||||
struct pxa_i2c {
|
||||
spinlock_t lock;
|
||||
|
@ -945,32 +944,6 @@ static const struct i2c_algorithm i2c_pxa_pio_algorithm = {
|
|||
.functionality = i2c_pxa_functionality,
|
||||
};
|
||||
|
||||
static void i2c_pxa_enable(struct platform_device *dev)
|
||||
{
|
||||
if (cpu_is_pxa27x()) {
|
||||
switch (dev->id) {
|
||||
case 0:
|
||||
pxa_gpio_mode(GPIO117_I2CSCL_MD);
|
||||
pxa_gpio_mode(GPIO118_I2CSDA_MD);
|
||||
break;
|
||||
case 1:
|
||||
local_irq_disable();
|
||||
PCFR |= PCFR_PI2CEN;
|
||||
local_irq_enable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void i2c_pxa_disable(struct platform_device *dev)
|
||||
{
|
||||
if (cpu_is_pxa27x() && dev->id == 1) {
|
||||
local_irq_disable();
|
||||
PCFR &= ~PCFR_PI2CEN;
|
||||
local_irq_enable();
|
||||
}
|
||||
}
|
||||
|
||||
#define res_len(r) ((r)->end - (r)->start + 1)
|
||||
static int i2c_pxa_probe(struct platform_device *dev)
|
||||
{
|
||||
|
@ -1036,7 +1009,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
|
|||
#endif
|
||||
|
||||
clk_enable(i2c->clk);
|
||||
i2c_pxa_enable(dev);
|
||||
|
||||
if (plat) {
|
||||
i2c->adap.class = plat->class;
|
||||
|
@ -1080,7 +1052,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
|
|||
free_irq(irq, i2c);
|
||||
ereqirq:
|
||||
clk_disable(i2c->clk);
|
||||
i2c_pxa_disable(dev);
|
||||
iounmap(i2c->reg_base);
|
||||
eremap:
|
||||
clk_put(i2c->clk);
|
||||
|
@ -1103,7 +1074,6 @@ static int __exit i2c_pxa_remove(struct platform_device *dev)
|
|||
|
||||
clk_disable(i2c->clk);
|
||||
clk_put(i2c->clk);
|
||||
i2c_pxa_disable(dev);
|
||||
|
||||
iounmap(i2c->reg_base);
|
||||
release_mem_region(i2c->iobase, i2c->iosize);
|
||||
|
|
|
@ -215,8 +215,6 @@ static int tosakbd_suspend(struct platform_device *dev, pm_message_t state)
|
|||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&tosakbd->lock, flags);
|
||||
PGSR1 = (PGSR1 & ~TOSA_GPIO_LOW_STROBE_BIT);
|
||||
PGSR2 = (PGSR2 & ~TOSA_GPIO_HIGH_STROBE_BIT);
|
||||
tosakbd->suspended = 1;
|
||||
spin_unlock_irqrestore(&tosakbd->lock, flags);
|
||||
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
menu "Multifunction device drivers"
|
||||
depends on HAS_IOMEM
|
||||
|
||||
config MFD_CORE
|
||||
tristate
|
||||
default n
|
||||
|
||||
config MFD_SM501
|
||||
tristate "Support for Silicon Motion SM501"
|
||||
---help---
|
||||
|
@ -38,6 +42,13 @@ config HTC_PASIC3
|
|||
HTC Magician devices, respectively. Actual functionality is
|
||||
handled by the leds-pasic3 and ds1wm drivers.
|
||||
|
||||
config MFD_TC6393XB
|
||||
bool "Support Toshiba TC6393XB"
|
||||
depends on HAVE_GPIO_LIB
|
||||
select MFD_CORE
|
||||
help
|
||||
Support for Toshiba Mobile IO Controller TC6393XB
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Multimedia Capabilities Port drivers"
|
||||
|
|
|
@ -8,6 +8,10 @@ obj-$(CONFIG_MFD_ASIC3) += asic3.o
|
|||
obj-$(CONFIG_HTC_EGPIO) += htc-egpio.o
|
||||
obj-$(CONFIG_HTC_PASIC3) += htc-pasic3.o
|
||||
|
||||
obj-$(CONFIG_MFD_TC6393XB) += tc6393xb.o
|
||||
|
||||
obj-$(CONFIG_MFD_CORE) += mfd-core.o
|
||||
|
||||
obj-$(CONFIG_MCP) += mcp-core.o
|
||||
obj-$(CONFIG_MCP_SA11X0) += mcp-sa11x0.o
|
||||
obj-$(CONFIG_MCP_UCB1200) += ucb1x00-core.o
|
||||
|
|
114
drivers/mfd/mfd-core.c
Normal file
114
drivers/mfd/mfd-core.c
Normal file
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
* drivers/mfd/mfd-core.c
|
||||
*
|
||||
* core MFD support
|
||||
* Copyright (c) 2006 Ian Molton
|
||||
* Copyright (c) 2007,2008 Dmitry Baryshkov
|
||||
*
|
||||
* 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/platform_device.h>
|
||||
#include <linux/mfd/core.h>
|
||||
|
||||
static int mfd_add_device(struct platform_device *parent,
|
||||
const struct mfd_cell *cell,
|
||||
struct resource *mem_base,
|
||||
int irq_base)
|
||||
{
|
||||
struct resource res[cell->num_resources];
|
||||
struct platform_device *pdev;
|
||||
int ret = -ENOMEM;
|
||||
int r;
|
||||
|
||||
pdev = platform_device_alloc(cell->name, parent->id);
|
||||
if (!pdev)
|
||||
goto fail_alloc;
|
||||
|
||||
pdev->dev.parent = &parent->dev;
|
||||
|
||||
ret = platform_device_add_data(pdev,
|
||||
cell, sizeof(struct mfd_cell));
|
||||
if (ret)
|
||||
goto fail_device;
|
||||
|
||||
memzero(res, sizeof(res));
|
||||
for (r = 0; r < cell->num_resources; r++) {
|
||||
res[r].name = cell->resources[r].name;
|
||||
res[r].flags = cell->resources[r].flags;
|
||||
|
||||
/* Find out base to use */
|
||||
if (cell->resources[r].flags & IORESOURCE_MEM) {
|
||||
res[r].parent = mem_base;
|
||||
res[r].start = mem_base->start +
|
||||
cell->resources[r].start;
|
||||
res[r].end = mem_base->start +
|
||||
cell->resources[r].end;
|
||||
} else if (cell->resources[r].flags & IORESOURCE_IRQ) {
|
||||
res[r].start = irq_base +
|
||||
cell->resources[r].start;
|
||||
res[r].end = irq_base +
|
||||
cell->resources[r].end;
|
||||
} else {
|
||||
res[r].parent = cell->resources[r].parent;
|
||||
res[r].start = cell->resources[r].start;
|
||||
res[r].end = cell->resources[r].end;
|
||||
}
|
||||
}
|
||||
|
||||
platform_device_add_resources(pdev, res, cell->num_resources);
|
||||
|
||||
ret = platform_device_add(pdev);
|
||||
if (ret)
|
||||
goto fail_device;
|
||||
|
||||
return 0;
|
||||
|
||||
/* platform_device_del(pdev); */
|
||||
fail_device:
|
||||
platform_device_put(pdev);
|
||||
fail_alloc:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int mfd_add_devices(
|
||||
struct platform_device *parent,
|
||||
const struct mfd_cell *cells, int n_devs,
|
||||
struct resource *mem_base,
|
||||
int irq_base)
|
||||
{
|
||||
int i;
|
||||
int ret = 0;
|
||||
|
||||
for (i = 0; i < n_devs; i++) {
|
||||
ret = mfd_add_device(parent, cells + i, mem_base, irq_base);
|
||||
if (ret)
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret)
|
||||
mfd_remove_devices(parent);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(mfd_add_devices);
|
||||
|
||||
static int mfd_remove_devices_fn(struct device *dev, void *unused)
|
||||
{
|
||||
platform_device_unregister(
|
||||
container_of(dev, struct platform_device, dev));
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mfd_remove_devices(struct platform_device *parent)
|
||||
{
|
||||
device_for_each_child(&parent->dev, NULL, mfd_remove_devices_fn);
|
||||
}
|
||||
EXPORT_SYMBOL(mfd_remove_devices);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Ian Molton, Dmitry Baryshkov");
|
600
drivers/mfd/tc6393xb.c
Normal file
600
drivers/mfd/tc6393xb.c
Normal file
|
@ -0,0 +1,600 @@
|
|||
/*
|
||||
* Toshiba TC6393XB SoC support
|
||||
*
|
||||
* Copyright(c) 2005-2006 Chris Humbert
|
||||
* Copyright(c) 2005 Dirk Opfer
|
||||
* Copyright(c) 2005 Ian Molton <spyro@f2s.com>
|
||||
* Copyright(c) 2007 Dmitry Baryshkov
|
||||
*
|
||||
* Based on code written by Sharp/Lineo for 2.4 kernels
|
||||
* Based on locomo.c
|
||||
*
|
||||
* 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/module.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/mfd/core.h>
|
||||
#include <linux/mfd/tmio.h>
|
||||
#include <linux/mfd/tc6393xb.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#define SCR_REVID 0x08 /* b Revision ID */
|
||||
#define SCR_ISR 0x50 /* b Interrupt Status */
|
||||
#define SCR_IMR 0x52 /* b Interrupt Mask */
|
||||
#define SCR_IRR 0x54 /* b Interrupt Routing */
|
||||
#define SCR_GPER 0x60 /* w GP Enable */
|
||||
#define SCR_GPI_SR(i) (0x64 + (i)) /* b3 GPI Status */
|
||||
#define SCR_GPI_IMR(i) (0x68 + (i)) /* b3 GPI INT Mask */
|
||||
#define SCR_GPI_EDER(i) (0x6c + (i)) /* b3 GPI Edge Detect Enable */
|
||||
#define SCR_GPI_LIR(i) (0x70 + (i)) /* b3 GPI Level Invert */
|
||||
#define SCR_GPO_DSR(i) (0x78 + (i)) /* b3 GPO Data Set */
|
||||
#define SCR_GPO_DOECR(i) (0x7c + (i)) /* b3 GPO Data OE Control */
|
||||
#define SCR_GP_IARCR(i) (0x80 + (i)) /* b3 GP Internal Active Register Control */
|
||||
#define SCR_GP_IARLCR(i) (0x84 + (i)) /* b3 GP INTERNAL Active Register Level Control */
|
||||
#define SCR_GPI_BCR(i) (0x88 + (i)) /* b3 GPI Buffer Control */
|
||||
#define SCR_GPA_IARCR 0x8c /* w GPa Internal Active Register Control */
|
||||
#define SCR_GPA_IARLCR 0x90 /* w GPa Internal Active Register Level Control */
|
||||
#define SCR_GPA_BCR 0x94 /* w GPa Buffer Control */
|
||||
#define SCR_CCR 0x98 /* w Clock Control */
|
||||
#define SCR_PLL2CR 0x9a /* w PLL2 Control */
|
||||
#define SCR_PLL1CR 0x9c /* l PLL1 Control */
|
||||
#define SCR_DIARCR 0xa0 /* b Device Internal Active Register Control */
|
||||
#define SCR_DBOCR 0xa1 /* b Device Buffer Off Control */
|
||||
#define SCR_FER 0xe0 /* b Function Enable */
|
||||
#define SCR_MCR 0xe4 /* w Mode Control */
|
||||
#define SCR_CONFIG 0xfc /* b Configuration Control */
|
||||
#define SCR_DEBUG 0xff /* b Debug */
|
||||
|
||||
#define SCR_CCR_CK32K BIT(0)
|
||||
#define SCR_CCR_USBCK BIT(1)
|
||||
#define SCR_CCR_UNK1 BIT(4)
|
||||
#define SCR_CCR_MCLK_MASK (7 << 8)
|
||||
#define SCR_CCR_MCLK_OFF (0 << 8)
|
||||
#define SCR_CCR_MCLK_12 (1 << 8)
|
||||
#define SCR_CCR_MCLK_24 (2 << 8)
|
||||
#define SCR_CCR_MCLK_48 (3 << 8)
|
||||
#define SCR_CCR_HCLK_MASK (3 << 12)
|
||||
#define SCR_CCR_HCLK_24 (0 << 12)
|
||||
#define SCR_CCR_HCLK_48 (1 << 12)
|
||||
|
||||
#define SCR_FER_USBEN BIT(0) /* USB host enable */
|
||||
#define SCR_FER_LCDCVEN BIT(1) /* polysilicon TFT enable */
|
||||
#define SCR_FER_SLCDEN BIT(2) /* SLCD enable */
|
||||
|
||||
#define SCR_MCR_RDY_MASK (3 << 0)
|
||||
#define SCR_MCR_RDY_OPENDRAIN (0 << 0)
|
||||
#define SCR_MCR_RDY_TRISTATE (1 << 0)
|
||||
#define SCR_MCR_RDY_PUSHPULL (2 << 0)
|
||||
#define SCR_MCR_RDY_UNK BIT(2)
|
||||
#define SCR_MCR_RDY_EN BIT(3)
|
||||
#define SCR_MCR_INT_MASK (3 << 4)
|
||||
#define SCR_MCR_INT_OPENDRAIN (0 << 4)
|
||||
#define SCR_MCR_INT_TRISTATE (1 << 4)
|
||||
#define SCR_MCR_INT_PUSHPULL (2 << 4)
|
||||
#define SCR_MCR_INT_UNK BIT(6)
|
||||
#define SCR_MCR_INT_EN BIT(7)
|
||||
/* bits 8 - 16 are unknown */
|
||||
|
||||
#define TC_GPIO_BIT(i) (1 << (i & 0x7))
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
struct tc6393xb {
|
||||
void __iomem *scr;
|
||||
|
||||
struct gpio_chip gpio;
|
||||
|
||||
struct clk *clk; /* 3,6 Mhz */
|
||||
|
||||
spinlock_t lock; /* protects RMW cycles */
|
||||
|
||||
struct {
|
||||
u8 fer;
|
||||
u16 ccr;
|
||||
u8 gpi_bcr[3];
|
||||
u8 gpo_dsr[3];
|
||||
u8 gpo_doecr[3];
|
||||
} suspend_state;
|
||||
|
||||
struct resource rscr;
|
||||
struct resource *iomem;
|
||||
int irq;
|
||||
int irq_base;
|
||||
};
|
||||
|
||||
enum {
|
||||
TC6393XB_CELL_NAND,
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
static int tc6393xb_nand_enable(struct platform_device *nand)
|
||||
{
|
||||
struct platform_device *dev = to_platform_device(nand->dev.parent);
|
||||
struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&tc6393xb->lock, flags);
|
||||
|
||||
/* SMD buffer on */
|
||||
dev_dbg(&dev->dev, "SMD buffer on\n");
|
||||
iowrite8(0xff, tc6393xb->scr + SCR_GPI_BCR(1));
|
||||
|
||||
spin_unlock_irqrestore(&tc6393xb->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct resource __devinitdata tc6393xb_nand_resources[] = {
|
||||
{
|
||||
.name = TMIO_NAND_CONFIG,
|
||||
.start = 0x0100,
|
||||
.end = 0x01ff,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
{
|
||||
.name = TMIO_NAND_CONTROL,
|
||||
.start = 0x1000,
|
||||
.end = 0x1007,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
{
|
||||
.name = TMIO_NAND_IRQ,
|
||||
.start = IRQ_TC6393_NAND,
|
||||
.end = IRQ_TC6393_NAND,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
static struct mfd_cell __devinitdata tc6393xb_cells[] = {
|
||||
[TC6393XB_CELL_NAND] = {
|
||||
.name = "tmio-nand",
|
||||
.enable = tc6393xb_nand_enable,
|
||||
.num_resources = ARRAY_SIZE(tc6393xb_nand_resources),
|
||||
.resources = tc6393xb_nand_resources,
|
||||
},
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
static int tc6393xb_gpio_get(struct gpio_chip *chip,
|
||||
unsigned offset)
|
||||
{
|
||||
struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio);
|
||||
|
||||
/* XXX: does dsr also represent inputs? */
|
||||
return ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8))
|
||||
& TC_GPIO_BIT(offset);
|
||||
}
|
||||
|
||||
static void __tc6393xb_gpio_set(struct gpio_chip *chip,
|
||||
unsigned offset, int value)
|
||||
{
|
||||
struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio);
|
||||
u8 dsr;
|
||||
|
||||
dsr = ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8));
|
||||
if (value)
|
||||
dsr |= TC_GPIO_BIT(offset);
|
||||
else
|
||||
dsr &= ~TC_GPIO_BIT(offset);
|
||||
|
||||
iowrite8(dsr, tc6393xb->scr + SCR_GPO_DSR(offset / 8));
|
||||
}
|
||||
|
||||
static void tc6393xb_gpio_set(struct gpio_chip *chip,
|
||||
unsigned offset, int value)
|
||||
{
|
||||
struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio);
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&tc6393xb->lock, flags);
|
||||
|
||||
__tc6393xb_gpio_set(chip, offset, value);
|
||||
|
||||
spin_unlock_irqrestore(&tc6393xb->lock, flags);
|
||||
}
|
||||
|
||||
static int tc6393xb_gpio_direction_input(struct gpio_chip *chip,
|
||||
unsigned offset)
|
||||
{
|
||||
struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio);
|
||||
unsigned long flags;
|
||||
u8 doecr;
|
||||
|
||||
spin_lock_irqsave(&tc6393xb->lock, flags);
|
||||
|
||||
doecr = ioread8(tc6393xb->scr + SCR_GPO_DOECR(offset / 8));
|
||||
doecr &= ~TC_GPIO_BIT(offset);
|
||||
iowrite8(doecr, tc6393xb->scr + SCR_GPO_DOECR(offset / 8));
|
||||
|
||||
spin_unlock_irqrestore(&tc6393xb->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tc6393xb_gpio_direction_output(struct gpio_chip *chip,
|
||||
unsigned offset, int value)
|
||||
{
|
||||
struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio);
|
||||
unsigned long flags;
|
||||
u8 doecr;
|
||||
|
||||
spin_lock_irqsave(&tc6393xb->lock, flags);
|
||||
|
||||
__tc6393xb_gpio_set(chip, offset, value);
|
||||
|
||||
doecr = ioread8(tc6393xb->scr + SCR_GPO_DOECR(offset / 8));
|
||||
doecr |= TC_GPIO_BIT(offset);
|
||||
iowrite8(doecr, tc6393xb->scr + SCR_GPO_DOECR(offset / 8));
|
||||
|
||||
spin_unlock_irqrestore(&tc6393xb->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tc6393xb_register_gpio(struct tc6393xb *tc6393xb, int gpio_base)
|
||||
{
|
||||
tc6393xb->gpio.label = "tc6393xb";
|
||||
tc6393xb->gpio.base = gpio_base;
|
||||
tc6393xb->gpio.ngpio = 16;
|
||||
tc6393xb->gpio.set = tc6393xb_gpio_set;
|
||||
tc6393xb->gpio.get = tc6393xb_gpio_get;
|
||||
tc6393xb->gpio.direction_input = tc6393xb_gpio_direction_input;
|
||||
tc6393xb->gpio.direction_output = tc6393xb_gpio_direction_output;
|
||||
|
||||
return gpiochip_add(&tc6393xb->gpio);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
tc6393xb_irq(unsigned int irq, struct irq_desc *desc)
|
||||
{
|
||||
struct tc6393xb *tc6393xb = get_irq_data(irq);
|
||||
unsigned int isr;
|
||||
unsigned int i, irq_base;
|
||||
|
||||
irq_base = tc6393xb->irq_base;
|
||||
|
||||
while ((isr = ioread8(tc6393xb->scr + SCR_ISR) &
|
||||
~ioread8(tc6393xb->scr + SCR_IMR)))
|
||||
for (i = 0; i < TC6393XB_NR_IRQS; i++) {
|
||||
if (isr & (1 << i))
|
||||
generic_handle_irq(irq_base + i);
|
||||
}
|
||||
}
|
||||
|
||||
static void tc6393xb_irq_ack(unsigned int irq)
|
||||
{
|
||||
}
|
||||
|
||||
static void tc6393xb_irq_mask(unsigned int irq)
|
||||
{
|
||||
struct tc6393xb *tc6393xb = get_irq_chip_data(irq);
|
||||
unsigned long flags;
|
||||
u8 imr;
|
||||
|
||||
spin_lock_irqsave(&tc6393xb->lock, flags);
|
||||
imr = ioread8(tc6393xb->scr + SCR_IMR);
|
||||
imr |= 1 << (irq - tc6393xb->irq_base);
|
||||
iowrite8(imr, tc6393xb->scr + SCR_IMR);
|
||||
spin_unlock_irqrestore(&tc6393xb->lock, flags);
|
||||
}
|
||||
|
||||
static void tc6393xb_irq_unmask(unsigned int irq)
|
||||
{
|
||||
struct tc6393xb *tc6393xb = get_irq_chip_data(irq);
|
||||
unsigned long flags;
|
||||
u8 imr;
|
||||
|
||||
spin_lock_irqsave(&tc6393xb->lock, flags);
|
||||
imr = ioread8(tc6393xb->scr + SCR_IMR);
|
||||
imr &= ~(1 << (irq - tc6393xb->irq_base));
|
||||
iowrite8(imr, tc6393xb->scr + SCR_IMR);
|
||||
spin_unlock_irqrestore(&tc6393xb->lock, flags);
|
||||
}
|
||||
|
||||
static struct irq_chip tc6393xb_chip = {
|
||||
.name = "tc6393xb",
|
||||
.ack = tc6393xb_irq_ack,
|
||||
.mask = tc6393xb_irq_mask,
|
||||
.unmask = tc6393xb_irq_unmask,
|
||||
};
|
||||
|
||||
static void tc6393xb_attach_irq(struct platform_device *dev)
|
||||
{
|
||||
struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
|
||||
unsigned int irq, irq_base;
|
||||
|
||||
irq_base = tc6393xb->irq_base;
|
||||
|
||||
for (irq = irq_base; irq < irq_base + TC6393XB_NR_IRQS; irq++) {
|
||||
set_irq_chip(irq, &tc6393xb_chip);
|
||||
set_irq_chip_data(irq, tc6393xb);
|
||||
set_irq_handler(irq, handle_edge_irq);
|
||||
set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
|
||||
}
|
||||
|
||||
set_irq_type(tc6393xb->irq, IRQT_FALLING);
|
||||
set_irq_data(tc6393xb->irq, tc6393xb);
|
||||
set_irq_chained_handler(tc6393xb->irq, tc6393xb_irq);
|
||||
}
|
||||
|
||||
static void tc6393xb_detach_irq(struct platform_device *dev)
|
||||
{
|
||||
struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
|
||||
unsigned int irq, irq_base;
|
||||
|
||||
set_irq_chained_handler(tc6393xb->irq, NULL);
|
||||
set_irq_data(tc6393xb->irq, NULL);
|
||||
|
||||
irq_base = tc6393xb->irq_base;
|
||||
|
||||
for (irq = irq_base; irq < irq_base + TC6393XB_NR_IRQS; irq++) {
|
||||
set_irq_flags(irq, 0);
|
||||
set_irq_chip(irq, NULL);
|
||||
set_irq_chip_data(irq, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
static int tc6393xb_hw_init(struct platform_device *dev)
|
||||
{
|
||||
struct tc6393xb_platform_data *tcpd = dev->dev.platform_data;
|
||||
struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
|
||||
int i;
|
||||
|
||||
iowrite8(tc6393xb->suspend_state.fer, tc6393xb->scr + SCR_FER);
|
||||
iowrite16(tcpd->scr_pll2cr, tc6393xb->scr + SCR_PLL2CR);
|
||||
iowrite16(tc6393xb->suspend_state.ccr, tc6393xb->scr + SCR_CCR);
|
||||
iowrite16(SCR_MCR_RDY_OPENDRAIN | SCR_MCR_RDY_UNK | SCR_MCR_RDY_EN |
|
||||
SCR_MCR_INT_OPENDRAIN | SCR_MCR_INT_UNK | SCR_MCR_INT_EN |
|
||||
BIT(15), tc6393xb->scr + SCR_MCR);
|
||||
iowrite16(tcpd->scr_gper, tc6393xb->scr + SCR_GPER);
|
||||
iowrite8(0, tc6393xb->scr + SCR_IRR);
|
||||
iowrite8(0xbf, tc6393xb->scr + SCR_IMR);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
iowrite8(tc6393xb->suspend_state.gpo_dsr[i],
|
||||
tc6393xb->scr + SCR_GPO_DSR(i));
|
||||
iowrite8(tc6393xb->suspend_state.gpo_doecr[i],
|
||||
tc6393xb->scr + SCR_GPO_DOECR(i));
|
||||
iowrite8(tc6393xb->suspend_state.gpi_bcr[i],
|
||||
tc6393xb->scr + SCR_GPI_BCR(i));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __devinit tc6393xb_probe(struct platform_device *dev)
|
||||
{
|
||||
struct tc6393xb_platform_data *tcpd = dev->dev.platform_data;
|
||||
struct tc6393xb *tc6393xb;
|
||||
struct resource *iomem;
|
||||
struct resource *rscr;
|
||||
int retval, temp;
|
||||
int i;
|
||||
|
||||
iomem = platform_get_resource(dev, IORESOURCE_MEM, 0);
|
||||
if (!iomem)
|
||||
return -EINVAL;
|
||||
|
||||
tc6393xb = kzalloc(sizeof *tc6393xb, GFP_KERNEL);
|
||||
if (!tc6393xb) {
|
||||
retval = -ENOMEM;
|
||||
goto err_kzalloc;
|
||||
}
|
||||
|
||||
spin_lock_init(&tc6393xb->lock);
|
||||
|
||||
platform_set_drvdata(dev, tc6393xb);
|
||||
tc6393xb->iomem = iomem;
|
||||
tc6393xb->irq = platform_get_irq(dev, 0);
|
||||
tc6393xb->irq_base = tcpd->irq_base;
|
||||
|
||||
tc6393xb->clk = clk_get(&dev->dev, "GPIO27_CLK" /* "CK3P6MI" */);
|
||||
if (IS_ERR(tc6393xb->clk)) {
|
||||
retval = PTR_ERR(tc6393xb->clk);
|
||||
goto err_clk_get;
|
||||
}
|
||||
|
||||
rscr = &tc6393xb->rscr;
|
||||
rscr->name = "tc6393xb-core";
|
||||
rscr->start = iomem->start;
|
||||
rscr->end = iomem->start + 0xff;
|
||||
rscr->flags = IORESOURCE_MEM;
|
||||
|
||||
retval = request_resource(iomem, rscr);
|
||||
if (retval)
|
||||
goto err_request_scr;
|
||||
|
||||
tc6393xb->scr = ioremap(rscr->start, rscr->end - rscr->start + 1);
|
||||
if (!tc6393xb->scr) {
|
||||
retval = -ENOMEM;
|
||||
goto err_ioremap;
|
||||
}
|
||||
|
||||
retval = clk_enable(tc6393xb->clk);
|
||||
if (retval)
|
||||
goto err_clk_enable;
|
||||
|
||||
retval = tcpd->enable(dev);
|
||||
if (retval)
|
||||
goto err_enable;
|
||||
|
||||
tc6393xb->suspend_state.fer = 0;
|
||||
for (i = 0; i < 3; i++) {
|
||||
tc6393xb->suspend_state.gpo_dsr[i] =
|
||||
(tcpd->scr_gpo_dsr >> (8 * i)) & 0xff;
|
||||
tc6393xb->suspend_state.gpo_doecr[i] =
|
||||
(tcpd->scr_gpo_doecr >> (8 * i)) & 0xff;
|
||||
}
|
||||
/*
|
||||
* It may be necessary to change this back to
|
||||
* platform-dependant code
|
||||
*/
|
||||
tc6393xb->suspend_state.ccr = SCR_CCR_UNK1 |
|
||||
SCR_CCR_HCLK_48;
|
||||
|
||||
retval = tc6393xb_hw_init(dev);
|
||||
if (retval)
|
||||
goto err_hw_init;
|
||||
|
||||
printk(KERN_INFO "Toshiba tc6393xb revision %d at 0x%08lx, irq %d\n",
|
||||
ioread8(tc6393xb->scr + SCR_REVID),
|
||||
(unsigned long) iomem->start, tc6393xb->irq);
|
||||
|
||||
tc6393xb->gpio.base = -1;
|
||||
|
||||
if (tcpd->gpio_base >= 0) {
|
||||
retval = tc6393xb_register_gpio(tc6393xb, tcpd->gpio_base);
|
||||
if (retval)
|
||||
goto err_gpio_add;
|
||||
}
|
||||
|
||||
if (tc6393xb->irq)
|
||||
tc6393xb_attach_irq(dev);
|
||||
|
||||
tc6393xb_cells[TC6393XB_CELL_NAND].driver_data = tcpd->nand_data;
|
||||
|
||||
retval = mfd_add_devices(dev,
|
||||
tc6393xb_cells, ARRAY_SIZE(tc6393xb_cells),
|
||||
iomem, tcpd->irq_base);
|
||||
|
||||
return 0;
|
||||
|
||||
if (tc6393xb->irq)
|
||||
tc6393xb_detach_irq(dev);
|
||||
|
||||
err_gpio_add:
|
||||
if (tc6393xb->gpio.base != -1)
|
||||
temp = gpiochip_remove(&tc6393xb->gpio);
|
||||
err_hw_init:
|
||||
tcpd->disable(dev);
|
||||
err_clk_enable:
|
||||
clk_disable(tc6393xb->clk);
|
||||
err_enable:
|
||||
iounmap(tc6393xb->scr);
|
||||
err_ioremap:
|
||||
release_resource(&tc6393xb->rscr);
|
||||
err_request_scr:
|
||||
clk_put(tc6393xb->clk);
|
||||
err_clk_get:
|
||||
kfree(tc6393xb);
|
||||
err_kzalloc:
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int __devexit tc6393xb_remove(struct platform_device *dev)
|
||||
{
|
||||
struct tc6393xb_platform_data *tcpd = dev->dev.platform_data;
|
||||
struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
|
||||
int ret;
|
||||
|
||||
mfd_remove_devices(dev);
|
||||
|
||||
if (tc6393xb->irq)
|
||||
tc6393xb_detach_irq(dev);
|
||||
|
||||
if (tc6393xb->gpio.base != -1) {
|
||||
ret = gpiochip_remove(&tc6393xb->gpio);
|
||||
if (ret) {
|
||||
dev_err(&dev->dev, "Can't remove gpio chip: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
ret = tcpd->disable(dev);
|
||||
|
||||
clk_disable(tc6393xb->clk);
|
||||
|
||||
iounmap(tc6393xb->scr);
|
||||
|
||||
release_resource(&tc6393xb->rscr);
|
||||
|
||||
platform_set_drvdata(dev, NULL);
|
||||
|
||||
clk_put(tc6393xb->clk);
|
||||
|
||||
kfree(tc6393xb);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int tc6393xb_suspend(struct platform_device *dev, pm_message_t state)
|
||||
{
|
||||
struct tc6393xb_platform_data *tcpd = dev->dev.platform_data;
|
||||
struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
|
||||
int i;
|
||||
|
||||
|
||||
tc6393xb->suspend_state.ccr = ioread16(tc6393xb->scr + SCR_CCR);
|
||||
tc6393xb->suspend_state.fer = ioread8(tc6393xb->scr + SCR_FER);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
tc6393xb->suspend_state.gpo_dsr[i] =
|
||||
ioread8(tc6393xb->scr + SCR_GPO_DSR(i));
|
||||
tc6393xb->suspend_state.gpo_doecr[i] =
|
||||
ioread8(tc6393xb->scr + SCR_GPO_DOECR(i));
|
||||
tc6393xb->suspend_state.gpi_bcr[i] =
|
||||
ioread8(tc6393xb->scr + SCR_GPI_BCR(i));
|
||||
}
|
||||
|
||||
return tcpd->suspend(dev);
|
||||
}
|
||||
|
||||
static int tc6393xb_resume(struct platform_device *dev)
|
||||
{
|
||||
struct tc6393xb_platform_data *tcpd = dev->dev.platform_data;
|
||||
int ret = tcpd->resume(dev);
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return tc6393xb_hw_init(dev);
|
||||
}
|
||||
#else
|
||||
#define tc6393xb_suspend NULL
|
||||
#define tc6393xb_resume NULL
|
||||
#endif
|
||||
|
||||
static struct platform_driver tc6393xb_driver = {
|
||||
.probe = tc6393xb_probe,
|
||||
.remove = __devexit_p(tc6393xb_remove),
|
||||
.suspend = tc6393xb_suspend,
|
||||
.resume = tc6393xb_resume,
|
||||
|
||||
.driver = {
|
||||
.name = "tc6393xb",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init tc6393xb_init(void)
|
||||
{
|
||||
return platform_driver_register(&tc6393xb_driver);
|
||||
}
|
||||
|
||||
static void __exit tc6393xb_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&tc6393xb_driver);
|
||||
}
|
||||
|
||||
subsys_initcall(tc6393xb_init);
|
||||
module_exit(tc6393xb_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Ian Molton, Dmitry Baryshkov and Dirk Opfer");
|
||||
MODULE_DESCRIPTION("tc6393xb Toshiba Mobile IO Controller");
|
||||
MODULE_ALIAS("platform:tc6393xb");
|
|
@ -20,9 +20,11 @@
|
|||
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/irq.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include <asm/arch/hardware.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
|
@ -30,20 +32,6 @@
|
|||
#define GPIO_NAND_CS (11)
|
||||
#define GPIO_NAND_RB (89)
|
||||
|
||||
/* This macro needed to ensure in-order operation of GPIO and local
|
||||
* bus. Without both asm command and dummy uncached read there're
|
||||
* states when NAND access is broken. I've looked for such macro(s) in
|
||||
* include/asm-arm but found nothing approptiate.
|
||||
* dmac_clean_range is close, but is makes cache invalidation
|
||||
* unnecessary here and it cannot be used in module
|
||||
*/
|
||||
#define DRAIN_WB() \
|
||||
do { \
|
||||
unsigned char dummy; \
|
||||
asm volatile ("mcr p15, 0, r0, c7, c10, 4":::"r0"); \
|
||||
dummy=*((unsigned char*)UNCACHED_ADDR); \
|
||||
} while(0)
|
||||
|
||||
/* MTD structure for CM-X270 board */
|
||||
static struct mtd_info *cmx270_nand_mtd;
|
||||
|
||||
|
@ -103,14 +91,14 @@ static int cmx270_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
|
|||
|
||||
static inline void nand_cs_on(void)
|
||||
{
|
||||
GPCR(GPIO_NAND_CS) = GPIO_bit(GPIO_NAND_CS);
|
||||
gpio_set_value(GPIO_NAND_CS, 0);
|
||||
}
|
||||
|
||||
static void nand_cs_off(void)
|
||||
{
|
||||
DRAIN_WB();
|
||||
dsb();
|
||||
|
||||
GPSR(GPIO_NAND_CS) = GPIO_bit(GPIO_NAND_CS);
|
||||
gpio_set_value(GPIO_NAND_CS, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -122,7 +110,7 @@ static void cmx270_hwcontrol(struct mtd_info *mtd, int dat,
|
|||
struct nand_chip* this = mtd->priv;
|
||||
unsigned int nandaddr = (unsigned int)this->IO_ADDR_W;
|
||||
|
||||
DRAIN_WB();
|
||||
dsb();
|
||||
|
||||
if (ctrl & NAND_CTRL_CHANGE) {
|
||||
if ( ctrl & NAND_ALE )
|
||||
|
@ -139,12 +127,12 @@ static void cmx270_hwcontrol(struct mtd_info *mtd, int dat,
|
|||
nand_cs_off();
|
||||
}
|
||||
|
||||
DRAIN_WB();
|
||||
dsb();
|
||||
this->IO_ADDR_W = (void __iomem*)nandaddr;
|
||||
if (dat != NAND_CMD_NONE)
|
||||
writel((dat << 16), this->IO_ADDR_W);
|
||||
|
||||
DRAIN_WB();
|
||||
dsb();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -152,9 +140,9 @@ static void cmx270_hwcontrol(struct mtd_info *mtd, int dat,
|
|||
*/
|
||||
static int cmx270_device_ready(struct mtd_info *mtd)
|
||||
{
|
||||
DRAIN_WB();
|
||||
dsb();
|
||||
|
||||
return (GPLR(GPIO_NAND_RB) & GPIO_bit(GPIO_NAND_RB));
|
||||
return (gpio_get_value(GPIO_NAND_RB));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -168,20 +156,40 @@ static int cmx270_init(void)
|
|||
int mtd_parts_nb = 0;
|
||||
int ret;
|
||||
|
||||
if (!machine_is_armcore())
|
||||
return -ENODEV;
|
||||
|
||||
ret = gpio_request(GPIO_NAND_CS, "NAND CS");
|
||||
if (ret) {
|
||||
pr_warning("CM-X270: failed to request NAND CS gpio\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
gpio_direction_output(GPIO_NAND_CS, 1);
|
||||
|
||||
ret = gpio_request(GPIO_NAND_RB, "NAND R/B");
|
||||
if (ret) {
|
||||
pr_warning("CM-X270: failed to request NAND R/B gpio\n");
|
||||
goto err_gpio_request;
|
||||
}
|
||||
|
||||
gpio_direction_input(GPIO_NAND_RB);
|
||||
|
||||
/* Allocate memory for MTD device structure and private data */
|
||||
cmx270_nand_mtd = kzalloc(sizeof(struct mtd_info) +
|
||||
sizeof(struct nand_chip),
|
||||
GFP_KERNEL);
|
||||
if (!cmx270_nand_mtd) {
|
||||
printk("Unable to allocate CM-X270 NAND MTD device structure.\n");
|
||||
return -ENOMEM;
|
||||
pr_debug("Unable to allocate CM-X270 NAND MTD device structure.\n");
|
||||
ret = -ENOMEM;
|
||||
goto err_kzalloc;
|
||||
}
|
||||
|
||||
cmx270_nand_io = ioremap(PXA_CS1_PHYS, 12);
|
||||
if (!cmx270_nand_io) {
|
||||
printk("Unable to ioremap NAND device\n");
|
||||
pr_debug("Unable to ioremap NAND device\n");
|
||||
ret = -EINVAL;
|
||||
goto err1;
|
||||
goto err_ioremap;
|
||||
}
|
||||
|
||||
/* Get pointer to private data */
|
||||
|
@ -209,9 +217,9 @@ static int cmx270_init(void)
|
|||
|
||||
/* Scan to find existence of the device */
|
||||
if (nand_scan (cmx270_nand_mtd, 1)) {
|
||||
printk(KERN_NOTICE "No NAND device\n");
|
||||
pr_notice("No NAND device\n");
|
||||
ret = -ENXIO;
|
||||
goto err2;
|
||||
goto err_scan;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MTD_CMDLINE_PARTS
|
||||
|
@ -229,18 +237,22 @@ static int cmx270_init(void)
|
|||
}
|
||||
|
||||
/* Register the partitions */
|
||||
printk(KERN_NOTICE "Using %s partition definition\n", part_type);
|
||||
pr_notice("Using %s partition definition\n", part_type);
|
||||
ret = add_mtd_partitions(cmx270_nand_mtd, mtd_parts, mtd_parts_nb);
|
||||
if (ret)
|
||||
goto err2;
|
||||
goto err_scan;
|
||||
|
||||
/* Return happy */
|
||||
return 0;
|
||||
|
||||
err2:
|
||||
err_scan:
|
||||
iounmap(cmx270_nand_io);
|
||||
err1:
|
||||
err_ioremap:
|
||||
kfree(cmx270_nand_mtd);
|
||||
err_kzalloc:
|
||||
gpio_free(GPIO_NAND_RB);
|
||||
err_gpio_request:
|
||||
gpio_free(GPIO_NAND_CS);
|
||||
|
||||
return ret;
|
||||
|
||||
|
@ -255,6 +267,9 @@ static void cmx270_cleanup(void)
|
|||
/* Release resources, unregister device */
|
||||
nand_release(cmx270_nand_mtd);
|
||||
|
||||
gpio_free(GPIO_NAND_RB);
|
||||
gpio_free(GPIO_NAND_CS);
|
||||
|
||||
iounmap(cmx270_nand_io);
|
||||
|
||||
/* Free the MTD device structure */
|
||||
|
|
|
@ -13,16 +13,8 @@
|
|||
*
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/clk.h>
|
||||
|
||||
#include <net/irda/irda.h>
|
||||
|
@ -30,17 +22,9 @@
|
|||
#include <net/irda/wrapper.h>
|
||||
#include <net/irda/irda_device.h>
|
||||
|
||||
#include <asm/irq.h>
|
||||
#include <asm/dma.h>
|
||||
#include <asm/delay.h>
|
||||
#include <asm/hardware.h>
|
||||
#include <asm/arch/irda.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-gpio.h>
|
||||
|
||||
#ifdef CONFIG_MACH_MAINSTONE
|
||||
#include <asm/arch/mainstone.h>
|
||||
#endif
|
||||
|
||||
#define IrSR_RXPL_NEG_IS_ZERO (1<<4)
|
||||
#define IrSR_RXPL_POS_IS_ZERO 0x0
|
||||
|
@ -163,10 +147,6 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed)
|
|||
/* set board transceiver to SIR mode */
|
||||
si->pdata->transceiver_mode(si->dev, IR_SIRMODE);
|
||||
|
||||
/* configure GPIO46/47 */
|
||||
pxa_gpio_mode(GPIO46_STRXD_MD);
|
||||
pxa_gpio_mode(GPIO47_STTXD_MD);
|
||||
|
||||
/* enable the STUART clock */
|
||||
pxa_irda_enable_sirclk(si);
|
||||
}
|
||||
|
@ -201,10 +181,6 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed)
|
|||
/* set board transceiver to FIR mode */
|
||||
si->pdata->transceiver_mode(si->dev, IR_FIRMODE);
|
||||
|
||||
/* configure GPIO46/47 */
|
||||
pxa_gpio_mode(GPIO46_ICPRXD_MD);
|
||||
pxa_gpio_mode(GPIO47_ICPTXD_MD);
|
||||
|
||||
/* enable the FICP clock */
|
||||
pxa_irda_enable_firclk(si);
|
||||
|
||||
|
|
|
@ -308,7 +308,7 @@ static void smc_reset(struct net_device *dev)
|
|||
* can't handle it then there will be no recovery except for
|
||||
* a hard reset or power cycle
|
||||
*/
|
||||
if (nowait)
|
||||
if (lp->cfg.flags & SMC91X_NOWAIT)
|
||||
cfg |= CONFIG_NO_WAIT;
|
||||
|
||||
/*
|
||||
|
@ -1939,8 +1939,11 @@ static int __init smc_probe(struct net_device *dev, void __iomem *ioaddr,
|
|||
if (retval)
|
||||
goto err_out;
|
||||
|
||||
#ifdef SMC_USE_PXA_DMA
|
||||
{
|
||||
#ifdef CONFIG_ARCH_PXA
|
||||
# ifdef SMC_USE_PXA_DMA
|
||||
lp->cfg.flags |= SMC91X_USE_DMA;
|
||||
# endif
|
||||
if (lp->cfg.flags & SMC91X_USE_DMA) {
|
||||
int dma = pxa_request_dma(dev->name, DMA_PRIO_LOW,
|
||||
smc_pxa_dma_irq, NULL);
|
||||
if (dma >= 0)
|
||||
|
@ -1980,7 +1983,7 @@ static int __init smc_probe(struct net_device *dev, void __iomem *ioaddr,
|
|||
}
|
||||
|
||||
err_out:
|
||||
#ifdef SMC_USE_PXA_DMA
|
||||
#ifdef CONFIG_ARCH_PXA
|
||||
if (retval && dev->dma != (unsigned char)-1)
|
||||
pxa_free_dma(dev->dma);
|
||||
#endif
|
||||
|
@ -2050,9 +2053,11 @@ static int smc_enable_device(struct platform_device *pdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int smc_request_attrib(struct platform_device *pdev)
|
||||
static int smc_request_attrib(struct platform_device *pdev,
|
||||
struct net_device *ndev)
|
||||
{
|
||||
struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib");
|
||||
struct smc_local *lp = netdev_priv(ndev);
|
||||
|
||||
if (!res)
|
||||
return 0;
|
||||
|
@ -2063,9 +2068,11 @@ static int smc_request_attrib(struct platform_device *pdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void smc_release_attrib(struct platform_device *pdev)
|
||||
static void smc_release_attrib(struct platform_device *pdev,
|
||||
struct net_device *ndev)
|
||||
{
|
||||
struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib");
|
||||
struct smc_local *lp = netdev_priv(ndev);
|
||||
|
||||
if (res)
|
||||
release_mem_region(res->start, ATTRIB_SIZE);
|
||||
|
@ -2123,27 +2130,14 @@ static int smc_drv_probe(struct platform_device *pdev)
|
|||
struct net_device *ndev;
|
||||
struct resource *res, *ires;
|
||||
unsigned int __iomem *addr;
|
||||
unsigned long irq_flags = SMC_IRQ_FLAGS;
|
||||
int ret;
|
||||
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-regs");
|
||||
if (!res)
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res) {
|
||||
ret = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
if (!request_mem_region(res->start, SMC_IO_EXTENT, CARDNAME)) {
|
||||
ret = -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ndev = alloc_etherdev(sizeof(struct smc_local));
|
||||
if (!ndev) {
|
||||
printk("%s: could not allocate device.\n", CARDNAME);
|
||||
ret = -ENOMEM;
|
||||
goto out_release_io;
|
||||
goto out;
|
||||
}
|
||||
SET_NETDEV_DEV(ndev, &pdev->dev);
|
||||
|
||||
|
@ -2152,37 +2146,47 @@ static int smc_drv_probe(struct platform_device *pdev)
|
|||
*/
|
||||
|
||||
lp = netdev_priv(ndev);
|
||||
lp->cfg.irq_flags = SMC_IRQ_FLAGS;
|
||||
|
||||
#ifdef SMC_DYNAMIC_BUS_CONFIG
|
||||
if (pd)
|
||||
if (pd) {
|
||||
memcpy(&lp->cfg, pd, sizeof(lp->cfg));
|
||||
else {
|
||||
lp->cfg.flags = SMC91X_USE_8BIT;
|
||||
lp->cfg.flags |= SMC91X_USE_16BIT;
|
||||
lp->cfg.flags |= SMC91X_USE_32BIT;
|
||||
lp->io_shift = SMC91X_IO_SHIFT(lp->cfg.flags);
|
||||
} else {
|
||||
lp->cfg.flags |= (SMC_CAN_USE_8BIT) ? SMC91X_USE_8BIT : 0;
|
||||
lp->cfg.flags |= (SMC_CAN_USE_16BIT) ? SMC91X_USE_16BIT : 0;
|
||||
lp->cfg.flags |= (SMC_CAN_USE_32BIT) ? SMC91X_USE_32BIT : 0;
|
||||
lp->cfg.flags |= (nowait) ? SMC91X_NOWAIT : 0;
|
||||
}
|
||||
|
||||
lp->cfg.flags &= ~(SMC_CAN_USE_8BIT ? 0 : SMC91X_USE_8BIT);
|
||||
lp->cfg.flags &= ~(SMC_CAN_USE_16BIT ? 0 : SMC91X_USE_16BIT);
|
||||
lp->cfg.flags &= ~(SMC_CAN_USE_32BIT ? 0 : SMC91X_USE_32BIT);
|
||||
#endif
|
||||
|
||||
ndev->dma = (unsigned char)-1;
|
||||
|
||||
ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
|
||||
if (!ires) {
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-regs");
|
||||
if (!res)
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res) {
|
||||
ret = -ENODEV;
|
||||
goto out_free_netdev;
|
||||
}
|
||||
|
||||
ndev->irq = ires->start;
|
||||
if (SMC_IRQ_FLAGS == -1)
|
||||
lp->cfg.irq_flags = ires->flags & IRQF_TRIGGER_MASK;
|
||||
|
||||
ret = smc_request_attrib(pdev);
|
||||
if (ret)
|
||||
if (!request_mem_region(res->start, SMC_IO_EXTENT, CARDNAME)) {
|
||||
ret = -EBUSY;
|
||||
goto out_free_netdev;
|
||||
}
|
||||
|
||||
ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
|
||||
if (!ires) {
|
||||
ret = -ENODEV;
|
||||
goto out_release_io;
|
||||
}
|
||||
|
||||
ndev->irq = ires->start;
|
||||
|
||||
if (ires->flags & IRQF_TRIGGER_MASK)
|
||||
irq_flags = ires->flags & IRQF_TRIGGER_MASK;
|
||||
|
||||
ret = smc_request_attrib(pdev, ndev);
|
||||
if (ret)
|
||||
goto out_release_io;
|
||||
#if defined(CONFIG_SA1100_ASSABET)
|
||||
NCR_0 |= NCR_ENET_OSC_EN;
|
||||
#endif
|
||||
|
@ -2197,7 +2201,7 @@ static int smc_drv_probe(struct platform_device *pdev)
|
|||
goto out_release_attrib;
|
||||
}
|
||||
|
||||
#ifdef SMC_USE_PXA_DMA
|
||||
#ifdef CONFIG_ARCH_PXA
|
||||
{
|
||||
struct smc_local *lp = netdev_priv(ndev);
|
||||
lp->device = &pdev->dev;
|
||||
|
@ -2205,7 +2209,7 @@ static int smc_drv_probe(struct platform_device *pdev)
|
|||
}
|
||||
#endif
|
||||
|
||||
ret = smc_probe(ndev, addr, lp->cfg.irq_flags);
|
||||
ret = smc_probe(ndev, addr, irq_flags);
|
||||
if (ret != 0)
|
||||
goto out_iounmap;
|
||||
|
||||
|
@ -2217,11 +2221,11 @@ static int smc_drv_probe(struct platform_device *pdev)
|
|||
platform_set_drvdata(pdev, NULL);
|
||||
iounmap(addr);
|
||||
out_release_attrib:
|
||||
smc_release_attrib(pdev);
|
||||
out_free_netdev:
|
||||
free_netdev(ndev);
|
||||
smc_release_attrib(pdev, ndev);
|
||||
out_release_io:
|
||||
release_mem_region(res->start, SMC_IO_EXTENT);
|
||||
out_free_netdev:
|
||||
free_netdev(ndev);
|
||||
out:
|
||||
printk("%s: not found (%d).\n", CARDNAME, ret);
|
||||
|
||||
|
@ -2240,14 +2244,14 @@ static int smc_drv_remove(struct platform_device *pdev)
|
|||
|
||||
free_irq(ndev->irq, ndev);
|
||||
|
||||
#ifdef SMC_USE_PXA_DMA
|
||||
#ifdef CONFIG_ARCH_PXA
|
||||
if (ndev->dma != (unsigned char)-1)
|
||||
pxa_free_dma(ndev->dma);
|
||||
#endif
|
||||
iounmap(lp->base);
|
||||
|
||||
smc_release_datacs(pdev,ndev);
|
||||
smc_release_attrib(pdev);
|
||||
smc_release_attrib(pdev,ndev);
|
||||
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-regs");
|
||||
if (!res)
|
||||
|
|
|
@ -40,23 +40,46 @@
|
|||
* Define your architecture specific bus configuration parameters here.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_ARCH_LUBBOCK)
|
||||
#if defined(CONFIG_ARCH_LUBBOCK) ||\
|
||||
defined(CONFIG_MACH_MAINSTONE) ||\
|
||||
defined(CONFIG_MACH_ZYLONITE) ||\
|
||||
defined(CONFIG_MACH_LITTLETON)
|
||||
|
||||
/* We can only do 16-bit reads and writes in the static memory space. */
|
||||
#define SMC_CAN_USE_8BIT 0
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
/* Now the bus width is specified in the platform data
|
||||
* pretend here to support all I/O access types
|
||||
*/
|
||||
#define SMC_CAN_USE_8BIT 1
|
||||
#define SMC_CAN_USE_16BIT 1
|
||||
#define SMC_CAN_USE_32BIT 0
|
||||
#define SMC_CAN_USE_32BIT 1
|
||||
#define SMC_NOWAIT 1
|
||||
|
||||
/* The first two address lines aren't connected... */
|
||||
#define SMC_IO_SHIFT 2
|
||||
#define SMC_IO_SHIFT (lp->io_shift)
|
||||
|
||||
#define SMC_inb(a, r) readb((a) + (r))
|
||||
#define SMC_inw(a, r) readw((a) + (r))
|
||||
#define SMC_outw(v, a, r) writew(v, (a) + (r))
|
||||
#define SMC_inl(a, r) readl((a) + (r))
|
||||
#define SMC_outb(v, a, r) writeb(v, (a) + (r))
|
||||
#define SMC_outl(v, a, r) writel(v, (a) + (r))
|
||||
#define SMC_insw(a, r, p, l) readsw((a) + (r), p, l)
|
||||
#define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l)
|
||||
#define SMC_insl(a, r, p, l) readsl((a) + (r), p, l)
|
||||
#define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l)
|
||||
#define SMC_IRQ_FLAGS (-1) /* from resource */
|
||||
|
||||
/* We actually can't write halfwords properly if not word aligned */
|
||||
static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg)
|
||||
{
|
||||
if (machine_is_mainstone() && reg & 2) {
|
||||
unsigned int v = val << 16;
|
||||
v |= readl(ioaddr + (reg & ~2)) & 0xffff;
|
||||
writel(v, ioaddr + (reg & ~2));
|
||||
} else {
|
||||
writew(val, ioaddr + reg);
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(CONFIG_BLACKFIN)
|
||||
|
||||
#define SMC_IRQ_FLAGS IRQF_TRIGGER_HIGH
|
||||
|
@ -195,7 +218,6 @@
|
|||
#define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l)
|
||||
|
||||
#elif defined(CONFIG_ARCH_INNOKOM) || \
|
||||
defined(CONFIG_MACH_MAINSTONE) || \
|
||||
defined(CONFIG_ARCH_PXA_IDP) || \
|
||||
defined(CONFIG_ARCH_RAMSES) || \
|
||||
defined(CONFIG_ARCH_PCM027)
|
||||
|
@ -229,22 +251,6 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)
|
|||
}
|
||||
}
|
||||
|
||||
#elif defined(CONFIG_MACH_ZYLONITE)
|
||||
|
||||
#define SMC_CAN_USE_8BIT 1
|
||||
#define SMC_CAN_USE_16BIT 1
|
||||
#define SMC_CAN_USE_32BIT 0
|
||||
#define SMC_IO_SHIFT 0
|
||||
#define SMC_NOWAIT 1
|
||||
#define SMC_USE_PXA_DMA 1
|
||||
#define SMC_inb(a, r) readb((a) + (r))
|
||||
#define SMC_inw(a, r) readw((a) + (r))
|
||||
#define SMC_insw(a, r, p, l) insw((a) + (r), p, l)
|
||||
#define SMC_outsw(a, r, p, l) outsw((a) + (r), p, l)
|
||||
#define SMC_outb(v, a, r) writeb(v, (a) + (r))
|
||||
#define SMC_outw(v, a, r) writew(v, (a) + (r))
|
||||
#define SMC_IRQ_FLAGS (-1) /* from resource */
|
||||
|
||||
#elif defined(CONFIG_ARCH_OMAP)
|
||||
|
||||
/* We can only do 16-bit reads and writes in the static memory space. */
|
||||
|
@ -454,7 +460,6 @@ static inline void LPD7_SMC_outsw (unsigned char* a, int r,
|
|||
#define RPC_LSA_DEFAULT RPC_LED_100_10
|
||||
#define RPC_LSB_DEFAULT RPC_LED_TX_RX
|
||||
|
||||
#define SMC_DYNAMIC_BUS_CONFIG
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -493,7 +498,7 @@ struct smc_local {
|
|||
|
||||
spinlock_t lock;
|
||||
|
||||
#ifdef SMC_USE_PXA_DMA
|
||||
#ifdef CONFIG_ARCH_PXA
|
||||
/* DMA needs the physical address of the chip */
|
||||
u_long physaddr;
|
||||
struct device *device;
|
||||
|
@ -501,20 +506,17 @@ struct smc_local {
|
|||
void __iomem *base;
|
||||
void __iomem *datacs;
|
||||
|
||||
/* the low address lines on some platforms aren't connected... */
|
||||
int io_shift;
|
||||
|
||||
struct smc91x_platdata cfg;
|
||||
};
|
||||
|
||||
#ifdef SMC_DYNAMIC_BUS_CONFIG
|
||||
#define SMC_8BIT(p) (((p)->cfg.flags & SMC91X_USE_8BIT) && SMC_CAN_USE_8BIT)
|
||||
#define SMC_16BIT(p) (((p)->cfg.flags & SMC91X_USE_16BIT) && SMC_CAN_USE_16BIT)
|
||||
#define SMC_32BIT(p) (((p)->cfg.flags & SMC91X_USE_32BIT) && SMC_CAN_USE_32BIT)
|
||||
#else
|
||||
#define SMC_8BIT(p) SMC_CAN_USE_8BIT
|
||||
#define SMC_16BIT(p) SMC_CAN_USE_16BIT
|
||||
#define SMC_32BIT(p) SMC_CAN_USE_32BIT
|
||||
#endif
|
||||
#define SMC_8BIT(p) ((p)->cfg.flags & SMC91X_USE_8BIT)
|
||||
#define SMC_16BIT(p) ((p)->cfg.flags & SMC91X_USE_16BIT)
|
||||
#define SMC_32BIT(p) ((p)->cfg.flags & SMC91X_USE_32BIT)
|
||||
|
||||
#ifdef SMC_USE_PXA_DMA
|
||||
#ifdef CONFIG_ARCH_PXA
|
||||
/*
|
||||
* Let's use the DMA engine on the XScale PXA2xx for RX packets. This is
|
||||
* always happening in irq context so no need to worry about races. TX is
|
||||
|
@ -608,7 +610,7 @@ smc_pxa_dma_irq(int dma, void *dummy)
|
|||
{
|
||||
DCSR(dma) = 0;
|
||||
}
|
||||
#endif /* SMC_USE_PXA_DMA */
|
||||
#endif /* CONFIG_ARCH_PXA */
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -219,7 +219,8 @@ config PCMCIA_SA1111
|
|||
config PCMCIA_PXA2XX
|
||||
tristate "PXA2xx support"
|
||||
depends on ARM && ARCH_PXA && PCMCIA
|
||||
depends on ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL || MACH_ARMCORE
|
||||
depends on (ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL \
|
||||
|| MACH_ARMCORE || ARCH_PXA_PALM)
|
||||
help
|
||||
Say Y here to include support for the PXA2xx PCMCIA controller
|
||||
|
||||
|
|
|
@ -71,4 +71,5 @@ pxa2xx_cs-$(CONFIG_ARCH_LUBBOCK) += pxa2xx_lubbock.o sa1111_generic.o
|
|||
pxa2xx_cs-$(CONFIG_MACH_MAINSTONE) += pxa2xx_mainstone.o
|
||||
pxa2xx_cs-$(CONFIG_PXA_SHARPSL) += pxa2xx_sharpsl.o
|
||||
pxa2xx_cs-$(CONFIG_MACH_ARMCORE) += pxa2xx_cm_x270.o
|
||||
pxa2xx_cs-$(CONFIG_MACH_PALMTX) += pxa2xx_palmtx.o
|
||||
|
||||
|
|
|
@ -5,82 +5,60 @@
|
|||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compulab Ltd., 2003, 2007
|
||||
* Compulab Ltd., 2003, 2007, 2008
|
||||
* Mike Rapoport <mike@compulab.co.il>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#include <pcmcia/ss.h>
|
||||
#include <asm/hardware.h>
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-gpio.h>
|
||||
#include <asm/arch/cm-x270.h>
|
||||
|
||||
#include "soc_common.h"
|
||||
|
||||
#define GPIO_PCMCIA_S0_CD_VALID (84)
|
||||
#define GPIO_PCMCIA_S0_RDYINT (82)
|
||||
#define GPIO_PCMCIA_RESET (53)
|
||||
|
||||
#define PCMCIA_S0_CD_VALID IRQ_GPIO(GPIO_PCMCIA_S0_CD_VALID)
|
||||
#define PCMCIA_S0_RDYINT IRQ_GPIO(GPIO_PCMCIA_S0_RDYINT)
|
||||
|
||||
|
||||
static struct pcmcia_irqs irqs[] = {
|
||||
{ 0, PCMCIA_S0_CD_VALID, "PCMCIA0 CD" },
|
||||
{ 1, PCMCIA_S1_CD_VALID, "PCMCIA1 CD" },
|
||||
};
|
||||
|
||||
static int cmx270_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
|
||||
{
|
||||
GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) |
|
||||
GPIO_bit(GPIO49_nPWE) |
|
||||
GPIO_bit(GPIO50_nPIOR) |
|
||||
GPIO_bit(GPIO51_nPIOW) |
|
||||
GPIO_bit(GPIO85_nPCE_1) |
|
||||
GPIO_bit(GPIO54_nPCE_2);
|
||||
int ret = gpio_request(GPIO_PCMCIA_RESET, "PCCard reset");
|
||||
if (ret)
|
||||
return ret;
|
||||
gpio_direction_output(GPIO_PCMCIA_RESET, 0);
|
||||
|
||||
pxa_gpio_mode(GPIO48_nPOE_MD);
|
||||
pxa_gpio_mode(GPIO49_nPWE_MD);
|
||||
pxa_gpio_mode(GPIO50_nPIOR_MD);
|
||||
pxa_gpio_mode(GPIO51_nPIOW_MD);
|
||||
pxa_gpio_mode(GPIO85_nPCE_1_MD);
|
||||
pxa_gpio_mode(GPIO54_nPCE_2_MD);
|
||||
pxa_gpio_mode(GPIO55_nPREG_MD);
|
||||
pxa_gpio_mode(GPIO56_nPWAIT_MD);
|
||||
pxa_gpio_mode(GPIO57_nIOIS16_MD);
|
||||
skt->irq = PCMCIA_S0_RDYINT;
|
||||
ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
|
||||
if (!ret)
|
||||
gpio_free(GPIO_PCMCIA_RESET);
|
||||
|
||||
/* Reset signal */
|
||||
pxa_gpio_mode(GPIO53_nPCE_2 | GPIO_OUT);
|
||||
GPCR(GPIO53_nPCE_2) = GPIO_bit(GPIO53_nPCE_2);
|
||||
|
||||
set_irq_type(PCMCIA_S0_CD_VALID, IRQ_TYPE_EDGE_BOTH);
|
||||
set_irq_type(PCMCIA_S1_CD_VALID, IRQ_TYPE_EDGE_BOTH);
|
||||
|
||||
/* irq's for slots: */
|
||||
set_irq_type(PCMCIA_S0_RDYINT, IRQ_TYPE_EDGE_FALLING);
|
||||
set_irq_type(PCMCIA_S1_RDYINT, IRQ_TYPE_EDGE_FALLING);
|
||||
|
||||
skt->irq = (skt->nr == 0) ? PCMCIA_S0_RDYINT : PCMCIA_S1_RDYINT;
|
||||
return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void cmx270_pcmcia_shutdown(struct soc_pcmcia_socket *skt)
|
||||
{
|
||||
soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
|
||||
|
||||
set_irq_type(IRQ_TO_GPIO(PCMCIA_S0_CD_VALID), IRQ_TYPE_NONE);
|
||||
set_irq_type(IRQ_TO_GPIO(PCMCIA_S1_CD_VALID), IRQ_TYPE_NONE);
|
||||
|
||||
set_irq_type(IRQ_TO_GPIO(PCMCIA_S0_RDYINT), IRQ_TYPE_NONE);
|
||||
set_irq_type(IRQ_TO_GPIO(PCMCIA_S1_RDYINT), IRQ_TYPE_NONE);
|
||||
gpio_free(GPIO_PCMCIA_RESET);
|
||||
}
|
||||
|
||||
|
||||
static void cmx270_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
|
||||
struct pcmcia_state *state)
|
||||
{
|
||||
state->detect = (PCC_DETECT(skt->nr) == 0) ? 1 : 0;
|
||||
state->ready = (PCC_READY(skt->nr) == 0) ? 0 : 1;
|
||||
state->detect = (gpio_get_value(GPIO_PCMCIA_S0_CD_VALID) == 0) ? 1 : 0;
|
||||
state->ready = (gpio_get_value(GPIO_PCMCIA_S0_RDYINT) == 0) ? 0 : 1;
|
||||
state->bvd1 = 1;
|
||||
state->bvd2 = 1;
|
||||
state->vs_3v = 0;
|
||||
|
@ -92,32 +70,16 @@ static void cmx270_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
|
|||
static int cmx270_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
|
||||
const socket_state_t *state)
|
||||
{
|
||||
GPSR(GPIO49_nPWE) = GPIO_bit(GPIO49_nPWE);
|
||||
pxa_gpio_mode(GPIO49_nPWE | GPIO_OUT);
|
||||
|
||||
switch (skt->nr) {
|
||||
case 0:
|
||||
if (state->flags & SS_RESET) {
|
||||
GPCR(GPIO49_nPWE) = GPIO_bit(GPIO49_nPWE);
|
||||
GPSR(GPIO53_nPCE_2) = GPIO_bit(GPIO53_nPCE_2);
|
||||
gpio_set_value(GPIO_PCMCIA_RESET, 1);
|
||||
udelay(10);
|
||||
GPCR(GPIO53_nPCE_2) = GPIO_bit(GPIO53_nPCE_2);
|
||||
GPSR(GPIO49_nPWE) = GPIO_bit(GPIO49_nPWE);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (state->flags & SS_RESET) {
|
||||
GPCR(GPIO49_nPWE) = GPIO_bit(GPIO49_nPWE);
|
||||
GPSR(GPIO53_nPCE_2) = GPIO_bit(GPIO53_nPCE_2);
|
||||
udelay(10);
|
||||
GPCR(GPIO53_nPCE_2) = GPIO_bit(GPIO53_nPCE_2);
|
||||
GPSR(GPIO49_nPWE) = GPIO_bit(GPIO49_nPWE);
|
||||
gpio_set_value(GPIO_PCMCIA_RESET, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
pxa_gpio_mode(GPIO49_nPWE_MD);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -130,7 +92,7 @@ static void cmx270_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
|
|||
}
|
||||
|
||||
|
||||
static struct pcmcia_low_level cmx270_pcmcia_ops = {
|
||||
static struct pcmcia_low_level cmx270_pcmcia_ops __initdata = {
|
||||
.owner = THIS_MODULE,
|
||||
.hw_init = cmx270_pcmcia_hw_init,
|
||||
.hw_shutdown = cmx270_pcmcia_shutdown,
|
||||
|
@ -138,7 +100,7 @@ static struct pcmcia_low_level cmx270_pcmcia_ops = {
|
|||
.configure_socket = cmx270_pcmcia_configure_socket,
|
||||
.socket_init = cmx270_pcmcia_socket_init,
|
||||
.socket_suspend = cmx270_pcmcia_socket_suspend,
|
||||
.nr = 2,
|
||||
.nr = 1,
|
||||
};
|
||||
|
||||
static struct platform_device *cmx270_pcmcia_device;
|
||||
|
@ -147,15 +109,21 @@ static int __init cmx270_pcmcia_init(void)
|
|||
{
|
||||
int ret;
|
||||
|
||||
if (!machine_is_armcore())
|
||||
return -ENODEV;
|
||||
|
||||
cmx270_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1);
|
||||
|
||||
if (!cmx270_pcmcia_device)
|
||||
return -ENOMEM;
|
||||
|
||||
cmx270_pcmcia_device->dev.platform_data = &cmx270_pcmcia_ops;
|
||||
ret = platform_device_add_data(cmx270_pcmcia_device, &cmx270_pcmcia_ops,
|
||||
sizeof(cmx270_pcmcia_ops));
|
||||
|
||||
printk(KERN_INFO "Registering cm-x270 PCMCIA interface.\n");
|
||||
ret = platform_device_add(cmx270_pcmcia_device);
|
||||
if (ret == 0) {
|
||||
printk(KERN_INFO "Registering cm-x270 PCMCIA interface.\n");
|
||||
ret = platform_device_add(cmx270_pcmcia_device);
|
||||
}
|
||||
|
||||
if (ret)
|
||||
platform_device_put(cmx270_pcmcia_device);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <pcmcia/ss.h>
|
||||
|
||||
#include <asm/hardware.h>
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/irq.h>
|
||||
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
|
@ -136,7 +137,7 @@ static void mst_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
|
|||
{
|
||||
}
|
||||
|
||||
static struct pcmcia_low_level mst_pcmcia_ops = {
|
||||
static struct pcmcia_low_level mst_pcmcia_ops __initdata = {
|
||||
.owner = THIS_MODULE,
|
||||
.hw_init = mst_pcmcia_hw_init,
|
||||
.hw_shutdown = mst_pcmcia_hw_shutdown,
|
||||
|
@ -153,13 +154,17 @@ static int __init mst_pcmcia_init(void)
|
|||
{
|
||||
int ret;
|
||||
|
||||
if (!machine_is_mainstone())
|
||||
return -ENODEV;
|
||||
|
||||
mst_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1);
|
||||
if (!mst_pcmcia_device)
|
||||
return -ENOMEM;
|
||||
|
||||
mst_pcmcia_device->dev.platform_data = &mst_pcmcia_ops;
|
||||
|
||||
ret = platform_device_add(mst_pcmcia_device);
|
||||
ret = platform_device_add_data(mst_pcmcia_device, &mst_pcmcia_ops,
|
||||
sizeof(mst_pcmcia_ops));
|
||||
if (ret == 0)
|
||||
ret = platform_device_add(mst_pcmcia_device);
|
||||
|
||||
if (ret)
|
||||
platform_device_put(mst_pcmcia_device);
|
||||
|
|
118
drivers/pcmcia/pxa2xx_palmtx.c
Normal file
118
drivers/pcmcia/pxa2xx_palmtx.c
Normal file
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* linux/drivers/pcmcia/pxa2xx_palmtx.c
|
||||
*
|
||||
* Driver for Palm T|X PCMCIA
|
||||
*
|
||||
* Copyright (C) 2007-2008 Marek Vasut <marek.vasut@gmail.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/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include <asm/arch/gpio.h>
|
||||
#include <asm/arch/palmtx.h>
|
||||
|
||||
#include "soc_common.h"
|
||||
|
||||
static int palmtx_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
|
||||
{
|
||||
skt->irq = IRQ_GPIO(GPIO_NR_PALMTX_PCMCIA_READY);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void palmtx_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
|
||||
{
|
||||
}
|
||||
|
||||
static void palmtx_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
|
||||
struct pcmcia_state *state)
|
||||
{
|
||||
state->detect = 1; /* always inserted */
|
||||
state->ready = !!gpio_get_value(GPIO_NR_PALMTX_PCMCIA_READY);
|
||||
state->bvd1 = 1;
|
||||
state->bvd2 = 1;
|
||||
state->wrprot = 0;
|
||||
state->vs_3v = 1;
|
||||
state->vs_Xv = 0;
|
||||
}
|
||||
|
||||
static int
|
||||
palmtx_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
|
||||
const socket_state_t *state)
|
||||
{
|
||||
gpio_set_value(GPIO_NR_PALMTX_PCMCIA_POWER1, 1);
|
||||
gpio_set_value(GPIO_NR_PALMTX_PCMCIA_POWER2, 1);
|
||||
gpio_set_value(GPIO_NR_PALMTX_PCMCIA_RESET,
|
||||
!!(state->flags & SS_RESET));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void palmtx_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
|
||||
{
|
||||
}
|
||||
|
||||
static void palmtx_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
|
||||
{
|
||||
}
|
||||
|
||||
static struct pcmcia_low_level palmtx_pcmcia_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
|
||||
.first = 0,
|
||||
.nr = 1,
|
||||
|
||||
.hw_init = palmtx_pcmcia_hw_init,
|
||||
.hw_shutdown = palmtx_pcmcia_hw_shutdown,
|
||||
|
||||
.socket_state = palmtx_pcmcia_socket_state,
|
||||
.configure_socket = palmtx_pcmcia_configure_socket,
|
||||
|
||||
.socket_init = palmtx_pcmcia_socket_init,
|
||||
.socket_suspend = palmtx_pcmcia_socket_suspend,
|
||||
};
|
||||
|
||||
static struct platform_device *palmtx_pcmcia_device;
|
||||
|
||||
static int __init palmtx_pcmcia_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!machine_is_palmtx())
|
||||
return -ENODEV;
|
||||
|
||||
palmtx_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1);
|
||||
if (!palmtx_pcmcia_device)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = platform_device_add_data(palmtx_pcmcia_device, &palmtx_pcmcia_ops,
|
||||
sizeof(palmtx_pcmcia_ops));
|
||||
|
||||
if (!ret)
|
||||
ret = platform_device_add(palmtx_pcmcia_device);
|
||||
|
||||
if (ret)
|
||||
platform_device_put(palmtx_pcmcia_device);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void __exit palmtx_pcmcia_exit(void)
|
||||
{
|
||||
platform_device_unregister(palmtx_pcmcia_device);
|
||||
}
|
||||
|
||||
fs_initcall(palmtx_pcmcia_init);
|
||||
module_exit(palmtx_pcmcia_exit);
|
||||
|
||||
MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>");
|
||||
MODULE_DESCRIPTION("PCMCIA support for Palm T|X");
|
||||
MODULE_ALIAS("platform:pxa2xx-pcmcia");
|
||||
MODULE_LICENSE("GPL");
|
|
@ -222,7 +222,7 @@ static void sharpsl_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
|
|||
sharpsl_pcmcia_init_reset(skt);
|
||||
}
|
||||
|
||||
static struct pcmcia_low_level sharpsl_pcmcia_ops = {
|
||||
static struct pcmcia_low_level sharpsl_pcmcia_ops __initdata = {
|
||||
.owner = THIS_MODULE,
|
||||
.hw_init = sharpsl_pcmcia_hw_init,
|
||||
.hw_shutdown = sharpsl_pcmcia_hw_shutdown,
|
||||
|
@ -261,10 +261,12 @@ static int __init sharpsl_pcmcia_init(void)
|
|||
if (!sharpsl_pcmcia_device)
|
||||
return -ENOMEM;
|
||||
|
||||
sharpsl_pcmcia_device->dev.platform_data = &sharpsl_pcmcia_ops;
|
||||
sharpsl_pcmcia_device->dev.parent = platform_scoop_config->devs[0].dev;
|
||||
|
||||
ret = platform_device_add(sharpsl_pcmcia_device);
|
||||
ret = platform_device_add_data(sharpsl_pcmcia_device,
|
||||
&sharpsl_pcmcia_ops, sizeof(sharpsl_pcmcia_ops));
|
||||
if (ret == 0) {
|
||||
sharpsl_pcmcia_device->dev.parent = platform_scoop_config->devs[0].dev;
|
||||
ret = platform_device_add(sharpsl_pcmcia_device);
|
||||
}
|
||||
|
||||
if (ret)
|
||||
platform_device_put(sharpsl_pcmcia_device);
|
||||
|
|
|
@ -49,4 +49,10 @@ config BATTERY_OLPC
|
|||
help
|
||||
Say Y to enable support for the battery on the OLPC laptop.
|
||||
|
||||
config BATTERY_PALMTX
|
||||
tristate "Palm T|X battery"
|
||||
depends on MACH_PALMTX
|
||||
help
|
||||
Say Y to enable support for the battery in Palm T|X.
|
||||
|
||||
endif # POWER_SUPPLY
|
||||
|
|
|
@ -20,3 +20,4 @@ obj-$(CONFIG_APM_POWER) += apm_power.o
|
|||
obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o
|
||||
obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o
|
||||
obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o
|
||||
obj-$(CONFIG_BATTERY_PALMTX) += palmtx_battery.o
|
||||
|
|
198
drivers/power/palmtx_battery.c
Normal file
198
drivers/power/palmtx_battery.c
Normal file
|
@ -0,0 +1,198 @@
|
|||
/*
|
||||
* linux/drivers/power/palmtx_battery.c
|
||||
*
|
||||
* Battery measurement code for Palm T|X Handheld computer
|
||||
*
|
||||
* based on tosa_battery.c
|
||||
*
|
||||
* Copyright (C) 2008 Marek Vasut <marek.vasut@gmail.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/module.h>
|
||||
#include <linux/power_supply.h>
|
||||
#include <linux/wm97xx.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/arch/palmtx.h>
|
||||
|
||||
static DEFINE_MUTEX(bat_lock);
|
||||
static struct work_struct bat_work;
|
||||
struct mutex work_lock;
|
||||
int bat_status = POWER_SUPPLY_STATUS_DISCHARGING;
|
||||
|
||||
static unsigned long palmtx_read_bat(struct power_supply *bat_ps)
|
||||
{
|
||||
return wm97xx_read_aux_adc(bat_ps->dev->parent->driver_data,
|
||||
WM97XX_AUX_ID3) * 1000 / 414;
|
||||
}
|
||||
|
||||
static unsigned long palmtx_read_temp(struct power_supply *bat_ps)
|
||||
{
|
||||
return wm97xx_read_aux_adc(bat_ps->dev->parent->driver_data,
|
||||
WM97XX_AUX_ID2);
|
||||
}
|
||||
|
||||
static int palmtx_bat_get_property(struct power_supply *bat_ps,
|
||||
enum power_supply_property psp,
|
||||
union power_supply_propval *val)
|
||||
{
|
||||
switch (psp) {
|
||||
case POWER_SUPPLY_PROP_STATUS:
|
||||
val->intval = bat_status;
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_TECHNOLOGY:
|
||||
val->intval = POWER_SUPPLY_TECHNOLOGY_LIPO;
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_VOLTAGE_NOW:
|
||||
val->intval = palmtx_read_bat(bat_ps);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_VOLTAGE_MAX:
|
||||
case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
|
||||
val->intval = PALMTX_BAT_MAX_VOLTAGE;
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
|
||||
val->intval = PALMTX_BAT_MIN_VOLTAGE;
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_TEMP:
|
||||
val->intval = palmtx_read_temp(bat_ps);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_PRESENT:
|
||||
val->intval = 1;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void palmtx_bat_external_power_changed(struct power_supply *bat_ps)
|
||||
{
|
||||
schedule_work(&bat_work);
|
||||
}
|
||||
|
||||
static char *status_text[] = {
|
||||
[POWER_SUPPLY_STATUS_UNKNOWN] = "Unknown",
|
||||
[POWER_SUPPLY_STATUS_CHARGING] = "Charging",
|
||||
[POWER_SUPPLY_STATUS_DISCHARGING] = "Discharging",
|
||||
};
|
||||
|
||||
static void palmtx_bat_update(struct power_supply *bat_ps)
|
||||
{
|
||||
int old_status = bat_status;
|
||||
|
||||
mutex_lock(&work_lock);
|
||||
|
||||
bat_status = gpio_get_value(GPIO_NR_PALMTX_POWER_DETECT) ?
|
||||
POWER_SUPPLY_STATUS_CHARGING :
|
||||
POWER_SUPPLY_STATUS_DISCHARGING;
|
||||
|
||||
if (old_status != bat_status) {
|
||||
pr_debug("%s %s -> %s\n", bat_ps->name,
|
||||
status_text[old_status],
|
||||
status_text[bat_status]);
|
||||
power_supply_changed(bat_ps);
|
||||
}
|
||||
|
||||
mutex_unlock(&work_lock);
|
||||
}
|
||||
|
||||
static enum power_supply_property palmtx_bat_main_props[] = {
|
||||
POWER_SUPPLY_PROP_STATUS,
|
||||
POWER_SUPPLY_PROP_TECHNOLOGY,
|
||||
POWER_SUPPLY_PROP_VOLTAGE_NOW,
|
||||
POWER_SUPPLY_PROP_VOLTAGE_MAX,
|
||||
POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
|
||||
POWER_SUPPLY_PROP_TEMP,
|
||||
POWER_SUPPLY_PROP_PRESENT,
|
||||
};
|
||||
|
||||
struct power_supply bat_ps = {
|
||||
.name = "main-battery",
|
||||
.type = POWER_SUPPLY_TYPE_BATTERY,
|
||||
.properties = palmtx_bat_main_props,
|
||||
.num_properties = ARRAY_SIZE(palmtx_bat_main_props),
|
||||
.get_property = palmtx_bat_get_property,
|
||||
.external_power_changed = palmtx_bat_external_power_changed,
|
||||
.use_for_apm = 1,
|
||||
};
|
||||
|
||||
static void palmtx_bat_work(struct work_struct *work)
|
||||
{
|
||||
palmtx_bat_update(&bat_ps);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int palmtx_bat_suspend(struct platform_device *dev, pm_message_t state)
|
||||
{
|
||||
flush_scheduled_work();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int palmtx_bat_resume(struct platform_device *dev)
|
||||
{
|
||||
schedule_work(&bat_work);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#define palmtx_bat_suspend NULL
|
||||
#define palmtx_bat_resume NULL
|
||||
#endif
|
||||
|
||||
static int __devinit palmtx_bat_probe(struct platform_device *dev)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (!machine_is_palmtx())
|
||||
return -ENODEV;
|
||||
|
||||
mutex_init(&work_lock);
|
||||
|
||||
INIT_WORK(&bat_work, palmtx_bat_work);
|
||||
|
||||
ret = power_supply_register(&dev->dev, &bat_ps);
|
||||
if (!ret)
|
||||
schedule_work(&bat_work);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __devexit palmtx_bat_remove(struct platform_device *dev)
|
||||
{
|
||||
power_supply_unregister(&bat_ps);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver palmtx_bat_driver = {
|
||||
.driver.name = "wm97xx-battery",
|
||||
.driver.owner = THIS_MODULE,
|
||||
.probe = palmtx_bat_probe,
|
||||
.remove = __devexit_p(palmtx_bat_remove),
|
||||
.suspend = palmtx_bat_suspend,
|
||||
.resume = palmtx_bat_resume,
|
||||
};
|
||||
|
||||
static int __init palmtx_bat_init(void)
|
||||
{
|
||||
return platform_driver_register(&palmtx_bat_driver);
|
||||
}
|
||||
|
||||
static void __exit palmtx_bat_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&palmtx_bat_driver);
|
||||
}
|
||||
|
||||
module_init(palmtx_bat_init);
|
||||
module_exit(palmtx_bat_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>");
|
||||
MODULE_DESCRIPTION("Palm T|X battery driver");
|
|
@ -172,7 +172,7 @@ config USB_NET2280
|
|||
default USB_GADGET
|
||||
select USB_GADGET_SELECTED
|
||||
|
||||
config USB_GADGET_PXA2XX
|
||||
config USB_GADGET_PXA25X
|
||||
boolean "PXA 25x or IXP 4xx"
|
||||
depends on (ARCH_PXA && PXA25x) || ARCH_IXP4XX
|
||||
help
|
||||
|
@ -184,19 +184,19 @@ config USB_GADGET_PXA2XX
|
|||
zero (for control transfers).
|
||||
|
||||
Say "y" to link the driver statically, or "m" to build a
|
||||
dynamically linked module called "pxa2xx_udc" and force all
|
||||
dynamically linked module called "pxa25x_udc" and force all
|
||||
gadget drivers to also be dynamically linked.
|
||||
|
||||
config USB_PXA2XX
|
||||
config USB_PXA25X
|
||||
tristate
|
||||
depends on USB_GADGET_PXA2XX
|
||||
depends on USB_GADGET_PXA25X
|
||||
default USB_GADGET
|
||||
select USB_GADGET_SELECTED
|
||||
|
||||
# if there's only one gadget driver, using only two bulk endpoints,
|
||||
# don't waste memory for the other endpoints
|
||||
config USB_PXA2XX_SMALL
|
||||
depends on USB_GADGET_PXA2XX
|
||||
config USB_PXA25X_SMALL
|
||||
depends on USB_GADGET_PXA25X
|
||||
bool
|
||||
default n if USB_ETH_RNDIS
|
||||
default y if USB_ZERO
|
||||
|
|
|
@ -8,7 +8,7 @@ endif
|
|||
obj-$(CONFIG_USB_DUMMY_HCD) += dummy_hcd.o
|
||||
obj-$(CONFIG_USB_NET2280) += net2280.o
|
||||
obj-$(CONFIG_USB_AMD5536UDC) += amd5536udc.o
|
||||
obj-$(CONFIG_USB_PXA2XX) += pxa2xx_udc.o
|
||||
obj-$(CONFIG_USB_PXA25X) += pxa25x_udc.o
|
||||
obj-$(CONFIG_USB_PXA27X) += pxa27x_udc.o
|
||||
obj-$(CONFIG_USB_GOKU) += goku_udc.o
|
||||
obj-$(CONFIG_USB_OMAP) += omap_udc.o
|
||||
|
|
|
@ -262,7 +262,7 @@ MODULE_PARM_DESC(host_addr, "Host Ethernet Address");
|
|||
/* For CDC-incapable hardware, choose the simple cdc subset.
|
||||
* Anything that talks bulk (without notable bugs) can do this.
|
||||
*/
|
||||
#ifdef CONFIG_USB_GADGET_PXA2XX
|
||||
#ifdef CONFIG_USB_GADGET_PXA25X
|
||||
#define DEV_CONFIG_SUBSET
|
||||
#endif
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
#define gadget_is_dummy(g) 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB_GADGET_PXA2XX
|
||||
#define gadget_is_pxa(g) !strcmp("pxa2xx_udc", (g)->name)
|
||||
#ifdef CONFIG_USB_GADGET_PXA25X
|
||||
#define gadget_is_pxa(g) !strcmp("pxa25x_udc", (g)->name)
|
||||
#else
|
||||
#define gadget_is_pxa(g) 0
|
||||
#endif
|
||||
|
|
|
@ -1501,7 +1501,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
|
|||
}
|
||||
break;
|
||||
|
||||
#ifndef CONFIG_USB_GADGET_PXA2XX
|
||||
#ifndef CONFIG_USB_GADGET_PXA25X
|
||||
/* PXA automagically handles this request too */
|
||||
case USB_REQ_GET_CONFIGURATION:
|
||||
if (ctrl->bRequestType != 0x80)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*
|
||||
* linux/drivers/usb/gadget/pxa2xx_udc.c
|
||||
* Intel PXA25x and IXP4xx on-chip full speed USB device controllers
|
||||
*
|
||||
* Copyright (C) 2002 Intrinsyc, Inc. (Frank Becker)
|
||||
|
@ -46,19 +45,25 @@
|
|||
#include <linux/err.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
#include <asm/dma.h>
|
||||
#include <asm/gpio.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/system.h>
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/unaligned.h>
|
||||
#include <asm/hardware.h>
|
||||
|
||||
#include <linux/usb/ch9.h>
|
||||
#include <linux/usb/gadget.h>
|
||||
|
||||
/*
|
||||
* This driver is PXA25x only. Grab the right register definitions.
|
||||
*/
|
||||
#ifdef CONFIG_ARCH_PXA
|
||||
#include <asm/arch/pxa25x-udc.h>
|
||||
#endif
|
||||
|
||||
#include <asm/mach/udc_pxa2xx.h>
|
||||
|
||||
|
||||
|
@ -91,7 +96,7 @@
|
|||
#define DRIVER_DESC "PXA 25x USB Device Controller driver"
|
||||
|
||||
|
||||
static const char driver_name [] = "pxa2xx_udc";
|
||||
static const char driver_name [] = "pxa25x_udc";
|
||||
|
||||
static const char ep0name [] = "ep0";
|
||||
|
||||
|
@ -111,10 +116,10 @@ static const char ep0name [] = "ep0";
|
|||
|
||||
#endif
|
||||
|
||||
#include "pxa2xx_udc.h"
|
||||
#include "pxa25x_udc.h"
|
||||
|
||||
|
||||
#ifdef CONFIG_USB_PXA2XX_SMALL
|
||||
#ifdef CONFIG_USB_PXA25X_SMALL
|
||||
#define SIZE_STR " (small)"
|
||||
#else
|
||||
#define SIZE_STR ""
|
||||
|
@ -126,8 +131,8 @@ static const char ep0name [] = "ep0";
|
|||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static void pxa2xx_ep_fifo_flush (struct usb_ep *ep);
|
||||
static void nuke (struct pxa2xx_ep *, int status);
|
||||
static void pxa25x_ep_fifo_flush (struct usb_ep *ep);
|
||||
static void nuke (struct pxa25x_ep *, int status);
|
||||
|
||||
/* one GPIO should be used to detect VBUS from the host */
|
||||
static int is_vbus_present(void)
|
||||
|
@ -147,9 +152,10 @@ static int is_vbus_present(void)
|
|||
static void pullup_off(void)
|
||||
{
|
||||
struct pxa2xx_udc_mach_info *mach = the_controller->mach;
|
||||
int off_level = mach->gpio_pullup_inverted;
|
||||
|
||||
if (mach->gpio_pullup)
|
||||
gpio_set_value(mach->gpio_pullup, 0);
|
||||
gpio_set_value(mach->gpio_pullup, off_level);
|
||||
else if (mach->udc_command)
|
||||
mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT);
|
||||
}
|
||||
|
@ -157,9 +163,10 @@ static void pullup_off(void)
|
|||
static void pullup_on(void)
|
||||
{
|
||||
struct pxa2xx_udc_mach_info *mach = the_controller->mach;
|
||||
int on_level = !mach->gpio_pullup_inverted;
|
||||
|
||||
if (mach->gpio_pullup)
|
||||
gpio_set_value(mach->gpio_pullup, 1);
|
||||
gpio_set_value(mach->gpio_pullup, on_level);
|
||||
else if (mach->udc_command)
|
||||
mach->udc_command(PXA2XX_UDC_CMD_CONNECT);
|
||||
}
|
||||
|
@ -212,24 +219,24 @@ static inline void udc_ack_int_UDCCR(int mask)
|
|||
/*
|
||||
* endpoint enable/disable
|
||||
*
|
||||
* we need to verify the descriptors used to enable endpoints. since pxa2xx
|
||||
* we need to verify the descriptors used to enable endpoints. since pxa25x
|
||||
* endpoint configurations are fixed, and are pretty much always enabled,
|
||||
* there's not a lot to manage here.
|
||||
*
|
||||
* because pxa2xx can't selectively initialize bulk (or interrupt) endpoints,
|
||||
* because pxa25x can't selectively initialize bulk (or interrupt) endpoints,
|
||||
* (resetting endpoint halt and toggle), SET_INTERFACE is unusable except
|
||||
* for a single interface (with only the default altsetting) and for gadget
|
||||
* drivers that don't halt endpoints (not reset by set_interface). that also
|
||||
* means that if you use ISO, you must violate the USB spec rule that all
|
||||
* iso endpoints must be in non-default altsettings.
|
||||
*/
|
||||
static int pxa2xx_ep_enable (struct usb_ep *_ep,
|
||||
static int pxa25x_ep_enable (struct usb_ep *_ep,
|
||||
const struct usb_endpoint_descriptor *desc)
|
||||
{
|
||||
struct pxa2xx_ep *ep;
|
||||
struct pxa2xx_udc *dev;
|
||||
struct pxa25x_ep *ep;
|
||||
struct pxa25x_udc *dev;
|
||||
|
||||
ep = container_of (_ep, struct pxa2xx_ep, ep);
|
||||
ep = container_of (_ep, struct pxa25x_ep, ep);
|
||||
if (!_ep || !desc || ep->desc || _ep->name == ep0name
|
||||
|| desc->bDescriptorType != USB_DT_ENDPOINT
|
||||
|| ep->bEndpointAddress != desc->bEndpointAddress
|
||||
|
@ -268,7 +275,7 @@ static int pxa2xx_ep_enable (struct usb_ep *_ep,
|
|||
ep->ep.maxpacket = le16_to_cpu (desc->wMaxPacketSize);
|
||||
|
||||
/* flush fifo (mostly for OUT buffers) */
|
||||
pxa2xx_ep_fifo_flush (_ep);
|
||||
pxa25x_ep_fifo_flush (_ep);
|
||||
|
||||
/* ... reset halt state too, if we could ... */
|
||||
|
||||
|
@ -276,12 +283,12 @@ static int pxa2xx_ep_enable (struct usb_ep *_ep,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int pxa2xx_ep_disable (struct usb_ep *_ep)
|
||||
static int pxa25x_ep_disable (struct usb_ep *_ep)
|
||||
{
|
||||
struct pxa2xx_ep *ep;
|
||||
struct pxa25x_ep *ep;
|
||||
unsigned long flags;
|
||||
|
||||
ep = container_of (_ep, struct pxa2xx_ep, ep);
|
||||
ep = container_of (_ep, struct pxa25x_ep, ep);
|
||||
if (!_ep || !ep->desc) {
|
||||
DMSG("%s, %s not enabled\n", __func__,
|
||||
_ep ? ep->ep.name : NULL);
|
||||
|
@ -292,7 +299,7 @@ static int pxa2xx_ep_disable (struct usb_ep *_ep)
|
|||
nuke (ep, -ESHUTDOWN);
|
||||
|
||||
/* flush fifo (mostly for IN buffers) */
|
||||
pxa2xx_ep_fifo_flush (_ep);
|
||||
pxa25x_ep_fifo_flush (_ep);
|
||||
|
||||
ep->desc = NULL;
|
||||
ep->stopped = 1;
|
||||
|
@ -304,18 +311,18 @@ static int pxa2xx_ep_disable (struct usb_ep *_ep)
|
|||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* for the pxa2xx, these can just wrap kmalloc/kfree. gadget drivers
|
||||
/* for the pxa25x, these can just wrap kmalloc/kfree. gadget drivers
|
||||
* must still pass correctly initialized endpoints, since other controller
|
||||
* drivers may care about how it's currently set up (dma issues etc).
|
||||
*/
|
||||
|
||||
/*
|
||||
* pxa2xx_ep_alloc_request - allocate a request data structure
|
||||
* pxa25x_ep_alloc_request - allocate a request data structure
|
||||
*/
|
||||
static struct usb_request *
|
||||
pxa2xx_ep_alloc_request (struct usb_ep *_ep, gfp_t gfp_flags)
|
||||
pxa25x_ep_alloc_request (struct usb_ep *_ep, gfp_t gfp_flags)
|
||||
{
|
||||
struct pxa2xx_request *req;
|
||||
struct pxa25x_request *req;
|
||||
|
||||
req = kzalloc(sizeof(*req), gfp_flags);
|
||||
if (!req)
|
||||
|
@ -327,14 +334,14 @@ pxa2xx_ep_alloc_request (struct usb_ep *_ep, gfp_t gfp_flags)
|
|||
|
||||
|
||||
/*
|
||||
* pxa2xx_ep_free_request - deallocate a request data structure
|
||||
* pxa25x_ep_free_request - deallocate a request data structure
|
||||
*/
|
||||
static void
|
||||
pxa2xx_ep_free_request (struct usb_ep *_ep, struct usb_request *_req)
|
||||
pxa25x_ep_free_request (struct usb_ep *_ep, struct usb_request *_req)
|
||||
{
|
||||
struct pxa2xx_request *req;
|
||||
struct pxa25x_request *req;
|
||||
|
||||
req = container_of (_req, struct pxa2xx_request, req);
|
||||
req = container_of (_req, struct pxa25x_request, req);
|
||||
WARN_ON (!list_empty (&req->queue));
|
||||
kfree(req);
|
||||
}
|
||||
|
@ -344,7 +351,7 @@ pxa2xx_ep_free_request (struct usb_ep *_ep, struct usb_request *_req)
|
|||
/*
|
||||
* done - retire a request; caller blocked irqs
|
||||
*/
|
||||
static void done(struct pxa2xx_ep *ep, struct pxa2xx_request *req, int status)
|
||||
static void done(struct pxa25x_ep *ep, struct pxa25x_request *req, int status)
|
||||
{
|
||||
unsigned stopped = ep->stopped;
|
||||
|
||||
|
@ -367,13 +374,13 @@ static void done(struct pxa2xx_ep *ep, struct pxa2xx_request *req, int status)
|
|||
}
|
||||
|
||||
|
||||
static inline void ep0_idle (struct pxa2xx_udc *dev)
|
||||
static inline void ep0_idle (struct pxa25x_udc *dev)
|
||||
{
|
||||
dev->ep0state = EP0_IDLE;
|
||||
}
|
||||
|
||||
static int
|
||||
write_packet(volatile u32 *uddr, struct pxa2xx_request *req, unsigned max)
|
||||
write_packet(volatile u32 *uddr, struct pxa25x_request *req, unsigned max)
|
||||
{
|
||||
u8 *buf;
|
||||
unsigned length, count;
|
||||
|
@ -398,7 +405,7 @@ write_packet(volatile u32 *uddr, struct pxa2xx_request *req, unsigned max)
|
|||
* caller guarantees at least one packet buffer is ready (or a zlp).
|
||||
*/
|
||||
static int
|
||||
write_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req)
|
||||
write_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req)
|
||||
{
|
||||
unsigned max;
|
||||
|
||||
|
@ -455,7 +462,7 @@ write_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req)
|
|||
* ep0 data stage. these chips want very simple state transitions.
|
||||
*/
|
||||
static inline
|
||||
void ep0start(struct pxa2xx_udc *dev, u32 flags, const char *tag)
|
||||
void ep0start(struct pxa25x_udc *dev, u32 flags, const char *tag)
|
||||
{
|
||||
UDCCS0 = flags|UDCCS0_SA|UDCCS0_OPR;
|
||||
USIR0 = USIR0_IR0;
|
||||
|
@ -465,7 +472,7 @@ void ep0start(struct pxa2xx_udc *dev, u32 flags, const char *tag)
|
|||
}
|
||||
|
||||
static int
|
||||
write_ep0_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req)
|
||||
write_ep0_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req)
|
||||
{
|
||||
unsigned count;
|
||||
int is_short;
|
||||
|
@ -525,7 +532,7 @@ write_ep0_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req)
|
|||
* request buffer having filled (and maybe overran till end-of-packet).
|
||||
*/
|
||||
static int
|
||||
read_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req)
|
||||
read_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req)
|
||||
{
|
||||
for (;;) {
|
||||
u32 udccs;
|
||||
|
@ -602,7 +609,7 @@ read_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req)
|
|||
* protocols do use them.
|
||||
*/
|
||||
static int
|
||||
read_ep0_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req)
|
||||
read_ep0_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req)
|
||||
{
|
||||
u8 *buf, byte;
|
||||
unsigned bufferspace;
|
||||
|
@ -641,21 +648,21 @@ read_ep0_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req)
|
|||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
static int
|
||||
pxa2xx_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
|
||||
pxa25x_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
|
||||
{
|
||||
struct pxa2xx_request *req;
|
||||
struct pxa2xx_ep *ep;
|
||||
struct pxa2xx_udc *dev;
|
||||
struct pxa25x_request *req;
|
||||
struct pxa25x_ep *ep;
|
||||
struct pxa25x_udc *dev;
|
||||
unsigned long flags;
|
||||
|
||||
req = container_of(_req, struct pxa2xx_request, req);
|
||||
req = container_of(_req, struct pxa25x_request, req);
|
||||
if (unlikely (!_req || !_req->complete || !_req->buf
|
||||
|| !list_empty(&req->queue))) {
|
||||
DMSG("%s, bad params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ep = container_of(_ep, struct pxa2xx_ep, ep);
|
||||
ep = container_of(_ep, struct pxa25x_ep, ep);
|
||||
if (unlikely (!_ep || (!ep->desc && ep->ep.name != ep0name))) {
|
||||
DMSG("%s, bad ep\n", __func__);
|
||||
return -EINVAL;
|
||||
|
@ -751,14 +758,14 @@ pxa2xx_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
|
|||
/*
|
||||
* nuke - dequeue ALL requests
|
||||
*/
|
||||
static void nuke(struct pxa2xx_ep *ep, int status)
|
||||
static void nuke(struct pxa25x_ep *ep, int status)
|
||||
{
|
||||
struct pxa2xx_request *req;
|
||||
struct pxa25x_request *req;
|
||||
|
||||
/* called with irqs blocked */
|
||||
while (!list_empty(&ep->queue)) {
|
||||
req = list_entry(ep->queue.next,
|
||||
struct pxa2xx_request,
|
||||
struct pxa25x_request,
|
||||
queue);
|
||||
done(ep, req, status);
|
||||
}
|
||||
|
@ -768,13 +775,13 @@ static void nuke(struct pxa2xx_ep *ep, int status)
|
|||
|
||||
|
||||
/* dequeue JUST ONE request */
|
||||
static int pxa2xx_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
|
||||
static int pxa25x_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
|
||||
{
|
||||
struct pxa2xx_ep *ep;
|
||||
struct pxa2xx_request *req;
|
||||
struct pxa25x_ep *ep;
|
||||
struct pxa25x_request *req;
|
||||
unsigned long flags;
|
||||
|
||||
ep = container_of(_ep, struct pxa2xx_ep, ep);
|
||||
ep = container_of(_ep, struct pxa25x_ep, ep);
|
||||
if (!_ep || ep->ep.name == ep0name)
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -798,12 +805,12 @@ static int pxa2xx_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
|
|||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
static int pxa2xx_ep_set_halt(struct usb_ep *_ep, int value)
|
||||
static int pxa25x_ep_set_halt(struct usb_ep *_ep, int value)
|
||||
{
|
||||
struct pxa2xx_ep *ep;
|
||||
struct pxa25x_ep *ep;
|
||||
unsigned long flags;
|
||||
|
||||
ep = container_of(_ep, struct pxa2xx_ep, ep);
|
||||
ep = container_of(_ep, struct pxa25x_ep, ep);
|
||||
if (unlikely (!_ep
|
||||
|| (!ep->desc && ep->ep.name != ep0name))
|
||||
|| ep->bmAttributes == USB_ENDPOINT_XFER_ISOC) {
|
||||
|
@ -853,11 +860,11 @@ static int pxa2xx_ep_set_halt(struct usb_ep *_ep, int value)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int pxa2xx_ep_fifo_status(struct usb_ep *_ep)
|
||||
static int pxa25x_ep_fifo_status(struct usb_ep *_ep)
|
||||
{
|
||||
struct pxa2xx_ep *ep;
|
||||
struct pxa25x_ep *ep;
|
||||
|
||||
ep = container_of(_ep, struct pxa2xx_ep, ep);
|
||||
ep = container_of(_ep, struct pxa25x_ep, ep);
|
||||
if (!_ep) {
|
||||
DMSG("%s, bad ep\n", __func__);
|
||||
return -ENODEV;
|
||||
|
@ -872,11 +879,11 @@ static int pxa2xx_ep_fifo_status(struct usb_ep *_ep)
|
|||
return (*ep->reg_ubcr & 0xfff) + 1;
|
||||
}
|
||||
|
||||
static void pxa2xx_ep_fifo_flush(struct usb_ep *_ep)
|
||||
static void pxa25x_ep_fifo_flush(struct usb_ep *_ep)
|
||||
{
|
||||
struct pxa2xx_ep *ep;
|
||||
struct pxa25x_ep *ep;
|
||||
|
||||
ep = container_of(_ep, struct pxa2xx_ep, ep);
|
||||
ep = container_of(_ep, struct pxa25x_ep, ep);
|
||||
if (!_ep || ep->ep.name == ep0name || !list_empty(&ep->queue)) {
|
||||
DMSG("%s, bad ep\n", __func__);
|
||||
return;
|
||||
|
@ -898,19 +905,19 @@ static void pxa2xx_ep_fifo_flush(struct usb_ep *_ep)
|
|||
}
|
||||
|
||||
|
||||
static struct usb_ep_ops pxa2xx_ep_ops = {
|
||||
.enable = pxa2xx_ep_enable,
|
||||
.disable = pxa2xx_ep_disable,
|
||||
static struct usb_ep_ops pxa25x_ep_ops = {
|
||||
.enable = pxa25x_ep_enable,
|
||||
.disable = pxa25x_ep_disable,
|
||||
|
||||
.alloc_request = pxa2xx_ep_alloc_request,
|
||||
.free_request = pxa2xx_ep_free_request,
|
||||
.alloc_request = pxa25x_ep_alloc_request,
|
||||
.free_request = pxa25x_ep_free_request,
|
||||
|
||||
.queue = pxa2xx_ep_queue,
|
||||
.dequeue = pxa2xx_ep_dequeue,
|
||||
.queue = pxa25x_ep_queue,
|
||||
.dequeue = pxa25x_ep_dequeue,
|
||||
|
||||
.set_halt = pxa2xx_ep_set_halt,
|
||||
.fifo_status = pxa2xx_ep_fifo_status,
|
||||
.fifo_flush = pxa2xx_ep_fifo_flush,
|
||||
.set_halt = pxa25x_ep_set_halt,
|
||||
.fifo_status = pxa25x_ep_fifo_status,
|
||||
.fifo_flush = pxa25x_ep_fifo_flush,
|
||||
};
|
||||
|
||||
|
||||
|
@ -919,12 +926,12 @@ static struct usb_ep_ops pxa2xx_ep_ops = {
|
|||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int pxa2xx_udc_get_frame(struct usb_gadget *_gadget)
|
||||
static int pxa25x_udc_get_frame(struct usb_gadget *_gadget)
|
||||
{
|
||||
return ((UFNRH & 0x07) << 8) | (UFNRL & 0xff);
|
||||
}
|
||||
|
||||
static int pxa2xx_udc_wakeup(struct usb_gadget *_gadget)
|
||||
static int pxa25x_udc_wakeup(struct usb_gadget *_gadget)
|
||||
{
|
||||
/* host may not have enabled remote wakeup */
|
||||
if ((UDCCS0 & UDCCS0_DRWF) == 0)
|
||||
|
@ -933,14 +940,14 @@ static int pxa2xx_udc_wakeup(struct usb_gadget *_gadget)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void stop_activity(struct pxa2xx_udc *, struct usb_gadget_driver *);
|
||||
static void udc_enable (struct pxa2xx_udc *);
|
||||
static void udc_disable(struct pxa2xx_udc *);
|
||||
static void stop_activity(struct pxa25x_udc *, struct usb_gadget_driver *);
|
||||
static void udc_enable (struct pxa25x_udc *);
|
||||
static void udc_disable(struct pxa25x_udc *);
|
||||
|
||||
/* We disable the UDC -- and its 48 MHz clock -- whenever it's not
|
||||
* in active use.
|
||||
*/
|
||||
static int pullup(struct pxa2xx_udc *udc)
|
||||
static int pullup(struct pxa25x_udc *udc)
|
||||
{
|
||||
int is_active = udc->vbus && udc->pullup && !udc->suspended;
|
||||
DMSG("%s\n", is_active ? "active" : "inactive");
|
||||
|
@ -970,11 +977,11 @@ static int pullup(struct pxa2xx_udc *udc)
|
|||
}
|
||||
|
||||
/* VBUS reporting logically comes from a transceiver */
|
||||
static int pxa2xx_udc_vbus_session(struct usb_gadget *_gadget, int is_active)
|
||||
static int pxa25x_udc_vbus_session(struct usb_gadget *_gadget, int is_active)
|
||||
{
|
||||
struct pxa2xx_udc *udc;
|
||||
struct pxa25x_udc *udc;
|
||||
|
||||
udc = container_of(_gadget, struct pxa2xx_udc, gadget);
|
||||
udc = container_of(_gadget, struct pxa25x_udc, gadget);
|
||||
udc->vbus = (is_active != 0);
|
||||
DMSG("vbus %s\n", is_active ? "supplied" : "inactive");
|
||||
pullup(udc);
|
||||
|
@ -982,11 +989,11 @@ static int pxa2xx_udc_vbus_session(struct usb_gadget *_gadget, int is_active)
|
|||
}
|
||||
|
||||
/* drivers may have software control over D+ pullup */
|
||||
static int pxa2xx_udc_pullup(struct usb_gadget *_gadget, int is_active)
|
||||
static int pxa25x_udc_pullup(struct usb_gadget *_gadget, int is_active)
|
||||
{
|
||||
struct pxa2xx_udc *udc;
|
||||
struct pxa25x_udc *udc;
|
||||
|
||||
udc = container_of(_gadget, struct pxa2xx_udc, gadget);
|
||||
udc = container_of(_gadget, struct pxa25x_udc, gadget);
|
||||
|
||||
/* not all boards support pullup control */
|
||||
if (!udc->mach->gpio_pullup && !udc->mach->udc_command)
|
||||
|
@ -997,11 +1004,11 @@ static int pxa2xx_udc_pullup(struct usb_gadget *_gadget, int is_active)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct usb_gadget_ops pxa2xx_udc_ops = {
|
||||
.get_frame = pxa2xx_udc_get_frame,
|
||||
.wakeup = pxa2xx_udc_wakeup,
|
||||
.vbus_session = pxa2xx_udc_vbus_session,
|
||||
.pullup = pxa2xx_udc_pullup,
|
||||
static const struct usb_gadget_ops pxa25x_udc_ops = {
|
||||
.get_frame = pxa25x_udc_get_frame,
|
||||
.wakeup = pxa25x_udc_wakeup,
|
||||
.vbus_session = pxa25x_udc_vbus_session,
|
||||
.pullup = pxa25x_udc_pullup,
|
||||
|
||||
// .vbus_draw ... boards may consume current from VBUS, up to
|
||||
// 100-500mA based on config. the 500uA suspend ceiling means
|
||||
|
@ -1015,7 +1022,7 @@ static const struct usb_gadget_ops pxa2xx_udc_ops = {
|
|||
static int
|
||||
udc_seq_show(struct seq_file *m, void *_d)
|
||||
{
|
||||
struct pxa2xx_udc *dev = m->private;
|
||||
struct pxa25x_udc *dev = m->private;
|
||||
unsigned long flags;
|
||||
int i;
|
||||
u32 tmp;
|
||||
|
@ -1076,8 +1083,8 @@ udc_seq_show(struct seq_file *m, void *_d)
|
|||
|
||||
/* dump endpoint queues */
|
||||
for (i = 0; i < PXA_UDC_NUM_ENDPOINTS; i++) {
|
||||
struct pxa2xx_ep *ep = &dev->ep [i];
|
||||
struct pxa2xx_request *req;
|
||||
struct pxa25x_ep *ep = &dev->ep [i];
|
||||
struct pxa25x_request *req;
|
||||
|
||||
if (i != 0) {
|
||||
const struct usb_endpoint_descriptor *desc;
|
||||
|
@ -1150,7 +1157,7 @@ static const struct file_operations debug_fops = {
|
|||
/*
|
||||
* udc_disable - disable USB device controller
|
||||
*/
|
||||
static void udc_disable(struct pxa2xx_udc *dev)
|
||||
static void udc_disable(struct pxa25x_udc *dev)
|
||||
{
|
||||
/* block all irqs */
|
||||
udc_set_mask_UDCCR(UDCCR_SRM|UDCCR_REM);
|
||||
|
@ -1170,7 +1177,7 @@ static void udc_disable(struct pxa2xx_udc *dev)
|
|||
/*
|
||||
* udc_reinit - initialize software state
|
||||
*/
|
||||
static void udc_reinit(struct pxa2xx_udc *dev)
|
||||
static void udc_reinit(struct pxa25x_udc *dev)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
|
@ -1181,7 +1188,7 @@ static void udc_reinit(struct pxa2xx_udc *dev)
|
|||
|
||||
/* basic endpoint records init */
|
||||
for (i = 0; i < PXA_UDC_NUM_ENDPOINTS; i++) {
|
||||
struct pxa2xx_ep *ep = &dev->ep[i];
|
||||
struct pxa25x_ep *ep = &dev->ep[i];
|
||||
|
||||
if (i != 0)
|
||||
list_add_tail (&ep->ep.ep_list, &dev->gadget.ep_list);
|
||||
|
@ -1198,7 +1205,7 @@ static void udc_reinit(struct pxa2xx_udc *dev)
|
|||
/* until it's enabled, this UDC should be completely invisible
|
||||
* to any USB host.
|
||||
*/
|
||||
static void udc_enable (struct pxa2xx_udc *dev)
|
||||
static void udc_enable (struct pxa25x_udc *dev)
|
||||
{
|
||||
udc_clear_mask_UDCCR(UDCCR_UDE);
|
||||
|
||||
|
@ -1254,7 +1261,7 @@ static void udc_enable (struct pxa2xx_udc *dev)
|
|||
*/
|
||||
int usb_gadget_register_driver(struct usb_gadget_driver *driver)
|
||||
{
|
||||
struct pxa2xx_udc *dev = the_controller;
|
||||
struct pxa25x_udc *dev = the_controller;
|
||||
int retval;
|
||||
|
||||
if (!driver
|
||||
|
@ -1299,7 +1306,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
|
|||
EXPORT_SYMBOL(usb_gadget_register_driver);
|
||||
|
||||
static void
|
||||
stop_activity(struct pxa2xx_udc *dev, struct usb_gadget_driver *driver)
|
||||
stop_activity(struct pxa25x_udc *dev, struct usb_gadget_driver *driver)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -1310,7 +1317,7 @@ stop_activity(struct pxa2xx_udc *dev, struct usb_gadget_driver *driver)
|
|||
|
||||
/* prevent new request submissions, kill any outstanding requests */
|
||||
for (i = 0; i < PXA_UDC_NUM_ENDPOINTS; i++) {
|
||||
struct pxa2xx_ep *ep = &dev->ep[i];
|
||||
struct pxa25x_ep *ep = &dev->ep[i];
|
||||
|
||||
ep->stopped = 1;
|
||||
nuke(ep, -ESHUTDOWN);
|
||||
|
@ -1327,7 +1334,7 @@ stop_activity(struct pxa2xx_udc *dev, struct usb_gadget_driver *driver)
|
|||
|
||||
int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
|
||||
{
|
||||
struct pxa2xx_udc *dev = the_controller;
|
||||
struct pxa25x_udc *dev = the_controller;
|
||||
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
@ -1364,7 +1371,7 @@ EXPORT_SYMBOL(usb_gadget_unregister_driver);
|
|||
static irqreturn_t
|
||||
lubbock_vbus_irq(int irq, void *_dev)
|
||||
{
|
||||
struct pxa2xx_udc *dev = _dev;
|
||||
struct pxa25x_udc *dev = _dev;
|
||||
int vbus;
|
||||
|
||||
dev->stats.irqs++;
|
||||
|
@ -1383,7 +1390,7 @@ lubbock_vbus_irq(int irq, void *_dev)
|
|||
return IRQ_NONE;
|
||||
}
|
||||
|
||||
pxa2xx_udc_vbus_session(&dev->gadget, vbus);
|
||||
pxa25x_udc_vbus_session(&dev->gadget, vbus);
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
|
@ -1391,20 +1398,20 @@ lubbock_vbus_irq(int irq, void *_dev)
|
|||
|
||||
static irqreturn_t udc_vbus_irq(int irq, void *_dev)
|
||||
{
|
||||
struct pxa2xx_udc *dev = _dev;
|
||||
struct pxa25x_udc *dev = _dev;
|
||||
int vbus = gpio_get_value(dev->mach->gpio_vbus);
|
||||
|
||||
if (dev->mach->gpio_vbus_inverted)
|
||||
vbus = !vbus;
|
||||
|
||||
pxa2xx_udc_vbus_session(&dev->gadget, vbus);
|
||||
pxa25x_udc_vbus_session(&dev->gadget, vbus);
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
static inline void clear_ep_state (struct pxa2xx_udc *dev)
|
||||
static inline void clear_ep_state (struct pxa25x_udc *dev)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
|
@ -1417,7 +1424,7 @@ static inline void clear_ep_state (struct pxa2xx_udc *dev)
|
|||
|
||||
static void udc_watchdog(unsigned long _dev)
|
||||
{
|
||||
struct pxa2xx_udc *dev = (void *)_dev;
|
||||
struct pxa25x_udc *dev = (void *)_dev;
|
||||
|
||||
local_irq_disable();
|
||||
if (dev->ep0state == EP0_STALL
|
||||
|
@ -1430,11 +1437,11 @@ static void udc_watchdog(unsigned long _dev)
|
|||
local_irq_enable();
|
||||
}
|
||||
|
||||
static void handle_ep0 (struct pxa2xx_udc *dev)
|
||||
static void handle_ep0 (struct pxa25x_udc *dev)
|
||||
{
|
||||
u32 udccs0 = UDCCS0;
|
||||
struct pxa2xx_ep *ep = &dev->ep [0];
|
||||
struct pxa2xx_request *req;
|
||||
struct pxa25x_ep *ep = &dev->ep [0];
|
||||
struct pxa25x_request *req;
|
||||
union {
|
||||
struct usb_ctrlrequest r;
|
||||
u8 raw [8];
|
||||
|
@ -1444,7 +1451,7 @@ static void handle_ep0 (struct pxa2xx_udc *dev)
|
|||
if (list_empty(&ep->queue))
|
||||
req = NULL;
|
||||
else
|
||||
req = list_entry(ep->queue.next, struct pxa2xx_request, queue);
|
||||
req = list_entry(ep->queue.next, struct pxa25x_request, queue);
|
||||
|
||||
/* clear stall status */
|
||||
if (udccs0 & UDCCS0_SST) {
|
||||
|
@ -1654,9 +1661,9 @@ static void handle_ep0 (struct pxa2xx_udc *dev)
|
|||
USIR0 = USIR0_IR0;
|
||||
}
|
||||
|
||||
static void handle_ep(struct pxa2xx_ep *ep)
|
||||
static void handle_ep(struct pxa25x_ep *ep)
|
||||
{
|
||||
struct pxa2xx_request *req;
|
||||
struct pxa25x_request *req;
|
||||
int is_in = ep->bEndpointAddress & USB_DIR_IN;
|
||||
int completed;
|
||||
u32 udccs, tmp;
|
||||
|
@ -1665,7 +1672,7 @@ static void handle_ep(struct pxa2xx_ep *ep)
|
|||
completed = 0;
|
||||
if (likely (!list_empty(&ep->queue)))
|
||||
req = list_entry(ep->queue.next,
|
||||
struct pxa2xx_request, queue);
|
||||
struct pxa25x_request, queue);
|
||||
else
|
||||
req = NULL;
|
||||
|
||||
|
@ -1702,16 +1709,16 @@ static void handle_ep(struct pxa2xx_ep *ep)
|
|||
}
|
||||
|
||||
/*
|
||||
* pxa2xx_udc_irq - interrupt handler
|
||||
* pxa25x_udc_irq - interrupt handler
|
||||
*
|
||||
* avoid delays in ep0 processing. the control handshaking isn't always
|
||||
* under software control (pxa250c0 and the pxa255 are better), and delays
|
||||
* could cause usb protocol errors.
|
||||
*/
|
||||
static irqreturn_t
|
||||
pxa2xx_udc_irq(int irq, void *_dev)
|
||||
pxa25x_udc_irq(int irq, void *_dev)
|
||||
{
|
||||
struct pxa2xx_udc *dev = _dev;
|
||||
struct pxa25x_udc *dev = _dev;
|
||||
int handled;
|
||||
|
||||
dev->stats.irqs++;
|
||||
|
@ -1820,9 +1827,9 @@ static void nop_release (struct device *dev)
|
|||
* doing it at run-time) to save code, eliminate fault paths, and
|
||||
* be more obviously correct.
|
||||
*/
|
||||
static struct pxa2xx_udc memory = {
|
||||
static struct pxa25x_udc memory = {
|
||||
.gadget = {
|
||||
.ops = &pxa2xx_udc_ops,
|
||||
.ops = &pxa25x_udc_ops,
|
||||
.ep0 = &memory.ep[0].ep,
|
||||
.name = driver_name,
|
||||
.dev = {
|
||||
|
@ -1835,7 +1842,7 @@ static struct pxa2xx_udc memory = {
|
|||
.ep[0] = {
|
||||
.ep = {
|
||||
.name = ep0name,
|
||||
.ops = &pxa2xx_ep_ops,
|
||||
.ops = &pxa25x_ep_ops,
|
||||
.maxpacket = EP0_FIFO_SIZE,
|
||||
},
|
||||
.dev = &memory,
|
||||
|
@ -1847,7 +1854,7 @@ static struct pxa2xx_udc memory = {
|
|||
.ep[1] = {
|
||||
.ep = {
|
||||
.name = "ep1in-bulk",
|
||||
.ops = &pxa2xx_ep_ops,
|
||||
.ops = &pxa25x_ep_ops,
|
||||
.maxpacket = BULK_FIFO_SIZE,
|
||||
},
|
||||
.dev = &memory,
|
||||
|
@ -1860,7 +1867,7 @@ static struct pxa2xx_udc memory = {
|
|||
.ep[2] = {
|
||||
.ep = {
|
||||
.name = "ep2out-bulk",
|
||||
.ops = &pxa2xx_ep_ops,
|
||||
.ops = &pxa25x_ep_ops,
|
||||
.maxpacket = BULK_FIFO_SIZE,
|
||||
},
|
||||
.dev = &memory,
|
||||
|
@ -1871,11 +1878,11 @@ static struct pxa2xx_udc memory = {
|
|||
.reg_ubcr = &UBCR2,
|
||||
.reg_uddr = &UDDR2,
|
||||
},
|
||||
#ifndef CONFIG_USB_PXA2XX_SMALL
|
||||
#ifndef CONFIG_USB_PXA25X_SMALL
|
||||
.ep[3] = {
|
||||
.ep = {
|
||||
.name = "ep3in-iso",
|
||||
.ops = &pxa2xx_ep_ops,
|
||||
.ops = &pxa25x_ep_ops,
|
||||
.maxpacket = ISO_FIFO_SIZE,
|
||||
},
|
||||
.dev = &memory,
|
||||
|
@ -1888,7 +1895,7 @@ static struct pxa2xx_udc memory = {
|
|||
.ep[4] = {
|
||||
.ep = {
|
||||
.name = "ep4out-iso",
|
||||
.ops = &pxa2xx_ep_ops,
|
||||
.ops = &pxa25x_ep_ops,
|
||||
.maxpacket = ISO_FIFO_SIZE,
|
||||
},
|
||||
.dev = &memory,
|
||||
|
@ -1902,7 +1909,7 @@ static struct pxa2xx_udc memory = {
|
|||
.ep[5] = {
|
||||
.ep = {
|
||||
.name = "ep5in-int",
|
||||
.ops = &pxa2xx_ep_ops,
|
||||
.ops = &pxa25x_ep_ops,
|
||||
.maxpacket = INT_FIFO_SIZE,
|
||||
},
|
||||
.dev = &memory,
|
||||
|
@ -1917,7 +1924,7 @@ static struct pxa2xx_udc memory = {
|
|||
.ep[6] = {
|
||||
.ep = {
|
||||
.name = "ep6in-bulk",
|
||||
.ops = &pxa2xx_ep_ops,
|
||||
.ops = &pxa25x_ep_ops,
|
||||
.maxpacket = BULK_FIFO_SIZE,
|
||||
},
|
||||
.dev = &memory,
|
||||
|
@ -1930,7 +1937,7 @@ static struct pxa2xx_udc memory = {
|
|||
.ep[7] = {
|
||||
.ep = {
|
||||
.name = "ep7out-bulk",
|
||||
.ops = &pxa2xx_ep_ops,
|
||||
.ops = &pxa25x_ep_ops,
|
||||
.maxpacket = BULK_FIFO_SIZE,
|
||||
},
|
||||
.dev = &memory,
|
||||
|
@ -1944,7 +1951,7 @@ static struct pxa2xx_udc memory = {
|
|||
.ep[8] = {
|
||||
.ep = {
|
||||
.name = "ep8in-iso",
|
||||
.ops = &pxa2xx_ep_ops,
|
||||
.ops = &pxa25x_ep_ops,
|
||||
.maxpacket = ISO_FIFO_SIZE,
|
||||
},
|
||||
.dev = &memory,
|
||||
|
@ -1957,7 +1964,7 @@ static struct pxa2xx_udc memory = {
|
|||
.ep[9] = {
|
||||
.ep = {
|
||||
.name = "ep9out-iso",
|
||||
.ops = &pxa2xx_ep_ops,
|
||||
.ops = &pxa25x_ep_ops,
|
||||
.maxpacket = ISO_FIFO_SIZE,
|
||||
},
|
||||
.dev = &memory,
|
||||
|
@ -1971,7 +1978,7 @@ static struct pxa2xx_udc memory = {
|
|||
.ep[10] = {
|
||||
.ep = {
|
||||
.name = "ep10in-int",
|
||||
.ops = &pxa2xx_ep_ops,
|
||||
.ops = &pxa25x_ep_ops,
|
||||
.maxpacket = INT_FIFO_SIZE,
|
||||
},
|
||||
.dev = &memory,
|
||||
|
@ -1986,7 +1993,7 @@ static struct pxa2xx_udc memory = {
|
|||
.ep[11] = {
|
||||
.ep = {
|
||||
.name = "ep11in-bulk",
|
||||
.ops = &pxa2xx_ep_ops,
|
||||
.ops = &pxa25x_ep_ops,
|
||||
.maxpacket = BULK_FIFO_SIZE,
|
||||
},
|
||||
.dev = &memory,
|
||||
|
@ -1999,7 +2006,7 @@ static struct pxa2xx_udc memory = {
|
|||
.ep[12] = {
|
||||
.ep = {
|
||||
.name = "ep12out-bulk",
|
||||
.ops = &pxa2xx_ep_ops,
|
||||
.ops = &pxa25x_ep_ops,
|
||||
.maxpacket = BULK_FIFO_SIZE,
|
||||
},
|
||||
.dev = &memory,
|
||||
|
@ -2013,7 +2020,7 @@ static struct pxa2xx_udc memory = {
|
|||
.ep[13] = {
|
||||
.ep = {
|
||||
.name = "ep13in-iso",
|
||||
.ops = &pxa2xx_ep_ops,
|
||||
.ops = &pxa25x_ep_ops,
|
||||
.maxpacket = ISO_FIFO_SIZE,
|
||||
},
|
||||
.dev = &memory,
|
||||
|
@ -2026,7 +2033,7 @@ static struct pxa2xx_udc memory = {
|
|||
.ep[14] = {
|
||||
.ep = {
|
||||
.name = "ep14out-iso",
|
||||
.ops = &pxa2xx_ep_ops,
|
||||
.ops = &pxa25x_ep_ops,
|
||||
.maxpacket = ISO_FIFO_SIZE,
|
||||
},
|
||||
.dev = &memory,
|
||||
|
@ -2040,7 +2047,7 @@ static struct pxa2xx_udc memory = {
|
|||
.ep[15] = {
|
||||
.ep = {
|
||||
.name = "ep15in-int",
|
||||
.ops = &pxa2xx_ep_ops,
|
||||
.ops = &pxa25x_ep_ops,
|
||||
.maxpacket = INT_FIFO_SIZE,
|
||||
},
|
||||
.dev = &memory,
|
||||
|
@ -2050,7 +2057,7 @@ static struct pxa2xx_udc memory = {
|
|||
.reg_udccs = &UDCCS15,
|
||||
.reg_uddr = &UDDR15,
|
||||
},
|
||||
#endif /* !CONFIG_USB_PXA2XX_SMALL */
|
||||
#endif /* !CONFIG_USB_PXA25X_SMALL */
|
||||
};
|
||||
|
||||
#define CP15R0_VENDOR_MASK 0xffffe000
|
||||
|
@ -2090,9 +2097,9 @@ static struct pxa2xx_udc memory = {
|
|||
/*
|
||||
* probe - binds to the platform device
|
||||
*/
|
||||
static int __init pxa2xx_udc_probe(struct platform_device *pdev)
|
||||
static int __init pxa25x_udc_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct pxa2xx_udc *dev = &memory;
|
||||
struct pxa25x_udc *dev = &memory;
|
||||
int retval, vbus_irq, irq;
|
||||
u32 chiprev;
|
||||
|
||||
|
@ -2155,7 +2162,7 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev)
|
|||
|
||||
if (dev->mach->gpio_vbus) {
|
||||
if ((retval = gpio_request(dev->mach->gpio_vbus,
|
||||
"pxa2xx_udc GPIO VBUS"))) {
|
||||
"pxa25x_udc GPIO VBUS"))) {
|
||||
dev_dbg(&pdev->dev,
|
||||
"can't get vbus gpio %d, err: %d\n",
|
||||
dev->mach->gpio_vbus, retval);
|
||||
|
@ -2168,7 +2175,7 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev)
|
|||
|
||||
if (dev->mach->gpio_pullup) {
|
||||
if ((retval = gpio_request(dev->mach->gpio_pullup,
|
||||
"pca2xx_udc GPIO PULLUP"))) {
|
||||
"pca25x_udc GPIO PULLUP"))) {
|
||||
dev_dbg(&pdev->dev,
|
||||
"can't get pullup gpio %d, err: %d\n",
|
||||
dev->mach->gpio_pullup, retval);
|
||||
|
@ -2194,7 +2201,7 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev)
|
|||
dev->vbus = is_vbus_present();
|
||||
|
||||
/* irq setup after old hardware state is cleaned up */
|
||||
retval = request_irq(irq, pxa2xx_udc_irq,
|
||||
retval = request_irq(irq, pxa25x_udc_irq,
|
||||
IRQF_DISABLED, driver_name, dev);
|
||||
if (retval != 0) {
|
||||
pr_err("%s: can't get irq %d, err %d\n",
|
||||
|
@ -2260,14 +2267,14 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev)
|
|||
return retval;
|
||||
}
|
||||
|
||||
static void pxa2xx_udc_shutdown(struct platform_device *_dev)
|
||||
static void pxa25x_udc_shutdown(struct platform_device *_dev)
|
||||
{
|
||||
pullup_off();
|
||||
}
|
||||
|
||||
static int __exit pxa2xx_udc_remove(struct platform_device *pdev)
|
||||
static int __exit pxa25x_udc_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct pxa2xx_udc *dev = platform_get_drvdata(pdev);
|
||||
struct pxa25x_udc *dev = platform_get_drvdata(pdev);
|
||||
|
||||
if (dev->driver)
|
||||
return -EBUSY;
|
||||
|
@ -2317,9 +2324,9 @@ static int __exit pxa2xx_udc_remove(struct platform_device *pdev)
|
|||
* VBUS IRQs should probably be ignored so that the PXA device just acts
|
||||
* "dead" to USB hosts until system resume.
|
||||
*/
|
||||
static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state)
|
||||
static int pxa25x_udc_suspend(struct platform_device *dev, pm_message_t state)
|
||||
{
|
||||
struct pxa2xx_udc *udc = platform_get_drvdata(dev);
|
||||
struct pxa25x_udc *udc = platform_get_drvdata(dev);
|
||||
unsigned long flags;
|
||||
|
||||
if (!udc->mach->gpio_pullup && !udc->mach->udc_command)
|
||||
|
@ -2333,9 +2340,9 @@ static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int pxa2xx_udc_resume(struct platform_device *dev)
|
||||
static int pxa25x_udc_resume(struct platform_device *dev)
|
||||
{
|
||||
struct pxa2xx_udc *udc = platform_get_drvdata(dev);
|
||||
struct pxa25x_udc *udc = platform_get_drvdata(dev);
|
||||
unsigned long flags;
|
||||
|
||||
udc->suspended = 0;
|
||||
|
@ -2347,27 +2354,27 @@ static int pxa2xx_udc_resume(struct platform_device *dev)
|
|||
}
|
||||
|
||||
#else
|
||||
#define pxa2xx_udc_suspend NULL
|
||||
#define pxa2xx_udc_resume NULL
|
||||
#define pxa25x_udc_suspend NULL
|
||||
#define pxa25x_udc_resume NULL
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
static struct platform_driver udc_driver = {
|
||||
.shutdown = pxa2xx_udc_shutdown,
|
||||
.remove = __exit_p(pxa2xx_udc_remove),
|
||||
.suspend = pxa2xx_udc_suspend,
|
||||
.resume = pxa2xx_udc_resume,
|
||||
.shutdown = pxa25x_udc_shutdown,
|
||||
.remove = __exit_p(pxa25x_udc_remove),
|
||||
.suspend = pxa25x_udc_suspend,
|
||||
.resume = pxa25x_udc_resume,
|
||||
.driver = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "pxa2xx-udc",
|
||||
.name = "pxa25x-udc",
|
||||
},
|
||||
};
|
||||
|
||||
static int __init udc_init(void)
|
||||
{
|
||||
pr_info("%s: version %s\n", driver_name, DRIVER_VERSION);
|
||||
return platform_driver_probe(&udc_driver, pxa2xx_udc_probe);
|
||||
return platform_driver_probe(&udc_driver, pxa25x_udc_probe);
|
||||
}
|
||||
module_init(udc_init);
|
||||
|
||||
|
@ -2380,4 +2387,4 @@ module_exit(udc_exit);
|
|||
MODULE_DESCRIPTION(DRIVER_DESC);
|
||||
MODULE_AUTHOR("Frank Becker, Robert Schwebel, David Brownell");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS("platform:pxa2xx-udc");
|
||||
MODULE_ALIAS("platform:pxa25x-udc");
|
|
@ -1,6 +1,5 @@
|
|||
/*
|
||||
* linux/drivers/usb/gadget/pxa2xx_udc.h
|
||||
* Intel PXA2xx on-chip full speed USB device controller
|
||||
* Intel PXA25x on-chip full speed USB device controller
|
||||
*
|
||||
* Copyright (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix
|
||||
* Copyright (C) 2003 David Brownell
|
||||
|
@ -21,14 +20,14 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_USB_GADGET_PXA2XX_H
|
||||
#define __LINUX_USB_GADGET_PXA2XX_H
|
||||
#ifndef __LINUX_USB_GADGET_PXA25X_H
|
||||
#define __LINUX_USB_GADGET_PXA25X_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* pxa2xx has this (move to include/asm-arm/arch-pxa/pxa-regs.h) */
|
||||
/* pxa25x has this (move to include/asm-arm/arch-pxa/pxa-regs.h) */
|
||||
#define UFNRH_SIR (1 << 7) /* SOF interrupt request */
|
||||
#define UFNRH_SIM (1 << 6) /* SOF interrupt mask */
|
||||
#define UFNRH_IPE14 (1 << 5) /* ISO packet error, ep14 */
|
||||
|
@ -45,11 +44,11 @@
|
|||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
struct pxa2xx_udc;
|
||||
struct pxa25x_udc;
|
||||
|
||||
struct pxa2xx_ep {
|
||||
struct pxa25x_ep {
|
||||
struct usb_ep ep;
|
||||
struct pxa2xx_udc *dev;
|
||||
struct pxa25x_udc *dev;
|
||||
|
||||
const struct usb_endpoint_descriptor *desc;
|
||||
struct list_head queue;
|
||||
|
@ -72,7 +71,7 @@ struct pxa2xx_ep {
|
|||
volatile u32 *reg_uddr;
|
||||
};
|
||||
|
||||
struct pxa2xx_request {
|
||||
struct pxa25x_request {
|
||||
struct usb_request req;
|
||||
struct list_head queue;
|
||||
};
|
||||
|
@ -98,7 +97,7 @@ struct udc_stats {
|
|||
unsigned long irqs;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_USB_PXA2XX_SMALL
|
||||
#ifdef CONFIG_USB_PXA25X_SMALL
|
||||
/* when memory's tight, SMALL config saves code+data. */
|
||||
#define PXA_UDC_NUM_ENDPOINTS 3
|
||||
#endif
|
||||
|
@ -107,7 +106,7 @@ struct udc_stats {
|
|||
#define PXA_UDC_NUM_ENDPOINTS 16
|
||||
#endif
|
||||
|
||||
struct pxa2xx_udc {
|
||||
struct pxa25x_udc {
|
||||
struct usb_gadget gadget;
|
||||
struct usb_gadget_driver *driver;
|
||||
|
||||
|
@ -130,7 +129,7 @@ struct pxa2xx_udc {
|
|||
struct clk *clk;
|
||||
struct pxa2xx_udc_mach_info *mach;
|
||||
u64 dma_mask;
|
||||
struct pxa2xx_ep ep [PXA_UDC_NUM_ENDPOINTS];
|
||||
struct pxa25x_ep ep [PXA_UDC_NUM_ENDPOINTS];
|
||||
|
||||
#ifdef CONFIG_USB_GADGET_DEBUG_FS
|
||||
struct dentry *debugfs_udc;
|
||||
|
@ -144,7 +143,7 @@ struct pxa2xx_udc {
|
|||
/* lubbock can also report usb connect/disconnect irqs */
|
||||
#endif
|
||||
|
||||
static struct pxa2xx_udc *the_controller;
|
||||
static struct pxa25x_udc *the_controller;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
|
@ -209,7 +208,7 @@ dump_udccs0(const char *label)
|
|||
}
|
||||
|
||||
static void __maybe_unused
|
||||
dump_state(struct pxa2xx_udc *dev)
|
||||
dump_state(struct pxa25x_udc *dev)
|
||||
{
|
||||
u32 tmp;
|
||||
unsigned i;
|
||||
|
@ -264,4 +263,4 @@ dump_state(struct pxa2xx_udc *dev)
|
|||
#define INFO(stuff...) pr_info("udc: " stuff)
|
||||
|
||||
|
||||
#endif /* __LINUX_USB_GADGET_PXA2XX_H */
|
||||
#endif /* __LINUX_USB_GADGET_PXA25X_H */
|
|
@ -38,7 +38,7 @@
|
|||
#include <linux/usb.h>
|
||||
#include <linux/usb/ch9.h>
|
||||
#include <linux/usb/gadget.h>
|
||||
|
||||
#include <asm/arch/pxa2xx-regs.h> /* FIXME: for PSSR */
|
||||
#include <asm/arch/udc.h>
|
||||
|
||||
#include "pxa27x_udc.h"
|
||||
|
@ -2360,18 +2360,19 @@ static int pxa_udc_resume(struct platform_device *_dev)
|
|||
* Software must configure the USB OTG pad, UDC, and UHC
|
||||
* to the state they were in before entering sleep mode.
|
||||
*/
|
||||
PSSR |= PSSR_OTGPH;
|
||||
if (cpu_is_pxa27x())
|
||||
PSSR |= PSSR_OTGPH;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* work with hotplug and coldplug */
|
||||
MODULE_ALIAS("platform:pxa2xx-udc");
|
||||
MODULE_ALIAS("platform:pxa27x-udc");
|
||||
|
||||
static struct platform_driver udc_driver = {
|
||||
.driver = {
|
||||
.name = "pxa2xx-udc",
|
||||
.name = "pxa27x-udc",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.remove = __exit_p(pxa_udc_remove),
|
||||
|
|
|
@ -484,12 +484,4 @@ static inline struct pxa_udc *to_gadget_udc(struct usb_gadget *gadget)
|
|||
#define ep_warn(ep, fmt, arg...) \
|
||||
dev_warn(ep->dev->dev, "%s:%s:" fmt, EPNAME(ep), __func__, ## arg)
|
||||
|
||||
/*
|
||||
* Cannot include pxa-regs.h, as register names are similar.
|
||||
* So PSSR is redefined here. This should be removed once UDC registers will
|
||||
* be gone from pxa-regs.h.
|
||||
*/
|
||||
#define PSSR __REG(0x40F00004) /* Power Manager Sleep Status */
|
||||
#define PSSR_OTGPH (1 << 6) /* OTG Peripheral Hold */
|
||||
|
||||
#endif /* __LINUX_USB_GADGET_PXA27X_H */
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <asm/mach-types.h>
|
||||
#include <asm/hardware.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <asm/arch/pxa2xx-regs.h> /* FIXME: for PSSR */
|
||||
#include <asm/arch/ohci.h>
|
||||
|
||||
#define PXA_UHC_MAX_PORTNUM 3
|
||||
|
@ -104,7 +105,7 @@ static int pxa27x_start_hc(struct device *dev)
|
|||
UHCHIE = (UHCHIE_UPRIE | UHCHIE_RWIE);
|
||||
|
||||
/* Clear any OTG Pin Hold */
|
||||
if (PSSR & PSSR_OTGPH)
|
||||
if (cpu_is_pxa27x() && (PSSR & PSSR_OTGPH))
|
||||
PSSR |= PSSR_OTGPH;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -112,3 +112,10 @@ config BACKLIGHT_CARILLO_RANCH
|
|||
help
|
||||
If you have a Intel LE80578 (Carillo Ranch) say Y to enable the
|
||||
backlight driver.
|
||||
|
||||
config BACKLIGHT_PWM
|
||||
tristate "Generic PWM based Backlight Driver"
|
||||
depends on BACKLIGHT_CLASS_DEVICE && HAVE_PWM
|
||||
help
|
||||
If you have a LCD backlight adjustable by PWM, say Y to enable
|
||||
this driver.
|
||||
|
|
|
@ -10,3 +10,4 @@ obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
|
|||
obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o
|
||||
obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o
|
||||
obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o
|
||||
obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o
|
||||
|
|
185
drivers/video/backlight/pwm_bl.c
Normal file
185
drivers/video/backlight/pwm_bl.c
Normal file
|
@ -0,0 +1,185 @@
|
|||
/*
|
||||
* linux/drivers/video/backlight/pwm_bl.c
|
||||
*
|
||||
* simple PWM based backlight control, board code has to setup
|
||||
* 1) pin configuration so PWM waveforms can output
|
||||
* 2) platform_data casts to the PWM id (0/1/2/3 on PXA)
|
||||
*
|
||||
* 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/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/backlight.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/pwm.h>
|
||||
#include <linux/pwm_backlight.h>
|
||||
|
||||
struct pwm_bl_data {
|
||||
struct pwm_device *pwm;
|
||||
unsigned int period;
|
||||
int (*notify)(int brightness);
|
||||
};
|
||||
|
||||
static int pwm_backlight_update_status(struct backlight_device *bl)
|
||||
{
|
||||
struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
|
||||
int brightness = bl->props.brightness;
|
||||
int max = bl->props.max_brightness;
|
||||
|
||||
if (bl->props.power != FB_BLANK_UNBLANK)
|
||||
brightness = 0;
|
||||
|
||||
if (bl->props.fb_blank != FB_BLANK_UNBLANK)
|
||||
brightness = 0;
|
||||
|
||||
if (pb->notify)
|
||||
brightness = pb->notify(brightness);
|
||||
|
||||
if (brightness == 0) {
|
||||
pwm_config(pb->pwm, 0, pb->period);
|
||||
pwm_disable(pb->pwm);
|
||||
} else {
|
||||
pwm_config(pb->pwm, brightness * pb->period / max, pb->period);
|
||||
pwm_enable(pb->pwm);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pwm_backlight_get_brightness(struct backlight_device *bl)
|
||||
{
|
||||
return bl->props.brightness;
|
||||
}
|
||||
|
||||
static struct backlight_ops pwm_backlight_ops = {
|
||||
.update_status = pwm_backlight_update_status,
|
||||
.get_brightness = pwm_backlight_get_brightness,
|
||||
};
|
||||
|
||||
static int pwm_backlight_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct platform_pwm_backlight_data *data = pdev->dev.platform_data;
|
||||
struct backlight_device *bl;
|
||||
struct pwm_bl_data *pb;
|
||||
int ret;
|
||||
|
||||
if (!data)
|
||||
return -EINVAL;
|
||||
|
||||
if (data->init) {
|
||||
ret = data->init(&pdev->dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
pb = kzalloc(sizeof(*pb), GFP_KERNEL);
|
||||
if (!pb) {
|
||||
ret = -ENOMEM;
|
||||
goto err_alloc;
|
||||
}
|
||||
|
||||
pb->period = data->pwm_period_ns;
|
||||
pb->notify = data->notify;
|
||||
|
||||
pb->pwm = pwm_request(data->pwm_id, "backlight");
|
||||
if (IS_ERR(pb->pwm)) {
|
||||
dev_err(&pdev->dev, "unable to request PWM for backlight\n");
|
||||
ret = PTR_ERR(pb->pwm);
|
||||
goto err_pwm;
|
||||
}
|
||||
|
||||
bl = backlight_device_register(pdev->name, &pdev->dev,
|
||||
pb, &pwm_backlight_ops);
|
||||
if (IS_ERR(bl)) {
|
||||
dev_err(&pdev->dev, "failed to register backlight\n");
|
||||
ret = PTR_ERR(bl);
|
||||
goto err_bl;
|
||||
}
|
||||
|
||||
bl->props.max_brightness = data->max_brightness;
|
||||
bl->props.brightness = data->dft_brightness;
|
||||
backlight_update_status(bl);
|
||||
|
||||
platform_set_drvdata(pdev, bl);
|
||||
return 0;
|
||||
|
||||
err_bl:
|
||||
pwm_free(pb->pwm);
|
||||
err_pwm:
|
||||
kfree(pb);
|
||||
err_alloc:
|
||||
if (data->exit)
|
||||
data->exit(&pdev->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int pwm_backlight_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct platform_pwm_backlight_data *data = pdev->dev.platform_data;
|
||||
struct backlight_device *bl = platform_get_drvdata(pdev);
|
||||
struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
|
||||
|
||||
backlight_device_unregister(bl);
|
||||
pwm_config(pb->pwm, 0, pb->period);
|
||||
pwm_disable(pb->pwm);
|
||||
pwm_free(pb->pwm);
|
||||
kfree(pb);
|
||||
if (data->exit)
|
||||
data->exit(&pdev->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int pwm_backlight_suspend(struct platform_device *pdev,
|
||||
pm_message_t state)
|
||||
{
|
||||
struct backlight_device *bl = platform_get_drvdata(pdev);
|
||||
struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
|
||||
|
||||
pwm_config(pb->pwm, 0, pb->period);
|
||||
pwm_disable(pb->pwm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pwm_backlight_resume(struct platform_device *pdev)
|
||||
{
|
||||
struct backlight_device *bl = platform_get_drvdata(pdev);
|
||||
|
||||
backlight_update_status(bl);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#define pwm_backlight_suspend NULL
|
||||
#define pwm_backlight_resume NULL
|
||||
#endif
|
||||
|
||||
static struct platform_driver pwm_backlight_driver = {
|
||||
.driver = {
|
||||
.name = "pwm-backlight",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = pwm_backlight_probe,
|
||||
.remove = pwm_backlight_remove,
|
||||
.suspend = pwm_backlight_suspend,
|
||||
.resume = pwm_backlight_resume,
|
||||
};
|
||||
|
||||
static int __init pwm_backlight_init(void)
|
||||
{
|
||||
return platform_driver_register(&pwm_backlight_driver);
|
||||
}
|
||||
module_init(pwm_backlight_init);
|
||||
|
||||
static void __exit pwm_backlight_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&pwm_backlight_driver);
|
||||
}
|
||||
module_exit(pwm_backlight_exit);
|
||||
|
||||
MODULE_DESCRIPTION("PWM based Backlight Driver");
|
||||
MODULE_LICENSE("GPL");
|
|
@ -227,6 +227,22 @@ static int pxafb_bpp_to_lccr3(struct fb_var_screeninfo *var)
|
|||
case 4: ret = LCCR3_4BPP; break;
|
||||
case 8: ret = LCCR3_8BPP; break;
|
||||
case 16: ret = LCCR3_16BPP; break;
|
||||
case 24:
|
||||
switch (var->red.length + var->green.length +
|
||||
var->blue.length + var->transp.length) {
|
||||
case 18: ret = LCCR3_18BPP_P | LCCR3_PDFOR_3; break;
|
||||
case 19: ret = LCCR3_19BPP_P; break;
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
switch (var->red.length + var->green.length +
|
||||
var->blue.length + var->transp.length) {
|
||||
case 18: ret = LCCR3_18BPP | LCCR3_PDFOR_3; break;
|
||||
case 19: ret = LCCR3_19BPP; break;
|
||||
case 24: ret = LCCR3_24BPP | LCCR3_PDFOR_3; break;
|
||||
case 25: ret = LCCR3_25BPP; break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -345,6 +361,41 @@ static int pxafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
|
|||
var->green.offset = 5; var->green.length = 6;
|
||||
var->blue.offset = 0; var->blue.length = 5;
|
||||
var->transp.offset = var->transp.length = 0;
|
||||
} else if (var->bits_per_pixel > 16) {
|
||||
struct pxafb_mode_info *mode;
|
||||
|
||||
mode = pxafb_getmode(inf, var);
|
||||
if (!mode)
|
||||
return -EINVAL;
|
||||
|
||||
switch (mode->depth) {
|
||||
case 18: /* RGB666 */
|
||||
var->transp.offset = var->transp.length = 0;
|
||||
var->red.offset = 12; var->red.length = 6;
|
||||
var->green.offset = 6; var->green.length = 6;
|
||||
var->blue.offset = 0; var->blue.length = 6;
|
||||
break;
|
||||
case 19: /* RGBT666 */
|
||||
var->transp.offset = 18; var->transp.length = 1;
|
||||
var->red.offset = 12; var->red.length = 6;
|
||||
var->green.offset = 6; var->green.length = 6;
|
||||
var->blue.offset = 0; var->blue.length = 6;
|
||||
break;
|
||||
case 24: /* RGB888 */
|
||||
var->transp.offset = var->transp.length = 0;
|
||||
var->red.offset = 16; var->red.length = 8;
|
||||
var->green.offset = 8; var->green.length = 8;
|
||||
var->blue.offset = 0; var->blue.length = 8;
|
||||
break;
|
||||
case 25: /* RGBT888 */
|
||||
var->transp.offset = 24; var->transp.length = 1;
|
||||
var->red.offset = 16; var->red.length = 8;
|
||||
var->green.offset = 8; var->green.length = 8;
|
||||
var->blue.offset = 0; var->blue.length = 8;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
} else {
|
||||
var->red.offset = var->green.offset = 0;
|
||||
var->blue.offset = var->transp.offset = 0;
|
||||
|
@ -376,7 +427,7 @@ static int pxafb_set_par(struct fb_info *info)
|
|||
struct pxafb_info *fbi = (struct pxafb_info *)info;
|
||||
struct fb_var_screeninfo *var = &info->var;
|
||||
|
||||
if (var->bits_per_pixel == 16)
|
||||
if (var->bits_per_pixel >= 16)
|
||||
fbi->fb.fix.visual = FB_VISUAL_TRUECOLOR;
|
||||
else if (!fbi->cmap_static)
|
||||
fbi->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR;
|
||||
|
@ -391,7 +442,7 @@ static int pxafb_set_par(struct fb_info *info)
|
|||
|
||||
fbi->fb.fix.line_length = var->xres_virtual *
|
||||
var->bits_per_pixel / 8;
|
||||
if (var->bits_per_pixel == 16)
|
||||
if (var->bits_per_pixel >= 16)
|
||||
fbi->palette_size = 0;
|
||||
else
|
||||
fbi->palette_size = var->bits_per_pixel == 1 ?
|
||||
|
@ -404,7 +455,7 @@ static int pxafb_set_par(struct fb_info *info)
|
|||
*/
|
||||
pxafb_set_truecolor(fbi->fb.fix.visual == FB_VISUAL_TRUECOLOR);
|
||||
|
||||
if (fbi->fb.var.bits_per_pixel == 16)
|
||||
if (fbi->fb.var.bits_per_pixel >= 16)
|
||||
fb_dealloc_cmap(&fbi->fb.cmap);
|
||||
else
|
||||
fb_alloc_cmap(&fbi->fb.cmap, 1<<fbi->fb.var.bits_per_pixel, 0);
|
||||
|
@ -831,6 +882,8 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var,
|
|||
case 4:
|
||||
case 8:
|
||||
case 16:
|
||||
case 24:
|
||||
case 32:
|
||||
break;
|
||||
default:
|
||||
printk(KERN_ERR "%s: invalid bit depth %d\n",
|
||||
|
@ -968,6 +1021,11 @@ static void pxafb_setup_gpio(struct pxafb_info *fbi)
|
|||
|
||||
for (gpio = 58; ldd_bits; gpio++, ldd_bits--)
|
||||
pxa_gpio_mode(gpio | GPIO_ALT_FN_2_OUT);
|
||||
/* 18 bit interface */
|
||||
if (fbi->fb.var.bits_per_pixel > 16) {
|
||||
pxa_gpio_mode(86 | GPIO_ALT_FN_2_OUT);
|
||||
pxa_gpio_mode(87 | GPIO_ALT_FN_2_OUT);
|
||||
}
|
||||
pxa_gpio_mode(GPIO74_LCD_FCLK_MD);
|
||||
pxa_gpio_mode(GPIO75_LCD_LCLK_MD);
|
||||
pxa_gpio_mode(GPIO76_LCD_PCLK_MD);
|
||||
|
@ -1792,11 +1850,49 @@ static int __devinit pxafb_probe(struct platform_device *dev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int __devexit pxafb_remove(struct platform_device *dev)
|
||||
{
|
||||
struct pxafb_info *fbi = platform_get_drvdata(dev);
|
||||
struct resource *r;
|
||||
int irq;
|
||||
struct fb_info *info;
|
||||
|
||||
if (!fbi)
|
||||
return 0;
|
||||
|
||||
info = &fbi->fb;
|
||||
|
||||
unregister_framebuffer(info);
|
||||
|
||||
pxafb_disable_controller(fbi);
|
||||
|
||||
if (fbi->fb.cmap.len)
|
||||
fb_dealloc_cmap(&fbi->fb.cmap);
|
||||
|
||||
irq = platform_get_irq(dev, 0);
|
||||
free_irq(irq, fbi);
|
||||
|
||||
dma_free_writecombine(&dev->dev, fbi->map_size,
|
||||
fbi->map_cpu, fbi->map_dma);
|
||||
|
||||
iounmap(fbi->mmio_base);
|
||||
|
||||
r = platform_get_resource(dev, IORESOURCE_MEM, 0);
|
||||
release_mem_region(r->start, r->end - r->start + 1);
|
||||
|
||||
clk_put(fbi->clk);
|
||||
kfree(fbi);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver pxafb_driver = {
|
||||
.probe = pxafb_probe,
|
||||
.remove = pxafb_remove,
|
||||
.suspend = pxafb_suspend,
|
||||
.resume = pxafb_resume,
|
||||
.driver = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "pxa2xx-fb",
|
||||
},
|
||||
};
|
||||
|
@ -1809,7 +1905,13 @@ static int __init pxafb_init(void)
|
|||
return platform_driver_register(&pxafb_driver);
|
||||
}
|
||||
|
||||
static void __exit pxafb_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&pxafb_driver);
|
||||
}
|
||||
|
||||
module_init(pxafb_init);
|
||||
module_exit(pxafb_exit);
|
||||
|
||||
MODULE_DESCRIPTION("loadable framebuffer driver for PXA");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
@ -12,4 +12,6 @@ typedef struct {
|
|||
void *priv;
|
||||
} pxa2xx_audio_ops_t;
|
||||
|
||||
extern void pxa_set_ac97_info(pxa2xx_audio_ops_t *ops);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* linux/include/asm/arch-pxa/cm-x270.h
|
||||
*
|
||||
* Copyright Compulab Ltd., 2003, 2007
|
||||
* Mike Rapoport <mike@compulab.co.il>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
/* CM-x270 device physical addresses */
|
||||
#define CMX270_CS1_PHYS (PXA_CS1_PHYS)
|
||||
#define MARATHON_PHYS (PXA_CS2_PHYS)
|
||||
#define CMX270_IDE104_PHYS (PXA_CS3_PHYS)
|
||||
#define CMX270_IT8152_PHYS (PXA_CS4_PHYS)
|
||||
|
||||
/* Statically mapped regions */
|
||||
#define CMX270_VIRT_BASE (0xe8000000)
|
||||
#define CMX270_IT8152_VIRT (CMX270_VIRT_BASE)
|
||||
#define CMX270_IDE104_VIRT (CMX270_IT8152_VIRT + SZ_64M)
|
||||
|
||||
/* GPIO related definitions */
|
||||
#define GPIO_IT8152_IRQ (22)
|
||||
|
||||
#define IRQ_GPIO_IT8152_IRQ IRQ_GPIO(GPIO_IT8152_IRQ)
|
||||
#define PME_IRQ IRQ_GPIO(0)
|
||||
#define CMX270_IDE_IRQ IRQ_GPIO(100)
|
||||
#define CMX270_GPIRQ1 IRQ_GPIO(101)
|
||||
#define CMX270_TOUCHIRQ IRQ_GPIO(96)
|
||||
#define CMX270_ETHIRQ IRQ_GPIO(10)
|
||||
#define CMX270_GFXIRQ IRQ_GPIO(95)
|
||||
#define CMX270_NANDIRQ IRQ_GPIO(89)
|
||||
#define CMX270_MMC_IRQ IRQ_GPIO(83)
|
||||
|
||||
/* PCMCIA related definitions */
|
||||
#define PCC_DETECT(x) (GPLR(84 - (x)) & GPIO_bit(84 - (x)))
|
||||
#define PCC_READY(x) (GPLR(82 - (x)) & GPIO_bit(82 - (x)))
|
||||
|
||||
#define PCMCIA_S0_CD_VALID IRQ_GPIO(84)
|
||||
#define PCMCIA_S0_CD_VALID_EDGE GPIO_BOTH_EDGES
|
||||
|
||||
#define PCMCIA_S1_CD_VALID IRQ_GPIO(83)
|
||||
#define PCMCIA_S1_CD_VALID_EDGE GPIO_BOTH_EDGES
|
||||
|
||||
#define PCMCIA_S0_RDYINT IRQ_GPIO(82)
|
||||
#define PCMCIA_S1_RDYINT IRQ_GPIO(81)
|
||||
|
||||
#define PCMCIA_RESET_GPIO 53
|
50
include/asm-arm/arch-pxa/eseries-gpio.h
Normal file
50
include/asm-arm/arch-pxa/eseries-gpio.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* eseries-gpio.h
|
||||
*
|
||||
* Copyright (C) Ian Molton <spyro@f2s.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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* e-series power button */
|
||||
#define GPIO_ESERIES_POWERBTN 0
|
||||
|
||||
/* UDC GPIO definitions */
|
||||
#define GPIO_E7XX_USB_DISC 13
|
||||
#define GPIO_E7XX_USB_PULLUP 3
|
||||
|
||||
#define GPIO_E800_USB_DISC 4
|
||||
#define GPIO_E800_USB_PULLUP 84
|
||||
|
||||
/* e740 PCMCIA GPIO definitions */
|
||||
/* Note: PWR1 seems to be inverted */
|
||||
#define GPIO_E740_PCMCIA_CD0 8
|
||||
#define GPIO_E740_PCMCIA_CD1 44
|
||||
#define GPIO_E740_PCMCIA_RDY0 11
|
||||
#define GPIO_E740_PCMCIA_RDY1 6
|
||||
#define GPIO_E740_PCMCIA_RST0 27
|
||||
#define GPIO_E740_PCMCIA_RST1 24
|
||||
#define GPIO_E740_PCMCIA_PWR0 20
|
||||
#define GPIO_E740_PCMCIA_PWR1 23
|
||||
|
||||
/* e750 PCMCIA GPIO definitions */
|
||||
#define GPIO_E750_PCMCIA_CD0 8
|
||||
#define GPIO_E750_PCMCIA_RDY0 12
|
||||
#define GPIO_E750_PCMCIA_RST0 27
|
||||
#define GPIO_E750_PCMCIA_PWR0 20
|
||||
|
||||
/* e800 PCMCIA GPIO definitions */
|
||||
#define GPIO_E800_PCMCIA_RST0 69
|
||||
#define GPIO_E800_PCMCIA_RST1 72
|
||||
#define GPIO_E800_PCMCIA_PWR0 20
|
||||
#define GPIO_E800_PCMCIA_PWR1 73
|
||||
|
||||
/* e7xx IrDA power control */
|
||||
#define GPIO_E7XX_IR_ON 38
|
||||
|
||||
/* ASIC related GPIOs */
|
||||
#define GPIO_ESERIES_TMIO_IRQ 5
|
||||
#define GPIO_E800_ANGELX_IRQ 8
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue