18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * linux/arch/arm/mach-mmp/jasper.c 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Support for the Marvell Jasper Development Platform. 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Copyright (C) 2009-2010 Marvell International Ltd. 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/init.h> 118c2ecf20Sopenharmony_ci#include <linux/kernel.h> 128c2ecf20Sopenharmony_ci#include <linux/gpio-pxa.h> 138c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 148c2ecf20Sopenharmony_ci#include <linux/io.h> 158c2ecf20Sopenharmony_ci#include <linux/regulator/machine.h> 168c2ecf20Sopenharmony_ci#include <linux/regulator/max8649.h> 178c2ecf20Sopenharmony_ci#include <linux/mfd/max8925.h> 188c2ecf20Sopenharmony_ci#include <linux/interrupt.h> 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#include "irqs.h" 218c2ecf20Sopenharmony_ci#include <asm/mach-types.h> 228c2ecf20Sopenharmony_ci#include <asm/mach/arch.h> 238c2ecf20Sopenharmony_ci#include "addr-map.h" 248c2ecf20Sopenharmony_ci#include "mfp-mmp2.h" 258c2ecf20Sopenharmony_ci#include "mmp2.h" 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#include "common.h" 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#define JASPER_NR_IRQS (MMP_NR_IRQS + 48) 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_cistatic unsigned long jasper_pin_config[] __initdata = { 328c2ecf20Sopenharmony_ci /* UART1 */ 338c2ecf20Sopenharmony_ci GPIO29_UART1_RXD, 348c2ecf20Sopenharmony_ci GPIO30_UART1_TXD, 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci /* UART3 */ 378c2ecf20Sopenharmony_ci GPIO51_UART3_RXD, 388c2ecf20Sopenharmony_ci GPIO52_UART3_TXD, 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci /* DFI */ 418c2ecf20Sopenharmony_ci GPIO168_DFI_D0, 428c2ecf20Sopenharmony_ci GPIO167_DFI_D1, 438c2ecf20Sopenharmony_ci GPIO166_DFI_D2, 448c2ecf20Sopenharmony_ci GPIO165_DFI_D3, 458c2ecf20Sopenharmony_ci GPIO107_DFI_D4, 468c2ecf20Sopenharmony_ci GPIO106_DFI_D5, 478c2ecf20Sopenharmony_ci GPIO105_DFI_D6, 488c2ecf20Sopenharmony_ci GPIO104_DFI_D7, 498c2ecf20Sopenharmony_ci GPIO111_DFI_D8, 508c2ecf20Sopenharmony_ci GPIO164_DFI_D9, 518c2ecf20Sopenharmony_ci GPIO163_DFI_D10, 528c2ecf20Sopenharmony_ci GPIO162_DFI_D11, 538c2ecf20Sopenharmony_ci GPIO161_DFI_D12, 548c2ecf20Sopenharmony_ci GPIO110_DFI_D13, 558c2ecf20Sopenharmony_ci GPIO109_DFI_D14, 568c2ecf20Sopenharmony_ci GPIO108_DFI_D15, 578c2ecf20Sopenharmony_ci GPIO143_ND_nCS0, 588c2ecf20Sopenharmony_ci GPIO144_ND_nCS1, 598c2ecf20Sopenharmony_ci GPIO147_ND_nWE, 608c2ecf20Sopenharmony_ci GPIO148_ND_nRE, 618c2ecf20Sopenharmony_ci GPIO150_ND_ALE, 628c2ecf20Sopenharmony_ci GPIO149_ND_CLE, 638c2ecf20Sopenharmony_ci GPIO112_ND_RDY0, 648c2ecf20Sopenharmony_ci GPIO160_ND_RDY1, 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci /* PMIC */ 678c2ecf20Sopenharmony_ci PMIC_PMIC_INT | MFP_LPM_EDGE_FALL, 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci /* MMC1 */ 708c2ecf20Sopenharmony_ci GPIO131_MMC1_DAT3, 718c2ecf20Sopenharmony_ci GPIO132_MMC1_DAT2, 728c2ecf20Sopenharmony_ci GPIO133_MMC1_DAT1, 738c2ecf20Sopenharmony_ci GPIO134_MMC1_DAT0, 748c2ecf20Sopenharmony_ci GPIO136_MMC1_CMD, 758c2ecf20Sopenharmony_ci GPIO139_MMC1_CLK, 768c2ecf20Sopenharmony_ci GPIO140_MMC1_CD, 778c2ecf20Sopenharmony_ci GPIO141_MMC1_WP, 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci /* MMC2 */ 808c2ecf20Sopenharmony_ci GPIO37_MMC2_DAT3, 818c2ecf20Sopenharmony_ci GPIO38_MMC2_DAT2, 828c2ecf20Sopenharmony_ci GPIO39_MMC2_DAT1, 838c2ecf20Sopenharmony_ci GPIO40_MMC2_DAT0, 848c2ecf20Sopenharmony_ci GPIO41_MMC2_CMD, 858c2ecf20Sopenharmony_ci GPIO42_MMC2_CLK, 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci /* MMC3 */ 888c2ecf20Sopenharmony_ci GPIO165_MMC3_DAT7, 898c2ecf20Sopenharmony_ci GPIO162_MMC3_DAT6, 908c2ecf20Sopenharmony_ci GPIO166_MMC3_DAT5, 918c2ecf20Sopenharmony_ci GPIO163_MMC3_DAT4, 928c2ecf20Sopenharmony_ci GPIO167_MMC3_DAT3, 938c2ecf20Sopenharmony_ci GPIO164_MMC3_DAT2, 948c2ecf20Sopenharmony_ci GPIO168_MMC3_DAT1, 958c2ecf20Sopenharmony_ci GPIO111_MMC3_DAT0, 968c2ecf20Sopenharmony_ci GPIO112_MMC3_CMD, 978c2ecf20Sopenharmony_ci GPIO151_MMC3_CLK, 988c2ecf20Sopenharmony_ci}; 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_cistatic struct pxa_gpio_platform_data mmp2_gpio_pdata = { 1018c2ecf20Sopenharmony_ci .irq_base = MMP_GPIO_TO_IRQ(0), 1028c2ecf20Sopenharmony_ci}; 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_cistatic struct regulator_consumer_supply max8649_supply[] = { 1058c2ecf20Sopenharmony_ci REGULATOR_SUPPLY("vcc_core", NULL), 1068c2ecf20Sopenharmony_ci}; 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_cistatic struct regulator_init_data max8649_init_data = { 1098c2ecf20Sopenharmony_ci .constraints = { 1108c2ecf20Sopenharmony_ci .name = "vcc_core range", 1118c2ecf20Sopenharmony_ci .min_uV = 1150000, 1128c2ecf20Sopenharmony_ci .max_uV = 1280000, 1138c2ecf20Sopenharmony_ci .always_on = 1, 1148c2ecf20Sopenharmony_ci .boot_on = 1, 1158c2ecf20Sopenharmony_ci .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, 1168c2ecf20Sopenharmony_ci }, 1178c2ecf20Sopenharmony_ci .num_consumer_supplies = 1, 1188c2ecf20Sopenharmony_ci .consumer_supplies = &max8649_supply[0], 1198c2ecf20Sopenharmony_ci}; 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_cistatic struct max8649_platform_data jasper_max8649_info = { 1228c2ecf20Sopenharmony_ci .mode = 2, /* VID1 = 1, VID0 = 0 */ 1238c2ecf20Sopenharmony_ci .extclk = 0, 1248c2ecf20Sopenharmony_ci .ramp_timing = MAX8649_RAMP_32MV, 1258c2ecf20Sopenharmony_ci .regulator = &max8649_init_data, 1268c2ecf20Sopenharmony_ci}; 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_cistatic struct max8925_backlight_pdata jasper_backlight_data = { 1298c2ecf20Sopenharmony_ci .dual_string = 0, 1308c2ecf20Sopenharmony_ci}; 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_cistatic struct max8925_power_pdata jasper_power_data = { 1338c2ecf20Sopenharmony_ci .batt_detect = 0, /* can't detect battery by ID pin */ 1348c2ecf20Sopenharmony_ci .topoff_threshold = MAX8925_TOPOFF_THR_10PER, 1358c2ecf20Sopenharmony_ci .fast_charge = MAX8925_FCHG_1000MA, 1368c2ecf20Sopenharmony_ci}; 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_cistatic struct max8925_platform_data jasper_max8925_info = { 1398c2ecf20Sopenharmony_ci .backlight = &jasper_backlight_data, 1408c2ecf20Sopenharmony_ci .power = &jasper_power_data, 1418c2ecf20Sopenharmony_ci .irq_base = MMP_NR_IRQS, 1428c2ecf20Sopenharmony_ci}; 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_cistatic struct i2c_board_info jasper_twsi1_info[] = { 1458c2ecf20Sopenharmony_ci [0] = { 1468c2ecf20Sopenharmony_ci .type = "max8649", 1478c2ecf20Sopenharmony_ci .addr = 0x60, 1488c2ecf20Sopenharmony_ci .platform_data = &jasper_max8649_info, 1498c2ecf20Sopenharmony_ci }, 1508c2ecf20Sopenharmony_ci [1] = { 1518c2ecf20Sopenharmony_ci .type = "max8925", 1528c2ecf20Sopenharmony_ci .addr = 0x3c, 1538c2ecf20Sopenharmony_ci .irq = IRQ_MMP2_PMIC, 1548c2ecf20Sopenharmony_ci .platform_data = &jasper_max8925_info, 1558c2ecf20Sopenharmony_ci }, 1568c2ecf20Sopenharmony_ci}; 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_cistatic struct sdhci_pxa_platdata mmp2_sdh_platdata_mmc0 = { 1598c2ecf20Sopenharmony_ci .clk_delay_cycles = 0x1f, 1608c2ecf20Sopenharmony_ci}; 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_cistatic void __init jasper_init(void) 1638c2ecf20Sopenharmony_ci{ 1648c2ecf20Sopenharmony_ci mfp_config(ARRAY_AND_SIZE(jasper_pin_config)); 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci /* on-chip devices */ 1678c2ecf20Sopenharmony_ci mmp2_add_uart(1); 1688c2ecf20Sopenharmony_ci mmp2_add_uart(3); 1698c2ecf20Sopenharmony_ci mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(jasper_twsi1_info)); 1708c2ecf20Sopenharmony_ci platform_device_add_data(&mmp2_device_gpio, &mmp2_gpio_pdata, 1718c2ecf20Sopenharmony_ci sizeof(struct pxa_gpio_platform_data)); 1728c2ecf20Sopenharmony_ci platform_device_register(&mmp2_device_gpio); 1738c2ecf20Sopenharmony_ci mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */ 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ci regulator_has_full_constraints(); 1768c2ecf20Sopenharmony_ci} 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_ciMACHINE_START(MARVELL_JASPER, "Jasper Development Platform") 1798c2ecf20Sopenharmony_ci .map_io = mmp_map_io, 1808c2ecf20Sopenharmony_ci .nr_irqs = JASPER_NR_IRQS, 1818c2ecf20Sopenharmony_ci .init_irq = mmp2_init_irq, 1828c2ecf20Sopenharmony_ci .init_time = mmp2_timer_init, 1838c2ecf20Sopenharmony_ci .init_machine = jasper_init, 1848c2ecf20Sopenharmony_ci .restart = mmp_restart, 1858c2ecf20Sopenharmony_ciMACHINE_END 186