diff mbox

[U-Boot,resend] sdhci: Add sdhci support for spear devices

Message ID ff1458277494ce48f11c29f324321cde0eec1c11.1354776155.git.vipin.kumar@st.com
State Accepted, archived
Delegated to: Andy Fleming
Headers show

Commit Message

Vipin Kumar Dec. 6, 2012, 6:44 a.m. UTC
Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
---
 drivers/mmc/Makefile      |  1 +
 drivers/mmc/spear_sdhci.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 drivers/mmc/spear_sdhci.c

Comments

Vipin Kumar Dec. 12, 2012, 9:58 a.m. UTC | #1
Stefan, Wolfgang,

Can you please add relevant people if not present already in this mail

Regards
Vipin

On 12/6/2012 12:14 PM, Vipin KUMAR wrote:
> Signed-off-by: Vipin Kumar<vipin.kumar@st.com>
> ---
>   drivers/mmc/Makefile      |  1 +
>   drivers/mmc/spear_sdhci.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
>   2 files changed, 45 insertions(+)
>   create mode 100644 drivers/mmc/spear_sdhci.c
>
> diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
> index a1dd730..01dd61d 100644
> --- a/drivers/mmc/Makefile
> +++ b/drivers/mmc/Makefile
> @@ -45,6 +45,7 @@ COBJS-$(CONFIG_PXA_MMC_GENERIC) += pxa_mmc_gen.o
>   COBJS-$(CONFIG_SDHCI) += sdhci.o
>   COBJS-$(CONFIG_S5P_SDHCI) += s5p_sdhci.o
>   COBJS-$(CONFIG_SH_MMCIF) += sh_mmcif.o
> +COBJS-$(CONFIG_SPEAR_SDHCI) += spear_sdhci.o
>   COBJS-$(CONFIG_TEGRA_MMC) += tegra_mmc.o
>   COBJS-$(CONFIG_DWMMC) += dw_mmc.o
>
> diff --git a/drivers/mmc/spear_sdhci.c b/drivers/mmc/spear_sdhci.c
> new file mode 100644
> index 0000000..23f1f4b
> --- /dev/null
> +++ b/drivers/mmc/spear_sdhci.c
> @@ -0,0 +1,44 @@
> +/*
> + * (C) Copyright 2012
> + * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
> + */
> +
> +#include<common.h>
> +#include<malloc.h>
> +#include<sdhci.h>
> +
> +int spear_sdhci_init(u32 regbase, u32 max_clk, u32 min_clk, u32 quirks)
> +{
> +	struct sdhci_host *host = NULL;
> +	host = (struct sdhci_host *)malloc(sizeof(struct sdhci_host));
> +	if (!host) {
> +		printf("sdhci host malloc fail!\n");
> +		return 1;
> +	}
> +
> +	host->name = "sdhci";
> +	host->ioaddr = (void *)regbase;
> +	host->quirks = quirks;
> +
> +	if (quirks&  SDHCI_QUIRK_REG32_RW)
> +		host->version = sdhci_readl(host, SDHCI_HOST_VERSION - 2)>>  16;
> +	else
> +		host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
> +
> +	add_sdhci(host, max_clk, min_clk);
> +	return 0;
> +}
Stefan Roese Dec. 12, 2012, 10:07 a.m. UTC | #2
On 12/06/2012 07:44 AM, Vipin Kumar wrote:
> Signed-off-by: Vipin Kumar <vipin.kumar@st.com>

Looks good, so:

Acked-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan
Jaehoon Chung Dec. 12, 2012, 10:11 a.m. UTC | #3
I didn't test..but it looks fine.

Acked-by: Jaehoon Chung <jh80.chung@samsung.com>

On 12/06/2012 03:44 PM, Vipin Kumar wrote:
> Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
> ---
>  drivers/mmc/Makefile      |  1 +
>  drivers/mmc/spear_sdhci.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 45 insertions(+)
>  create mode 100644 drivers/mmc/spear_sdhci.c
> 
> diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
> index a1dd730..01dd61d 100644
> --- a/drivers/mmc/Makefile
> +++ b/drivers/mmc/Makefile
> @@ -45,6 +45,7 @@ COBJS-$(CONFIG_PXA_MMC_GENERIC) += pxa_mmc_gen.o
>  COBJS-$(CONFIG_SDHCI) += sdhci.o
>  COBJS-$(CONFIG_S5P_SDHCI) += s5p_sdhci.o
>  COBJS-$(CONFIG_SH_MMCIF) += sh_mmcif.o
> +COBJS-$(CONFIG_SPEAR_SDHCI) += spear_sdhci.o
>  COBJS-$(CONFIG_TEGRA_MMC) += tegra_mmc.o
>  COBJS-$(CONFIG_DWMMC) += dw_mmc.o
>  
> diff --git a/drivers/mmc/spear_sdhci.c b/drivers/mmc/spear_sdhci.c
> new file mode 100644
> index 0000000..23f1f4b
> --- /dev/null
> +++ b/drivers/mmc/spear_sdhci.c
> @@ -0,0 +1,44 @@
> +/*
> + * (C) Copyright 2012
> + * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
> + */
> +
> +#include <common.h>
> +#include <malloc.h>
> +#include <sdhci.h>
> +
> +int spear_sdhci_init(u32 regbase, u32 max_clk, u32 min_clk, u32 quirks)
> +{
> +	struct sdhci_host *host = NULL;
> +	host = (struct sdhci_host *)malloc(sizeof(struct sdhci_host));
> +	if (!host) {
> +		printf("sdhci host malloc fail!\n");
> +		return 1;
> +	}
> +
> +	host->name = "sdhci";
> +	host->ioaddr = (void *)regbase;
> +	host->quirks = quirks;
> +
> +	if (quirks & SDHCI_QUIRK_REG32_RW)
> +		host->version = sdhci_readl(host, SDHCI_HOST_VERSION - 2) >> 16;
> +	else
> +		host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
> +
> +	add_sdhci(host, max_clk, min_clk);
> +	return 0;
> +}
>
diff mbox

Patch

diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
index a1dd730..01dd61d 100644
--- a/drivers/mmc/Makefile
+++ b/drivers/mmc/Makefile
@@ -45,6 +45,7 @@  COBJS-$(CONFIG_PXA_MMC_GENERIC) += pxa_mmc_gen.o
 COBJS-$(CONFIG_SDHCI) += sdhci.o
 COBJS-$(CONFIG_S5P_SDHCI) += s5p_sdhci.o
 COBJS-$(CONFIG_SH_MMCIF) += sh_mmcif.o
+COBJS-$(CONFIG_SPEAR_SDHCI) += spear_sdhci.o
 COBJS-$(CONFIG_TEGRA_MMC) += tegra_mmc.o
 COBJS-$(CONFIG_DWMMC) += dw_mmc.o
 
diff --git a/drivers/mmc/spear_sdhci.c b/drivers/mmc/spear_sdhci.c
new file mode 100644
index 0000000..23f1f4b
--- /dev/null
+++ b/drivers/mmc/spear_sdhci.c
@@ -0,0 +1,44 @@ 
+/*
+ * (C) Copyright 2012
+ * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <common.h>
+#include <malloc.h>
+#include <sdhci.h>
+
+int spear_sdhci_init(u32 regbase, u32 max_clk, u32 min_clk, u32 quirks)
+{
+	struct sdhci_host *host = NULL;
+	host = (struct sdhci_host *)malloc(sizeof(struct sdhci_host));
+	if (!host) {
+		printf("sdhci host malloc fail!\n");
+		return 1;
+	}
+
+	host->name = "sdhci";
+	host->ioaddr = (void *)regbase;
+	host->quirks = quirks;
+
+	if (quirks & SDHCI_QUIRK_REG32_RW)
+		host->version = sdhci_readl(host, SDHCI_HOST_VERSION - 2) >> 16;
+	else
+		host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
+
+	add_sdhci(host, max_clk, min_clk);
+	return 0;
+}