diff options
author | gonzo <gonzo@FreeBSD.org> | 2015-05-22 03:16:18 +0000 |
---|---|---|
committer | gonzo <gonzo@FreeBSD.org> | 2015-05-22 03:16:18 +0000 |
commit | ef6ca4337dbbc940f520cf42fcbaa689ee676850 (patch) | |
tree | 23662d9a59f877c1e1e89abf4736479e17c8ecff /sys/arm/ti/ti_sdhci.c | |
parent | 721376a5c9d5d2b8efdd1a396039113b3030ba73 (diff) | |
download | FreeBSD-src-ef6ca4337dbbc940f520cf42fcbaa689ee676850.zip FreeBSD-src-ef6ca4337dbbc940f520cf42fcbaa689ee676850.tar.gz |
Switch TI platform support code from using FreeBSD's custom-baked DTS
files to vendor-provided ones. It should make easier to adopt platform
code to new revisions of hardware and to use DTS overlays for various
Beaglebone extensions (shields/capes).
Original dts filenames were not changed, they're now wrappers over dts
files provided by TI. So make sure you update .dtb files on your
devices as part of kernel update
GPIO addressing was changed: instead of one global /dev/gpioc0 there
are per-bank instances of /dev/gpiocX. Each bank has 32 pins so for
instance pin 121 on /dev/gpioc0 in old addressing scheme is now pin 25
on /dev/gpioc3
On Pandaboard serial console devices was changed from /dev/ttyu0 to
/dev/ttyu2 so you'll have to update /etc/ttys to get login prompt
on serial port in multiuser mode. Single user mode serial console
should work as-is
Differential Revision: https://reviews.freebsd.org/D2146
Reviewed by: rpaulo, ian, Michal Meloun, Svatopluk Kraus
Diffstat (limited to 'sys/arm/ti/ti_sdhci.c')
-rw-r--r-- | sys/arm/ti/ti_sdhci.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/sys/arm/ti/ti_sdhci.c b/sys/arm/ti/ti_sdhci.c index 380a40e..bc0880d 100644 --- a/sys/arm/ti/ti_sdhci.c +++ b/sys/arm/ti/ti_sdhci.c @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include <arm/ti/ti_cpuid.h> #include <arm/ti/ti_prcm.h> +#include <arm/ti/ti_hwmods.h> #include "gpio_if.h" struct ti_sdhci_softc { @@ -66,7 +67,7 @@ struct ti_sdhci_softc { struct resource * irq_res; void * intr_cookie; struct sdhci_slot slot; - uint32_t mmchs_device_id; + clk_ident_t mmchs_clk_id; uint32_t mmchs_reg_off; uint32_t sdhci_reg_off; uint32_t baseclk_hz; @@ -383,19 +384,18 @@ static void ti_sdhci_hw_init(device_t dev) { struct ti_sdhci_softc *sc = device_get_softc(dev); - clk_ident_t clk; uint32_t regval; unsigned long timeout; /* Enable the controller and interface/functional clocks */ - clk = MMC0_CLK + sc->mmchs_device_id; - if (ti_prcm_clk_enable(clk) != 0) { + if (ti_prcm_clk_enable(sc->mmchs_clk_id) != 0) { device_printf(dev, "Error: failed to enable MMC clock\n"); return; } /* Get the frequency of the source clock */ - if (ti_prcm_clk_get_source_freq(clk, &sc->baseclk_hz) != 0) { + if (ti_prcm_clk_get_source_freq(sc->mmchs_clk_id, + &sc->baseclk_hz) != 0) { device_printf(dev, "Error: failed to get source clock freq\n"); return; } @@ -484,12 +484,10 @@ ti_sdhci_attach(device_t dev) * up and added in freebsd, it doesn't exist in the published bindings. */ node = ofw_bus_get_node(dev); - if ((OF_getprop(node, "mmchs-device-id", &prop, sizeof(prop))) <= 0) { - sc->mmchs_device_id = device_get_unit(dev); - device_printf(dev, "missing mmchs-device-id attribute in FDT, " - "using unit number (%d)", sc->mmchs_device_id); - } else - sc->mmchs_device_id = fdt32_to_cpu(prop); + sc->mmchs_clk_id = ti_hwmods_get_clock(dev); + if (sc->mmchs_clk_id == INVALID_CLK_IDENT) { + device_printf(dev, "failed to get clock based on hwmods property\n"); + } /* * The hardware can inherently do dual-voltage (1p8v, 3p0v) on the first @@ -500,7 +498,7 @@ ti_sdhci_attach(device_t dev) * be done once and never reset. */ sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE; - if (sc->mmchs_device_id == 0 || OF_hasprop(node, "ti,dual-volt")) { + if (sc->mmchs_clk_id == MMC1_CLK || OF_hasprop(node, "ti,dual-volt")) { sc->slot.host.caps |= MMC_OCR_290_300 | MMC_OCR_300_310; } |