9
0
Fork 0
Commit Graph

318 Commits

Author SHA1 Message Date
Antony Pavlov 377d261708 of: use 'const void *' for struct of_device_id.data
Since 2011 barebox' of_device_id struct uses unsigned long type for data field:

    struct of_device_id {
            char *compatible;
            unsigned long data;
    };

Almost always struct of_device_id.data field are used as pointer
and need 'unsigned long' casting.

E.g. see 'git grep -A 4 of_device_id drivers/' output:

    drivers/ata/sata-imx.c:static __maybe_unused struct of_device_id imx_sata_dt_ids[] = {
    drivers/ata/sata-imx.c- {
    drivers/ata/sata-imx.c-         .compatible = "fsl,imx6q-ahci",
    drivers/ata/sata-imx.c-         .data = (unsigned long)&data_imx6,
    drivers/ata/sata-imx.c- }, {

Here is of_device_id struct in linux kernel v4.0:

    struct of_device_id {
            char name[32];
            char type[32];
            char compatible[128];
            const void *data;
    };

Changing of_device_id.data type to 'const void *data' will increase
barebox' linux kernel compatibility and decrease number of 'unsigned
long' casts.

Part of the patch was done using the 'coccinelle' tool with the
following semantic patch:

    @rule1@
    identifier dev;
    identifier type;
    identifier func;
    @@
    func(...) {
    <...
    - dev_get_drvdata(dev, (unsigned long *)&type)
    + dev_get_drvdata(dev, (const void **)&type)
    ...>
    }
    @rule2@
    identifier dev;
    identifier type;
    identifier func;
    identifier data;
    @@
    func(...) {
    <...
    - dev_get_drvdata(dev, (unsigned long *)&type->data)
    + dev_get_drvdata(dev, (const void **)&type->data)
    ...>
    }

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-30 08:12:57 +02:00
Wadim Egorov f28ea92181 mci: core: Check return value of dev_add_param_bool
Commit 03b59bdb64 changed the
return values of dev_add_param_* to ERR_PTR(-ENOSYS) and broke a few boards.
We have now to care about the return value of dev_add_param_bool() in
mci_register().

Also set the ret variable when dev_add_param_bool() fails.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-19 07:52:24 +01:00
Andrey Panov fb1c0b2380 MMC: dw_mmc: PIO mode fixes
Simplify PIO mode routines.
Fix a bug when IO is possibly performed twice because of using old
interrupt status.
Support for slow-speed card writes.

Signed-off-by: Andrey Panov <rockford@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-09 11:40:20 +01:00
Sascha Hauer fa20ea45e0 Merge branch 'for-next/tegra' 2015-03-09 08:32:26 +01:00
Sascha Hauer 4680b375b9 Merge branch 'for-next/streaming-dma'
Conflicts:
	drivers/mci/dw_mmc.c
2015-03-09 08:32:21 +01:00
Lucas Stach f777398dc5 MCI: tegra-sdmmc: convert to streaming DMA ops
Move to the common streaming DMA ops in order to get rid of
the direct usage of the ARM MMU functions for the cache
maintenance.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-06 07:52:02 +01:00
Lucas Stach e31aa8badc MCI: imx: convert to streaming DMA ops
Move to the common streaming DMA ops in order to get rid of
the direct usage of the ARM MMU functions for the cache
maintenance.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-06 07:52:02 +01:00
Lucas Stach 451967e8b9 MCI: dw-mmc: convert to streaming DMA ops
Move to the common streaming DMA ops in order to get rid of
the direct usage of the ARM MMU functions for the cache
maintenance.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-06 07:52:02 +01:00
Lucas Stach 381f034ed6 ARM: move DMA alloc functions to dma.h
This better separates the DMA from the MMU functionality.

Also move all drivers that only depends on asm/mmu.h for the alloc
functions over to the common header.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-06 07:52:02 +01:00
Lucas Stach e05f9586b3 ARM: change dma_alloc/free_coherent to match other architectures
As a lot drivers currently rely on the 1:1 virt->phys mapping on ARM
we define DMA_ADDRESS_BROKEN to mark them. In order to use them on
other architectures with a different mapping they need proper fixing.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-06 07:51:47 +01:00
Andrey Panov 84fcb04367 MMC: dw_mmc: Add support for PIO mode and Rockchip variant of this hardware
Signed-off-by: Andrey Panov <rockford@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-05 15:19:28 +01:00
Lucas Stach 4bb43bf26f mci: tegra: handle mmc aliases
This allows to have fixed device names for the SDMMC
controllers.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-04 11:34:08 +01:00
Sascha Hauer 7b0f932bcd Merge branch 'for-next/mxs' 2015-02-04 19:09:15 +01:00
Sascha Hauer 846f27cf92 mci: mxs: Add devicetree support
Add device tree compatibles and allow retrieving data from device tree
instead of platform_data only.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-28 08:18:44 +01:00
Andrey Panov 58475f4599 MMC: IMX: Reset MMC_BOOT register after controller reset.
This helps with EMMC detection when booting from EMMC directly.
Taken from u-boot.

Signed-off-by: Andrey Panov <rockford@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-19 08:38:12 +01:00
Sascha Hauer df9879c65d drivers: remove unnecessary mach/imx-regs.h include
And replace the ones needed with the SoC specific header.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-05 11:30:59 +01:00
Sascha Hauer b01bc4c810 Merge branch 'for-next/randconfig-1' 2014-12-08 14:54:11 +01:00
Sascha Hauer 86916569a8 Merge branch 'for-next/imx' 2014-12-08 14:53:59 +01:00
Sascha Hauer 36d808c943 mci: mxs-mci: add f_min/f_max fields unconditionally
Parts of the driver need these regardless of whether CONFIG_MCI_INFO
is set, so add these fields unconditionally.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-28 15:21:26 +01:00
Sascha Hauer 9e7c0e3176 mci: imx-esdhc: Add i.MX6sl compatible
Which will also be used for the i.MX6sx.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-27 11:24:58 +01:00
Sascha Hauer df17efad59 mci: imx-esdhc: Fix Interrupt enable register for i.MX6sx
The reset default of this register has changed on i.MX6sx. Explicitly
write the value we want to have to make it work on i.MX6sx.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-27 11:24:52 +01:00
Lucas Stach 557b403d85 mci: esdhc: add back PIO_TIMEOUT
This got lost during bd1bf53b34
(mci: imx-esdhc: factor out common sdhci registers). Seems the PIO
option isn't too heavily used.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-24 14:04:10 +01:00
Antony Pavlov bc4312717b Typoes: "whith" -> "with"
This patch is based on linux kernel commit

    commit e1b8513d21845fbeb93d6d2c4973db874385059f
    Author: Robert P. J. Day <rpjday@crashcourse.ca>
    Date:   Sun Feb 3 15:14:02 2008 +0200

        Typoes:  "whith" -> "with"

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Cc: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-03 09:18:20 +01:00
Sascha Hauer fa93e4fb60 Merge branch 'for-next/resource-err-ptr' 2014-10-02 08:54:42 +02:00
Bo Shen 71692f1538 mci: atmel: add new ip version 0x600 support
Signed-off-by: Bo Shen <voice.shen@atmel.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-22 06:59:42 +02:00
Sascha Hauer ed6e965824 resource: Let dev_request_mem_region return an error pointer
For all users fix or add the error check.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-16 08:32:10 +02:00
Bo Shen 366f64ff1b mci: core: the sd1.0 card can work in 4 bits mode
The sd 1.0 card can work in 4 bits mode also.

Signed-off-by: Bo Shen <voice.shen@atmel.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-29 14:30:59 +02:00
Antony Pavlov 8e89bc594a treewide: remove address of the Free Software Foundation
The FSF address has changed; The FSF site says that
address is

  Free Software Foundation
  51 Franklin Street, Fifth Floor
  Boston, MA 02110-1301
  USA

(see http://www.fsf.org/about/contact/)

Instead of updating it each time the address changes,
just drop it completely treewide.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-06-11 08:35:25 +02:00
Lucas Stach 35a0081a83 mci: tegra: add Tegra124 compatible
The controller is similar enough to the ones found
on earlier generation SoCs to not need any additional
changes.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-06-05 08:01:15 +02:00
Lucas Stach f20e3eb414 mci: implement non-removable property
There is no need to check the card-detect status
for non-removable devices.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-06-04 07:21:17 +02:00
Lucas Stach 840896e227 mci: tegra: don't set 8bit mode unconditionally
Those flags should be set from the DT parsing code.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-15 14:17:12 +02:00
Lucas Stach ce41b64299 mci: tegra: apply pad autocalibration on T30
Needed for SD cards connected to sdmmc1 or sdmmc3
to work properly.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-15 14:17:12 +02:00
Lucas Stach 17a72b1f16 mci: tegra: add reset control
Enable the driver to reset the device itself.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-15 14:17:12 +02:00
Sascha Hauer 7b7631791e Merge branch 'for-next/tegra'
Conflicts:
	arch/arm/dts/tegra20-colibri.dtsi
	arch/arm/dts/tegra20-paz00.dts
	arch/arm/dts/tegra20.dtsi
	drivers/clk/tegra/clk-periph.c
2014-05-05 13:34:21 +02:00
Sascha Hauer acb427e2d0 mci: Add regulator support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-04-29 08:01:35 +02:00
Lucas Stach 47ed904495 mmc: tegra: fix typo
Missed OR, so we never enabled failure interrupt
status bits, which prevented the eMMC detect logic
to work properly.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-04-23 11:39:13 +02:00
Alexander Shiyan 0017d4d2d6 mci: core: Typo fix in printk specifier
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-03-17 08:20:48 +01:00
Sascha Hauer 9bdef9e7f2 mci: Fix version handling
Currently the version defines reflect the digits in the version
number. MMC_VERSION_4_41 is defined as 0x441 and MMC_VERSION_4_5
is defined as 0x405. This results in MMC_VERSION_4_5 < MMC_VERSION_4_41
becoming true which was surely not intended. Fix this by
redefining the versions as 0x<major><minor><micro>. This makes the
string generation more complicated but makes versions comparable
again.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-14 16:30:13 +01:00
Sascha Hauer d3c96d6522 Merge branch 'for-next/mci'
Conflicts:
	arch/arm/boards/tqma53/board.c
2014-02-03 09:55:52 +01:00
Sascha Hauer 8e174d41f0 mci: imx-esdhc: Add i.MX25 compatible entry
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-31 18:51:53 +01:00
Sascha Hauer 078a29da28 mci: imx: Add devicetree probe support
Only simple probing, no properties supported yet.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-29 11:31:31 +01:00
Markus Niebel fa5bdb30ee mci: imx-esdhc: add DSR support
having DSR support in mci-core we need a way to
forward the DSR value to the driver. Add it to
platform data for imx-esdhc

TODO: implement the same for other host controller
drivers

Signed-off-by: Markus Niebel <Markus.Niebel@tqs.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-15 15:22:56 +01:00
Markus Niebel f11668fee7 mci: add device tree support for DSR
add optional DSR support. This should go into the kernel, too

Signed-off-by: Markus Niebel <Markus.Niebel@tqs.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-15 15:22:43 +01:00
Markus Niebel 78b9e4e041 mci: add DSR support
The eMMC and the SD-Card specifications describe the optional SET_DSR command.
During measurements at our lab we found that some cards implementing this feature
having really strong driver strengts per default. This can lead to voltage peaks
above the specification of the host on signal edges for data sent from a card to
the host.

Since availability of a given card type may be shorter than the time a certain
hardware will be produced it is useful to have support for this command (Alternative
would be changing termination resistors and adapting the driver strength of the
host to the used card.)

Signed-off-by: Markus Niebel <Markus.Niebel@tqs.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-15 15:22:43 +01:00
Markus Niebel 96da216991 mci: production year for eMMC 4.41 and later
Year is coded in 4 bits of CID. eMMC 4.41
adds a new interpretation rule: production
year for 4.41 cards and newer is between 2010
and 2025 with 0 corresponding to 2013.

This fix was inspired by currect kernel code.

Signed-off-by: Markus Niebel <Markus.Niebel@tqs.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-10 14:56:58 +01:00
Markus Niebel 98d5fd3915 mci: Support the correct version for eMMC
eMMC is available up to version 4.5 but the
correct version is not decoded. Change version
definitions to support more minor verions, add
missing versions and parse the minor versions from
ext_csd.

After this, card detection code and devinfo reports
correct versions.

Handling is inspired by u-boot code.

Signed-off-by: Markus Niebel <Markus.Niebel@tqs.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-10 14:56:58 +01:00
Sascha Hauer 6d8a85d6c3 Merge branch 'for-next/tegra' 2013-12-06 08:23:27 +01:00
Sascha Hauer ed039cd72b Merge branch 'for-next/omap-drivers' 2013-12-06 08:23:27 +01:00
Sascha Hauer 6d7fae1e97 Merge branch 'for-next/omap-devicetree-prepare' 2013-12-06 08:23:27 +01:00
Sascha Hauer e9ea6eeaab Merge branch 'for-next/misc'
Conflicts:
	scripts/Makefile
2013-12-06 08:23:24 +01:00