Commit 88919ff7bf4d848ae0bb6dab933cc81bb24abc93
Committed by
Marek Vasut
1 parent
08fc71711a
Exists in
master
and in
54 other branches
am3517_evm: switch to musb-new
Use new musb framework instead of the old one on AM3517_EVM. Signed-off-by: Ilya Yanok <ilya.yanok@cogentembedded.com>
Showing 2 changed files with 90 additions and 21 deletions Side-by-side Diff
board/logicpd/am3517evm/am3517evm.c
... | ... | @@ -25,12 +25,20 @@ |
25 | 25 | |
26 | 26 | #include <common.h> |
27 | 27 | #include <asm/io.h> |
28 | +#include <asm/omap_musb.h> | |
29 | +#include <asm/arch/am35x_def.h> | |
28 | 30 | #include <asm/arch/mem.h> |
29 | 31 | #include <asm/arch/mux.h> |
30 | 32 | #include <asm/arch/sys_proto.h> |
31 | 33 | #include <asm/arch/mmc_host_def.h> |
34 | +#include <asm/arch/musb.h> | |
32 | 35 | #include <asm/mach-types.h> |
36 | +#include <asm/errno.h> | |
37 | +#include <linux/usb/ch9.h> | |
38 | +#include <linux/usb/gadget.h> | |
39 | +#include <linux/usb/musb.h> | |
33 | 40 | #include <i2c.h> |
41 | +#include <netdev.h> | |
34 | 42 | #include "am3517evm.h" |
35 | 43 | |
36 | 44 | DECLARE_GLOBAL_DATA_PTR; |
... | ... | @@ -50,6 +58,52 @@ |
50 | 58 | return 0; |
51 | 59 | } |
52 | 60 | |
61 | +#ifdef CONFIG_USB_MUSB_AM35X | |
62 | +static struct musb_hdrc_config musb_config = { | |
63 | + .multipoint = 1, | |
64 | + .dyn_fifo = 1, | |
65 | + .num_eps = 16, | |
66 | + .ram_bits = 12, | |
67 | +}; | |
68 | + | |
69 | +static struct omap_musb_board_data musb_board_data = { | |
70 | + .set_phy_power = am35x_musb_phy_power, | |
71 | + .clear_irq = am35x_musb_clear_irq, | |
72 | + .reset = am35x_musb_reset, | |
73 | +}; | |
74 | + | |
75 | +static struct musb_hdrc_platform_data musb_plat = { | |
76 | +#if defined(CONFIG_MUSB_HOST) | |
77 | + .mode = MUSB_HOST, | |
78 | +#elif defined(CONFIG_MUSB_GADGET) | |
79 | + .mode = MUSB_PERIPHERAL, | |
80 | +#else | |
81 | +#error "Please define either CONFIG_MUSB_HOST or CONFIG_MUSB_GADGET" | |
82 | +#endif | |
83 | + .config = &musb_config, | |
84 | + .power = 250, | |
85 | + .platform_ops = &am35x_ops, | |
86 | + .board_data = &musb_board_data, | |
87 | +}; | |
88 | + | |
89 | +static void am3517_evm_musb_init(void) | |
90 | +{ | |
91 | + /* | |
92 | + * Set up USB clock/mode in the DEVCONF2 register. | |
93 | + * USB2.0 PHY reference clock is 13 MHz | |
94 | + */ | |
95 | + clrsetbits_le32(&am35x_scm_general_regs->devconf2, | |
96 | + CONF2_REFFREQ | CONF2_OTGMODE | CONF2_PHY_GPIOMODE, | |
97 | + CONF2_REFFREQ_13MHZ | CONF2_SESENDEN | | |
98 | + CONF2_VBDTCTEN | CONF2_DATPOL); | |
99 | + | |
100 | + musb_register(&musb_plat, &musb_board_data, | |
101 | + (void *)AM35XX_IPSS_USBOTGSS_BASE); | |
102 | +} | |
103 | +#else | |
104 | +#define am3517_evm_musb_init() do {} while (0) | |
105 | +#endif | |
106 | + | |
53 | 107 | /* |
54 | 108 | * Routine: misc_init_r |
55 | 109 | * Description: Init i2c, ethernet, etc... (done here so udelay works) |
... | ... | @@ -62,6 +116,8 @@ |
62 | 116 | |
63 | 117 | dieid_num_r(); |
64 | 118 | |
119 | + am3517_evm_musb_init(); | |
120 | + | |
65 | 121 | return 0; |
66 | 122 | } |
67 | 123 | |
... | ... | @@ -81,6 +137,23 @@ |
81 | 137 | { |
82 | 138 | omap_mmc_init(0, 0, 0); |
83 | 139 | return 0; |
140 | +} | |
141 | +#endif | |
142 | + | |
143 | +#if defined(CONFIG_USB_ETHER) && defined(CONFIG_MUSB_GADGET) | |
144 | +int board_eth_init(bd_t *bis) | |
145 | +{ | |
146 | + int rv, n = 0; | |
147 | + | |
148 | + rv = cpu_eth_init(bis); | |
149 | + if (rv > 0) | |
150 | + n += rv; | |
151 | + | |
152 | + rv = usb_eth_initialize(bis); | |
153 | + if (rv > 0) | |
154 | + n += rv; | |
155 | + | |
156 | + return n; | |
84 | 157 | } |
85 | 158 | #endif |
include/configs/am3517_evm.h
... | ... | @@ -97,15 +97,16 @@ |
97 | 97 | |
98 | 98 | /* |
99 | 99 | * USB configuration |
100 | - * Enable CONFIG_MUSB_HCD for Host functionalities MSC, keyboard | |
101 | - * Enable CONFIG_MUSB_UDC for Device functionalities. | |
100 | + * Enable CONFIG_MUSB_HOST for Host functionalities MSC, keyboard | |
101 | + * Enable CONFIG_MUSB_GADGET for Device functionalities. | |
102 | 102 | */ |
103 | -#define CONFIG_USB_AM35X 1 | |
104 | -#define CONFIG_MUSB_HCD 1 | |
103 | +#define CONFIG_USB_MUSB_AM35X | |
104 | +#define CONFIG_MUSB_HOST | |
105 | +#define CONFIG_MUSB_PIO_ONLY | |
105 | 106 | |
106 | -#ifdef CONFIG_USB_AM35X | |
107 | +#ifdef CONFIG_USB_MUSB_AM35X | |
107 | 108 | |
108 | -#ifdef CONFIG_MUSB_HCD | |
109 | +#ifdef CONFIG_MUSB_HOST | |
109 | 110 | #define CONFIG_CMD_USB |
110 | 111 | |
111 | 112 | #define CONFIG_USB_STORAGE |
112 | 113 | |
113 | 114 | |
... | ... | @@ -117,21 +118,15 @@ |
117 | 118 | #define CONFIG_PREBOOT "usb start" |
118 | 119 | #endif /* CONFIG_USB_KEYBOARD */ |
119 | 120 | |
120 | -#endif /* CONFIG_MUSB_HCD */ | |
121 | +#endif /* CONFIG_MUSB_HOST */ | |
121 | 122 | |
122 | -#ifdef CONFIG_MUSB_UDC | |
123 | -/* USB device configuration */ | |
124 | -#define CONFIG_USB_DEVICE 1 | |
125 | -#define CONFIG_USB_TTY 1 | |
126 | -#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1 | |
127 | -/* Change these to suit your needs */ | |
128 | -#define CONFIG_USBD_VENDORID 0x0451 | |
129 | -#define CONFIG_USBD_PRODUCTID 0x5678 | |
130 | -#define CONFIG_USBD_MANUFACTURER "Texas Instruments" | |
131 | -#define CONFIG_USBD_PRODUCT_NAME "AM3517EVM" | |
132 | -#endif /* CONFIG_MUSB_UDC */ | |
123 | +#ifdef CONFIG_MUSB_GADGET | |
124 | +#define CONFIG_USB_GADGET_DUALSPEED | |
125 | +#define CONFIG_USB_ETHER | |
126 | +#define CONFIG_USB_ETH_RNDIS | |
127 | +#endif /* CONFIG_MUSB_GADGET */ | |
133 | 128 | |
134 | -#endif /* CONFIG_USB_AM35X */ | |
129 | +#endif /* CONFIG_USB_MUSB_AM35X */ | |
135 | 130 | |
136 | 131 | /* commands to include */ |
137 | 132 | #include <config_cmd_default.h> |