Re: [PATCH V3 4/8] ARM: tegra: add common LP1 suspend support
On Tue, 2013-08-13 at 03:24 +0800, Stephen Warren wrote: On 08/12/2013 03:40 AM, Joseph Lo wrote: The LP1 suspending mode on Tegra means CPU rail off, devices and PLLs are clock gated and SDRAM in self-refresh mode. That means the low level LP1 suspending and resuming code couldn't be run on DRAM and the CPU must switch to the always on clock domain (a.k.a. CLK_M 12MHz oscillator). And the system clock (SCLK) would be switched to CLK_S, a 32KHz oscillator. The LP1 low level handling code need to be moved to IRAM area first. And marking the LP1 mask for indicating the Tegra device is in LP1. The CPU power timer needs to be re-calculated based on 32KHz that was originally based on PCLK. When resuming from LP1, the LP1 reset handler will resume PLLs and then put DRAM to normal mode. Then jumping to the tegra_resume that will restore full context before back to kernel. The tegra_resume handler was expected to be found in PMC_SCRATCH41 register. This is common LP1 procedures for Tegra, so we do these jobs mainly in this patch: * moving LP1 low level handling code to IRAM * marking LP1 mask * copying the physical address of tegra_resume to PMC_SCRATCH41 * re-calculate the CPU power timer based on 32KHz Signed-off-by: Joseph Lo jose...@nvidia.com --- V3: * using a #define of IRAM_CODE to replace original static variable I didn't mean change the variable to a define, but rather simply to use the IO_ADDRESS() define instead of any new define. i.e.: diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c +#define IRAM_CODE IO_ADDRESS(TEGRA_IRAM_CODE_AREA) ... just don't add that, and ... +static void tegra_suspend_enter_lp1(void) +{ + tegra_pmc_suspend(); + + /* copy the reset vector SDRAM shutdown code into IRAM */ + memcpy(iram_save_addr, IRAM_CODE, iram_save_size); + memcpy(IRAM_CODE, tegra_lp1_iram.start_addr, iram_save_size); ... and s/IRAM_CODE/IO_ADDRESS(TEGRA_IRAM_CODE_AREA)/ in that code. I'll make that fixup when applying these patches. OK. Thanks. Joseph -- To unsubscribe from this list: send the line unsubscribe linux-tegra in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V4] ARM: tegra: disable LP2 cpuidle state if PCIe is enabled
On Mon, Aug 12, 2013 at 10:00:04AM -0600, Stephen Warren wrote: From: Stephen Warren swar...@nvidia.com Tegra20 HW appears to have a bug such that PCIe device interrupts, whether they are legacy IRQs or MSI, are lost when LP2 is enabled. To work around this, simply disable LP2 if any PCIe devices with interrupts are present. Detect this via the IRQ domain map operation. This is slightly over-conservative; if a device with an interrupt is present but the driver does not actually use them, LP2 will still be disabled. However, this is a reasonable trade-off which enables a simpler workaround. Signed-off-by: Stephen Warren swar...@nvidia.com Tested-by: Thierry Reding tred...@nvidia.com Acked-by: Thierry Reding tred...@nvidia.com --- v4: Add missing tegra-cpuidle.h, re-write commit description. Add acks. v3: Only disable LP2 if a PCIe device that requests an interrupt is actually present. This prevents the loss of power-saving when the WAR isn't required. Great, looks good to me and I see that you've applied it to your tree already. This has been in the works for (literally!) years and it's quite a relief to see it finally merged. Thanks a lot! Thierry pgp5upG5paMpD.pgp Description: PGP signature
[RFC 0/3] ARM: Allow PCI host drivers to be unloaded
Hi, This is a set of experimental patches that allow ARM PCI host drivers to be unloaded. The first two patches enhance the ARM core PCI code with functions to tear down fixed PCI I/O mappings and unregister a PCI host bridge. The third patch uses the new functionality to allow the Tegra PCIe driver to unbind from a device. I'm sending this as an RFC because, while I've been able to successfully unbind and rebind the Tegra PCIe driver and verifying that a NIC connected via PCIe still works after each new probe, I haven't fully investigated yet whether there may be memory leaks due to missing cleanup. Thierry Thierry Reding (3): ARM: Allow unmapping of fixed PCI I/O mappings ARM: Introduce pci_common_exit() PCI: tegra: Support driver unbinding arch/arm/include/asm/io.h | 1 + arch/arm/include/asm/mach/pci.h | 6 ++ arch/arm/kernel/bios32.c| 29 ++--- arch/arm/mm/ioremap.c | 6 ++ drivers/pci/host/pci-tegra.c| 37 - 5 files changed, 75 insertions(+), 4 deletions(-) -- 1.8.3.4 -- To unsubscribe from this list: send the line unsubscribe linux-tegra in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC 3/3] PCI: tegra: Support driver unbinding
Implement the platform driver's .remove() callback to free all resources allocated during driver setup and call pci_common_exit() to cleanup ARM specific datastructures. Unmap the fixed PCI I/O mapping by calling the new pci_iounmap_io() function in the new .teardown() callback. Finally, no longer set the .suppress_bind_attrs field to true to allow the driver to unbind from a device. Signed-off-by: Thierry Reding tred...@nvidia.com --- drivers/pci/host/pci-tegra.c | 37 - 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index 7356741..396f352 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c @@ -250,6 +250,7 @@ struct tegra_pcie { int irq; struct list_head busses; + struct list_head sys; struct resource *cs; struct resource io; @@ -666,6 +667,11 @@ static struct pci_bus *tegra_pcie_scan_bus(int nr, struct pci_sys_data *sys) return bus; } +static void tegra_pcie_teardown(int nr, struct pci_sys_data *sys) +{ + pci_iounmap_io(nr * SZ_64K); +} + static irqreturn_t tegra_pcie_isr(int irq, void *arg) { const char *err_msg[] = { @@ -1583,7 +1589,9 @@ static int tegra_pcie_enable(struct tegra_pcie *pcie) hw.map_irq = tegra_pcie_map_irq; hw.add_bus = tegra_pcie_add_bus; hw.scan = tegra_pcie_scan_bus; + hw.teardown = tegra_pcie_teardown; hw.ops = tegra_pcie_ops; + hw.sys = pcie-sys; pci_common_init_dev(pcie-dev, hw); @@ -1637,6 +1645,7 @@ static int tegra_pcie_probe(struct platform_device *pdev) INIT_LIST_HEAD(pcie-busses); INIT_LIST_HEAD(pcie-ports); + INIT_LIST_HEAD(pcie-sys); pcie-soc_data = match-data; pcie-dev = pdev-dev; @@ -1686,14 +1695,40 @@ put_resources: return err; } +static int tegra_pcie_remove(struct platform_device *pdev) +{ + struct tegra_pcie *pcie = platform_get_drvdata(pdev); + struct tegra_pcie_bus *bus, *tmp; + int err; + + pci_common_exit(pcie-sys); + + list_for_each_entry_safe(bus, tmp, pcie-busses, list) { + vunmap(bus-area-addr); + kfree(bus); + } + + if (IS_ENABLED(CONFIG_PCI_MSI)) { + err = tegra_pcie_disable_msi(pcie); + if (err 0) + return err; + } + + err = tegra_pcie_put_resources(pcie); + if (err 0) + return err; + + return 0; +} + static struct platform_driver tegra_pcie_driver = { .driver = { .name = tegra-pcie, .owner = THIS_MODULE, .of_match_table = tegra_pcie_of_match, - .suppress_bind_attrs = true, }, .probe = tegra_pcie_probe, + .remove = tegra_pcie_remove, }; module_platform_driver(tegra_pcie_driver); -- 1.8.3.4 -- To unsubscribe from this list: send the line unsubscribe linux-tegra in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC 2/3] ARM: Introduce pci_common_exit()
In order to support building PCI host drivers as modules, functionality is required to undo the steps performed by pci_common_init(). The PCI core provides much of the functionality already, so add a function that can be called by drivers to wrap the ARM specific bits. This patch does a number of things to achieve this: it adds a .nr field to struct pci_sys_data to keep track of the controller number that was used to initialize it during pci_common_init(). That field is passed to the new .teardown() callback during cleanup to undo what .setup() did. Furthermore the list of pci_sys_data structures setup can optionally be returned via the hw_pci structure's .sys field. If a driver initializes it, then it is assumed to be an empty list that pci_common_init() will append to. Otherwise the old behaviour of keeping a local list only is preserved. If a driver wants to support unloading, then it needs access to this list and pass it to pci_common_exit(). This will iterate over the list, call the new .teardown() callback and remove the root bus associated with each entry. Signed-off-by: Thierry Reding tred...@nvidia.com --- arch/arm/include/asm/mach/pci.h | 6 ++ arch/arm/kernel/bios32.c| 29 ++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/arch/arm/include/asm/mach/pci.h b/arch/arm/include/asm/mach/pci.h index 454d642..d6c352a 100644 --- a/arch/arm/include/asm/mach/pci.h +++ b/arch/arm/include/asm/mach/pci.h @@ -25,6 +25,7 @@ struct hw_pci { struct pci_ops *ops; int nr_controllers; void**private_data; + struct list_head *sys; int (*setup)(int nr, struct pci_sys_data *); struct pci_bus *(*scan)(int nr, struct pci_sys_data *); void(*preinit)(void); @@ -38,6 +39,7 @@ struct hw_pci { resource_size_t align); void(*add_bus)(struct pci_bus *bus); void(*remove_bus)(struct pci_bus *bus); + void(*teardown)(int nr, struct pci_sys_data *); }; /* @@ -49,6 +51,7 @@ struct pci_sys_data { #endif struct list_head node; int busnr; /* primary bus number */ + int nr; /* controller number */ u64 mem_offset; /* bus-cpu memory mapping offset */ unsigned long io_offset; /* bus-cpu IO mapping offset */ struct pci_bus *bus; /* PCI bus */ @@ -67,6 +70,7 @@ struct pci_sys_data { resource_size_t align); void(*add_bus)(struct pci_bus *bus); void(*remove_bus)(struct pci_bus *bus); + void(*teardown)(int nr, struct pci_sys_data *); void*private_data; /* platform controller private data */ }; @@ -84,6 +88,8 @@ static inline void pci_common_init(struct hw_pci *hw) pci_common_init_dev(NULL, hw); } +void pci_common_exit(struct list_head *head); + /* * Setup early fixed I/O mapping. */ diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index 1ec9c87..6895520 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c @@ -475,11 +475,13 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw, sys-domain = hw-domain; #endif sys-busnr = busnr; + sys-nr = nr; sys-swizzle = hw-swizzle; sys-map_irq = hw-map_irq; sys-align_resource = hw-align_resource; sys-add_bus = hw-add_bus; sys-remove_bus = hw-remove_bus; + sys-teardown = hw-teardown; INIT_LIST_HEAD(sys-resources); if (hw-private_data) @@ -517,18 +519,24 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw, void pci_common_init_dev(struct device *parent, struct hw_pci *hw) { struct pci_sys_data *sys; - LIST_HEAD(head); + struct list_head *head; + LIST_HEAD(list); + + if (hw-sys) + head = hw-sys; + else + head = list; pci_add_flags(PCI_REASSIGN_ALL_RSRC); if (hw-preinit) hw-preinit(); - pcibios_init_hw(parent, hw, head); + pcibios_init_hw(parent, hw, head); if (hw-postinit) hw-postinit(); pci_fixup_irqs(pcibios_swizzle, pcibios_map_irq); - list_for_each_entry(sys, head, node) { + list_for_each_entry(sys, head, node) { struct pci_bus *bus = sys-bus; if (!pci_has_flag(PCI_PROBE_ONLY)) { @@ -555,6 +563,21 @@ void pci_common_init_dev(struct device *parent, struct hw_pci *hw) } } +void pci_common_exit(struct list_head *head) +{ + struct
[RFC 1/3] ARM: Allow unmapping of fixed PCI I/O mappings
The new pci_iounmap_io() function can be used to unmap a fixed PCI I/O mapping as established by pci_ioremap_io(). This will be useful to support unbinding of PCI host drivers. Signed-off-by: Thierry Reding tred...@nvidia.com --- arch/arm/include/asm/io.h | 1 + arch/arm/mm/ioremap.c | 6 ++ 2 files changed, 7 insertions(+) diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index d070741..80c3826 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h @@ -172,6 +172,7 @@ static inline void __iomem *__typesafe_io(unsigned long addr) #define PCI_IO_VIRT_BASE 0xfee0 extern int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr); +extern void pci_iounmap_io(unsigned int offset); /* * Now, pick up the machine-defined IO definitions diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c index f123d6e..c7504c9 100644 --- a/arch/arm/mm/ioremap.c +++ b/arch/arm/mm/ioremap.c @@ -448,4 +448,10 @@ int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr) __pgprot(get_mem_type(MT_DEVICE)-prot_pte)); } EXPORT_SYMBOL_GPL(pci_ioremap_io); + +void pci_iounmap_io(unsigned int offset) +{ + unmap_kernel_range(PCI_IO_VIRT_BASE + offset, SZ_64K); +} +EXPORT_SYMBOL_GPL(pci_iounmap_io); #endif -- 1.8.3.4 -- To unsubscribe from this list: send the line unsubscribe linux-tegra in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] drm/host1x: stop casting VMA offsets to 32bit
VMA offsets are 64bit so do not cast them to unsigned int. Also remove the (now useless) offset-retrieval helper. The VMA manager provides simple enough helpers. Cc: Thierry Reding thierry.red...@gmail.com Cc: Terje Bergström tbergst...@nvidia.com Cc: Arto Merilainen amerilai...@nvidia.com Signed-off-by: David Herrmann dh.herrm...@gmail.com --- drivers/gpu/host1x/drm/drm.c | 2 +- drivers/gpu/host1x/drm/gem.c | 7 +-- drivers/gpu/host1x/drm/gem.h | 1 - 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/host1x/drm/drm.c b/drivers/gpu/host1x/drm/drm.c index 1371a2b..397ed3f 100644 --- a/drivers/gpu/host1x/drm/drm.c +++ b/drivers/gpu/host1x/drm/drm.c @@ -356,7 +356,7 @@ static int tegra_gem_mmap(struct drm_device *drm, void *data, bo = to_tegra_bo(gem); - args-offset = tegra_bo_get_mmap_offset(bo); + args-offset = drm_vma_node_offset_addr(bo-gem.vma_node); drm_gem_object_unreference(gem); diff --git a/drivers/gpu/host1x/drm/gem.c b/drivers/gpu/host1x/drm/gem.c index 3c35622..59623de 100644 --- a/drivers/gpu/host1x/drm/gem.c +++ b/drivers/gpu/host1x/drm/gem.c @@ -106,11 +106,6 @@ static void tegra_bo_destroy(struct drm_device *drm, struct tegra_bo *bo) dma_free_writecombine(drm-dev, bo-gem.size, bo-vaddr, bo-paddr); } -unsigned int tegra_bo_get_mmap_offset(struct tegra_bo *bo) -{ - return (unsigned int)drm_vma_node_offset_addr(bo-gem.vma_node); -} - struct tegra_bo *tegra_bo_create(struct drm_device *drm, unsigned int size) { struct tegra_bo *bo; @@ -227,7 +222,7 @@ int tegra_bo_dumb_map_offset(struct drm_file *file, struct drm_device *drm, bo = to_tegra_bo(gem); - *offset = tegra_bo_get_mmap_offset(bo); + *offset = drm_vma_node_offset_addr(bo-gem.vma_node); drm_gem_object_unreference(gem); diff --git a/drivers/gpu/host1x/drm/gem.h b/drivers/gpu/host1x/drm/gem.h index 2e93b03..492533a 100644 --- a/drivers/gpu/host1x/drm/gem.h +++ b/drivers/gpu/host1x/drm/gem.h @@ -44,7 +44,6 @@ struct tegra_bo *tegra_bo_create_with_handle(struct drm_file *file, unsigned int size, unsigned int *handle); void tegra_bo_free_object(struct drm_gem_object *gem); -unsigned int tegra_bo_get_mmap_offset(struct tegra_bo *bo); int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm, struct drm_mode_create_dumb *args); int tegra_bo_dumb_map_offset(struct drm_file *file, struct drm_device *drm, -- 1.8.3.4 -- To unsubscribe from this list: send the line unsubscribe linux-tegra in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
question on possible i2c slave configuration
Hi Laxman, Stephen and me were discussing about the possible configuration of the i2c slave controller. The question here is if the slave and the master controller of the same port (or instance) can act in parallel. This is of particular interest when it comes to device tree representation. The Tegra3 TRM mentions a that the master can address its own slave for testing purposes. Also the i2c block diagram suggests that there are two controllers (for master and slave) connected to the same bus. If this is the case, master and slave mode is not exclusive, or in other words, the i2c master and slave need to share their resources. Another question is (because this would add a lot of code complexity) if we want to allow such a configuration at all. Thanks, Marc -- To unsubscribe from this list: send the line unsubscribe linux-tegra in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 0/2] Device tree changes for Tegra30 and Tegra114 USB Host support
On 08/01/2013 09:00 AM, Tuomas Tynkkynen wrote: Hi all, Here's the device tree changes required for USB Host support on Tegra30 and Tegra114. This enables USB Host on the Cardhu's dock connector port and on the single built-in A-ports on Dalmore and Beaver. I've applied this series to Tegra's for-3.12/dt branch, since Felipe has applied the driver changes that back it up. -- To unsubscribe from this list: send the line unsubscribe linux-tegra in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Советовано познакомится
Самая плодотворная методология познания иностранного http://misturl.info/833454 -- To unsubscribe from this list: send the line unsubscribe linux-tegra in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 08/12] gpu: host1x: Port the HDMI vendor infoframe code the common helpers
I just wrote the bits to define and pack HDMI vendor specific infoframe. Port the host1x driver to use those so I can refactor the infoframe code a bit more. Cc: Thierry Reding thierry.red...@gmail.com Cc: Terje Bergström tbergst...@nvidia.com Cc: linux-tegra@vger.kernel.org Signed-off-by: Damien Lespiau damien.lesp...@intel.com --- drivers/gpu/host1x/drm/hdmi.c | 24 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/host1x/drm/hdmi.c b/drivers/gpu/host1x/drm/hdmi.c index 01097da..b548918 100644 --- a/drivers/gpu/host1x/drm/hdmi.c +++ b/drivers/gpu/host1x/drm/hdmi.c @@ -539,7 +539,7 @@ static void tegra_hdmi_setup_audio_infoframe(struct tegra_hdmi *hdmi) static void tegra_hdmi_setup_stereo_infoframe(struct tegra_hdmi *hdmi) { - struct hdmi_vendor_infoframe frame; + struct hdmi_hdmi_infoframe frame; unsigned long value; u8 buffer[10]; ssize_t err; @@ -551,26 +551,10 @@ static void tegra_hdmi_setup_stereo_infoframe(struct tegra_hdmi *hdmi) return; } - memset(frame, 0, sizeof(frame)); + hdmi_hdmi_infoframe_init(frame); + frame.s3d_struct = HDMI_3D_STRUCTURE_FRAME_PACKING; - frame.type = HDMI_INFOFRAME_TYPE_VENDOR; - frame.version = 0x01; - frame.length = 6; - - frame.data[0] = 0x03; /* regid0 */ - frame.data[1] = 0x0c; /* regid1 */ - frame.data[2] = 0x00; /* regid2 */ - frame.data[3] = 0x02 5; /* video format */ - - /* TODO: 74 MHz limit? */ - if (1) { - frame.data[4] = 0x00 4; /* 3D structure */ - } else { - frame.data[4] = 0x08 4; /* 3D structure */ - frame.data[5] = 0x00 4; /* 3D ext. data */ - } - - err = hdmi_vendor_infoframe_pack(frame, buffer, sizeof(buffer)); + err = hdmi_hdmi_infoframe_pack(frame, buffer, sizeof(buffer)); if (err 0) { dev_err(hdmi-dev, failed to pack vendor infoframe: %zd\n, err); -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-tegra in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html