Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  *  linux/arch/arm/mach-mmp/gplugd.c
0004  *
0005  *  Support for the Marvell PXA168-based GuruPlug Display (gplugD) Platform.
0006  */
0007 
0008 #include <linux/init.h>
0009 #include <linux/platform_device.h>
0010 #include <linux/gpio.h>
0011 #include <linux/gpio-pxa.h>
0012 
0013 #include <asm/mach/arch.h>
0014 #include <asm/mach-types.h>
0015 
0016 #include "irqs.h"
0017 #include "pxa168.h"
0018 #include "mfp-pxa168.h"
0019 
0020 #include "common.h"
0021 
0022 static unsigned long gplugd_pin_config[] __initdata = {
0023     /* UART3 */
0024     GPIO8_UART3_TXD,
0025     GPIO9_UART3_RXD,
0026     GPIO1O_UART3_CTS,
0027     GPIO11_UART3_RTS,
0028 
0029     /* USB OTG PEN */
0030     GPIO18_GPIO,
0031 
0032     /* MMC2 */
0033     GPIO28_MMC2_CMD,
0034     GPIO29_MMC2_CLK,
0035     GPIO30_MMC2_DAT0,
0036     GPIO31_MMC2_DAT1,
0037     GPIO32_MMC2_DAT2,
0038     GPIO33_MMC2_DAT3,
0039 
0040     /* LCD & HDMI clock selection GPIO: 0: 74.176MHz, 1: 74.25 MHz */
0041     GPIO35_GPIO,
0042     GPIO36_GPIO, /* CEC Interrupt */
0043 
0044     /* MMC1 */
0045     GPIO43_MMC1_CLK,
0046     GPIO49_MMC1_CMD,
0047     GPIO41_MMC1_DAT0,
0048     GPIO40_MMC1_DAT1,
0049     GPIO52_MMC1_DAT2,
0050     GPIO51_MMC1_DAT3,
0051     GPIO53_MMC1_CD,
0052 
0053     /* LCD */
0054     GPIO56_LCD_FCLK_RD,
0055     GPIO57_LCD_LCLK_A0,
0056     GPIO58_LCD_PCLK_WR,
0057     GPIO59_LCD_DENA_BIAS,
0058     GPIO60_LCD_DD0,
0059     GPIO61_LCD_DD1,
0060     GPIO62_LCD_DD2,
0061     GPIO63_LCD_DD3,
0062     GPIO64_LCD_DD4,
0063     GPIO65_LCD_DD5,
0064     GPIO66_LCD_DD6,
0065     GPIO67_LCD_DD7,
0066     GPIO68_LCD_DD8,
0067     GPIO69_LCD_DD9,
0068     GPIO70_LCD_DD10,
0069     GPIO71_LCD_DD11,
0070     GPIO72_LCD_DD12,
0071     GPIO73_LCD_DD13,
0072     GPIO74_LCD_DD14,
0073     GPIO75_LCD_DD15,
0074     GPIO76_LCD_DD16,
0075     GPIO77_LCD_DD17,
0076     GPIO78_LCD_DD18,
0077     GPIO79_LCD_DD19,
0078     GPIO80_LCD_DD20,
0079     GPIO81_LCD_DD21,
0080     GPIO82_LCD_DD22,
0081     GPIO83_LCD_DD23,
0082 
0083     /* GPIO */
0084     GPIO84_GPIO,
0085     GPIO85_GPIO,
0086 
0087     /* Fast-Ethernet*/
0088     GPIO86_TX_CLK,
0089     GPIO87_TX_EN,
0090     GPIO88_TX_DQ3,
0091     GPIO89_TX_DQ2,
0092     GPIO90_TX_DQ1,
0093     GPIO91_TX_DQ0,
0094     GPIO92_MII_CRS,
0095     GPIO93_MII_COL,
0096     GPIO94_RX_CLK,
0097     GPIO95_RX_ER,
0098     GPIO96_RX_DQ3,
0099     GPIO97_RX_DQ2,
0100     GPIO98_RX_DQ1,
0101     GPIO99_RX_DQ0,
0102     GPIO100_MII_MDC,
0103     GPIO101_MII_MDIO,
0104     GPIO103_RX_DV,
0105     GPIO104_GPIO,     /* Reset PHY */
0106 
0107     /* RTC interrupt */
0108     GPIO102_GPIO,
0109 
0110     /* I2C */
0111     GPIO105_CI2C_SDA,
0112     GPIO106_CI2C_SCL,
0113 
0114     /* SPI NOR Flash on SSP2 */
0115     GPIO107_SSP2_RXD,
0116     GPIO108_SSP2_TXD,
0117     GPIO110_GPIO,     /* SPI_CSn */
0118     GPIO111_SSP2_CLK,
0119 
0120     /* Select JTAG */
0121     GPIO109_GPIO,
0122 
0123     /* I2S */
0124     GPIO114_I2S_FRM,
0125     GPIO115_I2S_BCLK,
0126     GPIO116_I2S_TXD
0127 };
0128 
0129 static struct pxa_gpio_platform_data pxa168_gpio_pdata = {
0130     .irq_base   = MMP_GPIO_TO_IRQ(0),
0131 };
0132 
0133 static struct i2c_board_info gplugd_i2c_board_info[] = {
0134     {
0135         .type = "isl1208",
0136         .addr = 0x6F,
0137     }
0138 };
0139 
0140 /* Bring PHY out of reset by setting GPIO 104 */
0141 static int gplugd_eth_init(void)
0142 {
0143     if (unlikely(gpio_request(104, "ETH_RESET_N"))) {
0144         printk(KERN_ERR "Can't get hold of GPIO 104 to bring Ethernet "
0145                 "PHY out of reset\n");
0146         return -EIO;
0147     }
0148 
0149     gpio_direction_output(104, 1);
0150     gpio_free(104);
0151     return 0;
0152 }
0153 
0154 struct pxa168_eth_platform_data gplugd_eth_platform_data = {
0155     .port_number = 0,
0156     .phy_addr    = 0,
0157     .speed       = 0, /* Autonagotiation */
0158     .intf        = PHY_INTERFACE_MODE_RMII,
0159     .init        = gplugd_eth_init,
0160 };
0161 
0162 static void __init select_disp_freq(void)
0163 {
0164     /* set GPIO 35 & clear GPIO 85 to set LCD External Clock to 74.25 MHz */
0165     if (unlikely(gpio_request(35, "DISP_FREQ_SEL"))) {
0166         printk(KERN_ERR "Can't get hold of GPIO 35 to select display "
0167                 "frequency\n");
0168     } else {
0169         gpio_direction_output(35, 1);
0170         gpio_free(35);
0171     }
0172 
0173     if (unlikely(gpio_request(85, "DISP_FREQ_SEL_2"))) {
0174         printk(KERN_ERR "Can't get hold of GPIO 85 to select display "
0175                 "frequency\n");
0176     } else {
0177         gpio_direction_output(85, 0);
0178         gpio_free(85);
0179     }
0180 }
0181 
0182 static void __init gplugd_init(void)
0183 {
0184     mfp_config(ARRAY_AND_SIZE(gplugd_pin_config));
0185 
0186     select_disp_freq();
0187 
0188     /* on-chip devices */
0189     pxa168_add_uart(3);
0190     pxa168_add_ssp(1);
0191     pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info));
0192     platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
0193                  sizeof(struct pxa_gpio_platform_data));
0194     platform_device_register(&pxa168_device_gpio);
0195 
0196     pxa168_add_eth(&gplugd_eth_platform_data);
0197 }
0198 
0199 MACHINE_START(GPLUGD, "PXA168-based GuruPlug Display (gplugD) Platform")
0200     .map_io     = mmp_map_io,
0201     .nr_irqs    = MMP_NR_IRQS,
0202     .init_irq       = pxa168_init_irq,
0203     .init_time  = pxa168_timer_init,
0204     .init_machine   = gplugd_init,
0205     .restart    = pxa168_restart,
0206 MACHINE_END