~ubuntu-branches/ubuntu/quantal/linux-lowlatency/quantal-proposed

« back to all changes in this revision

Viewing changes to arch/arm/mach-omap2/mcbsp.c

  • Committer: Package Import Robot
  • Author(s): Andy Whitcroft, Andy Whitcroft
  • Date: 2012-06-21 09:16:38 UTC
  • Revision ID: package-import@ubuntu.com-20120621091638-gubhv4nox8xez1ct
Tags: 3.5.0-1.1
[ Andy Whitcroft]

* Rebuild lowlatency against Ubuntu-3.5.0-1.1
* All new configuration system to allow configuration deltas to be
  exposed via debian.lowlatency/config-delta

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
#include "cm2xxx_3xxx.h"
35
35
#include "cm-regbits-34xx.h"
36
36
 
37
 
/* McBSP internal signal muxing function */
 
37
/* McBSP1 internal signal muxing function for OMAP2/3 */
38
38
static int omap2_mcbsp1_mux_rx_clk(struct device *dev, const char *signal,
39
39
                                   const char *src)
40
40
{
65
65
        return 0;
66
66
}
67
67
 
 
68
/* McBSP4 internal signal muxing function for OMAP4 */
 
69
#define OMAP4_CONTROL_MCBSPLP_ALBCTRLRX_FSX     (1 << 31)
 
70
#define OMAP4_CONTROL_MCBSPLP_ALBCTRLRX_CLKX    (1 << 30)
 
71
static int omap4_mcbsp4_mux_rx_clk(struct device *dev, const char *signal,
 
72
                                   const char *src)
 
73
{
 
74
        u32 v;
 
75
 
 
76
        /*
 
77
         * In CONTROL_MCBSPLP register only bit 30 (CLKR mux), and bit 31 (FSR
 
78
         * mux) is used */
 
79
        v = omap4_ctrl_pad_readl(OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_MCBSPLP);
 
80
 
 
81
        if (!strcmp(signal, "clkr")) {
 
82
                if (!strcmp(src, "clkr"))
 
83
                        v &= ~OMAP4_CONTROL_MCBSPLP_ALBCTRLRX_CLKX;
 
84
                else if (!strcmp(src, "clkx"))
 
85
                        v |= OMAP4_CONTROL_MCBSPLP_ALBCTRLRX_CLKX;
 
86
                else
 
87
                        return -EINVAL;
 
88
        } else if (!strcmp(signal, "fsr")) {
 
89
                if (!strcmp(src, "fsr"))
 
90
                        v &= ~OMAP4_CONTROL_MCBSPLP_ALBCTRLRX_FSX;
 
91
                else if (!strcmp(src, "fsx"))
 
92
                        v |= OMAP4_CONTROL_MCBSPLP_ALBCTRLRX_FSX;
 
93
                else
 
94
                        return -EINVAL;
 
95
        } else {
 
96
                return -EINVAL;
 
97
        }
 
98
 
 
99
        omap4_ctrl_pad_writel(v, OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_MCBSPLP);
 
100
 
 
101
        return 0;
 
102
}
 
103
 
68
104
/* McBSP CLKS source switching function */
69
105
static int omap2_mcbsp_set_clk_src(struct device *dev, struct clk *clk,
70
106
                                   const char *src)
122
158
        return 0;
123
159
}
124
160
 
125
 
static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
 
161
static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
126
162
{
127
163
        int id, count = 1;
128
164
        char *name = "omap-mcbsp";
146
182
                pdata->has_ccr = true;
147
183
        }
148
184
        pdata->set_clk_src = omap2_mcbsp_set_clk_src;
149
 
        if (id == 1)
 
185
 
 
186
        /* On OMAP2/3 the McBSP1 port has 6 pin configuration */
 
187
        if (id == 1 && oh->class->rev < MCBSP_CONFIG_TYPE4)
150
188
                pdata->mux_signal = omap2_mcbsp1_mux_rx_clk;
151
189
 
 
190
        /* On OMAP4 the McBSP4 port has 6 pin configuration */
 
191
        if (id == 4 && oh->class->rev == MCBSP_CONFIG_TYPE4)
 
192
                pdata->mux_signal = omap4_mcbsp4_mux_rx_clk;
 
193
 
152
194
        if (oh->class->rev == MCBSP_CONFIG_TYPE3) {
153
195
                if (id == 2)
154
196
                        /* The FIFO has 1024 + 256 locations */
156
198
                else
157
199
                        /* The FIFO has 128 locations */
158
200
                        pdata->buffer_size = 0x80;
 
201
        } else if (oh->class->rev == MCBSP_CONFIG_TYPE4) {
 
202
                /* The FIFO has 128 locations for all instances */
 
203
                pdata->buffer_size = 0x80;
159
204
        }
160
205
 
161
206
        if (oh->class->rev >= MCBSP_CONFIG_TYPE3)
177
222
                                        name, oh->name);
178
223
                return PTR_ERR(pdev);
179
224
        }
180
 
        omap_mcbsp_count++;
181
225
        return 0;
182
226
}
183
227
 
185
229
{
186
230
        omap_hwmod_for_each_by_class("mcbsp", omap_init_mcbsp, NULL);
187
231
 
188
 
        mcbsp_ptr = kzalloc(omap_mcbsp_count * sizeof(struct omap_mcbsp *),
189
 
                                                                GFP_KERNEL);
190
 
        if (!mcbsp_ptr)
191
 
                return -ENOMEM;
192
 
 
193
 
        return omap_mcbsp_init();
 
232
        return 0;
194
233
}
195
234
arch_initcall(omap2_mcbsp_init);