Add Highbank platform
Subsystems (4)
cover Add Highbank platform
From: Rob Herring <[email protected]>
This series enables AHCI on non-PCI platforms, converts Samsung mmc to a common SDHCI implementation, and adds basic support for the Calxeda highbank platform which uses AHCI and SDHCI drivers.
Rob
Rob Herring (8):
mmc: copy s5p to sdhci
mmc: sdhci: rework Samsung specfic code
mmc: sdhci: exit cmd on error status
arm: add __ilog2 function
scsi/ahci: ata id little endian fix scsi/ahci: add support for non-PCI controllers
ARM: add missing CONFIG_SKIP_LOWLEVEL_INIT for armv7
ARM: Add Calxeda Highbank platform
arch/arm/cpu/armv7/highbank/Makefile | 46 +++ arch/arm/cpu/armv7/highbank/config.mk | 4 + arch/arm/cpu/armv7/highbank/timer.c | 124 +++++++ arch/arm/cpu/armv7/start.S | 2 + arch/arm/include/asm/arch-highbank/clk.h | 22 ++ arch/arm/include/asm/arch-s5pc1xx/mmc.h | 73 ---- arch/arm/include/asm/arch-s5pc2xx/mmc.h | 73 ---- arch/arm/include/asm/bitops.h | 9 + board/highbank/Makefile | 49 +++ board/highbank/highbank.c | 57 ++++ board/samsung/goni/goni.c | 4 +- board/samsung/universal_c210/universal.c | 8 +- boards.cfg | 1 + common/cmd_scsi.c | 6 +- drivers/block/ahci.c | 72 ++++- drivers/mmc/Makefile | 3 +- drivers/mmc/s5p_mmc.c | 482 --------------------------- drivers/mmc/sdhci.c | 532 ++++++++++++++++++++++++++++++ include/ahci.h | 4 + include/configs/highbank.h | 117 +++++++ include/scsi.h | 1 + include/sdhci.h | 18 + 22 files changed, 1061 insertions(+), 646 deletions(-) create mode 100644 arch/arm/cpu/armv7/highbank/Makefile create mode 100644 arch/arm/cpu/armv7/highbank/config.mk create mode 100644 arch/arm/cpu/armv7/highbank/timer.c create mode 100644 arch/arm/include/asm/arch-highbank/clk.h delete mode 100644 arch/arm/include/asm/arch-s5pc1xx/mmc.h delete mode 100644 arch/arm/include/asm/arch-s5pc2xx/mmc.h create mode 100644 board/highbank/Makefile create mode 100644 board/highbank/highbank.c delete mode 100644 drivers/mmc/s5p_mmc.c create mode 100644 drivers/mmc/sdhci.c create mode 100644 include/configs/highbank.h create mode 100644 include/sdhci.h
Signature · 1 line
1.7.4.1
PATCH 1/8 mmc: copy s5p to sdhci
From: Rob Herring <[email protected]>
The s5p mmc controller is a standard SDHCI controller with a few extra registers. So rename it to reflect that and so other platforms can use it.
--- drivers/mmc/Makefile | 3 +- drivers/mmc/s5p_mmc.c | 482 ------------------------------------------------- drivers/mmc/sdhci.c | 482 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 484 insertions(+), 483 deletions(-) delete mode 100644 drivers/mmc/s5p_mmc.c create mode 100644 drivers/mmc/sdhci.c
drivers/mmc/Makefile +2 -1
@@ -37,7 +37,8 @@ COBJS-$(CONFIG_MXC_MMC) += mxcmmc.o COBJS-$(CONFIG_OMAP3_MMC) += omap3_mmc.o COBJS-$(CONFIG_OMAP_HSMMC) += omap_hsmmc.o COBJS-$(CONFIG_PXA_MMC) += pxa_mmc.o -COBJS-$(CONFIG_S5P_MMC) += s5p_mmc.o +COBJS-$(CONFIG_S5P_MMC) += sdhci.o +COBJS-$(CONFIG_SDHCI) += sdhci.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c)
drivers/mmc/s5p_mmc.c deleted +0 -482
482 lines not on this page · raw message
drivers/mmc/sdhci.c new file +482 -0
482 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 2/8 mmc: sdhci: rework Samsung specfic code
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Move the register definitions into the sdhci.c file. Set the base address from the board init code.
The Samsung SDHCI controller has extra registers. Make them conditional on CONFIG_MMC_S5P.
--- arch/arm/include/asm/arch-s5pc1xx/mmc.h | 73 -------------------------- arch/arm/include/asm/arch-s5pc2xx/mmc.h | 73 -------------------------- board/samsung/goni/goni.c | 4 +- board/samsung/universal_c210/universal.c | 8 ++- drivers/mmc/sdhci.c | 82 +++++++++++++++++++++++------- include/sdhci.h | 18 +++++++ 6 files changed, 89 insertions(+), 169 deletions(-) delete mode 100644 arch/arm/include/asm/arch-s5pc1xx/mmc.h delete mode 100644 arch/arm/include/asm/arch-s5pc2xx/mmc.h create mode 100644 include/sdhci.h
arch/arm/include/asm/arch-s5pc1xx/mmc.h deleted +0 -73
@@ -1,73 +0,0 @@ -/* -* (C) Copyright 2009 SAMSUNG Electronics -* Minkyu Kang <[email protected]> -* -* 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 -* -*/ - -#ifndef __ASM_ARCH_MMC_H_ -#define __ASM_ARCH_MMC_H_ - -#ifndef __ASSEMBLY__ -struct s5p_mmc { -unsigned int sysad; -unsigned short blksize; -unsigned short blkcnt; -unsigned int argument; -unsigned short trnmod; -unsigned short cmdreg; -unsigned int rspreg0; -unsigned int rspreg1; -unsigned int rspreg2; -unsigned int rspreg3; -unsigned int bdata; -unsigned int prnsts; -unsigned char hostctl; -unsigned char pwrcon; -unsigned char blkgap; -unsigned char wakcon; -unsigned short clkcon; -unsigned char timeoutcon; -unsigned char swrst; -unsigned int norintsts;/* errintsts */ -unsigned int norintstsen;/* errintstsen */ -unsigned int norintsigen;/* errintsigen */ -unsigned short acmd12errsts; -unsigned char res1[2 ]; -unsigned int capareg; -unsigned char res2[4 ]; -unsigned int maxcurr; -unsigned char res3[0x34 ]; -unsigned int control2; -unsigned int control3; -unsigned char res4[4 ]; -unsigned int control4; -unsigned char res5[0x6e ]; -unsigned short hcver; -unsigned char res6[0xFFF00 ]; -}; - -struct mmc_host { -struct s5p_mmc *reg; -unsigned int version;/* SDHCI spec. version */ -unsigned int clock;/* Current clock (MHz) */ -int dev_index; -}; - -int s5p_mmc_init (int dev_index,int bus_width); - -#endif /* __ASSEMBLY__ */ -#endif
arch/arm/include/asm/arch-s5pc2xx/mmc.h deleted +0 -73
73 lines not on this page · raw message
board/samsung/goni/goni.c +2 -2
@@ -23,8 +23,8 @@*/ #include <common.h> +#include <sdhci.h> #include <asm/arch/gpio.h> -#include <asm/arch/mmc.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -93,6 +93,6 @@ int board_mmc_init(bd_t *bis) gpio_set_drv(&s5pc110_gpio->g0, i, GPIO_DRV_4X); } -return s5p_mmc_init (0 ,4 ); +return sdhci_mmc_init ((void *)samsung_get_base_mmc (),4 ); }#endif
board/samsung/universal_c210/universal.c +5 -3
@@ -23,10 +23,10 @@*/ #include <common.h> +#include <sdhci.h> #include <asm/io.h> #include <asm/arch/adc.h> #include <asm/arch/gpio.h> -#include <asm/arch/mmc.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -151,6 +151,7 @@ int checkboard(void)int board_mmc_init (bd_t *bis) {int i, err; +u32 base;switch (get_hwrev ()) {case 0 :
@@ -217,7 +218,8 @@ int board_mmc_init(bd_t *bis)* mmc0 : eMMC (8-bit buswidth) * mmc2 : SD card (4-bit buswidth) */ - err =s5p_mmc_init (0 ,8 ); + base =samsung_get_base_mmc (); + err =sdhci_mmc_init ((void *)base,8 );/* * Check the T-flash detect pin
@@ -241,7 +243,7 @@ int board_mmc_init(bd_t *bis)/* GPK2[0:6] drv 4x */ gpio_set_drv (&gpio2->k2, i,GPIO_DRV_4X ); } - err =s5p_mmc_init (2 ,4 ); + err =sdhci_mmc_init ((void *)(base +0x20000 ),4 ); }return err;
drivers/mmc/sdhci.c +64 -18
138 lines not on this page · raw message
include/sdhci.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* Copyright 2011 Calxeda, Inc. +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope 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, see <http://www.gnu.org/licenses/>. +*/ + +int sdhci_mmc_init (void *base,int bus_width); +
Signature · 1 line
1.7.4.1
Minkyu Kang
NAKPATCH 2/8 mmc: sdhci: rework Samsung specfic code
Dear Rob Herring,
Quoted 56 lines · Rob Herring
From: Rob Herring <[email protected]>
Move the register definitions into the
sdhci.cfile. Set the base address from the board init code.The Samsung SDHCI controller has extra registers. Make them conditional on
CONFIG_MMC_S5P.Signed-off-by Rob Herring <[email protected]>---
?arch/arm/include/asm/arch-s5pc1xx/mmc.h ?| ? 73 -------------------------- ?arch/arm/include/asm/arch-s5pc2xx/mmc.h ?| ? 73 -------------------------- ?board/samsung/goni/goni.c ? ? ? ? ? ? ? ?| ? ?4 +- ?board/samsung/universal_c210/universal.c | ? ?8 ++- ?drivers/mmc/sdhci.c ? ? ? ? ? ? ? ? ? ? ?| ? 82 +++++++++++++++++++++++------- ?include/sdhci.h ? ? ? ? ? ? ? ? ? ? ? ? ?| ? 18 +++++++?6 files changed, 89 insertions(+), 169 deletions(-) ?delete mode 100644
arch/arm/include/asm/arch-s5pc1xx/mmc.h?delete mode 100644arch/arm/include/asm/arch-s5pc2xx/mmc.h?create mode 100644include/sdhci.hboard/samsung/universal_c210/universal.c +0
-0@@ -23,10 +23,10 @@?*/
?#include <
common.h>
+#include <sdhci.h>
?#include <asm/io.h>
?#include <asm/arch/adc.h>
?#include <asm/arch/gpio.h>
-#include <asm/arch/mmc.h>?DECLARE_GLOBAL_DATA_PTR;
board/samsung/universal_c210/universal.c +1
-0@@ -151,6 +151,7 @@ int checkboard(void) ?int board_mmc_init(bd_t *bis) ?{ ? ? ? ?int i, err; + ? ? ? u32 base; ? ? ? ?switch (get_hwrev()) {? ? ? ?case 0:
board/samsung/universal_c210/universal.c +0
-0@@ -217,7 +218,8 @@ int board_mmc_init(bd_t *bis) ? ? ? ? * mmc0 ?: eMMC (8-bit buswidth) ? ? ? ? * mmc2 ?: SD card (4-bit buswidth)? ? ? ? */
- ? ? ? err =s5p_mmc_init(0, 8);
+ ? ? ? base =samsung_get_base_mmc();
+ ? ? ? err =sdhci_mmc_init((void *)base, 8);? ? ? ?/*
? ? ? ? * Check the T-flash ?detect pinboard/samsung/universal_c210/universal.c +0
-0@@ -241,7 +243,7 @@ int board_mmc_init(bd_t *bis)
Quoted 5 lines
? ? ? ? ? ? ? ? ? ? ? ?/* GPK2[0:6] drv 4x */
? ? ? ? ? ? ? ? ? ? ? ?gpio_set_drv(&gpio2->k2, i,GPIO_DRV_4X); ? ? ? ? ? ? ? ?}
- ? ? ? ? ? ? ? err =s5p_mmc_init(2, 4);
+ ? ? ? ? ? ? ? err =sdhci_mmc_init((void *)(base + 0x20000), 4);
No, please use the macro instead of constant. (pass the device number to macro)
Quoted 47 lines
? ? ? ?}
? ? ? ?return err;
drivers/mmc/sdhci.c +0
-0@@ -21,18 +21,56 @@?#include <
common.h>
?#include <mmc.h>
?#include <asm/io.h>
-#include <asm/arch/mmc.h>
?#include <asm/arch/clk.h>drivers/mmc/sdhci.c +33
-0+struct sdhci_mmc { + ? ? ? unsigned int ? ?sysad; + ? ? ? unsigned short ?blksize; + ? ? ? unsigned short ?blkcnt; + ? ? ? unsigned int ? ?argument; + ? ? ? unsigned short ?trnmod; + ? ? ? unsigned short ?cmdreg; + ? ? ? unsigned int ? ?rspreg0; + ? ? ? unsigned int ? ?rspreg1; + ? ? ? unsigned int ? ?rspreg2; + ? ? ? unsigned int ? ?rspreg3; + ? ? ? unsigned int ? ?bdata; + ? ? ? unsigned int ? ?prnsts; + ? ? ? unsigned char ? hostctl; + ? ? ? unsigned char ? pwrcon; + ? ? ? unsigned char ? blkgap; + ? ? ? unsigned char ? wakcon; + ? ? ? unsigned short ?clkcon; + ? ? ? unsigned char ? timeoutcon; + ? ? ? unsigned char ? swrst; + ? ? ? unsigned int ? ?norintsts; ? ? ?/* errintsts */ + ? ? ? unsigned int ? ?norintstsen; ? ?/* errintstsen */ + ? ? ? unsigned int ? ?norintsigen; ? ?/* errintsigen */ + ? ? ? unsigned short ?acmd12errsts; + ? ? ? unsigned char ? res1[2]; + ? ? ? unsigned int ? ?capareg; + ? ? ? unsigned char ? res2[4]; + ? ? ? unsigned int ? ?maxcurr; + ? ? ? unsigned char ? res3[0x34]; + ? ? ? unsigned int ? ?control2; + ? ? ? unsigned int ? ?control3; + ? ? ? unsigned char ? res4[4]; + ? ? ? unsigned int ? ?control4;
drivers/mmc/sdhci.c
Quoted 10 lines
drivers/mmc/sdhci.c +10
-0+ ? ? ? unsigned char ? res5[0x6e]; + ? ? ? unsigned short ?hcver; +}; + +struct mmc_host { + ? ? ? struct sdhci_mmc *reg; + ? ? ? unsigned int version; ? /* SDHCI spec. version */ + ? ? ? unsigned int clock; ? ? /* Current clock (MHz) */ + ? ? ? int dev_index; +};
Please move this structures to header file.
Quoted 56 lines
+
?/* support 4 mmc hosts */
?struct mmc mmc_dev[4];
?structmmc_hostmmc_host[4];drivers/mmc/sdhci.c +1
-6- -static inline struct s5p_mmc *s5p_get_base_mmc (int dev_index) -{ - ? ? ? unsigned long offset = dev_index * sizeof(struct s5p_mmc); - ? ? ? return (struct s5p_mmc *)(samsung_get_base_mmc() + offset); -} +int dev_count;?static void
mmc_prepare_data(struct mmc_host *host, struct mmc_data *data)?{drivers/mmc/sdhci.c +1
-0@@ -255,6 +293,7 @@ static void mmc_change_clock(struct mmc_host *host, uint clock) ? ? ? ?unsigned long timeout; ? ? ? ?unsigned long ctrl2; +#ifdef CONFIG_S5P_MMC ? ? ? ?/*
? ? ? ? * SELBASECLK[5:4]
? ? ? ? * 00/01 = HCLKdrivers/mmc/sdhci.c +1
-1@@ -265,7 +304,7 @@ static void mmc_change_clock(struct mmc_host *host, uint clock) ? ? ? ?ctrl2 &= ~(3 << 4); ? ? ? ?ctrl2 |= (2 << 4); ? ? ? ?writel(ctrl2, &host->reg->control2); - +#endif ? ? ? ?writew(0, &host->reg->clkcon);? ? ? ?/* XXX: we assume that clock is between 40MHz and 50MHz */
drivers/mmc/sdhci.c +1
-0@@ -320,6 +359,7 @@ static void mmc_set_ios(struct mmc *mmc) ? ? ? ?debug("bus_width: %x, clock: %d\n", mmc->bus_width, mmc->clock); +#ifdef CONFIG_S5P_MMC ? ? ? ?/*
? ? ? ? * SELCLKPADDS[17:16]
? ? ? ? * 00 = 2mAdrivers/mmc/sdhci.c +0
-0@@ -349,7 +389,7 @@ static void mmc_set_ios(struct mmc *mmc) ? ? ? ? * ? ? ?10 = Delay4 (inverter delay + 2ns)? ? ? ? */
? ? ? ?writel(0x8080,&host->reg->control3);drivers/mmc/sdhci.c +1
-1- +#endif ? ? ? ?mmc_change_clock(host,
mmc->clock);? ? ? ?ctrl =
readb(&host->reg->hostctl);drivers/mmc/sdhci.c +1
-1@@ -445,14 +485,21 @@ static int mmc_core_init(struct mmc *mmc) ? ? ? ?return 0; ?} -static int s5p_mmc_initialize (int dev_index,int bus_width) +static int sdhci_mmc_initialize (void *base,int bus_width) ?{ ? ? ? ?struct mmc *mmc;
drivers/mmc/sdhci.c static int mmc_core_init(struct mmc *mmc) · line 499
Quoted 10 lines
drivers/mmc/sdhci.c +8
-1+ ? ? ? struct mmc_host *host; + + ? ? ? if (dev_count >= 4) + ? ? ? ? ? ? ? return -1; - ? ? ? mmc = &mmc_dev[dev_index]; + ? ? ? mmc = &mmc_dev[dev_count]; + ? ? ? host = &mmc_host[dev_count]; + ? ? ? host->dev_index = dev_count; + ? ? ? dev_count++;
NAK.dev_index is not a count number, it's a h/w device number. This change is wrong. (Maybe you misunderstood this concept) Please keep the dev_index.
drivers/mmc/sdhci.c static int s5p_mmc_initialize(int dev_index, int bus_width) · line 470
Quoted 13 lines
drivers/mmc/sdhci.c +2
-3- ? ? ? sprintf(mmc->name, "SAMSUNG SD/MMC"); - ? ? ? mmc->priv = &mmc_host[dev_index]; + ? ? ? sprintf(mmc->name, "SDHCI SD/MMC"); + ? ? ? mmc->priv = host; ? ? ? ?mmc->send_cmd = mmc_send_cmd; ? ? ? ?mmc->set_ios = mmc_set_ios; ? ? ? ?mmc->init = mmc_core_init;@@ -467,16 +514,15 @@ static int s5p_mmc_initialize(int dev_index, int bus_width) ? ? ? ?mmc->f_min = 400000; ? ? ? ?mmc->f_max = 52000000; - ? ? ? mmc_host[dev_index].dev_index = dev_index;
Ditto. Please keep the dev_index.
Quoted 6 lines
drivers/mmc/sdhci.c +2
-2- ? ? ? mmc_host[dev_index].clock = 0; - ? ? ? mmc_host[dev_index].reg = s5p_get_base_mmc(dev_index); + ? ? ? host->clock = 0; + ? ? ? host->reg = base; ? ? ? ?mmc->b_max = 0; ? ? ? ?mmc_register(mmc);
drivers/mmc/sdhci.c static int s5p_mmc_initialize(int dev_index, int bus_width) · line 528
Quoted 10 lines
drivers/mmc/sdhci.c +2
-2? ? ? ?return 0; ?} -int s5p_mmc_init (int dev_index,int bus_width) +int sdhci_mmc_init (void *base,int bus_width) ?{ - ? ? ? return s5p_mmc_initialize(dev_index, bus_width); + ? ? ? return sdhci_mmc_initialize(base, bus_width); ?}
Thanks
Minkyu Kang
Signature · 2 lines
from. prom. www.promsoft.net
PATCH 2/8 mmc: sdhci: rework Samsung specfic code
Quoted 118 lines · Minkyu Kang
Dear Rob Herring,
Quoted 56 lines · Rob Herring
From: Rob Herring<[email protected]>
Move the register definitions into the
sdhci.cfile. Set the base address from the board init code.The Samsung SDHCI controller has extra registers. Make them conditional on
CONFIG_MMC_S5P.Signed-off-by Rob Herring<[email protected]>--- arch/arm/include/asm/arch-s5pc1xx/mmc.h | 73 -------------------------- arch/arm/include/asm/arch-s5pc2xx/mmc.h | 73 -------------------------- board/samsung/goni/goni.c | 4 +- board/samsung/universal_c210/universal.c | 8 ++- drivers/mmc/sdhci.c | 82 +++++++++++++++++++++++------- include/sdhci.h | 18 +++++++ 6 files changed, 89 insertions(+), 169 deletions(-)delete mode 100644
arch/arm/include/asm/arch-s5pc1xx/mmc.hdelete mode 100644arch/arm/include/asm/arch-s5pc2xx/mmc.hcreate mode 100644include/sdhci.hboard/samsung/universal_c210/universal.c +4
-2@@ -23,10 +23,10 @@*/ #include <common.h> +#include <sdhci.h> #include <asm/io.h> #include <asm/arch/adc.h> #include <asm/arch/gpio.h> -#include <asm/arch/mmc.h> DECLARE_GLOBAL_DATA_PTR ;@@ -151,6 +151,7 @@ int checkboard(void)int board_mmc_init (bd_t *bis) {int i, err; +u32 base;switch (get_hwrev ()) {case 0 :@@ -217,7 +218,8 @@ int board_mmc_init(bd_t *bis)* mmc0 : eMMC (8-bit buswidth) * mmc2 : SD card (4-bit buswidth) */ - err =s5p_mmc_init (0 ,8 ); + base =samsung_get_base_mmc (); + err =sdhci_mmc_init ((void *)base,8 );/* * Check the T-flash detect pin board/samsung/universal_c210/universal.c int board_mmc_init(bd_t *bis) · line 246
Quoted 5 lines
board/samsung/universal_c210/universal.c +1
-1@@ -241,7 +243,7 @@ int board_mmc_init(bd_t *bis)/* GPK2[0:6] drv 4x */ gpio_set_drv (&gpio2->k2, i,GPIO_DRV_4X ); } - err =s5p_mmc_init (2 ,4 ); + err =sdhci_mmc_init ((void *)(base +0x20000 ),4 );No, please use the macro instead of constant. (pass the device number to macro)
Quoted 51 lines
board/samsung/universal_c210/universal.c +0
-0}return err;drivers/mmc/sdhci.c +37
-1@@ -21,18 +21,56 @@#include <common.h> #include <mmc.h> #include <asm/io.h> -#include <asm/arch/mmc.h> #include <asm/arch/clk.h> +struct sdhci_mmc { +unsigned int sysad; +unsigned short blksize; +unsigned short blkcnt; +unsigned int argument; +unsigned short trnmod; +unsigned short cmdreg; +unsigned int rspreg0; +unsigned int rspreg1; +unsigned int rspreg2; +unsigned int rspreg3; +unsigned int bdata; +unsigned int prnsts; +unsigned char hostctl; +unsigned char pwrcon; +unsigned char blkgap; +unsigned char wakcon; +unsigned short clkcon; +unsigned char timeoutcon; +unsigned char swrst; +unsigned int norintsts;/* errintsts */ +unsigned int norintstsen;/* errintstsen */ +unsigned int norintsigen;/* errintsigen */ +unsigned short acmd12errsts; +unsigned char res1[2 ]; +unsigned int capareg; +unsigned char res2[4 ]; +unsigned int maxcurr; +unsigned char res3[0x34 ]; +unsigned int control2; +unsigned int control3; +unsigned char res4[4 ]; +unsigned int control4; +unsigned char res5[0x6e ]; +unsigned short hcver; +}; +
Quoted 8 lines
drivers/mmc/sdhci.c line 68
Quoted 6 lines
drivers/mmc/sdhci.c +6
-0+struct mmc_host { +struct sdhci_mmc *reg; +unsigned int version;/* SDHCI spec. version */ +unsigned int clock;/* Current clock (MHz) */ +int dev_index; +};Please move this structures to header file.
Why? There is no header anymore. These structures are only used within the .c file, so there is no point in having a header. They were almost the same before and just duplicated code. The only difference was padding added to the end of the struct used to calculate base address and the 2nd controller. Using the size of the struct to calculate base addresses doesn't work for all platforms. The fact that there were already 2 structs for 2 platforms is evidence of that.
Quoted 62 lines
Quoted 62 lines
drivers/mmc/sdhci.c +11
-9+/* support 4 mmc hosts */ struct mmc mmc_dev[4 ];struct mmc_host mmc_host[4 ]; - -static inline struct s5p_mmc *s5p_get_base_mmc (int dev_index) -{ -unsigned long offset = dev_index *sizeof (struct s5p_mmc ); -return (struct s5p_mmc *)(samsung_get_base_mmc () + offset); -} +int dev_count;static void mmc_prepare_data (struct mmc_host *host,struct mmc_data *data) {@@ -255,6 +293,7 @@ static void mmc_change_clock(struct mmc_host *host, uint clock)unsigned long timeout;unsigned long ctrl2; +#ifdef CONFIG_S5P_MMC /* * SELBASECLK[5:4] * 00/01 = HCLK @@ -265,7 +304,7 @@ static void mmc_change_clock(struct mmc_host *host, uint clock) ctrl2&= ~(3 <<4 ); ctrl2 |= (2 <<4 );writel (ctrl2,&host->reg->control2); - +#endif writew (0 ,&host->reg->clkcon);/* XXX: we assume that clock is between 40MHz and 50MHz */ @@ -320,6 +359,7 @@ static void mmc_set_ios(struct mmc *mmc)debug ("bus_width: %x, clock: %d\n" , mmc->bus_width, mmc->clock); +#ifdef CONFIG_S5P_MMC /* * SELCLKPADDS[17:16] * 00 = 2mA @@ -349,7 +389,7 @@ static void mmc_set_ios(struct mmc *mmc)* 10 = Delay4 (inverter delay + 2ns) */ writel (0x8080 ,&host->reg->control3); - +#endif mmc_change_clock (host, mmc->clock); ctrl =readb (&host->reg->hostctl);@@ -445,14 +485,21 @@ static int mmc_core_init(struct mmc *mmc)return 0 ; } -static int s5p_mmc_initialize (int dev_index,int bus_width) +static int sdhci_mmc_initialize (void *base,int bus_width) {struct mmc *mmc; +struct mmc_host *host; + +if (dev_count>=4 ) +return -1 ;
Quoted 11 lines
drivers/mmc/sdhci.c static int mmc_core_init(struct mmc *mmc) · line 499
Quoted 5 lines
drivers/mmc/sdhci.c +4
-1- mmc =&mmc_dev[dev_index]; + mmc =&mmc_dev[dev_count]; + host =&mmc_host[dev_count]; + host->dev_index = dev_count; + dev_count++;NAK.
dev_indexis not a count number, it's a h/w device number. This change is wrong. (Maybe you misunderstood this concept) Please keep thedev_index.
What have I broken? The only thing the index was used for was getting the base address and indexing to driver struct. I've simply pulled out the base address from the driver so the board code can specify it. You still have an index that is controlled by order the board code initializes each controller.
Rob
PATCH 2/8 mmc: sdhci: rework Samsung specfic code
Dear Rob Herring,
Quoted 62 lines · Rob Herring
Quoted 52 lines · Minkyu Kang
Dear Rob Herring,
Quoted 48 lines · On 12 June 2011 06:46, Rob Herring<[email protected]> ?wrote:
drivers/mmc/sdhci.c +0
-0@@ -21,18 +21,56 @@?#include<common.h>
?#include<mmc.h>
?#include<asm/io.h>
-#include<asm/arch/mmc.h>
?#include<asm/arch/clk.h>drivers/mmc/sdhci.c +37
-0+struct sdhci_mmc { + ? ? ? unsigned int ? ?sysad; + ? ? ? unsigned short ?blksize; + ? ? ? unsigned short ?blkcnt; + ? ? ? unsigned int ? ?argument; + ? ? ? unsigned short ?trnmod; + ? ? ? unsigned short ?cmdreg; + ? ? ? unsigned int ? ?rspreg0; + ? ? ? unsigned int ? ?rspreg1; + ? ? ? unsigned int ? ?rspreg2; + ? ? ? unsigned int ? ?rspreg3; + ? ? ? unsigned int ? ?bdata; + ? ? ? unsigned int ? ?prnsts; + ? ? ? unsigned char ? hostctl; + ? ? ? unsigned char ? pwrcon; + ? ? ? unsigned char ? blkgap; + ? ? ? unsigned char ? wakcon; + ? ? ? unsigned short ?clkcon; + ? ? ? unsigned char ? timeoutcon; + ? ? ? unsigned char ? swrst; + ? ? ? unsigned int ? ?norintsts; ? ? ?/* errintsts */ + ? ? ? unsigned int ? ?norintstsen; ? ?/* errintstsen */ + ? ? ? unsigned int ? ?norintsigen; ? ?/* errintsigen */ + ? ? ? unsigned short ?acmd12errsts; + ? ? ? unsigned char ? res1[2]; + ? ? ? unsigned int ? ?capareg; + ? ? ? unsigned char ? res2[4]; + ? ? ? unsigned int ? ?maxcurr; + ? ? ? unsigned char ? res3[0x34]; + ? ? ? unsigned int ? ?control2; + ? ? ? unsigned int ? ?control3; + ? ? ? unsigned char ? res4[4]; + ? ? ? unsigned int ? ?control4; + ? ? ? unsigned char ? res5[0x6e]; + ? ? ? unsigned short ?hcver; +}; +Quoted 8 lines
drivers/mmc/sdhci.c
Quoted 6 lines
drivers/mmc/sdhci.c +6
-0+struct mmc_host { + ? ? ? struct sdhci_mmc *reg; + ? ? ? unsigned int version; ? /* SDHCI spec. version */ + ? ? ? unsigned int clock; ? ? /* Current clock (MHz) */ + ? ? ? int dev_index; +};Please move this structures to header file.
Quoted 7 lines
Why? There is no header anymore. These structures are only used within the .c file, so there is no point in having a header. They were almost the same before and just duplicated code. The only difference was padding added to the end of the struct used to calculate base address and the 2nd controller. Using the size of the struct to calculate base addresses doesn't work for all platforms. The fact that there were already 2 structs for 2 platforms is evidence of that.
I mean.. move it to include/sdhci.h.
There are possibility to use at other files.
Quoted 21 lines
Quoted 9 lines
Quoted 9 lines
drivers/mmc/sdhci.c +1
-1-static int s5p_mmc_initialize (int dev_index,int bus_width) +static int sdhci_mmc_initialize (void *base,int bus_width)?{
? ? ? ?struct mmc *mmc;
+ ? ? ? structmmc_host*host;
+
+ ? ? ? if (dev_count>= 4)
+ ? ? ? ? ? ? ? return -1;Quoted 11 lines
Quoted 5 lines
- ? ? ? mmc =&mmc_dev[dev_index];
+ ? ? ? mmc =&mmc_dev[dev_count];
+ ? ? ? host =&mmc_host[dev_count];
+ ? ? ?host->dev_index=dev_count;
+ ? ? ? dev_count++;NAK.
dev_indexis not a count number, it's a h/w device number. This change is wrong. (Maybe you misunderstood this concept) Please keep thedev_index.
Quoted 5 lines
What have I broken? The only thing the index was used for was getting the base address and indexing to driver struct. I've simply pulled out the base address from the driver so the board code can specify it. You still have an index that is controlled by order the board code initializes each controller.
No.
Please see the code in detail.dev_index is used by set_mmc_clk in mmc_chage_clock function (line 295). set_mmc_clk need h/w device number.
universal_c210 board have 2 mmc device.
device 0 is eMMC and device 2 is SD card.
According to your patch, we should register the dummy device for device 1. I can't agree it.
Please don't modify unrelated part of patch.
Thanks
Minkyu Kang
Signature · 2 lines
from. prom. www.promsoft.net
PATCH 1/1 mmc: sdhci: rework Samsung specfic code
From: Rob Herring <[email protected]>
Create a common header sdhci.h and move register defintions there. Set the base address from the board init code.
The Samsung SDHCI controller has extra registers. Make them conditional on CONFIG_MMC_S5P.
---
Minkyu Kang,
Please take a look at the updated patch. I've implemented most
I moved the register definitions, but kept "struct mmc_host" within the .c file. It is private to the driver.
I'm not sure if other devices have the same offsets. If so, the macro for the device offset could be made more generic. I find the whole use of indexes to calculate the base addresses to be fragile. It will work for some chips, but is easily broken.
Rob
arch/arm/include/asm/arch-s5pc1xx/mmc.h | 73 ------------------------------ arch/arm/include/asm/arch-s5pc2xx/cpu.h | 4 ++ arch/arm/include/asm/arch-s5pc2xx/mmc.h | 73 ------------------------------ board/samsung/goni/goni.c | 4 +- board/samsung/universal_c210/universal.c | 6 +- drivers/mmc/sdhci.c | 31 +++++++------ include/sdhci.h | 62 +++++++++++++++++++++++++ 7 files changed, 88 insertions(+), 165 deletions(-) delete mode 100644 arch/arm/include/asm/arch-s5pc1xx/mmc.h delete mode 100644 arch/arm/include/asm/arch-s5pc2xx/mmc.h create mode 100644 include/sdhci.h
arch/arm/include/asm/arch-s5pc1xx/mmc.h deleted +0 -73
@@ -1,73 +0,0 @@ -/* -* (C) Copyright 2009 SAMSUNG Electronics -* Minkyu Kang <[email protected]> -* -* 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 -* -*/ - -#ifndef __ASM_ARCH_MMC_H_ -#define __ASM_ARCH_MMC_H_ - -#ifndef __ASSEMBLY__ -struct s5p_mmc { -unsigned int sysad; -unsigned short blksize; -unsigned short blkcnt; -unsigned int argument; -unsigned short trnmod; -unsigned short cmdreg; -unsigned int rspreg0; -unsigned int rspreg1; -unsigned int rspreg2; -unsigned int rspreg3; -unsigned int bdata; -unsigned int prnsts; -unsigned char hostctl; -unsigned char pwrcon; -unsigned char blkgap; -unsigned char wakcon; -unsigned short clkcon; -unsigned char timeoutcon; -unsigned char swrst; -unsigned int norintsts;/* errintsts */ -unsigned int norintstsen;/* errintstsen */ -unsigned int norintsigen;/* errintsigen */ -unsigned short acmd12errsts; -unsigned char res1[2 ]; -unsigned int capareg; -unsigned char res2[4 ]; -unsigned int maxcurr; -unsigned char res3[0x34 ]; -unsigned int control2; -unsigned int control3; -unsigned char res4[4 ]; -unsigned int control4; -unsigned char res5[0x6e ]; -unsigned short hcver; -unsigned char res6[0xFFF00 ]; -}; - -struct mmc_host { -struct s5p_mmc *reg; -unsigned int version;/* SDHCI spec. version */ -unsigned int clock;/* Current clock (MHz) */ -int dev_index; -}; - -int s5p_mmc_init (int dev_index,int bus_width); - -#endif /* __ASSEMBLY__ */ -#endif
arch/arm/include/asm/arch-s5pc2xx/cpu.h +4 -0
@@ -108,6 +108,10 @@ SAMSUNG_BASE(uart, UART_BASE) SAMSUNG_BASE(usb_phy, USBPHY_BASE) SAMSUNG_BASE(usb_otg, USBOTG_BASE) SAMSUNG_BASE(watchdog, WATCHDOG_BASE) + +#define samsung_get_base_mmc_offset (idx) (samsung_get_base_mmc() + \ + 0x10000 * (idx)) +#endif #endif /* _S5PC2XX_CPU_H */
arch/arm/include/asm/arch-s5pc2xx/mmc.h deleted +0 -73
73 lines not on this page · raw message
board/samsung/goni/goni.c +2 -2
@@ -23,8 +23,8 @@*/ #include <common.h> +#include <sdhci.h> #include <asm/arch/gpio.h> -#include <asm/arch/mmc.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -93,6 +93,6 @@ int board_mmc_init(bd_t *bis) gpio_set_drv(&s5pc110_gpio->g0, i, GPIO_DRV_4X); } -return s5p_mmc_init (0 ,4 ); +return sdhci_mmc_init (0 ,samsung_get_base_mmc (),4 ); }#endif
board/samsung/universal_c210/universal.c +3 -3
@@ -23,10 +23,10 @@*/ #include <common.h> +#include <sdhci.h> #include <asm/io.h> #include <asm/arch/adc.h> #include <asm/arch/gpio.h> -#include <asm/arch/mmc.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -217,7 +217,7 @@ int board_mmc_init(bd_t *bis)* mmc0 : eMMC (8-bit buswidth) * mmc2 : SD card (4-bit buswidth) */ - err =s5p_mmc_init (0 ,8 ); + err =sdhci_mmc_init (0 ,samsung_get_base_mmc_offset (0 ),8 );/* * Check the T-flash detect pin
@@ -241,7 +241,7 @@ int board_mmc_init(bd_t *bis)/* GPK2[0:6] drv 4x */ gpio_set_drv (&gpio2->k2, i,GPIO_DRV_4X ); } - err =s5p_mmc_init (2 ,4 ); + err =sdhci_mmc_init (2 ,samsung_get_base_mmc_offset (2 ),4 ); }return err;
drivers/mmc/sdhci.c +17 -14
@@ -20,20 +20,21 @@#include <common.h> #include <mmc.h> +#include <sdhci.h> #include <asm/io.h> -#include <asm/arch/mmc.h> #include <asm/arch/clk.h> +struct mmc_host { +struct sdhci_mmc *reg; +unsigned int version;/* SDHCI spec. version */ +unsigned int clock;/* Current clock (MHz) */ +int dev_index; +}; +/* support 4 mmc hosts */ struct mmc mmc_dev[4 ];struct mmc_host mmc_host[4 ]; -static inline struct s5p_mmc *s5p_get_base_mmc (int dev_index) -{ -unsigned long offset = dev_index *sizeof (struct s5p_mmc ); -return (struct s5p_mmc *)(samsung_get_base_mmc () + offset); -} -static void mmc_prepare_data (struct mmc_host *host,struct mmc_data *data) {unsigned char ctrl;
@@ -255,6 +256,7 @@ static void mmc_change_clock(struct mmc_host *host, uint clock)unsigned long timeout;unsigned long ctrl2; +#ifdef CONFIG_S5P_MMC /* * SELBASECLK[5:4] * 00/01 = HCLK
@@ -265,7 +267,7 @@ static void mmc_change_clock(struct mmc_host *host, uint clock) ctrl2 &= ~(3 <<4 ); ctrl2 |= (2 <<4 );writel (ctrl2, &host->reg->control2); - +#endif writew (0 , &host->reg->clkcon);/* XXX: we assume that clock is between 40MHz and 50MHz */
@@ -320,6 +322,7 @@ static void mmc_set_ios(struct mmc *mmc)debug ("bus_width: %x, clock: %d\n" , mmc->bus_width, mmc->clock); +#ifdef CONFIG_S5P_MMC /* * SELCLKPADDS[17:16] * 00 = 2mA
@@ -349,7 +352,7 @@ static void mmc_set_ios(struct mmc *mmc)* 10 = Delay4 (inverter delay + 2ns) */ writel (0x8080 , &host->reg->control3); - +#endif mmc_change_clock (host, mmc->clock); ctrl =readb (&host->reg->hostctl);
@@ -445,13 +448,13 @@ static int mmc_core_init(struct mmc *mmc)return 0 ; } -static int s5p_mmc_initialize (int dev_index,int bus_width) +static int sdhci_mmc_initialize (int dev_index,void *base,int bus_width) {struct mmc *mmc; mmc = &mmc_dev[dev_index]; -sprintf (mmc->name,"SAMSUNG SD/MMC" ); +sprintf (mmc->name,"SDHCI SD/MMC" ); mmc->priv = &mmc_host[dev_index]; mmc->send_cmd = mmc_send_cmd; mmc->set_ios = mmc_set_ios;
@@ -469,14 +472,14 @@ static int s5p_mmc_initialize(int dev_index, int bus_width) mmc_host[dev_index].dev_index = dev_index; mmc_host[dev_index].clock =0 ; - mmc_host[dev_index].reg =s5p_get_base_mmc (dev_index); + mmc_host[dev_index].reg = base; mmc->b_max =0 ;mmc_register (mmc);return 0 ; } -int s5p_mmc_init (int dev_index,int bus_width) +int sdhci_mmc_init (int dev_index,unsigned int base,int bus_width) { -return s5p_mmc_initialize (dev_index, bus_width); +return sdhci_mmc_initialize (dev_index, (void *)base, bus_width); }
include/sdhci.h new file +62 -0
62 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 1/1 mmc: sdhci: rework Samsung specfic code
Dear Rob Herring,
Quoted 24 lines · Rob Herring
?arch/arm/include/asm/arch-s5pc1xx/mmc.h ?| ? 73 ------------------------------ ?arch/arm/include/asm/arch-s5pc2xx/cpu.h ?| ? ?4 ++ ?arch/arm/include/asm/arch-s5pc2xx/mmc.h ?| ? 73 ------------------------------ ?board/samsung/goni/goni.c ? ? ? ? ? ? ? ?| ? ?4 +- ?board/samsung/universal_c210/universal.c | ? ?6 +- ?drivers/mmc/sdhci.c ? ? ? ? ? ? ? ? ? ? ?| ? 31 +++++++------ ?include/sdhci.h ? ? ? ? ? ? ? ? ? ? ? ? ?| ? 62 +++++++++++++++++++++++++?7 files changed, 88 insertions(+), 165 deletions(-) ?delete mode 100644
arch/arm/include/asm/arch-s5pc1xx/mmc.h?delete mode 100644arch/arm/include/asm/arch-s5pc2xx/mmc.h?create mode 100644include/sdhci.harch/arm/include/asm/arch-s5pc2xx/cpu.h +4
-0@@ -108,6 +108,10 @@ SAMSUNG_BASE(uart, UART_BASE) ?SAMSUNG_BASE(usb_phy, USBPHY_BASE) ?SAMSUNG_BASE(usb_otg, USBOTG_BASE) ?SAMSUNG_BASE(watchdog, WATCHDOG_BASE) + +#define samsung_get_base_mmc_offset (idx) ? ? ? (samsung_get_base_mmc() + \ + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?0x10000 * (idx)) +?#endif
Quoted 1 line
?#endif /*
_S5PC2XX_CPU_H*/
Looks fine.
But, missing arch/arm/include/asm/arch-s5pc1xx/cpu.h
Dear Jaehoon,
Please test this patch on s5pc1xx and s5pc2xx.
Thanks
Minkyu Kang
Signature · 2 lines
from. prom. www.promsoft.net
PATCH 1/1 mmc: sdhci: rework Samsung specfic code
But Mr.Kang mentioned missing arch/arm/include/asm/arch-s5pc1xx/cpu.h Need the below patch..
(s5pc2xx and s5pc1xx are working well)
arch/arm/include/asm/arch-s5pc1xx/cpu.h +3 -0
@@ -94,6 +94,9 @@ SAMSUNG_BASE(mmc, MMC_BASE) SAMSUNG_BASE(sromc, SROMC_BASE) SAMSUNG_BASE(timer, PWMTIMER_BASE) SAMSUNG_BASE(uart, UART_BASE) + +#define samsung_get_base_mmc_offset (idx) (samsung_get_base_mmc() + \ + 0x10000 * (idx))#endif #endif /* _S5PC1XX_CPU_H */
Regards,
Jaehoon Chung
Quoted 38 lines · Minkyu Kang
Dear Rob Herring,
Quoted 15 lines · Rob Herring
arch/arm/include/asm/arch-s5pc1xx/mmc.h | 73 ------------------------------ arch/arm/include/asm/arch-s5pc2xx/cpu.h | 4 ++ arch/arm/include/asm/arch-s5pc2xx/mmc.h | 73 ------------------------------ board/samsung/goni/goni.c | 4 +- board/samsung/universal_c210/universal.c | 6 +- drivers/mmc/sdhci.c | 31 +++++++------ include/sdhci.h | 62 +++++++++++++++++++++++++ 7 files changed, 88 insertions(+), 165 deletions(-) delete mode 100644 arch/arm/include/asm/arch-s5pc1xx/mmc.h delete mode 100644 arch/arm/include/asm/arch-s5pc2xx/mmc.h create mode 100644 include/sdhci.harch/arm/include/asm/arch-s5pc2xx/cpu.h SAMSUNG_BASE(uart, UART_BASE) · line 117
Quoted 10 lines
arch/arm/include/asm/arch-s5pc2xx/cpu.h +4
-0@@ -108,6 +108,10 @@ SAMSUNG_BASE(uart, UART_BASE) SAMSUNG_BASE(usb_phy, USBPHY_BASE) SAMSUNG_BASE(usb_otg, USBOTG_BASE) SAMSUNG_BASE(watchdog, WATCHDOG_BASE) + +#define samsung_get_base_mmc_offset (idx) (samsung_get_base_mmc() + \ + 0x10000 * (idx)) +#endif #endif /* _S5PC2XX_CPU_H */ Looks fine.
But, missingarch/arm/include/asm/arch-s5pc1xx/cpu.hDear Jaehoon,
Please test this patch on s5pc1xx and s5pc2xx.
Thanks
Minkyu Kang
PATCH 1/1 mmc: sdhci: rework Samsung specfic code
Quoted 11 lines · Jaehoon Chung
Tested-by Jaehoon Chung <[email protected]>But Mr.Kang mentioned missing
arch/arm/include/asm/arch-s5pc1xx/cpu.hNeed the below patch..
(s5pc2xx and s5pc1xx are working well)arch/arm/include/asm/arch-s5pc1xx/cpu.h +0
-0
arch/arm/include/asm/arch-s5pc1xx/cpu.h SAMSUNG_BASE(mmc, MMC_BASE) · line 99
Quoted 6 lines
arch/arm/include/asm/arch-s5pc1xx/cpu.h +3
-0@@ -94,6 +94,9 @@ SAMSUNG_BASE(mmc, MMC_BASE) ?SAMSUNG_BASE(sromc, SROMC_BASE) ?SAMSUNG_BASE(timer, PWMTIMER_BASE) ?SAMSUNG_BASE(uart, UART_BASE) + +#define samsung_get_base_mmc_offset (idx) ? ? ? (samsung_get_base_mmc() + \ + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?0x10000 * (idx))
I think.. offset is wrong.
In case of s5pc1xx, 0x10_0000 is right.
Please check.
Thanks
Minkyu Kang
Signature · 2 lines
from. prom. www.promsoft.net
PATCH 1/1 mmc: sdhci: rework Samsung specfic code
Quoted 7 lines · Minkyu Kang
Quoted 6 lines · Jaehoon Chung
Tested-by Jaehoon Chung <[email protected]>But Mr.Kang mentioned missing
arch/arm/include/asm/arch-s5pc1xx/cpu.hNeed the below patch..
(s5pc2xx and s5pc1xx are working well)
Quoted 15 lines
arch/arm/include/asm/arch-s5pc1xx/cpu.h SAMSUNG_BASE(mmc, MMC_BASE) · line 99
Quoted 11 lines
arch/arm/include/asm/arch-s5pc1xx/cpu.h +3
-0@@ -94,6 +94,9 @@ SAMSUNG_BASE(mmc, MMC_BASE) SAMSUNG_BASE(sromc, SROMC_BASE) SAMSUNG_BASE(timer, PWMTIMER_BASE) SAMSUNG_BASE(uart, UART_BASE) + +#define samsung_get_base_mmc_offset (idx) (samsung_get_base_mmc() + \ + 0x10000 * (idx))I think.. offset is wrong.
In case of s5pc1xx, 0x10_0000 is right.
Please check.
Sorry..my mistake..you're right.
Offset is 0x10_0000
Thanks,
Jaehoon chung
PATCH 2/8 mmc: sdhci: rework Samsung specfic code
In reply to Rob HerringQuoted 11 lines · Rob Herring
include/sdhci.h new file +8
-0@@ -0,0 +1,18 @@ +/* +* Copyright 2011 Calxeda, Inc. +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT
include/sdhci.h line 18
Quoted 10 lines
include/sdhci.h new file +10
-0+* 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, see <http://www.gnu.org/licenses/>. +*/ + +int sdhci_mmc_init (void *base,int bus_width); +
please add ifdef protection against multiple inclusion -mike
PATCH 3/8 mmc: sdhci: exit cmd on error status
In reply to Rob HerringFrom: Rob Herring <[email protected]>
If the controller has an error condition, then stop polling for command complete and exit mmc_send_cmd.
--- drivers/mmc/sdhci.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/mmc/sdhci.c +4 -0
@@ -206,6 +206,10 @@ static int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,writel (mask, &host->reg->norintsts);break ; } +if (mask & (1 <<15 )) { +writel (mask, &host->reg->norintsts); +return -1 ; + } }if (i == retry) {
Signature · 1 line
1.7.4.1
PATCH 4/8 arm: add __ilog2 function
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Add __ilog2 function for ARM. Needed for ahci.c
--- arch/arm/include/asm/bitops.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
arch/arm/include/asm/bitops.h +9 -0
@@ -106,6 +106,15 @@ static inline int test_bit(int nr, const void * addr)return ((unsigned char *) addr)[nr >>3 ] & (1U << (nr &7 )); } +extern __inline__int __ilog2 (unsigned int x) +{ +int ret; + + asm("clz\t%0, %1" :"=r" (ret) :"r" (x)); + ret =31 - ret; +return ret; +} +/* * ffz = Find First Zero in word. Undefined if no zero exists, * so code should check against ~0UL first..
Signature · 1 line
1.7.4.1
PATCH 5/8 scsi/ahci: ata id little endian fix
In reply to Rob HerringFrom: Rob Herring <[email protected]>
The ata id string always needs swapping, not just on BE machines.
--- drivers/block/ahci.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/block/ahci.c +1 -1
@@ -468,7 +468,7 @@ static char *ata_id_strcpy(u16 *target, u16 *src, int len) {int i;for (i =0 ; i < len /2 ; i++) - target[i] =le16_to_cpu (src[i]); + target[i] =swab16 (src[i]);return (char *)target; }
Signature · 1 line
1.7.4.1
PATCH 6/8 scsi/ahci: add support for non-PCI controllers
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Add support for AHCI controllers that are not PCI based.
--- common/cmd_scsi.c | 6 +++- drivers/block/ahci.c | 70 +++++++++++++++++++++++++++++++++++++++++++------ include/ahci.h | 4 +++ include/scsi.h | 1 + 4 files changed, 70 insertions(+), 11 deletions(-)
common/cmd_scsi.c +4 -2
@@ -47,7 +47,8 @@#define SCSI_DEV_ID 0x5288#else -#error no scsi device defined +#define SCSI_VEND_ID 0 +#define SCSI_DEV_ID 0#endif
@@ -174,7 +175,7 @@ removable: scsi_curr_dev =-1 ; } - +#ifdef CONFIG_PCI void scsi_init (void ) {int busdevfunc;
@@ -192,6 +193,7 @@ void scsi_init(void)scsi_low_level_init (busdevfunc); scsi_scan(1); } +#endif block_dev_desc_t *scsi_get_dev (int dev) {
drivers/block/ahci.c +61 -9
149 lines not on this page · raw message
include/ahci.h +4 -0
@@ -25,6 +25,8 @@#ifndef _AHCI_H_#define _AHCI_H_ +#include <pci.h> +#define AHCI_PCI_BAR 0x24#define AHCI_MAX_SG 56/* hardware max is 64K */ #define AHCI_CMD_SLOT_SZ 32
@@ -187,4 +189,6 @@ struct ahci_probe_ent { u32 link_port_map; /*linkup port map*/ }; +int ahci_init (u32 base); +#endif
include/scsi.h +1 -0
@@ -185,6 +185,7 @@ void scsi_low_level_init(int busdevfunc);* functions residing inside cmd_scsi.c */ void scsi_init (void ); +void scsi_scan (int mode);#define SCSI_IDENTIFY 0xC0/* not used */
Signature · 1 line
1.7.4.1
PATCH 7/8 ARM: add missing CONFIG_SKIP_LOWLEVEL_INIT for armv7
In reply to Rob HerringFrom: Rob Herring <[email protected]>
cpu_init_crit can be skipped, but the code is still enabled requiring a platform to supply lowlevel_init.
--- arch/arm/cpu/armv7/start.S | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/cpu/armv7/start.S +2 -0
@@ -275,6 +275,7 @@ _rel_dyn_end_ofs: _dynsym_start_ofs: .word __dynsym_start - _start +#ifndef CONFIG_SKIP_LOWLEVEL_INIT /************************************************************************* * * CPU_init_critical registers
@@ -311,6 +312,7 @@ cpu_init_crit: bl lowlevel_init @ go setup pll,mux,memory mov lr, ip @ restore link mov pc, lr @ back to my caller +#endif /* ************************************************************************* *
Signature · 1 line
1.7.4.1
PATCH 7/8 ARM: add missing CONFIG_SKIP_LOWLEVEL_INIT for armv7
Hi Rob,
Le 11/06/2011 23:46, Rob Herring a ?crit :
Quoted 7 lines
From: Rob Herring<[email protected]>
cpu_init_critcan be skipped, but the code is still enabled requiring a platform to supplylowlevel_init.Signed-off-by Rob Herring<[email protected]>---
Applied to u-boot-arm/master, thanks!
Amicalement,
Signature · 1 line
Albert.
PATCH 8/8 ARM: Add Calxeda Highbank platform
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Add basic support for Calxeda Highbank platform. This includes support for serial, mmc, and sata.
--- arch/arm/cpu/armv7/highbank/Makefile | 46 +++++++++++ arch/arm/cpu/armv7/highbank/config.mk | 4 + arch/arm/cpu/armv7/highbank/timer.c | 124 ++++++++++++++++++++++++++++++ arch/arm/include/asm/arch-highbank/clk.h | 22 +++++ board/highbank/Makefile | 49 ++++++++++++ board/highbank/highbank.c | 57 ++++++++++++++ boards.cfg | 1 + include/configs/highbank.h | 117 ++++++++++++++++++++++++++++ 8 files changed, 420 insertions(+), 0 deletions(-) create mode 100644 arch/arm/cpu/armv7/highbank/Makefile create mode 100644 arch/arm/cpu/armv7/highbank/config.mk create mode 100644 arch/arm/cpu/armv7/highbank/timer.c create mode 100644 arch/arm/include/asm/arch-highbank/clk.h create mode 100644 board/highbank/Makefile create mode 100644 board/highbank/highbank.c create mode 100644 include/configs/highbank.h
arch/arm/cpu/armv7/highbank/Makefile new file +46 -0
@@ -0,0 +1,46 @@ +# +# (C) Copyright 2000-2006 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# See file CREDITS for list of people who contributed to this +# project. +# +# 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 $(TOPDIR)/config.mk + +LIB = $(obj)lib$(SOC).o + +COBJS := timer.o +SOBJS := + +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) + +all: $(obj).depend $(LIB) + +$(LIB): $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
arch/arm/cpu/armv7/highbank/config.mk new file +4 -0
@@ -0,0 +1,4 @@ +STANDALONE_LOAD_ADDR = 0x100000 + +PLATFORM_CPPFLAGS += -march=armv7-a +
arch/arm/cpu/armv7/highbank/timer.c new file +124 -0
124 lines not on this page · raw message
arch/arm/include/asm/arch-highbank/clk.h new file +22 -0
@@ -0,0 +1,22 @@ +/* +* Copyright 2011 Calxeda, Inc. +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope 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, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __ASM_ARM_ARCH_CLK_H_ +#define __ASM_ARM_ARCH_CLK_H_ + +static inline void set_mmc_clk (int dev_index,unsigned int div) {} + +#endif
board/highbank/Makefile new file +49 -0
49 lines not on this page · raw message
board/highbank/highbank.c new file +57 -0
57 lines not on this page · raw message
boards.cfg +1 -0
@@ -126,6 +126,7 @@ omap5912osk arm arm926ejs - ti edminiv2 arm arm926ejs - LaCie orion5x dkb arm arm926ejs - Marvell pantheon ca9x4_ct_vxp arm armv7 vexpress armltd +highbank arm armv7 highbank - highbank efikamx arm armv7 efikamx - mx5 mx51evk:IMX_CONFIG=board/efikamx/imximage.cfg mx51evk arm armv7 mx51evk freescale mx5 mx51evk:IMX_CONFIG=board/freescale/mx51evk/imximage.cfg mx53evk arm armv7 mx53evk freescale mx5 mx53evk:IMX_CONFIG=board/freescale/mx53evk/imximage.cfg
include/configs/highbank.h new file +117 -0
117 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 8/8 ARM: Add Calxeda Highbank platform
Hi Rob,
Le 11/06/2011 23:46, Rob Herring a ?crit :
Quoted 8 lines
From: Rob Herring<[email protected]>
Add basic support for Calxeda Highbank platform. This includes support for serial, mmc, and sata.
Signed-off-by Jason Hobbs<[email protected]>Signed-off-by Rob Herring<[email protected]>---
This one will get in when all previous ones in the series are applied. Please ping me as a reminder if needed.
Amicalement,
Signature · 1 line
Albert.
PATCH 8/8 ARM: Add Calxeda Highbank platform
Le 17/07/2011 11:29, Albert ARIBAUD a ?crit :
Quoted 9 lines
Hi Rob,
Le 11/06/2011 23:46, Rob Herring a ?crit :
Quoted 6 lines
From: Rob Herring<[email protected]>
Add basic support for Calxeda Highbank platform. This includes support for
serial, mmc, and sata.
Quoted 8 lines
Quoted 3 lines
Signed-off-by Jason Hobbs<[email protected]>Signed-off-by Rob Herring<[email protected]>---
This one will get in when all previous ones in the series are applied. Please ping me as a reminder if needed.
Amicalement,
Sorry -- was a bit quick on this one. I'd forgotten the subsequent changes and issues with numbering. I'll keep the 1/8 because it was inherently OK from day 1 (thus it should not be part of any new patch set) but I'll make sure I get a clean numbered patch for the platform addition patch itself.
Amicalement,
Signature · 1 line
Albert.