2010-02-25 19:37:43 +00:00
|
|
|
/* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 and
|
|
|
|
* only version 2 as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
|
* 02110-1301, USA.
|
|
|
|
*/
|
2011-07-26 09:53:52 +00:00
|
|
|
#include <linux/gpio.h>
|
2010-02-25 19:37:43 +00:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/irq.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/smsc911x.h>
|
2010-12-08 08:07:08 +00:00
|
|
|
#include <linux/usb/msm_hsusb.h>
|
2011-02-23 17:37:42 +00:00
|
|
|
#include <linux/clkdev.h>
|
2011-08-11 23:14:28 +00:00
|
|
|
#include <linux/memblock.h>
|
2010-02-25 19:37:43 +00:00
|
|
|
|
|
|
|
#include <asm/mach-types.h>
|
|
|
|
#include <asm/mach/arch.h>
|
2011-01-04 18:07:14 +00:00
|
|
|
#include <asm/memory.h>
|
2010-02-25 19:37:43 +00:00
|
|
|
#include <asm/setup.h>
|
|
|
|
|
2013-12-30 21:15:27 +00:00
|
|
|
#include <mach/clk.h>
|
2010-02-25 19:37:43 +00:00
|
|
|
#include <mach/msm_iomap.h>
|
|
|
|
#include <mach/dma.h>
|
|
|
|
|
|
|
|
#include <mach/vreg.h>
|
|
|
|
#include "devices.h"
|
2011-01-10 19:00:30 +00:00
|
|
|
#include "gpiomux.h"
|
2010-05-12 21:24:15 +00:00
|
|
|
#include "proc_comm.h"
|
2012-09-05 19:28:52 +00:00
|
|
|
#include "common.h"
|
2010-02-25 19:37:43 +00:00
|
|
|
|
2014-04-13 21:54:58 +00:00
|
|
|
static void __init msm7x30_fixup(struct tag *tag, char **cmdline)
|
2011-08-11 23:14:28 +00:00
|
|
|
{
|
|
|
|
for (; tag->hdr.size; tag = tag_next(tag))
|
|
|
|
if (tag->hdr.tag == ATAG_MEM && tag->u.mem.start == 0x200000) {
|
|
|
|
tag->u.mem.start = 0;
|
|
|
|
tag->u.mem.size += SZ_2M;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __init msm7x30_reserve(void)
|
|
|
|
{
|
|
|
|
memblock_remove(0x0, SZ_2M);
|
|
|
|
}
|
|
|
|
|
2010-12-08 08:07:08 +00:00
|
|
|
static int hsusb_phy_init_seq[] = {
|
|
|
|
0x30, 0x32, /* Enable and set Pre-Emphasis Depth to 20% */
|
|
|
|
0x02, 0x36, /* Disable CDR Auto Reset feature */
|
|
|
|
-1
|
|
|
|
};
|
|
|
|
|
2013-12-30 21:15:27 +00:00
|
|
|
static int hsusb_link_clk_reset(struct clk *link_clk, bool assert)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (assert) {
|
|
|
|
ret = clk_reset(link_clk, CLK_RESET_ASSERT);
|
|
|
|
if (ret)
|
|
|
|
pr_err("usb hs_clk assert failed\n");
|
|
|
|
} else {
|
|
|
|
ret = clk_reset(link_clk, CLK_RESET_DEASSERT);
|
|
|
|
if (ret)
|
|
|
|
pr_err("usb hs_clk deassert failed\n");
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int hsusb_phy_clk_reset(struct clk *phy_clk)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = clk_reset(phy_clk, CLK_RESET_ASSERT);
|
|
|
|
if (ret) {
|
|
|
|
pr_err("usb phy clk assert failed\n");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
usleep_range(10000, 12000);
|
|
|
|
ret = clk_reset(phy_clk, CLK_RESET_DEASSERT);
|
|
|
|
if (ret)
|
|
|
|
pr_err("usb phy clk deassert failed\n");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-12-08 08:07:08 +00:00
|
|
|
static struct msm_otg_platform_data msm_otg_pdata = {
|
|
|
|
.phy_init_seq = hsusb_phy_init_seq,
|
2014-04-28 13:34:11 +00:00
|
|
|
.mode = USB_DR_MODE_PERIPHERAL,
|
2010-12-08 08:07:08 +00:00
|
|
|
.otg_control = OTG_PHY_CONTROL,
|
2013-12-30 21:15:27 +00:00
|
|
|
.link_clk_reset = hsusb_link_clk_reset,
|
|
|
|
.phy_clk_reset = hsusb_phy_clk_reset,
|
2010-12-08 08:07:08 +00:00
|
|
|
};
|
|
|
|
|
2011-01-10 19:00:30 +00:00
|
|
|
struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
|
|
|
|
#ifdef CONFIG_SERIAL_MSM_CONSOLE
|
|
|
|
[49] = { /* UART2 RFR */
|
|
|
|
.suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN |
|
|
|
|
GPIOMUX_FUNC_2 | GPIOMUX_VALID,
|
|
|
|
},
|
|
|
|
[50] = { /* UART2 CTS */
|
|
|
|
.suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN |
|
|
|
|
GPIOMUX_FUNC_2 | GPIOMUX_VALID,
|
|
|
|
},
|
|
|
|
[51] = { /* UART2 RX */
|
|
|
|
.suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN |
|
|
|
|
GPIOMUX_FUNC_2 | GPIOMUX_VALID,
|
|
|
|
},
|
|
|
|
[52] = { /* UART2 TX */
|
|
|
|
.suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN |
|
|
|
|
GPIOMUX_FUNC_2 | GPIOMUX_VALID,
|
|
|
|
},
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2010-02-25 19:37:43 +00:00
|
|
|
static struct platform_device *devices[] __initdata = {
|
2013-06-17 17:43:18 +00:00
|
|
|
&msm_clock_7x30,
|
2013-03-04 23:08:27 +00:00
|
|
|
&msm_device_gpio_7x30,
|
2010-05-12 21:24:15 +00:00
|
|
|
#if defined(CONFIG_SERIAL_MSM) || defined(CONFIG_MSM_SERIAL_DEBUGGER)
|
|
|
|
&msm_device_uart2,
|
|
|
|
#endif
|
2010-10-06 20:52:10 +00:00
|
|
|
&msm_device_smd,
|
2010-12-08 08:07:08 +00:00
|
|
|
&msm_device_otg,
|
|
|
|
&msm_device_hsusb,
|
|
|
|
&msm_device_hsusb_host,
|
2010-02-25 19:37:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void __init msm7x30_init_irq(void)
|
|
|
|
{
|
|
|
|
msm_init_irq();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __init msm7x30_init(void)
|
|
|
|
{
|
2010-12-08 08:07:08 +00:00
|
|
|
msm_device_otg.dev.platform_data = &msm_otg_pdata;
|
|
|
|
msm_device_hsusb.dev.parent = &msm_device_otg.dev;
|
|
|
|
msm_device_hsusb_host.dev.parent = &msm_device_otg.dev;
|
|
|
|
|
2010-02-25 19:37:43 +00:00
|
|
|
platform_add_devices(devices, ARRAY_SIZE(devices));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __init msm7x30_map_io(void)
|
|
|
|
{
|
|
|
|
msm_map_msm7x30_io();
|
|
|
|
}
|
|
|
|
|
2012-05-02 07:53:20 +00:00
|
|
|
static void __init msm7x30_init_late(void)
|
|
|
|
{
|
|
|
|
smd_debugfs_init();
|
|
|
|
}
|
|
|
|
|
2010-02-25 19:37:43 +00:00
|
|
|
MACHINE_START(MSM7X30_SURF, "QCT MSM7X30 SURF")
|
2011-07-06 02:38:14 +00:00
|
|
|
.atag_offset = 0x100,
|
2011-08-11 23:14:28 +00:00
|
|
|
.fixup = msm7x30_fixup,
|
|
|
|
.reserve = msm7x30_reserve,
|
2010-02-25 19:37:43 +00:00
|
|
|
.map_io = msm7x30_map_io,
|
|
|
|
.init_irq = msm7x30_init_irq,
|
|
|
|
.init_machine = msm7x30_init,
|
2012-05-02 07:53:20 +00:00
|
|
|
.init_late = msm7x30_init_late,
|
2012-11-08 19:40:59 +00:00
|
|
|
.init_time = msm7x30_timer_init,
|
2010-02-25 19:37:43 +00:00
|
|
|
MACHINE_END
|
|
|
|
|
|
|
|
MACHINE_START(MSM7X30_FFA, "QCT MSM7X30 FFA")
|
2011-07-06 02:38:14 +00:00
|
|
|
.atag_offset = 0x100,
|
2011-08-11 23:14:28 +00:00
|
|
|
.fixup = msm7x30_fixup,
|
|
|
|
.reserve = msm7x30_reserve,
|
2010-02-25 19:37:43 +00:00
|
|
|
.map_io = msm7x30_map_io,
|
|
|
|
.init_irq = msm7x30_init_irq,
|
|
|
|
.init_machine = msm7x30_init,
|
2012-05-02 07:53:20 +00:00
|
|
|
.init_late = msm7x30_init_late,
|
2012-11-08 19:40:59 +00:00
|
|
|
.init_time = msm7x30_timer_init,
|
2010-02-25 19:37:43 +00:00
|
|
|
MACHINE_END
|
|
|
|
|
|
|
|
MACHINE_START(MSM7X30_FLUID, "QCT MSM7X30 FLUID")
|
2011-07-06 02:38:14 +00:00
|
|
|
.atag_offset = 0x100,
|
2011-08-11 23:14:28 +00:00
|
|
|
.fixup = msm7x30_fixup,
|
|
|
|
.reserve = msm7x30_reserve,
|
2010-02-25 19:37:43 +00:00
|
|
|
.map_io = msm7x30_map_io,
|
|
|
|
.init_irq = msm7x30_init_irq,
|
|
|
|
.init_machine = msm7x30_init,
|
2012-05-02 07:53:20 +00:00
|
|
|
.init_late = msm7x30_init_late,
|
2012-11-08 19:40:59 +00:00
|
|
|
.init_time = msm7x30_timer_init,
|
2010-02-25 19:37:43 +00:00
|
|
|
MACHINE_END
|