Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
linux-elphel
Commits
0d8ea7fc
Commit
0d8ea7fc
authored
Nov 04, 2016
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SDHCI_ANY_PRESENT
parent
85e1d930
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
5 deletions
+49
-5
sdhci.c
src/drivers/mmc/host/sdhci.c
+47
-5
sdhci.h
src/drivers/mmc/host/sdhci.h
+2
-0
No files found.
src/drivers/mmc/host/sdhci.c
View file @
0d8ea7fc
...
...
@@ -151,7 +151,16 @@ static void sdhci_set_card_detection(struct sdhci_host *host, bool enable)
if
(
enable
)
{
present
=
sdhci_readl
(
host
,
SDHCI_PRESENT_STATE
)
&
SDHCI_DAT3_PRESENT
;
SDHCI_ANY_PRESENT
;
/* oleg's debug
if (!present){
pr_err("Forcing Card Present\n");
present = SDHCI_ANY_PRESENT;
}else{
pr_err("Card Is Present\n");
}
*/
host
->
ier
|=
present
?
SDHCI_INT_CARD_REMOVE
:
SDHCI_INT_CARD_INSERT
;
...
...
@@ -207,9 +216,13 @@ static void sdhci_do_reset(struct sdhci_host *host, u8 mask)
{
if
(
host
->
quirks
&
SDHCI_QUIRK_NO_CARD_NO_RESET
)
{
if
(
!
(
sdhci_readl
(
host
,
SDHCI_PRESENT_STATE
)
&
SDHCI_DAT3_PRESENT
))
SDHCI_ANY_PRESENT
)){
// oleg's debug
//pr_err("!!!!!sdhci_doNOT_reset!!!!");
return
;
}
}
//pr_err("!!!!!sdhci_do_reset!!!!");
host
->
ops
->
reset
(
host
,
mask
);
...
...
@@ -1395,10 +1408,19 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
present
=
1
;
else
present
=
sdhci_readl
(
host
,
SDHCI_PRESENT_STATE
)
&
SDHCI_DAT3
_PRESENT
;
SDHCI_ANY
_PRESENT
;
}
/*oleg's debug
if (!present){
pr_err("sdhci card request: card not present?\n");
present = 1;
}else{
pr_err("sdhci card request: CARD IS PRESENT: 0x%08x\n",present);
}
*/
if
(
!
present
||
host
->
flags
&
SDHCI_DEVICE_DEAD
)
{
host
->
mrq
->
cmd
->
error
=
-
ENOMEDIUM
;
tasklet_schedule
(
&
host
->
finish_tasklet
);
}
else
{
...
...
@@ -1651,6 +1673,7 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
static
int
sdhci_do_get_cd
(
struct
sdhci_host
*
host
)
{
int
gpio_cd
=
mmc_gpio_get_cd
(
host
->
mmc
);
int
present
;
if
(
host
->
flags
&
SDHCI_DEVICE_DEAD
)
return
0
;
...
...
@@ -1664,8 +1687,18 @@ static int sdhci_do_get_cd(struct sdhci_host *host)
if
(
!
IS_ERR_VALUE
(
gpio_cd
))
return
!!
gpio_cd
;
present
=
!!
(
sdhci_readl
(
host
,
SDHCI_PRESENT_STATE
)
&
SDHCI_ANY_PRESENT
);
/* oleg's debug
if (!present){
pr_err("sdhci_do_get_cd: card not present\n");
present = 1;
}else{
pr_err("sdhci_do_get_cd: CARD IS PRESENT\n");
}
*/
/* Host native card detect */
return
!!
(
sdhci_readl
(
host
,
SDHCI_PRESENT_STATE
)
&
SDHCI_DAT3_PRESENT
)
;
return
present
;
}
static
int
sdhci_get_cd
(
struct
mmc_host
*
mmc
)
...
...
@@ -2606,7 +2639,16 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id)
if
(
intmask
&
(
SDHCI_INT_CARD_INSERT
|
SDHCI_INT_CARD_REMOVE
))
{
u32
present
=
sdhci_readl
(
host
,
SDHCI_PRESENT_STATE
)
&
SDHCI_DAT3_PRESENT
;
SDHCI_ANY_PRESENT
;
/*
if (!present){
pr_err("sdhci_irq: card not present\n");
present = 1;
}else{
pr_err("sdhci_irq: card is present\n");
}
*/
/*
* There is a observation on i.mx esdhc. INSERT
...
...
src/drivers/mmc/host/sdhci.h
View file @
0d8ea7fc
...
...
@@ -70,6 +70,8 @@
#define SDHCI_DATA_AVAILABLE 0x00000800
#define SDHCI_CARD_PRESENT 0x00010000
#define SDHCI_DAT3_PRESENT 0x00800000
//For 10393 rev.B unreliable D3 detection
#define SDHCI_ANY_PRESENT (SDHCI_CARD_PRESENT | SDHCI_DAT3_PRESENT)
#define SDHCI_WRITE_PROTECT 0x00080000
#define SDHCI_DATA_LVL_MASK 0x00F00000
#define SDHCI_DATA_LVL_SHIFT 20
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment