Skip to content

Commit a137980

Browse files
committed
desperately trying to sync up sdhc.c
1 parent 81cef8b commit a137980

File tree

2 files changed

+0
-152
lines changed

2 files changed

+0
-152
lines changed

sdhc.c

-54
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */
2-
31
/*
42
* Copyright (c) 2006 Uwe Stuehler <[email protected]>
53
* Copyright (c) 2009 Sven Peter <[email protected]>
@@ -22,16 +20,6 @@
2220
* Simplified Specification Version 1.00 (www.sdcard.com).
2321
*/
2422

25-
26-
#if 0
27-
#include <sys/param.h>
28-
#include <sys/device.h>
29-
#include <sys/kernel.h>
30-
#include <sys/kthread.h>
31-
#include <sys/malloc.h>
32-
#include <sys/systm.h>
33-
#endif
34-
3523
#include "bsdtypes.h"
3624
#include "sdhcreg.h"
3725
#include "sdhcvar.h"
@@ -107,18 +95,6 @@ static inline void bus_space_write_1(bus_space_handle_t ioh, u32 r, u8 v)
10795
mask32(addr & ~3, mask, v << shift);
10896
}
10997

110-
u32 splbio(void)
111-
{
112-
// irq_disable(IRQ_SDHC);
113-
return 0;
114-
}
115-
116-
void splx(u32 dummy)
117-
{
118-
(void)dummy;
119-
// irq_enable(IRQ_SDHC);
120-
}
121-
12298
/* flag values */
12399
#define SHF_USE_DMA 0x0001
124100

@@ -186,12 +162,6 @@ struct sdmmc_chip_functions sdhc_functions = {
186162
sdhc_card_intr_ack
187163
};
188164

189-
#if 0
190-
struct cfdriver sdhc_cd = {
191-
NULL, "sdhc", DV_DULL
192-
};
193-
#endif
194-
195165
/*
196166
* Called by attachment driver. For each SD card slot there is one SD
197167
* host controller standard register set. (1.3)
@@ -388,9 +358,6 @@ sdhc_host_reset(sdmmc_chipset_handle_t sch)
388358
struct sdhc_host *hp = sch;
389359
u_int16_t imask;
390360
int error;
391-
int s;
392-
393-
s = splsdmmc();
394361

395362
/* Disable all interrupts. */
396363
HWRITE2(hp, SDHC_NINTR_SIGNAL_EN, 0);
@@ -400,7 +367,6 @@ sdhc_host_reset(sdmmc_chipset_handle_t sch)
400367
* the controller to clear the reset bit.
401368
*/
402369
if ((error = sdhc_soft_reset(hp, SDHC_RESET_ALL)) != 0) {
403-
splx(s);
404370
return (error);
405371
}
406372

@@ -418,7 +384,6 @@ sdhc_host_reset(sdmmc_chipset_handle_t sch)
418384
HWRITE2(hp, SDHC_NINTR_SIGNAL_EN, imask);
419385
HWRITE2(hp, SDHC_EINTR_SIGNAL_EN, SDHC_EINTR_SIGNAL_MASK);
420386

421-
splx(s);
422387
return 0;
423388
}
424389

@@ -456,9 +421,6 @@ sdhc_bus_power(sdmmc_chipset_handle_t sch, u_int32_t ocr)
456421
{
457422
struct sdhc_host *hp = sch;
458423
u_int8_t vdd;
459-
int s;
460-
461-
s = splsdmmc();
462424

463425
/*
464426
* Disable bus power before voltage change.
@@ -468,7 +430,6 @@ sdhc_bus_power(sdmmc_chipset_handle_t sch, u_int32_t ocr)
468430

469431
/* If power is disabled, reset the host and return now. */
470432
if (ocr == 0) {
471-
splx(s);
472433
(void)sdhc_host_reset(hp);
473434
return 0;
474435
}
@@ -485,7 +446,6 @@ sdhc_bus_power(sdmmc_chipset_handle_t sch, u_int32_t ocr)
485446
vdd = SDHC_VOLTAGE_1_8V;
486447
else {
487448
/* Unsupported voltage level requested. */
488-
splx(s);
489449
return EINVAL;
490450
}
491451

@@ -503,11 +463,9 @@ sdhc_bus_power(sdmmc_chipset_handle_t sch, u_int32_t ocr)
503463
* bus power bit.
504464
*/
505465
if (!ISSET(HREAD1(hp, SDHC_POWER_CTL), SDHC_BUS_POWER)) {
506-
splx(s);
507466
return ENXIO;
508467
}
509468

510-
splx(s);
511469
return 0;
512470
}
513471

@@ -535,13 +493,10 @@ int
535493
sdhc_bus_clock(sdmmc_chipset_handle_t sch, int freq)
536494
{
537495
struct sdhc_host *hp = sch;
538-
int s;
539496
int div;
540497
int timo;
541498
int error = 0;
542499

543-
s = splsdmmc();
544-
545500
#ifdef DIAGNOSTIC
546501
/* Must not stop the clock if commands are in progress. */
547502
if (ISSET(HREAD4(hp, SDHC_PRESENT_STATE), SDHC_CMD_INHIBIT_MASK) &&
@@ -586,7 +541,6 @@ sdhc_bus_clock(sdmmc_chipset_handle_t sch, int freq)
586541
HSET2(hp, SDHC_CLOCK_CTL, SDHC_SDCLK_ENABLE);
587542

588543
ret:
589-
splx(s);
590544
return error;
591545
}
592546

@@ -695,7 +649,6 @@ sdhc_start_command(struct sdhc_host *hp, struct sdmmc_command *cmd)
695649
u_int16_t mode;
696650
u_int16_t command;
697651
int error;
698-
int s;
699652

700653
DPRINTF(1,("%s: start cmd %u arg=%#x data=%p dlen=%d flags=%#x "
701654
"proc=\"%s\"\n", HDEVNAME(hp), cmd->c_opcode, cmd->c_arg,
@@ -765,8 +718,6 @@ sdhc_start_command(struct sdhc_host *hp, struct sdmmc_command *cmd)
765718
if ((error = sdhc_wait_state(hp, SDHC_CMD_INHIBIT_MASK, 0)) != 0)
766719
return error;
767720

768-
s = splsdmmc();
769-
770721
/* Alert the user not to remove the card. */
771722
HSET1(hp, SDHC_HOST_CTL, SDHC_LED_ON);
772723

@@ -798,7 +749,6 @@ sdhc_start_command(struct sdhc_host *hp, struct sdmmc_command *cmd)
798749
// HWRITE2(hp, SDHC_COMMAND, command);
799750
// HWRITE2(hp, SDHC_TRANSFER_MODE, mode);
800751

801-
splx(s);
802752
return 0;
803753
}
804754

@@ -967,14 +917,11 @@ int
967917
sdhc_wait_intr(struct sdhc_host *hp, int mask, int timo)
968918
{
969919
int status;
970-
int s;
971920

972921
mask |= SDHC_ERROR_INTERRUPT;
973922

974-
s = splsdmmc();
975923
status = hp->intr_status & mask;
976924

977-
978925
for (timo = 500; timo > 0; timo--) {
979926
if (hp->intr_status != 0) {
980927
status = hp->intr_status & mask;
@@ -997,7 +944,6 @@ sdhc_wait_intr(struct sdhc_host *hp, int mask, int timo)
997944
status = 0;
998945
}
999946

1000-
splx(s);
1001947
return status;
1002948
}
1003949

sdmmcvar.h

-98
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,6 @@
2020
#ifndef _SDMMCVAR_H_
2121
#define _SDMMCVAR_H_
2222

23-
#if 0
24-
#include <sys/queue.h>
25-
#include <sys/lock.h>
26-
27-
#include <scsi/scsi_all.h>
28-
#include <scsi/scsiconf.h>
29-
30-
#include <dev/sdmmc/sdmmcchip.h>
31-
#include <dev/sdmmc/sdmmcreg.h>
32-
#endif
33-
3423
struct sdmmc_csd {
3524
int csdver; /* CSD structure format */
3625
int mmcver; /* MMC version (for CID format) */
@@ -58,9 +47,6 @@ struct sdmmc_task {
5847
void *arg;
5948
int onqueue;
6049
struct sdmmc_softc *sc;
61-
#if 0
62-
TAILQ_ENTRY(sdmmc_task) next;
63-
#endif
6450
};
6551

6652
#define sdmmc_init_task(xtask, xfunc, xarg) do { \
@@ -142,9 +128,6 @@ struct sdmmc_function {
142128
int flags;
143129
#define SFF_ERROR 0x0001 /* function is poo; ignore it */
144130
#define SFF_SDHC 0x0002 /* SD High Capacity card */
145-
#if 0
146-
SIMPLEQ_ENTRY(sdmmc_function) sf_list;
147-
#endif
148131
/* SD card I/O function members */
149132
int number; /* I/O function number or -1 */
150133
struct device *child; /* function driver */
@@ -173,23 +156,11 @@ struct sdmmc_softc {
173156
int sc_function_count; /* number of I/O functions (SDIO) */
174157
struct sdmmc_function *sc_card; /* selected card */
175158
struct sdmmc_function *sc_fn0; /* function 0, the card itself */
176-
#if 0
177-
SIMPLEQ_HEAD(, sdmmc_function) sf_head; /* list of card functions */
178-
#endif
179159
int sc_dying; /* bus driver is shutting down */
180160
struct proc *sc_task_thread; /* asynchronous tasks */
181-
#if 0
182-
TAILQ_HEAD(, sdmmc_task) sc_tskq; /* task thread work queue */
183-
#endif
184161
struct sdmmc_task sc_discover_task; /* card attach/detach task */
185162
struct sdmmc_task sc_intr_task; /* card interrupt task */
186-
#if 0
187-
struct lock sc_lock; /* lock around host controller */
188-
#endif
189163
void *sc_scsibus; /* SCSI bus emulation softc */
190-
#if 0
191-
TAILQ_HEAD(, sdmmc_intr_handler) sc_intrq; /* interrupt handlers */
192-
#endif
193164
long sc_max_xfer; /* maximum transfer size */
194165
};
195166

@@ -202,79 +173,10 @@ struct sdmmc_attach_args {
202173
};
203174

204175
#define IPL_SDMMC IPL_BIO
205-
#define splsdmmc() splbio()
206176

207177
#define SDMMC_LOCK(sc) lockmgr(&(sc)->sc_lock, LK_EXCLUSIVE, NULL)
208178
#define SDMMC_UNLOCK(sc) lockmgr(&(sc)->sc_lock, LK_RELEASE, NULL)
209179
#define SDMMC_ASSERT_LOCKED(sc) \
210180
KASSERT(lockstatus(&((sc))->sc_lock) == LK_EXCLUSIVE)
211181

212-
#if 0
213-
void sdmmc_add_task(struct sdmmc_softc *, struct sdmmc_task *);
214-
void sdmmc_del_task(struct sdmmc_task *);
215-
216-
struct sdmmc_function *sdmmc_function_alloc(struct sdmmc_softc *);
217-
void sdmmc_function_free(struct sdmmc_function *);
218-
int sdmmc_set_bus_power(struct sdmmc_softc *, u_int32_t, u_int32_t);
219-
int sdmmc_mmc_command(struct sdmmc_softc *, struct sdmmc_command *);
220-
int sdmmc_app_command(struct sdmmc_softc *, struct sdmmc_command *);
221-
void sdmmc_go_idle_state(struct sdmmc_softc *);
222-
int sdmmc_select_card(struct sdmmc_softc *, struct sdmmc_function *);
223-
int sdmmc_set_relative_addr(struct sdmmc_softc *,
224-
struct sdmmc_function *);
225-
int sdmmc_send_if_cond(struct sdmmc_softc *, uint32_t);
226-
227-
void sdmmc_intr_enable(struct sdmmc_function *);
228-
void sdmmc_intr_disable(struct sdmmc_function *);
229-
void *sdmmc_intr_establish(struct device *, int (*)(void *),
230-
void *, const char *);
231-
void sdmmc_intr_disestablish(void *);
232-
void sdmmc_intr_task(void *);
233-
234-
int sdmmc_io_enable(struct sdmmc_softc *);
235-
void sdmmc_io_scan(struct sdmmc_softc *);
236-
int sdmmc_io_init(struct sdmmc_softc *, struct sdmmc_function *);
237-
void sdmmc_io_attach(struct sdmmc_softc *);
238-
void sdmmc_io_detach(struct sdmmc_softc *);
239-
u_int8_t sdmmc_io_read_1(struct sdmmc_function *, int);
240-
u_int16_t sdmmc_io_read_2(struct sdmmc_function *, int);
241-
u_int32_t sdmmc_io_read_4(struct sdmmc_function *, int);
242-
int sdmmc_io_read_multi_1(struct sdmmc_function *, int, u_char *, int);
243-
void sdmmc_io_write_1(struct sdmmc_function *, int, u_int8_t);
244-
void sdmmc_io_write_2(struct sdmmc_function *, int, u_int16_t);
245-
void sdmmc_io_write_4(struct sdmmc_function *, int, u_int32_t);
246-
int sdmmc_io_write_multi_1(struct sdmmc_function *, int, u_char *, int);
247-
int sdmmc_io_function_ready(struct sdmmc_function *);
248-
int sdmmc_io_function_enable(struct sdmmc_function *);
249-
void sdmmc_io_function_disable(struct sdmmc_function *);
250-
251-
int sdmmc_read_cis(struct sdmmc_function *, struct sdmmc_cis *);
252-
void sdmmc_print_cis(struct sdmmc_function *);
253-
void sdmmc_check_cis_quirks(struct sdmmc_function *);
254-
255-
int sdmmc_mem_enable(struct sdmmc_softc *);
256-
void sdmmc_mem_scan(struct sdmmc_softc *);
257-
int sdmmc_mem_init(struct sdmmc_softc *, struct sdmmc_function *);
258-
int sdmmc_mem_read_block(struct sdmmc_function *, int, u_char *, size_t);
259-
int sdmmc_mem_write_block(struct sdmmc_function *, int, u_char *, size_t);
260-
261-
/* ioctls */
262-
263-
#include <sys/ioccom.h>
264-
265-
struct bio_sdmmc_command {
266-
void *cookie;
267-
struct sdmmc_command cmd;
268-
};
269-
270-
struct bio_sdmmc_debug {
271-
void *cookie;
272-
int debug;
273-
};
274-
275-
#define SDIOCEXECMMC _IOWR('S',0, struct bio_sdmmc_command)
276-
#define SDIOCEXECAPP _IOWR('S',1, struct bio_sdmmc_command)
277-
#define SDIOCSETDEBUG _IOWR('S',2, struct bio_sdmmc_debug)
278-
#endif
279-
280182
#endif

0 commit comments

Comments
 (0)