Skip to contentSkip to conversation

ARM: Tegra: cleanup patches from Arnd Bergmann

PATCH Superseded Alan Ott 10 participants 34 messages Mar 1, 2012 – Mar 12, 2012

Subsystems (6)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Alan Ott

author
#0 lore raw

cover ARM: Tegra: cleanup patches from Arnd Bergmann

Hello,

I'm helping Arnd Bergmann get some of his cleanup patches upstream. This set covers the Tegra.

Thanks,

Alan.

Arnd Bergmann (8):
ARM: tegra: export tegra_gpio_{en,dis}able
ARM: tegra: do not hide dma declarations
ARM: tegra: select CPU_FREQ_TABLE
ARM: tegra: build localtimer support only when needed
ARM: tegra: work around tegra THUMB2_KERNEL bug
ARM: tegra: USB_ULPI needs USB
ARM: tegra: export usb phy symbols
ARM: tegra: HACK: remove set_irq_flags() from driver

 arch/arm/Kconfig                       |    1 +
 arch/arm/mach-tegra/Kconfig            |    2 ++
 arch/arm/mach-tegra/Makefile           |    3 ++-
 arch/arm/mach-tegra/include/mach/dma.h |    4 ----
 arch/arm/mach-tegra/usb_phy.c          |   10 ++++++++++
 drivers/gpio/gpio-tegra.c              |    2 ++
 drivers/usb/host/ehci-tegra.c          |    1 -
 7 files changed, 17 insertions(+), 6 deletions(-)
author
#1 lore raw

PATCH 1/8 ARM: tegra: export tegra_gpio_{en,dis}able

From: Arnd Bergmann <[email protected]>

These two functions are used in drivers that can be modules, so they need to be exported.

---
 drivers/gpio/gpio-tegra.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/gpio/gpio-tegra.c +2 -0
index bdc2937..96662cc 100644
@@ -107,11 +107,13 @@ void tegra_gpio_enable(int gpio)
 {
 	tegra_gpio_mask_write(GPIO_MSK_CNF(gpio), gpio, 1);
 }
+EXPORT_SYMBOL_GPL(tegra_gpio_enable);
 
 void tegra_gpio_disable(int gpio)
 {
 	tegra_gpio_mask_write(GPIO_MSK_CNF(gpio), gpio, 0);
 }
+EXPORT_SYMBOL_GPL(tegra_gpio_disable);
 
 static void tegra_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 {
Signature · 1 line
1.7.0.4
author
#8 lore raw

PATCH 2/8 ARM: tegra: do not hide dma declarations

In reply to Alan Ott

From: Arnd Bergmann <[email protected]>

The declarations are actually required for the device definitions, and are still valid even if the dma controller is disabled:

arch/arm/mach-tegra/devices.c:559:12: error: 'TEGRA_DMA_REQ_SEL_I2S_1' undeclared here (not in a function) arch/arm/mach-tegra/devices.c:577:12: error: 'TEGRA_DMA_REQ_SEL_I2S2_1' undeclared here (not in a function)

---
 arch/arm/mach-tegra/include/mach/dma.h |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
arch/arm/mach-tegra/include/mach/dma.h +0 -4
index 3c93390..9077092 100644
@@ -51,8 +51,6 @@
 #define TEGRA_DMA_REQ_SEL_OWR			25
 #define TEGRA_DMA_REQ_SEL_INVALID		31
 
-#if defined(CONFIG_TEGRA_SYSTEM_DMA)
-
 struct tegra_dma_req;
 struct tegra_dma_channel;
 
@@ -151,5 +149,3 @@ void tegra_dma_free_channel(struct tegra_dma_channel *ch);
 int __init tegra_dma_init(void);
 
 #endif
-
-#endif
Signature · 1 line
1.7.0.4
author
#9 lore raw

PATCH 3/8 ARM: tegra: select CPU_FREQ_TABLE

In reply to Alan Ott

From: Arnd Bergmann <[email protected]>

The tegra cpufreq implementation relies on the cpu_freq_table code, so make sure that this is always there when needed.

---
 arch/arm/mach-tegra/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-tegra/Kconfig +1 -0
index 373652d..b2a038e 100644
@@ -10,6 +10,7 @@ config ARCH_TEGRA_2x_SOC
 	select USB_ARCH_HAS_EHCI if USB_SUPPORT
 	select USB_ULPI if USB_SUPPORT
 	select USB_ULPI_VIEWPORT if USB_SUPPORT
+	select CPU_FREQ_TABLE if CPU_FREQ
 	help
 	  Support for NVIDIA Tegra AP20 and T20 processors, based on the
 	  ARM CortexA9MP CPU and the ARM PL310 L2 cache controller
Signature · 1 line
1.7.0.4
author
#11 lore raw

PATCH 4/8 ARM: tegra: build localtimer support only when needed

In reply to Alan Ott

From: Arnd Bergmann <[email protected]>

It is possible to build a tegra kernel without localtimer support, so the tegra specific parts should only be built when that is indeed enabled.

---
 arch/arm/mach-tegra/Makefile |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/arm/mach-tegra/Makefile +2 -1
index e120ff5..a956df8 100644
@@ -13,7 +13,8 @@ obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= tegra2_emc.o
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= pinmux-tegra20-tables.o
 obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= pinmux-tegra30-tables.o
 obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= board-dt-tegra30.o
-obj-$(CONFIG_SMP)                       += platsmp.o localtimer.o headsmp.o
+obj-$(CONFIG_SMP)                       += platsmp.o headsmp.o
+obj-$(CONFIG_LOCAL_TIMERS)		+= localtimer.o
 obj-$(CONFIG_HOTPLUG_CPU)               += hotplug.o
 obj-$(CONFIG_TEGRA_SYSTEM_DMA)		+= dma.o
 obj-$(CONFIG_CPU_FREQ)                  += cpu-tegra.o
Signature · 1 line
1.7.0.4
author
#13 lore raw

PATCH 5/8 ARM: tegra: work around tegra THUMB2_KERNEL bug

In reply to Alan Ott

From: Arnd Bergmann <[email protected]>

The tegra smp code cannot currently be built for t2, so disable that combination for now, as a workaround.

---
 arch/arm/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/Kconfig +1 -0
index a48aecc..ea1d59b 100644
@@ -1598,6 +1598,7 @@ config HZ
 config THUMB2_KERNEL
 	bool "Compile the kernel in Thumb-2 mode (EXPERIMENTAL)"
 	depends on CPU_V7 && !CPU_V6 && !CPU_V6K && EXPERIMENTAL
+	depends on !SMP || !ARCH_TEGRA
 	select AEABI
 	select ARM_ASM_UNIFIED
 	select ARM_UNWIND
Signature · 1 line
1.7.0.4
author
#17 lore raw

PATCH 6/8 ARM: tegra: USB_ULPI needs USB

In reply to Alan Ott

From: Arnd Bergmann <[email protected]>

The USB_ULPI driver is selected by tegra, but can only be built if at least one of USB or USB_GADGET is enabled. The kernel fails to link if both are off.

---
 arch/arm/mach-tegra/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-tegra/Kconfig +1 -0
index b2a038e..7ac3011 100644
@@ -10,6 +10,7 @@ config ARCH_TEGRA_2x_SOC
 	select USB_ARCH_HAS_EHCI if USB_SUPPORT
 	select USB_ULPI if USB_SUPPORT
 	select USB_ULPI_VIEWPORT if USB_SUPPORT
+	select USB_GADGET if USB_SUPPORT && !USB
 	select CPU_FREQ_TABLE if CPU_FREQ
 	help
 	  Support for NVIDIA Tegra AP20 and T20 processors, based on the
Signature · 1 line
1.7.0.4
author
#22 lore raw

PATCH 7/8 ARM: tegra: export usb phy symbols

In reply to Alan Ott

From: Arnd Bergmann <[email protected]>

The ehci driver can be a module, so the functions provided by the tegra platform code used by ehci-tegra need to be exported.

---
 arch/arm/mach-tegra/usb_phy.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
arch/arm/mach-tegra/usb_phy.c +10 -0
index 37576a7..3c45264 100644
@@ -730,6 +730,7 @@ err0:
 	kfree(phy);
 	return ERR_PTR(err);
 }
+EXPORT_SYMBOL_GPL(tegra_usb_phy_open);
 
 int tegra_usb_phy_power_on(struct tegra_usb_phy *phy)
 {
@@ -738,6 +739,7 @@ int tegra_usb_phy_power_on(struct tegra_usb_phy *phy)
 	else
 		return utmi_phy_power_on(phy);
 }
+EXPORT_SYMBOL_GPL(tegra_usb_phy_power_on);
 
 void tegra_usb_phy_power_off(struct tegra_usb_phy *phy)
 {
@@ -746,18 +748,21 @@ void tegra_usb_phy_power_off(struct tegra_usb_phy *phy)
 	else
 		utmi_phy_power_off(phy);
 }
+EXPORT_SYMBOL_GPL(tegra_usb_phy_power_off);
 
 void tegra_usb_phy_preresume(struct tegra_usb_phy *phy)
 {
 	if (!phy_is_ulpi(phy))
 		utmi_phy_preresume(phy);
 }
+EXPORT_SYMBOL_GPL(tegra_usb_phy_preresume);
 
 void tegra_usb_phy_postresume(struct tegra_usb_phy *phy)
 {
 	if (!phy_is_ulpi(phy))
 		utmi_phy_postresume(phy);
 }
+EXPORT_SYMBOL_GPL(tegra_usb_phy_postresume);
 
 void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy,
 				 enum tegra_usb_phy_port_speed port_speed)
@@ -765,24 +770,28 @@ void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy,
 	if (!phy_is_ulpi(phy))
 		utmi_phy_restore_start(phy, port_speed);
 }
+EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_start);
 
 void tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy)
 {
 	if (!phy_is_ulpi(phy))
 		utmi_phy_restore_end(phy);
 }
+EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_end);
 
 void tegra_usb_phy_clk_disable(struct tegra_usb_phy *phy)
 {
 	if (!phy_is_ulpi(phy))
 		utmi_phy_clk_disable(phy);
 }
+EXPORT_SYMBOL_GPL(tegra_usb_phy_clk_disable);
 
 void tegra_usb_phy_clk_enable(struct tegra_usb_phy *phy)
 {
 	if (!phy_is_ulpi(phy))
 		utmi_phy_clk_enable(phy);
 }
+EXPORT_SYMBOL_GPL(tegra_usb_phy_clk_enable);
 
 void tegra_usb_phy_close(struct tegra_usb_phy *phy)
 {
@@ -794,3 +803,4 @@ void tegra_usb_phy_close(struct tegra_usb_phy *phy)
 	clk_put(phy->pll_u);
 	kfree(phy);
 }
+EXPORT_SYMBOL_GPL(tegra_usb_phy_close);
Signature · 1 line
1.7.0.4
author
#24 lore raw

PATCH 8/8 ARM: tegra: HACK: remove set_irq_flags() from driver

In reply to Alan Ott

From: Arnd Bergmann <[email protected]>

The driver should not call set_irq_flags itself, and cannot do this from a loadable module.

Remove the call for now, which might break the driver but at least lets the kernel link again.

---
 drivers/usb/host/ehci-tegra.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/usb/host/ehci-tegra.c +0 -1
index dbc7fe8..ab91f26 100644
@@ -729,7 +729,6 @@ static int tegra_ehci_probe(struct platform_device *pdev)
 		err = -ENODEV;
 		goto fail;
 	}
-	set_irq_flags(irq, IRQF_VALID);
 
 #ifdef CONFIG_USB_OTG_UTILS
 	if (pdata->operating_mode == TEGRA_USB_OTG) {
Signature · 1 line
1.7.0.4
#25 lore raw

Re: [PATCH 8/8] ARM: tegra: HACK: remove set_irq_flags() from driver

Quoted 9 lines · Alan Ott

From: Arnd Bergmann <[email protected]>

The driver should not call set_irq_flags itself, and cannot do this from a loadable module.

Remove the call for now, which might break the driver but at least lets the kernel link again.

Um, I think you should test this out before submitting it anywhere :)

As it is, I can't accept it.

greg k-h

#14 lore raw

RE: [PATCH 5/8] ARM: tegra: work around tegra THUMB2_KERNEL bug

In reply to Alan Ott

Alan Ott wrote at Thursday, March 01, 2012 12:27 PM:

Quoted 6 lines

From: Arnd Bergmann <[email protected]>

The tegra smp code cannot currently be built for t2, so disable that combination for now, as a workaround.

At least in next-20120229 with the .config I'm using, everything appears to compile fine. The link step does fail, but the error messages I get don't appear to be Tegra specific:

xxx/kernel/sched/clock.c:334: relocation truncated to fit: R_ARM_THM_JUMP11 against symbol sched_clock' defined in .text section in arch/arm/kernel/built-in.o kernel/built-in.o: In function post_relocation':
xxx/kernel/module.c:2860: relocation truncated to fit: R_ARM_THM_JUMP11 against symbol module_finalize' defined in .text section in arch/arm/kernel/built-in.o kernel/built-in.o: In function show_interrupts':
xxx/kernel/irq/proc.c:431: relocation truncated to fit: R_ARM_THM_JUMP11 against symbol arch_show_interrupts' defined in .text section in arch/arm/kernel/built-in.o drivers/built-in.o: In function pci_set_master':
xxx/drivers/pci/pci.c:2674: relocation truncated to fit: R_ARM_THM_JUMP11 against symbol `pcibios_set_master' defined in .text section in arch/arm/kernel/built-in.o

What failure does this solve, and how do I trigger it?

Signature · 1 line
nvpublic
#18 lore raw

RE: [PATCH 6/8] ARM: tegra: USB_ULPI needs USB

In reply to Alan Ott

Alan Ott wrote at Thursday, March 01, 2012 12:27 PM:

Quoted 7 lines

From: Arnd Bergmann <[email protected]>

The USB_ULPI driver is selected by tegra, but can only be built if at least one of USB or USB_GADGET is enabled. The kernel fails to link if both are off.

arch/arm/mach-tegra/Kconfig +0 -0

...

Quoted 1 line
arch/arm/mach-tegra/Kconfig +0 -0
@@ -10,6 +10,7 @@ config ARCH_TEGRA_2x_SOC

...

arch/arm/mach-tegra/Kconfig config ARCH_TEGRA_2x_SOC · line 13

Quoted 1 line
arch/arm/mach-tegra/Kconfig +1 -0
+	select USB_GADGET if USB_SUPPORT && !USB

I don't believe the Tegra USB driver supports gadget mode at present. Would the above be better written as:

select USB if USB_SUPPORT

And I wonder if the Tegra EHCI driver shouldn't be doing some of these selects, not the ARCH_TEGRA_* option.

And this is probably required for Tegra30 too not just Tegra20.

Signature · 1 line
nvpublic
#10 lore raw

Re: [PATCH 3/8] ARM: tegra: select CPU_FREQ_TABLE

In reply to Alan Ott

Hi,

Quoted 15 lines · Alan Ott

From: Arnd Bergmann <[email protected]>

The tegra cpufreq implementation relies on the cpu_freq_table code, so make sure that this is always there when needed.

---
?arch/arm/mach-tegra/Kconfig | ? ?1 +
?1 files changed, 1 insertions(+), 0 deletions(-)

arch/arm/mach-tegra/Kconfig +0 -0
index 373652d..b2a038e 100644
@@ -10,6 +10,7 @@ config ARCH_TEGRA_2x_SOC
Quoted 4 lines

? ? ? ?select USB_ARCH_HAS_EHCI if USB_SUPPORT
? ? ? ?select USB_ULPI if USB_SUPPORT
? ? ? ?select USB_ULPI_VIEWPORT if USB_SUPPORT
+ ? ? ? select CPU_FREQ_TABLE if CPU_FREQ

The corresponding chance is needed for T30 as well.

(the cpufreq driver should probably be moved out to drivers/cpufreq and given its own but that's a separate issue)

-Olof

#26 lore raw

Re: [PATCH 8/8] ARM: tegra: HACK: remove set_irq_flags() from driver

In reply to Greg Kroah-Hartman
Quoted 6 lines · Greg Kroah-Hartman
Quoted 5 lines · Alan Ott

From: Arnd Bergmann <[email protected]>

The driver should not call set_irq_flags itself, and cannot do this from a loadable module.

Quoted 8 lines
Quoted 4 lines

Remove the call for now, which might break the driver but at least lets the kernel link again.

Um, I think you should test this out before submitting it anywhere :)

As it is, I can't accept it.

Right, this one was not meant for inclusion, similar to patch 5 in this series.

Alan:
Part of the reason I asked for help getting the patches out is that they need a lot of auditing, both for whether they still apply to current kernels and for whether they are a good solution to the problem at hand. When in doubt, it's probably better to leave out any patch that looks like it might not be ready for inclusion, or that might make thinks uglier in some way.

Arnd

#23 lore raw

RE: [PATCH 7/8] ARM: tegra: export usb phy symbols

In reply to Alan Ott

Alan Ott wrote at Thursday, March 01, 2012 12:27 PM:

Quoted 7 lines

From: Arnd Bergmann <[email protected]>

The ehci driver can be a module, so the functions provided by the tegra platform code used by ehci-tegra need to be exported.

I think this one need to add:

#include <linux/export.h>

In the relevant place.

Signature · 1 line
nvpublic
#33 lore raw
In reply to Alan Ott
Quoted 7 lines · Alan Ott

I'm helping Arnd Bergmann get some of his cleanup patches upstream. This set covers the Tegra.

Thanks,

Alan.

Quoted 10 lines

Arnd Bergmann (8):
ARM: tegra: export tegra_gpio_{en,dis}able
ARM: tegra: do not hide dma declarations
ARM: tegra: select CPU_FREQ_TABLE
ARM: tegra: build localtimer support only when needed
ARM: tegra: work around tegra THUMB2_KERNEL bug
ARM: tegra: USB_ULPI needs USB
ARM: tegra: export usb phy symbols
ARM: tegra: HACK: remove set_irq_flags() from driver

Hi Alan,

Thanks for getting this started!

As Greg already commented, there are some patches that you should probably drop. When you send out a series with the name of a subarchitecture, it's best to leave out the patches that only address device drivers. I had initially sorted these into the subarch series instead of the drivers series but that turned out to be a bad idea. Sorry I didn't remember about this detail when we first discussed the way forward on my patches.

Also, it's better if you have a slightly shorter Cc list and for each patch take only the people on Cc that are actually interested, rather than send the whole series to everyone that get_maintainer.pl lists for one of the patches. If the Cc list gets too long, that often means that the mails get dropped from the mailing lists, and people might ignore them when they don't understand why they were on Cc to start with. It does help to have everyone on Cc for the initial mail though.

You can add 'Cc:' tags in the individual patches to help you with that. This is another thing I never got around to for the patches I did not send out.

Finally, when sending patches from someone else, you have to add your own Signed-off-by: line below the others (i.e. mine). Everyone who is handling the patch by sending it to someone else should have a Signed-off-by in the email until the point when it gets applied to a git tree that is pulled into the Linus' tree.

Arnd

#19 lore raw

Re: [PATCH 6/8] ARM: tegra: USB_ULPI needs USB

In reply to Stephen Warren
Quoted 7 lines · Stephen Warren

Alan Ott wrote at Thursday, March 01, 2012 12:27 PM:

Quoted 5 lines

From: Arnd Bergmann <[email protected]>

The USB_ULPI driver is selected by tegra, but can only be built if at least one of USB or USB_GADGET is enabled. The kernel fails to link if both are off.

Quoted 7 lines
Quoted 1 line
arch/arm/mach-tegra/Kconfig +0 -0

...

Quoted 1 line
arch/arm/mach-tegra/Kconfig +0 -0
@@ -10,6 +10,7 @@ config ARCH_TEGRA_2x_SOC

...

arch/arm/mach-tegra/Kconfig config ARCH_TEGRA_2x_SOC · line 13

Quoted 1 line
arch/arm/mach-tegra/Kconfig +1 -0
+	select USB_GADGET if USB_SUPPORT && !USB

I don't believe the Tegra USB driver supports gadget mode at present.

ok.

Quoted 3 lines

Would the above be better written as:

select USB if USB_SUPPORT

That does not look correct either. There is no reason why USB can't be disabled with USB_SUPPORT enabled on other platforms.

Maybe it's better to change the 'select USB_ULPI if USB_SUPPORT' into 'select USB_ULPI if USB' instead? Or maybe just don't select USB_ULPI to start with and put it into the defconfig instead.

Quoted 1 line

And this is probably required for Tegra30 too not just Tegra20.

Right. Tegra30 was not there when I did these patches, so it's probably missing in other places, too.

Arnd

Tested-by on v1 8/8
#27 lore raw

RE: [PATCH 8/8] ARM: tegra: HACK: remove set_irq_flags() from driver

In reply to Alan Ott

Alan Ott wrote at Thursday, March 01, 2012 12:27 PM:

Quoted 3 lines

From: Arnd Bergmann <[email protected]>

The driver should not call set_irq_flags itself, and

Probably true in this case.

Quoted 1 line

cannot do this from a loadable module.

I hope that's not true; grep'ing the entire of drivers/ shows a bunch of drivers calling this function, and many look like they'd be reasonable as module.

Quoted 1 line

From what little I understand of this, any irq_chip is going to call

that function after setting up any child/cascaded IRQs, and I assume that irq_chips can be in modules.

Quoted 2 lines

Remove the call for now, which might break the driver but at least lets the kernel link again.

The driver appears to work fine with this removed. At least, on Tegra20 Harmony, I was able to modprobe ehci-hcd and then use the USB Ethernet controller for DHCP and SSH.

So,

Signature · 1 line
nvpublic
#30 lore raw

Re: [PATCH 8/8] ARM: tegra: HACK: remove set_irq_flags() from driver

In reply to Alan Ott
Quoted 18 lines · Alan Ott

From: Arnd Bergmann <[email protected]>

The driver should not call set_irq_flags itself, and cannot do this from a loadable module.

Remove the call for now, which might break the driver but at least lets the kernel link again.

---
?drivers/usb/host/ehci-tegra.c | ? ?1 -
?1 files changed, 0 insertions(+), 1 deletions(-)

drivers/usb/host/ehci-tegra.c +0 -0
index dbc7fe8..ab91f26 100644

drivers/usb/host/ehci-tegra.c static int tegra_ehci_probe(struct platform_device *pdev) · line 732

Quoted 4 lines
drivers/usb/host/ehci-tegra.c +0 -1
@@ -729,7 +729,6 @@ static int tegra_ehci_probe(struct platform_device *pdev)
 ? ? ? ? ? ? ? ?err = -ENODEV;
 ? ? ? ? ? ? ? ?goto fail;
 ? ? ? ?}
- ? ? ? set_irq_flags(irq, IRQF_VALID);

The kernel is full of this kind of stuff (drivers/mfd/twl4030-irq.c):

#ifdef CONFIG_ARM
        /* ARM requires an extra step to clear IRQ_NOREQUEST, which it
         * sets on behalf of every irq_chip.  Also sets IRQ_NOPROBE.
         */
        set_irq_flags(irq, IRQF_VALID);
#else
        /* same effect on other architectures */
        irq_set_noprobe(irq);

#endif

Can't we try to fix this for real instead of breaking the universe, hehe :-)

Yours,
Linus Walleij

#20 lore raw

RE: [PATCH 6/8] ARM: tegra: USB_ULPI needs USB

In reply to Arnd Bergmann

Arnd Bergmann wrote at Thursday, March 01, 2012 1:26 PM:

Quoted 20 lines · Stephen Warren
Quoted 7 lines

Alan Ott wrote at Thursday, March 01, 2012 12:27 PM:

Quoted 5 lines

From: Arnd Bergmann <[email protected]>

The USB_ULPI driver is selected by tegra, but can only be built if at least one of USB or USB_GADGET is enabled. The kernel fails to link if both are off.

Quoted 7 lines
Quoted 1 line
arch/arm/mach-tegra/Kconfig +0 -0

...

Quoted 1 line
arch/arm/mach-tegra/Kconfig +0 -0
@@ -10,6 +10,7 @@ config ARCH_TEGRA_2x_SOC

...

arch/arm/mach-tegra/Kconfig config ARCH_TEGRA_2x_SOC · line 13

Quoted 1 line
arch/arm/mach-tegra/Kconfig +1 -0
+	select USB_GADGET if USB_SUPPORT && !USB

I don't believe the Tegra USB driver supports gadget mode at present.

ok.

Quoted 2 lines

Would the above be better written as:

Quoted 7 lines
Quoted 1 line

select USB if USB_SUPPORT

That does not look correct either. There is no reason why USB can't be disabled with USB_SUPPORT enabled on other platforms.

Maybe it's better to change the 'select USB_ULPI if USB_SUPPORT' into 'select USB_ULPI if USB' instead?

That sounds reasonable.

Quoted 2 lines

Or maybe just don't select
USB_ULPI to start with and put it into the defconfig instead.

Perhaps USB_EHCI_TEGRA should depend on USB, and select USB_EHCI?

Signature · 1 line
nvpublic
#28 lore raw

Re: [PATCH 8/8] ARM: tegra: HACK: remove set_irq_flags() from driver

In reply to Stephen Warren
Quoted 6 lines · Stephen Warren

Alan Ott wrote at Thursday, March 01, 2012 12:27 PM:

Quoted 3 lines

From: Arnd Bergmann <[email protected]>

The driver should not call set_irq_flags itself, and

Quoted 7 lines

Probably true in this case.

Quoted 1 line

cannot do this from a loadable module.

I hope that's not true; grep'ing the entire of drivers/ shows a bunch of drivers calling this function, and many look like they'd be reasonable as module.

The drivers that I can see using it are for the most part implementing irq controllers by themselves, which is different from merely using an interrupt.

There are three exceptions today:

arnd at klappe2:~/linux-arm$ git grep -l set_irq_flags drivers/ | xargs grep -L irq_chip drivers/tty/serial/serial_ks8695.c
drivers/tty/serial/sirfsoc_uart.c
drivers/usb/host/ehci-tegra.c

Quoted 3 lines

From what little I understand of this, any irq_chip is going to call that function after setting up any child/cascaded IRQs, and I assume that irq_chips can be in modules.

But the function is not exported. I guess if we want to allow irq_chips in loadable modules, we could export it, but I don't see how it could ever have worked so far.

Quoted 6 lines
Quoted 2 lines

Remove the call for now, which might break the driver but at least lets the kernel link again.

The driver appears to work fine with this removed. At least, on Tegra20 Harmony, I was able to modprobe ehci-hcd and then use the USB Ethernet controller for DHCP and SSH.

Ok, maybe it was the right fix after all then and it just needs a proper change description ;-)

Arnd

#31 lore raw

Re: [PATCH 8/8] ARM: tegra: HACK: remove set_irq_flags() from driver

In reply to Linus Walleij
Quoted 11 lines · Linus Walleij

The kernel is full of this kind of stuff (drivers/mfd/twl4030-irq.c):

#ifdef CONFIG_ARM
        /* ARM requires an extra step to clear IRQ_NOREQUEST, which it
         * sets on behalf of every irq_chip.  Also sets IRQ_NOPROBE.
         */
        set_irq_flags(irq, IRQF_VALID);
#else
        /* same effect on other architectures */
        irq_set_noprobe(irq);

#endif

That is the implementation of an irq_chip, not a random device driver.

Arnd

#15 lore raw

Re: [PATCH 5/8] ARM: tegra: work around tegra THUMB2_KERNEL bug

In reply to Stephen Warren
Quoted 12 lines · Stephen Warren

Alan Ott wrote at Thursday, March 01, 2012 12:27 PM:

Quoted 6 lines

From: Arnd Bergmann <[email protected]>

The tegra smp code cannot currently be built for t2, so disable that combination for now, as a workaround.

At least in next-20120229 with the .config I'm using, everything appears to compile fine. The link step does fail, but the error messages I get don't appear to be Tegra specific:

Quoted 7 lines

xxx/kernel/sched/clock.c:334: relocation truncated to fit: R_ARM_THM_JUMP11 against symbol sched_clock' defined in .text section in arch/arm/kernel/built-in.o kernel/built-in.o: In function post_relocation':
xxx/kernel/module.c:2860: relocation truncated to fit: R_ARM_THM_JUMP11 against symbol module_finalize' defined in .text section in arch/arm/kernel/built-in.o kernel/built-in.o: In function show_interrupts':
xxx/kernel/irq/proc.c:431: relocation truncated to fit: R_ARM_THM_JUMP11 against symbol arch_show_interrupts' defined in .text section in arch/arm/kernel/built-in.o drivers/built-in.o: In function pci_set_master':
xxx/drivers/pci/pci.c:2674: relocation truncated to fit: R_ARM_THM_JUMP11 against symbol `pcibios_set_master' defined in .text section in arch/arm/kernel/built-in.o

At a guess, it suggests your kernel image is too big for the relocations contained within the code. That's something for Thumb people to look into and solve.

#21 lore raw

Re: [PATCH 6/8] ARM: tegra: USB_ULPI needs USB

In reply to Stephen Warren
Quoted 4 lines · Stephen Warren
Quoted 2 lines

Or maybe just don't select
USB_ULPI to start with and put it into the defconfig instead.

Perhaps USB_EHCI_TEGRA should depend on USB, and select USB_EHCI?

I think it should, but that is a different issue. All EHCI bus glues currently depend on USB_EHCI_HCD instead of selecting it.

Changing that would likely break a number of other things that have come to depend on the current behavior.

Arnd

#16 lore raw

Re: [PATCH 5/8] ARM: tegra: work around tegra THUMB2_KERNEL bug

In reply to Russell King - ARM Linux
Quoted 21 lines · Russell King - ARM Linux
Quoted 12 lines · Stephen Warren

Alan Ott wrote at Thursday, March 01, 2012 12:27 PM:

Quoted 6 lines

From: Arnd Bergmann <[email protected]>

The tegra smp code cannot currently be built for t2, so disable that combination for now, as a workaround.

At least in next-20120229 with the .config I'm using, everything appears to compile fine. The link step does fail, but the error messages I get don't appear to be Tegra specific:

Quoted 7 lines

xxx/kernel/sched/clock.c:334: relocation truncated to fit: R_ARM_THM_JUMP11 against symbol sched_clock' defined in .text section in arch/arm/kernel/built-in.o kernel/built-in.o: In function post_relocation':
xxx/kernel/module.c:2860: relocation truncated to fit: R_ARM_THM_JUMP11 against symbol module_finalize' defined in .text section in arch/arm/kernel/built-in.o kernel/built-in.o: In function show_interrupts':
xxx/kernel/irq/proc.c:431: relocation truncated to fit: R_ARM_THM_JUMP11 against symbol arch_show_interrupts' defined in .text section in arch/arm/kernel/built-in.o drivers/built-in.o: In function pci_set_master':
xxx/drivers/pci/pci.c:2674: relocation truncated to fit: R_ARM_THM_JUMP11 against symbol `pcibios_set_master' defined in .text section in arch/arm/kernel/built-in.o

Quoted 3 lines

At a guess, it suggests your kernel image is too big for the relocations contained within the code. That's something for Thumb people to look into and solve.

IIRC, that was not the issue I was trying to fix when I originally made the patch. It's quite likely that the original bug was fixed already, so I'd suggest we drop the patch for now and see if the problem comes back when all other randconfig problems have been resolved on Tegra.

Arnd

#32 lore raw

Re: [PATCH 8/8] ARM: tegra: HACK: remove set_irq_flags() from driver

In reply to Linus Walleij
Quoted 35 lines · Linus Walleij
Quoted 18 lines · Alan Ott

From: Arnd Bergmann <[email protected]>

The driver should not call set_irq_flags itself, and cannot do this from a loadable module.

Remove the call for now, which might break the driver but at least lets the kernel link again.

---
?drivers/usb/host/ehci-tegra.c | ? ?1 -
?1 files changed, 0 insertions(+), 1 deletions(-)

drivers/usb/host/ehci-tegra.c +0 -0
index dbc7fe8..ab91f26 100644

drivers/usb/host/ehci-tegra.c static int tegra_ehci_probe(struct platform_device *pdev) · line 732

Quoted 4 lines
drivers/usb/host/ehci-tegra.c +0 -1
@@ -729,7 +729,6 @@ static int tegra_ehci_probe(struct platform_device *pdev)
 ? ? ? ? ? ? ? ?err = -ENODEV;
 ? ? ? ? ? ? ? ?goto fail;
 ? ? ? ?}
- ? ? ? set_irq_flags(irq, IRQF_VALID);

The kernel is full of this kind of stuff (drivers/mfd/twl4030-irq.c):

#ifdef CONFIG_ARM
        /* ARM requires an extra step to clear IRQ_NOREQUEST, which it
         * sets on behalf of every irq_chip.  Also sets IRQ_NOPROBE.
         */
        set_irq_flags(irq, IRQF_VALID);
#else
        /* same effect on other architectures */
        irq_set_noprobe(irq);
Quoted 4 lines

#endif

Can't we try to fix this for real instead of breaking the universe, hehe :-)

That depends whether you want 0..NR_IRQS to all be request-able before they've been setup with their irq chips and handlers etc.

Unfortunately, genirq doesn't provide a standard helper to clear IRQ_NOREQUEST, and that's why this pain persists.

#29 lore raw

Re: [PATCH 8/8] ARM: tegra: HACK: remove set_irq_flags() from driver

In reply to Arnd Bergmann
Quoted 15 lines · Arnd Bergmann
Quoted 6 lines · Stephen Warren

Alan Ott wrote at Thursday, March 01, 2012 12:27 PM:

Quoted 3 lines

From: Arnd Bergmann <[email protected]>

The driver should not call set_irq_flags itself, and

Quoted 7 lines

Probably true in this case.

Quoted 1 line

cannot do this from a loadable module.

I hope that's not true; grep'ing the entire of drivers/ shows a bunch of drivers calling this function, and many look like they'd be reasonable as module.

Quoted 8 lines

The drivers that I can see using it are for the most part implementing irq controllers by themselves, which is different from merely using an interrupt.

There are three exceptions today:

arnd at klappe2:~/linux-arm$ git grep -l set_irq_flags drivers/ | xargs grep -L irq_chip drivers/tty/serial/serial_ks8695.c

Setting NOAUTOEN should be done elsewhere (in platform code.) Better still, fixing genirq to allow request_irq() to permit the interrupt to be requested *without enabling it* would be a step forwards. I thought my original ARM IRQ code did that.

Quoted 1 line

drivers/tty/serial/sirfsoc_uart.c

Same issue, so same comments.

Quoted 1 line

drivers/usb/host/ehci-tegra.c

This one should not be there. Having drivers mark IRQs as being requestable when the whole point of the flag is to stop request_irq() being used on non-initialized interrupts is just plain stupid.

Quoted 7 lines
Quoted 3 lines

From what little I understand of this, any irq_chip is going to call that function after setting up any child/cascaded IRQs, and I assume that irq_chips can be in modules.

But the function is not exported. I guess if we want to allow irq_chips in loadable modules, we could export it, but I don't see how it could ever have worked so far.

genirq does not permit flow handlers in modules - I suspect that's because it's pretty hard to remove them safely from the system without a lot of effort. Certainly, a whole bunch of genirq functions which are required to implement external flow handlers etc aren't exported.

Acked-by on v1 1/8
#3 lore raw

Re: [PATCH 1/8] ARM: tegra: export tegra_gpio_{en,dis}able

In reply to Alan Ott
Quoted 6 lines · Alan Ott

From: Arnd Bergmann <[email protected]>

These two functions are used in drivers that can be modules, so they need to be exported.

Quoted 25 lines
---
 drivers/gpio/gpio-tegra.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/gpio/gpio-tegra.c +2 -0
index bdc2937..96662cc 100644
@@ -107,11 +107,13 @@ void tegra_gpio_enable(int gpio)
 {
 	tegra_gpio_mask_write(GPIO_MSK_CNF(gpio), gpio, 1);
 }
+EXPORT_SYMBOL_GPL(tegra_gpio_enable);
 
 void tegra_gpio_disable(int gpio)
 {
 	tegra_gpio_mask_write(GPIO_MSK_CNF(gpio), gpio, 0);
 }
+EXPORT_SYMBOL_GPL(tegra_gpio_disable);
 
 static void tegra_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 {
Signature · 1 line
1.7.0.4
Signature · 1 line
email sent from notmuch.vim plugin
#12 lore raw

Re: [PATCH 4/8] ARM: tegra: build localtimer support only when needed

In reply to Alan Ott

Hello.

Quoted 16 lines · Alan Ott

From: Arnd Bergmann<[email protected]>

It is possible to build a tegra kernel without localtimer support, so the tegra specific parts should only be built when that is indeed enabled.

---
  arch/arm/mach-tegra/Makefile |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)
arch/arm/mach-tegra/Makefile +0 -0
index e120ff5..a956df8 100644

arch/arm/mach-tegra/Makefile obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_emc.o · line 16

Quoted 5 lines
arch/arm/mach-tegra/Makefile +1 -1
@@ -13,7 +13,8 @@ obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= tegra2_emc.o
  obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= pinmux-tegra20-tables.o
  obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= pinmux-tegra30-tables.o
  obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= board-dt-tegra30.o
-obj-$(CONFIG_SMP)                       += platsmp.o localtimer.o headsmp.o
+obj-$(CONFIG_SMP)                       += platsmp.o headsmp.o

Could use the chance to indent here with tabs instead of spaces, like below.

arch/arm/mach-tegra/Makefile obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_emc.o · line 17

Quoted 1 line
arch/arm/mach-tegra/Makefile +1 -0
+obj-$(CONFIG_LOCAL_TIMERS)		+= localtimer.o

WBR, Sergei

author
#4 lore raw

PATCH v2 1/1 ARM: tegra: export tegra_gpio_{en,dis}able

In reply to Alan Ott

From: Arnd Bergmann <[email protected]>

These two functions are used in drivers that can be modules, so they need to be exported.

---
 drivers/gpio/gpio-tegra.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/gpio/gpio-tegra.c +2 -0
index bdc2937..96662cc 100644
@@ -107,11 +107,13 @@ void tegra_gpio_enable(int gpio)
 {
 	tegra_gpio_mask_write(GPIO_MSK_CNF(gpio), gpio, 1);
 }
+EXPORT_SYMBOL_GPL(tegra_gpio_enable);
 
 void tegra_gpio_disable(int gpio)
 {
 	tegra_gpio_mask_write(GPIO_MSK_CNF(gpio), gpio, 0);
 }
+EXPORT_SYMBOL_GPL(tegra_gpio_disable);
 
 static void tegra_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 {
Signature · 1 line
1.7.0.4
author
#5 lore raw

Re: [PATCH v2] ARM: tegra: export tegra_gpio_{en,dis}able

Quoted 22 lines · Alan Ott

From: Arnd Bergmann <[email protected]>

These two functions are used in drivers that can be modules, so they need to be exported.

---
 drivers/gpio/gpio-tegra.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/gpio/gpio-tegra.c +0 -0
index bdc2937..96662cc 100644
@@ -107,11 +107,13 @@ void tegra_gpio_enable(int gpio)
 {
 	tegra_gpio_mask_write(GPIO_MSK_CNF(gpio), gpio, 1);
 }

drivers/gpio/gpio-tegra.c void tegra_gpio_enable(int gpio) · line 119

Quoted 10 lines
drivers/gpio/gpio-tegra.c +2 -0
+EXPORT_SYMBOL_GPL(tegra_gpio_enable);
 
 void tegra_gpio_disable(int gpio)
 {
 	tegra_gpio_mask_write(GPIO_MSK_CNF(gpio), gpio, 0);
 }
+EXPORT_SYMBOL_GPL(tegra_gpio_disable);
 
 static void tegra_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 {

Did this patch ever get picked up into someone's tree?

Alan.

#6 lore raw

Re: [PATCH v2] ARM: tegra: export tegra_gpio_{en,dis}able

Quoted 8 lines · Alan Ott
Quoted 7 lines · Alan Ott

From: Arnd Bergmann <[email protected]>

These two functions are used in drivers that can be modules, so they need to be exported.

...

Quoted 1 line

Did this patch ever get picked up into someone's tree?

It looks like Grant ack'd it which implies the thought Olof was going to take it through the Tegra tree perhaps? But Olof did the same, so is probably waiting for Grant to take it...

Applied
#7 lore raw

Re: [PATCH v2] ARM: tegra: export tegra_gpio_{en,dis}able

Quoted 7 lines · Stephen Warren
Quoted 6 lines · Alan Ott
Quoted 5 lines · Alan Ott

From: Arnd Bergmann <[email protected]>

These two functions are used in drivers that can be modules, so they need to be exported.

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

...

Quoted 1 line

Did this patch ever get picked up into someone's tree?

It looks like Grant ack'd it which implies the thought Olof was going to take it through the Tegra tree perhaps? But Olof did the same, so is probably waiting for Grant to take it...

Applied, thx.

g.

Signature · 2 lines
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies,Ltd.