renesas_sdhi.h 1.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/*
 * Renesas Mobile SDHI
 *
 * Copyright (C) 2017 Horms Solutions Ltd., Simon Horman
 * Copyright (C) 2017 Renesas Electronics Corporation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#ifndef RENESAS_SDHI_H
#define RENESAS_SDHI_H

15
#include <linux/platform_device.h>
16 17
#include "tmio_mmc.h"

18 19 20 21 22 23 24 25 26 27 28 29
struct renesas_sdhi_scc {
	unsigned long clk_rate;	/* clock rate for SDR104 */
	u32 tap;		/* sampling clock position for SDR104 */
};

struct renesas_sdhi_of_data {
	unsigned long tmio_flags;
	u32	      tmio_ocr_mask;
	unsigned long capabilities;
	unsigned long capabilities2;
	enum dma_slave_buswidth dma_buswidth;
	dma_addr_t dma_rx_offset;
30
	unsigned int bus_shift;
31 32 33
	int scc_offset;
	struct renesas_sdhi_scc *taps;
	int taps_num;
34 35
	unsigned int max_blk_count;
	unsigned short max_segs;
36 37
};

38 39 40 41
struct tmio_mmc_dma {
	enum dma_slave_buswidth dma_buswidth;
	bool (*filter)(struct dma_chan *chan, void *arg);
	void (*enable)(struct tmio_mmc_host *host, bool enable);
42 43
	struct completion	dma_dataend;
	struct tasklet_struct	dma_complete;
44 45 46 47 48 49 50 51 52 53
};

struct renesas_sdhi {
	struct clk *clk;
	struct clk *clk_cd;
	struct tmio_mmc_data mmc_data;
	struct tmio_mmc_dma dma_priv;
	struct pinctrl *pinctrl;
	struct pinctrl_state *pins_default, *pins_uhs;
	void __iomem *scc_ctl;
54
	u32 scc_tappos;
55 56 57 58 59
};

#define host_to_priv(host) \
	container_of((host)->pdata, struct renesas_sdhi, mmc_data)

60
int renesas_sdhi_probe(struct platform_device *pdev,
61
		       const struct tmio_mmc_dma_ops *dma_ops);
62
int renesas_sdhi_remove(struct platform_device *pdev);
63
#endif