]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-bsp/u-boot/u-boot/2011.06/0033-omap4_panda-add-support-for-EHCI.patch
u-boot 2011.06: add tftpboot support for pandaboard
[glsdk/meta-ti-glsdk.git] / recipes-bsp / u-boot / u-boot / 2011.06 / 0033-omap4_panda-add-support-for-EHCI.patch
1 From 0d730b18792cdbd31ec47bd7b5793b26f884c796 Mon Sep 17 00:00:00 2001
2 From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
3 Date: Mon, 9 May 2011 23:04:51 +0200
4 Subject: [PATCH 33/35] omap4_panda: add support for EHCI
6 Signed-off-by: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
7 Signed-off-by: Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
8 Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
9 ---
10  board/ti/panda/Makefile     |    4 ++-
11  board/ti/panda/ehci-panda.c |   59 +++++++++++++++++++++++++++++++++++++++++++
12  2 files changed, 62 insertions(+), 1 deletions(-)
13  create mode 100644 board/ti/panda/ehci-panda.c
15 diff --git a/board/ti/panda/Makefile b/board/ti/panda/Makefile
16 index 2186403..253567c 100644
17 --- a/board/ti/panda/Makefile
18 +++ b/board/ti/panda/Makefile
19 @@ -25,7 +25,9 @@ include $(TOPDIR)/config.mk
20  
21  LIB    = $(obj)lib$(BOARD).o
22  
23 -COBJS  := panda.o
24 +COBJS-$(CONFIG_USB_EHCI) += ehci-panda.o
25 +
26 +COBJS  := $(COBJS-y) panda.o
27  
28  SRCS   := $(COBJS:.o=.c)
29  OBJS   := $(addprefix $(obj),$(COBJS))
30 diff --git a/board/ti/panda/ehci-panda.c b/board/ti/panda/ehci-panda.c
31 new file mode 100644
32 index 0000000..b1e247c
33 --- /dev/null
34 +++ b/board/ti/panda/ehci-panda.c
35 @@ -0,0 +1,59 @@
36 +/*
37 + * OMAP4 EHCI port, copied from linux/drivers/usb/host/ehci-omap.c
38 + *
39 + * Copyright (C) 2007-2010 Texas Instruments, Inc.
40 + *     Author: Vikram Pandita <vikram.pandita@ti.com>
41 + *     Author: Anand Gadiyar <gadiyar@ti.com>
42 + */
43 +
44 +#include <asm/arch/gpio.h>
45 +#include <asm/arch/ehci.h>
46 +
47 +#define GPIO_HUB_POWER         1
48 +#define GPIO_HUB_NRESET                62
49 +
50 +int ehci_hcd_init(void)
51 +{
52 +       unsigned long base = get_timer(0);
53 +       unsigned reg = 0, port = 0;
54 +       int rc;
55 +
56 +       /* disable the power to the usb hub prior to init */
57 +       rc = omap_request_gpio(GPIO_HUB_POWER);
58 +       if (rc < 0) {
59 +               printf("Could not request gpio %d\n", GPIO_HUB_POWER);
60 +               return rc;
61 +       }
62 +
63 +       rc = omap_request_gpio(GPIO_HUB_NRESET);
64 +       if (rc < 0) {
65 +               printf("Could not request gpio %d\n", GPIO_HUB_NRESET);
66 +               omap_free_gpio(GPIO_HUB_POWER);
67 +               return rc;
68 +       }
69 +
70 +       omap_set_gpio_direction(GPIO_HUB_POWER, 0);
71 +       omap_set_gpio_dataout(GPIO_HUB_POWER, 0);
72 +       omap_set_gpio_direction(GPIO_HUB_NRESET, 0);
73 +       omap_set_gpio_dataout(GPIO_HUB_NRESET, 0);
74 +       omap_set_gpio_dataout(GPIO_HUB_NRESET, 1);
75 +
76 +       rc = omap4_ehci_hcd_init();
77 +
78 +       if (rc < 0)
79 +               return rc;
80 +
81 +       omap_set_gpio_dataout(GPIO_HUB_POWER, 1);
82 +
83 +       return 0;
84 +}
85 +
86 +int ehci_hcd_stop(void)
87 +{
88 +       omap4_ehci_hcd_stop();
89 +
90 +       omap_set_gpio_dataout(GPIO_HUB_POWER, 0);
91 +       omap_set_gpio_dataout(GPIO_HUB_NRESET, 0);
92 +       omap_free_gpio(GPIO_HUB_POWER);
93 +       omap_free_gpio(GPIO_HUB_NRESET);
94 +}
95 -- 
96 1.6.6.1