sdhci_fdt.c (be27b3116288a0ff98ddce9c853b6f4fe55e85ee) | sdhci_fdt.c (018101a836f0e0f36db6973bde543685ebf67436) |
---|---|
1/*- 2 * Copyright (c) 2012 Thomas Skibo 3 * Copyright (c) 2008 Alexander Motin <mav@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 43 unchanged lines hidden (view full) --- 52 53#include <dev/mmc/bridge.h> 54 55#include <dev/sdhci/sdhci.h> 56 57#include "mmcbr_if.h" 58#include "sdhci_if.h" 59 | 1/*- 2 * Copyright (c) 2012 Thomas Skibo 3 * Copyright (c) 2008 Alexander Motin <mav@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 43 unchanged lines hidden (view full) --- 52 53#include <dev/mmc/bridge.h> 54 55#include <dev/sdhci/sdhci.h> 56 57#include "mmcbr_if.h" 58#include "sdhci_if.h" 59 |
60#define MAX_SLOTS 6 | 60#define MAX_SLOTS 6 61#define SDHCI_FDT_ARMADA38X 1 62#define SDHCI_FDT_GENERIC 2 63#define SDHCI_FDT_XLNX_ZY7 3 |
61 | 64 |
65static struct ofw_compat_data compat_data[] = { 66 { "marvell,armada-380-sdhci", SDHCI_FDT_ARMADA38X }, 67 { "sdhci_generic", SDHCI_FDT_GENERIC }, 68 { "xlnx,zy7_sdhci", SDHCI_FDT_XLNX_ZY7 }, 69 { NULL, 0 } 70}; 71 |
|
62struct sdhci_fdt_softc { 63 device_t dev; /* Controller device */ 64 u_int quirks; /* Chip specific quirks */ 65 u_int caps; /* If we override SDHCI_CAPABILITIES */ 66 uint32_t max_clk; /* Max possible freq */ 67 struct resource *irq_res; /* IRQ resource */ 68 void *intrhand; /* Interrupt handle */ 69 --- 106 unchanged lines hidden (view full) --- 176 177 sc->quirks = 0; 178 sc->num_slots = 1; 179 sc->max_clk = 0; 180 181 if (!ofw_bus_status_okay(dev)) 182 return (ENXIO); 183 | 72struct sdhci_fdt_softc { 73 device_t dev; /* Controller device */ 74 u_int quirks; /* Chip specific quirks */ 75 u_int caps; /* If we override SDHCI_CAPABILITIES */ 76 uint32_t max_clk; /* Max possible freq */ 77 struct resource *irq_res; /* IRQ resource */ 78 void *intrhand; /* Interrupt handle */ 79 --- 106 unchanged lines hidden (view full) --- 186 187 sc->quirks = 0; 188 sc->num_slots = 1; 189 sc->max_clk = 0; 190 191 if (!ofw_bus_status_okay(dev)) 192 return (ENXIO); 193 |
184 if (ofw_bus_is_compatible(dev, "sdhci_generic")) { | 194 switch (ofw_bus_search_compatible(dev, compat_data)->ocd_data) { 195 case SDHCI_FDT_ARMADA38X: 196 sc->quirks = SDHCI_QUIRK_BROKEN_AUTO_STOP; 197 device_set_desc(dev, "ARMADA38X SDHCI controller"); 198 break; 199 case SDHCI_FDT_GENERIC: |
185 device_set_desc(dev, "generic fdt SDHCI controller"); | 200 device_set_desc(dev, "generic fdt SDHCI controller"); |
186 } else if (ofw_bus_is_compatible(dev, "xlnx,zy7_sdhci")) { | 201 break; 202 case SDHCI_FDT_XLNX_ZY7: |
187 sc->quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK; 188 device_set_desc(dev, "Zynq-7000 generic fdt SDHCI controller"); | 203 sc->quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK; 204 device_set_desc(dev, "Zynq-7000 generic fdt SDHCI controller"); |
189 } else | 205 break; 206 default: |
190 return (ENXIO); | 207 return (ENXIO); |
208 } |
|
191 192 node = ofw_bus_get_node(dev); 193 194 /* Allow dts to patch quirks, slots, and max-frequency. */ 195 if ((OF_getencprop(node, "quirks", &cid, sizeof(cid))) > 0) 196 sc->quirks = cid; 197 if ((OF_getencprop(node, "num-slots", &cid, sizeof(cid))) > 0) 198 sc->num_slots = cid; --- 131 unchanged lines hidden --- | 209 210 node = ofw_bus_get_node(dev); 211 212 /* Allow dts to patch quirks, slots, and max-frequency. */ 213 if ((OF_getencprop(node, "quirks", &cid, sizeof(cid))) > 0) 214 sc->quirks = cid; 215 if ((OF_getencprop(node, "num-slots", &cid, sizeof(cid))) > 0) 216 sc->num_slots = cid; --- 131 unchanged lines hidden --- |