Commit Graph

30 Commits

Author SHA1 Message Date
Ilya Bakulin
d3a60796db Fix building GENERIC-MMCCAM on arm64
Since GENERIC includes quite a few drivers now, all MMC drivers should have
appropriate MMCCAM-related ifdefs and include opt_mmccam.h so that
those ifdefs are actually processed correctly.

Reviewed by:	manu
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D15569
2018-05-25 19:00:28 +00:00
Emmanuel Vadot
2f88239958 dwmmc_rockchip: Add ifdefs on EXT_RESOURCES
The old RK3188 kernel config uses dwmmc but isn't compiled with EXT_RESOURCES.
Add ifdefs around code using EXT_RESOURCES code.

Reported by:	rpokala
2018-02-28 19:05:25 +00:00
Emmanuel Vadot
a5091e03c5 dwmmc_rockchip: Add support for rk3328-dw-mshc
* Do not use pio mode like rk2928
* Change clocks frequency in update_ios

Tested-On:    Pine64 Rock64 (RK3328)
2018-02-26 21:29:01 +00:00
Emmanuel Vadot
dd198e868a dwmmc: Add clock support and other improvements
* If compiled with EXT_RESOURCES look up the "biu" and "ciu" clocks in
  the DT
* Don't use custom property "bus-frequency" but the standard one
  "clock-frequency"
* Use the DT property max-frequency and fall back to 200Mhz if it don't exists
* Add more mmc caps suported by the controller
* Always ack all interrupts
* Subclassed driver can supply an update_ios so they can handle update
  the clocks accordingly
* Take care of the DDR bit in update_ios (no functional change since we
  do not support voltage change for now)
* Make use of the FDT bus-width property
2018-02-26 21:27:42 +00:00
Emmanuel Vadot
a4cafeb098 dwmmc_hisi: Fix build when option MMCCAM is defined 2018-01-13 14:10:45 +00:00
Emmanuel Vadot
74e0613ead dwmmc: Fully subclass driver
Fully subclass the dwmmc driver and split every driver into multiple files.

There is still a few quirks in the dwmmc driver that will need some work.

Tested On: Pine64 Rock64

Differential Revision:	https://reviews.freebsd.org/D13615
2017-12-30 22:01:17 +00:00
Alexander Kabaev
151ba7933a Do pass removing some write-only variables from the kernel.
This reduces noise when kernel is compiled by newer GCC versions,
such as one used by external toolchain ports.

Reviewed by: kib, andrew(sys/arm and sys/arm64), emaste(partial), erj(partial)
Reviewed by: jhb (sys/dev/pci/* sys/kern/vfs_aio.c and sys/kern/kern_synch.c)
Differential Revision: https://reviews.freebsd.org/D10385
2017-12-25 04:48:39 +00:00
Ilya Bakulin
02c474b481 Miscellaneous fixes and improvements to MMCCAM stack
* Demote the level of several debug messages to CAM_DEBUG_TRACE
 * Add detection for SDHC cards that can do 1.8V. No voltage switch sequence
   is issued yet;
 * Don't create a separate LUN for each SDIO function. We need just one to make
   pass(4) attach;
 * Remove obsolete mmc_sdio* files. SDIO functionality will be moved into the
   separate device that will manage a new sdio(4) bus;
 * Terminate probing if got no reply to CMD0;
 * Make bcm2835 SDHCI host controller driver compile with 'option MMCCAM'.

Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D12109
2017-09-15 19:47:44 +00:00
Marius Strobl
55dae242e6 Add and use a MMC_DECLARE_BRIDGE macro for declaring mmc(4) bridges
as kernel drivers and their dependency onto mmc(4); this allows for
incrementing the mmc(4) module version but also for entire omission
of these bridge declarations for mmccam(4) in a single place, i. e.
in dev/mmc/bridge.h.
2017-03-07 22:42:44 +00:00
Marius Strobl
b440e965da o Another round fixes for mmc(4), mmcsd(4) and sdhci(4) regarding
comments, marking unused parameters as such, style(9), whitespace,
  etc.
o In the mmc(4) bridges and sdhci(4) (bus) front-ends:
  - Remove redundant assignments of the default bus_generic_print_child
    device method (I've whipped these out of the tree as part of r227843
    once, but they keep coming back ...),
  - use DEVMETHOD_END,
  - use NULL instead of 0 for pointers.
o Trim/adjust includes.
2017-03-06 23:47:59 +00:00
Andrew Turner
f3ad8ea007 Add DMA sync operations around accessing the dwmmc descriptor ring. Even
with it maps as cache-coherent we still need to call bus_dmamap_sync.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-05-13 15:15:54 +00:00
Pedro F. Giffuni
057b4402bf sys/dev: extend use of the howmany() macro when available.
We have a howmany() macro in the <sys/param.h> header that is
convenient to re-use as it makes things easier to read.
2016-04-26 15:03:15 +00:00
Pedro F. Giffuni
74b8d63dcc Cleanup unnecessary semicolons from the kernel.
Found with devel/coccinelle.
2016-04-10 23:07:00 +00:00
Ian Lepore
dec4873723 Fix fallout from r292180 (Dec 2015)... ensure that every driver which has
a DRIVER_MODULE() referencing mmc_driver has a MODULE_DEPEND() on mmc.  This
is because the kernel linker only searches for symbols in dependent modules,
so loading sdhci_pci (and other bus-flavors of sdhci) would fail when mmc
was not compiled into the kernel (even if you hand-loaded mmc first).

(Thanks to jilles@ for providing the vital clue about the kernel linker.)
2016-03-21 00:52:24 +00:00
Ian Lepore
3f62727443 Move the DRIVER_MODULE() statements that declare mmc(4) to be a child of
the various bridge drivers out of dev/mmc.c and into the bridge drivers.

Requested by:	   jhb (almost two years ago; better late than never)
2015-12-14 01:09:25 +00:00
Andrew Turner
c0e5e17237 Add support for the DesignWare MMC hardware in the HiSilicon hi6220. This
SoC is used in the HiKey board from 96boards.

Currently on the SD card is working on the HiKey, as such devices 0 and 2
will need to be disabled, for example by adding the following to
loader.conf:

hint.hisi_dwmmc.0.disabled=1
hint.hisi_dwmmc.2.disabled=1

Relnotes:	yes (Hikey board booting)
Sponsored by:	ABT Systems Ltd
2015-09-01 16:25:12 +00:00
Andrew Turner
fa6ea9962e Finish allowing the dwmmc driver to be subclassed, move the softc to a new
header, along with the hwtype enum, device attach prototype, and driver_t.

Sponsored by:	ABT Systems Ltd
2015-09-01 15:26:21 +00:00
Andrew Turner
0e308268b0 Remove an variable we only ever write to, and stop assigning 0 to values
in the softc as it's the default value. The latter helps with subclassing
this driver.

Sponsored by:	ABT Systems Ltd
2015-09-01 10:47:42 +00:00
Andrew Turner
755eb18fd7 Move dwmmc.h to dwmmc_reg.h. This is in preperation for adding support to
subclass the dwmmc driver to allow SoC specific attachments.

Sponsored by:	ABT Systems Ltd
2015-08-28 15:27:55 +00:00
Andrew Turner
725b72d5e0 Only check for the bus frequency if it has not already been set, for
example through a driver running as a subclass of this.

Sponsored by:	ABT Systems Ltd
2015-08-28 10:34:37 +00:00
Andrew Turner
2640322a2e There is no need to get the bus tag or handle.
Sponsored by:	ABT Systems Ltd
2015-08-27 16:27:51 +00:00
Andrew Turner
fd59e3a9d8 Limit the speed to the bus frequency.
Sponsored by:	ABT Systems Ltd
2015-08-27 16:24:30 +00:00
Andrew Turner
488d593a0c Allow the fifo-depth and num-slots to be missing. For the former we read
the value from the hardware, for the latter assume a single slot.

Sponsored by:	ABT Systems Ltd
2015-08-27 16:18:22 +00:00
Andrew Turner
26f0e89a6d Allow us to select the transfer count. This allows us to work with hardware
that seems to only work with a single block at a time.

Sponsored by:	ABT Systems Ltd
2015-08-27 13:08:45 +00:00
Andrew Turner
4f768055bd Only access the Samsung registers when targeting Samsung hardware.
Sponsored by:	ABT Systems Ltd
2015-08-26 10:54:14 +00:00
Andrew Turner
d1b2133d03 Attach dwmmc to the ofwbus, som devicetrees place it here.
Sponsored by:	ABT Systems Ltd
2015-08-07 08:57:58 +00:00
Andrew Turner
a336c37514 Stop including machine/fdt.h, it's unneeded, and purposefully
unimplemented on arm64.

Sponsored by:	ABT Systems Ltd
2015-08-07 08:54:50 +00:00
Ganbold Tsagaankhuu
e2763dca83 Enable Synopsys DesignWare Mobile Storage Host Controller
driver on Rockchip boards. It currently supports PIO mode
and dma mode needs external dma controller to be used.

Submitted by:   jmcneill
Approved by:    stas (mentor)
2015-01-20 09:07:28 +00:00
Ruslan Bukin
fdbf76c383 Always wait 'command done' interrupt status bit before proceeding next command.
Sponsored by:	DARPA, AFRL
2014-10-08 08:51:05 +00:00
Ruslan Bukin
41709d23c4 Add driver for Synopsys DesignWare Mobile Storage Host Controller.
Sponsored by:	DARPA, AFRL
2014-10-07 17:39:30 +00:00