Skip to content

Commit

Permalink
[MMC] ios for mmc chip select
Browse files Browse the repository at this point in the history
Adds a new ios for setting the chip select pin on MMC cards. Needed on
SD controllers which use this pin for other things and therefore cannot
have it pulled high at all times.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Pierre Ossman authored and Russell King committed Sep 3, 2005
1 parent f505380 commit 865e9f1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/mmc/mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,13 +457,23 @@ static void mmc_idle_cards(struct mmc_host *host)
{
struct mmc_command cmd;

host->ios.chip_select = MMC_CS_HIGH;
host->ops->set_ios(host, &host->ios);

mmc_delay(1);

cmd.opcode = MMC_GO_IDLE_STATE;
cmd.arg = 0;
cmd.flags = MMC_RSP_NONE;

mmc_wait_for_cmd(host, &cmd, 0);

mmc_delay(1);

host->ios.chip_select = MMC_CS_DONTCARE;
host->ops->set_ios(host, &host->ios);

mmc_delay(1);
}

/*
Expand All @@ -475,6 +485,7 @@ static void mmc_power_up(struct mmc_host *host)

host->ios.vdd = bit;
host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN;
host->ios.chip_select = MMC_CS_DONTCARE;
host->ios.power_mode = MMC_POWER_UP;
host->ops->set_ios(host, &host->ios);

Expand All @@ -492,6 +503,7 @@ static void mmc_power_off(struct mmc_host *host)
host->ios.clock = 0;
host->ios.vdd = 0;
host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN;
host->ios.chip_select = MMC_CS_DONTCARE;
host->ios.power_mode = MMC_POWER_OFF;
host->ops->set_ios(host, &host->ios);
}
Expand Down
6 changes: 6 additions & 0 deletions include/linux/mmc/host.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ struct mmc_ios {
#define MMC_BUSMODE_OPENDRAIN 1
#define MMC_BUSMODE_PUSHPULL 2

unsigned char chip_select; /* SPI chip select */

#define MMC_CS_DONTCARE 0
#define MMC_CS_HIGH 1
#define MMC_CS_LOW 2

unsigned char power_mode; /* power supply mode */

#define MMC_POWER_OFF 0
Expand Down

0 comments on commit 865e9f1

Please sign in to comment.