Commit cd3ee8c5 authored by Ludovic Barre's avatar Ludovic Barre Committed by Ulf Hansson

mmc: mmci: add set_clk/pwrreg callbacks

This patch adds set_clkreg and set_pwrreg callbacks
at mmci_host_ops to allow to call specific variant.
extends visibility of mmci_write_clk/pwrreg functions
to be used into specific file variant.
Signed-off-by: default avatarLudovic Barre <ludovic.barre@st.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent e0da1721
...@@ -257,7 +257,7 @@ static void mmci_reg_delay(struct mmci_host *host) ...@@ -257,7 +257,7 @@ static void mmci_reg_delay(struct mmci_host *host)
/* /*
* This must be called with host->lock held * This must be called with host->lock held
*/ */
static void mmci_write_clkreg(struct mmci_host *host, u32 clk) void mmci_write_clkreg(struct mmci_host *host, u32 clk)
{ {
if (host->clk_reg != clk) { if (host->clk_reg != clk) {
host->clk_reg = clk; host->clk_reg = clk;
...@@ -268,7 +268,7 @@ static void mmci_write_clkreg(struct mmci_host *host, u32 clk) ...@@ -268,7 +268,7 @@ static void mmci_write_clkreg(struct mmci_host *host, u32 clk)
/* /*
* This must be called with host->lock held * This must be called with host->lock held
*/ */
static void mmci_write_pwrreg(struct mmci_host *host, u32 pwr) void mmci_write_pwrreg(struct mmci_host *host, u32 pwr)
{ {
if (host->pwr_reg != pwr) { if (host->pwr_reg != pwr) {
host->pwr_reg = pwr; host->pwr_reg = pwr;
...@@ -1571,8 +1571,16 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) ...@@ -1571,8 +1571,16 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
spin_lock_irqsave(&host->lock, flags); spin_lock_irqsave(&host->lock, flags);
mmci_set_clkreg(host, ios->clock); if (host->ops && host->ops->set_clkreg)
mmci_write_pwrreg(host, pwr); host->ops->set_clkreg(host, ios->clock);
else
mmci_set_clkreg(host, ios->clock);
if (host->ops && host->ops->set_pwrreg)
host->ops->set_pwrreg(host, pwr);
else
mmci_write_pwrreg(host, pwr);
mmci_reg_delay(host); mmci_reg_delay(host);
spin_unlock_irqrestore(&host->lock, flags); spin_unlock_irqrestore(&host->lock, flags);
......
...@@ -284,6 +284,8 @@ struct mmci_host_ops { ...@@ -284,6 +284,8 @@ struct mmci_host_ops {
int (*dma_start)(struct mmci_host *host, unsigned int *datactrl); int (*dma_start)(struct mmci_host *host, unsigned int *datactrl);
void (*dma_finalize)(struct mmci_host *host, struct mmc_data *data); void (*dma_finalize)(struct mmci_host *host, struct mmc_data *data);
void (*dma_error)(struct mmci_host *host); void (*dma_error)(struct mmci_host *host);
void (*set_clkreg)(struct mmci_host *host, unsigned int desired);
void (*set_pwrreg)(struct mmci_host *host, unsigned int pwr);
}; };
struct mmci_host { struct mmci_host {
...@@ -336,6 +338,9 @@ struct mmci_host { ...@@ -336,6 +338,9 @@ struct mmci_host {
#define dma_inprogress(host) ((host)->dma_in_progress) #define dma_inprogress(host) ((host)->dma_in_progress)
void mmci_write_clkreg(struct mmci_host *host, u32 clk);
void mmci_write_pwrreg(struct mmci_host *host, u32 pwr);
int mmci_dmae_prep_data(struct mmci_host *host, struct mmc_data *data, int mmci_dmae_prep_data(struct mmci_host *host, struct mmc_data *data,
bool next); bool next);
void mmci_dmae_unprep_data(struct mmci_host *host, struct mmc_data *data, void mmci_dmae_unprep_data(struct mmci_host *host, struct mmc_data *data,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment