Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
4aa12f7b
Commit
4aa12f7b
authored
Jan 05, 2009
by
Benjamin Herrenschmidt
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit 'kumar/kumar-next' into next
parents
b58602a4
068e8c9d
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
686 additions
and
71 deletions
+686
-71
Documentation/powerpc/dts-bindings/fsl/board.txt
Documentation/powerpc/dts-bindings/fsl/board.txt
+31
-1
arch/powerpc/boot/dts/mpc836x_mds.dts
arch/powerpc/boot/dts/mpc836x_mds.dts
+41
-2
arch/powerpc/boot/dts/mpc836x_rdk.dts
arch/powerpc/boot/dts/mpc836x_rdk.dts
+17
-2
arch/powerpc/boot/dts/mpc8641_hpcn.dts
arch/powerpc/boot/dts/mpc8641_hpcn.dts
+32
-24
arch/powerpc/configs/85xx/mpc8572_ds_defconfig
arch/powerpc/configs/85xx/mpc8572_ds_defconfig
+28
-15
arch/powerpc/include/asm/qe.h
arch/powerpc/include/asm/qe.h
+35
-2
arch/powerpc/include/asm/qe_ic.h
arch/powerpc/include/asm/qe_ic.h
+17
-4
arch/powerpc/platforms/83xx/mpc831x_rdb.c
arch/powerpc/platforms/83xx/mpc831x_rdb.c
+1
-1
arch/powerpc/platforms/83xx/mpc832x_mds.c
arch/powerpc/platforms/83xx/mpc832x_mds.c
+4
-5
arch/powerpc/platforms/83xx/mpc832x_rdb.c
arch/powerpc/platforms/83xx/mpc832x_rdb.c
+3
-2
arch/powerpc/platforms/83xx/mpc836x_mds.c
arch/powerpc/platforms/83xx/mpc836x_mds.c
+78
-3
arch/powerpc/platforms/83xx/mpc836x_rdk.c
arch/powerpc/platforms/83xx/mpc836x_rdk.c
+4
-2
arch/powerpc/platforms/83xx/mpc837x_mds.c
arch/powerpc/platforms/83xx/mpc837x_mds.c
+0
-1
arch/powerpc/platforms/83xx/mpc837x_rdb.c
arch/powerpc/platforms/83xx/mpc837x_rdb.c
+0
-2
arch/powerpc/platforms/83xx/mpc83xx.h
arch/powerpc/platforms/83xx/mpc83xx.h
+1
-0
arch/powerpc/platforms/85xx/mpc85xx_ds.c
arch/powerpc/platforms/85xx/mpc85xx_ds.c
+7
-0
arch/powerpc/platforms/85xx/smp.c
arch/powerpc/platforms/85xx/smp.c
+1
-0
arch/powerpc/platforms/Kconfig
arch/powerpc/platforms/Kconfig
+11
-0
arch/powerpc/platforms/Kconfig.cputype
arch/powerpc/platforms/Kconfig.cputype
+1
-1
arch/powerpc/sysdev/Makefile
arch/powerpc/sysdev/Makefile
+1
-0
arch/powerpc/sysdev/fsl_pci.c
arch/powerpc/sysdev/fsl_pci.c
+4
-3
arch/powerpc/sysdev/fsl_soc.h
arch/powerpc/sysdev/fsl_soc.h
+5
-0
arch/powerpc/sysdev/qe_lib/Kconfig
arch/powerpc/sysdev/qe_lib/Kconfig
+2
-1
arch/powerpc/sysdev/qe_lib/gpio.c
arch/powerpc/sysdev/qe_lib/gpio.c
+195
-0
arch/powerpc/sysdev/simple_gpio.c
arch/powerpc/sysdev/simple_gpio.c
+155
-0
arch/powerpc/sysdev/simple_gpio.h
arch/powerpc/sysdev/simple_gpio.h
+12
-0
No files found.
Documentation/powerpc/dts-bindings/fsl/board.txt
View file @
4aa12f7b
...
...
@@ -18,7 +18,7 @@ This is the memory-mapped registers for on board FPGA.
Required properities:
- compatible : should be "fsl,fpga-pixis".
- reg : should contain the address and the leng
ht
of the FPPGA register
- reg : should contain the address and the leng
th
of the FPPGA register
set.
Example (MPC8610HPCD):
...
...
@@ -27,3 +27,33 @@ Example (MPC8610HPCD):
compatible = "fsl,fpga-pixis";
reg = <0xe8000000 32>;
};
* Freescale BCSR GPIO banks
Some BCSR registers act as simple GPIO controllers, each such
register can be represented by the gpio-controller node.
Required properities:
- compatible : Should be "fsl,<board>-bcsr-gpio".
- reg : Should contain the address and the length of the GPIO bank
register.
- #gpio-cells : Should be two. The first cell is the pin number and the
second cell is used to specify optional paramters (currently unused).
- gpio-controller : Marks the port as GPIO controller.
Example:
bcsr@1,0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,mpc8360mds-bcsr";
reg = <1 0 0x8000>;
ranges = <0 1 0 0x8000>;
bcsr13: gpio-controller@d {
#gpio-cells = <2>;
compatible = "fsl,mpc8360mds-bcsr-gpio";
reg = <0xd 1>;
gpio-controller;
};
};
arch/powerpc/boot/dts/mpc836x_mds.dts
View file @
4aa12f7b
...
...
@@ -69,8 +69,18 @@ flash@0,0 {
};
bcsr
@
1
,
0
{
#
address
-
cells
=
<
1
>;
#
size
-
cells
=
<
1
>;
compatible
=
"fsl,mpc8360mds-bcsr"
;
reg
=
<
1
0
0x8000
>;
ranges
=
<
0
1
0
0x8000
>;
bcsr13
:
gpio
-
controller
@
d
{
#
gpio
-
cells
=
<
2
>;
compatible
=
"fsl,mpc8360mds-bcsr-gpio"
;
reg
=
<
0xd
1
>;
gpio
-
controller
;
};
};
};
...
...
@@ -195,10 +205,21 @@ ipic: pic@700 {
};
par_io
@
1400
{
#
address
-
cells
=
<
1
>;
#
size
-
cells
=
<
1
>;
reg
=
<
0x1400
0x100
>;
ranges
=
<
0
0x1400
0x100
>;
device_type
=
"par_io"
;
num
-
ports
=
<
7
>;
qe_pio_b
:
gpio
-
controller
@
18
{
#
gpio
-
cells
=
<
2
>;
compatible
=
"fsl,mpc8360-qe-pario-bank"
,
"fsl,mpc8323-qe-pario-bank"
;
reg
=
<
0x18
0x18
>;
gpio
-
controller
;
};
pio1
:
ucc_pin
@
01
{
pio
-
map
=
<
/*
port
pin
dir
open_drain
assignment
has_irq
*/
...
...
@@ -282,6 +303,15 @@ data-only@0 {
};
};
timer
@
440
{
compatible
=
"fsl,mpc8360-qe-gtm"
,
"fsl,qe-gtm"
,
"fsl,gtm"
;
reg
=
<
0x440
0x40
>;
clock
-
frequency
=
<
132000000
>;
interrupts
=
<
12
13
14
15
>;
interrupt
-
parent
=
<&
qeic
>;
};
spi
@
4
c0
{
cell
-
index
=
<
0
>;
compatible
=
"fsl,spi"
;
...
...
@@ -301,11 +331,20 @@ spi@500 {
};
usb
@
6
c0
{
compatible
=
"qe_udc"
;
compatible
=
"fsl,mpc8360-qe-usb"
,
"fsl,mpc8323-qe-usb"
;
reg
=
<
0x6c0
0x40
0x8b00
0x100
>;
interrupts
=
<
11
>;
interrupt
-
parent
=
<&
qeic
>;
mode
=
"slave"
;
fsl
,
fullspeed
-
clock
=
"clk21"
;
fsl
,
lowspeed
-
clock
=
"brg9"
;
gpios
=
<&
qe_pio_b
2
0
/*
USBOE
*/
&
qe_pio_b
3
0
/*
USBTP
*/
&
qe_pio_b
8
0
/*
USBTN
*/
&
qe_pio_b
9
0
/*
USBRP
*/
&
qe_pio_b
11
0
/*
USBRN
*/
&
bcsr13
5
0
/*
SPEED
*/
&
bcsr13
4
1
>;
/*
POWER
*/
};
enet0
:
ucc
@
2000
{
...
...
arch/powerpc/boot/dts/mpc836x_rdk.dts
View file @
4aa12f7b
...
...
@@ -218,8 +218,23 @@ timer@440 {
reg = <0x440 0x40>;
interrupts = <12 13 14 15>;
interrupt-parent = <&qeic>;
/* filled by u-boot */
clock-frequency = <0>;
clock-frequency = <166666666>;
};
usb@6c0 {
compatible = "fsl,mpc8360-qe-usb",
"fsl,mpc8323-qe-usb";
reg = <0x6c0 0x40 0x8b00 0x100>;
interrupts = <11>;
interrupt-parent = <&qeic>;
fsl,fullspeed-clock = "clk21";
gpios = <&qe_pio_b 2 0 /* USBOE */
&qe_pio_b 3 0 /* USBTP */
&qe_pio_b 8 0 /* USBTN */
&qe_pio_b 9 0 /* USBRP */
&qe_pio_b 11 0 /* USBRN */
&qe_pio_e 20 0 /* SPEED */
&qe_pio_e 21 1 /* POWER */>;
};
spi@4c0 {
...
...
arch/powerpc/boot/dts/mpc8641_hpcn.dts
View file @
4aa12f7b
...
...
@@ -26,7 +26,13 @@ aliases {
serial1
=
&
serial1
;
pci0
=
&
pci0
;
pci1
=
&
pci1
;
rapidio0
=
&
rapidio0
;
/*
*
Only
one
of
Rapid
IO
or
PCI
can
be
present
due
to
HW
limitations
and
*
due
to
the
fact
that
the
2
now
share
address
space
in
the
new
memory
*
map
.
The
most
likely
case
is
that
we
have
PCI
,
so
comment
out
the
*
rapidio
node
.
Leave
it
here
for
reference
.
*/
/*
rapidio0
=
&
rapidio0
;
*/
};
cpus
{
...
...
@@ -62,18 +68,17 @@ memory {
reg
=
<
0x00000000
0x40000000
>;
//
1
G
at
0x0
};
localbus
@
f
80
05000
{
localbus
@
f
fe
05000
{
#
address
-
cells
=
<
2
>;
#
size
-
cells
=
<
1
>;
compatible
=
"fsl,mpc8641-localbus"
,
"simple-bus"
;
reg
=
<
0xf
80
05000
0x1000
>;
reg
=
<
0xf
fe
05000
0x1000
>;
interrupts
=
<
19
2
>;
interrupt
-
parent
=
<&
mpic
>;
ranges
=
<
0
0
0xff800000
0x00800000
1
0
0xfe000000
0x01000000
2
0
0xf8200000
0x00100000
3
0
0xf8100000
0x00100000
>;
ranges
=
<
0
0
0xef800000
0x00800000
2
0
0xffdf8000
0x00008000
3
0
0xffdf0000
0x00008000
>;
flash
@
0
,
0
{
compatible
=
"cfi-flash"
;
...
...
@@ -103,13 +108,13 @@ partition@700000 {
};
};
soc8641
@
f
80
00000
{
soc8641
@
f
fe
00000
{
#
address
-
cells
=
<
1
>;
#
size
-
cells
=
<
1
>;
device_type
=
"soc"
;
compatible
=
"simple-bus"
;
ranges
=
<
0x00000000
0xf
80
00000
0x00100000
>;
reg
=
<
0xf
80
00000
0x00001000
>;
//
CCSRBAR
ranges
=
<
0x00000000
0xf
fe
00000
0x00100000
>;
reg
=
<
0xf
fe
00000
0x00001000
>;
//
CCSRBAR
bus
-
frequency
=
<
0
>;
i2c
@
3000
{
...
...
@@ -340,17 +345,17 @@ global-utilities@e0000 {
};
};
pci0
:
pcie
@
f
80
08000
{
pci0
:
pcie
@
f
fe
08000
{
cell
-
index
=
<
0
>;
compatible
=
"fsl,mpc8641-pcie"
;
device_type
=
"pci"
;
#
interrupt
-
cells
=
<
1
>;
#
size
-
cells
=
<
2
>;
#
address
-
cells
=
<
3
>;
reg
=
<
0xf
80
08000
0x1000
>;
reg
=
<
0xf
fe
08000
0x1000
>;
bus
-
range
=
<
0x0
0xff
>;
ranges
=
<
0x02000000
0x0
0x80000000
0x80000000
0x0
0x20000000
0x01000000
0x0
0x00000000
0x
e2000000
0x0
0x0010
0000
>;
0x01000000
0x0
0x00000000
0x
ffc00000
0x0
0x0001
0000
>;
clock
-
frequency
=
<
33333333
>;
interrupt
-
parent
=
<&
mpic
>;
interrupts
=
<
24
2
>;
...
...
@@ -481,7 +486,7 @@ pcie@0 {
0x01000000
0x0
0x00000000
0x01000000
0x0
0x00000000
0x0
0x00
10
0000
>;
0x0
0x00
01
0000
>;
uli1575
@
0
{
reg
=
<
0
0
0
0
0
>;
#
size
-
cells
=
<
2
>;
...
...
@@ -491,7 +496,7 @@ uli1575@0 {
0x0
0x20000000
0x01000000
0x0
0x00000000
0x01000000
0x0
0x00000000
0x0
0x00
10
0000
>;
0x0
0x00
01
0000
>;
isa
@
1
e
{
device_type
=
"isa"
;
#
interrupt
-
cells
=
<
2
>;
...
...
@@ -549,17 +554,17 @@ gpio@400 {
};
pci1
:
pcie
@
f
80
09000
{
pci1
:
pcie
@
f
fe
09000
{
cell
-
index
=
<
1
>;
compatible
=
"fsl,mpc8641-pcie"
;
device_type
=
"pci"
;
#
interrupt
-
cells
=
<
1
>;
#
size
-
cells
=
<
2
>;
#
address
-
cells
=
<
3
>;
reg
=
<
0xf
80
09000
0x1000
>;
reg
=
<
0xf
fe
09000
0x1000
>;
bus
-
range
=
<
0
0xff
>;
ranges
=
<
0x02000000
0x0
0xa0000000
0xa0000000
0x0
0x20000000
0x01000000
0x0
0x00000000
0x
e3000000
0x0
0x0010
0000
>;
0x01000000
0x0
0x00000000
0x
ffc10000
0x0
0x0001
0000
>;
clock
-
frequency
=
<
33333333
>;
interrupt
-
parent
=
<&
mpic
>;
interrupts
=
<
25
2
>;
...
...
@@ -582,18 +587,21 @@ pcie@0 {
0x01000000
0x0
0x00000000
0x01000000
0x0
0x00000000
0x0
0x00
10
0000
>;
0x0
0x00
01
0000
>;
};
};
rapidio0
:
rapidio
@
f80c0000
{
/*
rapidio0
:
rapidio
@
ffec0000
{
#
address
-
cells
=
<
2
>;
#
size
-
cells
=
<
2
>;
compatible
=
"fsl,rapidio-delta"
;
reg
=
<
0xf
80
c0000
0x20000
>;
ranges
=
<
0
0
0x
c
0000000
0
0x20000000
>;
reg
=
<
0xf
fe
c0000
0x20000
>;
ranges
=
<
0
0
0x
8
0000000
0
0x20000000
>;
interrupt
-
parent
=
<&
mpic
>;
/
*
err_irq
bell_outb_irq
bell_inb_irq
msg1_tx_irq
msg1_rx_irq
msg2_tx_irq
msg2_rx_irq
*/
/
/
err_irq
bell_outb_irq
bell_inb_irq
//
msg1_tx_irq
msg1_rx_irq
msg2_tx_irq
msg2_rx_irq
interrupts
=
<
48
2
49
2
50
2
53
2
54
2
55
2
56
2
>;
};
*/
};
arch/powerpc/configs/85xx/mpc8572_ds_defconfig
View file @
4aa12f7b
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.28-rc
3
#
Sat Nov 8 12:40:13
2008
# Linux kernel version: 2.6.28-rc
8
#
Tue Dec 30 11:17:46
2008
#
# CONFIG_PPC64 is not set
...
...
@@ -21,7 +21,10 @@ CONFIG_FSL_BOOKE=y
CONFIG_FSL_EMB_PERFMON=y
# CONFIG_PHYS_64BIT is not set
CONFIG_SPE=y
CONFIG_PPC_MMU_NOHASH=y
# CONFIG_PPC_MM_SLICES is not set
CONFIG_SMP=y
CONFIG_NR_CPUS=2
CONFIG_PPC32=y
CONFIG_WORD_SIZE=32
# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
...
...
@@ -50,7 +53,7 @@ CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_PPC_OF=y
CONFIG_OF=y
CONFIG_PPC_UDBG_16550=y
# CONFIG_GENERIC_TBSYNC is not set
CONFIG_GENERIC_TBSYNC=y
CONFIG_AUDIT_ARCH=y
CONFIG_GENERIC_BUG=y
CONFIG_DEFAULT_UIMAGE=y
...
...
@@ -62,7 +65,7 @@ CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
# General setup
#
CONFIG_EXPERIMENTAL=y
CONFIG_
BROKEN_ON_SMP
=y
CONFIG_
LOCK_KERNEL
=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
...
...
@@ -126,6 +129,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
CONFIG_HAVE_KPROBES=y
CONFIG_HAVE_KRETPROBES=y
CONFIG_HAVE_ARCH_TRACEHOOK=y
CONFIG_USE_GENERIC_SMP_HELPERS=y
# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
CONFIG_SLABINFO=y
CONFIG_RT_MUTEXES=y
...
...
@@ -138,6 +142,7 @@ CONFIG_MODULE_FORCE_UNLOAD=y
CONFIG_MODVERSIONS=y
# CONFIG_MODULE_SRCVERSION_ALL is not set
CONFIG_KMOD=y
CONFIG_STOP_MACHINE=y
CONFIG_BLOCK=y
CONFIG_LBD=y
# CONFIG_BLK_DEV_IO_TRACE is not set
...
...
@@ -197,6 +202,7 @@ CONFIG_PPC_I8259=y
# CONFIG_CPM2 is not set
CONFIG_FSL_ULI1575=y
# CONFIG_MPC8xxx_GPIO is not set
# CONFIG_SIMPLE_GPIO is not set
#
# Kernel options
...
...
@@ -224,6 +230,7 @@ CONFIG_MATH_EMULATION=y
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
CONFIG_ARCH_HAS_WALK_MEMORY=y
CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
# CONFIG_IRQ_ALL_CPUS is not set
CONFIG_ARCH_FLATMEM_ENABLE=y
CONFIG_ARCH_POPULATES_NODE_MAP=y
CONFIG_SELECT_MEMORY_MODEL=y
...
...
@@ -241,6 +248,9 @@ CONFIG_ZONE_DMA_FLAG=1
CONFIG_BOUNCE=y
CONFIG_VIRT_TO_BUS=y
CONFIG_UNEVICTABLE_LRU=y
CONFIG_PPC_4K_PAGES=y
# CONFIG_PPC_16K_PAGES is not set
# CONFIG_PPC_64K_PAGES is not set
CONFIG_FORCE_MAX_ZONEORDER=11
CONFIG_PROC_DEVICETREE=y
# CONFIG_CMDLINE_BOOL is not set
...
...
@@ -443,8 +453,10 @@ CONFIG_MISC_DEVICES=y
# CONFIG_EEPROM_93CX6 is not set
# CONFIG_SGI_IOC4 is not set
# CONFIG_TIFM_CORE is not set
# CONFIG_ICS932S401 is not set
# CONFIG_ENCLOSURE_SERVICES is not set
# CONFIG_HP_ILO is not set
# CONFIG_C2PORT is not set
CONFIG_HAVE_IDE=y
# CONFIG_IDE is not set
...
...
@@ -784,6 +796,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
CONFIG_UNIX98_PTYS=y
CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=256
# CONFIG_HVC_UDBG is not set
# CONFIG_IPMI_HANDLER is not set
CONFIG_HW_RANDOM=y
CONFIG_NVRAM=y
...
...
@@ -869,11 +882,11 @@ CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
# CONFIG_THERMAL is not set
# CONFIG_THERMAL_HWMON is not set
# CONFIG_WATCHDOG is not set
CONFIG_SSB_POSSIBLE=y
#
# Sonics Silicon Backplane
#
CONFIG_SSB_POSSIBLE=y
# CONFIG_SSB is not set
#
...
...
@@ -886,14 +899,7 @@ CONFIG_SSB_POSSIBLE=y
# CONFIG_PMIC_DA903X is not set
# CONFIG_MFD_WM8400 is not set
# CONFIG_MFD_WM8350_I2C is not set
#
# Voltage and Current regulators
#
# CONFIG_REGULATOR is not set
# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
# CONFIG_REGULATOR_BQ24022 is not set
#
# Multimedia devices
...
...
@@ -1252,11 +1258,11 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
# CONFIG_USB_TMC is not set
#
# NOTE: USB_STORAGE
enables SCSI, and 'SCSI disk support'
# NOTE: USB_STORAGE
depends on SCSI but BLK_DEV_SD may also be needed;
#
#
#
may also be needed;
see USB_STORAGE Help for more information
# see USB_STORAGE Help for more information
#
CONFIG_USB_STORAGE=y
# CONFIG_USB_STORAGE_DEBUG is not set
...
...
@@ -1348,6 +1354,7 @@ CONFIG_RTC_INTF_DEV=y
# CONFIG_RTC_DRV_M41T80 is not set
# CONFIG_RTC_DRV_S35390A is not set
# CONFIG_RTC_DRV_FM3130 is not set
# CONFIG_RTC_DRV_RX8581 is not set
#
# SPI RTC drivers
...
...
@@ -1624,6 +1631,7 @@ CONFIG_HAVE_FUNCTION_TRACER=y
# CONFIG_SAMPLES is not set
CONFIG_HAVE_ARCH_KGDB=y
# CONFIG_KGDB is not set
CONFIG_PRINT_STACK_DEPTH=64
# CONFIG_DEBUG_STACKOVERFLOW is not set
# CONFIG_DEBUG_STACK_USAGE is not set
# CONFIG_DEBUG_PAGEALLOC is not set
...
...
@@ -1649,11 +1657,16 @@ CONFIG_CRYPTO=y
#
# CONFIG_CRYPTO_FIPS is not set
CONFIG_CRYPTO_ALGAPI=y
CONFIG_CRYPTO_ALGAPI2=y
CONFIG_CRYPTO_AEAD=y
CONFIG_CRYPTO_AEAD2=y
CONFIG_CRYPTO_BLKCIPHER=y
CONFIG_CRYPTO_BLKCIPHER2=y
CONFIG_CRYPTO_HASH=y
CONFIG_CRYPTO_RNG=y
CONFIG_CRYPTO_HASH2=y
CONFIG_CRYPTO_RNG2=y
CONFIG_CRYPTO_MANAGER=y
CONFIG_CRYPTO_MANAGER2=y
# CONFIG_CRYPTO_GF128MUL is not set
# CONFIG_CRYPTO_NULL is not set
# CONFIG_CRYPTO_CRYPTD is not set
...
...
arch/powerpc/include/asm/qe.h
View file @
4aa12f7b
...
...
@@ -17,6 +17,8 @@
#ifdef __KERNEL__
#include <linux/spinlock.h>
#include <linux/errno.h>
#include <linux/err.h>
#include <asm/cpm.h>
#include <asm/immap_qe.h>
...
...
@@ -84,7 +86,11 @@ static inline bool qe_clock_is_brg(enum qe_clock clk)
extern
spinlock_t
cmxgcr_lock
;
/* Export QE common operations */
#ifdef CONFIG_QUICC_ENGINE
extern
void
__init
qe_reset
(
void
);
#else
static
inline
void
qe_reset
(
void
)
{}
#endif
/* QE PIO */
#define QE_PIO_PINS 32
...
...
@@ -101,16 +107,43 @@ struct qe_pio_regs {
#endif
};
extern
int
par_io_init
(
struct
device_node
*
np
);
extern
int
par_io_of_config
(
struct
device_node
*
np
);
#define QE_PIO_DIR_IN 2
#define QE_PIO_DIR_OUT 1
extern
void
__par_io_config_pin
(
struct
qe_pio_regs
__iomem
*
par_io
,
u8
pin
,
int
dir
,
int
open_drain
,
int
assignment
,
int
has_irq
);
#ifdef CONFIG_QUICC_ENGINE
extern
int
par_io_init
(
struct
device_node
*
np
);
extern
int
par_io_of_config
(
struct
device_node
*
np
);
extern
int
par_io_config_pin
(
u8
port
,
u8
pin
,
int
dir
,
int
open_drain
,
int
assignment
,
int
has_irq
);
extern
int
par_io_data_set
(
u8
port
,
u8
pin
,
u8
val
);
#else
static
inline
int
par_io_init
(
struct
device_node
*
np
)
{
return
-
ENOSYS
;
}
static
inline
int
par_io_of_config
(
struct
device_node
*
np
)
{
return
-
ENOSYS
;
}
static
inline
int
par_io_config_pin
(
u8
port
,
u8
pin
,
int
dir
,
int
open_drain
,
int
assignment
,
int
has_irq
)
{
return
-
ENOSYS
;
}
static
inline
int
par_io_data_set
(
u8
port
,
u8
pin
,
u8
val
)
{
return
-
ENOSYS
;
}
#endif
/* CONFIG_QUICC_ENGINE */
/*
* Pin multiplexing functions.
*/
struct
qe_pin
;
#ifdef CONFIG_QE_GPIO
extern
struct
qe_pin
*
qe_pin_request
(
struct
device_node
*
np
,
int
index
);
extern
void
qe_pin_free
(
struct
qe_pin
*
qe_pin
);
extern
void
qe_pin_set_gpio
(
struct
qe_pin
*
qe_pin
);
extern
void
qe_pin_set_dedicated
(
struct
qe_pin
*
pin
);
#else
static
inline
struct
qe_pin
*
qe_pin_request
(
struct
device_node
*
np
,
int
index
)
{
return
ERR_PTR
(
-
ENOSYS
);
}
static
inline
void
qe_pin_free
(
struct
qe_pin
*
qe_pin
)
{}
static
inline
void
qe_pin_set_gpio
(
struct
qe_pin
*
qe_pin
)
{}
static
inline
void
qe_pin_set_dedicated
(
struct
qe_pin
*
pin
)
{}
#endif
/* CONFIG_QE_GPIO */
/* QE internal API */
int
qe_issue_cmd
(
u32
cmd
,
u32
device
,
u8
mcn_protocol
,
u32
cmd_input
);
...
...
arch/powerpc/include/asm/qe_ic.h
View file @
4aa12f7b
...
...
@@ -17,6 +17,9 @@
#include <linux/irq.h>
struct
device_node
;
struct
qe_ic
;
#define NUM_OF_QE_IC_GROUPS 6
/* Flags when we init the QE IC */
...
...
@@ -54,17 +57,27 @@ enum qe_ic_grp_id {
QE_IC_GRP_RISCB
/* QE interrupt controller RISC group B */
};
#ifdef CONFIG_QUICC_ENGINE
void
qe_ic_init
(
struct
device_node
*
node
,
unsigned
int
flags
,
void
(
*
low_handler
)(
unsigned
int
irq
,
struct
irq_desc
*
desc
),
void
(
*
high_handler
)(
unsigned
int
irq
,
struct
irq_desc
*
desc
));
unsigned
int
qe_ic_get_low_irq
(
struct
qe_ic
*
qe_ic
);
unsigned
int
qe_ic_get_high_irq
(
struct
qe_ic
*
qe_ic
);
#else
static
inline
void
qe_ic_init
(
struct
device_node
*
node
,
unsigned
int
flags
,
void
(
*
low_handler
)(
unsigned
int
irq
,
struct
irq_desc
*
desc
),
void
(
*
high_handler
)(
unsigned
int
irq
,
struct
irq_desc
*
desc
))
{}
static
inline
unsigned
int
qe_ic_get_low_irq
(
struct
qe_ic
*
qe_ic
)
{
return
0
;
}
static
inline
unsigned
int
qe_ic_get_high_irq
(
struct
qe_ic
*
qe_ic
)
{
return
0
;
}
#endif
/* CONFIG_QUICC_ENGINE */
void
qe_ic_set_highest_priority
(
unsigned
int
virq
,
int
high
);
int
qe_ic_set_priority
(
unsigned
int
virq
,
unsigned
int
priority
);
int
qe_ic_set_high_priority
(
unsigned
int
virq
,
unsigned
int
priority
,
int
high
);
struct
qe_ic
;
unsigned
int
qe_ic_get_low_irq
(
struct
qe_ic
*
qe_ic
);
unsigned
int
qe_ic_get_high_irq
(
struct
qe_ic
*
qe_ic
);
static
inline
void
qe_ic_cascade_low_ipic
(
unsigned
int
irq
,
struct
irq_desc
*
desc
)
{
...
...
arch/powerpc/platforms/83xx/mpc831x_rdb.c
View file @
4aa12f7b
...
...
@@ -42,7 +42,7 @@ static void __init mpc831x_rdb_setup_arch(void)
mpc831x_usb_cfg
();
}
void
__init
mpc831x_rdb_init_IRQ
(
void
)
static
void
__init
mpc831x_rdb_init_IRQ
(
void
)
{
struct
device_node
*
np
;
...
...
arch/powerpc/platforms/83xx/mpc832x_mds.c
View file @
4aa12f7b
...
...
@@ -49,8 +49,6 @@
#define DBG(fmt...)
#endif
static
u8
*
bcsr_regs
=
NULL
;
/* ************************************************************************
*
* Setup the architecture
...
...
@@ -59,13 +57,14 @@ static u8 *bcsr_regs = NULL;
static
void
__init
mpc832x_sys_setup_arch
(
void
)
{
struct
device_node
*
np
;
u8
__iomem
*
bcsr_regs
=
NULL
;
if
(
ppc_md
.
progress
)
ppc_md
.
progress
(
"mpc832x_sys_setup_arch()"
,
0
);
/* Map BCSR area */
np
=
of_find_node_by_name
(
NULL
,
"bcsr"
);
if
(
np
!=
0
)
{
if
(
np
)
{
struct
resource
res
;
of_address_to_resource
(
np
,
0
,
&
res
);
...
...
@@ -93,9 +92,9 @@ static void __init mpc832x_sys_setup_arch(void)
!=
NULL
){
/* Reset the Ethernet PHYs */
#define BCSR8_FETH_RST 0x50
bcsr_regs
[
8
]
&=
~
BCSR8_FETH_RST
;
clrbits8
(
&
bcsr_regs
[
8
],
BCSR8_FETH_RST
)
;
udelay
(
1000
);
bcsr_regs
[
8
]
|=
BCSR8_FETH_RST
;
setbits8
(
&
bcsr_regs
[
8
],
BCSR8_FETH_RST
)
;
iounmap
(
bcsr_regs
);
of_node_put
(
np
);
}
...
...
arch/powerpc/platforms/83xx/mpc832x_rdb.c
View file @
4aa12f7b
...
...
@@ -38,6 +38,7 @@
#define DBG(fmt...)
#endif
#ifdef CONFIG_QUICC_ENGINE
static
void
mpc83xx_spi_activate_cs
(
u8
cs
,
u8
polarity
)
{
pr_debug
(
"%s %d %d
\n
"
,
__func__
,
cs
,
polarity
);
...
...
@@ -77,8 +78,8 @@ static int __init mpc832x_spi_init(void)
mpc83xx_spi_activate_cs
,
mpc83xx_spi_deactivate_cs
);
}
machine_device_initcall
(
mpc832x_rdb
,
mpc832x_spi_init
);
#endif
/* CONFIG_QUICC_ENGINE */
/* ************************************************************************
*
...
...
@@ -130,7 +131,7 @@ static int __init mpc832x_declare_of_platform_devices(void)
}
machine_device_initcall
(
mpc832x_rdb
,
mpc832x_declare_of_platform_devices
);
void
__init
mpc832x_rdb_init_IRQ
(
void
)
static
void
__init
mpc832x_rdb_init_IRQ
(
void
)
{
struct
device_node
*
np
;
...
...
arch/powerpc/platforms/83xx/mpc836x_mds.c
View file @
4aa12f7b
...
...
@@ -18,6 +18,7 @@
#include <linux/stddef.h>
#include <linux/kernel.h>
#include <linux/compiler.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/reboot.h>
...
...
@@ -43,6 +44,7 @@
#include <asm/udbg.h>
#include <sysdev/fsl_soc.h>
#include <sysdev/fsl_pci.h>
#include <sysdev/simple_gpio.h>
#include <asm/qe.h>
#include <asm/qe_ic.h>
...
...
@@ -55,8 +57,6 @@
#define DBG(fmt...)
#endif
static
u8
*
bcsr_regs
=
NULL
;
/* ************************************************************************
*
* Setup the architecture
...
...
@@ -65,13 +65,14 @@ static u8 *bcsr_regs = NULL;
static
void
__init
mpc836x_mds_setup_arch
(
void
)
{
struct
device_node
*
np
;
u8
__iomem
*
bcsr_regs
=
NULL
;
if
(
ppc_md
.
progress
)
ppc_md
.
progress
(
"mpc836x_mds_setup_arch()"
,
0
);
/* Map BCSR area */
np
=
of_find_node_by_name
(
NULL
,
"bcsr"
);
if
(
np
!=
0
)
{
if
(
np
)
{
struct
resource
res
;
of_address_to_resource
(
np
,
0
,
&
res
);
...
...
@@ -93,6 +94,16 @@ static void __init mpc836x_mds_setup_arch(void)
for
(
np
=
NULL
;
(
np
=
of_find_node_by_name
(
np
,
"ucc"
))
!=
NULL
;)
par_io_of_config
(
np
);
#ifdef CONFIG_QE_USB
/* Must fixup Par IO before QE GPIO chips are registered. */
par_io_config_pin
(
1
,
2
,
1
,
0
,
3
,
0
);
/* USBOE */
par_io_config_pin
(
1
,
3
,
1
,
0
,
3
,
0
);
/* USBTP */
par_io_config_pin
(
1
,
8
,
1
,
0
,
1
,
0
);
/* USBTN */
par_io_config_pin
(
1
,
10
,
2
,
0
,
3
,
0
);
/* USBRXD */
par_io_config_pin
(
1
,
9
,
2
,
1
,
3
,
0
);
/* USBRP */
par_io_config_pin
(
1
,
11
,
2
,
1
,
3
,
0
);
/* USBRN */
par_io_config_pin
(
2
,
20
,
2
,
0
,
1
,
0
);
/* CLK21 */
#endif
/* CONFIG_QE_USB */
}
if
((
np
=
of_find_compatible_node
(
NULL
,
"network"
,
"ucc_geth"
))
...
...
@@ -151,6 +162,70 @@ static int __init mpc836x_declare_of_platform_devices(void)
}
machine_device_initcall
(
mpc836x_mds
,
mpc836x_declare_of_platform_devices
);
#ifdef CONFIG_QE_USB
static
int
__init
mpc836x_usb_cfg
(
void
)
{
u8
__iomem
*
bcsr
;
struct
device_node
*
np
;
const
char
*
mode
;
int
ret
=
0
;
np
=
of_find_compatible_node
(
NULL
,
NULL
,
"fsl,mpc8360mds-bcsr"
);
if
(
!
np
)
return
-
ENODEV
;
bcsr
=
of_iomap
(
np
,
0
);
of_node_put
(
np
);
if
(
!
bcsr
)
return
-
ENOMEM
;
np
=
of_find_compatible_node
(
NULL
,
NULL
,
"fsl,mpc8323-qe-usb"
);
if
(
!
np
)
{
ret
=
-
ENODEV
;
goto
err
;
}
#define BCSR8_TSEC1M_MASK (0x3 << 6)
#define BCSR8_TSEC1M_RGMII (0x0 << 6)
#define BCSR8_TSEC2M_MASK (0x3 << 4)
#define BCSR8_TSEC2M_RGMII (0x0 << 4)
/*
* Default is GMII (2), but we should set it to RGMII (0) if we use
* USB (Eth PHY is in RGMII mode anyway).
*/
clrsetbits_8
(
&
bcsr
[
8
],
BCSR8_TSEC1M_MASK
|
BCSR8_TSEC2M_MASK
,
BCSR8_TSEC1M_RGMII
|
BCSR8_TSEC2M_RGMII
);
#define BCSR13_USBMASK 0x0f
#define BCSR13_nUSBEN 0x08
/* 1 - Disable, 0 - Enable */
#define BCSR13_USBSPEED 0x04
/* 1 - Full, 0 - Low */
#define BCSR13_USBMODE 0x02
/* 1 - Host, 0 - Function */
#define BCSR13_nUSBVCC 0x01
/* 1 - gets VBUS, 0 - supplies VBUS */
clrsetbits_8
(
&
bcsr
[
13
],
BCSR13_USBMASK
,
BCSR13_USBSPEED
);
mode
=
of_get_property
(
np
,
"mode"
,
NULL
);
if
(
mode
&&
!
strcmp
(
mode
,
"peripheral"
))
{
setbits8
(
&
bcsr
[
13
],
BCSR13_nUSBVCC
);
qe_usb_clock_set
(
QE_CLK21
,
48000000
);
}
else
{
setbits8
(
&
bcsr
[
13
],
BCSR13_USBMODE
);
/*
* The BCSR GPIOs are used to control power and
* speed of the USB transceiver. This is needed for
* the USB Host only.
*/
simple_gpiochip_init
(
"fsl,mpc8360mds-bcsr-gpio"
);
}
of_node_put
(
np
);
err:
iounmap
(
bcsr
);
return
ret
;
}
machine_arch_initcall
(
mpc836x_mds
,
mpc836x_usb_cfg
);
#endif
/* CONFIG_QE_USB */
static
void
__init
mpc836x_mds_init_IRQ
(
void
)
{
struct
device_node
*
np
;
...
...
arch/powerpc/platforms/83xx/mpc836x_rdk.c
View file @
4aa12f7b
...
...
@@ -51,8 +51,9 @@ static void __init mpc836x_rdk_setup_arch(void)
for_each_compatible_node
(
np
,
"pci"
,
"fsl,mpc8349-pci"
)
mpc83xx_add_bridge
(
np
);
#endif
#ifdef CONFIG_QUICC_ENGINE
qe_reset
();
#endif
}
static
void
__init
mpc836x_rdk_init_IRQ
(
void
)
...
...
@@ -71,13 +72,14 @@ static void __init mpc836x_rdk_init_IRQ(void)
*/
ipic_set_default_priority
();
of_node_put
(
np
);
#ifdef CONFIG_QUICC_ENGINE
np
=
of_find_compatible_node
(
NULL
,
NULL
,
"fsl,qe-ic"
);
if
(
!
np
)
return
;
qe_ic_init
(
np
,
0
,
qe_ic_cascade_low_ipic
,
qe_ic_cascade_high_ipic
);
of_node_put
(
np
);
#endif
}
/*
...
...
arch/powerpc/platforms/83xx/mpc837x_mds.c
View file @
4aa12f7b
...
...
@@ -26,7 +26,6 @@
#define BCSR12_USB_SER_MASK 0x8a
#define BCSR12_USB_SER_PIN 0x80
#define BCSR12_USB_SER_DEVICE 0x02
extern
int
mpc837x_usb_cfg
(
void
);
static
int
mpc837xmds_usb_cfg
(
void
)
{
...
...
arch/powerpc/platforms/83xx/mpc837x_rdb.c
View file @
4aa12f7b
...
...
@@ -21,8 +21,6 @@
#include "mpc83xx.h"
extern
int
mpc837x_usb_cfg
(
void
);
/* ************************************************************************
*
* Setup the architecture
...
...
arch/powerpc/platforms/83xx/mpc83xx.h
View file @
4aa12f7b
...
...
@@ -61,6 +61,7 @@
extern
void
mpc83xx_restart
(
char
*
cmd
);
extern
long
mpc83xx_time_init
(
void
);
extern
int
mpc837x_usb_cfg
(
void
);
extern
int
mpc834x_usb_cfg
(
void
);
extern
int
mpc831x_usb_cfg
(
void
);
...
...
arch/powerpc/platforms/85xx/mpc85xx_ds.c
View file @
4aa12f7b
...
...
@@ -148,6 +148,9 @@ static int mpc85xx_exclude_device(struct pci_controller *hose,
/*
* Setup the architecture
*/
#ifdef CONFIG_SMP
extern
void
__init
mpc85xx_smp_init
(
void
);
#endif
static
void
__init
mpc85xx_ds_setup_arch
(
void
)
{
#ifdef CONFIG_PCI
...
...
@@ -173,6 +176,10 @@ static void __init mpc85xx_ds_setup_arch(void)
ppc_md
.
pci_exclude_device
=
mpc85xx_exclude_device
;
#endif
#ifdef CONFIG_SMP
mpc85xx_smp_init
();
#endif
printk
(
"MPC85xx DS board from Freescale Semiconductor
\n
"
);
}
...
...
arch/powerpc/platforms/85xx/smp.c
View file @
4aa12f7b
...
...
@@ -58,6 +58,7 @@ smp_85xx_kick_cpu(int nr)
if
(
cpu_rel_addr
==
NULL
)
{
printk
(
KERN_ERR
"No cpu-release-addr for cpu %d
\n
"
,
nr
);
local_irq_restore
(
flags
);
return
;
}
...
...
arch/powerpc/platforms/Kconfig
View file @
4aa12f7b
...
...
@@ -312,4 +312,15 @@ config MPC8xxx_GPIO
Say Y here if you're going to use hardware that connects to the
MPC831x/834x/837x/8572/8610 GPIOs.
config SIMPLE_GPIO
bool "Support for simple, memory-mapped GPIO controllers"
depends on PPC
select GENERIC_GPIO
select ARCH_REQUIRE_GPIOLIB
help
Say Y here to support simple, memory-mapped GPIO controllers.
These are usually BCSRs used to control board's switches, LEDs,
chip-selects, Ethernet/USB PHY's power and various other small
on-board peripherals.
endmenu
arch/powerpc/platforms/Kconfig.cputype
View file @
4aa12f7b
...
...
@@ -231,7 +231,7 @@ config VIRT_CPU_ACCOUNTING
If in doubt, say Y here.
config SMP
depends on PPC_STD_MMU
depends on PPC_STD_MMU
|| FSL_BOOKE
bool "Symmetric multi-processing support"
---help---
This enables support for systems with more than one CPU. If you have
...
...
arch/powerpc/sysdev/Makefile
View file @
4aa12f7b
...
...
@@ -17,6 +17,7 @@ obj-$(CONFIG_FSL_PCI) += fsl_pci.o $(fsl-msi-obj-y)
obj-$(CONFIG_FSL_LBC)
+=
fsl_lbc.o
obj-$(CONFIG_FSL_GTM)
+=
fsl_gtm.o
obj-$(CONFIG_MPC8xxx_GPIO)
+=
mpc8xxx_gpio.o
obj-$(CONFIG_SIMPLE_GPIO)
+=
simple_gpio.o
obj-$(CONFIG_RAPIDIO)
+=
fsl_rio.o
obj-$(CONFIG_TSI108_BRIDGE)
+=
tsi108_pci.o tsi108_dev.o
obj-$(CONFIG_QUICC_ENGINE)
+=
qe_lib/
...
...
arch/powerpc/sysdev/fsl_pci.c
View file @
4aa12f7b
...
...
@@ -29,7 +29,8 @@
#if defined(CONFIG_PPC_85xx) || defined(CONFIG_PPC_86xx)
/* atmu setup for fsl pci/pcie controller */
void
__init
setup_pci_atmu
(
struct
pci_controller
*
hose
,
struct
resource
*
rsrc
)
static
void
__init
setup_pci_atmu
(
struct
pci_controller
*
hose
,
struct
resource
*
rsrc
)
{
struct
ccsr_pci
__iomem
*
pci
;
int
i
;
...
...
@@ -86,7 +87,7 @@ void __init setup_pci_atmu(struct pci_controller *hose, struct resource *rsrc)
out_be32
(
&
pci
->
piw
[
2
].
piwar
,
PIWAR_2G
);
}
void
__init
setup_pci_cmd
(
struct
pci_controller
*
hose
)
static
void
__init
setup_pci_cmd
(
struct
pci_controller
*
hose
)
{
u16
cmd
;
int
cap_x
;
...
...
@@ -130,7 +131,7 @@ static void __init quirk_fsl_pcie_header(struct pci_dev *dev)
return
;
}
int
__init
fsl_pcie_check_link
(
struct
pci_controller
*
hose
)
static
int
__init
fsl_pcie_check_link
(
struct
pci_controller
*
hose
)
{
u32
val
;
early_read_config_dword
(
hose
,
0
,
0
,
PCIE_LTSSM
,
&
val
);
...
...
arch/powerpc/sysdev/fsl_soc.h
View file @
4aa12f7b
...
...
@@ -5,8 +5,13 @@
#include <asm/mmu.h>
extern
phys_addr_t
get_immrbase
(
void
);
#if defined(CONFIG_CPM2) || defined(CONFIG_QUICC_ENGINE) || defined(CONFIG_8xx)
extern
u32
get_brgfreq
(
void
);
extern
u32
get_baudrate
(
void
);
#else
static
inline
u32
get_brgfreq
(
void
)
{
return
-
1
;
}
static
inline
u32
get_baudrate
(
void
)
{
return
-
1
;
}
#endif
extern
u32
fsl_get_sys_freq
(
void
);
struct
spi_board_info
;
...
...
arch/powerpc/sysdev/qe_lib/Kconfig
View file @
4aa12f7b
...
...
@@ -22,5 +22,6 @@ config UCC
config QE_USB
bool
default y if USB_GADGET_FSL_QE
help
QE USB
Host
Controller support
QE USB Controller support
arch/powerpc/sysdev/qe_lib/gpio.c
View file @
4aa12f7b
...
...
@@ -14,6 +14,7 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
...
...
@@ -24,8 +25,14 @@ struct qe_gpio_chip {
struct
of_mm_gpio_chip
mm_gc
;
spinlock_t
lock
;
unsigned
long
pin_flags
[
QE_PIO_PINS
];
#define QE_PIN_REQUESTED 0
/* shadowed data register to clear/set bits safely */
u32
cpdata
;
/* saved_regs used to restore dedicated functions */
struct
qe_pio_regs
saved_regs
;
};
static
inline
struct
qe_gpio_chip
*
...
...
@@ -40,6 +47,12 @@ static void qe_gpio_save_regs(struct of_mm_gpio_chip *mm_gc)
struct
qe_pio_regs
__iomem
*
regs
=
mm_gc
->
regs
;
qe_gc
->
cpdata
=
in_be32
(
&
regs
->
cpdata
);
qe_gc
->
saved_regs
.
cpdata
=
qe_gc
->
cpdata
;
qe_gc
->
saved_regs
.
cpdir1
=
in_be32
(
&
regs
->
cpdir1
);
qe_gc
->
saved_regs
.
cpdir2
=
in_be32
(
&
regs
->
cpdir2
);
qe_gc
->
saved_regs
.
cppar1
=
in_be32
(
&
regs
->
cppar1
);
qe_gc
->
saved_regs
.
cppar2
=
in_be32
(
&
regs
->
cppar2
);
qe_gc
->
saved_regs
.
cpodr
=
in_be32
(
&
regs
->
cpodr
);
}
static
int
qe_gpio_get
(
struct
gpio_chip
*
gc
,
unsigned
int
gpio
)
...
...
@@ -103,6 +116,188 @@ static int qe_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
return
0
;
}
struct
qe_pin
{
/*
* The qe_gpio_chip name is unfortunate, we should change that to
* something like qe_pio_controller. Someday.
*/
struct
qe_gpio_chip
*
controller
;
int
num
;
};
/**
* qe_pin_request - Request a QE pin
* @np: device node to get a pin from
* @index: index of a pin in the device tree
* Context: non-atomic
*
* This function return qe_pin so that you could use it with the rest of
* the QE Pin Multiplexing API.
*/
struct
qe_pin
*
qe_pin_request
(
struct
device_node
*
np
,
int
index
)
{
struct
qe_pin
*
qe_pin
;
struct
device_node
*
gc
;
struct
of_gpio_chip
*
of_gc
=
NULL
;
struct
of_mm_gpio_chip
*
mm_gc
;
struct
qe_gpio_chip
*
qe_gc
;
int
err
;
int
size
;
const
void
*
gpio_spec
;
const
u32
*
gpio_cells
;
unsigned
long
flags
;
qe_pin
=
kzalloc
(
sizeof
(
*
qe_pin
),
GFP_KERNEL
);
if
(
!
qe_pin
)
{
pr_debug
(
"%s: can't allocate memory
\n
"
,
__func__
);
return
ERR_PTR
(
-
ENOMEM
);
}
err
=
of_parse_phandles_with_args
(
np
,
"gpios"
,
"#gpio-cells"
,
index
,
&
gc
,
&
gpio_spec
);
if
(
err
)
{
pr_debug
(
"%s: can't parse gpios property
\n
"
,
__func__
);
goto
err0
;
}
if
(
!
of_device_is_compatible
(
gc
,
"fsl,mpc8323-qe-pario-bank"
))
{
pr_debug
(
"%s: tried to get a non-qe pin
\n
"
,
__func__
);
err
=
-
EINVAL
;
goto
err1
;
}
of_gc
=
gc
->
data
;
if
(
!
of_gc
)
{
pr_debug
(
"%s: gpio controller %s isn't registered
\n
"
,
np
->
full_name
,
gc
->
full_name
);
err
=
-
ENODEV
;
goto
err1
;
}
gpio_cells
=
of_get_property
(
gc
,
"#gpio-cells"
,
&
size
);
if
(
!
gpio_cells
||
size
!=
sizeof
(
*
gpio_cells
)
||
*
gpio_cells
!=
of_gc
->
gpio_cells
)
{
pr_debug
(
"%s: wrong #gpio-cells for %s
\n
"
,
np
->
full_name
,
gc
->
full_name
);
err
=
-
EINVAL
;
goto
err1
;
}
err
=
of_gc
->
xlate
(
of_gc
,
np
,
gpio_spec
,
NULL
);
if
(
err
<
0
)
goto
err1
;
mm_gc
=
to_of_mm_gpio_chip
(
&
of_gc
->
gc
);
qe_gc
=
to_qe_gpio_chip
(
mm_gc
);
spin_lock_irqsave
(
&
qe_gc
->
lock
,
flags
);
if
(
test_and_set_bit
(
QE_PIN_REQUESTED
,
&
qe_gc
->
pin_flags
[
err
])
==
0
)
{
qe_pin
->
controller
=
qe_gc
;
qe_pin
->
num
=
err
;
err
=
0
;
}
else
{
err
=
-
EBUSY
;
}
spin_unlock_irqrestore
(
&
qe_gc
->
lock
,
flags
);
if
(
!
err
)
return
qe_pin
;
err1:
of_node_put
(
gc
);
err0:
kfree
(
qe_pin
);
pr_debug
(
"%s failed with status %d
\n
"
,
__func__
,
err
);
return
ERR_PTR
(
err
);
}
EXPORT_SYMBOL
(
qe_pin_request
);
/**
* qe_pin_free - Free a pin
* @qe_pin: pointer to the qe_pin structure
* Context: any
*
* This function frees the qe_pin structure and makes a pin available
* for further qe_pin_request() calls.
*/
void
qe_pin_free
(
struct
qe_pin
*
qe_pin
)
{
struct
qe_gpio_chip
*
qe_gc
=
qe_pin
->
controller
;
unsigned
long
flags
;
const
int
pin
=
qe_pin
->
num
;
spin_lock_irqsave
(
&
qe_gc
->
lock
,
flags
);
test_and_clear_bit
(
QE_PIN_REQUESTED
,
&
qe_gc
->
pin_flags
[
pin
]);
spin_unlock_irqrestore
(
&
qe_gc
->
lock
,
flags
);
kfree
(
qe_pin
);
}
EXPORT_SYMBOL
(
qe_pin_free
);
/**
* qe_pin_set_dedicated - Revert a pin to a dedicated peripheral function mode
* @qe_pin: pointer to the qe_pin structure
* Context: any
*
* This function resets a pin to a dedicated peripheral function that
* has been set up by the firmware.
*/
void
qe_pin_set_dedicated
(
struct
qe_pin
*
qe_pin
)
{
struct
qe_gpio_chip
*
qe_gc
=
qe_pin
->
controller
;
struct
qe_pio_regs
__iomem
*
regs
=
qe_gc
->
mm_gc
.
regs
;
struct
qe_pio_regs
*
sregs
=
&
qe_gc
->
saved_regs
;
int
pin
=
qe_pin
->
num
;
u32
mask1
=
1
<<
(
QE_PIO_PINS
-
(
pin
+
1
));
u32
mask2
=
0x3
<<
(
QE_PIO_PINS
-
(
pin
%
(
QE_PIO_PINS
/
2
)
+
1
)
*
2
);
bool
second_reg
=
pin
>
(
QE_PIO_PINS
/
2
)
-
1
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
qe_gc
->
lock
,
flags
);
if
(
second_reg
)
{
clrsetbits_be32
(
&
regs
->
cpdir2
,
mask2
,
sregs
->
cpdir2
&
mask2
);
clrsetbits_be32
(
&
regs
->
cppar2
,
mask2
,
sregs
->
cppar2
&
mask2
);
}
else
{
clrsetbits_be32
(
&
regs
->
cpdir1
,
mask2
,
sregs
->
cpdir1
&
mask2
);
clrsetbits_be32
(
&
regs
->
cppar1
,
mask2
,
sregs
->
cppar1
&
mask2
);
}
if
(
sregs
->
cpdata
&
mask1
)
qe_gc
->
cpdata
|=
mask1
;
else
qe_gc
->
cpdata
&=
~
mask1
;
out_be32
(
&
regs
->
cpdata
,
qe_gc
->
cpdata
);
clrsetbits_be32
(
&
regs
->
cpodr
,
mask1
,
sregs
->
cpodr
&
mask1
);
spin_unlock_irqrestore
(
&
qe_gc
->
lock
,
flags
);
}
EXPORT_SYMBOL
(
qe_pin_set_dedicated
);
/**
* qe_pin_set_gpio - Set a pin to the GPIO mode
* @qe_pin: pointer to the qe_pin structure
* Context: any
*
* This function sets a pin to the GPIO mode.
*/
void
qe_pin_set_gpio
(
struct
qe_pin
*
qe_pin
)
{
struct
qe_gpio_chip
*
qe_gc
=
qe_pin
->
controller
;
struct
qe_pio_regs
__iomem
*
regs
=
qe_gc
->
mm_gc
.
regs
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
qe_gc
->
lock
,
flags
);
/* Let's make it input by default, GPIO API is able to change that. */
__par_io_config_pin
(
regs
,
qe_pin
->
num
,
QE_PIO_DIR_IN
,
0
,
0
,
0
);
spin_unlock_irqrestore
(
&
qe_gc
->
lock
,
flags
);
}
EXPORT_SYMBOL
(
qe_pin_set_gpio
);
static
int
__init
qe_add_gpiochips
(
void
)
{
struct
device_node
*
np
;
...
...
arch/powerpc/sysdev/simple_gpio.c
0 → 100644
View file @
4aa12f7b
/*
* Simple Memory-Mapped GPIOs
*
* Copyright (c) MontaVista Software, Inc. 2008.
*
* Author: Anton Vorontsov <avorontsov@ru.mvista.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/types.h>
#include <linux/ioport.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/gpio.h>
#include <asm/prom.h>
#include "simple_gpio.h"
struct
u8_gpio_chip
{
struct
of_mm_gpio_chip
mm_gc
;
spinlock_t
lock
;
/* shadowed data register to clear/set bits safely */
u8
data
;
};
static
struct
u8_gpio_chip
*
to_u8_gpio_chip
(
struct
of_mm_gpio_chip
*
mm_gc
)
{
return
container_of
(
mm_gc
,
struct
u8_gpio_chip
,
mm_gc
);
}
static
u8
u8_pin2mask
(
unsigned
int
pin
)
{
return
1
<<
(
8
-
1
-
pin
);
}
static
int
u8_gpio_get
(
struct
gpio_chip
*
gc
,
unsigned
int
gpio
)
{
struct
of_mm_gpio_chip
*
mm_gc
=
to_of_mm_gpio_chip
(
gc
);
return
in_8
(
mm_gc
->
regs
)
&
u8_pin2mask
(
gpio
);
}
static
void
u8_gpio_set
(
struct
gpio_chip
*
gc
,
unsigned
int
gpio
,
int
val
)
{
struct
of_mm_gpio_chip
*
mm_gc
=
to_of_mm_gpio_chip
(
gc
);
struct
u8_gpio_chip
*
u8_gc
=
to_u8_gpio_chip
(
mm_gc
);
unsigned
long
flags
;
spin_lock_irqsave
(
&
u8_gc
->
lock
,
flags
);
if
(
val
)
u8_gc
->
data
|=
u8_pin2mask
(
gpio
);
else
u8_gc
->
data
&=
~
u8_pin2mask
(
gpio
);
out_8
(
mm_gc
->
regs
,
u8_gc
->
data
);
spin_unlock_irqrestore
(
&
u8_gc
->
lock
,
flags
);
}
static
int
u8_gpio_dir_in
(
struct
gpio_chip
*
gc
,
unsigned
int
gpio
)
{
return
0
;
}
static
int
u8_gpio_dir_out
(
struct
gpio_chip
*
gc
,
unsigned
int
gpio
,
int
val
)
{
u8_gpio_set
(
gc
,
gpio
,
val
);
return
0
;
}
static
void
u8_gpio_save_regs
(
struct
of_mm_gpio_chip
*
mm_gc
)
{
struct
u8_gpio_chip
*
u8_gc
=
to_u8_gpio_chip
(
mm_gc
);
u8_gc
->
data
=
in_8
(
mm_gc
->
regs
);
}
static
int
__init
u8_simple_gpiochip_add
(
struct
device_node
*
np
)
{
int
ret
;
struct
u8_gpio_chip
*
u8_gc
;
struct
of_mm_gpio_chip
*
mm_gc
;
struct
of_gpio_chip
*
of_gc
;
struct
gpio_chip
*
gc
;
u8_gc
=
kzalloc
(
sizeof
(
*
u8_gc
),
GFP_KERNEL
);
if
(
!
u8_gc
)
return
-
ENOMEM
;
spin_lock_init
(
&
u8_gc
->
lock
);
mm_gc
=
&
u8_gc
->
mm_gc
;
of_gc
=
&
mm_gc
->
of_gc
;
gc
=
&
of_gc
->
gc
;
mm_gc
->
save_regs
=
u8_gpio_save_regs
;
of_gc
->
gpio_cells
=
2
;
gc
->
ngpio
=
8
;
gc
->
direction_input
=
u8_gpio_dir_in
;
gc
->
direction_output
=
u8_gpio_dir_out
;
gc
->
get
=
u8_gpio_get
;
gc
->
set
=
u8_gpio_set
;
ret
=
of_mm_gpiochip_add
(
np
,
mm_gc
);
if
(
ret
)
goto
err
;
return
0
;
err:
kfree
(
u8_gc
);
return
ret
;
}
void
__init
simple_gpiochip_init
(
const
char
*
compatible
)
{
struct
device_node
*
np
;
for_each_compatible_node
(
np
,
NULL
,
compatible
)
{
int
ret
;
struct
resource
r
;
ret
=
of_address_to_resource
(
np
,
0
,
&
r
);
if
(
ret
)
goto
err
;
switch
(
resource_size
(
&
r
))
{
case
1
:
ret
=
u8_simple_gpiochip_add
(
np
);
if
(
ret
)
goto
err
;
break
;
default:
/*
* Whenever you need support for GPIO bank width > 1,
* please just turn u8_ code into huge macros, and
* construct needed uX_ code with it.
*/
ret
=
-
ENOSYS
;
goto
err
;
}
continue
;
err:
pr_err
(
"%s: registration failed, status %d
\n
"
,
np
->
full_name
,
ret
);
}
}
arch/powerpc/sysdev/simple_gpio.h
0 → 100644
View file @
4aa12f7b
#ifndef __SYSDEV_SIMPLE_GPIO_H
#define __SYSDEV_SIMPLE_GPIO_H
#include <linux/errno.h>
#ifdef CONFIG_SIMPLE_GPIO
extern
void
simple_gpiochip_init
(
const
char
*
compatible
);
#else
static
inline
void
simple_gpiochip_init
(
const
char
*
compatible
)
{}
#endif
/* CONFIG_SIMPLE_GPIO */
#endif
/* __SYSDEV_SIMPLE_GPIO_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment