Deleted Added
full compact
sdhci_acpi.c (318494) sdhci_acpi.c (318496)
1/*-
2 * Copyright (c) 2017 Oleksandr Tymoshenko <gonzo@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 10 unchanged lines hidden (view full) ---

19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2017 Oleksandr Tymoshenko <gonzo@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 10 unchanged lines hidden (view full) ---

19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
27__FBSDID("$FreeBSD: stable/11/sys/dev/sdhci/sdhci_acpi.c 318494 2017-05-18 20:46:20Z marius $");
27__FBSDID("$FreeBSD: stable/11/sys/dev/sdhci/sdhci_acpi.c 318496 2017-05-18 21:00:50Z marius $");
28
29#include <sys/param.h>
30#include <sys/systm.h>
31#include <sys/bus.h>
32#include <sys/kernel.h>
33#include <sys/lock.h>
34#include <sys/module.h>
35#include <sys/mutex.h>

--- 16 unchanged lines hidden (view full) ---

52#include "sdhci_if.h"
53
54static const struct sdhci_acpi_device {
55 const char* hid;
56 int uid;
57 const char *desc;
58 u_int quirks;
59} sdhci_acpi_devices[] = {
28
29#include <sys/param.h>
30#include <sys/systm.h>
31#include <sys/bus.h>
32#include <sys/kernel.h>
33#include <sys/lock.h>
34#include <sys/module.h>
35#include <sys/mutex.h>

--- 16 unchanged lines hidden (view full) ---

52#include "sdhci_if.h"
53
54static const struct sdhci_acpi_device {
55 const char* hid;
56 int uid;
57 const char *desc;
58 u_int quirks;
59} sdhci_acpi_devices[] = {
60 { "80860F14", 1, "Intel Bay Trail eMMC 4.5 Controller",
60 { "80860F14", 1, "Intel Bay Trail/Braswell eMMC 4.5/4.5.1 Controller",
61 SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE |
62 SDHCI_QUIRK_INTEL_POWER_UP_RESET |
63 SDHCI_QUIRK_WAIT_WHILE_BUSY |
64 SDHCI_QUIRK_MMC_DDR52 |
65 SDHCI_QUIRK_CAPS_BIT63_FOR_MMC_HS400 |
66 SDHCI_QUIRK_PRESET_VALUE_BROKEN },
61 SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE |
62 SDHCI_QUIRK_INTEL_POWER_UP_RESET |
63 SDHCI_QUIRK_WAIT_WHILE_BUSY |
64 SDHCI_QUIRK_MMC_DDR52 |
65 SDHCI_QUIRK_CAPS_BIT63_FOR_MMC_HS400 |
66 SDHCI_QUIRK_PRESET_VALUE_BROKEN },
67 { "80860F14", 3, "Intel Bay Trail SDXC Controller",
67 { "80860F14", 3, "Intel Bay Trail/Braswell SDXC Controller",
68 SDHCI_QUIRK_WAIT_WHILE_BUSY |
69 SDHCI_QUIRK_PRESET_VALUE_BROKEN },
68 SDHCI_QUIRK_WAIT_WHILE_BUSY |
69 SDHCI_QUIRK_PRESET_VALUE_BROKEN },
70 { "80860F16", 0, "Intel Bay Trail SDXC Controller",
70 { "80860F16", 0, "Intel Bay Trail/Braswell SDXC Controller",
71 SDHCI_QUIRK_WAIT_WHILE_BUSY |
72 SDHCI_QUIRK_PRESET_VALUE_BROKEN },
71 SDHCI_QUIRK_WAIT_WHILE_BUSY |
72 SDHCI_QUIRK_PRESET_VALUE_BROKEN },
73 { "80865ACA", 0, "Intel Apollo Lake SDXC Controller",
74 SDHCI_QUIRK_BROKEN_DMA | /* APL18 erratum */
75 SDHCI_QUIRK_WAIT_WHILE_BUSY |
76 SDHCI_QUIRK_PRESET_VALUE_BROKEN },
77 { "80865ACC", 0, "Intel Apollo Lake eMMC 5.0 Controller",
78 SDHCI_QUIRK_BROKEN_DMA | /* APL18 erratum */
79 SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE |
80 SDHCI_QUIRK_INTEL_POWER_UP_RESET |
81 SDHCI_QUIRK_WAIT_WHILE_BUSY |
82 SDHCI_QUIRK_MMC_DDR52 |
83 SDHCI_QUIRK_CAPS_BIT63_FOR_MMC_HS400 |
84 SDHCI_QUIRK_PRESET_VALUE_BROKEN },
73 { NULL, 0, NULL, 0}
74};
75
76static char *sdhci_ids[] = {
77 "80860F14",
78 "80860F16",
85 { NULL, 0, NULL, 0}
86};
87
88static char *sdhci_ids[] = {
89 "80860F14",
90 "80860F16",
91 "80865ACA",
92 "80865ACC",
79 NULL
80};
81
82struct sdhci_acpi_softc {
83 u_int quirks; /* Chip specific quirks */
84 struct resource *irq_res; /* IRQ resource */
85 void *intrhand; /* Interrupt handle */
86

--- 157 unchanged lines hidden (view full) ---

244 sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
245 &rid, RF_ACTIVE);
246 if (sc->mem_res == NULL) {
247 device_printf(dev, "can't allocate memory resource for slot\n");
248 sdhci_acpi_detach(dev);
249 return (ENOMEM);
250 }
251
93 NULL
94};
95
96struct sdhci_acpi_softc {
97 u_int quirks; /* Chip specific quirks */
98 struct resource *irq_res; /* IRQ resource */
99 void *intrhand; /* Interrupt handle */
100

--- 157 unchanged lines hidden (view full) ---

258 sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
259 &rid, RF_ACTIVE);
260 if (sc->mem_res == NULL) {
261 device_printf(dev, "can't allocate memory resource for slot\n");
262 sdhci_acpi_detach(dev);
263 return (ENOMEM);
264 }
265
266 /* Intel Braswell eMMC 4.5.1 controller quirk */
267 if (strcmp(acpi_dev->hid, "80860F14") == 0 && acpi_dev->uid == 1 &&
268 SDHCI_READ_4(dev, &sc->slot, SDHCI_CAPABILITIES) == 0x446cc8b2 &&
269 SDHCI_READ_4(dev, &sc->slot, SDHCI_CAPABILITIES2) == 0x00000807)
270 sc->quirks |= SDHCI_QUIRK_DATA_TIMEOUT_1MHZ;
252 sc->quirks &= ~sdhci_quirk_clear;
253 sc->quirks |= sdhci_quirk_set;
254 sc->slot.quirks = sc->quirks;
255
256 err = sdhci_init_slot(dev, &sc->slot, 0);
257 if (err) {
258 device_printf(dev, "failed to init slot\n");
259 sdhci_acpi_detach(dev);

--- 125 unchanged lines hidden ---
271 sc->quirks &= ~sdhci_quirk_clear;
272 sc->quirks |= sdhci_quirk_set;
273 sc->slot.quirks = sc->quirks;
274
275 err = sdhci_init_slot(dev, &sc->slot, 0);
276 if (err) {
277 device_printf(dev, "failed to init slot\n");
278 sdhci_acpi_detach(dev);

--- 125 unchanged lines hidden ---