Skip to contentSkip to conversation

Add Omapl138-Hawkboard support

PATCH Superseded [email protected] 5 participants 22 messages Oct 15, 2010 – Oct 19, 2010 7 messages not in the archive

Subsystems (5)

v4 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

v4 cover Add Omapl138-Hawkboard support

From: Victor Rodriguez <[email protected]>

This patch adds
EMAC, EDMA, ASoC, SOUND, MMC/SD and USB OHCI support for the Hawkboard-L138 system
It is under the machine name "omapl138_hawkboard". This system is based on the da850 davinci CPU architecture.

Victor Rodriguez (9):
davinci: EMAC support for Omapl138-Hawkboard
davinci: EDMA support for Omapl138-Hawkboard
davinci: ASoC support for Omapl138-Hawkboard
davinci: McASP configuration for Omapl138-Hawkboard
davinci: Audio support for Omapl138-Hawkboard
davinci: MMC/SD and USB-OHCI configuration for Omapl138-Hawkboard
davinci: MMC/SD support for Omapl138-Hawkboar
davinci: USB clocks for Omapl138-Hawkboard
davinci: USB1.1 support for Omapl138-Hawkboard

 arch/arm/mach-davinci/board-omapl138-hawk.c |  308 +++++++++++++++++++++++++++
 arch/arm/mach-davinci/da850.c               |   22 ++-
 arch/arm/mach-davinci/include/mach/mux.h    |    4 +
 sound/soc/davinci/Kconfig                   |    5 +-
 sound/soc/davinci/davinci-evm.c             |    6 +-
 5 files changed, 340 insertions(+), 5 deletions(-)
#1 lore raw

PATCH v4 2/9 davinci: EDMA support for Omapl138-Hawkboard

From: Victor Rodriguez <[email protected]>

This patch adds EDMA support for the Hawkboard-L138 system

---
 arch/arm/mach-davinci/board-omapl138-hawk.c |   54 +++++++++++++++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/board-omapl138-hawk.c +54 -0
index 2220105..5a645ad 100644
@@ -67,6 +67,55 @@ static __init void omapl138_hawk_config_emac(void)
 		return;
 }
 
+/*
+ * The following EDMA channels/slots are not being used by drivers (for
+ * example: Timer, GPIO, UART events etc) on da850/omap-l138 EVM/Hawkboard,
+ * hence they are being reserved for codecs on the DSP side.
+ */
+static const s16 da850_dma0_rsv_chans[][2] = {
+	/* (offset, number) */
+	{ 8,  6},
+	{24,  4},
+	{30,  2},
+	{-1, -1}
+};
+
+static const s16 da850_dma0_rsv_slots[][2] = {
+	/* (offset, number) */
+	{ 8,  6},
+	{24,  4},
+	{30, 50},
+	{-1, -1}
+};
+
+static const s16 da850_dma1_rsv_chans[][2] = {
+	/* (offset, number) */
+	{ 0, 28},
+	{30,  2},
+	{-1, -1}
+};
+
+static const s16 da850_dma1_rsv_slots[][2] = {
+	/* (offset, number) */
+	{ 0, 28},
+	{30, 90},
+	{-1, -1}
+};
+
+static struct edma_rsv_info da850_edma_cc0_rsv = {
+	.rsv_chans	= da850_dma0_rsv_chans,
+	.rsv_slots	= da850_dma0_rsv_slots,
+};
+
+static struct edma_rsv_info da850_edma_cc1_rsv = {
+	.rsv_chans	= da850_dma1_rsv_chans,
+	.rsv_slots	= da850_dma1_rsv_slots,
+};
+
+static struct edma_rsv_info *da850_edma_rsv[2] = {
+	&da850_edma_cc0_rsv,
+	&da850_edma_cc1_rsv,
+};
 
 static struct davinci_uart_config omapl138_hawk_uart_config __initdata = {
 	.enabled_uarts = 0x7,
@@ -80,6 +129,11 @@ static __init void omapl138_hawk_init(void)
 
 	omapl138_hawk_config_emac();
 
+	ret = da850_register_edma(da850_edma_rsv);
+	if (ret)
+		pr_warning("%s: EDMA registration failed: %d\n",
+			__func__, ret);
+
 	ret = da8xx_register_watchdog();
 	if (ret)
 		pr_warning("omapl138_hawk_init: "
Signature · 1 line
1.6.0.5
#2 lore raw

PATCH v4 3/9 davinci: ASoC support for Omapl138-Hawkboard

In reply to [email protected]

From: Victor Rodriguez <[email protected]>

This patch adds ASoC support for the Hawkboard-L138 system

---
 sound/soc/davinci/Kconfig       |    5 +++--
 sound/soc/davinci/davinci-evm.c |    6 ++++--
 2 files changed, 7 insertions(+), 4 deletions(-)
sound/soc/davinci/Kconfig +3 -2
index 6bbf001..72c6752 100644
@@ -76,8 +76,9 @@ config  SND_DA830_SOC_EVM
 	  DA830/OMAP-L137 EVM
 
 config  SND_DA850_SOC_EVM
-	tristate "SoC Audio support for DA850/OMAP-L138 EVM"
-	depends on SND_DAVINCI_SOC && MACH_DAVINCI_DA850_EVM
+	tristate "SoC Audio support for DA850/OMAP-L138 EVM/Hawkboard"
+	depends on SND_DAVINCI_SOC && (MACH_DAVINCI_DA850_EVM || \
+			MACH_OMAPL138_HAWKBOARD)
 	select SND_DAVINCI_SOC_MCASP
 	select SND_SOC_TLV320AIC3X
 	help
sound/soc/davinci/davinci-evm.c +4 -2
index 97f74d6..73093eb 100644
@@ -59,7 +59,8 @@ static int evm_hw_params(struct snd_pcm_substream *substream,
 		sysclk = 12288000;
 
 	else if (machine_is_davinci_da830_evm() ||
-				machine_is_davinci_da850_evm())
+				machine_is_davinci_da850_evm() ||
+				machine_is_omapl138_hawkboard())
 		sysclk = 24576000;
 
 	else
@@ -311,7 +312,8 @@ static int __init evm_init(void)
 	} else if (machine_is_davinci_da830_evm()) {
 		evm_snd_dev_data = &da830_evm_snd_devdata;
 		index = 1;
-	} else if (machine_is_davinci_da850_evm()) {
+	} else if (machine_is_davinci_da850_evm() ||
+			machine_is_omapl138_hawkboard()) {
 		evm_snd_dev_data = &da850_evm_snd_devdata;
 		index = 0;
 	} else
Signature · 1 line
1.6.0.5
#3 lore raw

PATCH v4 5/9 davinci: Audio support for Omapl138-Hawkboard

In reply to [email protected]

From: Victor Rodriguez <[email protected]>

This patch adds sound support for the Hawkboard-L138 system

---
Notes:

This patch works with da8xx_omapl_defconfig

In order to test ALSA utils select in menuconfig like insmodule:

Sound card support --->
Advanced Linux Sound Architecture --->
ALSA for SoC audio support --->
SoC Audio for the TI DAVINCI chip
SoC Audio support for DA850/OMAP-L138 EVM/Hawkboard

 arch/arm/mach-davinci/board-omapl138-hawk.c |   46 +++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/board-omapl138-hawk.c +46 -0
index 5a645ad..6f76220 100644
@@ -13,6 +13,7 @@
 #include <linux/init.h>
 #include <linux/console.h>
 #include <linux/gpio.h>
+#include <linux/i2c.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -117,6 +118,38 @@ static struct edma_rsv_info *da850_edma_rsv[2] = {
 	&da850_edma_cc1_rsv,
 };
 
+static struct i2c_board_info __initdata omapl138_hawk_i2c_devices[] = {
+	{
+		I2C_BOARD_INFO("tlv320aic3x", 0x18),
+	},
+};
+
+static struct davinci_i2c_platform_data omapl138_hawk_i2c_0_pdata = {
+	.bus_freq	= 100,	/* kHz */
+	.bus_delay	= 0,	/* usec */
+};
+
+/* davinci Hawkboard audio machine driver */
+static u8 da850_iis_serializer_direction[] = {
+	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,
+	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,
+	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,
+	INACTIVE_MODE,	TX_MODE,	RX_MODE,	INACTIVE_MODE,
+};
+
+static struct snd_platform_data omapl138_hawk_snd_data = {
+	.tx_dma_offset	= 0x2000,
+	.rx_dma_offset	= 0x2000,
+	.op_mode	= DAVINCI_MCASP_IIS_MODE,
+	.num_serializer	= ARRAY_SIZE(da850_iis_serializer_direction),
+	.tdm_slots	= 2,
+	.serial_dir	= da850_iis_serializer_direction,
+	.asp_chan_q	= EVENTQ_1,
+	.version	= MCASP_VERSION_2,
+	.txnumevt	= 1,
+	.rxnumevt	= 1,
+};
+
 static struct davinci_uart_config omapl138_hawk_uart_config __initdata = {
 	.enabled_uarts = 0x7,
 };
@@ -134,6 +167,19 @@ static __init void omapl138_hawk_init(void)
 		pr_warning("%s: EDMA registration failed: %d\n",
 			__func__, ret);
 
+	i2c_register_board_info(1, omapl138_hawk_i2c_devices,
+			ARRAY_SIZE(omapl138_hawk_i2c_devices));
+
+	ret = da8xx_register_i2c(0, &omapl138_hawk_i2c_0_pdata);
+	if (ret)
+		pr_warning("%s: i2c0 registration failed: %d\n",
+			__func__, ret);
+
+	ret = davinci_cfg_reg_list(da850_mcasp_pins);
+	if (ret)
+		pr_warning("%s: mcasp mux setup failed: %d\n", __func__, ret);
+	da8xx_register_mcasp(0, &omapl138_hawk_snd_data);
+
 	ret = da8xx_register_watchdog();
 	if (ret)
 		pr_warning("omapl138_hawk_init: "
Signature · 1 line
1.6.0.5
#4 lore raw

PATCH v4 6/9 davinci: MMC/SD and USB-OHCI configuration for Omapl138-Hawkboard

In reply to [email protected]

From: Victor Rodriguez <[email protected]>

This patch defines Pin Mux configuration to enable MMC/SD and USB-OHCI on the Hawkboard-L138 system

---
 arch/arm/mach-davinci/da850.c            |    4 ++++
 arch/arm/mach-davinci/include/mach/mux.h |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/da850.c +4 -0
index f033a0a..4458bff 100644
@@ -543,11 +543,15 @@ static const struct mux_config da850_pins[] = {
 	MUX_CFG(DA850, EMA_WAIT_1,	6,	24,	15,	1,	false)
 	MUX_CFG(DA850, NEMA_CS_2,	7,	0,	15,	1,	false)
 	/* GPIO function */
+	MUX_CFG(DA850, GPIO2_4,		6,	12,	15,	8,	false)
 	MUX_CFG(DA850, GPIO2_6,		6,	4,	15,	8,	false)
 	MUX_CFG(DA850, GPIO2_8,		5,	28,	15,	8,	false)
 	MUX_CFG(DA850, GPIO2_15,	5,	0,	15,	8,	false)
+	MUX_CFG(DA850, GPIO3_12,	7,	12,	15,	8,	false)
+	MUX_CFG(DA850, GPIO3_13,	7,	8,	15,	8,	false)
 	MUX_CFG(DA850, GPIO4_0,		10,	28,	15,	8,	false)
 	MUX_CFG(DA850, GPIO4_1,		10,	24,	15,	8,	false)
+	MUX_CFG(DA850, GPIO6_13,	13,	8,	15,	8,	false)
 	MUX_CFG(DA850, RTC_ALARM,	0,	28,	15,	2,	false)
 #endif
 };
arch/arm/mach-davinci/include/mach/mux.h +4 -0
index de11aac..5d4e0fe 100644
@@ -908,11 +908,15 @@ enum davinci_da850_index {
 	DA850_NEMA_CS_2,
 
 	/* GPIO function */
+	DA850_GPIO2_4,
 	DA850_GPIO2_6,
 	DA850_GPIO2_8,
 	DA850_GPIO2_15,
+	DA850_GPIO3_12,
+	DA850_GPIO3_13,
 	DA850_GPIO4_0,
 	DA850_GPIO4_1,
+	DA850_GPIO6_13,
 	DA850_RTC_ALARM,
 };
 
Signature · 1 line
1.6.0.5
#5 lore raw

PATCH v4 7/9 davinci: MMC/SD support for Omapl138-Hawkboar

In reply to [email protected]

From: Victor Rodriguez <[email protected]>

This patch adds MMC/SD support for the Hawkboard-L138 system

---
Notes:

This patch works with da8xx_omapl_defconfig
In order to test it select in menuconfig like insmodule

MMC/SD/SDIO card support --->
MMC block device driver
Use bounce buffer for simple hosts TI DAVINCI Multimedia Card Interface support

 arch/arm/mach-davinci/board-omapl138-hawk.c |   50 +++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/board-omapl138-hawk.c +50 -0
index 6f76220..87dea28 100644
@@ -23,6 +23,8 @@
 #include <mach/mux.h>
 
 #define HAWKBOARD_PHY_ID		"0:07"
+#define DA850_HAWK_MMCSD_CD_PIN		GPIO_TO_PIN(3, 12)
+#define DA850_HAWK_MMCSD_WP_PIN		GPIO_TO_PIN(3, 13)
 
 static short omapl138_hawk_mii_pins[] __initdata = {
 	DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3,
@@ -150,6 +152,32 @@ static struct snd_platform_data omapl138_hawk_snd_data = {
 	.rxnumevt	= 1,
 };
 
+static const short hawk_mmcsd0_pins[] = {
+	DA850_MMCSD0_DAT_0, DA850_MMCSD0_DAT_1, DA850_MMCSD0_DAT_2,
+	DA850_MMCSD0_DAT_3, DA850_MMCSD0_CLK, DA850_MMCSD0_CMD,
+	DA850_GPIO3_12, DA850_GPIO3_13,
+	-1
+};
+
+static int da850_hawk_mmc_get_ro(int index)
+{
+	return gpio_get_value(DA850_HAWK_MMCSD_WP_PIN);
+}
+
+static int da850_hawk_mmc_get_cd(int index)
+{
+	return !gpio_get_value(DA850_HAWK_MMCSD_CD_PIN);
+}
+
+static struct davinci_mmc_config da850_mmc_config = {
+	.get_ro		= da850_hawk_mmc_get_ro,
+	.get_cd		= da850_hawk_mmc_get_cd,
+	.wires		= 4,
+	.max_freq	= 50000000,
+	.caps		= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
+	.version	= MMC_CTLR_VERSION_2,
+};
+
 static struct davinci_uart_config omapl138_hawk_uart_config __initdata = {
 	.enabled_uarts = 0x7,
 };
@@ -180,6 +208,28 @@ static __init void omapl138_hawk_init(void)
 		pr_warning("%s: mcasp mux setup failed: %d\n", __func__, ret);
 	da8xx_register_mcasp(0, &omapl138_hawk_snd_data);
 
+	ret = davinci_cfg_reg_list(hawk_mmcsd0_pins);
+	if (ret)
+		pr_warning("%s: MMC/SD0 mux setup failed: %d\n",
+			__func__, ret);
+
+	ret = gpio_request(DA850_HAWK_MMCSD_CD_PIN, "MMC CD\n");
+	if (ret)
+		pr_warning("%s: can not open GPIO %d\n",
+			__func__, DA850_HAWK_MMCSD_CD_PIN);
+	gpio_direction_input(DA850_HAWK_MMCSD_CD_PIN);
+
+	ret = gpio_request(DA850_HAWK_MMCSD_WP_PIN, "MMC WP\n");
+	if (ret)
+		pr_warning("%s: can not open GPIO %d\n",
+			__func__, DA850_HAWK_MMCSD_WP_PIN);
+	gpio_direction_input(DA850_HAWK_MMCSD_WP_PIN);
+
+	ret = da8xx_register_mmcsd0(&da850_mmc_config);
+	if (ret)
+		pr_warning("%s: MMC/SD0 registration failed: %d\n",
+			__func__, ret);
+
 	ret = da8xx_register_watchdog();
 	if (ret)
 		pr_warning("omapl138_hawk_init: "
Signature · 1 line
1.6.0.5

A message that is not in the archive (sent off-list or not yet received): 1287112105-11968-8-git-send-email-vm.rod25-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#7 lore raw

Re: [PATCH v4 7/9] davinci: MMC/SD support for Omapl138-Hawkboar

Hello.

Quoted 5 lines · On 10/15/10 07:08, [email protected] wrote:

From: Victor Rodriguez<[email protected]>

This patch adds MMC/SD support for the Hawkboard-L138 system

[...]

Quoted 4 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +0 -0
index 6f76220..87dea28 100644

[...]

arch/arm/mach-davinci/board-omapl138-hawk.c static __init void omapl138_hawk_init(void) · line 209

Quoted 3 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +0 -0
@@ -180,6 +208,28 @@ static __init void omapl138_hawk_init(void)
  		pr_warning("%s: mcasp mux setup failed: %d\n", __func__, ret);
  	da8xx_register_mcasp(0,&omapl138_hawk_snd_data);

I'd put all the following into a sperate function.

arch/arm/mach-davinci/board-omapl138-hawk.c static __init void omapl138_hawk_init(void) · line 220

Quoted 10 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +10 -0
+	ret = davinci_cfg_reg_list(hawk_mmcsd0_pins);
+	if (ret)
+		pr_warning("%s: MMC/SD0 mux setup failed: %d\n",
+			__func__, ret);
+
+	ret = gpio_request(DA850_HAWK_MMCSD_CD_PIN, "MMC CD\n");
+	if (ret)
+		pr_warning("%s: can not open GPIO %d\n",
+			__func__, DA850_HAWK_MMCSD_CD_PIN);
+	gpio_direction_input(DA850_HAWK_MMCSD_CD_PIN);

You cannot call that if gpio_request{} failed.

arch/arm/mach-davinci/board-omapl138-hawk.c static __init void omapl138_hawk_init(void) · line 226

Quoted 5 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +5 -0
+	ret = gpio_request(DA850_HAWK_MMCSD_WP_PIN, "MMC WP\n");
+	if (ret)
+		pr_warning("%s: can not open GPIO %d\n",
+			__func__, DA850_HAWK_MMCSD_WP_PIN);
+	gpio_direction_input(DA850_HAWK_MMCSD_WP_PIN);

You cannot call that if gpio_request{} failed.

arch/arm/mach-davinci/board-omapl138-hawk.c static __init void omapl138_hawk_init(void) · line 235

Quoted 8 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +5 -0
+	ret = da8xx_register_mmcsd0(&da850_mmc_config);
+	if (ret)
+		pr_warning("%s: MMC/SD0 registration failed: %d\n",
+			__func__, ret);
+
  	ret = da8xx_register_watchdog();
  	if (ret)
  		pr_warning("omapl138_hawk_init: "

WBR, Sergei

#8 lore raw

Re: [PATCH v4 7/9] davinci: MMC/SD support for Omapl138-Hawkboar

Quoted 20 lines · Sergei Shtylyov

Hello.

Quoted 5 lines · On 10/15/10 07:08, [email protected] wrote:

From: Victor Rodriguez<[email protected]>

This patch adds MMC/SD support for the Hawkboard-L138 system

[...]

Quoted 5 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +0 -0
index 6f76220..87dea28 100644

[...]

Quoted 1 line
Quoted 6 lines

arch/arm/mach-davinci/board-omapl138-hawk.c static __init void omapl138_hawk_init(void) · line 210

Quoted 4 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +0 -0
@@ -180,6 +208,28 @@ static __init void omapl138_hawk_init(void)
                pr_warning("%s: mcasp mux setup failed: %d\n", __func__,
 ret);
        da8xx_register_mcasp(0,&omapl138_hawk_snd_data);

  I'd put all the following into a sperate function.

Thanks for the feedback Sergei I will fix that in a void function similar to omapl138_hawk_usb_init on the 9/9 patch

Quoted 11 lines

arch/arm/mach-davinci/board-omapl138-hawk.c static __init void omapl138_hawk_init(void) · line 220

Quoted 10 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +10 -0
+       ret = davinci_cfg_reg_list(hawk_mmcsd0_pins);
+       if (ret)
+               pr_warning("%s: MMC/SD0 mux setup failed: %d\n",
+                       __func__, ret);
+
+       ret = gpio_request(DA850_HAWK_MMCSD_CD_PIN, "MMC CD\n");
+       if (ret)
+               pr_warning("%s: can not open GPIO %d\n",
+                       __func__, DA850_HAWK_MMCSD_CD_PIN);
+       gpio_direction_input(DA850_HAWK_MMCSD_CD_PIN);
Quoted 1 line

  You cannot call that if gpio_request{} failed.

I think that is the idea. I am really confused here I have found in Documentation/gpio.txt that

[...]

Using GPIOs
-----------
The first thing a system should do with a GPIO is allocate it, using the gpio_request() call; see later.

One of the next things to do with a GPIO, often in board setup code when setting up a platform_device using the GPIO, is mark its direction:

	/* set as input or output, returning 0 or negative errno */
	int gpio_direction_input(unsigned gpio);
	int gpio_direction_output(unsigned gpio, int value);

( ========== This is what I tried to implement ==================== )

The return value is zero for success, else a negative errno. It should be checked, since the get/set calls don't have error returns and since misconfiguration is possible. You should normally issue these calls from a task context. However, for spinlock-safe GPIOs it's OK to use them before tasking is enabled, as part of early board setup.

[...]

GPIO access that may sleep

** IN ADDITION ** calls to setup and configure such GPIOs must be made
from contexts which may sleep, since they may need to access the GPIO controller chip too: (These setup calls are usually made from board setup or driver probe/teardown code, so this is an easy constraint.)

gpio_direction_input()
gpio_direction_output()
gpio_request()

( ========== Here is my confusion it is a different order ==================== )

## gpio_request_one()
## gpio_request_array()
## gpio_free_array()

	gpio_free()
	gpio_set_debounce()

I think that you mean that I should not call gpio_direction_input if gpio_request failed am I right ?

Regards

Victor Rodriguez

Quoted 19 lines

arch/arm/mach-davinci/board-omapl138-hawk.c static __init void omapl138_hawk_init(void) · line 226

Quoted 5 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +5 -0
+       ret = gpio_request(DA850_HAWK_MMCSD_WP_PIN, "MMC WP\n");
+       if (ret)
+               pr_warning("%s: can not open GPIO %d\n",
+                       __func__, DA850_HAWK_MMCSD_WP_PIN);
+       gpio_direction_input(DA850_HAWK_MMCSD_WP_PIN);

  You cannot call that if gpio_request{} failed.

Quoted 8 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +5 -0
+       ret = da8xx_register_mmcsd0(&da850_mmc_config);
+       if (ret)
+               pr_warning("%s: MMC/SD0 registration failed: %d\n",
+                       __func__, ret);
+
        ret = da8xx_register_watchdog();
        if (ret)

               pr_warning("omapl138_hawk_init: "

WBR, Sergei

A message that is not in the archive (sent off-list or not yet received): AANLkTin-DH9eU9wSPLROVBbMj=gfxjRH=Jz=b4yUuHfi-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#10 lore raw

RE: [PATCH v4 7/9] davinci: MMC/SD support for Omapl138-Hawkboar

Quoted 2 lines · davinci-linux-open-source-bounces-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane…

I think that you mean that I should not call gpio_direction_input if gpio_request failed am I right ?

Yes, if gpio_request() fails that means you have not claimed that gpio, something else is using it already or it's not available due to other misconfiguration.

So you shouldn't be trying to set its direction or anything like that.

--
Jon Povey
jon.povey-Ean/AyPsLtfkYMGBc/[email protected]

Racelogic is a limited company registered in England. Registered number 2743719 . Registered Office Unit 10, Swan Business Centre, Osier Way, Buckingham, Bucks, MK18 1TB .

The information contained in this electronic mail transmission is intended by Racelogic Ltd for the use of the named individual or entity to which it is directed and may contain information that is confidential or privileged. If you have received this electronic mail transmission in error, please delete it from your system without copying or forwarding it, and notify the sender of the error by reply email so that the sender's address records can be corrected. The views expressed by the sender of this communication do not necessarily represent those of Racelogic Ltd. Please note that Racelogic reserves the right to monitor e-mail communications passing through its network

#11 lore raw

Re: [PATCH v4 7/9] davinci: MMC/SD support for Omapl138-Hawkboar

Quoted 10 lines · Jon Povey
Quoted 2 lines · [email protected] wrote:

I think that you mean that I should not call gpio_direction_input if gpio_request failed am I right ?

Yes, if gpio_request() fails that means you have not claimed that gpio, something else is using it already or it's not available due to other misconfiguration.

So you shouldn't be trying to set its direction or anything like that.

Quoted 11 lines

--
Jon Povey
[email protected]

Racelogic is a limited company registered in England. Registered number 2743719 . Registered Office Unit 10, Swan Business Centre, Osier Way, Buckingham, Bucks, MK18 1TB .

The information contained in this electronic mail transmission is intended by Racelogic Ltd for the use of the named individual or entity to which it is directed and may contain information that is confidential or privileged. If you have received this electronic mail transmission in error, please delete it from your system without copying or forwarding it, and notify the sender of the error by reply email so that the sender's address records can be corrected. The views expressed by the sender of this communication do not necessarily represent those of Racelogic Ltd. Please note that Racelogic reserves the right to monitor e-mail communications passing through its network

Hi Jon

Yes you are right and as I understand gpio_request will give a 0 if it success and because of that the warning never will appear, if there is a problem there will be a -1 and the warning will be printed. I could fix this with a return that breaks the code like this

       ret = gpio_request(DA850_HAWK_MMCSD_CD_PIN, "MMC CD\n");
       if (ret) {
               pr_warning("%s: can not open GPIO %d\n",
                       __func__, DA850_HAWK_MMCSD_CD_PIN);
               return;
       }
       gpio_direction_input(DA850_HAWK_MMCSD_CD_PIN);

Is this ok ?

Thanks

Sincerely yours

Victor Rodriguez

A message that is not in the archive (sent off-list or not yet received): AANLkTint2jQ3NpNWk09Y+Tm-mqAaUHpteZ+wrRA_3CDA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#13 lore raw

RE: [PATCH v4 7/9] davinci: MMC/SD support for Omapl138-Hawkboar

Quoted 18 lines · Victor Rodriguez
Quoted 10 lines · Jon Povey
Quoted 2 lines · davinci-linux-open-source-bounces-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane…

I think that you mean that I should not call gpio_direction_input if gpio_request failed am I right ?

Yes, if gpio_request() fails that means you have not claimed that gpio, something else is using it already or it's not available due to other misconfiguration.

So you shouldn't be trying to set its direction or anything like that.

Yes you are right and as I understand gpio_request will give a 0 if it success and because of that the warning never will appear, if there is a problem there will be a -1 and the warning will be printed. I could fix this with a return that breaks the code like this

Quoted 7 lines
       ret = gpio_request(DA850_HAWK_MMCSD_CD_PIN, "MMC CD\n");
               if (ret) { pr_warning("%s: can not open GPIO %d\n",
                       __func__, DA850_HAWK_MMCSD_CD_PIN);
       return; }
       gpio_direction_input(DA850_HAWK_MMCSD_CD_PIN);

Is this ok ?

I haven't seen the rest of your code to tell if that is OK, but not calling any other gpio_* functions if the request fails is the right idea.

You may need to do more cleanup to gracefuly handle the failure, like returning an error value at least.

--
Jon Povey
jon.povey-Ean/AyPsLtfkYMGBc/[email protected]

Racelogic is a limited company registered in England. Registered number 2743719 . Registered Office Unit 10, Swan Business Centre, Osier Way, Buckingham, Bucks, MK18 1TB .

The information contained in this electronic mail transmission is intended by Racelogic Ltd for the use of the named individual or entity to which it is directed and may contain information that is confidential or privileged. If you have received this electronic mail transmission in error, please delete it from your system without copying or forwarding it, and notify the sender of the error by reply email so that the sender's address records can be corrected. The views expressed by the sender of this communication do not necessarily represent those of Racelogic Ltd. Please note that Racelogic reserves the right to monitor e-mail communications passing through its network

#14 lore raw

Re: [PATCH v4 7/9] davinci: MMC/SD support for Omapl138-Hawkboar

In reply to a message not in the archive

Hi Victor,

[...]

Quoted 5 lines

Yes you are right and as I understand gpio_request will give a 0 if it success and because of that the warning never will appear, if there is a problem there will be a -1 and the warning will be printed. I could fix this with a return that breaks the code like this

Quoted 7 lines
       ret = gpio_request(DA850_HAWK_MMCSD_CD_PIN, "MMC CD\n");
       if (ret) {
               pr_warning("%s: can not open GPIO %d\n",
                       __func__, DA850_HAWK_MMCSD_CD_PIN);
               return;
       }
       gpio_direction_input(DA850_HAWK_MMCSD_CD_PIN);

I think gpio_request_one() is simpler. This requests the gpio and sets it up:

	ret = gpio_request_one(DA850_HAWK_MMCSD_CD_PIN,
			       GPIOF_DIR_IN, "MMC CD");
	if (ret < 0) {
		... failed ...
	}

Regards
Cyril.

#15 lore raw

Re: [PATCH v4 7/9] davinci: MMC/SD support for Omapl138-Hawkboar

Quoted 19 lines · Cyril Chemparathy

Hi Victor,

[...]

Quoted 5 lines

Yes you are right and as I understand gpio_request will give a 0 if it success and because of that the warning never will appear, if there is a problem there will be a -1 and the warning will be printed. I could fix this with a return that breaks the code like this

Quoted 7 lines

       ret = gpio_request(DA850_HAWK_MMCSD_CD_PIN, "MMC CD\n"); if (ret) {
               pr_warning("%s: can not open GPIO %d\n", __func__, DA850_HAWK_MMCSD_CD_PIN); return;
       } gpio_direction_input(DA850_HAWK_MMCSD_CD_PIN);

I think gpio_request_one() is simpler.  This requests the gpio and sets it up:

Quoted 9 lines

       ret = gpio_request_one(DA850_HAWK_MMCSD_CD_PIN, GPIOF_DIR_IN, "MMC CD"); if (ret < 0) {
               ... failed ...
       }

Regards
Cyril.

Thanks works perfect

Regards

Victor Rodriguez

#16 lore raw

PATCH v4 8/9 davinci: USB clocks for Omapl138-Hawkboard

In reply to [email protected]

From: Victor Rodriguez <[email protected]>

This patch adds USB1.1 and USB2.0 clocks for the Hawkboard-L138 system

---
 arch/arm/mach-davinci/da850.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/da850.c +16 -0
index 4458bff..2a4730e 100644
@@ -345,6 +345,20 @@ static struct clk aemif_clk = {
 	.flags		= ALWAYS_ENABLED,
 };
 
+static struct clk usb11_clk = {
+	.name		= "usb11",
+	.parent		= &pll0_sysclk4,
+	.lpsc		= DA8XX_LPSC1_USB11,
+	.gpsc		= 1,
+	};
+
+static struct clk usb20_clk = {
+	.name		= "usb20",
+	.parent		= &pll0_sysclk2,
+	.lpsc		= DA8XX_LPSC1_USB20,
+	.gpsc		= 1,
+	};
+
 static struct clk_lookup da850_clks[] = {
 	CLK(NULL,		"ref",		&ref_clk),
 	CLK(NULL,		"pll0",		&pll0_clk),
@@ -387,6 +401,8 @@ static struct clk_lookup da850_clks[] = {
 	CLK("davinci_mmc.0",	NULL,		&mmcsd0_clk),
 	CLK("davinci_mmc.1",	NULL,		&mmcsd1_clk),
 	CLK(NULL,		"aemif",	&aemif_clk),
+	CLK(NULL,		"usb11",	&usb11_clk),
+	CLK(NULL,		"usb20",	&usb20_clk),
 	CLK(NULL,		NULL,		NULL),
 };
 
Signature · 1 line
1.6.0.5

A message that is not in the archive (sent off-list or not yet received): 1287112105-11968-9-git-send-email-vm.rod25-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#18 lore raw

Re: [PATCH v4 8/9] davinci: USB clocks for Omapl138-Hawkboard

Hello.

Quoted 5 lines · On 10/15/10 07:08, [email protected] wrote:

From: Victor Rodriguez<[email protected]>

This patch adds USB1.1 and USB2.0 clocks for the Hawkboard-L138 system

[...]

Quoted 5 lines
arch/arm/mach-davinci/da850.c +0 -0
index 4458bff..2a4730e 100644

arch/arm/mach-davinci/da850.c static struct clk aemif_clk = { · line 353

Quoted 9 lines
arch/arm/mach-davinci/da850.c +6 -0
@@ -345,6 +345,20 @@ static struct clk aemif_clk = {
  	.flags		= ALWAYS_ENABLED,
  };
 
+static struct clk usb11_clk = {
+	.name		= "usb11",
+	.parent		=&pll0_sysclk4,
+	.lpsc		= DA8XX_LPSC1_USB11,
+	.gpsc		= 1,
+	};

This } should be at the start of line.

arch/arm/mach-davinci/da850.c static struct clk aemif_clk = { · line 360

Quoted 7 lines
arch/arm/mach-davinci/da850.c +7 -0
+
+static struct clk usb20_clk = {
+	.name		= "usb20",
+	.parent		=&pll0_sysclk2,
+	.lpsc		= DA8XX_LPSC1_USB20,
+	.gpsc		= 1,
+	};

Same comment.

WBR, Sergei

#19 lore raw

Re: [PATCH v4 8/9] davinci: USB clocks for Omapl138-Hawkboard

Quoted 39 lines · Sergei Shtylyov

Hello.

Quoted 5 lines · On 10/15/10 07:08, [email protected] wrote:

From: Victor Rodriguez<[email protected]>

This patch adds USB1.1 and USB2.0 clocks for the Hawkboard-L138 system

[...]

Quoted 5 lines
arch/arm/mach-davinci/da850.c +0 -0
index 4458bff..2a4730e 100644

arch/arm/mach-davinci/da850.c static struct clk aemif_clk = { · line 353

Quoted 9 lines
arch/arm/mach-davinci/da850.c +6 -0
@@ -345,6 +345,20 @@ static struct clk aemif_clk = {
        .flags          = ALWAYS_ENABLED,
  };
 
+static struct clk usb11_clk = {
+       .name           = "usb11",
+       .parent         =&pll0_sysclk4,
+       .lpsc           = DA8XX_LPSC1_USB11,
+       .gpsc           = 1,
+       };

  This } should be at the start of line.

arch/arm/mach-davinci/da850.c static struct clk aemif_clk = { · line 360

Quoted 7 lines
arch/arm/mach-davinci/da850.c +7 -0
+
+static struct clk usb20_clk = {
+       .name           = "usb20",
+       .parent         =&pll0_sysclk2,
+       .lpsc           = DA8XX_LPSC1_USB20,
+       .gpsc           = 1,
+       };

  Same comment.

Quoted 2 lines

WBR, Sergei

Thanks for the feedback i appreciate a lot i have already do this change

If there is any other change i think I could send the v5 do you agree ?

Thanks

Sincerely yours

Victor Rodriguez

#20 lore raw

PATCH v4 9/9 davinci: USB1.1 support for Omapl138-Hawkboard

In reply to [email protected]

From: Victor Rodriguez <[email protected]>

This patch adds USB1.1 support for the Hawkboard-L138 system

---
Notes:

This patch works with da8xx_omapl_defconfig
In order to test it select in menuconfig like insmodule

Device Drivers --->
SCSI device support --->
SCSI device support
legacy /proc/scsi/ support
SCSI disk support
SCSI low-level drivers

USB support --->
Support for Host-side US OHCI HCD support (NEW)
USB Mass Storage support (NEW) USB Gadget Support --->
USB Gadget Drivers (Ethernet Gadget\
(with CDC Ethernet support)) --->
NOP USB Transceiver Driver

And you will be able to mount and USB pen drive

In order to connect a keyboard or a mouse on a USB-hub select in menuconfig like insmodule

HID Devices --->
Generic HID support
USB Human Interface Device (full HID) support

 arch/arm/mach-davinci/board-omapl138-hawk.c |  108 +++++++++++++++++++++++++++
 1 files changed, 108 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/board-omapl138-hawk.c +108 -0
index 87dea28..4658498 100644
@@ -26,6 +26,9 @@
 #define DA850_HAWK_MMCSD_CD_PIN		GPIO_TO_PIN(3, 12)
 #define DA850_HAWK_MMCSD_WP_PIN		GPIO_TO_PIN(3, 13)
 
+#define DA850_USB1_VBUS_PIN		GPIO_TO_PIN(2, 4)
+#define DA850_USB1_OC_PIN		GPIO_TO_PIN(6, 13)
+
 static short omapl138_hawk_mii_pins[] __initdata = {
 	DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3,
 	DA850_MII_TXD_2, DA850_MII_TXD_1, DA850_MII_TXD_0, DA850_MII_RXER,
@@ -178,6 +181,109 @@ static struct davinci_mmc_config da850_mmc_config = {
 	.version	= MMC_CTLR_VERSION_2,
 };
 
+static irqreturn_t omapl138_hawk_usb_ocic_irq(int irq, void *dev_id);
+static da8xx_ocic_handler_t hawk_usb_ocic_handler;
+
+static const short da850_hawk_usb11_pins[] = {
+	DA850_GPIO2_4, DA850_GPIO6_13,
+	-1
+};
+static int hawk_usb_set_power(unsigned port, int on)
+{
+	gpio_set_value(DA850_USB1_VBUS_PIN, on);
+	return 0;
+}
+
+static int hawk_usb_get_power(unsigned port)
+{
+	return gpio_get_value(DA850_USB1_VBUS_PIN);
+}
+
+static int hawk_usb_get_oci(unsigned port)
+{
+	return !gpio_get_value(DA850_USB1_OC_PIN);
+}
+
+static int hawk_usb_ocic_notify(da8xx_ocic_handler_t handler)
+{
+	int irq         = gpio_to_irq(DA850_USB1_OC_PIN);
+	int error       = 0;
+
+	if (handler != NULL) {
+		hawk_usb_ocic_handler = handler;
+
+		error = request_irq(irq, omapl138_hawk_usb_ocic_irq,
+					IRQF_DISABLED | IRQF_TRIGGER_RISING |
+					IRQF_TRIGGER_FALLING,
+					"OHCI over-current indicator", NULL);
+		if (error)
+			printk(KERN_ERR "%s: could not request IRQ to watch "
+				"over-current indicator changes\n", __func__);
+	} else
+		free_irq(irq, NULL);
+
+	return error;
+}
+
+static struct da8xx_ohci_root_hub omapl138_hawk_usb11_pdata = {
+	.set_power      = hawk_usb_set_power,
+	.get_power      = hawk_usb_get_power,
+	.get_oci        = hawk_usb_get_oci,
+	.ocic_notify    = hawk_usb_ocic_notify,
+	/* TPS2087 switch @ 5V */
+	.potpgt         = (3 + 1) / 2,  /* 3 ms max */
+};
+
+static irqreturn_t omapl138_hawk_usb_ocic_irq(int irq, void *dev_id)
+{
+	hawk_usb_ocic_handler(&omapl138_hawk_usb11_pdata, 1);
+	return IRQ_HANDLED;
+}
+
+static __init void omapl138_hawk_usb_init(void)
+{
+	int ret;
+	u32 cfgchip2;
+
+	ret = davinci_cfg_reg_list(da850_hawk_usb11_pins);
+	if (ret) {
+		pr_warning("%s: USB 1.1 PinMux setup failed: %d\n",
+			__func__, ret);
+		return;
+	}
+
+	/*
+	 * Setup the Ref. clock frequency for the HAWK at 24 MHz.
+	 */
+	cfgchip2 = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
+	cfgchip2 &= ~CFGCHIP2_REFFREQ;
+	cfgchip2 |=  CFGCHIP2_REFFREQ_24MHZ;
+	__raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
+
+	ret = gpio_request(DA850_USB1_VBUS_PIN, "USB1 VBUS\n");
+	if (ret) {
+		printk(KERN_ERR "%s: failed to request GPIO for USB 1.1 port "
+			"power control: %d\n", __func__, ret);
+		return;
+	}
+	gpio_direction_output(DA850_USB1_VBUS_PIN, 0);
+
+	ret = gpio_request(DA850_USB1_OC_PIN, "USB1 OC");
+	if (ret) {
+		printk(KERN_ERR "%s: failed to request GPIO for USB 1.1 port "
+			"over-current indicator: %d\n", __func__, ret);
+		return;
+	}
+	gpio_direction_input(DA850_USB1_OC_PIN);
+
+	ret = da8xx_register_usb11(&omapl138_hawk_usb11_pdata);
+	if (ret) {
+		pr_warning("%s: USB 1.1 registration failed: %d\n",
+			__func__, ret);
+		return;
+	}
+}
+
 static struct davinci_uart_config omapl138_hawk_uart_config __initdata = {
 	.enabled_uarts = 0x7,
 };
@@ -230,6 +336,8 @@ static __init void omapl138_hawk_init(void)
 		pr_warning("%s: MMC/SD0 registration failed: %d\n",
 			__func__, ret);
 
+	omapl138_hawk_usb_init();
+
 	ret = da8xx_register_watchdog();
 	if (ret)
 		pr_warning("omapl138_hawk_init: "
Signature · 1 line
1.6.0.5

A message that is not in the archive (sent off-list or not yet received): 1287112105-11968-10-git-send-email-vm.rod25-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#22 lore raw

Re: [PATCH v4 9/9] davinci: USB1.1 support for Omapl138-Hawkboard

Hello.

Quoted 5 lines · On 10/15/10 07:08, [email protected] wrote:

From: Victor Rodriguez<[email protected]>

This patch adds USB1.1 support for the Hawkboard-L138 system

[...]

Quoted 4 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +0 -0
index 87dea28..4658498 100644

[...]

arch/arm/mach-davinci/board-omapl138-hawk.c static struct davinci_mmc_config da850_mmc_config = { · line 190

Quoted 11 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +7 -0
@@ -178,6 +181,109 @@ static struct davinci_mmc_config da850_mmc_config = {
  	.version	= MMC_CTLR_VERSION_2,
  };
 
+static irqreturn_t omapl138_hawk_usb_ocic_irq(int irq, void *dev_id);
+static da8xx_ocic_handler_t hawk_usb_ocic_handler;
+
+static const short da850_hawk_usb11_pins[] = {
+	DA850_GPIO2_4, DA850_GPIO6_13,
+	-1
+};

An empty wouldn't hurt here. Sorry if I overlooked this before...

Quoted 21 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +21 -0
+static int hawk_usb_set_power(unsigned port, int on)
+{
+	gpio_set_value(DA850_USB1_VBUS_PIN, on);
+	return 0;
+}
+
+static int hawk_usb_get_power(unsigned port)
+{
+	return gpio_get_value(DA850_USB1_VBUS_PIN);
+}
+
+static int hawk_usb_get_oci(unsigned port)
+{
+	return !gpio_get_value(DA850_USB1_OC_PIN);
+}
+
+static int hawk_usb_ocic_notify(da8xx_ocic_handler_t handler)
+{
+	int irq         = gpio_to_irq(DA850_USB1_OC_PIN);
+	int error       = 0;
+

arch/arm/mach-davinci/board-omapl138-hawk.c static struct davinci_mmc_config da850_mmc_config = { · line 221

Quoted 10 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +10 -0
+	if (handler != NULL) {
+		hawk_usb_ocic_handler = handler;
+
+		error = request_irq(irq, omapl138_hawk_usb_ocic_irq,
+					IRQF_DISABLED | IRQF_TRIGGER_RISING |
+					IRQF_TRIGGER_FALLING,
+					"OHCI over-current indicator", NULL);
+		if (error)
+			printk(KERN_ERR "%s: could not request IRQ to watch "
+				"over-current indicator changes\n", __func__);

pr_err() please.

Quoted 35 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +35 -0
+	} else
+		free_irq(irq, NULL);
+
+	return error;
+}
+
+static struct da8xx_ohci_root_hub omapl138_hawk_usb11_pdata = {
+	.set_power      = hawk_usb_set_power,
+	.get_power      = hawk_usb_get_power,
+	.get_oci        = hawk_usb_get_oci,
+	.ocic_notify    = hawk_usb_ocic_notify,
+	/* TPS2087 switch @ 5V */
+	.potpgt         = (3 + 1) / 2,  /* 3 ms max */
+};
+
+static irqreturn_t omapl138_hawk_usb_ocic_irq(int irq, void *dev_id)
+{
+	hawk_usb_ocic_handler(&omapl138_hawk_usb11_pdata, 1);
+	return IRQ_HANDLED;
+}
+
+static __init void omapl138_hawk_usb_init(void)
+{
+	int ret;
+	u32 cfgchip2;
+
+	ret = davinci_cfg_reg_list(da850_hawk_usb11_pins);
+	if (ret) {
+		pr_warning("%s: USB 1.1 PinMux setup failed: %d\n",
+			__func__, ret);
+		return;
+	}
+
+	/*
+	 * Setup the Ref. clock frequency for the HAWK at 24 MHz.

arch/arm/mach-davinci/board-omapl138-hawk.c static struct davinci_mmc_config da850_mmc_config = { · line 266

Quoted 10 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +10 -0
+	 */
+	cfgchip2 = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
+	cfgchip2 &= ~CFGCHIP2_REFFREQ;
+	cfgchip2 |=  CFGCHIP2_REFFREQ_24MHZ;
+	__raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
+
+	ret = gpio_request(DA850_USB1_VBUS_PIN, "USB1 VBUS\n");
+	if (ret) {
+		printk(KERN_ERR "%s: failed to request GPIO for USB 1.1 port "
+			"power control: %d\n", __func__, ret);

pr_err() please.

arch/arm/mach-davinci/board-omapl138-hawk.c static struct davinci_mmc_config da850_mmc_config = { · line 274

Quoted 8 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +8 -0
+		return;
+	}
+	gpio_direction_output(DA850_USB1_VBUS_PIN, 0);
+
+	ret = gpio_request(DA850_USB1_OC_PIN, "USB1 OC");
+	if (ret) {
+		printk(KERN_ERR "%s: failed to request GPIO for USB 1.1 port "
+			"over-current indicator: %d\n", __func__, ret);

pr_err() please.

arch/arm/mach-davinci/board-omapl138-hawk.c static struct davinci_mmc_config da850_mmc_config = { · line 283

Quoted 9 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +9 -0
+		return;
+	}
+	gpio_direction_input(DA850_USB1_OC_PIN);
+
+	ret = da8xx_register_usb11(&omapl138_hawk_usb11_pdata);
+	if (ret) {
+		pr_warning("%s: USB 1.1 registration failed: %d\n",
+			__func__, ret);
+		return;

'return' is useless here...

arch/arm/mach-davinci/board-omapl138-hawk.c static struct davinci_mmc_config da850_mmc_config = { · line 289

Quoted 6 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +3 -0
+	}
+}
+
  static struct davinci_uart_config omapl138_hawk_uart_config __initdata = {
  	.enabled_uarts = 0x7,
  };

WBR, Sergei

#23 lore raw

Re: [PATCH v4 9/9] davinci: USB1.1 support for Omapl138-Hawkboard

Quoted 144 lines · Sergei Shtylyov

Hello.

Quoted 5 lines · On 10/15/10 07:08, [email protected] wrote:

From: Victor Rodriguez<[email protected]>

This patch adds USB1.1 support for the Hawkboard-L138 system

[...]

Quoted 5 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +0 -0
index 87dea28..4658498 100644

[...]

arch/arm/mach-davinci/board-omapl138-hawk.c static struct davinci_mmc_config da850_mmc_config = · line 191

Quoted 13 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +7 -0
@@ -178,6 +181,109 @@ static struct davinci_mmc_config da850_mmc_config =
 {
        .version        = MMC_CTLR_VERSION_2,
  };
 
+static irqreturn_t omapl138_hawk_usb_ocic_irq(int irq, void *dev_id);
+static da8xx_ocic_handler_t hawk_usb_ocic_handler;
+
+static const short da850_hawk_usb11_pins[] = {
+       DA850_GPIO2_4, DA850_GPIO6_13,
+       -1
+};

  An empty wouldn't hurt here. Sorry if I overlooked this before...

Quoted 27 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +26 -0
+static int hawk_usb_set_power(unsigned port, int on)
+{
+       gpio_set_value(DA850_USB1_VBUS_PIN, on);
+       return 0;
+}
+
+static int hawk_usb_get_power(unsigned port)
+{
+       return gpio_get_value(DA850_USB1_VBUS_PIN);
+}
+
+static int hawk_usb_get_oci(unsigned port)
+{
+       return !gpio_get_value(DA850_USB1_OC_PIN);
+}
+
+static int hawk_usb_ocic_notify(da8xx_ocic_handler_t handler)
+{
+       int irq         = gpio_to_irq(DA850_USB1_OC_PIN);
+       int error       = 0;
+
+       if (handler != NULL) {
+               hawk_usb_ocic_handler = handler;
+
+               error = request_irq(irq, omapl138_hawk_usb_ocic_irq,
+                                       IRQF_DISABLED |

IRQF_TRIGGER_RISING |

Quoted 8 lines

+                                       IRQF_TRIGGER_FALLING,
+                                       "OHCI over-current indicator", NULL);
+               if (error)
+                       printk(KERN_ERR "%s: could not request IRQ to watch "
+                               "over-current indicator changes\n", __func__);

  pr_err() please.

Quoted 44 lines

+       } else
+               free_irq(irq, NULL);

arch/arm/mach-davinci/board-omapl138-hawk.c +42 -0
+
+       return error;
+}
+
+static struct da8xx_ohci_root_hub omapl138_hawk_usb11_pdata = {
+       .set_power      = hawk_usb_set_power,
+       .get_power      = hawk_usb_get_power,
+       .get_oci        = hawk_usb_get_oci,
+       .ocic_notify    = hawk_usb_ocic_notify,
+       /* TPS2087 switch @ 5V */
+       .potpgt         = (3 + 1) / 2,  /* 3 ms max */
+};
+
+static irqreturn_t omapl138_hawk_usb_ocic_irq(int irq, void *dev_id)
+{
+       hawk_usb_ocic_handler(&omapl138_hawk_usb11_pdata, 1);
+       return IRQ_HANDLED;
+}
+
+static __init void omapl138_hawk_usb_init(void)
+{
+       int ret;
+       u32 cfgchip2;
+
+       ret = davinci_cfg_reg_list(da850_hawk_usb11_pins);
+       if (ret) {
+               pr_warning("%s: USB 1.1 PinMux setup failed: %d\n",
+                       __func__, ret);
+               return;
+       }
+
+       /*
+        * Setup the Ref. clock frequency for the HAWK at 24 MHz.
+        */
+       cfgchip2 = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
+       cfgchip2 &= ~CFGCHIP2_REFFREQ;
+       cfgchip2 |=  CFGCHIP2_REFFREQ_24MHZ;
+       __raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
+
+       ret = gpio_request(DA850_USB1_VBUS_PIN, "USB1 VBUS\n");
+       if (ret) {
+               printk(KERN_ERR "%s: failed to request GPIO for USB 1.1
Quoted 2 lines

port "
+                       "power control: %d\n", __func__, ret);

  pr_err() please.

Quoted 9 lines

+               return;
+       }
+       gpio_direction_output(DA850_USB1_VBUS_PIN, 0);
+
+       ret = gpio_request(DA850_USB1_OC_PIN, "USB1 OC");
+       if (ret) {
+               printk(KERN_ERR "%s: failed to request GPIO for USB 1.1 port "
+                       "over-current indicator: %d\n", __func__, ret);

  pr_err() please.

Quoted 9 lines

+               return;
+       }
+       gpio_direction_input(DA850_USB1_OC_PIN);
+
+       ret = da8xx_register_usb11(&omapl138_hawk_usb11_pdata);
+       if (ret) {
+               pr_warning("%s: USB 1.1 registration failed: %d\n",
+                       __func__, ret);
+               return;

Quoted 1 line

  'return' is useless here...

Thanks for the feedback if I erase the return here I think I also have to erase the { ...} am I right ?

Regards

Victor Rodriguez

Quoted 10 lines
Quoted 7 lines

+       }

arch/arm/mach-davinci/board-omapl138-hawk.c +2 -0
+}
+

 static struct davinci_uart_config omapl138_hawk_uart_config __initdata = {
       .enabled_uarts = 0x7,
 };

WBR, Sergei

A message that is not in the archive (sent off-list or not yet received): 1287112105-11968-1-git-send-email-vm.rod25-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#25 lore raw

PATCH v4 1/9 davinci: EMAC support for Omapl138-Hawkboard

From: Victor Rodriguez <[email protected]>

This patch adds EMAC support for the Hawkboard-L138 system

---
 arch/arm/mach-davinci/board-omapl138-hawk.c |   50 +++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/board-omapl138-hawk.c +50 -0
index c472dd8..2220105 100644
@@ -19,6 +19,54 @@
 
 #include <mach/cp_intc.h>
 #include <mach/da8xx.h>
+#include <mach/mux.h>
+
+#define HAWKBOARD_PHY_ID		"0:07"
+
+static short omapl138_hawk_mii_pins[] __initdata = {
+	DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3,
+	DA850_MII_TXD_2, DA850_MII_TXD_1, DA850_MII_TXD_0, DA850_MII_RXER,
+	DA850_MII_CRS, DA850_MII_RXCLK, DA850_MII_RXDV, DA850_MII_RXD_3,
+	DA850_MII_RXD_2, DA850_MII_RXD_1, DA850_MII_RXD_0, DA850_MDIO_CLK,
+	DA850_MDIO_D,
+	-1
+};
+
+static __init void omapl138_hawk_config_emac(void)
+{
+	void __iomem *cfgchip3;
+	int ret;
+	u32 val;
+	struct davinci_soc_info *soc_info = &davinci_soc_info;
+
+	if (!machine_is_omapl138_hawkboard())
+		return;
+
+	cfgchip3 = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG);
+
+	val = __raw_readl(cfgchip3);
+
+	val &= ~BIT(8);
+	ret = davinci_cfg_reg_list(omapl138_hawk_mii_pins);
+	if (ret) {
+		pr_warning("%s: "
+			"cpgmac/mii mux setup failed: %d\n", __func__, ret);
+		return;
+	}
+
+	pr_info("EMAC: MII PHY configured\n");
+	/* configure the CFGCHIP3 register for MII */
+	__raw_writel(val, cfgchip3);
+
+	soc_info->emac_pdata->phy_id = HAWKBOARD_PHY_ID;
+
+	ret = da8xx_register_emac();
+	if (ret)
+		pr_warning("%s: "
+			"emac registration failed: %d\n", __func__, ret);
+		return;
+}
+
 
 static struct davinci_uart_config omapl138_hawk_uart_config __initdata = {
 	.enabled_uarts = 0x7,
@@ -30,6 +78,8 @@ static __init void omapl138_hawk_init(void)
 
 	davinci_serial_init(&omapl138_hawk_uart_config);
 
+	omapl138_hawk_config_emac();
+
 	ret = da8xx_register_watchdog();
 	if (ret)
 		pr_warning("omapl138_hawk_init: "
Signature · 1 line
1.6.0.5

A message that is not in the archive (sent off-list or not yet received): 1287112105-11968-2-git-send-email-vm.rod25-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#27 lore raw

Re: [PATCH v4 1/9] davinci: EMAC support for Omapl138-Hawkboard

Hello.

Quoted 43 lines · On 10/15/10 07:08, [email protected] wrote:

From: Victor Rodriguez<[email protected]>

This patch adds EMAC support for the Hawkboard-L138 system

---
  arch/arm/mach-davinci/board-omapl138-hawk.c |   50 +++++++++++++++++++++++++++
  1 files changed, 50 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/board-omapl138-hawk.c +26 -0
index c472dd8..2220105 100644
@@ -19,6 +19,54 @@
 
  #include<mach/cp_intc.h>
  #include<mach/da8xx.h>
+#include<mach/mux.h>
+
+#define HAWKBOARD_PHY_ID		"0:07"
+
+static short omapl138_hawk_mii_pins[] __initdata = {
+	DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3,
+	DA850_MII_TXD_2, DA850_MII_TXD_1, DA850_MII_TXD_0, DA850_MII_RXER,
+	DA850_MII_CRS, DA850_MII_RXCLK, DA850_MII_RXDV, DA850_MII_RXD_3,
+	DA850_MII_RXD_2, DA850_MII_RXD_1, DA850_MII_RXD_0, DA850_MDIO_CLK,
+	DA850_MDIO_D,
+	-1
+};
+
+static __init void omapl138_hawk_config_emac(void)
+{
+	void __iomem *cfgchip3;
+	int ret;
+	u32 val;
+	struct davinci_soc_info *soc_info =&davinci_soc_info;
+
+	if (!machine_is_omapl138_hawkboard())
+		return;
+
+	cfgchip3 = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG);
+
+	val = __raw_readl(cfgchip3);

arch/arm/mach-davinci/board-omapl138-hawk.c line 57

Quoted 10 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +10 -0
+
+	val&= ~BIT(8);
+	ret = davinci_cfg_reg_list(omapl138_hawk_mii_pins);
+	if (ret) {
+		pr_warning("%s: "
+			"cpgmac/mii mux setup failed: %d\n", __func__, ret);
+		return;
+	}
+
+	pr_info("EMAC: MII PHY configured\n");

I said this should *follow* __raw_writel(), not precede it...

arch/arm/mach-davinci/board-omapl138-hawk.c line 67

Quoted 10 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +10 -0
+	/* configure the CFGCHIP3 register for MII */
+	__raw_writel(val, cfgchip3);
+
+	soc_info->emac_pdata->phy_id = HAWKBOARD_PHY_ID;
+
+	ret = da8xx_register_emac();
+	if (ret)
+		pr_warning("%s: "
+			"emac registration failed: %d\n", __func__, ret);
+		return;

'return' not needed here. And you've forgotten to enclose it in {} anyway. :-)

WBR. Sergei

#28 lore raw

PATCH v4 4/9 davinci: McASP configuration for Omapl138-Hawkboard

In reply to a message not in the archive

From: Victor Rodriguez <[email protected]>

This patch defines Pin Mux configuration for MacASP used on the Hawkboard-L138 system in order to add Audio support

---
 arch/arm/mach-davinci/da850.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-davinci/da850.c +1 -1
index 63916b9..f033a0a 100644
@@ -591,7 +591,7 @@ const short da850_cpgmac_pins[] __initdata = {
 const short da850_mcasp_pins[] __initdata = {
 	DA850_AHCLKX, DA850_ACLKX, DA850_AFSX,
 	DA850_AHCLKR, DA850_ACLKR, DA850_AFSR, DA850_AMUTE,
-	DA850_AXR_11, DA850_AXR_12,
+	DA850_AXR_11, DA850_AXR_12, DA850_AXR_13, DA850_AXR_14,
 	-1
 };
 
Signature · 1 line
1.6.0.5