bpf: NULL pointer check is not needed in BPF_CGROUP_RUN_PROG_INET_SOCK
[linux-2.6/btrfs-unstable.git] / drivers / pcmcia / sa1100_shannon.c
blob0e52a575986e0be6e8acf9a228717dbe4026787a
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * drivers/pcmcia/sa1100_shannon.c
5 * PCMCIA implementation routines for Shannon
7 */
8 #include <linux/module.h>
9 #include <linux/kernel.h>
10 #include <linux/device.h>
11 #include <linux/init.h>
12 #include <linux/io.h>
14 #include <mach/hardware.h>
15 #include <asm/mach-types.h>
16 #include <mach/shannon.h>
17 #include <asm/irq.h>
18 #include "sa1100_generic.h"
20 static int shannon_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
22 /* All those are inputs */
23 GAFR &= ~(GPIO_GPIO(SHANNON_GPIO_EJECT_0) |
24 GPIO_GPIO(SHANNON_GPIO_EJECT_1) |
25 GPIO_GPIO(SHANNON_GPIO_RDY_0) |
26 GPIO_GPIO(SHANNON_GPIO_RDY_1));
28 if (skt->nr == 0) {
29 skt->stat[SOC_STAT_CD].gpio = SHANNON_GPIO_EJECT_0;
30 skt->stat[SOC_STAT_CD].name = "PCMCIA_CD_0";
31 skt->stat[SOC_STAT_RDY].gpio = SHANNON_GPIO_RDY_0;
32 skt->stat[SOC_STAT_RDY].name = "PCMCIA_RDY_0";
33 } else {
34 skt->stat[SOC_STAT_CD].gpio = SHANNON_GPIO_EJECT_1;
35 skt->stat[SOC_STAT_CD].name = "PCMCIA_CD_1";
36 skt->stat[SOC_STAT_RDY].gpio = SHANNON_GPIO_RDY_1;
37 skt->stat[SOC_STAT_RDY].name = "PCMCIA_RDY_1";
40 return 0;
43 static void
44 shannon_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
45 struct pcmcia_state *state)
47 switch (skt->nr) {
48 case 0:
49 state->bvd1 = 1;
50 state->bvd2 = 1;
51 state->vs_3v = 1; /* FIXME Can only apply 3.3V on Shannon. */
52 state->vs_Xv = 0;
53 break;
55 case 1:
56 state->bvd1 = 1;
57 state->bvd2 = 1;
58 state->vs_3v = 1; /* FIXME Can only apply 3.3V on Shannon. */
59 state->vs_Xv = 0;
60 break;
64 static int
65 shannon_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
66 const socket_state_t *state)
68 switch (state->Vcc) {
69 case 0: /* power off */
70 printk(KERN_WARNING "%s(): CS asked for 0V, still applying 3.3V..\n", __func__);
71 break;
72 case 50:
73 printk(KERN_WARNING "%s(): CS asked for 5V, applying 3.3V..\n", __func__);
74 case 33:
75 break;
76 default:
77 printk(KERN_ERR "%s(): unrecognized Vcc %u\n",
78 __func__, state->Vcc);
79 return -1;
82 printk(KERN_WARNING "%s(): Warning, Can't perform reset\n", __func__);
84 /* Silently ignore Vpp, output enable, speaker enable. */
86 return 0;
89 static struct pcmcia_low_level shannon_pcmcia_ops = {
90 .owner = THIS_MODULE,
91 .hw_init = shannon_pcmcia_hw_init,
92 .socket_state = shannon_pcmcia_socket_state,
93 .configure_socket = shannon_pcmcia_configure_socket,
96 int pcmcia_shannon_init(struct device *dev)
98 int ret = -ENODEV;
100 if (machine_is_shannon())
101 ret = sa11xx_drv_pcmcia_probe(dev, &shannon_pcmcia_ops, 0, 2);
103 return ret;