rk_serial: use of_alias_get_id to get serial id

This commit is contained in:
黄涛 2013-12-13 16:40:30 +08:00
parent 39890e599f
commit 280d558b93
3 changed files with 11 additions and 9 deletions

View File

@ -7,6 +7,13 @@ / {
compatible = "rockchip,rk3188";
interrupt-parent = <&gic>;
aliases {
serial0 = &uart0;
serial1 = &uart1;
serial2 = &uart2;
serial3 = &uart3;
};
cpus {
#address-cells = <1>;
#size-cells = <0>;
@ -172,7 +179,6 @@ timer@20038080 {
interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
};
uart0: serial@10124000 {
compatible = "rockchip,serial";
reg = <0x10124000 0x100>;
@ -180,7 +186,6 @@ uart0: serial@10124000 {
clock-frequency = <24000000>;
reg-shift = <2>;
reg-io-width = <4>;
id = <0>;
pinctrl-names = "default";
pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
status = "disabled";
@ -193,7 +198,6 @@ uart1: serial@10126000 {
clock-frequency = <24000000>;
reg-shift = <2>;
reg-io-width = <4>;
id = <1>;
pinctrl-names = "default";
pinctrl-0 = <&uart1_xfer &uart1_cts &uart1_rts>;
status = "disabled";
@ -207,7 +211,6 @@ uart2: serial@20064000 {
current-speed = <115200>;
reg-shift = <2>;
reg-io-width = <4>;
id = <2>;
pinctrl-names = "default";
pinctrl-0 = <&uart2_xfer>;
status = "disabled";
@ -220,7 +223,6 @@ uart3: serial@20068000 {
clock-frequency = <24000000>;
reg-shift = <2>;
reg-io-width = <4>;
id = <3>;
pinctrl-names = "default";
pinctrl-0 = <&uart3_xfer &uart3_cts &uart3_rts>;
status = "disabled";

View File

@ -327,7 +327,8 @@ static int __init rk_fiq_debugger_init(void) {
np = NULL;
for (i = 0; i < 5; i++) {
np = of_find_node_by_name(np, "serial");
if (np && !of_property_read_u32(np, "id", &id)) {
if (np) {
id = of_alias_get_id(np, "serial");
if (id == serial_id) {
ok = 1;
break;

View File

@ -1944,10 +1944,9 @@ static int serial_rk_remove_wakeup_irq(struct uart_rk_port *up) {
#endif
#ifdef CONFIG_OF
static int of_rk_serial_parse_dt(const struct device_node *np, struct of_rk_serial *rks) {
static int of_rk_serial_parse_dt(struct device_node *np, struct of_rk_serial *rks) {
unsigned int val = 0;
if(!of_property_read_u32(np, "id", &val))
rks->id = val;
rks->id = of_alias_get_id(np, "serial");
if(!of_property_read_u32(np, "clock-frequency", &val))
rks->uartclk = val;
#if USE_DMA