~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise-security

« back to all changes in this revision

Viewing changes to arch/arm/mach-omap2/usb-musb.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati
  • Date: 2011-12-06 15:56:07 UTC
  • Revision ID: package-import@ubuntu.com-20111206155607-pcf44kv5fmhk564f
Tags: 3.2.0-1401.1
[ Paolo Pisati ]

* Rebased on top of Ubuntu-3.2.0-3.8
* Tilt-tracking @ ef2487af4bb15bdd0689631774b5a5e3a59f74e2
* Delete debian.ti-omap4/control, it shoudln't be tracked
* Fix architecture spelling (s/armel/armhf/)
* [Config] Update configs following 3.2 import
* [Config] Fix compilation: disable CODA and ARCH_OMAP3
* [Config] Fix compilation: disable Ethernet Faraday
* Update series to precise

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include <plat/omap_device.h>
34
34
#include "mux.h"
35
35
 
36
 
#if defined(CONFIG_USB_MUSB_OMAP2PLUS) || defined (CONFIG_USB_MUSB_AM35X)
37
 
 
38
36
static struct musb_hdrc_config musb_config = {
39
37
        .multipoint     = 1,
40
38
        .dyn_fifo       = 1,
62
60
 
63
61
static u64 musb_dmamask = DMA_BIT_MASK(32);
64
62
 
65
 
static struct omap_device_pm_latency omap_musb_latency[] = {
66
 
        {
67
 
                .deactivate_func        = omap_device_idle_hwmods,
68
 
                .activate_func          = omap_device_enable_hwmods,
69
 
                .flags                  = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
70
 
        },
71
 
};
72
 
 
73
 
static void usb_musb_mux_init(struct omap_musb_board_data *board_data)
74
 
{
75
 
        switch (board_data->interface_type) {
76
 
        case MUSB_INTERFACE_UTMI:
77
 
                omap_mux_init_signal("usba0_otg_dp", OMAP_PIN_INPUT);
78
 
                omap_mux_init_signal("usba0_otg_dm", OMAP_PIN_INPUT);
79
 
                break;
80
 
        case MUSB_INTERFACE_ULPI:
81
 
                omap_mux_init_signal("usba0_ulpiphy_clk",
82
 
                                                OMAP_PIN_INPUT_PULLDOWN);
83
 
                omap_mux_init_signal("usba0_ulpiphy_stp",
84
 
                                                OMAP_PIN_INPUT_PULLDOWN);
85
 
                omap_mux_init_signal("usba0_ulpiphy_dir",
86
 
                                                OMAP_PIN_INPUT_PULLDOWN);
87
 
                omap_mux_init_signal("usba0_ulpiphy_nxt",
88
 
                                                OMAP_PIN_INPUT_PULLDOWN);
89
 
                omap_mux_init_signal("usba0_ulpiphy_dat0",
90
 
                                                OMAP_PIN_INPUT_PULLDOWN);
91
 
                omap_mux_init_signal("usba0_ulpiphy_dat1",
92
 
                                                OMAP_PIN_INPUT_PULLDOWN);
93
 
                omap_mux_init_signal("usba0_ulpiphy_dat2",
94
 
                                                OMAP_PIN_INPUT_PULLDOWN);
95
 
                omap_mux_init_signal("usba0_ulpiphy_dat3",
96
 
                                                OMAP_PIN_INPUT_PULLDOWN);
97
 
                omap_mux_init_signal("usba0_ulpiphy_dat4",
98
 
                                                OMAP_PIN_INPUT_PULLDOWN);
99
 
                omap_mux_init_signal("usba0_ulpiphy_dat5",
100
 
                                                OMAP_PIN_INPUT_PULLDOWN);
101
 
                omap_mux_init_signal("usba0_ulpiphy_dat6",
102
 
                                                OMAP_PIN_INPUT_PULLDOWN);
103
 
                omap_mux_init_signal("usba0_ulpiphy_dat7",
104
 
                                                OMAP_PIN_INPUT_PULLDOWN);
105
 
                break;
106
 
        default:
107
 
                break;
108
 
        }
109
 
}
110
 
 
111
63
static struct omap_musb_board_data musb_default_board_data = {
112
64
        .interface_type         = MUSB_INTERFACE_ULPI,
113
65
        .mode                   = MUSB_OTG,
117
69
void __init usb_musb_init(struct omap_musb_board_data *musb_board_data)
118
70
{
119
71
        struct omap_hwmod               *oh;
120
 
        struct omap_device              *od;
121
72
        struct platform_device          *pdev;
122
73
        struct device                   *dev;
123
74
        int                             bus_id = -1;
139
90
        musb_plat.mode = board_data->mode;
140
91
        musb_plat.extvbus = board_data->extvbus;
141
92
 
142
 
        if (cpu_is_omap44xx())
143
 
                omap4430_phy_init(dev);
144
 
 
145
93
        if (cpu_is_omap3517() || cpu_is_omap3505()) {
146
94
                oh_name = "am35x_otg_hs";
147
95
                name = "musb-am35x";
150
98
                name = "musb-omap2430";
151
99
        }
152
100
 
153
 
        oh = omap_hwmod_lookup(oh_name);
154
 
        if (!oh) {
155
 
                pr_err("Could not look up %s\n", oh_name);
156
 
                return;
157
 
        }
 
101
        oh = omap_hwmod_lookup(oh_name);
 
102
        if (WARN(!oh, "%s: could not find omap_hwmod for %s\n",
 
103
                 __func__, oh_name))
 
104
                return;
158
105
 
159
 
        od = omap_device_build(name, bus_id, oh, &musb_plat,
160
 
                               sizeof(musb_plat), omap_musb_latency,
161
 
                               ARRAY_SIZE(omap_musb_latency), false);
162
 
        if (IS_ERR(od)) {
 
106
        pdev = omap_device_build(name, bus_id, oh, &musb_plat,
 
107
                               sizeof(musb_plat), NULL, 0, false);
 
108
        if (IS_ERR(pdev)) {
163
109
                pr_err("Could not build omap_device for %s %s\n",
164
110
                                                name, oh_name);
165
111
                return;
166
112
        }
167
113
 
168
 
        pdev = &od->pdev;
169
114
        dev = &pdev->dev;
170
115
        get_device(dev);
171
116
        dev->dma_mask = &musb_dmamask;
175
120
        if (cpu_is_omap44xx())
176
121
                omap4430_phy_init(dev);
177
122
}
178
 
 
179
 
#else
180
 
void __init usb_musb_init(struct omap_musb_board_data *board_data)
181
 
{
182
 
        if (cpu_is_omap44xx())
183
 
                omap4430_phy_init(NULL);
184
 
}
185
 
#endif /* CONFIG_USB_MUSB_SOC */