summaryrefslogtreecommitdiff
path: root/Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh772x_driver.c
blob: aba270bf5b705684276a6189b3685bfbe8a01997 (plain)
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
/*
 * SH7722/SH7723 Graphics Device
 *
 * Copyright (C) 2006-2008  IGEL Co.,Ltd
 *
 * Written by Denis Oliver Kropp <dok@directfb.org>
 *
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License v2
 * as published by the Free Software Foundation.
 */

#include <linux/module.h>
#include <linux/version.h>

#include <asm/io.h>
#include <asm/processor.h>

#include "sh7722.h"
#include "sh7723.h"


/**********************************************************************************************************************/

static int sh772x_init = 0;

/**********************************************************************************************************************/

static int __init
sh772x_driver_init( void )
{
     int ret = -ENODEV;

     if ((ctrl_inl(CCN_PVR) & 0xffff00) == 0x300800) {
          switch (ctrl_inl(CCN_PRR) & 0xf00) {
               case 0xa00:
                    ret = sh7722_init();
                    if (ret)
                         return ret;

                    sh772x_init = 7722;
                    break;

               case 0x500:
                    ret = sh7723_init();
                    if (ret)
                         return ret;

                    sh772x_init = 7723;
                    break;
          }
     }

     return ret;
}

module_init( sh772x_driver_init );

/**********************************************************************************************************************/

static void __exit
sh772x_driver_exit( void )
{
     switch (sh772x_init) {
          case 7722:
               sh7722_exit();
               break;

          case 7723:
               sh7723_exit();
               break;
     }
}

module_exit( sh772x_driver_exit );

/**********************************************************************************************************************/

MODULE_AUTHOR( "Denis Oliver Kropp <dok@directfb.org> & Janine Kropp <nin@directfb.org>" );
MODULE_LICENSE( "GPL v2" );