diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2015-08-20 14:54:23 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-08-28 12:38:37 +1000 |
commit | f9215d7183c55e1787f7a33f784409b7c406f12d (patch) | |
tree | 89a644dd2cf5c9c418804efea4fca03ee36eb6cd /lib | |
parent | 9c38b4f8d3f0fa685da802bc511d89a35215c45f (diff) |
tegra: merge platform setup from nouveau drm
The copyright header in nvkm/engine/device/platform.c has been replaced
with the NVIDIA one from drm/nouveau_platform.c, as most of the actual
code is now theirs.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile | 2 | ||||
-rw-r--r-- | lib/include/nvif/os.h | 153 | ||||
-rw-r--r-- | lib/platform.c | 26 | ||||
-rw-r--r-- | lib/tegra.c | 26 |
4 files changed, 194 insertions, 13 deletions
diff --git a/lib/Makefile b/lib/Makefile index 972d93ad..11c70a27 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -31,7 +31,9 @@ srcs := $(lib)/bit.o \ $(lib)/intr.o \ $(lib)/main.o \ $(lib)/null.o \ + $(lib)/platform.o \ $(lib)/rb.o \ + $(lib)/tegra.o \ $(lib)/work.o outp := $(lib)/libnvif.so diff --git a/lib/include/nvif/os.h b/lib/include/nvif/os.h index 182ae5ad..4757cd47 100644 --- a/lib/include/nvif/os.h +++ b/lib/include/nvif/os.h @@ -120,7 +120,19 @@ typedef dma_addr_t resource_size_t; #define __printf(a,b) #define __user -#define IS_ENABLED(x) (0) +#if defined(CONFIG_ARM) +#define IS_ENABLED_CONFIG_ARM 1 +#else +#define IS_ENABLED_CONFIG_ARM 0 +#endif + +#if defined(CONFIG_IOMMU_API) +#define IS_ENABLED_CONFIG_IOMMU_API 1 +#else +#define IS_ENABLED_CONFIG_IOMMU_API 0 +#endif + +#define IS_ENABLED(x) IS_ENABLED_##x static inline int order_base_2(u64 base) @@ -810,17 +822,61 @@ dma_free_attrs(struct device *dev, size_t sz, void *vaddr, dma_addr_t bus, { } +/****************************************************************************** + * Bus + *****************************************************************************/ + +struct bus_type { +}; + +extern struct bus_type platform_bus_type; /****************************************************************************** * IOMMU *****************************************************************************/ struct iommu_domain; +struct iommu_ops { + unsigned long pgsize_bitmap; +}; + +struct iommu_domain { + const struct iommu_ops *ops; +}; + #define IOMMU_READ (1 << 0) #define IOMMU_WRITE (1 << 1) #define IOMMU_CACHE (1 << 2) /* DMA cache coherency */ #define IOMMU_NOEXEC (1 << 3) +static inline bool +iommu_present(struct bus_type *bus) +{ + return false; +} + +static inline struct iommu_domain * +iommu_domain_alloc(struct bus_type *bus) +{ + return NULL; +} + +static inline void +iommu_domain_free(struct iommu_domain *domain) +{ +} + +static inline int +iommu_attach_device(struct iommu_domain *domain, struct device *dev) +{ + return -ENOSYS; +} + +static inline void +iommu_detach_device(struct iommu_domain *domain, struct device *dev) +{ +} + static inline int iommu_map(struct iommu_domain *domain, unsigned long iova, dma_addr_t paddr, size_t size, int prot) @@ -1328,12 +1384,35 @@ struct notifier_block { struct clk { }; +static inline struct clk * +clk_get(struct device *dev, const char *id) +{ + return NULL; +} + static inline unsigned long clk_get_rate(struct clk *clk) { return 0; } +static inline int +clk_set_rate(struct clk *clk, unsigned long rate) +{ + return -ENOSYS; +} + +static inline int +clk_prepare_enable(struct clk *clk) +{ + return -ENOSYS; +} + +static inline void +clk_disable_unprepare(struct clk *clk) +{ +} + /****************************************************************************** * regulator *****************************************************************************/ @@ -1353,26 +1432,74 @@ regulator_get_voltage(struct regulator *regulator) return -ENOSYS; } +static inline int +regulator_enable(struct regulator *regulator) +{ + return -ENOSYS; +} + +static inline int +regulator_disable(struct regulator *regulator) +{ + return -ENOSYS; +} + +static inline struct regulator * +regulator_get(struct device *dev, const char *id) +{ + return NULL; +} + /****************************************************************************** - * nouveau drm platform device + * reset *****************************************************************************/ -struct nvkm_mm; +struct reset_control { +}; -struct nouveau_platform_gpu { - struct clk *clk; - struct regulator *vdd; +static inline struct reset_control * +reset_control_get(struct device *dev, const char *id) +{ + return NULL; +} - struct { - struct mutex mutex; - struct nvkm_mm *mm; - struct iommu_domain *domain; - unsigned long pgshift; - } iommu; +static inline int +reset_control_assert(struct reset_control *reset) +{ + return -ENOSYS; +} + +static inline int +reset_control_deassert(struct reset_control *reset) +{ + return -ENOSYS; +} - int gpu_speedo; +/****************************************************************************** + * devres + *****************************************************************************/ + +#define devm_clk_get clk_get +#define devm_regulator_get regulator_get +#define devm_reset_control_get reset_control_get + +/****************************************************************************** + * tegra + *****************************************************************************/ +struct tegra_sku_info { + int gpu_speedo_value; }; +extern struct tegra_sku_info tegra_sku_info; + +#define TEGRA_POWERGATE_3D 1 + +static inline int +tegra_powergate_remove_clamping(int id) +{ + return -ENOSYS; +} + /****************************************************************************** * endianness (cont'd) *****************************************************************************/ diff --git a/lib/platform.c b/lib/platform.c new file mode 100644 index 00000000..cb26cb79 --- /dev/null +++ b/lib/platform.c @@ -0,0 +1,26 @@ +/* + * Copyright 2015 Red Hat Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: Ben Skeggs <bskeggs@redhat.com> + */ +#include "priv.h" + +struct bus_type platform_bus_type; diff --git a/lib/tegra.c b/lib/tegra.c new file mode 100644 index 00000000..20a6acb5 --- /dev/null +++ b/lib/tegra.c @@ -0,0 +1,26 @@ +/* + * Copyright 2015 Red Hat Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: Ben Skeggs <bskeggs@redhat.com> + */ +#include "priv.h" + +struct tegra_sku_info tegra_sku_info; |