diff options
Diffstat (limited to 'arch/arm/mach-omap2/serial.c')
-rw-r--r-- | arch/arm/mach-omap2/serial.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index da77930480e9..3771254dfa81 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c | |||
@@ -115,7 +115,6 @@ static struct plat_serial8250_port serial_platform_data2[] = { | |||
115 | } | 115 | } |
116 | }; | 116 | }; |
117 | 117 | ||
118 | #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) | ||
119 | static struct plat_serial8250_port serial_platform_data3[] = { | 118 | static struct plat_serial8250_port serial_platform_data3[] = { |
120 | { | 119 | { |
121 | .irq = 70, | 120 | .irq = 70, |
@@ -128,23 +127,12 @@ static struct plat_serial8250_port serial_platform_data3[] = { | |||
128 | } | 127 | } |
129 | }; | 128 | }; |
130 | 129 | ||
131 | static inline void omap2_set_globals_uart4(struct omap_globals *omap2_globals) | ||
132 | { | ||
133 | serial_platform_data3[0].mapbase = omap2_globals->uart4_phys; | ||
134 | } | ||
135 | #else | ||
136 | static inline void omap2_set_globals_uart4(struct omap_globals *omap2_globals) | ||
137 | { | ||
138 | } | ||
139 | #endif | ||
140 | |||
141 | void __init omap2_set_globals_uart(struct omap_globals *omap2_globals) | 130 | void __init omap2_set_globals_uart(struct omap_globals *omap2_globals) |
142 | { | 131 | { |
143 | serial_platform_data0[0].mapbase = omap2_globals->uart1_phys; | 132 | serial_platform_data0[0].mapbase = omap2_globals->uart1_phys; |
144 | serial_platform_data1[0].mapbase = omap2_globals->uart2_phys; | 133 | serial_platform_data1[0].mapbase = omap2_globals->uart2_phys; |
145 | serial_platform_data2[0].mapbase = omap2_globals->uart3_phys; | 134 | serial_platform_data2[0].mapbase = omap2_globals->uart3_phys; |
146 | if (cpu_is_omap3630() || cpu_is_omap44xx()) | 135 | serial_platform_data3[0].mapbase = omap2_globals->uart4_phys; |
147 | omap2_set_globals_uart4(omap2_globals); | ||
148 | } | 136 | } |
149 | 137 | ||
150 | static inline unsigned int __serial_read_reg(struct uart_port *up, | 138 | static inline unsigned int __serial_read_reg(struct uart_port *up, |
@@ -550,7 +538,7 @@ static ssize_t sleep_timeout_store(struct device *dev, | |||
550 | unsigned int value; | 538 | unsigned int value; |
551 | 539 | ||
552 | if (sscanf(buf, "%u", &value) != 1) { | 540 | if (sscanf(buf, "%u", &value) != 1) { |
553 | printk(KERN_ERR "sleep_timeout_store: Invalid value\n"); | 541 | dev_err(dev, "sleep_timeout_store: Invalid value\n"); |
554 | return -EINVAL; | 542 | return -EINVAL; |
555 | } | 543 | } |
556 | 544 | ||
@@ -664,27 +652,33 @@ void __init omap_serial_early_init(void) | |||
664 | struct device *dev = &pdev->dev; | 652 | struct device *dev = &pdev->dev; |
665 | struct plat_serial8250_port *p = dev->platform_data; | 653 | struct plat_serial8250_port *p = dev->platform_data; |
666 | 654 | ||
655 | /* Don't map zero-based physical address */ | ||
656 | if (p->mapbase == 0) { | ||
657 | dev_warn(dev, "no physical address for uart#%d," | ||
658 | " so skipping early_init...\n", i); | ||
659 | continue; | ||
660 | } | ||
667 | /* | 661 | /* |
668 | * Module 4KB + L4 interconnect 4KB | 662 | * Module 4KB + L4 interconnect 4KB |
669 | * Static mapping, never released | 663 | * Static mapping, never released |
670 | */ | 664 | */ |
671 | p->membase = ioremap(p->mapbase, SZ_8K); | 665 | p->membase = ioremap(p->mapbase, SZ_8K); |
672 | if (!p->membase) { | 666 | if (!p->membase) { |
673 | printk(KERN_ERR "ioremap failed for uart%i\n", i + 1); | 667 | dev_err(dev, "ioremap failed for uart%i\n", i + 1); |
674 | continue; | 668 | continue; |
675 | } | 669 | } |
676 | 670 | ||
677 | sprintf(name, "uart%d_ick", i + 1); | 671 | sprintf(name, "uart%d_ick", i + 1); |
678 | uart->ick = clk_get(NULL, name); | 672 | uart->ick = clk_get(NULL, name); |
679 | if (IS_ERR(uart->ick)) { | 673 | if (IS_ERR(uart->ick)) { |
680 | printk(KERN_ERR "Could not get uart%d_ick\n", i + 1); | 674 | dev_err(dev, "Could not get uart%d_ick\n", i + 1); |
681 | uart->ick = NULL; | 675 | uart->ick = NULL; |
682 | } | 676 | } |
683 | 677 | ||
684 | sprintf(name, "uart%d_fck", i+1); | 678 | sprintf(name, "uart%d_fck", i+1); |
685 | uart->fck = clk_get(NULL, name); | 679 | uart->fck = clk_get(NULL, name); |
686 | if (IS_ERR(uart->fck)) { | 680 | if (IS_ERR(uart->fck)) { |
687 | printk(KERN_ERR "Could not get uart%d_fck\n", i + 1); | 681 | dev_err(dev, "Could not get uart%d_fck\n", i + 1); |
688 | uart->fck = NULL; | 682 | uart->fck = NULL; |
689 | } | 683 | } |
690 | 684 | ||
@@ -727,6 +721,13 @@ void __init omap_serial_init_port(int port) | |||
727 | pdev = &uart->pdev; | 721 | pdev = &uart->pdev; |
728 | dev = &pdev->dev; | 722 | dev = &pdev->dev; |
729 | 723 | ||
724 | /* Don't proceed if there's no clocks available */ | ||
725 | if (unlikely(!uart->ick || !uart->fck)) { | ||
726 | WARN(1, "%s: can't init uart%d, no clocks available\n", | ||
727 | kobject_name(&dev->kobj), port); | ||
728 | return; | ||
729 | } | ||
730 | |||
730 | omap_uart_enable_clocks(uart); | 731 | omap_uart_enable_clocks(uart); |
731 | 732 | ||
732 | omap_uart_reset(uart); | 733 | omap_uart_reset(uart); |