1 From 93b6bd1bf81cffd3e5739478c4434bf25458ec7d Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Fri, 5 Jul 2013 14:54:16 +0200
4 Subject: [PATCH 038/203] bus: mvebu-mbus: Add new API for window creation
6 We add an API to create MBus address decoding windows from the target
7 ID and attribute. This function will be used later and deprecate the
8 current name based scheme.
10 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 Tested-by: Andrew Lunn <andrew@lunn.ch>
12 Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
14 drivers/bus/mvebu-mbus.c | 33 +++++++++++++++++++++++++--------
15 include/linux/mbus.h | 6 ++++++
16 2 files changed, 31 insertions(+), 8 deletions(-)
18 --- a/drivers/bus/mvebu-mbus.c
19 +++ b/drivers/bus/mvebu-mbus.c
20 @@ -748,6 +748,22 @@ static const struct of_device_id of_mveb
22 * Public API of the driver
24 +int mvebu_mbus_add_window_remap_by_id(unsigned int target,
25 + unsigned int attribute,
26 + phys_addr_t base, size_t size,
29 + struct mvebu_mbus_state *s = &mbus_state;
31 + if (!mvebu_mbus_window_conflicts(s, base, size, target, attribute)) {
32 + pr_err("cannot add window '%x:%x', conflicts with another window\n",
37 + return mvebu_mbus_alloc_window(s, base, size, remap, target, attribute);
40 int mvebu_mbus_add_window_remap_flags(const char *devname, phys_addr_t base,
41 size_t size, phys_addr_t remap,
43 @@ -776,14 +792,8 @@ int mvebu_mbus_add_window_remap_flags(co
44 else if (flags == MVEBU_MBUS_PCI_WA)
47 - if (!mvebu_mbus_window_conflicts(s, base, size, target, attr)) {
48 - pr_err("cannot add window '%s', conflicts with another window\n",
53 - return mvebu_mbus_alloc_window(s, base, size, remap, target, attr);
55 + return mvebu_mbus_add_window_remap_by_id(target, attr, base,
59 int mvebu_mbus_add_window(const char *devname, phys_addr_t base, size_t size)
60 @@ -792,6 +802,13 @@ int mvebu_mbus_add_window(const char *de
61 MVEBU_MBUS_NO_REMAP, 0);
64 +int mvebu_mbus_add_window_by_id(unsigned int target, unsigned int attribute,
65 + phys_addr_t base, size_t size)
67 + return mvebu_mbus_add_window_remap_by_id(target, attribute, base,
68 + size, MVEBU_MBUS_NO_REMAP);
71 int mvebu_mbus_del_window(phys_addr_t base, size_t size)
74 --- a/include/linux/mbus.h
75 +++ b/include/linux/mbus.h
76 @@ -62,8 +62,14 @@ static inline const struct mbus_dram_tar
77 int mvebu_mbus_add_window_remap_flags(const char *devname, phys_addr_t base,
78 size_t size, phys_addr_t remap,
80 +int mvebu_mbus_add_window_remap_by_id(unsigned int target,
81 + unsigned int attribute,
82 + phys_addr_t base, size_t size,
84 int mvebu_mbus_add_window(const char *devname, phys_addr_t base,
86 +int mvebu_mbus_add_window_by_id(unsigned int target, unsigned int attribute,
87 + phys_addr_t base, size_t size);
88 int mvebu_mbus_del_window(phys_addr_t base, size_t size);
89 int mvebu_mbus_init(const char *soc, phys_addr_t mbus_phys_base,
90 size_t mbus_size, phys_addr_t sdram_phys_base,