Andreas Fenkart | 55143438 | 2014-11-08 15:33:09 +0100 | [diff] [blame] | 1 | /* |
| 2 | * MMC definitions for OMAP2 |
| 3 | * |
| 4 | * Copyright (C) 2006 Nokia Corporation |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | |
Andreas Fenkart | 55143438 | 2014-11-08 15:33:09 +0100 | [diff] [blame] | 11 | /* |
| 12 | * struct omap_hsmmc_dev_attr.flags possibilities |
| 13 | * |
| 14 | * OMAP_HSMMC_SUPPORTS_DUAL_VOLT: Some HSMMC controller instances can |
| 15 | * operate with either 1.8Vdc or 3.0Vdc card voltages; this flag |
| 16 | * should be set if this is the case. See for example Section 22.5.3 |
| 17 | * "MMC/SD/SDIO1 Bus Voltage Selection" of the OMAP34xx Multimedia |
| 18 | * Device Silicon Revision 3.1.x Revision ZR (July 2011) (SWPU223R). |
| 19 | * |
| 20 | * OMAP_HSMMC_BROKEN_MULTIBLOCK_READ: Multiple-block read transfers |
| 21 | * don't work correctly on some MMC controller instances on some |
| 22 | * OMAP3 SoCs; this flag should be set if this is the case. See |
| 23 | * for example Advisory 2.1.1.128 "MMC: Multiple Block Read |
| 24 | * Operation Issue" in _OMAP3530/3525/3515/3503 Silicon Errata_ |
| 25 | * Revision F (October 2010) (SPRZ278F). |
| 26 | */ |
| 27 | #define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0) |
| 28 | #define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1) |
| 29 | #define OMAP_HSMMC_SWAKEUP_MISSING BIT(2) |
| 30 | |
| 31 | struct omap_hsmmc_dev_attr { |
| 32 | u8 flags; |
| 33 | }; |
| 34 | |
| 35 | struct mmc_card; |
| 36 | |
| 37 | struct omap_hsmmc_platform_data { |
| 38 | /* back-link to device */ |
| 39 | struct device *dev; |
| 40 | |
| 41 | /* number of slots per controller */ |
| 42 | unsigned nr_slots:2; |
| 43 | |
| 44 | /* set if your board has components or wiring that limits the |
| 45 | * maximum frequency on the MMC bus */ |
| 46 | unsigned int max_freq; |
| 47 | |
Andreas Fenkart | 55143438 | 2014-11-08 15:33:09 +0100 | [diff] [blame] | 48 | /* To handle board related suspend/resume functionality for MMC */ |
| 49 | int (*suspend)(struct device *dev, int slot); |
| 50 | int (*resume)(struct device *dev, int slot); |
| 51 | |
Andreas Fenkart | 55143438 | 2014-11-08 15:33:09 +0100 | [diff] [blame] | 52 | /* Integrating attributes from the omap_hwmod layer */ |
| 53 | u8 controller_flags; |
| 54 | |
| 55 | /* Register offset deviation */ |
| 56 | u16 reg_offset; |
| 57 | |
Andreas Fenkart | 326119c | 2014-11-08 15:33:14 +0100 | [diff] [blame^] | 58 | /* |
| 59 | * 4/8 wires and any additional host capabilities |
| 60 | * need to OR'd all capabilities (ref. linux/mmc/host.h) |
| 61 | */ |
| 62 | u32 caps; /* Used for the MMC driver on 2430 and later */ |
| 63 | u32 pm_caps; /* PM capabilities of the mmc */ |
Andreas Fenkart | 55143438 | 2014-11-08 15:33:09 +0100 | [diff] [blame] | 64 | |
Andreas Fenkart | 326119c | 2014-11-08 15:33:14 +0100 | [diff] [blame^] | 65 | /* switch pin can be for card detect (default) or card cover */ |
| 66 | unsigned cover:1; |
Andreas Fenkart | 55143438 | 2014-11-08 15:33:09 +0100 | [diff] [blame] | 67 | |
Andreas Fenkart | 326119c | 2014-11-08 15:33:14 +0100 | [diff] [blame^] | 68 | /* use the internal clock */ |
| 69 | unsigned internal_clock:1; |
Andreas Fenkart | 55143438 | 2014-11-08 15:33:09 +0100 | [diff] [blame] | 70 | |
Andreas Fenkart | 326119c | 2014-11-08 15:33:14 +0100 | [diff] [blame^] | 71 | /* nonremovable e.g. eMMC */ |
| 72 | unsigned nonremovable:1; |
Andreas Fenkart | 55143438 | 2014-11-08 15:33:09 +0100 | [diff] [blame] | 73 | |
Andreas Fenkart | 326119c | 2014-11-08 15:33:14 +0100 | [diff] [blame^] | 74 | /* eMMC does not handle power off when not in sleep state */ |
| 75 | unsigned no_regulator_off_init:1; |
Andreas Fenkart | 55143438 | 2014-11-08 15:33:09 +0100 | [diff] [blame] | 76 | |
Andreas Fenkart | 326119c | 2014-11-08 15:33:14 +0100 | [diff] [blame^] | 77 | /* we can put the features above into this variable */ |
Andreas Fenkart | 55143438 | 2014-11-08 15:33:09 +0100 | [diff] [blame] | 78 | #define HSMMC_HAS_PBIAS (1 << 0) |
| 79 | #define HSMMC_HAS_UPDATED_RESET (1 << 1) |
| 80 | #define HSMMC_HAS_HSPE_SUPPORT (1 << 2) |
Andreas Fenkart | 326119c | 2014-11-08 15:33:14 +0100 | [diff] [blame^] | 81 | unsigned features; |
Andreas Fenkart | 55143438 | 2014-11-08 15:33:09 +0100 | [diff] [blame] | 82 | |
Andreas Fenkart | 326119c | 2014-11-08 15:33:14 +0100 | [diff] [blame^] | 83 | int switch_pin; /* gpio (card detect) */ |
| 84 | int gpio_wp; /* gpio (write protect) */ |
Andreas Fenkart | 55143438 | 2014-11-08 15:33:09 +0100 | [diff] [blame] | 85 | |
Andreas Fenkart | 326119c | 2014-11-08 15:33:14 +0100 | [diff] [blame^] | 86 | int (*set_power)(struct device *dev, int slot, |
| 87 | int power_on, int vdd); |
| 88 | int (*get_ro)(struct device *dev, int slot); |
| 89 | void (*remux)(struct device *dev, int slot, int power_on); |
| 90 | /* Call back before enabling / disabling regulators */ |
| 91 | void (*before_set_reg)(struct device *dev, int slot, |
| 92 | int power_on, int vdd); |
| 93 | /* Call back after enabling / disabling regulators */ |
| 94 | void (*after_set_reg)(struct device *dev, int slot, |
| 95 | int power_on, int vdd); |
| 96 | /* if we have special card, init it using this callback */ |
| 97 | void (*init_card)(struct mmc_card *card); |
Andreas Fenkart | 55143438 | 2014-11-08 15:33:09 +0100 | [diff] [blame] | 98 | |
Andreas Fenkart | 326119c | 2014-11-08 15:33:14 +0100 | [diff] [blame^] | 99 | /* return MMC cover switch state, can be NULL if not supported. |
| 100 | * |
| 101 | * possible return values: |
| 102 | * 0 - closed |
| 103 | * 1 - open |
| 104 | */ |
| 105 | int (*get_cover_state)(struct device *dev, int slot); |
Andreas Fenkart | 55143438 | 2014-11-08 15:33:09 +0100 | [diff] [blame] | 106 | |
Andreas Fenkart | 326119c | 2014-11-08 15:33:14 +0100 | [diff] [blame^] | 107 | const char *name; |
| 108 | u32 ocr_mask; |
Andreas Fenkart | 55143438 | 2014-11-08 15:33:09 +0100 | [diff] [blame] | 109 | |
Andreas Fenkart | 326119c | 2014-11-08 15:33:14 +0100 | [diff] [blame^] | 110 | /* Card detection IRQs */ |
| 111 | int card_detect_irq; |
Andreas Fenkart | 55143438 | 2014-11-08 15:33:09 +0100 | [diff] [blame] | 112 | |
Andreas Fenkart | 326119c | 2014-11-08 15:33:14 +0100 | [diff] [blame^] | 113 | int (*card_detect)(struct device *dev, int slot); |
Andreas Fenkart | 55143438 | 2014-11-08 15:33:09 +0100 | [diff] [blame] | 114 | }; |