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
e259a3ae
Commit
e259a3ae
authored
Aug 20, 2007
by
Russell King
Committed by
Russell King
Oct 12, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ARM] pxa: convert PXA serial drivers to use platform resources
Signed-off-by:
Russell King
<
rmk+kernel@arm.linux.org.uk
>
parent
08197f6e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
120 additions
and
78 deletions
+120
-78
arch/arm/mach-pxa/generic.c
arch/arm/mach-pxa/generic.c
+59
-0
drivers/serial/pxa.c
drivers/serial/pxa.c
+61
-78
No files found.
arch/arm/mach-pxa/generic.c
View file @
e259a3ae
...
...
@@ -267,21 +267,80 @@ void __init set_pxa_fb_parent(struct device *parent_dev)
pxa_device_fb
.
dev
.
parent
=
parent_dev
;
}
static
struct
resource
pxa_resource_ffuart
[]
=
{
{
.
start
=
__PREG
(
FFUART
),
.
end
=
__PREG
(
FFUART
)
+
35
,
.
flags
=
IORESOURCE_MEM
,
},
{
.
start
=
IRQ_FFUART
,
.
end
=
IRQ_FFUART
,
.
flags
=
IORESOURCE_IRQ
,
}
};
struct
platform_device
pxa_device_ffuart
=
{
.
name
=
"pxa2xx-uart"
,
.
id
=
0
,
.
resource
=
pxa_resource_ffuart
,
.
num_resources
=
ARRAY_SIZE
(
pxa_resource_ffuart
),
};
static
struct
resource
pxa_resource_btuart
[]
=
{
{
.
start
=
__PREG
(
BTUART
),
.
end
=
__PREG
(
BTUART
)
+
35
,
.
flags
=
IORESOURCE_MEM
,
},
{
.
start
=
IRQ_BTUART
,
.
end
=
IRQ_BTUART
,
.
flags
=
IORESOURCE_IRQ
,
}
};
struct
platform_device
pxa_device_btuart
=
{
.
name
=
"pxa2xx-uart"
,
.
id
=
1
,
.
resource
=
pxa_resource_btuart
,
.
num_resources
=
ARRAY_SIZE
(
pxa_resource_btuart
),
};
static
struct
resource
pxa_resource_stuart
[]
=
{
{
.
start
=
__PREG
(
STUART
),
.
end
=
__PREG
(
STUART
)
+
35
,
.
flags
=
IORESOURCE_MEM
,
},
{
.
start
=
IRQ_STUART
,
.
end
=
IRQ_STUART
,
.
flags
=
IORESOURCE_IRQ
,
}
};
struct
platform_device
pxa_device_stuart
=
{
.
name
=
"pxa2xx-uart"
,
.
id
=
2
,
.
resource
=
pxa_resource_stuart
,
.
num_resources
=
ARRAY_SIZE
(
pxa_resource_stuart
),
};
static
struct
resource
pxa_resource_hwuart
[]
=
{
{
.
start
=
__PREG
(
HWUART
),
.
end
=
__PREG
(
HWUART
)
+
47
,
.
flags
=
IORESOURCE_MEM
,
},
{
.
start
=
IRQ_HWUART
,
.
end
=
IRQ_HWUART
,
.
flags
=
IORESOURCE_IRQ
,
}
};
struct
platform_device
pxa_device_hwuart
=
{
.
name
=
"pxa2xx-uart"
,
.
id
=
3
,
.
resource
=
pxa_resource_hwuart
,
.
num_resources
=
ARRAY_SIZE
(
pxa_resource_hwuart
),
};
static
struct
resource
pxai2c_resources
[]
=
{
...
...
drivers/serial/pxa.c
View file @
e259a3ae
...
...
@@ -582,7 +582,7 @@ serial_pxa_type(struct uart_port *port)
#ifdef CONFIG_SERIAL_PXA_CONSOLE
static
struct
uart_pxa_port
serial_pxa_ports
[
];
static
struct
uart_pxa_port
*
serial_pxa_ports
[
4
];
static
struct
uart_driver
serial_pxa_reg
;
#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
...
...
@@ -632,7 +632,7 @@ static void serial_pxa_console_putchar(struct uart_port *port, int ch)
static
void
serial_pxa_console_write
(
struct
console
*
co
,
const
char
*
s
,
unsigned
int
count
)
{
struct
uart_pxa_port
*
up
=
&
serial_pxa_ports
[
co
->
index
];
struct
uart_pxa_port
*
up
=
serial_pxa_ports
[
co
->
index
];
unsigned
int
ier
;
/*
...
...
@@ -662,7 +662,9 @@ serial_pxa_console_setup(struct console *co, char *options)
if
(
co
->
index
==
-
1
||
co
->
index
>=
serial_pxa_reg
.
nr
)
co
->
index
=
0
;
up
=
&
serial_pxa_ports
[
co
->
index
];
up
=
serial_pxa_ports
[
co
->
index
];
if
(
!
up
)
return
-
ENODEV
;
if
(
options
)
uart_parse_options
(
options
,
&
baud
,
&
parity
,
&
bits
,
&
flow
);
...
...
@@ -680,15 +682,6 @@ static struct console serial_pxa_console = {
.
data
=
&
serial_pxa_reg
,
};
static
int
__init
serial_pxa_console_init
(
void
)
{
register_console
(
&
serial_pxa_console
);
return
0
;
}
console_initcall
(
serial_pxa_console_init
);
#define PXA_CONSOLE &serial_pxa_console
#else
#define PXA_CONSOLE NULL
...
...
@@ -714,73 +707,13 @@ struct uart_ops serial_pxa_pops = {
.
verify_port
=
serial_pxa_verify_port
,
};
static
struct
uart_pxa_port
serial_pxa_ports
[]
=
{
{
/* FFUART */
.
name
=
"FFUART"
,
.
cken
=
CKEN_FFUART
,
.
port
=
{
.
type
=
PORT_PXA
,
.
iotype
=
UPIO_MEM
,
.
membase
=
(
void
*
)
&
FFUART
,
.
mapbase
=
__PREG
(
FFUART
),
.
irq
=
IRQ_FFUART
,
.
uartclk
=
921600
*
16
,
.
fifosize
=
64
,
.
ops
=
&
serial_pxa_pops
,
.
line
=
0
,
},
},
{
/* BTUART */
.
name
=
"BTUART"
,
.
cken
=
CKEN_BTUART
,
.
port
=
{
.
type
=
PORT_PXA
,
.
iotype
=
UPIO_MEM
,
.
membase
=
(
void
*
)
&
BTUART
,
.
mapbase
=
__PREG
(
BTUART
),
.
irq
=
IRQ_BTUART
,
.
uartclk
=
921600
*
16
,
.
fifosize
=
64
,
.
ops
=
&
serial_pxa_pops
,
.
line
=
1
,
},
},
{
/* STUART */
.
name
=
"STUART"
,
.
cken
=
CKEN_STUART
,
.
port
=
{
.
type
=
PORT_PXA
,
.
iotype
=
UPIO_MEM
,
.
membase
=
(
void
*
)
&
STUART
,
.
mapbase
=
__PREG
(
STUART
),
.
irq
=
IRQ_STUART
,
.
uartclk
=
921600
*
16
,
.
fifosize
=
64
,
.
ops
=
&
serial_pxa_pops
,
.
line
=
2
,
},
},
{
/* HWUART */
.
name
=
"HWUART"
,
.
cken
=
CKEN_HWUART
,
.
port
=
{
.
type
=
PORT_PXA
,
.
iotype
=
UPIO_MEM
,
.
membase
=
(
void
*
)
&
HWUART
,
.
mapbase
=
__PREG
(
HWUART
),
.
irq
=
IRQ_HWUART
,
.
uartclk
=
921600
*
16
,
.
fifosize
=
64
,
.
ops
=
&
serial_pxa_pops
,
.
line
=
3
,
},
}
};
static
struct
uart_driver
serial_pxa_reg
=
{
.
owner
=
THIS_MODULE
,
.
driver_name
=
"PXA serial"
,
.
dev_name
=
"ttyS"
,
.
major
=
TTY_MAJOR
,
.
minor
=
64
,
.
nr
=
ARRAY_SIZE
(
serial_pxa_ports
)
,
.
nr
=
4
,
.
cons
=
PXA_CONSOLE
,
};
...
...
@@ -806,10 +739,60 @@ static int serial_pxa_resume(struct platform_device *dev)
static
int
serial_pxa_probe
(
struct
platform_device
*
dev
)
{
serial_pxa_ports
[
dev
->
id
].
port
.
dev
=
&
dev
->
dev
;
uart_add_one_port
(
&
serial_pxa_reg
,
&
serial_pxa_ports
[
dev
->
id
].
port
);
platform_set_drvdata
(
dev
,
&
serial_pxa_ports
[
dev
->
id
]);
struct
uart_pxa_port
*
sport
;
struct
resource
*
mmres
,
*
irqres
;
int
ret
;
mmres
=
platform_get_resource
(
dev
,
IORESOURCE_MEM
,
0
);
irqres
=
platform_get_resource
(
dev
,
IORESOURCE_IRQ
,
0
);
if
(
!
mmres
||
!
irqres
)
return
-
ENODEV
;
sport
=
kzalloc
(
sizeof
(
struct
uart_pxa_port
),
GFP_KERNEL
);
if
(
!
sport
)
return
-
ENOMEM
;
sport
->
port
.
type
=
PORT_PXA
;
sport
->
port
.
iotype
=
UPIO_MEM
;
sport
->
port
.
mapbase
=
mmres
->
start
;
sport
->
port
.
irq
=
irqres
->
start
;
sport
->
port
.
fifosize
=
64
;
sport
->
port
.
ops
=
&
serial_pxa_pops
;
sport
->
port
.
line
=
dev
->
id
;
sport
->
port
.
dev
=
&
dev
->
dev
;
sport
->
port
.
flags
=
UPF_IOREMAP
|
UPF_BOOT_AUTOCONF
;
sport
->
port
.
uartclk
=
921600
*
16
;
/*
* Is it worth keeping this?
*/
if
(
mmres
->
start
==
__PREG
(
FFUART
))
sport
->
name
=
"FFUART"
;
else
if
(
mmres
->
start
==
__PREG
(
BTUART
))
sport
->
name
=
"BTUART"
;
else
if
(
mmres
->
start
==
__PREG
(
STUART
))
sport
->
name
=
"STUART"
;
else
if
(
mmres
->
start
==
__PREG
(
HWUART
))
sport
->
name
=
"HWUART"
;
else
sport
->
name
=
"???"
;
sport
->
port
.
membase
=
ioremap
(
mmres
->
start
,
mmres
->
end
-
mmres
->
start
+
1
);
if
(
!
sport
->
port
.
membase
)
{
ret
=
-
ENOMEM
;
goto
err_free
;
}
serial_pxa_ports
[
dev
->
id
]
=
sport
;
uart_add_one_port
(
&
serial_pxa_reg
,
&
sport
->
port
);
platform_set_drvdata
(
dev
,
sport
);
return
0
;
err_free:
kfree
(
sport
);
return
ret
;
}
static
int
serial_pxa_remove
(
struct
platform_device
*
dev
)
...
...
@@ -818,8 +801,8 @@ static int serial_pxa_remove(struct platform_device *dev)
platform_set_drvdata
(
dev
,
NULL
);
if
(
sport
)
uart_remove_one_port
(
&
serial_pxa_reg
,
&
sport
->
port
);
uart_remove_one_port
(
&
serial_pxa_reg
,
&
sport
->
port
);
kfree
(
s
port
);
return
0
;
}
...
...
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