^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Sharp SL-C7xx Series PCMCIA routines
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (c) 2004-2005 Richard Purdie
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Based on Sharp's 2.4 kernel patches and pxa2xx_mainstone.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <mach/hardware.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <asm/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <asm/hardware/scoop.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include "soc_common.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define NO_KEEP_VS 0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define SCOOP_DEV platform_scoop_config->devs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) static void sharpsl_pcmcia_init_reset(struct soc_pcmcia_socket *skt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) struct scoop_pcmcia_dev *scoopdev = &SCOOP_DEV[skt->nr];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) reset_scoop(scoopdev->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) /* Shared power controls need to be handled carefully */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) if (platform_scoop_config->power_ctrl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) platform_scoop_config->power_ctrl(scoopdev->dev, 0x0000, skt->nr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) write_scoop_reg(scoopdev->dev, SCOOP_CPR, 0x0000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) scoopdev->keep_vs = NO_KEEP_VS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) scoopdev->keep_rd = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) static int sharpsl_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) if (SCOOP_DEV[skt->nr].cd_irq >= 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) skt->stat[SOC_STAT_CD].irq = SCOOP_DEV[skt->nr].cd_irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) skt->stat[SOC_STAT_CD].name = SCOOP_DEV[skt->nr].cd_irq_str;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) skt->socket.pci_irq = SCOOP_DEV[skt->nr].irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) static void sharpsl_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) struct pcmcia_state *state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) unsigned short cpr, csr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) struct device *scoop = SCOOP_DEV[skt->nr].dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) cpr = read_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_CPR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) write_scoop_reg(scoop, SCOOP_IRM, 0x00FF);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) write_scoop_reg(scoop, SCOOP_ISR, 0x0000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) write_scoop_reg(scoop, SCOOP_IRM, 0x0000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) csr = read_scoop_reg(scoop, SCOOP_CSR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) if (csr & 0x0004) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) /* card eject */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) write_scoop_reg(scoop, SCOOP_CDR, 0x0000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) SCOOP_DEV[skt->nr].keep_vs = NO_KEEP_VS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) else if (!(SCOOP_DEV[skt->nr].keep_vs & NO_KEEP_VS)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) /* keep vs1,vs2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) write_scoop_reg(scoop, SCOOP_CDR, 0x0000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) csr |= SCOOP_DEV[skt->nr].keep_vs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) else if (cpr & 0x0003) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) /* power on */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) write_scoop_reg(scoop, SCOOP_CDR, 0x0000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) SCOOP_DEV[skt->nr].keep_vs = (csr & 0x00C0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) /* card detect */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) if ((machine_is_spitz() || machine_is_borzoi()) && skt->nr == 1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) write_scoop_reg(scoop, SCOOP_CDR, 0x0000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) write_scoop_reg(scoop, SCOOP_CDR, 0x0002);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) state->detect = (csr & 0x0004) ? 0 : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) state->ready = (csr & 0x0002) ? 1 : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) state->bvd1 = (csr & 0x0010) ? 1 : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) state->bvd2 = (csr & 0x0020) ? 1 : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) state->wrprot = (csr & 0x0008) ? 1 : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) state->vs_3v = (csr & 0x0040) ? 0 : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) state->vs_Xv = (csr & 0x0080) ? 0 : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) if ((cpr & 0x0080) && ((cpr & 0x8040) != 0x8040)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) printk(KERN_ERR "sharpsl_pcmcia_socket_state(): CPR=%04X, Low voltage!\n", cpr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) static int sharpsl_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) const socket_state_t *state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) struct device *scoop = SCOOP_DEV[skt->nr].dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) unsigned short cpr, ncpr, ccr, nccr, mcr, nmcr, imr, nimr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) switch (state->Vcc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) case 0: break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) case 33: break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) case 50: break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) printk(KERN_ERR "sharpsl_pcmcia_configure_socket(): bad Vcc %u\n", state->Vcc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) if ((state->Vpp!=state->Vcc) && (state->Vpp!=0)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) printk(KERN_ERR "CF slot cannot support Vpp %u\n", state->Vpp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) local_irq_save(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) nmcr = (mcr = read_scoop_reg(scoop, SCOOP_MCR)) & ~0x0010;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) ncpr = (cpr = read_scoop_reg(scoop, SCOOP_CPR)) & ~0x0083;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) nccr = (ccr = read_scoop_reg(scoop, SCOOP_CCR)) & ~0x0080;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) nimr = (imr = read_scoop_reg(scoop, SCOOP_IMR)) & ~0x003E;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) if ((machine_is_spitz() || machine_is_borzoi() || machine_is_akita()) && skt->nr == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) ncpr |= (state->Vcc == 33) ? 0x0002 :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) (state->Vcc == 50) ? 0x0002 : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) ncpr |= (state->Vcc == 33) ? 0x0001 :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) (state->Vcc == 50) ? 0x0002 : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) nmcr |= (state->flags&SS_IOCARD) ? 0x0010 : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) ncpr |= (state->flags&SS_OUTPUT_ENA) ? 0x0080 : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) nccr |= (state->flags&SS_RESET)? 0x0080: 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) nimr |= ((skt->status&SS_DETECT) ? 0x0004 : 0)|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) ((skt->status&SS_READY) ? 0x0002 : 0)|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) ((skt->status&SS_BATDEAD)? 0x0010 : 0)|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) ((skt->status&SS_BATWARN)? 0x0020 : 0)|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) ((skt->status&SS_STSCHG) ? 0x0010 : 0)|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) ((skt->status&SS_WRPROT) ? 0x0008 : 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) if (!(ncpr & 0x0003)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) SCOOP_DEV[skt->nr].keep_rd = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) } else if (!SCOOP_DEV[skt->nr].keep_rd) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) if (nccr & 0x0080)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) SCOOP_DEV[skt->nr].keep_rd = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) nccr |= 0x0080;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) if (mcr != nmcr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) write_scoop_reg(scoop, SCOOP_MCR, nmcr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) if (cpr != ncpr) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) if (platform_scoop_config->power_ctrl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) platform_scoop_config->power_ctrl(scoop, ncpr , skt->nr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) write_scoop_reg(scoop, SCOOP_CPR, ncpr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) if (ccr != nccr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) write_scoop_reg(scoop, SCOOP_CCR, nccr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) if (imr != nimr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) write_scoop_reg(scoop, SCOOP_IMR, nimr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) local_irq_restore(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) static void sharpsl_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) sharpsl_pcmcia_init_reset(skt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) /* Enable interrupt */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_IMR, 0x00C0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_MCR, 0x0101);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) SCOOP_DEV[skt->nr].keep_vs = NO_KEEP_VS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) static void sharpsl_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) sharpsl_pcmcia_init_reset(skt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) static struct pcmcia_low_level sharpsl_pcmcia_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) .hw_init = sharpsl_pcmcia_hw_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) .socket_state = sharpsl_pcmcia_socket_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) .configure_socket = sharpsl_pcmcia_configure_socket,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) .socket_init = sharpsl_pcmcia_socket_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) .socket_suspend = sharpsl_pcmcia_socket_suspend,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) .first = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) .nr = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) #ifdef CONFIG_SA1100_COLLIE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) #include "sa11xx_base.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) int pcmcia_collie_init(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) int ret = -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) if (machine_is_collie())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) ret = sa11xx_drv_pcmcia_probe(dev, &sharpsl_pcmcia_ops, 0, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) static struct platform_device *sharpsl_pcmcia_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) static int __init sharpsl_pcmcia_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) if (!platform_scoop_config)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) sharpsl_pcmcia_ops.nr = platform_scoop_config->num_devs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) sharpsl_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) if (!sharpsl_pcmcia_device)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) ret = platform_device_add_data(sharpsl_pcmcia_device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) &sharpsl_pcmcia_ops, sizeof(sharpsl_pcmcia_ops));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) if (ret == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) sharpsl_pcmcia_device->dev.parent = platform_scoop_config->devs[0].dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) ret = platform_device_add(sharpsl_pcmcia_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) platform_device_put(sharpsl_pcmcia_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) static void __exit sharpsl_pcmcia_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) platform_device_unregister(sharpsl_pcmcia_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) fs_initcall(sharpsl_pcmcia_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) module_exit(sharpsl_pcmcia_exit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) MODULE_DESCRIPTION("Sharp SL Series PCMCIA Support");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) MODULE_ALIAS("platform:pxa2xx-pcmcia");