Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dc7d243d authored by Marek Vasut's avatar Marek Vasut Committed by John W. Linville
Browse files

Add support for CF8381 WiFi card.



A detection function was added for identifying CF8381.

Signed-off-by: default avatarMarek Vasut <marek.vasut@gmail.com>
Acked-by: default avatarDan Williams <dcbw@redhat.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent fade5db4
Loading
Loading
Loading
Loading
+32 −2
Original line number Original line Diff line number Diff line
@@ -273,7 +273,28 @@ static int if_cs_poll_while_fw_download(struct if_cs_card *card, uint addr, u8 r
 */
 */
#define IF_CS_PRODUCT_ID		0x0000001C
#define IF_CS_PRODUCT_ID		0x0000001C
#define IF_CS_CF8385_B1_REV		0x12
#define IF_CS_CF8385_B1_REV		0x12
#define IF_CS_CF8381_B3_REV		0x04


/*
 * Used to detect other cards than CF8385 since their revisions of silicon
 * doesn't match those from CF8385, eg. CF8381 B3 works with this driver.
 */
#define CF8381_MANFID		0x02db
#define CF8381_CARDID		0x6064
#define CF8385_MANFID		0x02df
#define CF8385_CARDID		0x8103

static inline int if_cs_hw_is_cf8381(struct pcmcia_device *p_dev)
{
	return (p_dev->manf_id == CF8381_MANFID &&
		p_dev->card_id == CF8381_CARDID);
}

static inline int if_cs_hw_is_cf8385(struct pcmcia_device *p_dev)
{
	return (p_dev->manf_id == CF8385_MANFID &&
		p_dev->card_id == CF8385_CARDID);
}


/********************************************************************/
/********************************************************************/
/* I/O and interrupt handling                                       */
/* I/O and interrupt handling                                       */
@@ -757,6 +778,7 @@ static void if_cs_release(struct pcmcia_device *p_dev)
static int if_cs_probe(struct pcmcia_device *p_dev)
static int if_cs_probe(struct pcmcia_device *p_dev)
{
{
	int ret = -ENOMEM;
	int ret = -ENOMEM;
	unsigned int prod_id;
	struct lbs_private *priv;
	struct lbs_private *priv;
	struct if_cs_card *card;
	struct if_cs_card *card;
	/* CIS parsing */
	/* CIS parsing */
@@ -859,7 +881,14 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
	       p_dev->io.BasePort1 + p_dev->io.NumPorts1 - 1);
	       p_dev->io.BasePort1 + p_dev->io.NumPorts1 - 1);


	/* Check if we have a current silicon */
	/* Check if we have a current silicon */
	if (if_cs_read8(card, IF_CS_PRODUCT_ID) < IF_CS_CF8385_B1_REV) {
	prod_id = if_cs_read8(card, IF_CS_PRODUCT_ID);
	if (if_cs_hw_is_cf8381(p_dev) && prod_id < IF_CS_CF8381_B3_REV) {
		lbs_pr_err("old chips like 8381 rev B3 aren't supported\n");
		ret = -ENODEV;
		goto out2;
	}

	if (if_cs_hw_is_cf8385(p_dev) && prod_id < IF_CS_CF8385_B1_REV) {
		lbs_pr_err("old chips like 8385 rev B1 aren't supported\n");
		lbs_pr_err("old chips like 8385 rev B1 aren't supported\n");
		ret = -ENODEV;
		ret = -ENODEV;
		goto out2;
		goto out2;
@@ -950,7 +979,8 @@ static void if_cs_detach(struct pcmcia_device *p_dev)
/********************************************************************/
/********************************************************************/


static struct pcmcia_device_id if_cs_ids[] = {
static struct pcmcia_device_id if_cs_ids[] = {
	PCMCIA_DEVICE_MANF_CARD(0x02df, 0x8103),
	PCMCIA_DEVICE_MANF_CARD(CF8381_MANFID, CF8381_CARDID),
	PCMCIA_DEVICE_MANF_CARD(CF8385_MANFID, CF8385_CARDID),
	PCMCIA_DEVICE_NULL,
	PCMCIA_DEVICE_NULL,
};
};
MODULE_DEVICE_TABLE(pcmcia, if_cs_ids);
MODULE_DEVICE_TABLE(pcmcia, if_cs_ids);