Commit e3913f56a26dbb49758370320dac477ab0324631
Committed by
Tom Rini
1 parent
d23d8d7e06
Exists in
master
and in
53 other branches
omap_hsmmc: add driver check for write protection
Add check for write protection in omap mmc driver. Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il> Reviewed-by: Tom Rini <trini@ti.com>
Showing 28 changed files with 47 additions and 36 deletions Side-by-side Diff
- arch/arm/cpu/armv7/am33xx/board.c
- arch/arm/cpu/armv7/omap-common/boot-common.c
- arch/arm/cpu/armv7/omap3/board.c
- arch/arm/include/asm/omap_mmc.h
- board/cm_t35/cm_t35.c
- board/comelit/dig297/dig297.c
- board/corscience/tricorder/tricorder.c
- board/htkw/mcx/mcx.c
- board/isee/igep00x0/igep00x0.c
- board/logicpd/am3517evm/am3517evm.c
- board/logicpd/omap3som/omap3logic.c
- board/logicpd/zoom1/zoom1.c
- board/logicpd/zoom2/zoom2.c
- board/matrix_vision/mvblx/mvblx.c
- board/nokia/rx51/rx51.c
- board/overo/overo.c
- board/pandora/pandora.c
- board/technexion/twister/twister.c
- board/teejet/mt_ventoux/mt_ventoux.c
- board/ti/am3517crane/am3517crane.c
- board/ti/beagle/beagle.c
- board/ti/evm/evm.c
- board/ti/omap5_evm/evm.c
- board/ti/panda/panda.c
- board/ti/sdp3430/sdp.c
- board/ti/sdp4430/sdp.c
- board/timll/devkit8000/devkit8000.c
- drivers/mmc/omap_hsmmc.c
arch/arm/cpu/armv7/am33xx/board.c
arch/arm/cpu/armv7/omap-common/boot-common.c
... | ... | @@ -64,11 +64,11 @@ |
64 | 64 | { |
65 | 65 | switch (spl_boot_device()) { |
66 | 66 | case BOOT_DEVICE_MMC1: |
67 | - omap_mmc_init(0, 0, 0, -1); | |
67 | + omap_mmc_init(0, 0, 0, -1, -1); | |
68 | 68 | break; |
69 | 69 | case BOOT_DEVICE_MMC2: |
70 | 70 | case BOOT_DEVICE_MMC2_2: |
71 | - omap_mmc_init(1, 0, 0, -1); | |
71 | + omap_mmc_init(1, 0, 0, -1, -1); | |
72 | 72 | break; |
73 | 73 | } |
74 | 74 | return 0; |
arch/arm/cpu/armv7/omap3/board.c
... | ... | @@ -98,11 +98,11 @@ |
98 | 98 | { |
99 | 99 | switch (spl_boot_device()) { |
100 | 100 | case BOOT_DEVICE_MMC1: |
101 | - omap_mmc_init(0, 0, 0, -1); | |
101 | + omap_mmc_init(0, 0, 0, -1, -1); | |
102 | 102 | break; |
103 | 103 | case BOOT_DEVICE_MMC2: |
104 | 104 | case BOOT_DEVICE_MMC2_2: |
105 | - omap_mmc_init(1, 0, 0, -1); | |
105 | + omap_mmc_init(1, 0, 0, -1, -1); | |
106 | 106 | break; |
107 | 107 | } |
108 | 108 | return 0; |
arch/arm/include/asm/omap_mmc.h
... | ... | @@ -161,7 +161,8 @@ |
161 | 161 | #define mmc_reg_out(addr, mask, val)\ |
162 | 162 | writel((readl(addr) & (~(mask))) | ((val) & (mask)), (addr)) |
163 | 163 | |
164 | -int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio); | |
164 | +int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio, | |
165 | + int wp_gpio); | |
165 | 166 | |
166 | 167 | |
167 | 168 | #endif /* OMAP_MMC_H_ */ |
board/cm_t35/cm_t35.c
board/comelit/dig297/dig297.c
board/corscience/tricorder/tricorder.c
board/htkw/mcx/mcx.c
board/isee/igep00x0/igep00x0.c
board/logicpd/am3517evm/am3517evm.c
board/logicpd/omap3som/omap3logic.c
board/logicpd/zoom1/zoom1.c
board/logicpd/zoom2/zoom2.c
board/matrix_vision/mvblx/mvblx.c
board/nokia/rx51/rx51.c
board/overo/overo.c
board/pandora/pandora.c
board/technexion/twister/twister.c
board/teejet/mt_ventoux/mt_ventoux.c
board/ti/am3517crane/am3517crane.c
board/ti/beagle/beagle.c
board/ti/evm/evm.c
board/ti/omap5_evm/evm.c
... | ... | @@ -94,8 +94,8 @@ |
94 | 94 | #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_GENERIC_MMC) |
95 | 95 | int board_mmc_init(bd_t *bis) |
96 | 96 | { |
97 | - omap_mmc_init(0, 0, 0, -1); | |
98 | - omap_mmc_init(1, 0, 0, -1); | |
97 | + omap_mmc_init(0, 0, 0, -1, -1); | |
98 | + omap_mmc_init(1, 0, 0, -1, -1); | |
99 | 99 | return 0; |
100 | 100 | } |
101 | 101 | #endif |
board/ti/panda/panda.c
board/ti/sdp3430/sdp.c
board/ti/sdp4430/sdp.c
... | ... | @@ -108,8 +108,8 @@ |
108 | 108 | #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_GENERIC_MMC) |
109 | 109 | int board_mmc_init(bd_t *bis) |
110 | 110 | { |
111 | - omap_mmc_init(0, 0, 0, -1); | |
112 | - omap_mmc_init(1, 0, 0, -1); | |
111 | + omap_mmc_init(0, 0, 0, -1, -1); | |
112 | + omap_mmc_init(1, 0, 0, -1, -1); | |
113 | 113 | return 0; |
114 | 114 | } |
115 | 115 | #endif |
board/timll/devkit8000/devkit8000.c
drivers/mmc/omap_hsmmc.c
... | ... | @@ -42,6 +42,7 @@ |
42 | 42 | struct omap_hsmmc_data { |
43 | 43 | struct hsmmc *base_addr; |
44 | 44 | int cd_gpio; |
45 | + int wp_gpio; | |
45 | 46 | }; |
46 | 47 | |
47 | 48 | /* If we fail after 1 second wait, something is really bad */ |
... | ... | @@ -74,6 +75,12 @@ |
74 | 75 | int cd_gpio = ((struct omap_hsmmc_data *)mmc->priv)->cd_gpio; |
75 | 76 | return gpio_get_value(cd_gpio); |
76 | 77 | } |
78 | + | |
79 | +static int omap_mmc_getwp(struct mmc *mmc) | |
80 | +{ | |
81 | + int wp_gpio = ((struct omap_hsmmc_data *)mmc->priv)->wp_gpio; | |
82 | + return gpio_get_value(wp_gpio); | |
83 | +} | |
77 | 84 | #else |
78 | 85 | static inline int omap_mmc_setup_gpio_in(int gpio, const char *label) |
79 | 86 | { |
... | ... | @@ -81,6 +88,7 @@ |
81 | 88 | } |
82 | 89 | |
83 | 90 | #define omap_mmc_getcd NULL |
91 | +#define omap_mmc_getwp NULL | |
84 | 92 | #endif |
85 | 93 | |
86 | 94 | #if defined(CONFIG_OMAP44XX) && defined(CONFIG_TWL6030_POWER) |
... | ... | @@ -580,7 +588,8 @@ |
580 | 588 | writel(readl(&mmc_base->sysctl) | CEN_ENABLE, &mmc_base->sysctl); |
581 | 589 | } |
582 | 590 | |
583 | -int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio) | |
591 | +int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio, | |
592 | + int wp_gpio) | |
584 | 593 | { |
585 | 594 | struct mmc *mmc = &hsmmc_dev[dev_index]; |
586 | 595 | struct omap_hsmmc_data *priv_data = &hsmmc_dev_data[dev_index]; |
... | ... | @@ -590,7 +599,7 @@ |
590 | 599 | mmc->set_ios = mmc_set_ios; |
591 | 600 | mmc->init = mmc_init_setup; |
592 | 601 | mmc->getcd = omap_mmc_getcd; |
593 | - mmc->getwp = NULL; | |
602 | + mmc->getwp = omap_mmc_getwp; | |
594 | 603 | mmc->priv = priv_data; |
595 | 604 | |
596 | 605 | switch (dev_index) { |
... | ... | @@ -612,6 +621,7 @@ |
612 | 621 | return 1; |
613 | 622 | } |
614 | 623 | priv_data->cd_gpio = omap_mmc_setup_gpio_in(cd_gpio, "mmc_cd"); |
624 | + priv_data->wp_gpio = omap_mmc_setup_gpio_in(wp_gpio, "mmc_wp"); | |
615 | 625 | mmc->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195; |
616 | 626 | mmc->host_caps = (MMC_MODE_4BIT | MMC_MODE_HS_52MHz | MMC_MODE_HS | |
617 | 627 | MMC_MODE_HC) & ~host_caps_mask; |