2007-07-09 15:06:53 -06:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2000 Deep Blue Solutions Ltd
|
|
|
|
* Copyright (C) 2002 Shane Nay (shane@minirl.com)
|
|
|
|
* Copyright 2005-2007 Freescale Semiconductor, Inc. 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 as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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/types.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/clk.h>
|
|
|
|
#include <linux/serial_8250.h>
|
2009-01-15 09:14:30 -07:00
|
|
|
#include <linux/gpio.h>
|
|
|
|
#include <linux/i2c.h>
|
2008-09-09 02:19:42 -06:00
|
|
|
#include <linux/irq.h>
|
2012-06-13 03:07:25 -06:00
|
|
|
#include <linux/irqdomain.h>
|
2007-07-09 15:06:53 -06:00
|
|
|
|
|
|
|
#include <asm/mach-types.h>
|
|
|
|
#include <asm/mach/arch.h>
|
2008-07-05 02:02:50 -06:00
|
|
|
#include <asm/mach/time.h>
|
2007-07-09 15:06:53 -06:00
|
|
|
#include <asm/memory.h>
|
|
|
|
#include <asm/mach/map.h>
|
|
|
|
|
2009-01-15 09:14:30 -07:00
|
|
|
#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1
|
|
|
|
#include <linux/mfd/wm8350/audio.h>
|
|
|
|
#include <linux/mfd/wm8350/core.h>
|
|
|
|
#include <linux/mfd/wm8350/pmic.h>
|
|
|
|
#endif
|
|
|
|
|
2012-09-13 07:01:00 -06:00
|
|
|
#include "common.h"
|
2010-06-16 10:03:05 -06:00
|
|
|
#include "devices-imx31.h"
|
2012-09-14 00:14:45 -06:00
|
|
|
#include "hardware.h"
|
2012-09-12 23:26:00 -06:00
|
|
|
#include "iomux-mx3.h"
|
2008-10-17 08:10:38 -06:00
|
|
|
|
2012-01-26 13:47:27 -07:00
|
|
|
/* Base address of PBC controller */
|
|
|
|
#define PBC_BASE_ADDRESS MX31_CS4_BASE_ADDR_VIRT
|
|
|
|
|
2010-03-08 09:10:54 -07:00
|
|
|
/* PBC Board interrupt status register */
|
|
|
|
#define PBC_INTSTATUS 0x000016
|
|
|
|
|
|
|
|
/* PBC Board interrupt current status register */
|
|
|
|
#define PBC_INTCURR_STATUS 0x000018
|
|
|
|
|
|
|
|
/* PBC Interrupt mask register set address */
|
|
|
|
#define PBC_INTMASK_SET 0x00001A
|
|
|
|
|
|
|
|
/* PBC Interrupt mask register clear address */
|
|
|
|
#define PBC_INTMASK_CLEAR 0x00001C
|
|
|
|
|
|
|
|
/* External UART A */
|
|
|
|
#define PBC_SC16C652_UARTA 0x010000
|
|
|
|
|
|
|
|
/* External UART B */
|
|
|
|
#define PBC_SC16C652_UARTB 0x010010
|
|
|
|
|
|
|
|
#define PBC_INTSTATUS_REG (PBC_INTSTATUS + PBC_BASE_ADDRESS)
|
|
|
|
#define PBC_INTMASK_SET_REG (PBC_INTMASK_SET + PBC_BASE_ADDRESS)
|
|
|
|
#define PBC_INTMASK_CLEAR_REG (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS)
|
|
|
|
|
2012-06-13 03:07:25 -06:00
|
|
|
#define EXPIO_INT_XUART_INTA 10
|
|
|
|
#define EXPIO_INT_XUART_INTB 11
|
2010-03-08 09:10:54 -07:00
|
|
|
|
|
|
|
#define MXC_MAX_EXP_IO_LINES 16
|
2007-07-09 15:06:53 -06:00
|
|
|
|
2012-01-26 13:47:27 -07:00
|
|
|
/* CS8900 */
|
2012-06-13 03:07:25 -06:00
|
|
|
#define EXPIO_INT_ENET_INT 8
|
2012-01-26 13:47:27 -07:00
|
|
|
#define CS4_CS8900_MMIO_START 0x20000
|
|
|
|
|
2012-06-13 03:07:25 -06:00
|
|
|
static struct irq_domain *domain;
|
|
|
|
|
2011-01-14 03:22:31 -07:00
|
|
|
/*
|
2007-07-09 15:06:53 -06:00
|
|
|
* The serial port definition structure.
|
|
|
|
*/
|
|
|
|
static struct plat_serial8250_port serial_platform_data[] = {
|
|
|
|
{
|
|
|
|
.membase = (void *)(PBC_BASE_ADDRESS + PBC_SC16C652_UARTA),
|
2009-12-09 03:57:21 -07:00
|
|
|
.mapbase = (unsigned long)(MX31_CS4_BASE_ADDR + PBC_SC16C652_UARTA),
|
2007-07-09 15:06:53 -06:00
|
|
|
.uartclk = 14745600,
|
|
|
|
.regshift = 0,
|
|
|
|
.iotype = UPIO_MEM,
|
|
|
|
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ,
|
|
|
|
}, {
|
|
|
|
.membase = (void *)(PBC_BASE_ADDRESS + PBC_SC16C652_UARTB),
|
2009-12-09 03:57:21 -07:00
|
|
|
.mapbase = (unsigned long)(MX31_CS4_BASE_ADDR + PBC_SC16C652_UARTB),
|
2007-07-09 15:06:53 -06:00
|
|
|
.uartclk = 14745600,
|
|
|
|
.regshift = 0,
|
|
|
|
.iotype = UPIO_MEM,
|
|
|
|
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ,
|
|
|
|
},
|
|
|
|
{},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device serial_device = {
|
|
|
|
.name = "serial8250",
|
|
|
|
.id = 0,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = serial_platform_data,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2012-06-13 03:07:25 -06:00
|
|
|
static struct resource mx31ads_cs8900_resources[] __initdata = {
|
2012-01-26 13:47:27 -07:00
|
|
|
DEFINE_RES_MEM(MX31_CS4_BASE_ADDR + CS4_CS8900_MMIO_START, SZ_64K),
|
2012-06-13 03:07:25 -06:00
|
|
|
DEFINE_RES_IRQ(-1),
|
2012-01-26 13:47:27 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct platform_device_info mx31ads_cs8900_devinfo __initconst = {
|
|
|
|
.name = "cs89x0",
|
|
|
|
.id = 0,
|
|
|
|
.res = mx31ads_cs8900_resources,
|
|
|
|
.num_res = ARRAY_SIZE(mx31ads_cs8900_resources),
|
|
|
|
};
|
|
|
|
|
2007-07-09 15:06:53 -06:00
|
|
|
static int __init mxc_init_extuart(void)
|
|
|
|
{
|
2012-06-13 03:07:25 -06:00
|
|
|
serial_platform_data[0].irq = irq_find_mapping(domain,
|
|
|
|
EXPIO_INT_XUART_INTA);
|
|
|
|
serial_platform_data[1].irq = irq_find_mapping(domain,
|
|
|
|
EXPIO_INT_XUART_INTB);
|
2007-07-09 15:06:53 -06:00
|
|
|
return platform_device_register(&serial_device);
|
|
|
|
}
|
|
|
|
|
2012-01-26 13:47:27 -07:00
|
|
|
static void __init mxc_init_ext_ethernet(void)
|
|
|
|
{
|
2012-06-13 03:07:25 -06:00
|
|
|
mx31ads_cs8900_resources[1].start =
|
|
|
|
irq_find_mapping(domain, EXPIO_INT_ENET_INT);
|
|
|
|
mx31ads_cs8900_resources[1].end =
|
|
|
|
irq_find_mapping(domain, EXPIO_INT_ENET_INT);
|
2012-01-26 13:47:27 -07:00
|
|
|
platform_device_register_full(
|
|
|
|
(struct platform_device_info *)&mx31ads_cs8900_devinfo);
|
|
|
|
}
|
|
|
|
|
2010-06-23 03:46:16 -06:00
|
|
|
static const struct imxuart_platform_data uart_pdata __initconst = {
|
2008-09-09 02:19:41 -06:00
|
|
|
.flags = IMXUART_HAVE_RTSCTS,
|
|
|
|
};
|
|
|
|
|
2009-04-13 06:02:36 -06:00
|
|
|
static unsigned int uart_pins[] = {
|
2009-01-28 07:13:52 -07:00
|
|
|
MX31_PIN_CTS1__CTS1,
|
|
|
|
MX31_PIN_RTS1__RTS1,
|
|
|
|
MX31_PIN_TXD1__TXD1,
|
|
|
|
MX31_PIN_RXD1__RXD1
|
|
|
|
};
|
|
|
|
|
2008-09-09 02:19:41 -06:00
|
|
|
static inline void mxc_init_imx_uart(void)
|
|
|
|
{
|
2009-01-28 07:13:52 -07:00
|
|
|
mxc_iomux_setup_multiple_pins(uart_pins, ARRAY_SIZE(uart_pins), "uart-0");
|
2010-06-23 03:46:16 -06:00
|
|
|
imx31_add_imx_uart0(&uart_pdata);
|
2008-09-09 02:19:41 -06:00
|
|
|
}
|
|
|
|
|
2008-09-09 02:19:42 -06:00
|
|
|
static void mx31ads_expio_irq_handler(u32 irq, struct irq_desc *desc)
|
|
|
|
{
|
|
|
|
u32 imr_val;
|
|
|
|
u32 int_valid;
|
|
|
|
u32 expio_irq;
|
|
|
|
|
|
|
|
imr_val = __raw_readw(PBC_INTMASK_SET_REG);
|
|
|
|
int_valid = __raw_readw(PBC_INTSTATUS_REG) & imr_val;
|
|
|
|
|
2012-06-13 03:07:25 -06:00
|
|
|
expio_irq = 0;
|
2008-09-09 02:19:42 -06:00
|
|
|
for (; int_valid != 0; int_valid >>= 1, expio_irq++) {
|
|
|
|
if ((int_valid & 1) == 0)
|
|
|
|
continue;
|
|
|
|
|
2012-06-13 03:07:25 -06:00
|
|
|
generic_handle_irq(irq_find_mapping(domain, expio_irq));
|
2008-09-09 02:19:42 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Disable an expio pin's interrupt by setting the bit in the imr.
|
2011-02-11 02:21:09 -07:00
|
|
|
* @param d an expio virtual irq description
|
2008-09-09 02:19:42 -06:00
|
|
|
*/
|
2010-11-29 02:37:55 -07:00
|
|
|
static void expio_mask_irq(struct irq_data *d)
|
2008-09-09 02:19:42 -06:00
|
|
|
{
|
2012-06-13 03:07:25 -06:00
|
|
|
u32 expio = d->hwirq;
|
2008-09-09 02:19:42 -06:00
|
|
|
/* mask the interrupt */
|
|
|
|
__raw_writew(1 << expio, PBC_INTMASK_CLEAR_REG);
|
|
|
|
__raw_readw(PBC_INTMASK_CLEAR_REG);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Acknowledge an expanded io pin's interrupt by clearing the bit in the isr.
|
2011-02-11 02:21:09 -07:00
|
|
|
* @param d an expio virtual irq description
|
2008-09-09 02:19:42 -06:00
|
|
|
*/
|
2010-11-29 02:37:55 -07:00
|
|
|
static void expio_ack_irq(struct irq_data *d)
|
2008-09-09 02:19:42 -06:00
|
|
|
{
|
2012-06-13 03:07:25 -06:00
|
|
|
u32 expio = d->hwirq;
|
2008-09-09 02:19:42 -06:00
|
|
|
/* clear the interrupt status */
|
|
|
|
__raw_writew(1 << expio, PBC_INTSTATUS_REG);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Enable a expio pin's interrupt by clearing the bit in the imr.
|
2011-02-11 02:21:09 -07:00
|
|
|
* @param d an expio virtual irq description
|
2008-09-09 02:19:42 -06:00
|
|
|
*/
|
2010-11-29 02:37:55 -07:00
|
|
|
static void expio_unmask_irq(struct irq_data *d)
|
2008-09-09 02:19:42 -06:00
|
|
|
{
|
2012-06-13 03:07:25 -06:00
|
|
|
u32 expio = d->hwirq;
|
2008-09-09 02:19:42 -06:00
|
|
|
/* unmask the interrupt */
|
|
|
|
__raw_writew(1 << expio, PBC_INTMASK_SET_REG);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct irq_chip expio_irq_chip = {
|
2010-01-05 09:05:15 -07:00
|
|
|
.name = "EXPIO(CPLD)",
|
2010-11-29 02:37:55 -07:00
|
|
|
.irq_ack = expio_ack_irq,
|
|
|
|
.irq_mask = expio_mask_irq,
|
|
|
|
.irq_unmask = expio_unmask_irq,
|
2008-09-09 02:19:42 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
static void __init mx31ads_init_expio(void)
|
|
|
|
{
|
2012-06-13 03:07:25 -06:00
|
|
|
int irq_base;
|
2011-12-02 05:00:33 -07:00
|
|
|
int i, irq;
|
2008-09-09 02:19:42 -06:00
|
|
|
|
|
|
|
printk(KERN_INFO "MX31ADS EXPIO(CPLD) hardware\n");
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Configure INT line as GPIO input
|
|
|
|
*/
|
2009-05-06 04:55:50 -06:00
|
|
|
mxc_iomux_alloc_pin(IOMUX_MODE(MX31_PIN_GPIO1_4, IOMUX_CONFIG_GPIO), "expio");
|
2008-09-09 02:19:42 -06:00
|
|
|
|
|
|
|
/* disable the interrupt and clear the status */
|
|
|
|
__raw_writew(0xFFFF, PBC_INTMASK_CLEAR_REG);
|
|
|
|
__raw_writew(0xFFFF, PBC_INTSTATUS_REG);
|
2012-06-13 03:07:25 -06:00
|
|
|
|
|
|
|
irq_base = irq_alloc_descs(-1, 0, MXC_MAX_EXP_IO_LINES, numa_node_id());
|
|
|
|
WARN_ON(irq_base < 0);
|
|
|
|
|
|
|
|
domain = irq_domain_add_legacy(NULL, MXC_MAX_EXP_IO_LINES, irq_base, 0,
|
|
|
|
&irq_domain_simple_ops, NULL);
|
|
|
|
WARN_ON(!domain);
|
|
|
|
|
|
|
|
for (i = irq_base; i < irq_base + MXC_MAX_EXP_IO_LINES; i++) {
|
2011-03-24 06:35:09 -06:00
|
|
|
irq_set_chip_and_handler(i, &expio_irq_chip, handle_level_irq);
|
2008-09-09 02:19:42 -06:00
|
|
|
set_irq_flags(i, IRQF_VALID);
|
|
|
|
}
|
2011-12-02 05:00:33 -07:00
|
|
|
irq = gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_4));
|
|
|
|
irq_set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH);
|
|
|
|
irq_set_chained_handler(irq, mx31ads_expio_irq_handler);
|
2008-09-09 02:19:42 -06:00
|
|
|
}
|
|
|
|
|
2009-01-15 09:14:30 -07:00
|
|
|
#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1
|
|
|
|
/* This section defines setup for the Wolfson Microelectronics
|
|
|
|
* 1133-EV1 PMU/audio board. When other PMU boards are supported the
|
|
|
|
* regulator definitions may be shared with them, but for now they can
|
|
|
|
* only be used with this board so would generate warnings about
|
|
|
|
* unused statics and some of the configuration is specific to this
|
|
|
|
* module.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* CPU */
|
|
|
|
static struct regulator_consumer_supply sw1a_consumers[] = {
|
|
|
|
{
|
|
|
|
.supply = "cpu_vcc",
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_init_data sw1a_data = {
|
|
|
|
.constraints = {
|
|
|
|
.name = "SW1A",
|
|
|
|
.min_uV = 1275000,
|
|
|
|
.max_uV = 1600000,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
|
|
|
|
REGULATOR_CHANGE_MODE,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL |
|
|
|
|
REGULATOR_MODE_FAST,
|
|
|
|
.state_mem = {
|
|
|
|
.uV = 1400000,
|
|
|
|
.mode = REGULATOR_MODE_NORMAL,
|
|
|
|
.enabled = 1,
|
|
|
|
},
|
|
|
|
.initial_state = PM_SUSPEND_MEM,
|
|
|
|
.always_on = 1,
|
|
|
|
.boot_on = 1,
|
|
|
|
},
|
|
|
|
.num_consumer_supplies = ARRAY_SIZE(sw1a_consumers),
|
|
|
|
.consumer_supplies = sw1a_consumers,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* System IO - High */
|
|
|
|
static struct regulator_init_data viohi_data = {
|
|
|
|
.constraints = {
|
|
|
|
.name = "VIOHO",
|
|
|
|
.min_uV = 2800000,
|
|
|
|
.max_uV = 2800000,
|
|
|
|
.state_mem = {
|
|
|
|
.uV = 2800000,
|
|
|
|
.mode = REGULATOR_MODE_NORMAL,
|
|
|
|
.enabled = 1,
|
|
|
|
},
|
|
|
|
.initial_state = PM_SUSPEND_MEM,
|
|
|
|
.always_on = 1,
|
|
|
|
.boot_on = 1,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* System IO - Low */
|
|
|
|
static struct regulator_init_data violo_data = {
|
|
|
|
.constraints = {
|
|
|
|
.name = "VIOLO",
|
|
|
|
.min_uV = 1800000,
|
|
|
|
.max_uV = 1800000,
|
|
|
|
.state_mem = {
|
|
|
|
.uV = 1800000,
|
|
|
|
.mode = REGULATOR_MODE_NORMAL,
|
|
|
|
.enabled = 1,
|
|
|
|
},
|
|
|
|
.initial_state = PM_SUSPEND_MEM,
|
|
|
|
.always_on = 1,
|
|
|
|
.boot_on = 1,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* DDR RAM */
|
|
|
|
static struct regulator_init_data sw2a_data = {
|
|
|
|
.constraints = {
|
|
|
|
.name = "SW2A",
|
|
|
|
.min_uV = 1800000,
|
|
|
|
.max_uV = 1800000,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL,
|
|
|
|
.state_mem = {
|
|
|
|
.uV = 1800000,
|
|
|
|
.mode = REGULATOR_MODE_NORMAL,
|
|
|
|
.enabled = 1,
|
|
|
|
},
|
|
|
|
.state_disk = {
|
|
|
|
.mode = REGULATOR_MODE_NORMAL,
|
|
|
|
.enabled = 0,
|
|
|
|
},
|
|
|
|
.always_on = 1,
|
|
|
|
.boot_on = 1,
|
|
|
|
.initial_state = PM_SUSPEND_MEM,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_init_data ldo1_data = {
|
|
|
|
.constraints = {
|
|
|
|
.name = "VCAM/VMMC1/VMMC2",
|
|
|
|
.min_uV = 2800000,
|
|
|
|
.max_uV = 2800000,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL,
|
2010-01-04 11:24:50 -07:00
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
|
2009-01-15 09:14:30 -07:00
|
|
|
.apply_uV = 1,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_consumer_supply ldo2_consumers[] = {
|
2010-01-04 11:24:49 -07:00
|
|
|
{ .supply = "AVDD", .dev_name = "1-001a" },
|
|
|
|
{ .supply = "HPVDD", .dev_name = "1-001a" },
|
2009-01-15 09:14:30 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/* CODEC and SIM */
|
|
|
|
static struct regulator_init_data ldo2_data = {
|
|
|
|
.constraints = {
|
|
|
|
.name = "VESIM/VSIM/AVDD",
|
|
|
|
.min_uV = 3300000,
|
|
|
|
.max_uV = 3300000,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL,
|
2010-01-04 11:24:50 -07:00
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
|
2009-01-15 09:14:30 -07:00
|
|
|
.apply_uV = 1,
|
|
|
|
},
|
|
|
|
.num_consumer_supplies = ARRAY_SIZE(ldo2_consumers),
|
|
|
|
.consumer_supplies = ldo2_consumers,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* General */
|
|
|
|
static struct regulator_init_data vdig_data = {
|
|
|
|
.constraints = {
|
|
|
|
.name = "VDIG",
|
|
|
|
.min_uV = 1500000,
|
|
|
|
.max_uV = 1500000,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL,
|
|
|
|
.apply_uV = 1,
|
|
|
|
.always_on = 1,
|
|
|
|
.boot_on = 1,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Tranceivers */
|
|
|
|
static struct regulator_init_data ldo4_data = {
|
|
|
|
.constraints = {
|
|
|
|
.name = "VRF1/CVDD_2.775",
|
|
|
|
.min_uV = 2500000,
|
|
|
|
.max_uV = 2500000,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL,
|
|
|
|
.apply_uV = 1,
|
|
|
|
.always_on = 1,
|
|
|
|
.boot_on = 1,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct wm8350_led_platform_data wm8350_led_data = {
|
|
|
|
.name = "wm8350:white",
|
|
|
|
.default_trigger = "heartbeat",
|
|
|
|
.max_uA = 27899,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct wm8350_audio_platform_data imx32ads_wm8350_setup = {
|
|
|
|
.vmid_discharge_msecs = 1000,
|
|
|
|
.drain_msecs = 30,
|
|
|
|
.cap_discharge_msecs = 700,
|
|
|
|
.vmid_charge_msecs = 700,
|
|
|
|
.vmid_s_curve = WM8350_S_CURVE_SLOW,
|
|
|
|
.dis_out4 = WM8350_DISCHARGE_SLOW,
|
|
|
|
.dis_out3 = WM8350_DISCHARGE_SLOW,
|
|
|
|
.dis_out2 = WM8350_DISCHARGE_SLOW,
|
|
|
|
.dis_out1 = WM8350_DISCHARGE_SLOW,
|
|
|
|
.vroi_out4 = WM8350_TIE_OFF_500R,
|
|
|
|
.vroi_out3 = WM8350_TIE_OFF_500R,
|
|
|
|
.vroi_out2 = WM8350_TIE_OFF_500R,
|
|
|
|
.vroi_out1 = WM8350_TIE_OFF_500R,
|
|
|
|
.vroi_enable = 0,
|
|
|
|
.codec_current_on = WM8350_CODEC_ISEL_1_0,
|
|
|
|
.codec_current_standby = WM8350_CODEC_ISEL_0_5,
|
|
|
|
.codec_current_charge = WM8350_CODEC_ISEL_1_5,
|
|
|
|
};
|
|
|
|
|
|
|
|
static int mx31_wm8350_init(struct wm8350 *wm8350)
|
|
|
|
{
|
|
|
|
wm8350_gpio_config(wm8350, 0, WM8350_GPIO_DIR_IN,
|
|
|
|
WM8350_GPIO0_PWR_ON_IN, WM8350_GPIO_ACTIVE_LOW,
|
|
|
|
WM8350_GPIO_PULL_UP, WM8350_GPIO_INVERT_OFF,
|
|
|
|
WM8350_GPIO_DEBOUNCE_ON);
|
|
|
|
|
|
|
|
wm8350_gpio_config(wm8350, 3, WM8350_GPIO_DIR_IN,
|
|
|
|
WM8350_GPIO3_PWR_OFF_IN, WM8350_GPIO_ACTIVE_HIGH,
|
|
|
|
WM8350_GPIO_PULL_DOWN, WM8350_GPIO_INVERT_OFF,
|
|
|
|
WM8350_GPIO_DEBOUNCE_ON);
|
|
|
|
|
|
|
|
wm8350_gpio_config(wm8350, 4, WM8350_GPIO_DIR_IN,
|
|
|
|
WM8350_GPIO4_MR_IN, WM8350_GPIO_ACTIVE_HIGH,
|
|
|
|
WM8350_GPIO_PULL_DOWN, WM8350_GPIO_INVERT_OFF,
|
|
|
|
WM8350_GPIO_DEBOUNCE_OFF);
|
|
|
|
|
|
|
|
wm8350_gpio_config(wm8350, 7, WM8350_GPIO_DIR_IN,
|
|
|
|
WM8350_GPIO7_HIBERNATE_IN, WM8350_GPIO_ACTIVE_HIGH,
|
|
|
|
WM8350_GPIO_PULL_DOWN, WM8350_GPIO_INVERT_OFF,
|
|
|
|
WM8350_GPIO_DEBOUNCE_OFF);
|
|
|
|
|
|
|
|
wm8350_gpio_config(wm8350, 6, WM8350_GPIO_DIR_OUT,
|
|
|
|
WM8350_GPIO6_SDOUT_OUT, WM8350_GPIO_ACTIVE_HIGH,
|
|
|
|
WM8350_GPIO_PULL_NONE, WM8350_GPIO_INVERT_OFF,
|
|
|
|
WM8350_GPIO_DEBOUNCE_OFF);
|
|
|
|
|
|
|
|
wm8350_gpio_config(wm8350, 8, WM8350_GPIO_DIR_OUT,
|
|
|
|
WM8350_GPIO8_VCC_FAULT_OUT, WM8350_GPIO_ACTIVE_LOW,
|
|
|
|
WM8350_GPIO_PULL_NONE, WM8350_GPIO_INVERT_OFF,
|
|
|
|
WM8350_GPIO_DEBOUNCE_OFF);
|
|
|
|
|
|
|
|
wm8350_gpio_config(wm8350, 9, WM8350_GPIO_DIR_OUT,
|
|
|
|
WM8350_GPIO9_BATT_FAULT_OUT, WM8350_GPIO_ACTIVE_LOW,
|
|
|
|
WM8350_GPIO_PULL_NONE, WM8350_GPIO_INVERT_OFF,
|
|
|
|
WM8350_GPIO_DEBOUNCE_OFF);
|
|
|
|
|
|
|
|
wm8350_register_regulator(wm8350, WM8350_DCDC_1, &sw1a_data);
|
|
|
|
wm8350_register_regulator(wm8350, WM8350_DCDC_3, &viohi_data);
|
|
|
|
wm8350_register_regulator(wm8350, WM8350_DCDC_4, &violo_data);
|
|
|
|
wm8350_register_regulator(wm8350, WM8350_DCDC_6, &sw2a_data);
|
|
|
|
wm8350_register_regulator(wm8350, WM8350_LDO_1, &ldo1_data);
|
|
|
|
wm8350_register_regulator(wm8350, WM8350_LDO_2, &ldo2_data);
|
|
|
|
wm8350_register_regulator(wm8350, WM8350_LDO_3, &vdig_data);
|
|
|
|
wm8350_register_regulator(wm8350, WM8350_LDO_4, &ldo4_data);
|
|
|
|
|
|
|
|
/* LEDs */
|
|
|
|
wm8350_dcdc_set_slot(wm8350, WM8350_DCDC_5, 1, 1,
|
|
|
|
WM8350_DC5_ERRACT_SHUTDOWN_CONV);
|
|
|
|
wm8350_isink_set_flash(wm8350, WM8350_ISINK_A,
|
|
|
|
WM8350_ISINK_FLASH_DISABLE,
|
|
|
|
WM8350_ISINK_FLASH_TRIG_BIT,
|
|
|
|
WM8350_ISINK_FLASH_DUR_32MS,
|
|
|
|
WM8350_ISINK_FLASH_ON_INSTANT,
|
|
|
|
WM8350_ISINK_FLASH_OFF_INSTANT,
|
|
|
|
WM8350_ISINK_FLASH_MODE_EN);
|
|
|
|
wm8350_dcdc25_set_mode(wm8350, WM8350_DCDC_5,
|
|
|
|
WM8350_ISINK_MODE_BOOST,
|
|
|
|
WM8350_ISINK_ILIM_NORMAL,
|
|
|
|
WM8350_DC5_RMP_20V,
|
|
|
|
WM8350_DC5_FBSRC_ISINKA);
|
|
|
|
wm8350_register_led(wm8350, 0, WM8350_DCDC_5, WM8350_ISINK_A,
|
|
|
|
&wm8350_led_data);
|
|
|
|
|
|
|
|
wm8350->codec.platform_data = &imx32ads_wm8350_setup;
|
|
|
|
|
2009-04-13 06:05:28 -06:00
|
|
|
regulator_has_full_constraints();
|
|
|
|
|
2009-01-15 09:14:30 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct wm8350_platform_data __initdata mx31_wm8350_pdata = {
|
|
|
|
.init = mx31_wm8350_init,
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static struct i2c_board_info __initdata mx31ads_i2c1_devices[] = {
|
|
|
|
#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1
|
|
|
|
{
|
|
|
|
I2C_BOARD_INFO("wm8350", 0x1a),
|
|
|
|
.platform_data = &mx31_wm8350_pdata,
|
2011-12-02 05:00:33 -07:00
|
|
|
/* irq number is run-time assigned */
|
2009-01-15 09:14:30 -07:00
|
|
|
},
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2011-06-14 12:42:49 -06:00
|
|
|
static void __init mxc_init_i2c(void)
|
2009-01-15 09:14:30 -07:00
|
|
|
{
|
2011-12-02 05:00:33 -07:00
|
|
|
#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1
|
|
|
|
mx31ads_i2c1_devices[0].irq =
|
|
|
|
gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3));
|
|
|
|
#endif
|
2009-01-15 09:14:30 -07:00
|
|
|
i2c_register_board_info(1, mx31ads_i2c1_devices,
|
|
|
|
ARRAY_SIZE(mx31ads_i2c1_devices));
|
|
|
|
|
|
|
|
mxc_iomux_mode(IOMUX_MODE(MX31_PIN_CSPI2_MOSI, IOMUX_CONFIG_ALT1));
|
|
|
|
mxc_iomux_mode(IOMUX_MODE(MX31_PIN_CSPI2_MISO, IOMUX_CONFIG_ALT1));
|
|
|
|
|
2010-06-16 10:03:05 -06:00
|
|
|
imx31_add_imx_i2c1(NULL);
|
2009-01-15 09:14:30 -07:00
|
|
|
}
|
|
|
|
|
2010-02-23 04:05:11 -07:00
|
|
|
static unsigned int ssi_pins[] = {
|
|
|
|
MX31_PIN_SFS5__SFS5,
|
|
|
|
MX31_PIN_SCK5__SCK5,
|
|
|
|
MX31_PIN_SRXD5__SRXD5,
|
|
|
|
MX31_PIN_STXD5__STXD5,
|
|
|
|
};
|
|
|
|
|
2011-06-14 12:42:49 -06:00
|
|
|
static void __init mxc_init_audio(void)
|
2010-02-23 04:05:11 -07:00
|
|
|
{
|
2010-08-25 09:37:45 -06:00
|
|
|
imx31_add_imx_ssi(0, NULL);
|
2010-02-23 04:05:11 -07:00
|
|
|
mxc_iomux_setup_multiple_pins(ssi_pins, ARRAY_SIZE(ssi_pins), "ssi");
|
|
|
|
}
|
|
|
|
|
2012-01-26 13:47:27 -07:00
|
|
|
/*
|
|
|
|
* Static mappings, starting from the CS4 start address up to the start address
|
|
|
|
* of the CS8900.
|
|
|
|
*/
|
2007-07-09 15:06:53 -06:00
|
|
|
static struct map_desc mx31ads_io_desc[] __initdata = {
|
|
|
|
{
|
2012-09-14 14:14:01 -06:00
|
|
|
.virtual = (unsigned long)MX31_CS4_BASE_ADDR_VIRT,
|
2009-12-09 03:57:21 -07:00
|
|
|
.pfn = __phys_to_pfn(MX31_CS4_BASE_ADDR),
|
2012-01-26 13:47:27 -07:00
|
|
|
.length = CS4_CS8900_MMIO_START,
|
2007-07-09 15:06:53 -06:00
|
|
|
.type = MT_DEVICE
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2009-01-15 09:14:29 -07:00
|
|
|
static void __init mx31ads_map_io(void)
|
2007-07-09 15:06:53 -06:00
|
|
|
{
|
2009-04-02 14:32:10 -06:00
|
|
|
mx31_map_io();
|
2007-07-09 15:06:53 -06:00
|
|
|
iotable_init(mx31ads_io_desc, ARRAY_SIZE(mx31ads_io_desc));
|
|
|
|
}
|
|
|
|
|
2009-01-15 09:14:29 -07:00
|
|
|
static void __init mx31ads_init_irq(void)
|
2008-09-09 02:19:42 -06:00
|
|
|
{
|
2009-05-25 09:36:19 -06:00
|
|
|
mx31_init_irq();
|
2008-09-09 02:19:42 -06:00
|
|
|
mx31ads_init_expio();
|
|
|
|
}
|
|
|
|
|
2011-02-11 02:23:19 -07:00
|
|
|
static void __init mx31ads_init(void)
|
2007-07-09 15:06:53 -06:00
|
|
|
{
|
2011-06-05 10:07:55 -06:00
|
|
|
imx31_soc_init();
|
|
|
|
|
2007-07-09 15:06:53 -06:00
|
|
|
mxc_init_extuart();
|
2008-09-09 02:19:41 -06:00
|
|
|
mxc_init_imx_uart();
|
2009-01-15 09:14:30 -07:00
|
|
|
mxc_init_i2c();
|
2010-02-23 04:05:11 -07:00
|
|
|
mxc_init_audio();
|
2012-01-26 13:47:27 -07:00
|
|
|
mxc_init_ext_ethernet();
|
2007-07-09 15:06:53 -06:00
|
|
|
}
|
|
|
|
|
2008-07-05 02:02:50 -06:00
|
|
|
static void __init mx31ads_timer_init(void)
|
|
|
|
{
|
2009-02-16 06:36:49 -07:00
|
|
|
mx31_clocks_init(26000000);
|
2008-07-05 02:02:50 -06:00
|
|
|
}
|
|
|
|
|
2007-07-09 15:06:53 -06:00
|
|
|
MACHINE_START(MX31ADS, "Freescale MX31ADS")
|
|
|
|
/* Maintainer: Freescale Semiconductor, Inc. */
|
2011-07-05 20:38:12 -06:00
|
|
|
.atag_offset = 0x100,
|
2011-02-07 08:35:20 -07:00
|
|
|
.map_io = mx31ads_map_io,
|
|
|
|
.init_early = imx31_init_early,
|
|
|
|
.init_irq = mx31ads_init_irq,
|
2012-11-08 12:40:59 -07:00
|
|
|
.init_time = mx31ads_timer_init,
|
2011-02-11 02:23:19 -07:00
|
|
|
.init_machine = mx31ads_init,
|
2011-11-06 10:12:08 -07:00
|
|
|
.restart = mxc_restart,
|
2007-07-09 15:06:53 -06:00
|
|
|
MACHINE_END
|