Skip to contentSkip to conversation

dream: glue for mmc controller

PATCH Pavel Machek 4 participants 6 messages Nov 3, 2009 – Dec 8, 2009

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

This is what I came up with (relative to the previous patches). Unfortunately, it does not quite work: mmc controller is detected, but it hangs trying to access the card.

Good news is that GPIO support seems to work, and I am able to flash the keyboard backlight.

Does anyone have an idea what is wrong? Do I need some more infrastructure to set up (DMA transfers or something?)?

I'm only setting up one mmc channel; I believe the other one is for wifi, and it should work like this...?
Pavel

arch/arm/mach-msm/Makefile +1 -1
index 91e6f5c..16c0faa 100644
@@ -6,4 +6,4 @@ obj-y += clock.o clock-7x01a.o
 
 obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o
 
-obj-$(CONFIG_MACH_TROUT) += board-dream.o
+obj-$(CONFIG_MACH_TROUT) += board-dream.o board-dream-mmc.o board-dream-gpio.o generic_gpio.o
arch/arm/mach-msm/board-dream-gpio.c new file +301 -0

301 lines not on this page · raw message

arch/arm/mach-msm/board-dream-mmc.c new file +240 -0

240 lines not on this page · raw message

arch/arm/mach-msm/board-dream.c +38 -10

103 lines not on this page · raw message

arch/arm/mach-msm/board-dream.h +148 -0

153 lines not on this page · raw message

arch/arm/mach-msm/devices.c +77 -0

118 lines not on this page · raw message

arch/arm/mach-msm/generic_gpio.c new file +274 -0

274 lines not on this page · raw message

arch/arm/mach-msm/gpio_chip.h new file +38 -0
new file mode 100644
index 0000000..eab9f09
@@ -0,0 +1,38 @@
+/* arch/arm/mach-msm/gpio_chip.h
+ *
+ * Copyright (C) 2007 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _LINUX_GPIO_CHIP_H
+#define _LINUX_GPIO_CHIP_H
+
+#include <linux/list.h>
+
+struct gpio_chip {
+	struct list_head list;
+	struct gpio_state *state;
+
+	unsigned int start;
+	unsigned int end;
+
+	int (*configure)(struct gpio_chip *chip, unsigned int gpio, unsigned long flags);
+	int (*get_irq_num)(struct gpio_chip *chip, unsigned int gpio, unsigned int *irqp, unsigned long *irqnumflagsp);
+	int (*read)(struct gpio_chip *chip, unsigned int gpio);
+	int (*write)(struct gpio_chip *chip, unsigned int gpio, unsigned on);
+	int (*read_detect_status)(struct gpio_chip *chip, unsigned int gpio);
+	int (*clear_detect_status)(struct gpio_chip *chip, unsigned int gpio);
+};
+
+int register_gpio_chip(struct gpio_chip *gpio_chip);
+
+#endif
arch/arm/mach-msm/gpio_hw.h new file +100 -0

100 lines not on this page · raw message

arch/arm/mach-msm/include/mach/gpio.h new file +47 -0

47 lines not on this page · raw message

drivers/mmc/host/msm_sdcc.c +7 -0
index b31946e..7e0c1ac 100644
@@ -69,6 +69,7 @@ msmsdcc_request_end(struct msmsdcc_host *host, struct mmc_request *mrq)
 
 	host->curr.mrq = NULL;
 	host->curr.cmd = NULL;
+	printk("msm..._request_end\n");
 
 	if (mrq->data)
 		mrq->data->bytes_xfered = host->curr.data_xfered;
@@ -119,6 +120,7 @@ msmsdcc_dma_complete_func(struct msm_dmov_cmd *cmd,
 	unsigned long		flags;
 	struct mmc_request	*mrq;
 
+	printk("data complete func\n");
 	spin_lock_irqsave(&host->lock, flags);
 	mrq = host->curr.mrq;
 	BUG_ON(!mrq);
@@ -360,6 +362,8 @@ msmsdcc_start_command(struct msmsdcc_host *host, struct mmc_command *cmd, u32 c)
 {
 	void __iomem *base = host->base;
 
+	printk("start_command\n");
+
 	if (readl(base + MMCICOMMAND) & MCI_CPSM_ENABLE) {
 		writel(0, base + MMCICOMMAND);
 		udelay(2 + ((5 * 1000000) / host->clk_rate));
@@ -483,6 +487,7 @@ msmsdcc_pio_irq(int irq, void *dev_id)
 	void __iomem		*base = host->base;
 	uint32_t		status;
 
+	printk("msmsdcc_pio_irq\n");
 	status = readl(base + MMCISTATUS);
 
 	do {
@@ -589,6 +594,7 @@ msmsdcc_handle_irq_data(struct msmsdcc_host *host, u32 status,
 {
 	struct mmc_data *data = host->curr.data;
 
+	printk("handle_irq_data\n");
 	if (!data)
 		return;
 
@@ -696,6 +702,7 @@ msmsdcc_request(struct mmc_host *mmc, struct mmc_request *mrq)
 	WARN_ON(host->curr.mrq != NULL);
 	WARN_ON(host->pwr == 0);
 
+	printk("msm..._request\n");
 	spin_lock_irqsave(&host->lock, flags);
 
 	host->stats.reqs++;
kernel/printk.c +2 -0
index 2c98b0b..5f37e88 100644
@@ -714,10 +714,12 @@ asmlinkage int vprintk(const char *fmt, va_list args)
 	printed_len += vscnprintf(printk_buf + printed_len,
 				  sizeof(printk_buf) - printed_len, fmt, args);
 
+#if 0
 	{
 		extern void printascii(const char *);
 		printascii(printk_buf);
 	}
+#endif
 
 	p = printk_buf;
 
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#1 lore raw
Quoted 44 lines · Pavel Machek

This is what I came up with (relative to the previous patches). Unfortunately, it does not quite work: mmc controller is detected, but it hangs trying to access the card.

Good news is that GPIO support seems to work, and I am able to flash the keyboard backlight.

Does anyone have an idea what is wrong? Do I need some more infrastructure to set up (DMA transfers or something?)?

I'm only setting up one mmc channel; I believe the other one is for wifi, and it should work like this...?
Pavel

arch/arm/mach-msm/Makefile +1 -1
index 91e6f5c..16c0faa 100644
@@ -6,4 +6,4 @@ obj-y += clock.o clock-7x01a.o
 
 obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o
 
-obj-$(CONFIG_MACH_TROUT) += board-dream.o
+obj-$(CONFIG_MACH_TROUT) += board-dream.o board-dream-mmc.o board-dream-gpio.o generic_gpio.o
arch/arm/mach-msm/board-dream-gpio.c new file +13 -0
new file mode 100644
index 0000000..7e86a99
@@ -0,0 +1,301 @@
+/* arch/arm/mach-msm/board-dream-gpio.c
+ *
+ * Copyright (C) 2008 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *

arch/arm/mach-msm/board-dream-gpio.c line 23

Quoted 10 lines
arch/arm/mach-msm/board-dream-gpio.c new file +10 -0
+ */
+
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/irq.h>
+#include <linux/pm.h>
+#include <linux/sysdev.h>
+
+#include <asm/io.h>
+#include <asm/gpio.h>

linux/gpio.h
linux/io.h

and why can't use you use gpiolib?

Signature · 3 lines
Ben (ben at fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'
#2 lore raw

Hi!

Quoted 43 lines
Quoted 43 lines

Good news is that GPIO support seems to work, and I am able to flash the keyboard backlight.

Does anyone have an idea what is wrong? Do I need some more infrastructure to set up (DMA transfers or something?)?

I'm only setting up one mmc channel; I believe the other one is for wifi, and it should work like this...?
Pavel

arch/arm/mach-msm/Makefile +1 -1
index 91e6f5c..16c0faa 100644
@@ -6,4 +6,4 @@ obj-y += clock.o clock-7x01a.o
 
 obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o
 
-obj-$(CONFIG_MACH_TROUT) += board-dream.o
+obj-$(CONFIG_MACH_TROUT) += board-dream.o board-dream-mmc.o board-dream-gpio.o generic_gpio.o
arch/arm/mach-msm/board-dream-gpio.c new file +17 -0
new file mode 100644
index 0000000..7e86a99
@@ -0,0 +1,301 @@
+/* arch/arm/mach-msm/board-dream-gpio.c
+ *
+ * Copyright (C) 2008 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/errno.h>
Quoted 8 lines

arch/arm/mach-msm/board-dream-gpio.c line 23

Quoted 6 lines
arch/arm/mach-msm/board-dream-gpio.c new file +6 -0
+#include <linux/irq.h>
+#include <linux/pm.h>
+#include <linux/sysdev.h>
+
+#include <asm/io.h>
+#include <asm/gpio.h>

linux/gpio.h
linux/io.h

I got compile errors when trying to use linux/gpio.h:

arch/arm/mach-msm/board-dream-gpio.c: In function 'dream_gpio_configure':
arch/arm/mach-msm/board-dream-gpio.c:109: error: 'GPIOF_OUTPUT_LOW' undeclared (first use in this function) arch/arm/mach-msm/board-dream-gpio.c:109: error: (Each undeclared identifier is reported only once arch/arm/mach-msm/board-dream-gpio.c:109: error: for each function it appears in.)
arch/arm/mach-msm/board-dream-gpio.c:109: error: 'GPIOF_OUTPUT_HIGH' undeclared (first use in this function) arch/arm/mach-msm/board-dream-gpio.c: In function 'dream_init_gpio':
arch/arm/mach-msm/board-dream-gpio.c:291: error: 'IRQF_TRIGGER_HIGH' undeclared (first use in this function) arch/arm/mach-msm/board-dream-gpio.c:293: error: implicit declaration of function 'set_irq_wake'

Quoted 1 line

and why can't use you use gpiolib?

This is what I inherited from google. What advantages are there to it? I'll eventually take a look.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#3 lore raw
Quoted 11 lines · Pavel Machek
Quoted 4 lines

arch/arm/mach-msm/board-dream-gpio.c line 23

Quoted 2 lines
arch/arm/mach-msm/board-dream-gpio.c new file +2 -0
+#include <asm/io.h>
+#include <asm/gpio.h>

linux/gpio.h
linux/io.h

I got compile errors when trying to use linux/gpio.h:

arch/arm/mach-msm/board-dream-gpio.c: In function 'dream_gpio_configure':
arch/arm/mach-msm/board-dream-gpio.c:109: error: 'GPIOF_OUTPUT_LOW' undeclared (first use in this function)

This means it's abusing the gpio header files - which are intended for the generic GPIO support, but are being used for this platforms private non-generic GPIO based stuff.

Quoted 4 lines

arch/arm/mach-msm/board-dream-gpio.c:291: error: 'IRQF_TRIGGER_HIGH' undeclared (first use in this function) arch/arm/mach-msm/board-dream-gpio.c:293: error: implicit declaration of function 'set_irq_wake'

That's showing its missing a linux/interrupt.h include.

#4 lore raw
Quoted 8 lines · Russell King - ARM Linux
Quoted 7 lines · Pavel Machek
Quoted 4 lines

arch/arm/mach-msm/board-dream-gpio.c line 23

Quoted 2 lines
arch/arm/mach-msm/board-dream-gpio.c new file +2 -0
+#include <asm/io.h>
+#include <asm/gpio.h>

linux/gpio.h
linux/io.h

I got compile errors when trying to use linux/gpio.h:

Quoted 9 lines
Quoted 4 lines

arch/arm/mach-msm/board-dream-gpio.c: In function 'dream_gpio_configure':
arch/arm/mach-msm/board-dream-gpio.c:109: error: 'GPIOF_OUTPUT_LOW' undeclared (first use in this function)

This means it's abusing the gpio header files - which are intended for the generic GPIO support, but are being used for this platforms private non-generic GPIO based stuff.

It also means that CONFIG_GENERIC_GPIO is not set, so linux/gpio.h stubbed out all the gpio functions.

Signature · 1 line
Arve Hjønnevåg
#5 lore raw
In reply to Russell King - ARM Linux
Quoted 8 lines · Russell King - ARM Linux
Quoted 7 lines · Pavel Machek
Quoted 4 lines

arch/arm/mach-msm/board-dream-gpio.c line 23

Quoted 2 lines
arch/arm/mach-msm/board-dream-gpio.c new file +2 -0
+#include <asm/io.h>
+#include <asm/gpio.h>

linux/gpio.h
linux/io.h

I got compile errors when trying to use linux/gpio.h:

Quoted 8 lines
Quoted 4 lines

arch/arm/mach-msm/board-dream-gpio.c: In function 'dream_gpio_configure':
arch/arm/mach-msm/board-dream-gpio.c:109: error: 'GPIOF_OUTPUT_LOW' undeclared (first use in this function)

This means it's abusing the gpio header files - which are intended for the generic GPIO support, but are being used for this platforms private non-generic GPIO based stuff.

Ok, will fix.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html