Introducing the Broadcom bcm281xx Architecture
Subsystems (6)
cover Introducing the Broadcom bcm281xx Architecture
This patchset introduces the Broadcom bcm281xx family of mobile SoC chips. Broadcom kona hardware blocks are often found in Broadcom mobile SoC chips including the bcm281xx family, so support for some of these kona blocks is also provided here. These patches work on u-boot master as well as the u-boot-arm custodian tree.
v1 changes
----------
Delete lowlevel_init.S and create s_init.c. File header cleanup, cosmetic changes, dead code removal. Create include/bitfield.h. Use get_ram_size(). Use weak timer_init(); Skip lowlevel init. Remove memory test config. Use standard baud table and prompt.
Darwin Rambo (6):
arch: kona: Initial commit of kona-common architecture code
arch: bcm281xx: Initial commit of bcm281xx architecture code
gpio: kona: Add Kona gpio driver
i2c: kona: Add Kona I2C driver
mmc: kona: Add Kona mmc driver
board: bcm28155_ap: Add board files
arch/arm/cpu/armv7/Makefile | 1 + arch/arm/cpu/armv7/bcm281xx/Makefile | 11 + arch/arm/cpu/armv7/bcm281xx/clk-bcm281xx.c | 523 +++++++++++++++++ arch/arm/cpu/armv7/bcm281xx/clk-bsc.c | 52 ++ arch/arm/cpu/armv7/bcm281xx/clk-core.c | 513 +++++++++++++++++ arch/arm/cpu/armv7/bcm281xx/clk-core.h | 495 ++++++++++++++++ arch/arm/cpu/armv7/bcm281xx/clk-sdio.c | 73 +++ arch/arm/cpu/armv7/bcm281xx/reset.c | 27 + arch/arm/cpu/armv7/kona-common/Makefile | 9 + arch/arm/cpu/armv7/kona-common/clk-stubs.c | 21 + arch/arm/cpu/armv7/kona-common/hwinit-common.c | 16 + arch/arm/cpu/armv7/kona-common/s_init.c | 12 + arch/arm/include/asm/arch-bcm281xx/gpio.h | 15 + arch/arm/include/asm/arch-bcm281xx/sysmap.h | 25 + arch/arm/include/asm/kona-common/clk.h | 29 + arch/arm/include/asm/kona-common/kona_sdhci.h | 12 + board/broadcom/bcm28155_ap/Makefile | 7 + board/broadcom/bcm28155_ap/bcm28155_ap.c | 87 +++ boards.cfg | 1 + drivers/gpio/Makefile | 1 + drivers/gpio/kona_gpio.c | 141 +++++ drivers/i2c/Makefile | 1 + drivers/i2c/kona_i2c.c | 730 ++++++++++++++++++++++++ drivers/mmc/Makefile | 1 + drivers/mmc/kona_sdhci.c | 125 ++++ include/bitfield.h | 56 ++ include/configs/bcm28155_ap.h | 140 +++++ 27 files changed, 3124 insertions(+) create mode 100644 arch/arm/cpu/armv7/bcm281xx/Makefile create mode 100644 arch/arm/cpu/armv7/bcm281xx/clk-bcm281xx.c create mode 100644 arch/arm/cpu/armv7/bcm281xx/clk-bsc.c create mode 100644 arch/arm/cpu/armv7/bcm281xx/clk-core.c create mode 100644 arch/arm/cpu/armv7/bcm281xx/clk-core.h create mode 100644 arch/arm/cpu/armv7/bcm281xx/clk-sdio.c create mode 100644 arch/arm/cpu/armv7/bcm281xx/reset.c create mode 100644 arch/arm/cpu/armv7/kona-common/Makefile create mode 100644 arch/arm/cpu/armv7/kona-common/clk-stubs.c create mode 100644 arch/arm/cpu/armv7/kona-common/hwinit-common.c create mode 100644 arch/arm/cpu/armv7/kona-common/s_init.c create mode 100644 arch/arm/include/asm/arch-bcm281xx/gpio.h create mode 100644 arch/arm/include/asm/arch-bcm281xx/sysmap.h create mode 100644 arch/arm/include/asm/kona-common/clk.h create mode 100644 arch/arm/include/asm/kona-common/kona_sdhci.h create mode 100644 board/broadcom/bcm28155_ap/Makefile create mode 100644 board/broadcom/bcm28155_ap/bcm28155_ap.c create mode 100644 drivers/gpio/kona_gpio.c create mode 100644 drivers/i2c/kona_i2c.c create mode 100644 drivers/mmc/kona_sdhci.c create mode 100644 include/bitfield.h create mode 100644 include/configs/bcm28155_ap.h
Signature · 1 line
1.7.9.5
PATCH 1/6 arch: kona: Initial commit of kona-common architecture code
The Kona architecture is present on a number of Broadcom mobile SoCs including the bcm281xx family of chips.
--- arch/arm/cpu/armv7/Makefile | 1 + arch/arm/cpu/armv7/kona-common/Makefile | 9 ++++++++ arch/arm/cpu/armv7/kona-common/clk-stubs.c | 21 +++++++++++++++++ arch/arm/cpu/armv7/kona-common/hwinit-common.c | 16 +++++++++++++ arch/arm/cpu/armv7/kona-common/s_init.c | 12 ++++++++++ arch/arm/include/asm/kona-common/clk.h | 29 ++++++++++++++++++++++++ arch/arm/include/asm/kona-common/kona_sdhci.h | 12 ++++++++++ 7 files changed, 100 insertions(+) create mode 100644 arch/arm/cpu/armv7/kona-common/Makefile create mode 100644 arch/arm/cpu/armv7/kona-common/clk-stubs.c create mode 100644 arch/arm/cpu/armv7/kona-common/hwinit-common.c create mode 100644 arch/arm/cpu/armv7/kona-common/s_init.c create mode 100644 arch/arm/include/asm/kona-common/clk.h create mode 100644 arch/arm/include/asm/kona-common/kona_sdhci.h
arch/arm/cpu/armv7/Makefile +1 -0
@@ -23,6 +23,7 @@ obj-y += nonsec_virt.o obj-y += virt-v7.o endif +obj-$(CONFIG_KONA) += kona-common/ obj-$(CONFIG_OMAP_COMMON) += omap-common/ obj-$(CONFIG_TEGRA) += tegra-common/
arch/arm/cpu/armv7/kona-common/Makefile new file +9 -0
@@ -0,0 +1,9 @@ +# +# Copyright 2013 Broadcom Corporation. All rights reserved. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += s_init.o +obj-y += hwinit-common.o +obj-y += clk-stubs.o
arch/arm/cpu/armv7/kona-common/clk-stubs.c new file +21 -0
@@ -0,0 +1,21 @@ +/* +* Copyright 2013 Broadcom Corporation. All rights reserved. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> + +/* +* These weak functions are available to kona architectures that don't +* require clock enables from the driver code. +*/ +int __weak clk_sdio_enable (void *base,u32 rate,u32 *actual_ratep) +{ +return 0 ; +} + +int __weak clk_bsc_enable (void *base,u32 rate,u32 *actual_ratep) +{ +return 0 ; +}
arch/arm/cpu/armv7/kona-common/hwinit-common.c new file +16 -0
@@ -0,0 +1,16 @@ +/* +* Copyright 2013 Broadcom Corporation. All rights reserved. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/sizes.h> + +#ifndef CONFIG_SYS_DCACHE_OFF +void enable_caches (void ) +{ +/* Enable D-cache. I-cache is already enabled in start.S */ +dcache_enable (); +} +#endif
arch/arm/cpu/armv7/kona-common/s_init.c new file +12 -0
@@ -0,0 +1,12 @@ +/* +* System init +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +/* +* Early system init. Currently empty. +*/ +void s_init (void ) +{ +}
arch/arm/include/asm/kona-common/clk.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* Copyright 2013 Broadcom Corporation. All rights reserved. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +/* This API file is loosely based on u-boot/drivers/video/ipu.h and linux */ + +#ifndef __KONA_COMMON_CLK_H +#define __KONA_COMMON_CLK_H + +#include <linux/types.h> + +struct clk ; + +/* Only implement required functions for your specific architecture */ +int clk_init (void ); +struct clk *clk_get (const char *id); +int clk_enable (struct clk *clk); +void clk_disable (struct clk *clk); +unsigned long clk_get_rate (struct clk *clk); +long clk_round_rate (struct clk *clk,unsigned long rate); +int clk_set_rate (struct clk *clk,unsigned long rate); +int clk_set_parent (struct clk *clk,struct clk *parent); +struct clk *clk_get_parent (struct clk *clk); +int clk_sdio_enable (void *base,u32 rate,u32 *actual_ratep); +int clk_bsc_enable (void *base); + +#endif
arch/arm/include/asm/kona-common/kona_sdhci.h new file +12 -0
@@ -0,0 +1,12 @@ +/* +* Copyright 2013 Broadcom Corporation. All rights reserved. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __KONA_SDHCI_H +#define __KONA_SDHCI_H + +int kona_sdhci_init (int dev_index,u32 min_clk,u32 quirks); + +#endif
Signature · 1 line
1.7.9.5
PATCH 2/6 arch: bcm281xx: Initial commit of bcm281xx architecture code
In reply to Darwin RamboAdd bcm281xx architecture support code including a clock framework and chip reset. Define register block base addresses for the bcm281xx architecture and create an empty gpio header file required when CONFIG_CMD_GPIO is set.
--- arch/arm/cpu/armv7/bcm281xx/Makefile | 11 + arch/arm/cpu/armv7/bcm281xx/clk-bcm281xx.c | 523 +++++++++++++++++++++++++++ arch/arm/cpu/armv7/bcm281xx/clk-bsc.c | 52 +++ arch/arm/cpu/armv7/bcm281xx/clk-core.c | 513 ++++++++++++++++++++++++++ arch/arm/cpu/armv7/bcm281xx/clk-core.h | 495 +++++++++++++++++++++++++ arch/arm/cpu/armv7/bcm281xx/clk-sdio.c | 73 ++++ arch/arm/cpu/armv7/bcm281xx/reset.c | 27 ++ arch/arm/include/asm/arch-bcm281xx/gpio.h | 15 + arch/arm/include/asm/arch-bcm281xx/sysmap.h | 25 ++ include/bitfield.h | 56 +++ 10 files changed, 1790 insertions(+) create mode 100644 arch/arm/cpu/armv7/bcm281xx/Makefile create mode 100644 arch/arm/cpu/armv7/bcm281xx/clk-bcm281xx.c create mode 100644 arch/arm/cpu/armv7/bcm281xx/clk-bsc.c create mode 100644 arch/arm/cpu/armv7/bcm281xx/clk-core.c create mode 100644 arch/arm/cpu/armv7/bcm281xx/clk-core.h create mode 100644 arch/arm/cpu/armv7/bcm281xx/clk-sdio.c create mode 100644 arch/arm/cpu/armv7/bcm281xx/reset.c create mode 100644 arch/arm/include/asm/arch-bcm281xx/gpio.h create mode 100644 arch/arm/include/asm/arch-bcm281xx/sysmap.h create mode 100644 include/bitfield.h
arch/arm/cpu/armv7/bcm281xx/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +# +# Copyright 2013 Broadcom Corporation. All rights reserved. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += reset.o +obj-y += clk-core.o +obj-y += clk-bcm281xx.o +obj-y += clk-sdio.o +obj-y += clk-bsc.o
arch/arm/cpu/armv7/bcm281xx/clk-bcm281xx.c new file +523 -0
523 lines not on this page · raw message
arch/arm/cpu/armv7/bcm281xx/clk-bsc.c new file +52 -0
52 lines not on this page · raw message
arch/arm/cpu/armv7/bcm281xx/clk-core.c new file +513 -0
513 lines not on this page · raw message
arch/arm/cpu/armv7/bcm281xx/clk-core.h new file +495 -0
495 lines not on this page · raw message
arch/arm/cpu/armv7/bcm281xx/clk-sdio.c new file +73 -0
73 lines not on this page · raw message
arch/arm/cpu/armv7/bcm281xx/reset.c new file +27 -0
@@ -0,0 +1,27 @@ +/* +* Copyright 2013 Broadcom Corporation. All rights reserved. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/arch/sysmap.h> + +#define EN_MASK 0x08000000/* Enable timer */ +#define SRSTEN_MASK 0x04000000/* Enable soft reset */ +#define CLKS_SHIFT 20/* Clock period shift */ +#define LD_SHIFT 0/* Reload value shift */ + +void reset_cpu (ulong ignored) +{ +/* +* Set WD enable, RST enable, +* 3.9 msec clock period (8), reload value (8*3.9ms) +*/ +u32 reg =EN_MASK +SRSTEN_MASK + (8 <<CLKS_SHIFT ) + (8 <<LD_SHIFT ); +writel (reg,SECWD2_BASE_ADDR ); + +while (1 ) + ;/* loop forever till reset */ +}
arch/arm/include/asm/arch-bcm281xx/gpio.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Copyright 2013 Broadcom Corporation. All rights reserved. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __ARCH_BCM281XX_GPIO_H +#define __ARCH_BCM281XX_GPIO_H + +/* +* Empty file - cmd_gpio.c requires this. The implementation +* is in drivers/gpio/kona_gpio.c instead of inlined here. +*/ + +#endif
arch/arm/include/asm/arch-bcm281xx/sysmap.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* Copyright 2013 Broadcom Corporation. All rights reserved. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __ARCH_BCM281XX_SYSMAP_H + +#define BSC1_BASE_ADDR 0x3e016000 +#define BSC2_BASE_ADDR 0x3e017000 +#define BSC3_BASE_ADDR 0x3e018000 +#define GPIO2_BASE_ADDR 0x35003000 +#define KONA_MST_CLK_BASE_ADDR 0x3f001000 +#define KONA_SLV_CLK_BASE_ADDR 0x3e011000 +#define PMU_BSC_BASE_ADDR 0x3500d000 +#define PWRMGR_BASE_ADDR 0x35010000 +#define SDIO1_BASE_ADDR 0x3f180000 +#define SDIO2_BASE_ADDR 0x3f190000 +#define SDIO3_BASE_ADDR 0x3f1a0000 +#define SDIO4_BASE_ADDR 0x3f1b0000 +#define SECWD_BASE_ADDR 0x3500c000 +#define SECWD2_BASE_ADDR 0x35002f40 +#define TIMER_BASE_ADDR 0x3e00d000 + +#endif
include/bitfield.h new file +56 -0
56 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 3/6 gpio: kona: Add Kona gpio driver
In reply to Darwin RamboAdd support for the Kona GPIO controller found on Broadcom mobile SoCs.
--- drivers/gpio/Makefile | 1 + drivers/gpio/kona_gpio.c | 141 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 142 insertions(+) create mode 100644 drivers/gpio/kona_gpio.c
drivers/gpio/Makefile +1 -0
@@ -8,6 +8,7 @@ obj-$(CONFIG_AT91_GPIO) += at91_gpio.o obj-$(CONFIG_INTEL_ICH6_GPIO) += intel_ich6_gpio.o obj-$(CONFIG_KIRKWOOD_GPIO) += kw_gpio.o +obj-$(CONFIG_KONA_GPIO) += kona_gpio.o obj-$(CONFIG_MARVELL_GPIO) += mvgpio.o obj-$(CONFIG_MARVELL_MFP) += mvmfp.o obj-$(CONFIG_MXC_GPIO) += mxc_gpio.o
drivers/gpio/kona_gpio.c new file +141 -0
141 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 4/6 i2c: kona: Add Kona I2C driver
In reply to Darwin RamboAdd support for the Kona I2C controller found on Broadcom mobile SoCs.
--- drivers/i2c/Makefile | 1 + drivers/i2c/kona_i2c.c | 730 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 731 insertions(+) create mode 100644 drivers/i2c/kona_i2c.c
drivers/i2c/Makefile +1 -0
@@ -18,6 +18,7 @@ obj-$(CONFIG_SH_SH7734_I2C) += sh_sh7734_i2c.o obj-$(CONFIG_SYS_I2C) += i2c_core.o obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o obj-$(CONFIG_SYS_I2C_FTI2C010) += fti2c010.o +obj-$(CONFIG_SYS_I2C_KONA) += kona_i2c.o obj-$(CONFIG_SYS_I2C_MXC) += mxc_i2c.o obj-$(CONFIG_SYS_I2C_OMAP24XX) += omap24xx_i2c.o obj-$(CONFIG_SYS_I2C_OMAP34XX) += omap24xx_i2c.o
drivers/i2c/kona_i2c.c new file +730 -0
730 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 5/6 mmc: kona: Add Kona mmc driver
In reply to Darwin RamboAdd support for the Kona SDHCI found on Broadcom mobile SoCs.
--- drivers/mmc/Makefile | 1 + drivers/mmc/kona_sdhci.c | 125 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 drivers/mmc/kona_sdhci.c
drivers/mmc/Makefile +1 -0
@@ -21,6 +21,7 @@ obj-$(CONFIG_OMAP_HSMMC) += omap_hsmmc.o obj-$(CONFIG_PXA_MMC_GENERIC) += pxa_mmc_gen.o obj-$(CONFIG_SDHCI) += sdhci.o obj-$(CONFIG_BCM2835_SDHCI) += bcm2835_sdhci.o +obj-$(CONFIG_KONA_SDHCI) += kona_sdhci.o obj-$(CONFIG_S5P_SDHCI) += s5p_sdhci.o obj-$(CONFIG_SH_MMCIF) += sh_mmcif.o obj-$(CONFIG_SPEAR_SDHCI) += spear_sdhci.o
drivers/mmc/kona_sdhci.c new file +125 -0
125 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 5/6 mmc: kona: Add Kona mmc driver
Quoted 42 lines · Darwin Rambo
Add support for the Kona SDHCI found on Broadcom mobile SoCs.
Signed-off-by Darwin Rambo <[email protected]>Reviewed-by Steve Rae <[email protected]>Reviewed-by Tim Kryger <[email protected]>--- drivers/mmc/Makefile | 1 + drivers/mmc/kona_sdhci.c | 125 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 drivers/mmc/kona_sdhci.cdrivers/mmc/Makefile +1
-0@@ -21,6 +21,7 @@ obj-$(CONFIG_OMAP_HSMMC) += omap_hsmmc.o obj-$(CONFIG_PXA_MMC_GENERIC) += pxa_mmc_gen.o obj-$(CONFIG_SDHCI) += sdhci.o obj-$(CONFIG_BCM2835_SDHCI) += bcm2835_sdhci.o +obj-$(CONFIG_KONA_SDHCI) += kona_sdhci.o obj-$(CONFIG_S5P_SDHCI) += s5p_sdhci.o obj-$(CONFIG_SH_MMCIF) += sh_mmcif.o obj-$(CONFIG_SPEAR_SDHCI) += spear_sdhci.odrivers/mmc/kona_sdhci.c new file +13
-0@@ -0,0 +1,125 @@ +/* +* Copyright 2013 Broadcom Corporation. All rights reserved. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <malloc.h> +#include <sdhci.h> +#include <asm/errno.h> +#include <asm/kona-common/clk.h> + +#define SDHCI_CORECTRL_OFFSET 0x00008000
drivers/mmc/kona_sdhci.c line 23
Quoted 10 lines
drivers/mmc/kona_sdhci.c new file +10
-0+#define SDHCI_CORECTRL_EN 0x01 +#define SDHCI_CORECTRL_RESET 0x02 + +#define SDHCI_CORESTAT_OFFSET 0x00008004 +#define SDHCI_CORESTAT_CD_SW 0x01 + +#define SDHCI_COREIMR_OFFSET 0x00008008 +#define SDHCI_COREIMR_IP 0x01 + +static int init_mmc_core (struct sdhci_host *host)
I think that function name is used to "_kona_".
This function isn't general mmc function, right?
Best Regards,
Jaehoon Chung
Quoted 103 lines
drivers/mmc/kona_sdhci.c new file +102
-0+{ +unsigned int mask; +unsigned int timeout; + +if (sdhci_readb (host,SDHCI_SOFTWARE_RESET ) &SDHCI_RESET_ALL ) { +printf ("%s: sd host controller reset error\n" , __func__); +return 1 ; + } + +/* For kona a hardware reset before anything else. */ + mask =sdhci_readl (host,SDHCI_CORECTRL_OFFSET ) |SDHCI_CORECTRL_RESET ; +sdhci_writel (host, mask,SDHCI_CORECTRL_OFFSET ); + +/* Wait max 100 ms */ + timeout =1000 ; +do { +if (timeout ==0 ) { +printf ("%s: reset timeout error\n" , __func__); +return 1 ; + } + timeout--; +udelay (100 ); + }while (0 == + (sdhci_readl (host,SDHCI_CORECTRL_OFFSET ) & +SDHCI_CORECTRL_RESET )); + +/* Clear the reset bit. */ + mask = mask & ~SDHCI_CORECTRL_RESET ; +sdhci_writel (host, mask,SDHCI_CORECTRL_OFFSET ); +udelay (10 ); + +/* Enable AHB clock */ + mask =sdhci_readl (host,SDHCI_CORECTRL_OFFSET ); +sdhci_writel (host, mask |SDHCI_CORECTRL_EN ,SDHCI_CORECTRL_OFFSET ); + +/* Enable interrupts */ +sdhci_writel (host,SDHCI_COREIMR_IP ,SDHCI_COREIMR_OFFSET ); + +/* Make sure Card is detected in controller */ + mask =sdhci_readl (host,SDHCI_CORESTAT_OFFSET ); +sdhci_writel (host, mask |SDHCI_CORESTAT_CD_SW ,SDHCI_CORESTAT_OFFSET ); + +return 0 ; +} + +int kona_sdhci_init (int dev_index,u32 min_clk,u32 quirks) +{ +int ret =0 ; +u32 max_clk; +void *reg_base; +struct sdhci_host *host =NULL ; + + host = (struct sdhci_host *)malloc (sizeof (struct sdhci_host )); +if (!host) { +printf ("%s: sdhci host malloc fail!\n" , __func__); +return -ENOMEM ; + } +switch (dev_index) { +case 0 : + reg_base = (void *)CONFIG_SYS_SDIO_BASE0 ; + ret =clk_sdio_enable (reg_base,CONFIG_SYS_SDIO0_MAX_CLK , + &max_clk); +break ; +case 1 : + reg_base = (void *)CONFIG_SYS_SDIO_BASE1 ; + ret =clk_sdio_enable (reg_base,CONFIG_SYS_SDIO1_MAX_CLK , + &max_clk); +break ; +case 2 : + reg_base = (void *)CONFIG_SYS_SDIO_BASE2 ; + ret =clk_sdio_enable (reg_base,CONFIG_SYS_SDIO2_MAX_CLK , + &max_clk); +break ; +case 3 : + reg_base = (void *)CONFIG_SYS_SDIO_BASE3 ; + ret =clk_sdio_enable (reg_base,CONFIG_SYS_SDIO3_MAX_CLK , + &max_clk); +break ; +default : +printf ("%s: sdio dev index %d not supported\n" , + __func__, dev_index); + ret = -EINVAL ; + } +if (ret) +return ret; + + host->name ="kona-sdhci" ; + host->ioaddr = reg_base; + host->quirks = quirks; + host->host_caps =MMC_MODE_HC ; + +if (init_mmc_core (host)) +return -EINVAL ; + +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 ret; +}
PATCH 5/6 mmc: kona: Add Kona mmc driver
Quoted 48 lines · Jaehoon Chung
Quoted 47 lines · Darwin Rambo
Add support for the Kona SDHCI found on Broadcom mobile SoCs.
Signed-off-by Darwin Rambo <[email protected]>Reviewed-by Steve Rae <[email protected]>Reviewed-by Tim Kryger <[email protected]>--- drivers/mmc/Makefile | 1 + drivers/mmc/kona_sdhci.c | 125 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 drivers/mmc/kona_sdhci.cdrivers/mmc/Makefile +1
-0@@ -21,6 +21,7 @@ obj-$(CONFIG_OMAP_HSMMC) += omap_hsmmc.o obj-$(CONFIG_PXA_MMC_GENERIC) += pxa_mmc_gen.o obj-$(CONFIG_SDHCI) += sdhci.o obj-$(CONFIG_BCM2835_SDHCI) += bcm2835_sdhci.o +obj-$(CONFIG_KONA_SDHCI) += kona_sdhci.o obj-$(CONFIG_S5P_SDHCI) += s5p_sdhci.o obj-$(CONFIG_SH_MMCIF) += sh_mmcif.o obj-$(CONFIG_SPEAR_SDHCI) += spear_sdhci.odrivers/mmc/kona_sdhci.c new file +18
-0@@ -0,0 +1,125 @@ +/* +* Copyright 2013 Broadcom Corporation. All rights reserved. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <malloc.h> +#include <sdhci.h> +#include <asm/errno.h> +#include <asm/kona-common/clk.h> + +#define SDHCI_CORECTRL_OFFSET 0x00008000 +#define SDHCI_CORECTRL_EN 0x01 +#define SDHCI_CORECTRL_RESET 0x02 + +#define SDHCI_CORESTAT_OFFSET 0x00008004 +#define SDHCI_CORESTAT_CD_SW 0x01
Quoted 8 lines
drivers/mmc/kona_sdhci.c line 23
Quoted 5 lines
drivers/mmc/kona_sdhci.c new file +5
-0+ +#define SDHCI_COREIMR_OFFSET 0x00008008 +#define SDHCI_COREIMR_IP 0x01 + +static int init_mmc_core (struct sdhci_host *host)I think that function name is used to "_kona_".
This function isn't general mmc function, right?
Correct. I should rename it to init_kona_mmc_core(). Thanks.
Quoted 37 lines
Best Regards,
Jaehoon ChungQuoted 33 lines
drivers/mmc/kona_sdhci.c new file +33
-0+{ +unsigned int mask; +unsigned int timeout; + +if (sdhci_readb (host,SDHCI_SOFTWARE_RESET ) &SDHCI_RESET_ALL ) { +printf ("%s: sd host controller reset error\n" , __func__); +return 1 ; + } + +/* For kona a hardware reset before anything else. */ + mask =sdhci_readl (host,SDHCI_CORECTRL_OFFSET ) |SDHCI_CORECTRL_RESET ; +sdhci_writel (host, mask,SDHCI_CORECTRL_OFFSET ); + +/* Wait max 100 ms */ + timeout =1000 ; +do { +if (timeout ==0 ) { +printf ("%s: reset timeout error\n" , __func__); +return 1 ; + } + timeout--; +udelay (100 ); + }while (0 == + (sdhci_readl (host,SDHCI_CORECTRL_OFFSET ) & +SDHCI_CORECTRL_RESET )); + +/* Clear the reset bit. */ + mask = mask & ~SDHCI_CORECTRL_RESET ; +sdhci_writel (host, mask,SDHCI_CORECTRL_OFFSET ); +udelay (10 ); + +/* Enable AHB clock */ + mask =sdhci_readl (host,SDHCI_CORECTRL_OFFSET );
Quoted 8 lines
drivers/mmc/kona_sdhci.c line 64
Quoted 8 lines
drivers/mmc/kona_sdhci.c new file +8
-0+sdhci_writel (host, mask |SDHCI_CORECTRL_EN ,SDHCI_CORECTRL_OFFSET ); + +/* Enable interrupts */ +sdhci_writel (host,SDHCI_COREIMR_IP ,SDHCI_COREIMR_OFFSET ); + +/* Make sure Card is detected in controller */ + mask =sdhci_readl (host,SDHCI_CORESTAT_OFFSET ); +sdhci_writel (host, mask |SDHCI_CORESTAT_CD_SW ,SDHCI_CORESTAT_OFFSET );
BTW I think that this is a good spot to test and wait for CARD_PRESENT with timeout. I should add it here. This avoids timing issues if the core code tries to power up the card before it is recognized. Thanks.
Quoted 63 lines
Quoted 62 lines
drivers/mmc/kona_sdhci.c new file +61
-0+ +return 0 ; +} + +int kona_sdhci_init (int dev_index,u32 min_clk,u32 quirks) +{ +int ret =0 ; +u32 max_clk; +void *reg_base; +struct sdhci_host *host =NULL ; + + host = (struct sdhci_host *)malloc (sizeof (struct sdhci_host )); +if (!host) { +printf ("%s: sdhci host malloc fail!\n" , __func__); +return -ENOMEM ; + } +switch (dev_index) { +case 0 : + reg_base = (void *)CONFIG_SYS_SDIO_BASE0 ; + ret =clk_sdio_enable (reg_base,CONFIG_SYS_SDIO0_MAX_CLK , + &max_clk); +break ; +case 1 : + reg_base = (void *)CONFIG_SYS_SDIO_BASE1 ; + ret =clk_sdio_enable (reg_base,CONFIG_SYS_SDIO1_MAX_CLK , + &max_clk); +break ; +case 2 : + reg_base = (void *)CONFIG_SYS_SDIO_BASE2 ; + ret =clk_sdio_enable (reg_base,CONFIG_SYS_SDIO2_MAX_CLK , + &max_clk); +break ; +case 3 : + reg_base = (void *)CONFIG_SYS_SDIO_BASE3 ; + ret =clk_sdio_enable (reg_base,CONFIG_SYS_SDIO3_MAX_CLK , + &max_clk); +break ; +default : +printf ("%s: sdio dev index %d not supported\n" , + __func__, dev_index); + ret = -EINVAL ; + } +if (ret) +return ret; + + host->name ="kona-sdhci" ; + host->ioaddr = reg_base; + host->quirks = quirks; + host->host_caps =MMC_MODE_HC ; + +if (init_mmc_core (host)) +return -EINVAL ; + +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 ret; +}
PATCH 6/6 board: bcm28155_ap: Add board files
In reply to Darwin RamboAdd support for the bcm28155_ap reference board.
--- board/broadcom/bcm28155_ap/Makefile | 7 ++ board/broadcom/bcm28155_ap/bcm28155_ap.c | 87 +++++++++++++++++++ boards.cfg | 1 + include/configs/bcm28155_ap.h | 140 ++++++++++++++++++++++++++++++ 4 files changed, 235 insertions(+) create mode 100644 board/broadcom/bcm28155_ap/Makefile create mode 100644 board/broadcom/bcm28155_ap/bcm28155_ap.c create mode 100644 include/configs/bcm28155_ap.h
board/broadcom/bcm28155_ap/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# Copyright 2013 Broadcom Corporation. All rights reserved. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += $(BOARD).o
board/broadcom/bcm28155_ap/bcm28155_ap.c new file +87 -0
87 lines not on this page · raw message
boards.cfg +1 -0
@@ -272,6 +272,7 @@ Active arm armv7 am33xx ti ti816x Active arm armv7 at91 atmel sama5d3xek sama5d3xek_mmc sama5d3xek:SAMA5D3,SYS_USE_MMC Bo Shen <[email protected]> Active arm armv7 at91 atmel sama5d3xek sama5d3xek_nandflash sama5d3xek:SAMA5D3,SYS_USE_NANDFLASH Bo Shen <[email protected]> Active arm armv7 at91 atmel sama5d3xek sama5d3xek_spiflash sama5d3xek:SAMA5D3,SYS_USE_SERIALFLASH Bo Shen <[email protected]> +Active arm armv7 bcm281xx broadcom bcm28155_ap bcm28155_ap bcm28155_ap Tim Kryger <[email protected]> Active arm armv7 exynos samsung arndale arndale - Inderpal Singh <[email protected]> Active arm armv7 exynos samsung origen origen - Chander Kashyap <[email protected]> Active arm armv7 exynos samsung smdk5250 smdk5250 - Chander Kashyap <[email protected]>
include/configs/bcm28155_ap.h new file +140 -0
140 lines not on this page · raw message
Signature · 1 line
1.7.9.5
cover Introducing the Broadcom bcm281xx Architecture
In reply to Darwin RamboSorry folks, I missed my morning caffeine and mislabeled the patch version in the subject as v1. I will be resending the series with the proper v2 versioning asap to avoid confusion.
Regards,
Darwin
Quoted 83 lines
-----Original Message-----
From: Darwin Rambo [mailto:drambo at broadcom.com]
Sent: Monday, February 03, 2014 1:03 PM
To: u-boot at lists.denx.de
Cc: Darwin Rambo
Subject: [PATCH v1 0/6] Introducing the Broadcom bcm281xx ArchitectureThis patchset introduces the Broadcom bcm281xx family of mobile SoC chips. Broadcom kona hardware blocks are often found in Broadcom mobile SoC chips including the bcm281xx family, so support for some of these kona blocks is also provided here. These patches work on u-boot master as well as the u-boot-arm custodian tree.
v1 changes
----------
Deletelowlevel_init.Sand creates_init.c. File header cleanup, cosmetic changes, dead code removal. Createinclude/bitfield.h. Useget_ram_size(). Use weaktimer_init(); Skip lowlevel init. Remove memory test config. Use standard baud table and prompt.Darwin Rambo (6):
arch: kona: Initial commit of kona-common architecture code
arch: bcm281xx: Initial commit of bcm281xx architecture code
gpio: kona: Add Kona gpio driver
i2c: kona: Add Kona I2C driver
mmc: kona: Add Kona mmc driver
board:bcm28155_ap: Add board filesarch/arm/cpu/armv7/Makefile | 1 + arch/arm/cpu/armv7/bcm281xx/Makefile | 11 + arch/arm/cpu/armv7/bcm281xx/clk-bcm281xx.c | 523 +++++++++++++++++ arch/arm/cpu/armv7/bcm281xx/clk-bsc.c | 52 ++ arch/arm/cpu/armv7/bcm281xx/clk-core.c | 513 +++++++++++++++++ arch/arm/cpu/armv7/bcm281xx/clk-core.h | 495 ++++++++++++++++ arch/arm/cpu/armv7/bcm281xx/clk-sdio.c | 73 +++ arch/arm/cpu/armv7/bcm281xx/reset.c | 27 + arch/arm/cpu/armv7/kona-common/Makefile | 9 + arch/arm/cpu/armv7/kona-common/clk-stubs.c | 21 + arch/arm/cpu/armv7/kona-common/hwinit-common.c | 16 + arch/arm/cpu/armv7/kona-common/s_init.c | 12 + arch/arm/include/asm/arch-bcm281xx/gpio.h | 15 + arch/arm/include/asm/arch-bcm281xx/sysmap.h | 25 + arch/arm/include/asm/kona-common/clk.h | 29 + arch/arm/include/asm/kona-common/kona_sdhci.h | 12 + board/broadcom/bcm28155_ap/Makefile | 7 + board/broadcom/bcm28155_ap/bcm28155_ap.c | 87 +++ boards.cfg | 1 + drivers/gpio/Makefile | 1 + drivers/gpio/kona_gpio.c | 141 +++++ drivers/i2c/Makefile | 1 + drivers/i2c/kona_i2c.c | 730 ++++++++++++++++++++++++ drivers/mmc/Makefile | 1 + drivers/mmc/kona_sdhci.c | 125 ++++ include/bitfield.h | 56 ++ include/configs/bcm28155_ap.h | 140 +++++ 27 files changed, 3124 insertions(+) create mode 100644 arch/arm/cpu/armv7/bcm281xx/Makefile create mode 100644 arch/arm/cpu/armv7/bcm281xx/clk-bcm281xx.c create mode 100644 arch/arm/cpu/armv7/bcm281xx/clk-bsc.c create mode 100644 arch/arm/cpu/armv7/bcm281xx/clk-core.c create mode 100644 arch/arm/cpu/armv7/bcm281xx/clk-core.h create mode 100644 arch/arm/cpu/armv7/bcm281xx/clk-sdio.c create mode 100644 arch/arm/cpu/armv7/bcm281xx/reset.c create mode 100644 arch/arm/cpu/armv7/kona-common/Makefile create mode 100644 arch/arm/cpu/armv7/kona-common/clk-stubs.c create mode 100644 arch/arm/cpu/armv7/kona-common/hwinit-common.c create mode 100644 arch/arm/cpu/armv7/kona-common/s_init.c create mode 100644 arch/arm/include/asm/arch-bcm281xx/gpio.h create mode 100644 arch/arm/include/asm/arch-bcm281xx/sysmap.h create mode 100644 arch/arm/include/asm/kona-common/clk.h create mode 100644 arch/arm/include/asm/kona-common/kona_sdhci.h create mode 100644 board/broadcom/bcm28155_ap/Makefile create mode 100644 board/broadcom/bcm28155_ap/bcm28155_ap.c create mode 100644 drivers/gpio/kona_gpio.c create mode 100644 drivers/i2c/kona_i2c.c create mode 100644 drivers/mmc/kona_sdhci.c create mode 100644 include/bitfield.h create mode 100644 include/configs/bcm28155_ap.h--
1.7.9.5