Blame view

include/linux/mbus.h 2.91 KB
abc848c18   Lennert Buytenhek   introduce mbus DR...
1
2
3
4
5
6
7
8
9
10
11
12
  /*
   * Marvell MBUS common definitions.
   *
   * Copyright (C) 2008 Marvell Semiconductor
   *
   * This file is licensed under the terms of the GNU General Public
   * License version 2.  This program is licensed "as is" without any
   * warranty of any kind, whether express or implied.
   */
  
  #ifndef __LINUX_MBUS_H
  #define __LINUX_MBUS_H
434cec62a   Stefan Roese   bus: mvebu-mbus: ...
13
  #include <linux/errno.h>
79d946837   Ezequiel Garcia   bus: mvebu-mbus: ...
14
  struct resource;
abc848c18   Lennert Buytenhek   introduce mbus DR...
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  struct mbus_dram_target_info
  {
  	/*
  	 * The 4-bit MBUS target ID of the DRAM controller.
  	 */
  	u8		mbus_dram_target_id;
  
  	/*
  	 * The base address, size, and MBUS attribute ID for each
  	 * of the possible DRAM chip selects.  Peripherals are
  	 * required to support at least 4 decode windows.
  	 */
  	int		num_cs;
  	struct mbus_dram_window {
  		u8	cs_index;
  		u8	mbus_attr;
  		u32	base;
  		u32	size;
  	} cs[4];
  };
fddddb52a   Thomas Petazzoni   bus: introduce an...
35
36
37
38
39
40
41
42
43
44
  /* Flags for PCI/PCIe address decoding regions */
  #define MVEBU_MBUS_PCI_IO  0x1
  #define MVEBU_MBUS_PCI_MEM 0x2
  #define MVEBU_MBUS_PCI_WA  0x3
  
  /*
   * Magic value that explicits that we don't need a remapping-capable
   * address decoding window.
   */
  #define MVEBU_MBUS_NO_REMAP (0xffffffff)
95b80e0a9   Thomas Petazzoni   arm: mach-mv78xx0...
45
46
  /* Maximum size of a mbus window name */
  #define MVEBU_MBUS_MAX_WINNAME_SZ 32
63a9332b2   Andrew Lunn   ARM: Orion: Get a...
47
48
49
50
51
52
  /*
   * The Marvell mbus is to be found only on SOCs from the Orion family
   * at the moment.  Provide a dummy stub for other architectures.
   */
  #ifdef CONFIG_PLAT_ORION
  extern const struct mbus_dram_target_info *mv_mbus_dram_info(void);
bfa1ce5f3   Thomas Petazzoni   bus: mvebu-mbus: ...
53
  extern const struct mbus_dram_target_info *mv_mbus_dram_info_nooverlap(void);
434cec62a   Stefan Roese   bus: mvebu-mbus: ...
54
55
  int mvebu_mbus_get_io_win_info(phys_addr_t phyaddr, u32 *size, u8 *target,
  			       u8 *attr);
63a9332b2   Andrew Lunn   ARM: Orion: Get a...
56
57
58
59
60
  #else
  static inline const struct mbus_dram_target_info *mv_mbus_dram_info(void)
  {
  	return NULL;
  }
bfa1ce5f3   Thomas Petazzoni   bus: mvebu-mbus: ...
61
62
63
64
  static inline const struct mbus_dram_target_info *mv_mbus_dram_info_nooverlap(void)
  {
  	return NULL;
  }
434cec62a   Stefan Roese   bus: mvebu-mbus: ...
65
66
67
68
69
70
71
72
73
74
75
76
  static inline int mvebu_mbus_get_io_win_info(phys_addr_t phyaddr, u32 *size,
  					     u8 *target, u8 *attr)
  {
  	/*
  	 * On all ARM32 MVEBU platforms with MBus support, this stub
  	 * function will not get called. The real function from the
  	 * MBus driver is called instead. ARM64 MVEBU platforms like
  	 * the Armada 3700 could use the mv_xor device driver which calls
  	 * into this function
  	 */
  	return -EINVAL;
  }
63a9332b2   Andrew Lunn   ARM: Orion: Get a...
77
  #endif
fddddb52a   Thomas Petazzoni   bus: introduce an...
78

fce7b5ae1   Ben Dooks   bus: mvebu-mbus: ...
79
  int mvebu_mbus_save_cpu_target(u32 __iomem *store_addr);
79d946837   Ezequiel Garcia   bus: mvebu-mbus: ...
80
81
  void mvebu_mbus_get_pcie_mem_aperture(struct resource *res);
  void mvebu_mbus_get_pcie_io_aperture(struct resource *res);
f2900acea   Marcin Wojtas   bus: mvebu-mbus: ...
82
  int mvebu_mbus_get_dram_win_info(phys_addr_t phyaddr, u8 *target, u8 *attr);
6a63b098f   Thomas Petazzoni   bus: mvebu-mbus: ...
83
84
85
86
  int mvebu_mbus_add_window_remap_by_id(unsigned int target,
  				      unsigned int attribute,
  				      phys_addr_t base, size_t size,
  				      phys_addr_t remap);
6a63b098f   Thomas Petazzoni   bus: mvebu-mbus: ...
87
88
  int mvebu_mbus_add_window_by_id(unsigned int target, unsigned int attribute,
  				phys_addr_t base, size_t size);
fddddb52a   Thomas Petazzoni   bus: introduce an...
89
90
91
92
  int mvebu_mbus_del_window(phys_addr_t base, size_t size);
  int mvebu_mbus_init(const char *soc, phys_addr_t mbus_phys_base,
  		    size_t mbus_size, phys_addr_t sdram_phys_base,
  		    size_t sdram_size);
5686a1e5a   Thomas Petazzoni   bus: mvebu: pass ...
93
  int mvebu_mbus_dt_init(bool is_coherent);
fddddb52a   Thomas Petazzoni   bus: introduce an...
94
95
  
  #endif /* __LINUX_MBUS_H */