| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Renesas Mobile SDHI |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2017 Horms Solutions Ltd., Simon Horman |
|---|
| 5 | | - * Copyright (C) 2017 Renesas Electronics Corporation |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 9 | | - * published by the Free Software Foundation. |
|---|
| 6 | + * Copyright (C) 2017-19 Renesas Electronics Corporation |
|---|
| 10 | 7 | */ |
|---|
| 11 | 8 | |
|---|
| 12 | 9 | #ifndef RENESAS_SDHI_H |
|---|
| .. | .. |
|---|
| 17 | 14 | |
|---|
| 18 | 15 | struct renesas_sdhi_scc { |
|---|
| 19 | 16 | unsigned long clk_rate; /* clock rate for SDR104 */ |
|---|
| 20 | | - u32 tap; /* sampling clock position for SDR104 */ |
|---|
| 17 | + u32 tap; /* sampling clock position for SDR104/HS400 (8 TAP) */ |
|---|
| 18 | + u32 tap_hs400_4tap; /* sampling clock position for HS400 (4 TAP) */ |
|---|
| 21 | 19 | }; |
|---|
| 22 | 20 | |
|---|
| 23 | 21 | struct renesas_sdhi_of_data { |
|---|
| .. | .. |
|---|
| 35 | 33 | unsigned short max_segs; |
|---|
| 36 | 34 | }; |
|---|
| 37 | 35 | |
|---|
| 36 | +#define SDHI_CALIB_TABLE_MAX 32 |
|---|
| 37 | + |
|---|
| 38 | +struct renesas_sdhi_quirks { |
|---|
| 39 | + bool hs400_disabled; |
|---|
| 40 | + bool hs400_4taps; |
|---|
| 41 | + u32 hs400_bad_taps; |
|---|
| 42 | + const u8 (*hs400_calib_table)[SDHI_CALIB_TABLE_MAX]; |
|---|
| 43 | +}; |
|---|
| 44 | + |
|---|
| 38 | 45 | struct tmio_mmc_dma { |
|---|
| 39 | 46 | enum dma_slave_buswidth dma_buswidth; |
|---|
| 40 | 47 | bool (*filter)(struct dma_chan *chan, void *arg); |
|---|
| .. | .. |
|---|
| 48 | 55 | struct clk *clk_cd; |
|---|
| 49 | 56 | struct tmio_mmc_data mmc_data; |
|---|
| 50 | 57 | struct tmio_mmc_dma dma_priv; |
|---|
| 58 | + const struct renesas_sdhi_quirks *quirks; |
|---|
| 51 | 59 | struct pinctrl *pinctrl; |
|---|
| 52 | 60 | struct pinctrl_state *pins_default, *pins_uhs; |
|---|
| 53 | 61 | void __iomem *scc_ctl; |
|---|
| 54 | 62 | u32 scc_tappos; |
|---|
| 63 | + u32 scc_tappos_hs400; |
|---|
| 64 | + const u8 *adjust_hs400_calib_table; |
|---|
| 65 | + bool needs_adjust_hs400; |
|---|
| 66 | + |
|---|
| 67 | + /* Tuning values: 1 for success, 0 for failure */ |
|---|
| 68 | + DECLARE_BITMAP(taps, BITS_PER_LONG); |
|---|
| 69 | + /* Sampling data comparison: 1 for match, 0 for mismatch */ |
|---|
| 70 | + DECLARE_BITMAP(smpcmp, BITS_PER_LONG); |
|---|
| 71 | + unsigned int tap_num; |
|---|
| 72 | + unsigned int tap_set; |
|---|
| 55 | 73 | }; |
|---|
| 56 | 74 | |
|---|
| 57 | 75 | #define host_to_priv(host) \ |
|---|