^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef BCM63XX_PCMCIA_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define BCM63XX_PCMCIA_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <linux/timer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <pcmcia/ss.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <bcm63xx_dev_pcmcia.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) /* socket polling rate in ms */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define BCM63XX_PCMCIA_POLL_RATE 500
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) CARD_CARDBUS = (1 << 0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) CARD_PCCARD = (1 << 1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) CARD_5V = (1 << 2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) CARD_3V = (1 << 3),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) CARD_XV = (1 << 4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) CARD_YV = (1 << 5),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) struct bcm63xx_pcmcia_socket {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) struct pcmcia_socket socket;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) /* platform specific data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) struct bcm63xx_pcmcia_platform_data *pd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) /* all regs access are protected by this spinlock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) spinlock_t lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) /* pcmcia registers resource */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct resource *reg_res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /* base remapped address of registers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) void __iomem *base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) /* whether a card is detected at the moment */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) int card_detected;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) /* type of detected card (mask of above enum) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) u8 card_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) /* keep last socket status to implement event reporting */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) unsigned int old_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) /* backup of requested socket state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) socket_state_t requested_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) /* timer used for socket status polling */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) struct timer_list timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) /* attribute/common memory resources */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) struct resource *attr_res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) struct resource *common_res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) struct resource *io_res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) /* base address of io memory */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) void __iomem *io_base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #endif /* BCM63XX_PCMCIA_H_ */