2
* arch/arm/mach-dove/dove-db-z0-setup.c
4
* Marvell DB-MV88F6781-BP Z0 Development Board Setup
6
* Author: Tzachi Perelstein <tzachi@marvell.com>
8
* This file is licensed under the terms of the GNU General Public
9
* License version 2. This program is licensed "as is" without any
10
* warranty of any kind, whether express or implied.
13
#include <linux/kernel.h>
14
#include <linux/init.h>
15
#include <linux/platform_device.h>
16
#include <linux/irq.h>
17
#include <linux/mtd/physmap.h>
18
#include <linux/mtd/nand.h>
19
#include <linux/timer.h>
20
#include <linux/ata_platform.h>
21
#include <linux/mv643xx_eth.h>
22
#include <linux/i2c.h>
23
#include <linux/pci.h>
24
#include <linux/gpio_mouse.h>
25
#include <linux/spi/spi.h>
26
#include <linux/spi/orion_spi.h>
27
#include <linux/spi/flash.h>
28
#include <linux/spi/ads7846.h>
29
#include <video/dovefb.h>
30
#include <plat/i2s-orion.h>
31
#include <asm/mach-types.h>
33
#include <asm/mach/arch.h>
34
#include <mach/dove.h>
35
#include <asm/hardware/pxa-dma.h>
36
#include <mach/dove_nand.h>
40
#include "dove-front-panel-common.h"
42
#include "pmu/mvPmu.h"
43
#include "pmu/mvPmuRegs.h"
45
#define DOVE_DB_WAKEUP_GPIO (3)
46
static unsigned int front_panel = 0;
47
module_param(front_panel, uint, 0);
48
MODULE_PARM_DESC(front_panel, "set to 1 if the dove DB front panel connected");
50
static unsigned int left_tact = 0;
51
module_param(left_tact, uint, 0);
52
MODULE_PARM_DESC(left_tact, "Use left tact as mouse. this will disable I2S"
53
"JPR 3 should be removed, JPR 6 on 2-3");
55
static unsigned int use_hal_giga = 1;
56
#ifdef CONFIG_MV643XX_ETH
57
module_param(use_hal_giga, uint, 0);
58
MODULE_PARM_DESC(use_hal_giga, "Use the HAL giga driver");
61
extern int __init pxa_init_dma_wins(struct mbus_dram_target_info * dram);
63
static struct orion_i2s_platform_data i2s1_data = {
69
static struct mv643xx_eth_platform_data dove_db_ge00_data = {
70
.phy_addr = MV643XX_ETH_PHY_ADDR_DEFAULT,
73
static struct mv_sata_platform_data dove_db_sata_data = {
77
static struct gpio_mouse_platform_data tact_dove_db_data = {
92
/*****************************************************************************
94
* SPI0: 4M Flash ST-M25P32-VMF6P
95
****************************************************************************/
96
static const struct flash_platform_data dove_db_spi_flash_data = {
100
static struct spi_board_info __initdata dove_db_spi_flash_info[] = {
102
.modalias = "m25p80",
103
.platform_data = &dove_db_spi_flash_data,
105
.max_speed_hz = 20000000,
111
/*****************************************************************************
112
* 7-Segment on GPIO 14,15,18,19
113
* Dummy counter up to 7 every 1 sec
114
****************************************************************************/
116
static struct timer_list dove_db_timer;
117
static int dove_db_7seg_gpios[] = {14,15,18,19};
119
static void dove_db_7seg_event(unsigned long data)
121
static int count = 0;
123
gpio_set_value(dove_db_7seg_gpios[0], count & 1);
124
gpio_set_value(dove_db_7seg_gpios[1], count & (1 << 1));
125
gpio_set_value(dove_db_7seg_gpios[2], count & (1 << 2));
126
gpio_set_value(dove_db_7seg_gpios[3], count & (1 << 3));
128
count = (count + 1) & 7;
129
mod_timer(&dove_db_timer, jiffies + 1 * HZ);
132
static int __init dove_db_7seg_init(void)
134
if (machine_is_dove_db_z0()) {
137
for(i = 0; i < 4; i++){
138
int pin = dove_db_7seg_gpios[i];
140
if (gpio_request(pin, "7seg LED") == 0) {
141
if (gpio_direction_output(pin, 0) != 0) {
142
printk(KERN_ERR "%s failed "
143
"to set output pin %d\n", __func__,
149
printk(KERN_ERR "%s failed "
150
"to request gpio %d\n", __func__, pin);
154
setup_timer(&dove_db_timer, dove_db_7seg_event, 0);
155
mod_timer(&dove_db_timer, jiffies + 1 * HZ);
161
__initcall(dove_db_7seg_init);
163
/*****************************************************************************
165
****************************************************************************/
166
static int __init dove_db_pci_init(void)
168
if (machine_is_dove_db_z0())
169
dove_pcie_init(1, 1);
174
subsys_initcall(dove_db_pci_init);
176
/*****************************************************************************
178
****************************************************************************/
179
static struct i2c_board_info __initdata i2c_a2d = {
180
I2C_BOARD_INFO("i2s_i2c", 0x4A),
183
/*****************************************************************************
185
****************************************************************************/
186
static struct mtd_partition partition_dove[] = {
191
.offset = MTDPART_OFS_APPEND,
194
.offset = MTDPART_OFS_APPEND,
195
.size = 1019 * SZ_1M },
197
static u64 nfc_dmamask = DMA_BIT_MASK(32);
198
static struct dove_nand_platform_data dove_db_nfc_data = {
203
.parts = partition_dove,
204
.nr_parts = ARRAY_SIZE(partition_dove)
207
static struct resource dove_nfc_resources[] = {
209
.start = (DOVE_NFC_PHYS_BASE),
210
.end = (DOVE_NFC_PHYS_BASE + 0xFF),
211
.flags = IORESOURCE_MEM,
216
.flags = IORESOURCE_IRQ,
222
.flags = IORESOURCE_DMA,
228
.flags = IORESOURCE_DMA,
232
static struct platform_device dove_nfc = {
236
.dma_mask = &nfc_dmamask,
237
.coherent_dma_mask = DMA_BIT_MASK(32),
238
.platform_data = &dove_db_nfc_data,
240
.resource = dove_nfc_resources,
241
.num_resources = ARRAY_SIZE(dove_nfc_resources),
244
static void __init dove_db_nfc_init(void)
246
dove_db_nfc_data.tclk = dove_tclk_get();
247
platform_device_register(&dove_nfc);
250
static struct dove_mpp_mode dove_db_mpp_modes[] __initdata = {
251
{ 1, MPP_PMU }, /* CPU power control */
252
{ 3, MPP_PMU }, /* Wakeup - power button */
253
{ 4, MPP_PMU }, /* CPU power good inication */
254
{ 7, MPP_PMU }, /* Standby Led */
255
{ 10, MPP_PMU }, /* DVS SDI control */
256
{ 11, MPP_SATA_ACT }, /* SATA active */
257
{ 14, MPP_GPIO }, /* 7segDebug Led */
258
{ 15, MPP_GPIO }, /* 7segDebug Led */
259
{ 18, MPP_GPIO }, /* 7segDebug Led */
260
{ 19, MPP_GPIO }, /* 7segDebug Led */
261
{ 62, MPP_UART1 }, /* 7segDebug Led */
262
{ 52, MPP_AUDIO1 }, /* AU1 Group to GPIO */
266
static struct dove_mpp_mode dove_db_mpp_modes_ltact[] __initdata = {
267
{ 52, MPP_GPIO }, /* AU1 Group to GPIO */
271
/*****************************************************************************
273
****************************************************************************/
274
static int __init dove_db_z0_pm_init(void)
276
MV_PMU_INFO pmuInitInfo;
278
if (!machine_is_dove_db_z0())
281
pmuInitInfo.batFltMngDis = MV_FALSE; /* Keep battery fault enabled */
282
pmuInitInfo.exitOnBatFltDis = MV_FALSE; /* Keep exit from STANDBY on battery fail enabled */
283
pmuInitInfo.sigSelctor[0] = PMU_SIGNAL_NC;
284
pmuInitInfo.sigSelctor[1] = PMU_SIGNAL_CPU_PWRDWN; /* DEEP-IdLE => 0: CPU off, 1: CPU on */
285
pmuInitInfo.sigSelctor[2] = PMU_SIGNAL_NC; /* STANDBY => Not used in Z0 */
286
pmuInitInfo.sigSelctor[3] = PMU_SIGNAL_EXT0_WKUP; /* power on push button */
287
pmuInitInfo.sigSelctor[4] = PMU_SIGNAL_CPU_PWRGOOD; /* CORE power good used as Standby PG */
288
pmuInitInfo.sigSelctor[5] = PMU_SIGNAL_NC; /* NON PMU in Z0 Board */
289
pmuInitInfo.sigSelctor[6] = PMU_SIGNAL_NC; /* Charger interrupt - not used */
290
pmuInitInfo.sigSelctor[7] = PMU_SIGNAL_1; /* Standby Led - inverted */
291
pmuInitInfo.sigSelctor[8] = PMU_SIGNAL_NC; /* PM OFF Control - used as GPIO */
292
pmuInitInfo.sigSelctor[9] = PMU_SIGNAL_NC; /* CPU power good - not used */
293
pmuInitInfo.sigSelctor[10] = PMU_SIGNAL_SDI; /* Voltage regulator control */
294
pmuInitInfo.sigSelctor[11] = PMU_SIGNAL_NC;
295
pmuInitInfo.sigSelctor[12] = PMU_SIGNAL_NC;
296
pmuInitInfo.sigSelctor[13] = PMU_SIGNAL_NC;
297
pmuInitInfo.sigSelctor[14] = PMU_SIGNAL_NC;
298
pmuInitInfo.sigSelctor[15] = PMU_SIGNAL_NC;
299
pmuInitInfo.dvsDelay = 0; /* PMU cc delay for DVS change */
300
pmuInitInfo.ddrTermGpioNum = -1; /* No GPIO is used to disable terminations */
302
/* Initialize the PMU HAL */
303
if (mvPmuInit(&pmuInitInfo) != MV_OK)
304
printk(KERN_NOTICE "Failed to initialive the PMU!\n");
306
/* Configure wakeup events */
307
mvPmuWakeupEventSet(PMU_STBY_WKUP_CTRL_EXT0_FALL | PMU_STBY_WKUP_CTRL_RTC_MASK);
309
/* Register the PM operation in the Linux stack */
315
__initcall(dove_db_z0_pm_init);
317
/*****************************************************************************
319
****************************************************************************/
322
//extern struct mbus_dram_target_info dove_mbus_dram_info;
323
//extern int __init pxa_init_dma_wins(struct mbus_dram_target_info * dram);
324
static void __init dove_db_init(void)
327
* Basic Dove setup. Needs to be called early.
330
dove_mpp_conf(dove_db_mpp_modes);
332
/* the (SW1) button is for use as a "wakeup" button */
333
dove_wakeup_button_setup(DOVE_DB_WAKEUP_GPIO);
335
/* card interrupt workaround using GPIOs */
336
dove_sd_card_int_wa_setup(0);
337
dove_sd_card_int_wa_setup(1);
342
dove_mpp_conf(dove_db_mpp_modes_ltact);
343
/* JPR6 shoud be on 1-2 for touchscreen irq line */
345
if (dove_fp_ts_gpio_setup() != 0)
349
/* Initialize AC'97 related regs. */
353
pxa_init_dma_wins(&dove_mbus_dram_info);
357
#ifdef CONFIG_MV_ETHERNET
362
dove_ge00_init(&dove_db_ge00_data);
367
/* ehci init functions access the usb port, only now it's safe to disable
370
ds_clks_disable_all(0, 0);
372
dove_sata_init(&dove_db_sata_data);
376
/* uart1 is the debug port, register it first so it will be */
377
/* represented by device ttyS0, root filesystems usually expect the */
378
/* console to be on that device */
382
dove_i2c_exp_init(0);
383
dove_sdhci_cam_mbus_init();
394
dove_cam_init(&dove_cafe_cam_data);
396
if(front_panel && left_tact)
397
dove_tact_init(&tact_dove_db_data);
399
dove_i2s_init(1, &i2s1_data);
400
i2c_register_board_info(0, &i2c_a2d, 1);
401
spi_register_board_info(dove_db_spi_flash_info,
402
ARRAY_SIZE(dove_db_spi_flash_info));
403
spi_register_board_info(dove_fp_spi_devs, dove_fp_spi_devs_num());
406
MACHINE_START(DOVE_DB, "Marvell DB-MV88F6781-BP-Z0 Development Board")
407
.phys_io = DOVE_SB_REGS_PHYS_BASE,
408
.io_pg_offst = ((DOVE_SB_REGS_VIRT_BASE) >> 18) & 0xfffc,
409
.boot_params = 0x00000100,
410
.init_machine = dove_db_init,
411
.map_io = dove_map_io,
412
.init_irq = dove_init_irq,
413
.timer = &dove_timer,
414
/* reserve memory for VMETA and GPU */
415
.fixup = dove_tag_fixup_mem32,