Skip to contentSkip to conversation

PXA: Fix building for lubbock board

PATCH New Anatolij Gustschin 4 participants 10 messages Dec 12, 2011 – Dec 19, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PXA: Fix building for lubbock board

Fix:
drivers/mmc/libmmc.o: In function `mmc_legacy_init':
drivers/mmc/pxa_mmc.c:565: undefined reference to set_GPIO_mode' drivers/mmc/pxa_mmc.c:566: undefined reference to set_GPIO_mode'

Re-add set_GPIO_mode() which has been removed by commit d10237d275300562bbfecbbe2f59a97cfb9dc180 (PXA: Separate PXA2xx CPU init).

---
 arch/arm/cpu/pxa/pxa2xx.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
arch/arm/cpu/pxa/pxa2xx.c +25 -0
index 09e8177..42fb4fc 100644
@@ -299,3 +299,28 @@ void reset_cpu(ulong ignored)
 	for (;;)
 		;
 }
+
+#ifndef CONFIG_CPU_MONAHANS
+void set_GPIO_mode(int gpio_mode)
+{
+	int gpio = gpio_mode & GPIO_MD_MASK_NR;
+	int fn = (gpio_mode & GPIO_MD_MASK_FN) >> 8;
+	int val;
+
+	/* This below changes direction setting of GPIO "gpio" */
+	val = readl(GPDR(gpio));
+
+	if (gpio_mode & GPIO_MD_MASK_DIR)
+		val |= GPIO_bit(gpio);
+	else
+		val &= ~GPIO_bit(gpio);
+
+	writel(val, GPDR(gpio));
+
+	/* This below updates only AF of GPIO "gpio" */
+	val = readl(GAFR(gpio));
+	val &= ~(0x3 << (((gpio) & 0xf) * 2));
+	val |= fn << (((gpio) & 0xf) * 2);
+	writel(val, GAFR(gpio));
+}
+#endif /* CONFIG_CPU_MONAHANS */
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 PXA: Fix building for lubbock board

Quoted 38 lines

Fix:
drivers/mmc/libmmc.o: In function `mmc_legacy_init':
drivers/mmc/pxa_mmc.c:565: undefined reference to set_GPIO_mode' drivers/mmc/pxa_mmc.c:566: undefined reference to set_GPIO_mode'

Re-add set_GPIO_mode() which has been removed by commit d10237d275300562bbfecbbe2f59a97cfb9dc180 (PXA: Separate PXA2xx CPU init).

---
 arch/arm/cpu/pxa/pxa2xx.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
arch/arm/cpu/pxa/pxa2xx.c +15 -0
index 09e8177..42fb4fc 100644
@@ -299,3 +299,28 @@ void reset_cpu(ulong ignored)
 	for (;;)
 		;
 }
+
+#ifndef CONFIG_CPU_MONAHANS
+void set_GPIO_mode(int gpio_mode)
+{
+	int gpio = gpio_mode & GPIO_MD_MASK_NR;
+	int fn = (gpio_mode & GPIO_MD_MASK_FN) >> 8;
+	int val;
+
+	/* This below changes direction setting of GPIO "gpio" */
+	val = readl(GPDR(gpio));
+
+	if (gpio_mode & GPIO_MD_MASK_DIR)
+		val |= GPIO_bit(gpio);
+	else
+		val &= ~GPIO_bit(gpio);

arch/arm/cpu/pxa/pxa2xx.c void reset_cpu(ulong ignored) · line 326

Quoted 10 lines
arch/arm/cpu/pxa/pxa2xx.c +10 -0
+
+	writel(val, GPDR(gpio));
+
+	/* This below updates only AF of GPIO "gpio" */
+	val = readl(GAFR(gpio));
+	val &= ~(0x3 << (((gpio) & 0xf) * 2));
+	val |= fn << (((gpio) & 0xf) * 2);
+	writel(val, GAFR(gpio));
+}
+#endif /* CONFIG_CPU_MONAHANS */

NAK, this is insane and should die. I'll submit a proper patch.

M

#2 lore raw

PATCH 1/1 PXA: Kill last remnants of set_GPIO_mode function

In reply to Anatolij Gustschin

GPIO configuration shall never be done inside a driver, never.

Cc Anatolij Gustschin <[email protected]>
Cc Albert ARIBAUD <[email protected]>
---
 board/lubbock/lubbock.c |    6 ++++++
 drivers/mmc/pxa_mmc.c   |    5 -----
 2 files changed, 6 insertions(+), 5 deletions(-)
board/lubbock/lubbock.c +6 -0
index 437f944..3527b38 100644
@@ -28,6 +28,8 @@
 #include <common.h>
 #include <netdev.h>
 #include <asm/arch/pxa.h>
+#include <asm/arch/pxa-regs.h>
+#include <asm/io.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -47,6 +49,10 @@ int board_init (void)
 	/* adress of boot parameters */
 	gd->bd->bi_boot_params = 0xa0000100;
 
+	/* Configure GPIO6 and GPIO8 as OUT, AF1. */
+	setbits_le32(GPDR0, (1 << 6) | (1 << 8));
+	clrsetbits_le32(GAFR0_L, (3 << 12) | (3 << 16), (1 << 12) | (1 << 16));
+
 	return 0;
 }
 
drivers/mmc/pxa_mmc.c +0 -5
index 2b58a98..80c4445 100644
@@ -560,11 +560,6 @@ mmc_legacy_init(int verbose)
 	/* Reset device interface type */
 	mmc_dev.if_type = IF_TYPE_UNKNOWN;
 
-#if defined(CONFIG_LUBBOCK) || \
-	(defined(CONFIG_GUMSTIX) && !defined(CONFIG_CPU_PXA27X))
-	set_GPIO_mode(GPIO6_MMCCLK_MD);
-	set_GPIO_mode(GPIO8_MMCCS0_MD);
-#endif
 #ifdef CONFIG_CPU_MONAHANS	/* pxa3xx */
 	writel(readl(CKENA) | CKENA_12_MMC0 | CKENA_13_MMC1, CKENA);
 #else	/* pxa2xx */
Signature · 1 line
1.7.7.1
#3 lore raw

PATCH 1/1 PXA: Kill last remnants of set_GPIO_mode function

Hi Marek, Albert,

Quoted 9 lines · On Mon, 12 Dec 2011 16:34:03 +0100 Marek Vasut <[email protected]> wrote:

GPIO configuration shall never be done inside a driver, never.

Cc Anatolij Gustschin <[email protected]>
Cc Albert ARIBAUD <[email protected]>
---
 board/lubbock/lubbock.c |    6 ++++++
 drivers/mmc/pxa_mmc.c   |    5 -----
 2 files changed, 6 insertions(+), 5 deletions(-)

This patch should go into v2011.12 release. Who is going to apply it? Or should I push it via my staging branch?

Thanks,
Anatolij

#4 lore raw

PATCH 1/1 PXA: Kill last remnants of set_GPIO_mode function

Le 19/12/2011 16:57, Anatolij Gustschin a ?crit :

Quoted 15 lines

Hi Marek, Albert,

Quoted 9 lines · On Mon, 12 Dec 2011 16:34:03 +0100 Marek Vasut<[email protected]> wrote:

GPIO configuration shall never be done inside a driver, never.

Cc Anatolij Gustschin<[email protected]>
Cc Albert ARIBAUD<[email protected]>
---
  board/lubbock/lubbock.c |    6 ++++++
  drivers/mmc/pxa_mmc.c   |    5 -----
  2 files changed, 6 insertions(+), 5 deletions(-)
Quoted 5 lines

This patch should go into v2011.12 release. Who is going to apply it? Or should I push it via my staging branch?

Thanks,
Anatolij

How was this patch tested?

Amicalement,

Signature · 1 line
Albert.
#5 lore raw

PATCH 1/1 PXA: Kill last remnants of set_GPIO_mode function

Quoted 16 lines · On Mon, 19 Dec 2011 17:15:03 +0100 Albert ARIBAUD <[email protected]>…

Le 19/12/2011 16:57, Anatolij Gustschin a ?crit :

Quoted 15 lines

Hi Marek, Albert,

Quoted 9 lines · On Mon, 12 Dec 2011 16:34:03 +0100 Marek Vasut<[email protected]> wrote:

GPIO configuration shall never be done inside a driver, never.

Cc Anatolij Gustschin<[email protected]>
Cc Albert ARIBAUD<[email protected]>
---
  board/lubbock/lubbock.c |    6 ++++++
  drivers/mmc/pxa_mmc.c   |    5 -----
  2 files changed, 6 insertions(+), 5 deletions(-)
Quoted 7 lines
Quoted 5 lines

This patch should go into v2011.12 release. Who is going to apply it? Or should I push it via my staging branch?

Thanks,
Anatolij

How was this patch tested?

I only compile-tested it.

Marek, do you have this board? Did you test this patch on real hardware?

Anatolij

#6 lore raw

PATCH 1/1 PXA: Kill last remnants of set_GPIO_mode function

In reply to Albert ARIBAUD
Quoted 20 lines

Le 19/12/2011 16:57, Anatolij Gustschin a ?crit :

Quoted 19 lines

Hi Marek, Albert,

On Mon, 12 Dec 2011 16:34:03 +0100

Quoted 10 lines · Marek Vasut

GPIO configuration shall never be done inside a driver, never.

Cc Anatolij Gustschin<[email protected]>
Cc Albert ARIBAUD<[email protected]>

---

  board/lubbock/lubbock.c |    6 ++++++
  drivers/mmc/pxa_mmc.c   |    5 -----
  2 files changed, 6 insertions(+), 5 deletions(-)

This patch should go into v2011.12 release. Who is going to apply it? Or should I push it via my staging branch?

Quoted 6 lines
Quoted 2 lines

Thanks,
Anatolij

How was this patch tested?

Amicalement,

It wasn't ... only compile-tested. Does someone have a lubbock?

M

#7 lore raw

PATCH 1/1 PXA: Kill last remnants of set_GPIO_mode function

Dear Marek Vasut,

Quoted 2 lines · In message <[email protected]> you wrote:

It wasn't ... only compile-tested. Does someone have a lubbock?

Lubbock is orphaned, no testers are known.

If it's compile clean, that should be good enough.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Only in our dreams we are free.  The rest of the time we need  wages.
                                    - Terry Pratchett, _Wyrd Sisters_
#8 lore raw

PATCH 1/1 PXA: Kill last remnants of set_GPIO_mode function

Hi Wolfgang,

Le 19/12/2011 17:33, Wolfgang Denk a ?crit :

Quoted 6 lines

Dear Marek Vasut,

Quoted 2 lines · In message<[email protected]> you wrote:

It wasn't ... only compile-tested. Does someone have a lubbock?

Quoted 7 lines

Lubbock is orphaned, no testers are known.

If it's compile clean, that should be good enough.

Best regards,

Wolfgang Denk

Ok, I'll pull it in then; but if Lubbock is orphaned, then maybe we should throw a call for a new maintainer to step forward during next release cycle, and if none shows, then remove the board rather and try and keep it alive.

Amicalement,

Signature · 1 line
Albert.
#9 lore raw

PATCH 1/1 PXA: Kill last remnants of set_GPIO_mode function

Quoted 14 lines

Hi Wolfgang,

Le 19/12/2011 17:33, Wolfgang Denk a ?crit :

Quoted 11 lines

Dear Marek Vasut,

Quoted 1 line · In message<[email protected]> you wrote:

It wasn't ... only compile-tested. Does someone have a lubbock?

Lubbock is orphaned, no testers are known.

If it's compile clean, that should be good enough.

Best regards,

Quoted 8 lines
Quoted 1 line

Wolfgang Denk

Ok, I'll pull it in then; but if Lubbock is orphaned, then maybe we should throw a call for a new maintainer to step forward during next release cycle, and if none shows, then remove the board rather and try and keep it alive.

Amicalement,

That's indeed the plan.

M