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

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include <mach/gpio.h>
30
30
#include <plat/mmc.h>
31
31
#include <plat/dma.h>
32
 
#include <plat/gpu.h>
33
32
#include <plat/omap_hwmod.h>
34
33
#include <plat/omap_device.h>
35
34
#include <plat/omap4-keypad.h>
36
35
 
37
36
#include "mux.h"
38
37
#include "control.h"
 
38
#include "devices.h"
39
39
 
40
40
#define L3_MODULES_MAX_LEN 12
41
41
#define L3_MODULES 3
97
97
 
98
98
        WARN(IS_ERR(od), "could not build omap_device for %s\n", oh_name);
99
99
 
100
 
        return PTR_ERR(od);
 
100
        return IS_ERR(od) ? PTR_ERR(od) : 0;
101
101
}
102
102
postcore_initcall(omap4_l3_init);
103
103
 
104
104
#if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
105
105
 
106
 
static struct resource cam_resources[] = {
 
106
static struct resource omap2cam_resources[] = {
107
107
        {
108
108
                .start          = OMAP24XX_CAMERA_BASE,
109
109
                .end            = OMAP24XX_CAMERA_BASE + 0xfff,
115
115
        }
116
116
};
117
117
 
118
 
static struct platform_device omap_cam_device = {
 
118
static struct platform_device omap2cam_device = {
119
119
        .name           = "omap24xxcam",
120
120
        .id             = -1,
121
 
        .num_resources  = ARRAY_SIZE(cam_resources),
122
 
        .resource       = cam_resources,
 
121
        .num_resources  = ARRAY_SIZE(omap2cam_resources),
 
122
        .resource       = omap2cam_resources,
123
123
};
124
 
 
125
 
static inline void omap_init_camera(void)
126
 
{
127
 
        platform_device_register(&omap_cam_device);
128
 
}
129
 
 
130
 
#elif defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE)
 
124
#endif
131
125
 
132
126
static struct resource omap3isp_resources[] = {
133
127
        {
136
130
                .flags          = IORESOURCE_MEM,
137
131
        },
138
132
        {
139
 
                .start          = OMAP3430_ISP_CBUFF_BASE,
140
 
                .end            = OMAP3430_ISP_CBUFF_END,
141
 
                .flags          = IORESOURCE_MEM,
142
 
        },
143
 
        {
144
133
                .start          = OMAP3430_ISP_CCP2_BASE,
145
134
                .end            = OMAP3430_ISP_CCP2_END,
146
135
                .flags          = IORESOURCE_MEM,
176
165
                .flags          = IORESOURCE_MEM,
177
166
        },
178
167
        {
179
 
                .start          = OMAP3430_ISP_CSI2A_BASE,
180
 
                .end            = OMAP3430_ISP_CSI2A_END,
181
 
                .flags          = IORESOURCE_MEM,
182
 
        },
183
 
        {
184
 
                .start          = OMAP3430_ISP_CSI2PHY_BASE,
185
 
                .end            = OMAP3430_ISP_CSI2PHY_END,
 
168
                .start          = OMAP3430_ISP_CSI2A_REGS1_BASE,
 
169
                .end            = OMAP3430_ISP_CSI2A_REGS1_END,
 
170
                .flags          = IORESOURCE_MEM,
 
171
        },
 
172
        {
 
173
                .start          = OMAP3430_ISP_CSIPHY2_BASE,
 
174
                .end            = OMAP3430_ISP_CSIPHY2_END,
 
175
                .flags          = IORESOURCE_MEM,
 
176
        },
 
177
        {
 
178
                .start          = OMAP3630_ISP_CSI2A_REGS2_BASE,
 
179
                .end            = OMAP3630_ISP_CSI2A_REGS2_END,
 
180
                .flags          = IORESOURCE_MEM,
 
181
        },
 
182
        {
 
183
                .start          = OMAP3630_ISP_CSI2C_REGS1_BASE,
 
184
                .end            = OMAP3630_ISP_CSI2C_REGS1_END,
 
185
                .flags          = IORESOURCE_MEM,
 
186
        },
 
187
        {
 
188
                .start          = OMAP3630_ISP_CSIPHY1_BASE,
 
189
                .end            = OMAP3630_ISP_CSIPHY1_END,
 
190
                .flags          = IORESOURCE_MEM,
 
191
        },
 
192
        {
 
193
                .start          = OMAP3630_ISP_CSI2C_REGS2_BASE,
 
194
                .end            = OMAP3630_ISP_CSI2C_REGS2_END,
186
195
                .flags          = IORESOURCE_MEM,
187
196
        },
188
197
        {
198
207
        .resource       = omap3isp_resources,
199
208
};
200
209
 
201
 
static inline void omap_init_camera(void)
202
 
{
203
 
        platform_device_register(&omap3isp_device);
204
 
}
205
 
#else
206
 
static inline void omap_init_camera(void)
207
 
{
208
 
}
 
210
int omap3_init_camera(struct isp_platform_data *pdata)
 
211
{
 
212
        omap3isp_device.dev.platform_data = pdata;
 
213
        return platform_device_register(&omap3isp_device);
 
214
}
 
215
 
 
216
static inline void omap_init_camera(void)
 
217
{
 
218
#if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
 
219
        if (cpu_is_omap24xx())
 
220
                platform_device_register(&omap2cam_device);
209
221
#endif
210
 
 
211
 
#ifdef CONFIG_ARCH_OMAP4 /* KEYBOARD */
 
222
}
212
223
 
213
224
struct omap_device_pm_latency omap_keyboard_latency[] = {
214
225
        {
218
229
        },
219
230
};
220
231
 
221
 
static int omap4_init_keypad(struct omap_hwmod *oh, void *user)
222
 
{
223
 
        struct omap_device *od;
224
 
        struct omap4_keypad_platform_data *sdp4430_keypad_data;
225
 
        unsigned int id = -1;
226
 
        char *name = "omap4-keypad";
227
 
 
228
 
        sdp4430_keypad_data = user;
229
 
 
230
 
        od = omap_device_build(name, id, oh, sdp4430_keypad_data,
231
 
                        sizeof(struct omap4_keypad_platform_data),
232
 
                        omap_keyboard_latency,
233
 
                        ARRAY_SIZE(omap_keyboard_latency), 0);
234
 
        WARN(IS_ERR(od), "Could not build omap_device for %s %s\n",
235
 
                name, oh->name);
236
 
 
237
 
        return 0;
238
 
}
239
 
 
240
 
 
241
 
#endif /* KEYBOARD CONFIG_ARCH_OMAP4 */
242
 
 
243
 
#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
244
 
 
245
 
#define MBOX_REG_SIZE   0x120
246
 
 
247
 
#ifdef CONFIG_ARCH_OMAP2
248
 
static struct resource omap2_mbox_resources[] = {
249
 
        {
250
 
                .start          = OMAP24XX_MAILBOX_BASE,
251
 
                .end            = OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
252
 
                .flags          = IORESOURCE_MEM,
253
 
        },
254
 
};
255
 
#endif
256
 
 
257
 
 
258
 
int __init omap4_keypad_initialization(struct omap4_keypad_platform_data
 
232
int __init omap4_keyboard_init(struct omap4_keypad_platform_data
259
233
                                                *sdp4430_keypad_data)
260
234
{
261
235
        struct omap_device *od;
279
253
                        ARRAY_SIZE(omap_keyboard_latency), 0);
280
254
 
281
255
        if (IS_ERR(od)) {
282
 
                WARN(1, "Cant build omap_device for %s:%s.\n",
 
256
                WARN(1, "Can't build omap_device for %s:%s.\n",
283
257
                                                name, oh->name);
284
258
                return PTR_ERR(od);
285
259
        }
287
261
        return 0;
288
262
}
289
263
 
290
 
//#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
 
264
#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
291
265
static struct omap_device_pm_latency mbox_latencies[] = {
292
266
        [0] = {
293
267
                .activate_func = omap_device_enable_hwmods,
432
406
        od = omap_device_build(name, spi_num, oh, pdata,
433
407
                                sizeof(*pdata), omap_mcspi_latency,
434
408
                                ARRAY_SIZE(omap_mcspi_latency), 0);
435
 
        WARN(IS_ERR(od), "Cant build omap_device for %s:%s\n",
 
409
        WARN(IS_ERR(od), "Can't build omap_device for %s:%s\n",
436
410
                                name, oh->name);
437
411
        kfree(pdata);
438
412
        return 0;
732
706
static inline void omap_init_vout(void) {}
733
707
#endif
734
708
 
735
 
static struct omap_device_pm_latency omap_gpu_latency[] = {
736
 
        [0] = {
737
 
                .deactivate_func        = omap_device_idle_hwmods,
738
 
                .activate_func          = omap_device_enable_hwmods,
739
 
                .flags                  = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
740
 
        },
741
 
};
742
 
 
743
 
static struct platform_device omap_omaplfb_device = {
744
 
        .name           = "omaplfb",
745
 
        .id             = -1,
746
 
};
747
 
 
748
 
 
749
 
static void omap_init_gpu(void)
750
 
{
751
 
        struct omap_hwmod *oh;
752
 
        struct omap_device *od;
753
 
        int max_omap_gpu_hwmod_name_len = 16;
754
 
        char oh_name[max_omap_gpu_hwmod_name_len];
755
 
        int l;
756
 
        struct gpu_platform_data *pdata;
757
 
        char *name = "pvrsrvkm";
758
 
 
759
 
        l = snprintf(oh_name, max_omap_gpu_hwmod_name_len,
760
 
                     "gpu");
761
 
        WARN(l >= max_omap_gpu_hwmod_name_len,
762
 
                "String buffer overflow in GPU device setup\n");
763
 
 
764
 
        oh = omap_hwmod_lookup(oh_name);
765
 
        if (!oh) {
766
 
 
767
 
                pr_err("omap_init_gpu: Could not look up %s\n", oh_name);
768
 
                return;
769
 
        }
770
 
 
771
 
        pdata = kzalloc(sizeof(struct gpu_platform_data),
772
 
                                        GFP_KERNEL);
773
 
        if (!pdata) {
774
 
                pr_err("omap_init_gpu: Platform data memory allocation failed\n");
775
 
                return;
776
 
        }
777
 
 
778
 
        pdata->device_enable = omap_device_enable;
779
 
        pdata->device_idle = omap_device_idle;
780
 
        pdata->device_shutdown = omap_device_shutdown;
781
 
 
782
 
        od = omap_device_build(name, 0, oh, pdata,
783
 
                             sizeof(struct gpu_platform_data),
784
 
                             omap_gpu_latency, ARRAY_SIZE(omap_gpu_latency), 0);
785
 
        WARN(IS_ERR(od), "Could not build omap_device for %s %s\n",
786
 
             name, oh_name);
787
 
 
788
 
        kfree(pdata);
789
 
        platform_device_register(&omap_omaplfb_device);
790
 
}
791
 
 
792
709
/*-------------------------------------------------------------------------*/
793
710
 
794
711
static int __init omap2_init_devices(void)
808
725
        omap_init_sham();
809
726
        omap_init_aes();
810
727
        omap_init_vout();
811
 
        omap_init_gpu();
812
728
 
813
729
        return 0;
814
730
}
843
759
        od = omap_device_build(dev_name, id, oh, NULL, 0,
844
760
                                omap_wdt_latency,
845
761
                                ARRAY_SIZE(omap_wdt_latency), 0);
846
 
        WARN(IS_ERR(od), "Cant build omap_device for %s:%s.\n",
 
762
        WARN(IS_ERR(od), "Can't build omap_device for %s:%s.\n",
847
763
                                dev_name, oh->name);
848
764
        return 0;
849
765
}