From patchwork Sat May 9 01:28:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Harvey X-Patchwork-Id: 470224 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 4E239140345 for ; Sat, 9 May 2015 11:29:39 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 333C94B6A7; Sat, 9 May 2015 03:29:34 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DH0oyiG2RtYA; Sat, 9 May 2015 03:29:33 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F05D44B6A9; Sat, 9 May 2015 03:29:11 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CFE614B61A for ; Sat, 9 May 2015 03:29:06 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BUGR7aYeafEX for ; Sat, 9 May 2015 03:29:06 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pd0-f174.google.com (mail-pd0-f174.google.com [209.85.192.174]) by theia.denx.de (Postfix) with ESMTPS id 1317D4B65B for ; Sat, 9 May 2015 03:28:53 +0200 (CEST) Received: by pdbqd1 with SMTP id qd1so100925011pdb.2 for ; Fri, 08 May 2015 18:28:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=w51DSeQFLehiFtYQHSWxeu8utMJoYbZNqOTCcJG16cY=; b=TtYtvxARVz76uiXpEEdMrWUhx1fewYba/0+gVusvmOQoaLImYCttJRIoHfTq7gonT3 0JwmwARr/xEbPgAKt3Eg9M5uLHN479nAhjZnSdNK9tIjdXBBv1AclUHhkXkM9DpwcwC7 Ho3Xrg/b7swvzKh7VihcA5pzfpli9/acP6tJeMho6R8g80HpnK2L9FqLLEJhwoMWeZno ggfrXCD0W1BtyfctNj3zB4j0ALPbOnZ4q2+qYwL6zdo/DZJr2WxJp4ZUb3qMBnkWse0E 3/GJc0yMsjAKiY+CiBc1hymt9K+mTIJ0md9il4+QPKvkcgcfv9VgJ3F+5eH6k+p+Ye1W eB3w== X-Gm-Message-State: ALoCoQnHSjUf7nlIJX4j2ZVQCpqqSZrz7N+zsTcDMG+lnb+GDYaJJAb/wtoJXRJiq1LDBDkNzih5 X-Received: by 10.66.196.163 with SMTP id in3mr1237331pac.70.1431134932600; Fri, 08 May 2015 18:28:52 -0700 (PDT) Received: from tharvey.gw (68-189-91-139.static.snlo.ca.charter.com. [68.189.91.139]) by mx.google.com with ESMTPSA id as1sm6351035pbc.39.2015.05.08.18.28.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 May 2015 18:28:52 -0700 (PDT) From: Tim Harvey To: Stefano Babic Date: Fri, 8 May 2015 18:28:28 -0700 Message-Id: <1431134922-2535-6-git-send-email-tharvey@gateworks.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1431134922-2535-1-git-send-email-tharvey@gateworks.com> References: <1431134922-2535-1-git-send-email-tharvey@gateworks.com> Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 05/19] imx: ventana: register gpio's with gpio_request X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Prior to using a gpio a call to gpio_request() should be called to register it with the gpio subsystem. Signed-off-by: Tim Harvey --- board/gateworks/gw_ventana/gw_ventana.c | 77 ++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 20 deletions(-) diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c index 1e54912..8818be4 100644 --- a/board/gateworks/gw_ventana/gw_ventana.c +++ b/board/gateworks/gw_ventana/gw_ventana.c @@ -268,14 +268,15 @@ static void setup_gpmi_nand(void) } #endif -static void setup_iomux_enet(void) +static void setup_iomux_enet(int gpio) { SETUP_IOMUX_PADS(enet_pads); /* toggle PHY_RST# */ - gpio_direction_output(GP_PHY_RST, 0); + gpio_request(gpio, "phy_rst#"); + gpio_direction_output(gpio, 0); mdelay(2); - gpio_set_value(GP_PHY_RST, 1); + gpio_set_value(gpio, 1); } static void setup_iomux_uart(void) @@ -295,6 +296,7 @@ static iomux_v3_cfg_t const usb_pads[] = { int board_ehci_hcd_init(int port) { struct ventana_board_info *info = &ventana_info; + int gpio; SETUP_IOMUX_PADS(usb_pads); @@ -303,18 +305,22 @@ int board_ehci_hcd_init(int port) case '3': /* GW53xx */ case '5': /* GW552x */ SETUP_IOMUX_PAD(PAD_GPIO_9__GPIO1_IO09 | DIO_PAD_CFG); - gpio_direction_output(IMX_GPIO_NR(1, 9), 0); - mdelay(2); - gpio_set_value(IMX_GPIO_NR(1, 9), 1); + gpio = (IMX_GPIO_NR(1, 9)); break; case '4': /* GW54xx */ SETUP_IOMUX_PAD(PAD_SD1_DAT0__GPIO1_IO16 | DIO_PAD_CFG); - gpio_direction_output(IMX_GPIO_NR(1, 16), 0); - mdelay(2); - gpio_set_value(IMX_GPIO_NR(1, 16), 1); + gpio = (IMX_GPIO_NR(1, 16)); break; + default: + return 0; } + /* request and toggle hub rst */ + gpio_request(gpio, "usb_hub_rst#"); + gpio_direction_output(gpio, 0); + mdelay(2); + gpio_set_value(gpio, 1); + return 0; } @@ -322,6 +328,7 @@ int board_ehci_power(int port, int on) { if (port) return 0; + gpio_request(GP_USB_OTG_PWR, "usb_otg_pwr"); gpio_set_value(GP_USB_OTG_PWR, on); return 0; } @@ -333,6 +340,7 @@ static struct fsl_esdhc_cfg usdhc_cfg = { USDHC3_BASE_ADDR }; int board_mmc_getcd(struct mmc *mmc) { /* Card Detect */ + gpio_request(GP_SD3_CD, "sd_cd"); gpio_direction_input(GP_SD3_CD); return !gpio_get_value(GP_SD3_CD); } @@ -364,6 +372,7 @@ int board_spi_cs_gpio(unsigned bus, unsigned cs) static void setup_spi(void) { + gpio_request(IMX_GPIO_NR(3, 19), "spi_cs"); gpio_direction_output(IMX_GPIO_NR(3, 19), 1); SETUP_IOMUX_PADS(ecspi1_pads); } @@ -399,7 +408,7 @@ int board_eth_init(bd_t *bis) { #ifdef CONFIG_FEC_MXC if (board_type != GW551x && board_type != GW552x) { - setup_iomux_enet(); + setup_iomux_enet(GP_PHY_RST); cpu_eth_init(bis); } #endif @@ -449,6 +458,7 @@ static void enable_lvds(struct display_info_t const *dev) writel(reg, &iomux->gpr[2]); /* Enable Backlight */ + gpio_request(IMX_GPIO_NR(1, 18), "bklt_en"); SETUP_IOMUX_PAD(PAD_SD1_CMD__GPIO1_IO18 | DIO_PAD_CFG); gpio_direction_output(IMX_GPIO_NR(1, 18), 1); } @@ -588,6 +598,7 @@ static void setup_display(void) writel(reg, &iomux->gpr[3]); /* Backlight CABEN on LVDS connector */ + gpio_request(IMX_GPIO_NR(1, 10), "bklt_gpio"); SETUP_IOMUX_PAD(PAD_SD2_CLK__GPIO1_IO10 | DIO_PAD_CFG); gpio_direction_output(IMX_GPIO_NR(1, 10), 0); } @@ -1158,9 +1169,11 @@ static void setup_board_gpio(int board) return; /* RS232_EN# */ + gpio_request(GP_RS232_EN, "rs232_en"); gpio_direction_output(GP_RS232_EN, (hwconfig("rs232")) ? 0 : 1); /* MSATA Enable */ + gpio_request(GP_MSATA_SEL, "msata_en"); if (is_cpu_type(MXC_CPU_MX6Q) && test_bit(EECONFIG_SATA, info->config)) { gpio_direction_output(GP_MSATA_SEL, @@ -1175,50 +1188,71 @@ static void setup_board_gpio(int board) gpio_cfg[board].pcie_rst = IMX_GPIO_NR(3, 23); /* assert PCI_RST# (released by OS when clock is valid) */ + gpio_request(gpio_cfg[board].pcie_rst, "pci_rst#"); gpio_direction_output(gpio_cfg[board].pcie_rst, 0); #endif /* turn off (active-high) user LED's */ for (i = 0; i < ARRAY_SIZE(gpio_cfg[board].leds); i++) { - if (gpio_cfg[board].leds[i]) + if (gpio_cfg[board].leds[i]) { + gpio_requestf(gpio_cfg[board].leds[i], "led_user%d", i); gpio_direction_output(gpio_cfg[board].leds[i], 1); + } } /* Expansion Mezzanine IO */ - if (gpio_cfg[board].mezz_pwren) + if (gpio_cfg[board].mezz_pwren) { + gpio_request(gpio_cfg[board].mezz_pwren, "mezz_pwr"); gpio_direction_output(gpio_cfg[board].mezz_pwren, 0); - if (gpio_cfg[board].mezz_irq) + } + if (gpio_cfg[board].mezz_irq) { + gpio_request(gpio_cfg[board].mezz_irq, "mezz_irq#"); gpio_direction_input(gpio_cfg[board].mezz_irq); + } /* RS485 Transmit Enable */ - if (gpio_cfg[board].rs485en) + if (gpio_cfg[board].rs485en) { + gpio_request(gpio_cfg[board].rs485en, "rs485_en"); gpio_direction_output(gpio_cfg[board].rs485en, 0); + } /* GPS_SHDN */ - if (gpio_cfg[board].gps_shdn) + if (gpio_cfg[board].gps_shdn) { + gpio_request(gpio_cfg[board].gps_shdn, "gps_shdn"); gpio_direction_output(gpio_cfg[board].gps_shdn, 1); + } /* Analog video codec power enable */ - if (gpio_cfg[board].vidin_en) + if (gpio_cfg[board].vidin_en) { + gpio_request(gpio_cfg[board].vidin_en, "anavidin_en"); gpio_direction_output(gpio_cfg[board].vidin_en, 1); + } /* DIOI2C_DIS# */ - if (gpio_cfg[board].dioi2c_en) + if (gpio_cfg[board].dioi2c_en) { + gpio_request(gpio_cfg[board].dioi2c_en, "dioi2c_dis#"); gpio_direction_output(gpio_cfg[board].dioi2c_en, 0); + } /* PCICK_SSON: disable spread-spectrum clock */ - if (gpio_cfg[board].pcie_sson) + if (gpio_cfg[board].pcie_sson) { + gpio_request(gpio_cfg[board].pcie_sson, "pci_sson"); gpio_direction_output(gpio_cfg[board].pcie_sson, 0); + } /* USBOTG Select (PCISKT or FrontPanel) */ - if (gpio_cfg[board].usb_sel) + if (gpio_cfg[board].usb_sel) { + gpio_request(gpio_cfg[board].usb_sel, "usb_pcisel"); gpio_direction_output(gpio_cfg[board].usb_sel, (hwconfig("usb_pcisel")) ? 1 : 0); + } /* PCISKT_WDIS# (Wireless disable GPIO to miniPCIe sockets) */ - if (gpio_cfg[board].wdis) + if (gpio_cfg[board].wdis) { + gpio_request(gpio_cfg[board].wdis, "wlan_dis"); gpio_direction_output(gpio_cfg[board].wdis, 1); + } /* * Configure DIO pinmux/padctl registers @@ -1248,6 +1282,7 @@ static void setup_board_gpio(int board) } imx_iomux_v3_setup_pad(cfg->gpio_padmux[cputype] | ctrl); + gpio_requestf(cfg->gpio_param, "dio%d", i); gpio_direction_input(cfg->gpio_param); } else if (hwconfig_subarg_cmp("dio2", "mode", "pwm") && cfg->pwm_padmux) { @@ -1274,6 +1309,7 @@ int imx6_pcie_toggle_reset(void) { if (board_type < GW_UNKNOWN) { uint pin = gpio_cfg[board_type].pcie_rst; + gpio_request(pin, "pci_rst#"); gpio_direction_output(pin, 0); mdelay(50); gpio_direction_output(pin, 1); @@ -1343,6 +1379,7 @@ void get_board_serial(struct tag_serialnr *serialnr) int board_early_init_f(void) { setup_iomux_uart(); + gpio_direction_output(GP_USB_OTG_PWR, 0); /* OTG power off */ #if defined(CONFIG_VIDEO_IPUV3)