Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src Pull up following revision(s) (requested by maya in ticke...
details: https://anonhg.NetBSD.org/src/rev/01681f711d8a
branches: netbsd-8
changeset: 435061:01681f711d8a
user: martin <martin%NetBSD.org@localhost>
date: Thu Jun 14 19:57:23 2018 +0000
description:
Pull up following revision(s) (requested by maya in ticket #878):
share/man/man4/rtsx.4: revision 1.5
sys/dev/pci/pcidevs: revision 1.1331
sys/dev/ic/rtsxreg.h: revision 1.3
sys/dev/ic/rtsxvar.h: revision 1.3
sys/dev/pci/rtsx_pci.c: revision 1.7
sys/dev/ic/rtsx.c: revision 1.3
add realtek RT525A PCI-E card reader
found in my Dell XPS 15 9550.
rtsx(4): Add support for RT525A, from openbsd.
ok rkujawa
Denote RTS525A, bump date
diffstat:
share/man/man4/rtsx.4 | 6 ++--
sys/dev/ic/rtsx.c | 30 +++++++++++++++++++----
sys/dev/ic/rtsxreg.h | 10 +++++++-
sys/dev/ic/rtsxvar.h | 12 +++++---
sys/dev/pci/pcidevs | 3 +-
sys/dev/pci/rtsx_pci.c | 63 +++++++++++++++++++++++++++----------------------
6 files changed, 80 insertions(+), 44 deletions(-)
diffs (294 lines):
diff -r 174eb55ef005 -r 01681f711d8a share/man/man4/rtsx.4
--- a/share/man/man4/rtsx.4 Thu Jun 14 19:54:40 2018 +0000
+++ b/share/man/man4/rtsx.4 Thu Jun 14 19:57:23 2018 +0000
@@ -1,10 +1,10 @@
-.\" $NetBSD: rtsx.4,v 1.4 2014/10/29 14:33:23 nonaka Exp $
+.\" $NetBSD: rtsx.4,v 1.4.8.1 2018/06/14 19:57:23 martin Exp $
.\" $OpenBSD: rtsx.4,v 1.6 2014/05/18 10:52:17 stsp Exp $
.\"
.\" Theo de Raadt, 2006. Public Domain.
.\" Stefan Sperling, 2012. Public Domain.
.\"
-.Dd October 29, 2014
+.Dd April 24, 2018
.Dt RTSX 4
.Os
.Sh NAME
@@ -17,7 +17,7 @@
The
.Nm
driver provides support for the Realtek RTS5209, RTS5227, RTS5229,
-RTL8402, RTL8411 and RTL8411B SD card readers.
+RTS525A, RTL8402, RTL8411 and RTL8411B SD card readers.
.Pp
The
.Xr sdmmc 4
diff -r 174eb55ef005 -r 01681f711d8a sys/dev/ic/rtsx.c
--- a/sys/dev/ic/rtsx.c Thu Jun 14 19:54:40 2018 +0000
+++ b/sys/dev/ic/rtsx.c Thu Jun 14 19:57:23 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rtsx.c,v 1.2 2014/10/29 14:24:09 nonaka Exp $ */
+/* $NetBSD: rtsx.c,v 1.2.12.1 2018/06/14 19:57:24 martin Exp $ */
/* $OpenBSD: rtsx.c,v 1.10 2014/08/19 17:55:03 phessler Exp $ */
/*
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsx.c,v 1.2 2014/10/29 14:24:09 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsx.c,v 1.2.12.1 2018/06/14 19:57:24 martin Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -560,7 +560,9 @@
disable3 = RTSX_PULL_CTL_DISABLE3;
if (RTSX_IS_RTS5209(sc))
RTSX_SET(sc, RTSX_PWR_GATE_CTRL, RTSX_LDO3318_OFF);
- else if (RTSX_IS_RTS5227(sc) || RTSX_IS_RTS5229(sc)) {
+ else if (RTSX_IS_RTS5227(sc)
+ || RTSX_IS_RTS5229(sc)
+ || RTSX_IS_RTS525A(sc)) {
RTSX_CLR(sc, RTSX_PWR_GATE_CTRL, RTSX_LDO3318_VCC1 |
RTSX_LDO3318_VCC2);
if (RTSX_IS_RTS5229_TYPE_C(sc))
@@ -578,7 +580,10 @@
RTSX_CLR(sc, RTSX_CARD_PWR_CTL, RTSX_PMOS_STRG_800mA);
/* Disable pull control. */
- if (RTSX_IS_RTS5209(sc) || RTSX_IS_RTS5227(sc) || RTSX_IS_RTS5229(sc)) {
+ if (RTSX_IS_RTS5209(sc)
+ || RTSX_IS_RTS5227(sc)
+ || RTSX_IS_RTS5229(sc)
+ || RTSX_IS_RTS525A(sc)) {
RTSX_WRITE(sc, RTSX_CARD_PULL_CTL1, RTSX_PULL_CTL_DISABLE12);
RTSX_WRITE(sc, RTSX_CARD_PULL_CTL2, RTSX_PULL_CTL_DISABLE12);
RTSX_WRITE(sc, RTSX_CARD_PULL_CTL3, disable3);
@@ -612,13 +617,23 @@
{
uint8_t enable3;
+ if (RTSX_IS_RTS525A(sc)) {
+ int err = rtsx_write(sc, RTSX_LDO_VCC_CFG1, RTSX_LDO_VCC_TUNE_MASK,
+ RTSX_LDO_VCC_3V3);
+ if (err)
+ return err;
+ }
+
/* Select SD card. */
RTSX_WRITE(sc, RTSX_CARD_SELECT, RTSX_SD_MOD_SEL);
RTSX_WRITE(sc, RTSX_CARD_SHARE_MODE, RTSX_CARD_SHARE_48_SD);
RTSX_SET(sc, RTSX_CARD_CLK_EN, RTSX_SD_CLK_EN);
/* Enable pull control. */
- if (RTSX_IS_RTS5209(sc) || RTSX_IS_RTS5227(sc) || RTSX_IS_RTS5229(sc)) {
+ if (RTSX_IS_RTS5209(sc)
+ || RTSX_IS_RTS5227(sc)
+ || RTSX_IS_RTS5229(sc)
+ || RTSX_IS_RTS525A(sc)) {
RTSX_WRITE(sc, RTSX_CARD_PULL_CTL1, RTSX_PULL_CTL_ENABLE12);
RTSX_WRITE(sc, RTSX_CARD_PULL_CTL2, RTSX_PULL_CTL_ENABLE12);
if (RTSX_IS_RTS5229_TYPE_C(sc))
@@ -653,7 +668,10 @@
* delay in between.
*/
- if (RTSX_IS_RTS5209(sc) || RTSX_IS_RTS5227(sc) || RTSX_IS_RTS5229(sc)) {
+ if (RTSX_IS_RTS5209(sc)
+ || RTSX_IS_RTS5227(sc)
+ || RTSX_IS_RTS5229(sc)
+ || RTSX_IS_RTS525A(sc)) {
/* Partial power. */
RTSX_SET(sc, RTSX_CARD_PWR_CTL, RTSX_SD_PARTIAL_PWR_ON);
if (RTSX_IS_RTS5209(sc))
diff -r 174eb55ef005 -r 01681f711d8a sys/dev/ic/rtsxreg.h
--- a/sys/dev/ic/rtsxreg.h Thu Jun 14 19:54:40 2018 +0000
+++ b/sys/dev/ic/rtsxreg.h Thu Jun 14 19:57:23 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rtsxreg.h,v 1.2 2014/10/29 14:24:09 nonaka Exp $ */
+/* $NetBSD: rtsxreg.h,v 1.2.12.1 2018/06/14 19:57:24 martin Exp $ */
/* $OpenBSD: rtsxreg.h,v 1.3 2013/11/26 20:33:16 deraadt Exp $ */
/*
@@ -544,6 +544,14 @@
#define RTSX_DUMMY_REG 0xFE90
+#define RTSX_LDO_VCC_CFG1 0xFF73
+#define RTSX_LDO_VCC_REF_TUNE_MASK 0x30
+#define RTSX_LDO_VCC_REF_1V2 0x20
+#define RTSX_LDO_VCC_TUNE_MASK 0x07
+#define RTSX_LDO_VCC_1V8 0x04
+#define RTSX_LDO_VCC_3V3 0x07
+#define RTSX_LDO_VCC_LMT_EN 0x08
+
#define RTSX_SG_INT 0x04
#define RTSX_SG_END 0x02
#define RTSX_SG_VALID 0x01
diff -r 174eb55ef005 -r 01681f711d8a sys/dev/ic/rtsxvar.h
--- a/sys/dev/ic/rtsxvar.h Thu Jun 14 19:54:40 2018 +0000
+++ b/sys/dev/ic/rtsxvar.h Thu Jun 14 19:57:23 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rtsxvar.h,v 1.2 2014/10/29 14:24:09 nonaka Exp $ */
+/* $NetBSD: rtsxvar.h,v 1.2.12.1 2018/06/14 19:57:24 martin Exp $ */
/* $OpenBSD: rtsxvar.h,v 1.3 2014/08/19 17:55:03 phessler Exp $ */
/*
@@ -57,10 +57,11 @@
#define RTSX_F_5227 __BIT(3)
#define RTSX_F_5229 __BIT(4)
#define RTSX_F_5229_TYPE_C __BIT(5)
-#define RTSX_F_8402 __BIT(6)
-#define RTSX_F_8411 __BIT(7)
-#define RTSX_F_8411B __BIT(8)
-#define RTSX_F_8411B_QFN48 __BIT(9)
+#define RTSX_F_525A __BIT(6)
+#define RTSX_F_8402 __BIT(7)
+#define RTSX_F_8411 __BIT(8)
+#define RTSX_F_8411B __BIT(9)
+#define RTSX_F_8411B_QFN48 __BIT(10)
};
#define RTSX_IS_RTS5209(sc) (((sc)->sc_flags & RTSX_F_5209) == RTSX_F_5209)
@@ -69,6 +70,7 @@
#define RTSX_IS_RTS5229_TYPE_C(sc) \
(((sc)->sc_flags & (RTSX_F_5229|RTSX_F_5229_TYPE_C)) == \
(RTSX_F_5229|RTSX_F_5229_TYPE_C))
+#define RTSX_IS_RTS525A(sc) (((sc)->sc_flags & RTSX_F_525A) == RTSX_F_525A)
#define RTSX_IS_RTL8402(sc) (((sc)->sc_flags & RTSX_F_8402) == RTSX_F_8402)
#define RTSX_IS_RTL8411(sc) (((sc)->sc_flags & RTSX_F_8411) == RTSX_F_8411)
#define RTSX_IS_RTL8411B(sc) \
diff -r 174eb55ef005 -r 01681f711d8a sys/dev/pci/pcidevs
--- a/sys/dev/pci/pcidevs Thu Jun 14 19:54:40 2018 +0000
+++ b/sys/dev/pci/pcidevs Thu Jun 14 19:57:23 2018 +0000
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.7 2018/06/07 18:12:17 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.8 2018/06/14 19:57:24 martin Exp $
/*
* Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -6509,6 +6509,7 @@
product REALTEK RTS5227 0x5227 RTS5227 PCI-E Card Reader
product REALTEK RTS5229 0x5229 RTS5229 PCI-E Card Reader
product REALTEK RTS5249 0x5249 RTS5249 PCI-E Card Reader
+product REALTEK RTS525A 0x525A RTS525A PCI-E Card Reader
product REALTEK RTL8402 0x5286 RTL8402 PCI-E Card Reader
product REALTEK RTL8411B 0x5287 RTL8411B PCI-E Card Reader
product REALTEK RTL8411 0x5289 RTL8411 PCI-E Card Reader
diff -r 174eb55ef005 -r 01681f711d8a sys/dev/pci/rtsx_pci.c
--- a/sys/dev/pci/rtsx_pci.c Thu Jun 14 19:54:40 2018 +0000
+++ b/sys/dev/pci/rtsx_pci.c Thu Jun 14 19:57:23 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rtsx_pci.c,v 1.6 2016/07/07 06:55:41 msaitoh Exp $ */
+/* $NetBSD: rtsx_pci.c,v 1.6.10.1 2018/06/14 19:57:24 martin Exp $ */
/* $OpenBSD: rtsx_pci.c,v 1.7 2014/08/19 17:55:03 phessler Exp $ */
@@ -20,7 +20,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsx_pci.c,v 1.6 2016/07/07 06:55:41 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsx_pci.c,v 1.6.10.1 2018/06/14 19:57:24 martin Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -36,7 +36,8 @@
#include <dev/sdmmc/sdmmcvar.h>
-#define RTSX_PCI_BAR 0x10
+#define RTSX_PCI_BAR 0x10
+#define RTSX_PCI_BAR_525A 0x14
struct rtsx_pci_softc {
struct rtsx_softc sc;
@@ -78,6 +79,7 @@
case PCI_PRODUCT_REALTEK_RTS5209:
case PCI_PRODUCT_REALTEK_RTS5227:
case PCI_PRODUCT_REALTEK_RTS5229:
+ case PCI_PRODUCT_REALTEK_RTS525A:
case PCI_PRODUCT_REALTEK_RTL8402:
case PCI_PRODUCT_REALTEK_RTL8411:
case PCI_PRODUCT_REALTEK_RTL8411B:
@@ -100,11 +102,40 @@
bus_space_handle_t ioh;
bus_size_t size;
uint32_t flags;
+ int bar = RTSX_PCI_BAR;
char intrbuf[PCI_INTRSTR_LEN];
sc->sc.sc_dev = self;
sc->sc_pc = pc;
+ 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;
+ case PCI_PRODUCT_REALTEK_RTS525A:
+ flags = RTSX_F_525A;
+ bar = RTSX_PCI_BAR_525A;
+ break;
+ case PCI_PRODUCT_REALTEK_RTL8402:
+ flags = RTSX_F_8402;
+ break;
+ case PCI_PRODUCT_REALTEK_RTL8411:
+ flags = RTSX_F_8411;
+ break;
+ case PCI_PRODUCT_REALTEK_RTL8411B:
+ flags = RTSX_F_8411B;
+ break;
+ default:
+ flags = 0;
+ break;
+ }
+
pci_aprint_devinfo(pa, NULL);
if ((pci_conf_read(pc, tag, RTSX_CFG_PCI) & RTSX_CFG_ASIC) != 0) {
@@ -112,7 +143,7 @@
return;
}
- if (pci_mapreg_map(pa, RTSX_PCI_BAR, PCI_MAPREG_TYPE_MEM, 0,
+ if (pci_mapreg_map(pa, bar, PCI_MAPREG_TYPE_MEM, 0,
&iot, &ioh, NULL, &size)) {
aprint_error_dev(self, "couldn't map registers\n");
return;
@@ -139,30 +170,6 @@
/* Power up the device */
pci_set_powerstate(pc, tag, PCI_PMCSR_STATE_D0);
- 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;
- case PCI_PRODUCT_REALTEK_RTL8402:
- flags = RTSX_F_8402;
- break;
- case PCI_PRODUCT_REALTEK_RTL8411:
- flags = RTSX_F_8411;
- break;
- case PCI_PRODUCT_REALTEK_RTL8411B:
- flags = RTSX_F_8411B;
- break;
- default:
- flags = 0;
- break;
- }
-
if (rtsx_attach(&sc->sc, iot, ioh, size, pa->pa_dmat, flags) != 0) {
aprint_error_dev(self, "couldn't initialize chip\n");
return;
Home |
Main Index |
Thread Index |
Old Index