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
Kirill Smelkov
linux
Commits
1da78078
Commit
1da78078
authored
May 17, 2008
by
Russell King
Committed by
Russell King
May 17, 2008
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'sa1100'
parents
53491e04
2a52efb2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
27 deletions
+60
-27
arch/arm/common/locomo.c
arch/arm/common/locomo.c
+48
-18
include/asm-arm/arch-sa1100/irqs.h
include/asm-arm/arch-sa1100/irqs.h
+1
-1
include/asm-arm/hardware/locomo.h
include/asm-arm/hardware/locomo.h
+11
-8
No files found.
arch/arm/common/locomo.c
View file @
1da78078
...
...
@@ -321,11 +321,42 @@ static void locomo_gpio_unmask_irq(unsigned int irq)
locomo_writel
(
r
,
mapbase
+
LOCOMO_GIE
);
}
static
int
GPIO_IRQ_rising_edge
;
static
int
GPIO_IRQ_falling_edge
;
static
int
locomo_gpio_type
(
unsigned
int
irq
,
unsigned
int
type
)
{
unsigned
int
mask
;
void
__iomem
*
mapbase
=
get_irq_chip_data
(
irq
);
mask
=
1
<<
(
irq
-
LOCOMO_IRQ_GPIO_START
);
if
(
type
==
IRQT_PROBE
)
{
if
((
GPIO_IRQ_rising_edge
|
GPIO_IRQ_falling_edge
)
&
mask
)
return
0
;
type
=
__IRQT_RISEDGE
|
__IRQT_FALEDGE
;
}
if
(
type
&
__IRQT_RISEDGE
)
GPIO_IRQ_rising_edge
|=
mask
;
else
GPIO_IRQ_rising_edge
&=
~
mask
;
if
(
type
&
__IRQT_FALEDGE
)
GPIO_IRQ_falling_edge
|=
mask
;
else
GPIO_IRQ_falling_edge
&=
~
mask
;
locomo_writel
(
GPIO_IRQ_rising_edge
,
mapbase
+
LOCOMO_GRIE
);
locomo_writel
(
GPIO_IRQ_falling_edge
,
mapbase
+
LOCOMO_GFIE
);
return
0
;
}
static
struct
irq_chip
locomo_gpio_chip
=
{
.
name
=
"LOCOMO-gpio"
,
.
ack
=
locomo_gpio_ack_irq
,
.
mask
=
locomo_gpio_mask_irq
,
.
unmask
=
locomo_gpio_unmask_irq
,
.
name
=
"LOCOMO-gpio"
,
.
ack
=
locomo_gpio_ack_irq
,
.
mask
=
locomo_gpio_mask_irq
,
.
unmask
=
locomo_gpio_unmask_irq
,
.
set_type
=
locomo_gpio_type
,
};
static
void
locomo_lt_handler
(
unsigned
int
irq
,
struct
irq_desc
*
desc
)
...
...
@@ -450,22 +481,18 @@ static void locomo_setup_irq(struct locomo *lchip)
set_irq_chip
(
IRQ_LOCOMO_KEY_BASE
,
&
locomo_chip
);
set_irq_chip_data
(
IRQ_LOCOMO_KEY_BASE
,
irqbase
);
set_irq_chained_handler
(
IRQ_LOCOMO_KEY_BASE
,
locomo_key_handler
);
set_irq_flags
(
IRQ_LOCOMO_KEY_BASE
,
IRQF_VALID
|
IRQF_PROBE
);
set_irq_chip
(
IRQ_LOCOMO_GPIO_BASE
,
&
locomo_chip
);
set_irq_chip_data
(
IRQ_LOCOMO_GPIO_BASE
,
irqbase
);
set_irq_chained_handler
(
IRQ_LOCOMO_GPIO_BASE
,
locomo_gpio_handler
);
set_irq_flags
(
IRQ_LOCOMO_GPIO_BASE
,
IRQF_VALID
|
IRQF_PROBE
);
set_irq_chip
(
IRQ_LOCOMO_LT_BASE
,
&
locomo_chip
);
set_irq_chip_data
(
IRQ_LOCOMO_LT_BASE
,
irqbase
);
set_irq_chained_handler
(
IRQ_LOCOMO_LT_BASE
,
locomo_lt_handler
);
set_irq_flags
(
IRQ_LOCOMO_LT_BASE
,
IRQF_VALID
|
IRQF_PROBE
);
set_irq_chip
(
IRQ_LOCOMO_SPI_BASE
,
&
locomo_chip
);
set_irq_chip_data
(
IRQ_LOCOMO_SPI_BASE
,
irqbase
);
set_irq_chained_handler
(
IRQ_LOCOMO_SPI_BASE
,
locomo_spi_handler
);
set_irq_flags
(
IRQ_LOCOMO_SPI_BASE
,
IRQF_VALID
|
IRQF_PROBE
);
/* install handlers for IRQ_LOCOMO_KEY_BASE generated interrupts */
set_irq_chip
(
LOCOMO_IRQ_KEY_START
,
&
locomo_key_chip
);
...
...
@@ -488,7 +515,7 @@ static void locomo_setup_irq(struct locomo *lchip)
set_irq_flags
(
LOCOMO_IRQ_LT_START
,
IRQF_VALID
|
IRQF_PROBE
);
/* install handlers for IRQ_LOCOMO_SPI_BASE generated interrupts */
for
(
irq
=
LOCOMO_IRQ_SPI_START
;
irq
<
LOCOMO_IRQ_SPI_START
+
3
;
irq
++
)
{
for
(
irq
=
LOCOMO_IRQ_SPI_START
;
irq
<
LOCOMO_IRQ_SPI_START
+
4
;
irq
++
)
{
set_irq_chip
(
irq
,
&
locomo_spi_chip
);
set_irq_chip_data
(
irq
,
irqbase
);
set_irq_handler
(
irq
,
handle_edge_irq
);
...
...
@@ -574,20 +601,20 @@ static int locomo_suspend(struct platform_device *dev, pm_message_t state)
save
->
LCM_GPO
=
locomo_readl
(
lchip
->
base
+
LOCOMO_GPO
);
/* GPIO */
locomo_writel
(
0x00
,
lchip
->
base
+
LOCOMO_GPO
);
save
->
LCM_SPICT
=
locomo_readl
(
lchip
->
base
+
LOCOMO_SPICT
);
/* SPI */
save
->
LCM_SPICT
=
locomo_readl
(
lchip
->
base
+
LOCOMO_SPI
+
LOCOMO_SPI
CT
);
/* SPI */
locomo_writel
(
0x40
,
lchip
->
base
+
LOCOMO_SPICT
);
save
->
LCM_GPE
=
locomo_readl
(
lchip
->
base
+
LOCOMO_GPE
);
/* GPIO */
locomo_writel
(
0x00
,
lchip
->
base
+
LOCOMO_GPE
);
save
->
LCM_ASD
=
locomo_readl
(
lchip
->
base
+
LOCOMO_ASD
);
/* ADSTART */
locomo_writel
(
0x00
,
lchip
->
base
+
LOCOMO_ASD
);
save
->
LCM_SPIMD
=
locomo_readl
(
lchip
->
base
+
LOCOMO_SPIMD
);
/* SPI */
locomo_writel
(
0x3C14
,
lchip
->
base
+
LOCOMO_SPIMD
);
save
->
LCM_SPIMD
=
locomo_readl
(
lchip
->
base
+
LOCOMO_SPI
+
LOCOMO_SPI
MD
);
/* SPI */
locomo_writel
(
0x3C14
,
lchip
->
base
+
LOCOMO_SPI
+
LOCOMO_SPI
MD
);
locomo_writel
(
0x00
,
lchip
->
base
+
LOCOMO_PAIF
);
locomo_writel
(
0x00
,
lchip
->
base
+
LOCOMO_DAC
);
locomo_writel
(
0x00
,
lchip
->
base
+
LOCOMO_BACKLIGHT
+
LOCOMO_TC
);
if
(
(
locomo_readl
(
lchip
->
base
+
LOCOMO_LED
+
LOCOMO_LPT0
)
&
0x88
)
&&
(
locomo_readl
(
lchip
->
base
+
LOCOMO_LED
+
LOCOMO_LPT1
)
&
0x88
)
)
if
(
(
locomo_readl
(
lchip
->
base
+
LOCOMO_LED
+
LOCOMO_LPT0
)
&
0x88
)
&&
(
locomo_readl
(
lchip
->
base
+
LOCOMO_LED
+
LOCOMO_LPT1
)
&
0x88
)
)
locomo_writel
(
0x00
,
lchip
->
base
+
LOCOMO_C32K
);
/* CLK32 off */
else
/* 18MHz already enabled, so no wait */
...
...
@@ -616,10 +643,10 @@ static int locomo_resume(struct platform_device *dev)
spin_lock_irqsave
(
&
lchip
->
lock
,
flags
);
locomo_writel
(
save
->
LCM_GPO
,
lchip
->
base
+
LOCOMO_GPO
);
locomo_writel
(
save
->
LCM_SPICT
,
lchip
->
base
+
LOCOMO_SPICT
);
locomo_writel
(
save
->
LCM_SPICT
,
lchip
->
base
+
LOCOMO_SPI
+
LOCOMO_SPI
CT
);
locomo_writel
(
save
->
LCM_GPE
,
lchip
->
base
+
LOCOMO_GPE
);
locomo_writel
(
save
->
LCM_ASD
,
lchip
->
base
+
LOCOMO_ASD
);
locomo_writel
(
save
->
LCM_SPIMD
,
lchip
->
base
+
LOCOMO_SPIMD
);
locomo_writel
(
save
->
LCM_SPIMD
,
lchip
->
base
+
LOCOMO_SPI
+
LOCOMO_SPI
MD
);
locomo_writel
(
0x00
,
lchip
->
base
+
LOCOMO_C32K
);
locomo_writel
(
0x90
,
lchip
->
base
+
LOCOMO_TADC
);
...
...
@@ -688,9 +715,9 @@ __locomo_probe(struct device *me, struct resource *mem, int irq)
/* GPIO */
locomo_writel
(
0
,
lchip
->
base
+
LOCOMO_GPO
);
locomo_writel
(
(
LOCOMO_GPIO
(
2
)
|
LOCOMO_GPIO
(
3
)
|
LOCOMO_GPIO
(
13
)
|
LOCOMO_GPIO
(
14
))
locomo_writel
(
(
LOCOMO_GPIO
(
1
)
|
LOCOMO_GPIO
(
2
)
|
LOCOMO_GPIO
(
13
)
|
LOCOMO_GPIO
(
14
))
,
lchip
->
base
+
LOCOMO_GPE
);
locomo_writel
(
(
LOCOMO_GPIO
(
2
)
|
LOCOMO_GPIO
(
3
)
|
LOCOMO_GPIO
(
13
)
|
LOCOMO_GPIO
(
14
))
locomo_writel
(
(
LOCOMO_GPIO
(
1
)
|
LOCOMO_GPIO
(
2
)
|
LOCOMO_GPIO
(
13
)
|
LOCOMO_GPIO
(
14
))
,
lchip
->
base
+
LOCOMO_GPD
);
locomo_writel
(
0
,
lchip
->
base
+
LOCOMO_GIE
);
...
...
@@ -833,7 +860,10 @@ void locomo_gpio_set_dir(struct device *dev, unsigned int bits, unsigned int dir
spin_lock_irqsave
(
&
lchip
->
lock
,
flags
);
r
=
locomo_readl
(
lchip
->
base
+
LOCOMO_GPD
);
r
&=
~
bits
;
if
(
dir
)
r
|=
bits
;
else
r
&=
~
bits
;
locomo_writel
(
r
,
lchip
->
base
+
LOCOMO_GPD
);
r
=
locomo_readl
(
lchip
->
base
+
LOCOMO_GPE
);
...
...
include/asm-arm/arch-sa1100/irqs.h
View file @
1da78078
...
...
@@ -141,7 +141,7 @@
#define IRQ_LOCOMO_LT (IRQ_BOARD_END + 17)
#define IRQ_LOCOMO_SPI_RFR (IRQ_BOARD_END + 18)
#define IRQ_LOCOMO_SPI_RFW (IRQ_BOARD_END + 19)
#define IRQ_LOCOMO_SPI_
OVRN
(IRQ_BOARD_END + 20)
#define IRQ_LOCOMO_SPI_
REND
(IRQ_BOARD_END + 20)
#define IRQ_LOCOMO_SPI_TEND (IRQ_BOARD_END + 21)
/*
...
...
include/asm-arm/hardware/locomo.h
View file @
1da78078
...
...
@@ -58,6 +58,11 @@
#define LOCOMO_SPIMD 0x00
/* SPI mode setting */
#define LOCOMO_SPICT 0x04
/* SPI mode control */
#define LOCOMO_SPIST 0x08
/* SPI status */
#define LOCOMO_SPI_TEND (1 << 3)
/* Transfer end bit */
#define LOCOMO_SPI_REND (1 << 2)
/* Receive end bit */
#define LOCOMO_SPI_RFW (1 << 1)
/* write buffer bit */
#define LOCOMO_SPI_RFR (1)
/* read buffer bit */
#define LOCOMO_SPIIS 0x10
/* SPI interrupt status */
#define LOCOMO_SPIWE 0x14
/* SPI interrupt status write enable */
#define LOCOMO_SPIIE 0x18
/* SPI interrupt enable */
...
...
@@ -66,16 +71,12 @@
#define LOCOMO_SPIRD 0x24
/* SPI receive data read */
#define LOCOMO_SPITS 0x28
/* SPI transfer data shift */
#define LOCOMO_SPIRS 0x2C
/* SPI receive data shift */
#define LOCOMO_SPI_TEND (1 << 3)
/* Transfer end bit */
#define LOCOMO_SPI_OVRN (1 << 2)
/* Over Run bit */
#define LOCOMO_SPI_RFW (1 << 1)
/* write buffer bit */
#define LOCOMO_SPI_RFR (1)
/* read buffer bit */
/* GPIO */
#define LOCOMO_GPD 0x90
/* GPIO direction */
#define LOCOMO_GPE 0x94
/* GPIO input enable */
#define LOCOMO_GPL 0x98
/* GPIO level */
#define LOCOMO_GPO 0x9c
/* GPIO out data sett
e
ing */
#define LOCOMO_GPO 0x9c
/* GPIO out data setting */
#define LOCOMO_GRIE 0xa0
/* GPIO rise detection */
#define LOCOMO_GFIE 0xa4
/* GPIO fall detection */
#define LOCOMO_GIS 0xa8
/* GPIO edge detection status */
...
...
@@ -96,6 +97,9 @@
#define LOCOMO_GPIO_DAC_SDATA LOCOMO_GPIO(10)
#define LOCOMO_GPIO_DAC_SCK LOCOMO_GPIO(11)
#define LOCOMO_GPIO_DAC_SLOAD LOCOMO_GPIO(12)
#define LOCOMO_GPIO_CARD_DETECT LOCOMO_GPIO(13)
#define LOCOMO_GPIO_WRITE_PROT LOCOMO_GPIO(14)
#define LOCOMO_GPIO_CARD_POWER LOCOMO_GPIO(15)
/* Start the definitions of the devices. Each device has an initial
* base address and a series of offsets from that base address. */
...
...
@@ -122,7 +126,7 @@
/* Audio controller */
#define LOCOMO_AUDIO 0x54
#define LOCOMO_ACC 0x00
/* Audio clock */
#define LOCOMO_PAIF 0x
7C
/* PCM audio interface */
#define LOCOMO_PAIF 0x
D0
/* PCM audio interface */
/* Audio clock */
#define LOCOMO_ACC_XON 0x80
#define LOCOMO_ACC_XEN 0x40
...
...
@@ -162,7 +166,7 @@ extern struct bus_type locomo_bus_type;
#define LOCOMO_DEVID_AUDIO 3
#define LOCOMO_DEVID_LED 4
#define LOCOMO_DEVID_UART 5
#define LOCOMO_DEVID_SPI
6
#define LOCOMO_DEVID_SPI 6
struct
locomo_dev
{
struct
device
dev
;
...
...
@@ -204,7 +208,6 @@ int locomo_gpio_read_level(struct device *dev, unsigned int bits);
int
locomo_gpio_read_output
(
struct
device
*
dev
,
unsigned
int
bits
);
void
locomo_gpio_write
(
struct
device
*
dev
,
unsigned
int
bits
,
unsigned
int
set
);
/* M62332 control function */
void
locomo_m62332_senddata
(
struct
locomo_dev
*
ldev
,
unsigned
int
dac_data
,
int
channel
);
...
...
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