root/arch/arm/mach-pxa/colibri-evalboard.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. colibri_mmc_init
  2. colibri_mmc_init
  3. colibri_ohci_init
  4. colibri_uhc_init
  5. colibri_uhc_init
  6. colibri_rtc_init
  7. colibri_rtc_init
  8. colibri_evalboard_init

   1 // SPDX-License-Identifier: GPL-2.0-only
   2 /*
   3  *  linux/arch/arm/mach-pxa/colibri-evalboard.c
   4  *
   5  *  Support for Toradex Colibri Evaluation Carrier Board
   6  *  Daniel Mack <daniel@caiaq.de>
   7  *  Marek Vasut <marek.vasut@gmail.com>
   8  */
   9 
  10 #include <linux/init.h>
  11 #include <linux/kernel.h>
  12 #include <linux/platform_device.h>
  13 #include <linux/interrupt.h>
  14 #include <linux/gpio/machine.h>
  15 #include <asm/mach-types.h>
  16 #include <mach/hardware.h>
  17 #include <asm/mach/arch.h>
  18 #include <linux/i2c.h>
  19 #include <linux/platform_data/i2c-pxa.h>
  20 #include <asm/io.h>
  21 
  22 #include "pxa27x.h"
  23 #include "colibri.h"
  24 #include <linux/platform_data/mmc-pxamci.h>
  25 #include <linux/platform_data/usb-ohci-pxa27x.h>
  26 #include "pxa27x-udc.h"
  27 
  28 #include "generic.h"
  29 #include "devices.h"
  30 
  31 /******************************************************************************
  32  * SD/MMC card controller
  33  ******************************************************************************/
  34 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
  35 static struct pxamci_platform_data colibri_mci_platform_data = {
  36         .ocr_mask               = MMC_VDD_32_33 | MMC_VDD_33_34,
  37         .detect_delay_ms        = 200,
  38 };
  39 
  40 static struct gpiod_lookup_table colibri_pxa270_mci_gpio_table = {
  41         .dev_id = "pxa2xx-mci.0",
  42         .table = {
  43                 GPIO_LOOKUP("gpio-pxa", GPIO0_COLIBRI_PXA270_SD_DETECT,
  44                             "cd", GPIO_ACTIVE_LOW),
  45                 { },
  46         },
  47 };
  48 
  49 static struct gpiod_lookup_table colibri_pxa300_mci_gpio_table = {
  50         .dev_id = "pxa2xx-mci.0",
  51         .table = {
  52                 GPIO_LOOKUP("gpio-pxa", GPIO13_COLIBRI_PXA300_SD_DETECT,
  53                             "cd", GPIO_ACTIVE_LOW),
  54                 { },
  55         },
  56 };
  57 
  58 static struct gpiod_lookup_table colibri_pxa320_mci_gpio_table = {
  59         .dev_id = "pxa2xx-mci.0",
  60         .table = {
  61                 GPIO_LOOKUP("gpio-pxa", GPIO28_COLIBRI_PXA320_SD_DETECT,
  62                             "cd", GPIO_ACTIVE_LOW),
  63                 { },
  64         },
  65 };
  66 
  67 static void __init colibri_mmc_init(void)
  68 {
  69         if (machine_is_colibri())       /* PXA270 Colibri */
  70                 gpiod_add_lookup_table(&colibri_pxa270_mci_gpio_table);
  71         if (machine_is_colibri300())    /* PXA300 Colibri */
  72                 gpiod_add_lookup_table(&colibri_pxa300_mci_gpio_table);
  73         else                            /* PXA320 Colibri */
  74                 gpiod_add_lookup_table(&colibri_pxa320_mci_gpio_table);
  75 
  76         pxa_set_mci_info(&colibri_mci_platform_data);
  77 }
  78 #else
  79 static inline void colibri_mmc_init(void) {}
  80 #endif
  81 
  82 /******************************************************************************
  83  * USB Host
  84  ******************************************************************************/
  85 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
  86 static int colibri_ohci_init(struct device *dev)
  87 {
  88         UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
  89         return 0;
  90 }
  91 
  92 static struct pxaohci_platform_data colibri_ohci_info = {
  93         .port_mode      = PMM_PERPORT_MODE,
  94         .flags          = ENABLE_PORT1 |
  95                           POWER_CONTROL_LOW | POWER_SENSE_LOW,
  96         .init           = colibri_ohci_init,
  97 };
  98 
  99 static void __init colibri_uhc_init(void)
 100 {
 101         /* Colibri PXA270 has two usb ports, TBA for 320 */
 102         if (machine_is_colibri())
 103                 colibri_ohci_info.flags |= ENABLE_PORT2;
 104 
 105         pxa_set_ohci_info(&colibri_ohci_info);
 106 }
 107 #else
 108 static inline void colibri_uhc_init(void) {}
 109 #endif
 110 
 111 /******************************************************************************
 112  * I2C RTC
 113  ******************************************************************************/
 114 #if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
 115 static struct i2c_board_info __initdata colibri_i2c_devs[] = {
 116         {
 117                 I2C_BOARD_INFO("m41t00", 0x68),
 118         },
 119 };
 120 
 121 static void __init colibri_rtc_init(void)
 122 {
 123         pxa_set_i2c_info(NULL);
 124         i2c_register_board_info(0, ARRAY_AND_SIZE(colibri_i2c_devs));
 125 }
 126 #else
 127 static inline void colibri_rtc_init(void) {}
 128 #endif
 129 
 130 void __init colibri_evalboard_init(void)
 131 {
 132         pxa_set_ffuart_info(NULL);
 133         pxa_set_btuart_info(NULL);
 134         pxa_set_stuart_info(NULL);
 135 
 136         colibri_mmc_init();
 137         colibri_uhc_init();
 138         colibri_rtc_init();
 139 }

/* [<][>][^][v][top][bottom][index][help] */