bcm2835_sdhci.c (280571) | bcm2835_sdhci.c (281863) |
---|---|
1/*- 2 * Copyright (c) 2012 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 --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2012 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 --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c 280571 2015-03-25 11:53:52Z andrew $"); | 28__FBSDID("$FreeBSD: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c 281863 2015-04-22 18:35:02Z loos $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/bus.h> 33#include <sys/kernel.h> 34#include <sys/lock.h> 35#include <sys/malloc.h> 36#include <sys/module.h> --- 139 unchanged lines hidden (view full) --- 176 } 177 178 default_freq = 0; 179 err = bcm2835_mbox_get_clock_rate(dev, BCM2835_MBOX_CLOCK_ID_EMMC, 180 &default_freq); 181 if (err == 0) { 182 /* Convert to MHz */ 183 default_freq /= 1000000; | 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/bus.h> 33#include <sys/kernel.h> 34#include <sys/lock.h> 35#include <sys/malloc.h> 36#include <sys/module.h> --- 139 unchanged lines hidden (view full) --- 176 } 177 178 default_freq = 0; 179 err = bcm2835_mbox_get_clock_rate(dev, BCM2835_MBOX_CLOCK_ID_EMMC, 180 &default_freq); 181 if (err == 0) { 182 /* Convert to MHz */ 183 default_freq /= 1000000; |
184 if (bootverbose) 185 device_printf(dev, "default frequency: %dMHz\n", 186 default_freq); | |
187 } | 184 } |
185 if (default_freq == 0) { 186 node = ofw_bus_get_node(sc->sc_dev); 187 if ((OF_getencprop(node, "clock-frequency", &cell, 188 sizeof(cell))) > 0) 189 default_freq = cell / 1000000; 190 } |
|
188 if (default_freq == 0) 189 default_freq = BCM2835_DEFAULT_SDHCI_FREQ; 190 | 191 if (default_freq == 0) 192 default_freq = BCM2835_DEFAULT_SDHCI_FREQ; 193 |
191 node = ofw_bus_get_node(sc->sc_dev); 192 if ((OF_getprop(node, "clock-frequency", &cell, sizeof(cell))) > 0) 193 default_freq = fdt32_to_cpu(cell)/1000000; 194 | |
195 if (bootverbose) 196 device_printf(dev, "SDHCI frequency: %dMHz\n", default_freq); 197 198 mtx_init(&sc->sc_mtx, "bcm sdhci", "sdhci", MTX_DEF); 199 200 rid = 0; 201 sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 202 RF_ACTIVE); --- 501 unchanged lines hidden --- | 194 if (bootverbose) 195 device_printf(dev, "SDHCI frequency: %dMHz\n", default_freq); 196 197 mtx_init(&sc->sc_mtx, "bcm sdhci", "sdhci", MTX_DEF); 198 199 rid = 0; 200 sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 201 RF_ACTIVE); --- 501 unchanged lines hidden --- |