Lines Matching refs:skt

34 static inline u32 pcmcia_readl(struct bcm63xx_pcmcia_socket *skt, u32 off)  in pcmcia_readl()  argument
36 return bcm_readl(skt->base + off); in pcmcia_readl()
39 static inline void pcmcia_writel(struct bcm63xx_pcmcia_socket *skt, in pcmcia_writel() argument
42 bcm_writel(val, skt->base + off); in pcmcia_writel()
78 struct bcm63xx_pcmcia_socket *skt; in bcm63xx_pcmcia_set_socket() local
82 skt = sock->driver_data; in bcm63xx_pcmcia_set_socket()
84 spin_lock_irqsave(&skt->lock, flags); in bcm63xx_pcmcia_set_socket()
90 val = pcmcia_readl(skt, PCMCIA_C1_REG); in bcm63xx_pcmcia_set_socket()
97 if (skt->card_detected && (skt->card_type & CARD_CARDBUS)) in bcm63xx_pcmcia_set_socket()
100 pcmcia_writel(skt, val, PCMCIA_C1_REG); in bcm63xx_pcmcia_set_socket()
103 skt->requested_state = *state; in bcm63xx_pcmcia_set_socket()
105 spin_unlock_irqrestore(&skt->lock, flags); in bcm63xx_pcmcia_set_socket()
162 static unsigned int __get_socket_status(struct bcm63xx_pcmcia_socket *skt) in __get_socket_status() argument
170 val = pcmcia_readl(skt, PCMCIA_C1_REG); in __get_socket_status()
176 if ((stat & SS_DETECT) && !skt->card_detected) { in __get_socket_status()
182 pcmcia_writel(skt, val, PCMCIA_C1_REG); in __get_socket_status()
186 val = pcmcia_readl(skt, PCMCIA_C1_REG); in __get_socket_status()
193 pcmcia_writel(skt, val, PCMCIA_C1_REG); in __get_socket_status()
197 val = pcmcia_readl(skt, PCMCIA_C1_REG); in __get_socket_status()
204 pcmcia_writel(skt, val, PCMCIA_C1_REG); in __get_socket_status()
208 val = pcmcia_readl(skt, PCMCIA_C1_REG); in __get_socket_status()
213 skt->card_type = vscd_to_cardtype[stat]; in __get_socket_status()
214 if (!skt->card_type) in __get_socket_status()
215 dev_err(&skt->socket.dev, "unsupported card type\n"); in __get_socket_status()
222 if (skt->card_type & CARD_PCCARD) in __get_socket_status()
227 pcmcia_writel(skt, val, PCMCIA_C1_REG); in __get_socket_status()
229 skt->card_detected = (stat & SS_DETECT) ? 1 : 0; in __get_socket_status()
232 if (skt->card_type & CARD_CARDBUS) in __get_socket_status()
234 if (skt->card_type & CARD_3V) in __get_socket_status()
236 if (skt->card_type & CARD_XV) in __get_socket_status()
240 if (gpio_get_value(skt->pd->ready_gpio)) in __get_socket_status()
252 struct bcm63xx_pcmcia_socket *skt; in bcm63xx_pcmcia_get_status() local
254 skt = sock->driver_data; in bcm63xx_pcmcia_get_status()
256 spin_lock_bh(&skt->lock); in bcm63xx_pcmcia_get_status()
257 *status = __get_socket_status(skt); in bcm63xx_pcmcia_get_status()
258 spin_unlock_bh(&skt->lock); in bcm63xx_pcmcia_get_status()
268 struct bcm63xx_pcmcia_socket *skt; in bcm63xx_pcmcia_poll() local
271 skt = from_timer(skt, t, timer); in bcm63xx_pcmcia_poll()
273 spin_lock_bh(&skt->lock); in bcm63xx_pcmcia_poll()
275 stat = __get_socket_status(skt); in bcm63xx_pcmcia_poll()
279 events = (stat ^ skt->old_status) & skt->requested_state.csc_mask; in bcm63xx_pcmcia_poll()
280 skt->old_status = stat; in bcm63xx_pcmcia_poll()
281 spin_unlock_bh(&skt->lock); in bcm63xx_pcmcia_poll()
284 pcmcia_parse_events(&skt->socket, events); in bcm63xx_pcmcia_poll()
286 mod_timer(&skt->timer, in bcm63xx_pcmcia_poll()
301 struct bcm63xx_pcmcia_socket *skt; in bcm63xx_pcmcia_set_mem_map() local
304 skt = sock->driver_data; in bcm63xx_pcmcia_set_mem_map()
306 res = skt->attr_res; in bcm63xx_pcmcia_set_mem_map()
308 res = skt->common_res; in bcm63xx_pcmcia_set_mem_map()
328 struct bcm63xx_pcmcia_socket *skt; in bcm63xx_drv_pcmcia_probe() local
335 skt = kzalloc(sizeof(*skt), GFP_KERNEL); in bcm63xx_drv_pcmcia_probe()
336 if (!skt) in bcm63xx_drv_pcmcia_probe()
338 spin_lock_init(&skt->lock); in bcm63xx_drv_pcmcia_probe()
339 sock = &skt->socket; in bcm63xx_drv_pcmcia_probe()
340 sock->driver_data = skt; in bcm63xx_drv_pcmcia_probe()
343 skt->common_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); in bcm63xx_drv_pcmcia_probe()
344 skt->attr_res = platform_get_resource(pdev, IORESOURCE_MEM, 2); in bcm63xx_drv_pcmcia_probe()
346 skt->pd = pdev->dev.platform_data; in bcm63xx_drv_pcmcia_probe()
347 if (!skt->common_res || !skt->attr_res || !irq_res || !skt->pd) { in bcm63xx_drv_pcmcia_probe()
359 skt->reg_res = res; in bcm63xx_drv_pcmcia_probe()
361 skt->base = ioremap(res->start, regmem_size); in bcm63xx_drv_pcmcia_probe()
362 if (!skt->base) { in bcm63xx_drv_pcmcia_probe()
370 skt->io_base = ioremap(res->start, iomem_size); in bcm63xx_drv_pcmcia_probe()
371 if (!skt->io_base) { in bcm63xx_drv_pcmcia_probe()
382 sock->io_offset = (unsigned long)skt->io_base; in bcm63xx_drv_pcmcia_probe()
392 sock->map_size = resource_size(skt->common_res); in bcm63xx_drv_pcmcia_probe()
395 timer_setup(&skt->timer, bcm63xx_pcmcia_poll, 0); in bcm63xx_drv_pcmcia_probe()
400 val = pcmcia_readl(skt, PCMCIA_C1_REG); in bcm63xx_drv_pcmcia_probe()
403 pcmcia_writel(skt, val, PCMCIA_C1_REG); in bcm63xx_drv_pcmcia_probe()
415 pcmcia_writel(skt, val, PCMCIA_C2_REG); in bcm63xx_drv_pcmcia_probe()
422 mod_timer(&skt->timer, in bcm63xx_drv_pcmcia_probe()
425 platform_set_drvdata(pdev, skt); in bcm63xx_drv_pcmcia_probe()
429 if (skt->io_base) in bcm63xx_drv_pcmcia_probe()
430 iounmap(skt->io_base); in bcm63xx_drv_pcmcia_probe()
431 if (skt->base) in bcm63xx_drv_pcmcia_probe()
432 iounmap(skt->base); in bcm63xx_drv_pcmcia_probe()
433 if (skt->reg_res) in bcm63xx_drv_pcmcia_probe()
434 release_mem_region(skt->reg_res->start, regmem_size); in bcm63xx_drv_pcmcia_probe()
435 kfree(skt); in bcm63xx_drv_pcmcia_probe()
441 struct bcm63xx_pcmcia_socket *skt; in bcm63xx_drv_pcmcia_remove() local
444 skt = platform_get_drvdata(pdev); in bcm63xx_drv_pcmcia_remove()
445 del_timer_sync(&skt->timer); in bcm63xx_drv_pcmcia_remove()
446 iounmap(skt->base); in bcm63xx_drv_pcmcia_remove()
447 iounmap(skt->io_base); in bcm63xx_drv_pcmcia_remove()
448 res = skt->reg_res; in bcm63xx_drv_pcmcia_remove()
450 kfree(skt); in bcm63xx_drv_pcmcia_remove()