net/mlx4_core: Reduce harmless SRIOV error message to debug level
[linux-2.6-block.git] / drivers / pcmcia / sa1100_cerf.c
CommitLineData
1da177e4
LT
1/*
2 * drivers/pcmcia/sa1100_cerf.c
3 *
4 * PCMCIA implementation routines for CerfBoard
5 * Based off the Assabet.
6 *
7 */
1da177e4
LT
8#include <linux/module.h>
9#include <linux/kernel.h>
1da177e4
LT
10#include <linux/device.h>
11#include <linux/init.h>
12#include <linux/delay.h>
bbb58a12 13#include <linux/gpio.h>
1da177e4 14
a09e64fb 15#include <mach/hardware.h>
1da177e4
LT
16#include <asm/mach-types.h>
17#include <asm/irq.h>
a09e64fb 18#include <mach/cerf.h>
1da177e4
LT
19#include "sa1100_generic.h"
20
21#define CERF_SOCKET 1
22
1da177e4
LT
23static int cerf_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
24{
bbb58a12
RK
25 int ret;
26
27 ret = gpio_request_one(CERF_GPIO_CF_RESET, GPIOF_OUT_INIT_LOW, "CF_RESET");
28 if (ret)
29 return ret;
30
f793e3ab
RK
31 skt->stat[SOC_STAT_CD].gpio = CERF_GPIO_CF_CD;
32 skt->stat[SOC_STAT_CD].name = "CF_CD";
33 skt->stat[SOC_STAT_BVD1].gpio = CERF_GPIO_CF_BVD1;
34 skt->stat[SOC_STAT_BVD1].name = "CF_BVD1";
35 skt->stat[SOC_STAT_BVD2].gpio = CERF_GPIO_CF_BVD2;
36 skt->stat[SOC_STAT_BVD2].name = "CF_BVD2";
37 skt->stat[SOC_STAT_RDY].gpio = CERF_GPIO_CF_IRQ;
38 skt->stat[SOC_STAT_RDY].name = "CF_IRQ";
1da177e4 39
f793e3ab 40 return 0;
1da177e4
LT
41}
42
bbb58a12
RK
43static void cerf_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
44{
45 gpio_free(CERF_GPIO_CF_RESET);
46}
47
1da177e4
LT
48static int
49cerf_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
50 const socket_state_t *state)
51{
52 switch (state->Vcc) {
53 case 0:
54 case 50:
55 case 33:
56 break;
57
58 default:
59 printk(KERN_ERR "%s(): unrecognized Vcc %u\n",
2e11cb4c 60 __func__, state->Vcc);
1da177e4
LT
61 return -1;
62 }
63
bbb58a12 64 gpio_set_value(CERF_GPIO_CF_RESET, !!(state->flags & SS_RESET));
1da177e4
LT
65
66 return 0;
67}
68
1da177e4
LT
69static struct pcmcia_low_level cerf_pcmcia_ops = {
70 .owner = THIS_MODULE,
71 .hw_init = cerf_pcmcia_hw_init,
bbb58a12 72 .hw_shutdown = cerf_pcmcia_hw_shutdown,
a1d05002 73 .socket_state = soc_common_cf_socket_state,
1da177e4 74 .configure_socket = cerf_pcmcia_configure_socket,
1da177e4
LT
75};
76
34cdf25a 77int pcmcia_cerf_init(struct device *dev)
1da177e4
LT
78{
79 int ret = -ENODEV;
80
81 if (machine_is_cerf())
82 ret = sa11xx_drv_pcmcia_probe(dev, &cerf_pcmcia_ops, CERF_SOCKET, 1);
83
84 return ret;
85}