aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ux500/board-mop500.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-ux500/board-mop500.c')
-rw-r--r--arch/arm/mach-ux500/board-mop500.c62
1 files changed, 41 insertions, 21 deletions
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index e5c0e6e25cf6..1dc31652b97a 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -30,18 +30,17 @@
30#include <linux/smsc911x.h> 30#include <linux/smsc911x.h>
31#include <linux/gpio_keys.h> 31#include <linux/gpio_keys.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33
34#include <linux/of.h> 33#include <linux/of.h>
35#include <linux/of_platform.h> 34#include <linux/of_platform.h>
36
37#include <linux/leds.h> 35#include <linux/leds.h>
36#include <linux/pinctrl/consumer.h>
37
38#include <asm/mach-types.h> 38#include <asm/mach-types.h>
39#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
40#include <asm/hardware/gic.h> 40#include <asm/hardware/gic.h>
41 41
42#include <plat/i2c.h> 42#include <plat/i2c.h>
43#include <plat/ste_dma40.h> 43#include <plat/ste_dma40.h>
44#include <plat/pincfg.h>
45#include <plat/gpio-nomadik.h> 44#include <plat/gpio-nomadik.h>
46 45
47#include <mach/hardware.h> 46#include <mach/hardware.h>
@@ -49,7 +48,6 @@
49#include <mach/devices.h> 48#include <mach/devices.h>
50#include <mach/irqs.h> 49#include <mach/irqs.h>
51 50
52#include "pins-db8500.h"
53#include "ste-dma40-db8500.h" 51#include "ste-dma40-db8500.h"
54#include "devices-db8500.h" 52#include "devices-db8500.h"
55#include "board-mop500.h" 53#include "board-mop500.h"
@@ -522,14 +520,6 @@ static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
522}; 520};
523#endif 521#endif
524 522
525
526static pin_cfg_t mop500_pins_uart0[] = {
527 GPIO0_U0_CTSn | PIN_INPUT_PULLUP,
528 GPIO1_U0_RTSn | PIN_OUTPUT_HIGH,
529 GPIO2_U0_RXD | PIN_INPUT_PULLUP,
530 GPIO3_U0_TXD | PIN_OUTPUT_HIGH,
531};
532
533#define PRCC_K_SOFTRST_SET 0x18 523#define PRCC_K_SOFTRST_SET 0x18
534#define PRCC_K_SOFTRST_CLEAR 0x1C 524#define PRCC_K_SOFTRST_CLEAR 0x1C
535static void ux500_uart0_reset(void) 525static void ux500_uart0_reset(void)
@@ -550,24 +540,33 @@ static void ux500_uart0_reset(void)
550 udelay(1); 540 udelay(1);
551} 541}
552 542
543/* This needs to be referenced by callbacks */
544struct pinctrl *u0_p;
545struct pinctrl_state *u0_def;
546struct pinctrl_state *u0_sleep;
547
553static void ux500_uart0_init(void) 548static void ux500_uart0_init(void)
554{ 549{
555 int ret; 550 int ret;
556 551
557 ret = nmk_config_pins(mop500_pins_uart0, 552 if (IS_ERR(u0_p) || IS_ERR(u0_def))
558 ARRAY_SIZE(mop500_pins_uart0)); 553 return;
559 if (ret < 0) 554
560 pr_err("pl011: uart pins_enable failed\n"); 555 ret = pinctrl_select_state(u0_p, u0_def);
556 if (ret)
557 pr_err("could not set UART0 defstate\n");
561} 558}
562 559
563static void ux500_uart0_exit(void) 560static void ux500_uart0_exit(void)
564{ 561{
565 int ret; 562 int ret;
566 563
567 ret = nmk_config_pins_sleep(mop500_pins_uart0, 564 if (IS_ERR(u0_p) || IS_ERR(u0_sleep))
568 ARRAY_SIZE(mop500_pins_uart0)); 565 return;
569 if (ret < 0) 566
570 pr_err("pl011: uart pins_disable failed\n"); 567 ret = pinctrl_select_state(u0_p, u0_sleep);
568 if (ret)
569 pr_err("could not set UART0 idlestate\n");
571} 570}
572 571
573static struct amba_pl011_data uart0_plat = { 572static struct amba_pl011_data uart0_plat = {
@@ -599,7 +598,28 @@ static struct amba_pl011_data uart2_plat = {
599 598
600static void __init mop500_uart_init(struct device *parent) 599static void __init mop500_uart_init(struct device *parent)
601{ 600{
602 db8500_add_uart0(parent, &uart0_plat); 601 struct amba_device *uart0_device;
602
603 uart0_device = db8500_add_uart0(parent, &uart0_plat);
604 if (uart0_device) {
605 u0_p = pinctrl_get(&uart0_device->dev);
606 if (IS_ERR(u0_p))
607 dev_err(&uart0_device->dev,
608 "could not get UART0 pinctrl\n");
609 else {
610 u0_def = pinctrl_lookup_state(u0_p,
611 PINCTRL_STATE_DEFAULT);
612 if (IS_ERR(u0_def)) {
613 dev_err(&uart0_device->dev,
614 "could not get UART0 defstate\n");
615 }
616 u0_sleep = pinctrl_lookup_state(u0_p,
617 PINCTRL_STATE_SLEEP);
618 if (IS_ERR(u0_sleep))
619 dev_err(&uart0_device->dev,
620 "could not get UART0 idlestate\n");
621 }
622 }
603 db8500_add_uart1(parent, &uart1_plat); 623 db8500_add_uart1(parent, &uart1_plat);
604 db8500_add_uart2(parent, &uart2_plat); 624 db8500_add_uart2(parent, &uart2_plat);
605} 625}