From: phessler Date: Tue, 19 Aug 2014 17:55:03 +0000 (+0000) Subject: Enable rts5227, as found in my new Thinkpad x240. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e518625a2e29ecd0be585a77495d0b0db706116a;p=openbsd Enable rts5227, as found in my new Thinkpad x240. Shuffle the code around slightly, so we special case the 5209 chipset instead of semi-randomly. Tested on rts5227 by me, and rts5209 by stsp@ OK stsp@ --- diff --git a/sys/dev/ic/rtsx.c b/sys/dev/ic/rtsx.c index 1e782aef817..ece1a8950ce 100644 --- a/sys/dev/ic/rtsx.c +++ b/sys/dev/ic/rtsx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsx.c,v 1.9 2014/05/18 10:52:16 stsp Exp $ */ +/* $OpenBSD: rtsx.c,v 1.10 2014/08/19 17:55:03 phessler Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler @@ -482,10 +482,10 @@ rtsx_bus_power_on(struct rtsx_softc *sc) /* Partial power. */ RTSX_SET(sc, RTSX_CARD_PWR_CTL, RTSX_SD_PARTIAL_PWR_ON); - if (sc->flags & RTSX_F_5229) - RTSX_SET(sc, RTSX_PWR_GATE_CTRL, RTSX_LDO3318_VCC1); - else + if (sc->flags & RTSX_F_5209) RTSX_SET(sc, RTSX_PWR_GATE_CTRL, RTSX_LDO3318_SUSPEND); + else + RTSX_SET(sc, RTSX_PWR_GATE_CTRL, RTSX_LDO3318_VCC1); delay(200); diff --git a/sys/dev/ic/rtsxvar.h b/sys/dev/ic/rtsxvar.h index d94d264e8dd..345ead395f5 100644 --- a/sys/dev/ic/rtsxvar.h +++ b/sys/dev/ic/rtsxvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsxvar.h,v 1.2 2013/11/06 13:51:02 stsp Exp $ */ +/* $OpenBSD: rtsxvar.h,v 1.3 2014/08/19 17:55:03 phessler Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler @@ -49,7 +49,8 @@ int rtsx_intr(void *); #define RTSX_F_CARD_PRESENT 0x01 #define RTSX_F_SDIO_SUPPORT 0x02 #define RTSX_F_5209 0x04 -#define RTSX_F_5229 0x08 -#define RTSX_F_5229_TYPE_C 0x10 +#define RTSX_F_5227 0x08 +#define RTSX_F_5229 0x10 +#define RTSX_F_5229_TYPE_C 0x20 #endif diff --git a/sys/dev/pci/rtsx_pci.c b/sys/dev/pci/rtsx_pci.c index a6c8a227721..076bc0dd635 100644 --- a/sys/dev/pci/rtsx_pci.c +++ b/sys/dev/pci/rtsx_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsx_pci.c,v 1.6 2014/05/18 10:52:17 stsp Exp $ */ +/* $OpenBSD: rtsx_pci.c,v 1.7 2014/08/19 17:55:03 phessler Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler @@ -112,10 +112,20 @@ rtsx_pci_attach(struct device *parent, struct device *self, void *aux) pci_set_powerstate(pa->pa_pc, pa->pa_tag, PCI_PMCSR_STATE_D0); - if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_REALTEK_RTS5209) - flags = RTSX_F_5209; - else - flags = RTSX_F_5229; + switch (PCI_PRODUCT(pa->pa_id)) { + case PCI_PRODUCT_REALTEK_RTS5209: + flags = RTSX_F_5209; + break; + case PCI_PRODUCT_REALTEK_RTS5227: + flags = RTSX_F_5227; + break; + case PCI_PRODUCT_REALTEK_RTS5229: + flags = RTSX_F_5229; + break; + default: + flags = 0; + break; + } if (rtsx_attach(&sc->sc, iot, ioh, size, pa->pa_dmat, flags) != 0) printf("%s: can't initialize chip\n", sc->sc.sc_dev.dv_xname);