[Armadeus-commitlog] armadeus branch, master, updated. armadeus-5.0-18-g9241ec5
Brought to you by:
sszy
|
From: jorasse <jo...@us...> - 2012-09-12 14:43:30
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "armadeus".
The branch, master has been updated
via 9241ec594bd47eef3a89434874d776dddfd80348 (commit)
from 99d493523977febb00ea7d7f0e9c942eb17b4c2d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 9241ec594bd47eef3a89434874d776dddfd80348
Author: Eric Jarrige <eri...@ar...>
Date: Wed Sep 12 16:47:41 2012 +0200
[LINUX] APF28: Support kernel 2.6.35 USB OTG
-----------------------------------------------------------------------
Summary of changes:
...1-armadeus-add_apf28dev_baseboard_support.patch | 117 ++++++++++++++++-
.../452-armadeus-mxs-fixes_USB_freescale_bsp.patch | 141 +++++++++++---------
2 files changed, 192 insertions(+), 66 deletions(-)
diff --git a/patches/linux/2.6.35/451-armadeus-add_apf28dev_baseboard_support.patch b/patches/linux/2.6.35/451-armadeus-add_apf28dev_baseboard_support.patch
index fced9a8..c5c9cd0 100644
--- a/patches/linux/2.6.35/451-armadeus-add_apf28dev_baseboard_support.patch
+++ b/patches/linux/2.6.35/451-armadeus-add_apf28dev_baseboard_support.patch
@@ -1,6 +1,7 @@
Add APF28Dev support to Freescale's 2.6.35 BSP.
Signed-off-by: Julien Boibessot <jul...@ar...>
+Signed-off-by: Eric Jarrige <eri...@ar...>
Index: linux-2.6.35.3/arch/arm/mach-mx28/Kconfig
===================================================================
@@ -45,7 +46,7 @@ Index: linux-2.6.35.3/arch/arm/mach-mx28/apf28dev.c
===================================================================
--- /dev/null
+++ linux-2.6.35.3/arch/arm/mach-mx28/apf28dev.c
-@@ -0,0 +1,898 @@
+@@ -0,0 +1,1006 @@
+/*
+ * Copyright (C) 2012 Armadeus systems
+ *
@@ -74,6 +75,7 @@ Index: linux-2.6.35.3/arch/arm/mach-mx28/apf28dev.c
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/fec.h>
++#include <linux/fsl_devices.h>
+#include <linux/gpio_keys.h>
+#include <linux/input.h>
+#include <linux/leds.h>
@@ -86,6 +88,7 @@ Index: linux-2.6.35.3/arch/arm/mach-mx28/apf28dev.c
+#include <asm/mach/arch.h>
+
+#include <mach/apf28.h>
++#include <mach/arc_otg.h>
+#include <mach/device.h>
+#include <mach/dma.h>
+#include <mach/hardware.h>
@@ -95,7 +98,9 @@ Index: linux-2.6.35.3/arch/arm/mach-mx28/apf28dev.c
+
+#include "mx28_pins.h"
+#include "device.h"
++#include "usb.h"
+
++#define USB_POWER_ENABLE MXS_PIN_TO_GPIO(PINID_LCD_D23)
+
+static struct pin_desc apf28dev_fixed_pins[] = {
+ /* USB OTG VBus */
@@ -103,6 +108,9 @@ Index: linux-2.6.35.3/arch/arm/mach-mx28/apf28dev.c
+ .name = "USB_VBUS",
+ .id = PINID_LCD_D23,
+ .fun = PIN_GPIO,
++ .strength = PAD_8MA,
++ .voltage = PAD_3_3V,
++ .drive = 1,
+ .data = 0,
+ .output = 1,
+ },
@@ -110,9 +118,12 @@ Index: linux-2.6.35.3/arch/arm/mach-mx28/apf28dev.c
+ {
+ .name = "USB_ID",
+ .id = PINID_PWM2,
-+ .fun = PIN_GPIO,
-+ .data = 0,
-+ .output = 0,
++ .fun = PIN_FUN2,
++ .strength = PAD_8MA,
++ .voltage = PAD_3_3V,
++ .drive = 1,
++ .pull = 0,
++ .pullup = 0,
+ },
+#if defined(CONFIG_FB_MXS) || defined(CONFIG_FB_MXS_MODULE)
+ {
@@ -761,6 +772,89 @@ Index: linux-2.6.35.3/arch/arm/mach-mx28/apf28dev.c
+#endif
+};
+
++extern unsigned int vbus5v_gpio;
++static int otg_mode_host = -1;
++
++static int __init apf28_otg_mode(char *options)
++{
++ if (!strcmp(options, "host"))
++ otg_mode_host = 1;
++ else if (!strcmp(options, "device"))
++ otg_mode_host = 0;
++
++ return 0;
++}
++__setup("otg_mode=", apf28_otg_mode);
++
++extern int clk_get_usecount(struct clk *clk);
++static struct clk *usb_clk;
++static struct clk *usb_phy_clk;
++static int internal_phy_clk_already_on;
++
++static void apf28dev_usbotg_internal_phy_clock_gate(bool on)
++{
++ u32 tmp;
++ void __iomem *phy_reg = IO_ADDRESS(USBPHY0_PHYS_ADDR);
++ if (on) {
++ internal_phy_clk_already_on += 1;
++ if (internal_phy_clk_already_on == 1) {
++ pr_debug ("%s, Clock on UTMI \n", __func__);
++ tmp = BM_USBPHY_CTRL_SFTRST | BM_USBPHY_CTRL_CLKGATE;
++ __raw_writel(tmp, phy_reg + HW_USBPHY_CTRL_CLR);
++ }
++ } else {
++ internal_phy_clk_already_on -= 1;
++ if (internal_phy_clk_already_on == 0) {
++ pr_debug ("%s, Clock off UTMI \n", __func__);
++ tmp = BM_USBPHY_CTRL_CLKGATE;
++ __raw_writel(tmp, phy_reg + HW_USBPHY_CTRL_SET);
++ }
++ }
++ if (internal_phy_clk_already_on < 0)
++ printk(KERN_ERR "please check internal phy clock ON/OFF sequence \n");
++}
++
++
++static int apf28dev_usbotg_init_ext(struct platform_device *pdev)
++{
++ usb_clk = clk_get(NULL, "usb_clk0");
++ clk_enable(usb_clk);
++ clk_put(usb_clk);
++
++ usb_phy_clk = clk_get(NULL, "usb_phy_clk0");
++ clk_enable(usb_phy_clk);
++ clk_put(usb_phy_clk);
++
++ apf28dev_usbotg_internal_phy_clock_gate(true);
++ return usbotg_init(pdev);
++}
++
++static void apf28dev_usbotg_uninit_ext(struct fsl_usb2_platform_data *pdata)
++{
++ usbotg_uninit(pdata);
++
++ apf28dev_usbotg_internal_phy_clock_gate(false);
++ clk_disable(usb_phy_clk);
++ clk_disable(usb_clk);
++}
++
++static void apf28dev_usbotg_clock_gate(bool on)
++{
++ pr_debug("%s: on is %d\n", __func__, on);
++ if (on) {
++ /*clk_enable(usb_clk);
++ clk_enable(usb_phy_clk);
++ apf28dev_usbotg_internal_phy_clock_gate(on);*/
++ } else {
++ /*apf28dev_usbotg_internal_phy_clock_gate(on);
++ clk_disable(usb_phy_clk);
++ clk_disable(usb_clk);*/
++ }
++
++ pr_debug("usb_clk0_ref_count:%d, usb_phy_clk0_ref_count:%d\n", clk_get_usecount(usb_clk), clk_get_usecount(usb_phy_clk));
++}
++
++
+#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
+static struct gpio_keys_button apf28dev_gpio_keys[] = {
+ {
@@ -936,6 +1030,21 @@ Index: linux-2.6.35.3/arch/arm/mach-mx28/apf28dev.c
+
+void __init apf28_baseboard_devices_init(void)
+{
++ struct fsl_usb2_platform_data * dr_config = usb_dr_get_plateform_data();
++ dr_config->platform_init = apf28dev_usbotg_init_ext;
++ dr_config->platform_uninit = apf28dev_usbotg_uninit_ext;
++ dr_config->usb_clock_for_pm = apf28dev_usbotg_clock_gate;
++ if (otg_mode_host == 1){
++ gpio_direction_output(USB_POWER_ENABLE, 1);
++ gpio_set_value(USB_POWER_ENABLE, 1);
++ dr_config->vbus_gpio = 0;
++ } else if (otg_mode_host == 0){
++ gpio_direction_output(USB_POWER_ENABLE, 0);
++ gpio_set_value(USB_POWER_ENABLE, 0);
++ dr_config->vbus_gpio = 0;
++ } else dr_config->vbus_gpio = USB_POWER_ENABLE;
++ vbus5v_gpio = USB_POWER_ENABLE;
++
+ /* Add apf28dev special code */
+ platform_add_devices(apf28dev_platform_devices, ARRAY_SIZE(apf28dev_platform_devices));
+
diff --git a/patches/linux/2.6.35/452-armadeus-mxs-fixes_USB_freescale_bsp.patch b/patches/linux/2.6.35/452-armadeus-mxs-fixes_USB_freescale_bsp.patch
index dd696fc..d8ea709 100644
--- a/patches/linux/2.6.35/452-armadeus-mxs-fixes_USB_freescale_bsp.patch
+++ b/patches/linux/2.6.35/452-armadeus-mxs-fixes_USB_freescale_bsp.patch
@@ -1,96 +1,113 @@
-USB (i.MX28) fixes to Freescale's 2.6.35 BSP + USB OTG option to enforce mode
+USB (i.MX28) fixes to Freescale's 2.6.35 BSP USB OTG option
Signed-off-by: Julien Boibessot <jul...@ar...>
+Signed-off-by: Eric Jarrige <eri...@ar...>
Index: linux-2.6.35.3/arch/arm/mach-mx28/usb_dr.c
===================================================================
--- linux-2.6.35.3/arch/arm/mach-mx28/usb_dr.c
+++ linux-2.6.35.3/arch/arm/mach-mx28/usb_dr.c
-@@ -29,7 +29,13 @@
- #include <mach/arc_otg.h>
- #include "usb.h"
- #include "mx28_pins.h"
-+#if defined(CONFIG_MACH_MX28EVK)
- #define USB_POWER_ENABLE MXS_PIN_TO_GPIO(PINID_AUART2_TX)
-+#define USB_OTG_ID MXS_PIN_TO_GPIO(PINID_AUART2_TX)
-+#else
-+#define USB_POWER_ENABLE MXS_PIN_TO_GPIO(PINID_LCD_D23)
-+#define USB_OTG_ID MXS_PIN_TO_GPIO(PINID_PWM2)
-+#endif
-
- #ifdef CONFIG_WORKAROUND_ARCUSB_REG_RW
- static void fsl_safe_writel(u32 val32, volatile u32 *addr)
-@@ -40,6 +46,7 @@ static void fsl_safe_writel(u32 val32, v
- extern int clk_get_usecount(struct clk *clk);
- static struct clk *usb_clk;
- static struct clk *usb_phy_clk;
-+static int otg_mode_host = -1;
-
- void fsl_phy_usb_utmi_init(struct fsl_xcvr_ops *this)
- {
-@@ -58,11 +65,19 @@ void fsl_phy_usb_utmi_uninit(struct fsl_
+@@ -58,11 +58,11 @@ void fsl_phy_usb_utmi_uninit(struct fsl_
void fsl_phy_set_power(struct fsl_xcvr_ops *this,
struct fsl_usb2_platform_data *pdata, int on)
{
- /* USB_POWER_ENABLE_PIN have request at pin init*/
- if (pdata->phy_regs != USBPHY1_PHYS_ADDR) {
-- pr_debug("%s: on is %d\n", __func__, on);
++ /* pdata->vbus_gpio have request at pin init*/
++ if (pdata->vbus_gpio) {
+ pr_debug("%s: on is %d\n", __func__, on);
- gpio_direction_output(USB_POWER_ENABLE, on);
- gpio_set_value(USB_POWER_ENABLE, on);
-+ if (otg_mode_host == 1){
-+ gpio_direction_output(USB_POWER_ENABLE, 1);
-+ gpio_set_value(USB_POWER_ENABLE, 1);
-+ } else if (otg_mode_host == 0){
-+ gpio_direction_output(USB_POWER_ENABLE, 0);
-+ gpio_set_value(USB_POWER_ENABLE, 0);
-+ } else {
-+ /* USB_POWER_ENABLE_PIN have request at pin init*/
-+ if (pdata->phy_regs != USBPHY1_PHYS_ADDR) {
-+ pr_debug("%s: on is %d\n", __func__, on);
-+ gpio_direction_output(USB_POWER_ENABLE, on);
-+ gpio_set_value(USB_POWER_ENABLE, on);
-+ }
++ gpio_direction_output(pdata->vbus_gpio, on);
++ gpio_set_value(pdata->vbus_gpio, on);
}
}
-@@ -363,6 +378,7 @@ static struct fsl_usb2_platform_data __m
+@@ -363,6 +363,7 @@ static struct fsl_usb2_platform_data __m
.platform_resume = usb_host_phy_resume,
.transceiver = "utmi",
.phy_regs = USBPHY0_PHYS_ADDR,
-+ .id_gpio = USB_OTG_ID,
++ .vbus_gpio = USB_POWER_ENABLE,
};
/*
-@@ -457,6 +473,18 @@ static struct fsl_usb2_wakeup_platform_d
+@@ -457,6 +458,11 @@ static struct fsl_usb2_wakeup_platform_d
.usb_clock_for_pm = usbotg_clock_gate,
};
-+static int __init apf28_otg_mode(char *options)
++struct fsl_usb2_platform_data * __init usb_dr_get_plateform_data(void)
+{
-+ if (!strcmp(options, "host"))
-+ otg_mode_host = 1;
-+ else if (!strcmp(options, "device"))
-+ otg_mode_host = 0;
-+
-+ return 0;
++ return &dr_utmi_config;
+}
-+__setup("otg_mode=", apf28_otg_mode);
-+
+
static int __init usb_dr_init(void)
{
struct platform_device *pdev;
-@@ -472,6 +500,13 @@ static int __init usb_dr_init(void)
- dr_utmi_config.irq_delay = 0;
- dr_utmi_config.wakeup_pdata = &usbdr_wakeup_config;
+Index: linux-2.6.35.3/arch/arm/mach-mx28/usb.h
+===================================================================
+--- linux-2.6.35.3/arch/arm/mach-mx28/usb.h
++++ linux-2.6.35.3/arch/arm/mach-mx28/usb.h
+@@ -31,6 +31,8 @@ extern void fsl_usb_host_uninit(struct f
+ extern int gpio_usbh2_active(void);
+ extern void gpio_usbh2_inactive(void);
-+ if (otg_mode_host == 1) { /*mode defined by bootloader options*/
-+ printk("OTG mode forced to HOST\n");
-+ dr_utmi_config.id_gpio = 0; /* do not manage the ID pin */
-+ gpio_direction_output(USB_POWER_ENABLE, 1);
-+ gpio_set_value(USB_POWER_ENABLE, 1);
-+ }
++extern struct fsl_usb2_platform_data * __init usb_dr_get_plateform_data(void);
+
- if (platform_device_register(&dr_otg_device))
- printk(KERN_ERR "usb DR: can't register otg device\n");
- else {
+ /*
+ * Determine which platform_data struct to use for the DR controller,
+ * based on which transceiver is configured.
+Index: linux-2.6.35.3/include/linux/fsl_devices.h
+===================================================================
+--- linux-2.6.35.3/include/linux/fsl_devices.h
++++ linux-2.6.35.3/include/linux/fsl_devices.h
+@@ -109,6 +109,7 @@ struct fsl_usb2_platform_data {
+ struct fsl_usb2_wakeup_platform_data *wakeup_pdata;
+
+ u32 id_gpio;
++ u32 vbus_gpio;
+ /* register save area for suspend/resume */
+ u32 pm_command;
+ u32 pm_status;
+--- linux-2.6.35.3/arch/arm/mach-mx28/power.c
++++ linux-2.6.35.3/arch/arm/mach-mx28/power.c
+@@ -32,6 +32,7 @@
+ #include <mach/regs-power.h>
+
+ #define USB_POWER_ENABLE MXS_PIN_TO_GPIO(PINID_AUART2_TX)
++unsigned int vbus5v_gpio = USB_POWER_ENABLE;
+ #define MX28EVK_VBUS5v 5
+
+ static int get_voltage(struct mxs_regulator *sreg)
+@@ -315,19 +316,19 @@ static struct regulator_init_data vddio_
+
+ static int vbus5v_enable(struct mxs_regulator *sreg)
+ {
+- gpio_set_value(USB_POWER_ENABLE, 1);
++ gpio_set_value(vbus5v_gpio, 1);
+ return 0;
+ }
+
+ static int vbus5v_disable(struct mxs_regulator *sreg)
+ {
+- gpio_set_value(USB_POWER_ENABLE, 0);
++ gpio_set_value(vbus5v_gpio, 0);
+ return 0;
+ }
+
+ static int vbus5v_is_enabled(struct mxs_regulator *sreg)
+ {
+- return gpio_get_value(USB_POWER_ENABLE);
++ return gpio_get_value(vbus5v_gpio);
+ }
+
+
+@@ -576,7 +577,7 @@ static int __init regulators_init(void)
+ mxs_platform_add_regulator("charger", 1);
+ mxs_platform_add_regulator("power-test", 1);
+ mxs_platform_add_regulator("cpufreq", 1);
+- gpio_direction_output(USB_POWER_ENABLE, 0);
++ gpio_direction_output(vbus5v_gpio, 0);
+ return 0;
+ }
+ postcore_initcall(regulators_init);
+
hooks/post-receive
--
armadeus
|