forked from teddywlq/smifb2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsmi_main.c
More file actions
705 lines (589 loc) · 15.7 KB
/
smi_main.c
File metadata and controls
705 lines (589 loc) · 15.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
// SPDX-License-Identifier: GPL-2.0+
// Copyright (c) 2023, SiliconMotion Inc.
#include "smi_drv.h"
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)
#include <drm/drm_pci.h>
#else
#include <linux/pci.h>
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
#include <drm/drm_irq.h>
#endif
#include <drm/drm_vblank.h>
#else
#include <drm/drmP.h>
#endif
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_fourcc.h>
#include <linux/dma-buf.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
#include <drm/drm_probe_helper.h>
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)
#include <drm/drm_framebuffer.h>
#endif
#include "hw750.h"
#include "hw768.h"
#include "smi_dbg.h"
static int smi_user_framebuffer_dirty(struct drm_framebuffer *fb, struct drm_file *file,
unsigned flags, unsigned color, struct drm_clip_rect *clips,
unsigned num_clips);
static struct drm_framebuffer *smi_user_framebuffer_create(struct drm_device *dev,
struct drm_file *filp,
const struct drm_mode_fb_cmd2 *mode_cmd);
static const struct drm_framebuffer_funcs smi_fb_funcs = {
.create_handle = drm_gem_fb_create_handle,
.destroy = drm_gem_fb_destroy,
.dirty = smi_user_framebuffer_dirty,
};
static const struct drm_mode_config_helper_funcs smi_mode_config_helper_funcs = {
.atomic_commit_tail = drm_atomic_helper_commit_tail,
};
static const struct drm_mode_config_funcs smi_mode_config_funcs = {
.fb_create = smi_user_framebuffer_create,
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
.output_poll_changed = drm_fb_helper_output_poll_changed,
#endif
.atomic_check = drm_atomic_helper_check,
.atomic_commit = drm_atomic_helper_commit,
};
static bool smi_merge_clips(struct drm_clip_rect *dst, struct drm_clip_rect *src,
unsigned int num_clips, unsigned int flags, u32 max_width,
u32 max_height)
{
unsigned int i;
if (!src || !num_clips) {
dst->x1 = 0;
dst->x2 = max_width;
dst->y1 = 0;
dst->y2 = max_height;
return true;
}
dst->x1 = ~0;
dst->y1 = ~0;
dst->x2 = 0;
dst->y2 = 0;
for (i = 0; i < num_clips; i++) {
if (flags & DRM_MODE_FB_DIRTY_ANNOTATE_COPY)
i++;
dst->x1 = min(dst->x1, src[i].x1);
dst->x2 = max(dst->x2, src[i].x2);
dst->y1 = min(dst->y1, src[i].y1);
dst->y2 = max(dst->y2, src[i].y2);
}
if (dst->x2 > max_width || dst->y2 > max_height || dst->x1 >= dst->x2 ||
dst->y1 >= dst->y2) {
DRM_DEBUG_KMS("Illegal clip: x1 = %u, x2 = %u, y1 = %u, y2 = %u\n", dst->x1,
dst->x2, dst->y1, dst->y2);
dst->x1 = 0;
dst->x2 = max_width;
dst->y1 = 0;
dst->y2 = max_height;
}
return (dst->x2 - dst->x1) == max_width && (dst->y2 - dst->y1) == max_height;
}
static int smi_handle_damage(struct drm_framebuffer *fb, struct drm_clip_rect clip)
{
bool kmap = false;
int i, ret = 0;
unsigned long offset = 0;
void *dst = NULL;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0)
struct drm_gem_vram_object *gbo;
#else
struct smi_bo *dst_bo = NULL;
#endif
struct drm_gem_object *obj = fb->obj[0];
void *src = NULL;
unsigned bytesPerPixel = fb->format->cpp[0];
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
struct iosys_map src_map,dst_map;
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)
struct dma_buf_map src_map,dst_map;
#endif
if (!obj->import_attach) {
return (-EINVAL);
}
if (!src) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)
ret = dma_buf_vmap(obj->import_attach->dmabuf, &src_map);
if (ret) {
DRM_ERROR("Failed to vmap src buffer\n");
return (0);
}
src = src_map.vaddr;
#else
src = dma_buf_vmap(obj->import_attach->dmabuf);
if (!src)
return (0);
#endif
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0)
gbo = drm_gem_vram_of_gem(obj);
ret = drm_gem_vram_pin(gbo, DRM_GEM_VRAM_PL_FLAG_VRAM);
if (ret)
return (0);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)
ret = drm_gem_vram_vmap(gbo, &dst_map);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
dst = drm_gem_vram_vmap(gbo);
#else
dst = drm_gem_vram_kmap(gbo, false, NULL);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)
if (ret) {
DRM_ERROR("failed to map vram\n");
goto error;
}
kmap = true;
dst = dst_map.vaddr;
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
if (IS_ERR(dst)) {
DRM_ERROR("failed to map vram\n");
goto error;
} else if (!dst) {
dst = drm_gem_vram_vmap(gbo);
if (IS_ERR(dst)) {
DRM_ERROR("failed to kmap vram\n");
goto error;
}
kmap = true;
}
#else
if (IS_ERR(dst)) {
DRM_ERROR("failed to map vram\n");
goto error;
} else if (!dst) {
dst = drm_gem_vram_kmap(gbo, true, NULL);
if (IS_ERR(dst)) {
DRM_ERROR("failed to kmap vram\n");
goto error;
}
kmap = true;
}
#endif
#else//5.3.0
dst_bo = gem_to_smi_bo(obj);
if (!dst_bo->pin_count) {
ret = smi_bo_pin(dst_bo, TTM_PL_FLAG_VRAM, NULL);
if (ret)
return (0);
}
dst = smi_bo_kmap(dst_bo, false, NULL);
if (IS_ERR(dst)) {
DRM_ERROR("failed to kmap vram\n");
goto error;
} else if (!dst) {
dst = smi_bo_kmap(dst_bo, true, NULL);
if (IS_ERR(dst)) {
DRM_ERROR("failed to kmap vram\n");
goto error;
}
kmap = true;
}
#endif
dbg_msg("src: %p, dst: %p, x=%d, y=%d, fbwidth=%d, fbheight=%d, "
"width=%d, height=%d, bpp = %u, pitch=%d\n",
src, dst, clip.x1, clip.y1, fb->width, fb->height, clip.x2 - clip.x1,
clip.y2 - clip.y1, (bytesPerPixel << 3), fb->pitches[0]);
for (i = clip.y1; i < clip.y2; i++) {
offset = i * fb->pitches[0] + (clip.x1 * bytesPerPixel);
memcpy_toio(dst + offset, src + offset, (clip.x2 - clip.x1) * bytesPerPixel);
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0)
if (kmap)
{
drm_gem_vram_unpin(gbo);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)
drm_gem_vram_vunmap(gbo, &dst_map);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
drm_gem_vram_vunmap(gbo, &dst);
#else
drm_gem_vram_kunmap(gbo);
#endif
}
#else
if (kmap)
smi_bo_kunmap(dst_bo);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)
dma_buf_vunmap(obj->import_attach->dmabuf, &src_map);
#else
dma_buf_vunmap(obj->import_attach->dmabuf, src);
#endif
error:
return (0);
}
static int smi_user_framebuffer_dirty(struct drm_framebuffer *fb, struct drm_file *file,
unsigned flags, unsigned color, struct drm_clip_rect *clips,
unsigned num_clips)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
int ret;
#else
struct drm_gem_object *obj = fb->obj[0];
#endif
struct drm_clip_rect clip;
drm_modeset_lock_all(fb->dev);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE);
if (ret)
goto unlock;
#else
if (obj->import_attach) {
int ret = dma_buf_begin_cpu_access(obj->import_attach->dmabuf, DMA_FROM_DEVICE);
if (ret)
goto unlock;
}
#endif
smi_merge_clips(&clip, clips, num_clips, flags, fb->width, fb->height);
smi_handle_damage(fb, clip);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE);
#else
if (obj->import_attach) {
dma_buf_end_cpu_access(obj->import_attach->dmabuf, DMA_FROM_DEVICE);
}
#endif
unlock:
drm_modeset_unlock_all(fb->dev);
return 0;
}
static struct drm_framebuffer *smi_user_framebuffer_create(struct drm_device *dev,
struct drm_file *filp,
const struct drm_mode_fb_cmd2 *mode_cmd)
{
return (drm_gem_fb_create_with_funcs(dev, filp, mode_cmd, &smi_fb_funcs));
}
/*
* Functions here will be called by the core once it's bound the driver to
* a PCI device
*/
int smi_driver_load(struct drm_device *dev, unsigned long flags)
{
struct smi_device *cdev;
struct pci_dev *pdev;
int r;
pdev = to_pci_dev(dev->dev);
cdev = kzalloc(sizeof(struct smi_device), GFP_KERNEL);
if (cdev == NULL)
return -ENOMEM;
dev->dev_private = (void *)cdev;
switch (pdev->device) {
case PCI_DEVID_LYNX_EXP:
cdev->specId = SPC_SM750;
break;
case PCI_DEVID_SM768:
cdev->specId = SPC_SM768;
break;
default:
return -ENODEV;
}
r = pci_enable_device(pdev);
r = smi_device_init(cdev, dev, pdev, flags);
if (r) {
dev_err(&pdev->dev, "Fatal error during GPU init: %d\n", r);
goto out;
}
if(cdev->specId == SPC_SM750)
{
if (pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW) {
cdev->is_boot_gpu = true;
}
ddk750_initChip();
ddk750_deInit();
#ifdef USE_HDMICHIP
if((r = sii9022xInitChip()) < 0)
{
printk("Init HDMI-Tx chip failed!");
r = 0;
}
#endif
#ifdef USE_EP952
EP_HDMI_Init(0);
EP_HDMI_Set_Video_Timing(1,0);
#endif
setDisplayControl(CHANNEL0_CTRL, DISP_OFF);
setDisplayControl(CHANNEL1_CTRL, DISP_OFF);
}
else
{
ddk768_initChip();
ddk768_deInit();
HDMI_Init();
#ifdef USE_EP952
EP_HDMI_Init(1);
EP_HDMI_Set_Video_Timing(1,1);
#endif
#ifndef NO_AUDIO
if(audio_en)
smi_audio_init(dev);
#endif
smi_pwm_init(dev);
#ifdef USE_LT8618
hw768_init_lt8618();
#endif
}
r = smi_mm_init(cdev);
if (r) {
dev_err(&pdev->dev, "fatal err on mm init\n");
goto out;
}
dev->mode_config.funcs = (void *)&smi_mode_config_funcs;
r = smi_modeset_init(cdev);
if (r) {
DRM_ERROR("Fatal error during modeset init: %d\n", r);
goto out;
}
if (use_vblank) {
drm_vblank_init(dev, dev->mode_config.num_crtc);
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
r = drm_irq_install(dev, pdev->irq);
#else
r = request_irq(pdev->irq, smi_drm_interrupt, IRQF_SHARED,
KBUILD_MODNAME, dev);
#endif
if (r)
DRM_ERROR("install irq failed , ret = %d\n", r);
}
cdev->regsave = kvmalloc(1024,GFP_KERNEL);
if (!cdev->regsave) {
DRM_ERROR("cannot allocate regsave\n");
//return -ENOMEM;
}
drm_kms_helper_poll_init(dev);
return 0;
out:
if (r)
smi_driver_unload(dev);
return r;
}
void smi_driver_unload(struct drm_device *dev)
{
struct smi_device *cdev = dev->dev_private;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
struct pci_dev *pdev = to_pci_dev(dev->dev);
#endif
if (use_vblank){
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
if (dev->irq_enabled)
drm_irq_uninstall(dev);
#else
free_irq(pdev->irq, dev);
#endif
}
/* Disable *all* interrupts */
if (cdev->specId == SPC_SM750) {
ddk750_disable_IntMask();
} else if (cdev->specId == SPC_SM768) {
ddk768_disable_IntMask();
}
if (cdev == NULL)
return;
smi_modeset_fini(cdev);
smi_mm_fini(cdev);
smi_device_fini(cdev);
if(cdev->specId == SPC_SM768)
{
#ifndef NO_AUDIO
if(audio_en)
smi_audio_remove(dev);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0)
smi_pwm_remove(dev);
#endif
}
kvfree(cdev->regsave);
kfree(cdev);
dev->dev_private = NULL;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0)
int smi_gem_create(struct drm_device *dev, u32 size, bool iskernel, struct drm_gem_object **obj)
{
struct smi_bo *smibo;
int ret;
*obj = NULL;
size = roundup(size, PAGE_SIZE);
if (size == 0)
return (-EINVAL);
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0)
ret = smi_bo_create(dev, size, 0, 0, NULL, NULL, &smibo);
#endif
if (ret) {
if (ret != -ERESTARTSYS)
DRM_ERROR("failed to allocate GEM object\n");
return (ret);
}
*obj = &smibo->gem;
return (0);
}
int smi_dumb_create(struct drm_file *file, struct drm_device *dev,
struct drm_mode_create_dumb *args)
{
int ret;
struct drm_gem_object *gobj;
u32 handle;
args->pitch = ALIGN(DIV_ROUND_UP(args->width * args->bpp, 8), 16);
args->size = roundup(args->pitch * args->height, PAGE_SIZE);
ret = smi_gem_create(dev, args->size, false, &gobj);
if (ret)
return (ret);
ret = drm_gem_handle_create(file, gobj, &handle);
drm_gem_object_put_unlocked(gobj);
if (ret)
return (ret);
args->handle = handle;
return (0);
}
static inline u64 smi_bo_mmap_offset(struct smi_bo *bo)
{
return drm_vma_node_offset_addr(&bo->bo.vma_node);
}
int smi_dumb_mmap_offset(struct drm_file *file, struct drm_device *dev, uint32_t handle,
uint64_t *offset)
{
struct drm_gem_object *obj;
struct smi_bo *bo;
obj = drm_gem_object_lookup(file, handle);
if (obj == NULL)
return -ENOENT;
bo = gem_to_smi_bo(obj);
*offset = smi_bo_mmap_offset(bo);
drm_gem_object_put_unlocked(obj);
return 0;
}
void smi_bo_unref(struct smi_bo **bo)
{
struct ttm_buffer_object *tbo;
if ((*bo) == NULL)
return;
tbo = &((*bo)->bo);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
ttm_bo_put(tbo);
#else
ttm_bo_unref(&tbo);
if (tbo == NULL)
#endif
{
*bo = NULL;
}
}
void smi_gem_free_object(struct drm_gem_object *obj)
{
struct smi_bo *smi_bo = gem_to_smi_bo(obj);
if (smi_bo) {
if (smi_bo->gem.import_attach)
drm_prime_gem_destroy(&smi_bo->gem, smi_bo->bo.sg);
smi_bo_unref(&smi_bo);
}
}
#else
void smi_gem_free_object(struct drm_gem_object *obj)
{
struct drm_gem_vram_object *gbo;
gbo = drm_gem_vram_of_gem(obj);
if (gbo) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
if (gbo->bo.base.import_attach)
drm_prime_gem_destroy(&gbo->bo.base, gbo->bo.sg);
#else
if (gbo->gem.import_attach)
drm_prime_gem_destroy(&gbo->gem, gbo->bo.sg);
#endif
if (kref_read(&gbo->bo.kref)) {
drm_gem_vram_put(gbo);
}
}
}
#endif
/* Unmap the framebuffer from the core and release the memory */
static void smi_vram_fini(struct smi_device *cdev)
{
}
/* Map the framebuffer from the card and configure the core */
static int smi_vram_init(struct smi_device *cdev)
{
struct pci_dev *pdev = to_pci_dev(cdev->dev->dev);
/* BAR 0 is VRAM */
cdev->vram_base = pci_resource_start(pdev, 0);
/* VRAM Size */
if (cdev->specId == SPC_SM750)
cdev->vram_size = ddk750_getFrameBufSize();
else
cdev->vram_size = ddk768_getFrameBufSize();
#ifdef NO_WC
cdev->vram = devm_ioremap(cdev->dev->dev, cdev->vram_base, cdev->vram_size);
if (!cdev->vram)
return -ENOMEM;
#else
cdev->vram = devm_ioremap_wc(cdev->dev->dev, cdev->vram_base, cdev->vram_size);
if (!cdev->vram)
return -ENOMEM;
/* Don't fail on errors, but performance might be reduced. */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)
devm_arch_phys_wc_add(cdev->dev->dev, cdev->vram_base, cdev->vram_size);
#else
if (arch_phys_wc_add(cdev->vram_base, cdev->vram_size) != 0) {
printk(KERN_ERR "arch_phys_wc_add failed \n");
}
#endif
#endif
return 0;
}
/*
* SMI Graphics has two sets of memory. One is video RAM and can
* simply be used as a linear framebuffer - the other provides mmio access
* to the display registers. The latter can also be accessed via IO port
* access, but we map the range and use mmio to program them instead
*/
int smi_device_init(struct smi_device *cdev, struct drm_device *ddev, struct pci_dev *pdev,
uint32_t flags)
{
int ret, dma_bits;
cdev->dev = ddev;
cdev->flags = flags;
/* Hardcode the number of CRTCs to 2 */
cdev->num_crtc = 2;
dma_bits = 40;
cdev->need_dma32 = false;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(dma_bits));
#else
ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(dma_bits));
#endif
if (ret) {
cdev->need_dma32 = true;
dma_bits = 32;
printk(KERN_WARNING "smifb: No suitable DMA available.\n");
}
#if 0
ret = pci_set_consistent_dma_mask(cdev->dev->pdev, DMA_BIT_MASK(dma_bits));
if (ret) {
pci_set_consistent_dma_mask(cdev->dev->pdev, DMA_BIT_MASK(32));
printk(KERN_WARNING "smifb: No coherent DMA available.\n");
}
#endif
/* BAR 0 is the framebuffer, BAR 1 contains registers */
cdev->rmmio_base = pci_resource_start(pdev, 1);
cdev->rmmio_size = pci_resource_len(pdev, 1);
cdev->rmmio = devm_ioremap(cdev->dev->dev, cdev->rmmio_base, cdev->rmmio_size);
if (cdev->rmmio == NULL)
return -ENOMEM;
if (cdev->specId == SPC_SM750)
ddk750_set_mmio(cdev->rmmio, pdev->device, pdev->revision);
else
ddk768_set_mmio(cdev->rmmio, pdev->device, pdev->revision);
ret = smi_vram_init(cdev);
if (ret) {
return ret;
}
cdev->m_connector = 0;
return 0;
}
void smi_device_fini(struct smi_device *cdev)
{
smi_vram_fini(cdev);
}