OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [drivers/] [pcmcia/] [sa1100_jornada720.c] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 * drivers/pcmcia/sa1100_jornada720.c
3
 *
4
 * Jornada720 PCMCIA specific routines
5
 *
6
 */
7
#include <linux/kernel.h>
8
#include <linux/sched.h>
9
 
10
#include <asm/hardware.h>
11
 
12
#include "sa1100_generic.h"
13
#include "sa1111_generic.h"
14
 
15
#define SOCKET0_POWER   GPIO_GPIO0
16
#define SOCKET0_3V      GPIO_GPIO2
17
#define SOCKET1_POWER   (GPIO_GPIO1 | GPIO_GPIO3)
18
#warning *** Does SOCKET1_3V actually do anything?
19
#define SOCKET1_3V      GPIO_GPIO3
20
 
21
static int jornada720_pcmcia_init(struct pcmcia_init *init)
22
{
23
  /*
24
   * What is all this crap for?
25
   */
26
  GRER |= 0x00000002;
27
  /* Set GPIO_A<3:1> to be outputs for PCMCIA/CF power controller: */
28
  PA_DDR = 0;
29
  PA_DWR = 0;
30
  PA_SDR = 0;
31
  PA_SSR = 0;
32
 
33
  PB_DDR = 0;
34
  PB_DWR = 0x01;
35
  PB_SDR = 0;
36
  PB_SSR = 0;
37
 
38
  PC_DDR = 0x88;
39
  PC_DWR = 0x20;
40
  PC_SDR = 0;
41
  PC_SSR = 0;
42
 
43
  return sa1111_pcmcia_init(init);
44
}
45
 
46
static int
47
jornada720_pcmcia_configure_socket(const struct pcmcia_configure *conf)
48
{
49
  unsigned int pa_dwr_mask, pa_dwr_set;
50
  int ret;
51
 
52
printk("%s(): config socket %d vcc %d vpp %d\n", __FUNCTION__,
53
               conf->sock, conf->vcc, conf->vpp);
54
 
55
  switch (conf->sock) {
56
  case 0:
57
    pa_dwr_mask = SOCKET0_POWER | SOCKET0_3V;
58
 
59
    switch (conf->vcc) {
60
    default:
61
    case 0:      pa_dwr_set = 0;                                  break;
62
    case 33:    pa_dwr_set = SOCKET0_POWER | SOCKET0_3V;        break;
63
    case 50:    pa_dwr_set = SOCKET0_POWER;                     break;
64
    }
65
    break;
66
 
67
  case 1:
68
    pa_dwr_mask = SOCKET1_POWER;
69
 
70
    switch (conf->vcc) {
71
    default:
72
    case 0:      pa_dwr_set = 0;                                  break;
73
    case 33:    pa_dwr_set = SOCKET1_POWER;                     break;
74
    case 50:    pa_dwr_set = SOCKET1_POWER;                     break;
75
    }
76
    break;
77
  }
78
 
79
  if (conf->vpp != conf->vcc && conf->vpp != 0) {
80
    printk(KERN_ERR "%s(): slot cannot support VPP %u\n",
81
           __FUNCTION__, conf->vpp);
82
    return -1;
83
  }
84
 
85
  ret = sa1111_pcmcia_configure_socket(conf);
86
  if (ret == 0) {
87
    unsigned long flags;
88
 
89
    local_irq_save(flags);
90
    PA_DWR = (PA_DWR & ~pa_dwr_mask) | pa_dwr_set;
91
    locla_irq_restore(flags);
92
  }
93
 
94
  return ret;
95
}
96
 
97
struct pcmcia_low_level jornada720_pcmcia_ops = {
98
  init:                 jornada720_pcmcia_init,
99
  shutdown:             sa1111_pcmcia_shutdown,
100
  socket_state:         sa1111_pcmcia_socket_state,
101
  get_irq_info:         sa1111_pcmcia_get_irq_info,
102
  configure_socket:     jornada720_pcmcia_configure_socket,
103
 
104
  socket_init:          sa1111_pcmcia_socket_init,
105
  socket_suspend:       sa1111_pcmcia_socket_suspend,
106
};
107
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.