Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  *  linux/arch/arm/mach-mmp/jasper.c
0004  *
0005  *  Support for the Marvell Jasper Development Platform.
0006  *
0007  *  Copyright (C) 2009-2010 Marvell International Ltd.
0008  */
0009 
0010 #include <linux/init.h>
0011 #include <linux/kernel.h>
0012 #include <linux/gpio-pxa.h>
0013 #include <linux/platform_device.h>
0014 #include <linux/io.h>
0015 #include <linux/regulator/machine.h>
0016 #include <linux/regulator/max8649.h>
0017 #include <linux/mfd/max8925.h>
0018 #include <linux/interrupt.h>
0019 
0020 #include "irqs.h"
0021 #include <asm/mach-types.h>
0022 #include <asm/mach/arch.h>
0023 #include "addr-map.h"
0024 #include "mfp-mmp2.h"
0025 #include "mmp2.h"
0026 
0027 #include "common.h"
0028 
0029 #define JASPER_NR_IRQS      (MMP_NR_IRQS + 48)
0030 
0031 static unsigned long jasper_pin_config[] __initdata = {
0032     /* UART1 */
0033     GPIO29_UART1_RXD,
0034     GPIO30_UART1_TXD,
0035 
0036     /* UART3 */
0037     GPIO51_UART3_RXD,
0038     GPIO52_UART3_TXD,
0039 
0040     /* DFI */
0041     GPIO168_DFI_D0,
0042     GPIO167_DFI_D1,
0043     GPIO166_DFI_D2,
0044     GPIO165_DFI_D3,
0045     GPIO107_DFI_D4,
0046     GPIO106_DFI_D5,
0047     GPIO105_DFI_D6,
0048     GPIO104_DFI_D7,
0049     GPIO111_DFI_D8,
0050     GPIO164_DFI_D9,
0051     GPIO163_DFI_D10,
0052     GPIO162_DFI_D11,
0053     GPIO161_DFI_D12,
0054     GPIO110_DFI_D13,
0055     GPIO109_DFI_D14,
0056     GPIO108_DFI_D15,
0057     GPIO143_ND_nCS0,
0058     GPIO144_ND_nCS1,
0059     GPIO147_ND_nWE,
0060     GPIO148_ND_nRE,
0061     GPIO150_ND_ALE,
0062     GPIO149_ND_CLE,
0063     GPIO112_ND_RDY0,
0064     GPIO160_ND_RDY1,
0065 
0066     /* PMIC */
0067     PMIC_PMIC_INT | MFP_LPM_EDGE_FALL,
0068 
0069     /* MMC1 */
0070     GPIO131_MMC1_DAT3,
0071     GPIO132_MMC1_DAT2,
0072     GPIO133_MMC1_DAT1,
0073     GPIO134_MMC1_DAT0,
0074     GPIO136_MMC1_CMD,
0075     GPIO139_MMC1_CLK,
0076     GPIO140_MMC1_CD,
0077     GPIO141_MMC1_WP,
0078 
0079     /* MMC2 */
0080     GPIO37_MMC2_DAT3,
0081     GPIO38_MMC2_DAT2,
0082     GPIO39_MMC2_DAT1,
0083     GPIO40_MMC2_DAT0,
0084     GPIO41_MMC2_CMD,
0085     GPIO42_MMC2_CLK,
0086 
0087     /* MMC3 */
0088     GPIO165_MMC3_DAT7,
0089     GPIO162_MMC3_DAT6,
0090     GPIO166_MMC3_DAT5,
0091     GPIO163_MMC3_DAT4,
0092     GPIO167_MMC3_DAT3,
0093     GPIO164_MMC3_DAT2,
0094     GPIO168_MMC3_DAT1,
0095     GPIO111_MMC3_DAT0,
0096     GPIO112_MMC3_CMD,
0097     GPIO151_MMC3_CLK,
0098 };
0099 
0100 static struct pxa_gpio_platform_data mmp2_gpio_pdata = {
0101     .irq_base   = MMP_GPIO_TO_IRQ(0),
0102 };
0103 
0104 static struct regulator_consumer_supply max8649_supply[] = {
0105     REGULATOR_SUPPLY("vcc_core", NULL),
0106 };
0107 
0108 static struct regulator_init_data max8649_init_data = {
0109     .constraints    = {
0110         .name       = "vcc_core range",
0111         .min_uV     = 1150000,
0112         .max_uV     = 1280000,
0113         .always_on  = 1,
0114         .boot_on    = 1,
0115         .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
0116     },
0117     .num_consumer_supplies  = 1,
0118     .consumer_supplies  = &max8649_supply[0],
0119 };
0120 
0121 static struct max8649_platform_data jasper_max8649_info = {
0122     .mode       = 2,    /* VID1 = 1, VID0 = 0 */
0123     .extclk     = 0,
0124     .ramp_timing    = MAX8649_RAMP_32MV,
0125     .regulator  = &max8649_init_data,
0126 };
0127 
0128 static struct max8925_backlight_pdata jasper_backlight_data = {
0129     .dual_string    = 0,
0130 };
0131 
0132 static struct max8925_power_pdata jasper_power_data = {
0133     .batt_detect        = 0,    /* can't detect battery by ID pin */
0134     .topoff_threshold   = MAX8925_TOPOFF_THR_10PER,
0135     .fast_charge        = MAX8925_FCHG_1000MA,
0136 };
0137 
0138 static struct max8925_platform_data jasper_max8925_info = {
0139     .backlight      = &jasper_backlight_data,
0140     .power          = &jasper_power_data,
0141     .irq_base       = MMP_NR_IRQS,
0142 };
0143 
0144 static struct i2c_board_info jasper_twsi1_info[] = {
0145     [0] = {
0146         .type       = "max8649",
0147         .addr       = 0x60,
0148         .platform_data  = &jasper_max8649_info,
0149     },
0150     [1] = {
0151         .type       = "max8925",
0152         .addr       = 0x3c,
0153         .irq        = IRQ_MMP2_PMIC,
0154         .platform_data  = &jasper_max8925_info,
0155     },
0156 };
0157 
0158 static struct sdhci_pxa_platdata mmp2_sdh_platdata_mmc0 = {
0159     .clk_delay_cycles = 0x1f,
0160 };
0161 
0162 static void __init jasper_init(void)
0163 {
0164     mfp_config(ARRAY_AND_SIZE(jasper_pin_config));
0165 
0166     /* on-chip devices */
0167     mmp2_add_uart(1);
0168     mmp2_add_uart(3);
0169     mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(jasper_twsi1_info));
0170     platform_device_add_data(&mmp2_device_gpio, &mmp2_gpio_pdata,
0171                  sizeof(struct pxa_gpio_platform_data));
0172     platform_device_register(&mmp2_device_gpio);
0173     mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */
0174 
0175     regulator_has_full_constraints();
0176 }
0177 
0178 MACHINE_START(MARVELL_JASPER, "Jasper Development Platform")
0179     .map_io     = mmp_map_io,
0180     .nr_irqs    = JASPER_NR_IRQS,
0181     .init_irq       = mmp2_init_irq,
0182     .init_time  = mmp2_timer_init,
0183     .init_machine   = jasper_init,
0184     .restart    = mmp_restart,
0185 MACHINE_END