@@ -198,7 +198,6 @@ struct omap_hsmmc_host {
198
198
struct dma_chan * rx_chan ;
199
199
int response_busy ;
200
200
int context_loss ;
201
- int protect_card ;
202
201
int reqs_blocked ;
203
202
int req_in_progress ;
204
203
unsigned long clk_rate ;
@@ -207,15 +206,6 @@ struct omap_hsmmc_host {
207
206
#define HSMMC_SDIO_IRQ_ENABLED (1 << 1) /* SDIO irq enabled */
208
207
struct omap_hsmmc_next next_data ;
209
208
struct omap_hsmmc_platform_data * pdata ;
210
-
211
- /* return MMC cover switch state, can be NULL if not supported.
212
- *
213
- * possible return values:
214
- * 0 - closed
215
- * 1 - open
216
- */
217
- int (* get_cover_state )(struct device * dev );
218
-
219
209
int (* card_detect )(struct device * dev );
220
210
};
221
211
@@ -233,13 +223,6 @@ static int omap_hsmmc_card_detect(struct device *dev)
233
223
return mmc_gpio_get_cd (host -> mmc );
234
224
}
235
225
236
- static int omap_hsmmc_get_cover_state (struct device * dev )
237
- {
238
- struct omap_hsmmc_host * host = dev_get_drvdata (dev );
239
-
240
- return mmc_gpio_get_cd (host -> mmc );
241
- }
242
-
243
226
static int omap_hsmmc_enable_supply (struct mmc_host * mmc )
244
227
{
245
228
int ret ;
@@ -484,22 +467,13 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
484
467
return 0 ;
485
468
}
486
469
487
- static irqreturn_t omap_hsmmc_cover_irq (int irq , void * dev_id );
488
-
489
470
static int omap_hsmmc_gpio_init (struct mmc_host * mmc ,
490
471
struct omap_hsmmc_host * host ,
491
472
struct omap_hsmmc_platform_data * pdata )
492
473
{
493
474
int ret ;
494
475
495
- if (gpio_is_valid (pdata -> gpio_cod )) {
496
- ret = mmc_gpio_request_cd (mmc , pdata -> gpio_cod , 0 );
497
- if (ret )
498
- return ret ;
499
-
500
- host -> get_cover_state = omap_hsmmc_get_cover_state ;
501
- mmc_gpio_set_cd_isr (mmc , omap_hsmmc_cover_irq );
502
- } else if (gpio_is_valid (pdata -> gpio_cd )) {
476
+ if (gpio_is_valid (pdata -> gpio_cd )) {
503
477
ret = mmc_gpio_request_cd (mmc , pdata -> gpio_cd , 0 );
504
478
if (ret )
505
479
return ret ;
@@ -781,9 +755,6 @@ static void send_init_stream(struct omap_hsmmc_host *host)
781
755
int reg = 0 ;
782
756
unsigned long timeout ;
783
757
784
- if (host -> protect_card )
785
- return ;
786
-
787
758
disable_irq (host -> irq );
788
759
789
760
OMAP_HSMMC_WRITE (host -> base , IE , INT_EN_MASK );
@@ -804,29 +775,6 @@ static void send_init_stream(struct omap_hsmmc_host *host)
804
775
enable_irq (host -> irq );
805
776
}
806
777
807
- static inline
808
- int omap_hsmmc_cover_is_closed (struct omap_hsmmc_host * host )
809
- {
810
- int r = 1 ;
811
-
812
- if (host -> get_cover_state )
813
- r = host -> get_cover_state (host -> dev );
814
- return r ;
815
- }
816
-
817
- static ssize_t
818
- omap_hsmmc_show_cover_switch (struct device * dev , struct device_attribute * attr ,
819
- char * buf )
820
- {
821
- struct mmc_host * mmc = container_of (dev , struct mmc_host , class_dev );
822
- struct omap_hsmmc_host * host = mmc_priv (mmc );
823
-
824
- return sprintf (buf , "%s\n" ,
825
- omap_hsmmc_cover_is_closed (host ) ? "closed" : "open" );
826
- }
827
-
828
- static DEVICE_ATTR (cover_switch , S_IRUGO , omap_hsmmc_show_cover_switch , NULL) ;
829
-
830
778
static ssize_t
831
779
omap_hsmmc_show_slot_name (struct device * dev , struct device_attribute * attr ,
832
780
char * buf )
@@ -1247,44 +1195,6 @@ static int omap_hsmmc_switch_opcond(struct omap_hsmmc_host *host, int vdd)
1247
1195
return ret ;
1248
1196
}
1249
1197
1250
- /* Protect the card while the cover is open */
1251
- static void omap_hsmmc_protect_card (struct omap_hsmmc_host * host )
1252
- {
1253
- if (!host -> get_cover_state )
1254
- return ;
1255
-
1256
- host -> reqs_blocked = 0 ;
1257
- if (host -> get_cover_state (host -> dev )) {
1258
- if (host -> protect_card ) {
1259
- dev_info (host -> dev , "%s: cover is closed, "
1260
- "card is now accessible\n" ,
1261
- mmc_hostname (host -> mmc ));
1262
- host -> protect_card = 0 ;
1263
- }
1264
- } else {
1265
- if (!host -> protect_card ) {
1266
- dev_info (host -> dev , "%s: cover is open, "
1267
- "card is now inaccessible\n" ,
1268
- mmc_hostname (host -> mmc ));
1269
- host -> protect_card = 1 ;
1270
- }
1271
- }
1272
- }
1273
-
1274
- /*
1275
- * irq handler when (cell-phone) cover is mounted/removed
1276
- */
1277
- static irqreturn_t omap_hsmmc_cover_irq (int irq , void * dev_id )
1278
- {
1279
- struct omap_hsmmc_host * host = dev_id ;
1280
-
1281
- sysfs_notify (& host -> mmc -> class_dev .kobj , NULL , "cover_switch" );
1282
-
1283
- omap_hsmmc_protect_card (host );
1284
- mmc_detect_change (host -> mmc , (HZ * 200 ) / 1000 );
1285
- return IRQ_HANDLED ;
1286
- }
1287
-
1288
1198
static void omap_hsmmc_dma_callback (void * param )
1289
1199
{
1290
1200
struct omap_hsmmc_host * host = param ;
@@ -1555,24 +1465,7 @@ static void omap_hsmmc_request(struct mmc_host *mmc, struct mmc_request *req)
1555
1465
1556
1466
BUG_ON (host -> req_in_progress );
1557
1467
BUG_ON (host -> dma_ch != -1 );
1558
- if (host -> protect_card ) {
1559
- if (host -> reqs_blocked < 3 ) {
1560
- /*
1561
- * Ensure the controller is left in a consistent
1562
- * state by resetting the command and data state
1563
- * machines.
1564
- */
1565
- omap_hsmmc_reset_controller_fsm (host , SRD );
1566
- omap_hsmmc_reset_controller_fsm (host , SRC );
1567
- host -> reqs_blocked += 1 ;
1568
- }
1569
- req -> cmd -> error = - EBADF ;
1570
- if (req -> data )
1571
- req -> data -> error = - EBADF ;
1572
- req -> cmd -> retries = 0 ;
1573
- mmc_request_done (mmc , req );
1574
- return ;
1575
- } else if (host -> reqs_blocked )
1468
+ if (host -> reqs_blocked )
1576
1469
host -> reqs_blocked = 0 ;
1577
1470
WARN_ON (host -> mrq != NULL );
1578
1471
host -> mrq = req ;
@@ -1921,7 +1814,6 @@ static struct omap_hsmmc_platform_data *of_get_hsmmc_pdata(struct device *dev)
1921
1814
pdata -> controller_flags |= OMAP_HSMMC_SUPPORTS_DUAL_VOLT ;
1922
1815
1923
1816
pdata -> gpio_cd = - EINVAL ;
1924
- pdata -> gpio_cod = - EINVAL ;
1925
1817
pdata -> gpio_wp = - EINVAL ;
1926
1818
1927
1819
if (of_find_property (np , "ti,non-removable" , NULL )) {
@@ -2125,21 +2017,13 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
2125
2017
if (!ret )
2126
2018
mmc -> caps |= MMC_CAP_SDIO_IRQ ;
2127
2019
2128
- omap_hsmmc_protect_card (host );
2129
-
2130
2020
mmc_add_host (mmc );
2131
2021
2132
2022
if (mmc_pdata (host )-> name != NULL ) {
2133
2023
ret = device_create_file (& mmc -> class_dev , & dev_attr_slot_name );
2134
2024
if (ret < 0 )
2135
2025
goto err_slot_name ;
2136
2026
}
2137
- if (host -> get_cover_state ) {
2138
- ret = device_create_file (& mmc -> class_dev ,
2139
- & dev_attr_cover_switch );
2140
- if (ret < 0 )
2141
- goto err_slot_name ;
2142
- }
2143
2027
2144
2028
omap_hsmmc_debugfs (mmc );
2145
2029
pm_runtime_mark_last_busy (host -> dev );
@@ -2231,7 +2115,6 @@ static int omap_hsmmc_resume(struct device *dev)
2231
2115
if (!(host -> mmc -> pm_flags & MMC_PM_KEEP_POWER ))
2232
2116
omap_hsmmc_conf_bus_power (host );
2233
2117
2234
- omap_hsmmc_protect_card (host );
2235
2118
pm_runtime_mark_last_busy (host -> dev );
2236
2119
pm_runtime_put_autosuspend (host -> dev );
2237
2120
return 0 ;
0 commit comments