169169#include <linux/efi.h> /* efi_enabled */
170170#include <linux/fb.h> /* fb_info struct */
171171#include <linux/screen_info.h> /* screen_info */
172+ #if defined(NV_LINUX_SYSFB_H_PRESENT )
173+ #include <linux/sysfb.h> /* sysfb_primary_display */
174+ #endif
172175
173176#if !defined(CONFIG_PCI )
174177#warning "Attempting to build driver for a platform with no PCI support!"
@@ -252,6 +255,10 @@ NV_STATUS nvos_forward_error_to_cray(struct pci_dev *, NvU32,
252255 user_function, NULL, args)
253256#endif
254257
258+ #if defined(NV_LINUX_IOMMU_DMA_H_PRESENT )
259+ #include <linux/iommu-dma.h>
260+ #endif
261+
255262#define NV_PAGE_COUNT (page ) \
256263 ((unsigned int)page_count(page))
257264
@@ -938,6 +945,11 @@ typedef struct nv_alloc_s {
938945 */
939946static inline NvBool nv_is_dma_direct (struct device * dev )
940947{
948+ #if defined(NV_USE_DMA_IOMMU_PRESENT )
949+ if (use_dma_iommu (dev ))
950+ return NV_FALSE ;
951+ #endif
952+
941953 return get_dma_ops (dev ) == NULL ;
942954}
943955
@@ -1041,6 +1053,7 @@ typedef struct nv_dma_map_s {
10411053 NvU64 page_count ;
10421054 NvBool contiguous ;
10431055 NvU32 cache_type ;
1056+ NvBool bReadOnlyDeviceMap ;
10441057 struct sg_table * import_sgt ;
10451058
10461059 union
@@ -1711,6 +1724,25 @@ typedef enum
17111724#else
17121725#include <linux/gpio/driver.h>
17131726
1727+ static inline int __to_hwgpio (const struct gpio_device * gdev ,
1728+ const struct of_phandle_args * gpiospec )
1729+ {
1730+ #if defined(CONFIG_OF_GPIO )
1731+ /*
1732+ * Use the chip's of_xlate callback to translate the DT GPIO
1733+ * specifier into a linear offset. Tegra GPIO controllers encode
1734+ * port and pin in args[0] and of_xlate sums per-port pin counts
1735+ * to produce the real offset.
1736+ */
1737+ struct gpio_chip * chip = gpio_device_get_chip (gdev );
1738+
1739+ if (chip -> of_xlate )
1740+ return chip -> of_xlate (chip , gpiospec , NULL );
1741+ #endif
1742+
1743+ return gpiospec -> args [0 ];
1744+ }
1745+
17141746/*
17151747 * of_get_named_gpio() was removed along with linux/of_gpio.h by commit
17161748 * 51aaf65bbd21 ("gpio: of: Remove <linux/of_gpio.h>"). Provide a compat
@@ -1722,7 +1754,7 @@ static inline int of_get_named_gpio(const struct device_node *np,
17221754 struct of_phandle_args gpiospec ;
17231755 struct gpio_device * gdev ;
17241756 struct gpio_desc * desc ;
1725- int ret ;
1757+ int ret , hwgpio ;
17261758
17271759 if (!np )
17281760 return - ENOENT ;
@@ -1737,30 +1769,13 @@ static inline int of_get_named_gpio(const struct device_node *np,
17371769 if (!gdev )
17381770 return - EPROBE_DEFER ;
17391771
1740- /*
1741- * Use the chip's of_xlate callback to translate the DT GPIO
1742- * specifier into a linear offset. Tegra GPIO controllers encode
1743- * port and pin in args[0] and of_xlate sums per-port pin counts
1744- * to produce the real offset.
1745- */
1746- {
1747- struct gpio_chip * chip = gpio_device_get_chip (gdev );
1748- int hwgpio ;
1749-
1750- #if defined(CONFIG_OF_GPIO )
1751- if (chip -> of_xlate )
1752- hwgpio = chip -> of_xlate (chip , & gpiospec , NULL );
1753- else
1754- #endif
1755- hwgpio = gpiospec .args [0 ];
1756-
1757- if (hwgpio < 0 ) {
1758- gpio_device_put (gdev );
1759- return hwgpio ;
1760- }
1761-
1762- desc = gpio_device_get_desc (gdev , hwgpio );
1772+ hwgpio = __to_hwgpio (gdev , & gpiospec );
1773+ if (hwgpio < 0 ) {
1774+ gpio_device_put (gdev );
1775+ return hwgpio ;
17631776 }
1777+
1778+ desc = gpio_device_get_desc (gdev , hwgpio );
17641779 gpio_device_put (gdev );
17651780
17661781 if (IS_ERR (desc ))
0 commit comments