18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef BCM63XX_PCMCIA_H_
38c2ecf20Sopenharmony_ci#define BCM63XX_PCMCIA_H_
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/types.h>
68c2ecf20Sopenharmony_ci#include <linux/timer.h>
78c2ecf20Sopenharmony_ci#include <pcmcia/ss.h>
88c2ecf20Sopenharmony_ci#include <bcm63xx_dev_pcmcia.h>
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci/* socket polling rate in ms */
118c2ecf20Sopenharmony_ci#define BCM63XX_PCMCIA_POLL_RATE	500
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_cienum {
148c2ecf20Sopenharmony_ci	CARD_CARDBUS = (1 << 0),
158c2ecf20Sopenharmony_ci	CARD_PCCARD = (1 << 1),
168c2ecf20Sopenharmony_ci	CARD_5V = (1 << 2),
178c2ecf20Sopenharmony_ci	CARD_3V = (1 << 3),
188c2ecf20Sopenharmony_ci	CARD_XV = (1 << 4),
198c2ecf20Sopenharmony_ci	CARD_YV = (1 << 5),
208c2ecf20Sopenharmony_ci};
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_cistruct bcm63xx_pcmcia_socket {
238c2ecf20Sopenharmony_ci	struct pcmcia_socket socket;
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci	/* platform specific data */
268c2ecf20Sopenharmony_ci	struct bcm63xx_pcmcia_platform_data *pd;
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci	/* all regs access are protected by this spinlock */
298c2ecf20Sopenharmony_ci	spinlock_t lock;
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci	/* pcmcia registers resource */
328c2ecf20Sopenharmony_ci	struct resource *reg_res;
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci	/* base remapped address of registers */
358c2ecf20Sopenharmony_ci	void __iomem *base;
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci	/* whether a card is detected at the moment */
388c2ecf20Sopenharmony_ci	int card_detected;
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci	/* type of detected card (mask of above enum) */
418c2ecf20Sopenharmony_ci	u8 card_type;
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci	/* keep last socket status to implement event reporting */
448c2ecf20Sopenharmony_ci	unsigned int old_status;
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci	/* backup of requested socket state */
478c2ecf20Sopenharmony_ci	socket_state_t requested_state;
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci	/* timer used for socket status polling */
508c2ecf20Sopenharmony_ci	struct timer_list timer;
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci	/* attribute/common memory resources */
538c2ecf20Sopenharmony_ci	struct resource *attr_res;
548c2ecf20Sopenharmony_ci	struct resource *common_res;
558c2ecf20Sopenharmony_ci	struct resource *io_res;
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci	/* base address of io memory */
588c2ecf20Sopenharmony_ci	void __iomem *io_base;
598c2ecf20Sopenharmony_ci};
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#endif /* BCM63XX_PCMCIA_H_ */
62