Message ID | 1390848810-7227-2-git-send-email-drambo@broadcom.com |
---|---|
State | Superseded |
Headers | show |
On Mon, Jan 27, 2014 at 10:53:25AM -0800, Darwin Rambo wrote: > The Kona architecture is present on a number of Broadcom mobile SoCs > including the bcm281xx family of chips. [snip] > +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; > +} Blank lines between functions please. > diff --git a/arch/arm/cpu/armv7/kona-common/lowlevel_init.S b/arch/arm/cpu/armv7/kona-common/lowlevel_init.S > new file mode 100644 > index 0000000..a03afcc > --- /dev/null > +++ b/arch/arm/cpu/armv7/kona-common/lowlevel_init.S > @@ -0,0 +1,15 @@ > +/***************************************************************************** > +* > +* Copyright 2013 Broadcom Corporation. All rights reserved. > +* > +* SPDX-License-Identifier: GPL-2.0+ > +* > +*****************************************************************************/ > + > +//#include <asm-offsets.h> > +//#include <config.h> > +//#include <linux/linkage.h> > + > +.globl lowlevel_init > +lowlevel_init: > + mov pc, lr (a) no commented out include lines (b) This is empty, which seems wrong. I strongly suspect you want to make use of arch/arm/cpu/armv7/lowlevel_init.S and have an s_init function, ala omap*/tegra/rmobile/etc. > diff --git a/arch/arm/cpu/armv7/kona-common/proc.c b/arch/arm/cpu/armv7/kona-common/proc.c > new file mode 100644 > index 0000000..92fb39b > --- /dev/null > +++ b/arch/arm/cpu/armv7/kona-common/proc.c > @@ -0,0 +1,20 @@ > +/***************************************************************************** > +* > +* Copyright 2013 Broadcom Corporation. All rights reserved. > +* > +* SPDX-License-Identifier: GPL-2.0+ > +* > +*****************************************************************************/ > + > +#include <common.h> > +#include <asm/io.h> > +#include <asm/kona-common/misc.h> > +#include <asm/armv7.h> > + > +void do_proc_wfe(int forever) > +{ > + do { > + asm volatile ("wfe @ wait for event\n"); > + /*printf("wake up from wfe\n"); */ No commented out printf, thanks.
On 14-01-29 02:32 PM, Tom Rini wrote: > On Mon, Jan 27, 2014 at 10:53:25AM -0800, Darwin Rambo wrote: > >> The Kona architecture is present on a number of Broadcom mobile SoCs >> including the bcm281xx family of chips. > [snip] >> +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; >> +} > > Blank lines between functions please. OK > >> diff --git a/arch/arm/cpu/armv7/kona-common/lowlevel_init.S b/arch/arm/cpu/armv7/kona-common/lowlevel_init.S >> new file mode 100644 >> index 0000000..a03afcc >> --- /dev/null >> +++ b/arch/arm/cpu/armv7/kona-common/lowlevel_init.S >> @@ -0,0 +1,15 @@ >> +/***************************************************************************** >> +* >> +* Copyright 2013 Broadcom Corporation. All rights reserved. >> +* >> +* SPDX-License-Identifier: GPL-2.0+ >> +* >> +*****************************************************************************/ >> + >> +//#include <asm-offsets.h> >> +//#include <config.h> >> +//#include <linux/linkage.h> >> + >> +.globl lowlevel_init >> +lowlevel_init: >> + mov pc, lr > > (a) no commented out include lines OK > (b) This is empty, which seems wrong. I strongly suspect you want to > make use of arch/arm/cpu/armv7/lowlevel_init.S and have an s_init > function, ala omap*/tegra/rmobile/etc. Will check this out. Thanks. > >> diff --git a/arch/arm/cpu/armv7/kona-common/proc.c b/arch/arm/cpu/armv7/kona-common/proc.c >> new file mode 100644 >> index 0000000..92fb39b >> --- /dev/null >> +++ b/arch/arm/cpu/armv7/kona-common/proc.c >> @@ -0,0 +1,20 @@ >> +/***************************************************************************** >> +* >> +* Copyright 2013 Broadcom Corporation. All rights reserved. >> +* >> +* SPDX-License-Identifier: GPL-2.0+ >> +* >> +*****************************************************************************/ >> + >> +#include <common.h> >> +#include <asm/io.h> >> +#include <asm/kona-common/misc.h> >> +#include <asm/armv7.h> >> + >> +void do_proc_wfe(int forever) >> +{ >> + do { >> + asm volatile ("wfe @ wait for event\n"); >> + /*printf("wake up from wfe\n"); */ > > No commented out printf, thanks. > OK
diff --git a/arch/arm/cpu/armv7/Makefile b/arch/arm/cpu/armv7/Makefile index 0467d00..119ebb3 100644 --- a/arch/arm/cpu/armv7/Makefile +++ b/arch/arm/cpu/armv7/Makefile @@ -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/ diff --git a/arch/arm/cpu/armv7/kona-common/Makefile b/arch/arm/cpu/armv7/kona-common/Makefile new file mode 100644 index 0000000..9a7c167 --- /dev/null +++ b/arch/arm/cpu/armv7/kona-common/Makefile @@ -0,0 +1,10 @@ +# +# Copyright 2013 Broadcom Corporation. All rights reserved. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += clk-stubs.o +obj-y += hwinit-common.o +obj-y += proc.o +obj-y += lowlevel_init.o diff --git a/arch/arm/cpu/armv7/kona-common/clk-stubs.c b/arch/arm/cpu/armv7/kona-common/clk-stubs.c new file mode 100644 index 0000000..dd3ce34 --- /dev/null +++ b/arch/arm/cpu/armv7/kona-common/clk-stubs.c @@ -0,0 +1,22 @@ +/***************************************************************************** +* +* 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; +} diff --git a/arch/arm/cpu/armv7/kona-common/hwinit-common.c b/arch/arm/cpu/armv7/kona-common/hwinit-common.c new file mode 100644 index 0000000..5d6b131 --- /dev/null +++ b/arch/arm/cpu/armv7/kona-common/hwinit-common.c @@ -0,0 +1,18 @@ +/***************************************************************************** +* +* 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 diff --git a/arch/arm/cpu/armv7/kona-common/lowlevel_init.S b/arch/arm/cpu/armv7/kona-common/lowlevel_init.S new file mode 100644 index 0000000..a03afcc --- /dev/null +++ b/arch/arm/cpu/armv7/kona-common/lowlevel_init.S @@ -0,0 +1,15 @@ +/***************************************************************************** +* +* Copyright 2013 Broadcom Corporation. All rights reserved. +* +* SPDX-License-Identifier: GPL-2.0+ +* +*****************************************************************************/ + +//#include <asm-offsets.h> +//#include <config.h> +//#include <linux/linkage.h> + +.globl lowlevel_init +lowlevel_init: + mov pc, lr diff --git a/arch/arm/cpu/armv7/kona-common/proc.c b/arch/arm/cpu/armv7/kona-common/proc.c new file mode 100644 index 0000000..92fb39b --- /dev/null +++ b/arch/arm/cpu/armv7/kona-common/proc.c @@ -0,0 +1,20 @@ +/***************************************************************************** +* +* Copyright 2013 Broadcom Corporation. All rights reserved. +* +* SPDX-License-Identifier: GPL-2.0+ +* +*****************************************************************************/ + +#include <common.h> +#include <asm/io.h> +#include <asm/kona-common/misc.h> +#include <asm/armv7.h> + +void do_proc_wfe(int forever) +{ + do { + asm volatile ("wfe @ wait for event\n"); + /*printf("wake up from wfe\n"); */ + } while (forever); +} diff --git a/arch/arm/include/asm/kona-common/clk.h b/arch/arm/include/asm/kona-common/clk.h new file mode 100644 index 0000000..c26c6a4 --- /dev/null +++ b/arch/arm/include/asm/kona-common/clk.h @@ -0,0 +1,31 @@ +/***************************************************************************** +* +* 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 diff --git a/arch/arm/include/asm/kona-common/misc.h b/arch/arm/include/asm/kona-common/misc.h new file mode 100644 index 0000000..8506bbc --- /dev/null +++ b/arch/arm/include/asm/kona-common/misc.h @@ -0,0 +1,20 @@ +/***************************************************************************** +* +* Copyright 2013 Broadcom Corporation. All rights reserved. +* +* SPDX-License-Identifier: GPL-2.0+ +* +*****************************************************************************/ + +#ifndef __KONA_COMMON_MISC_H +#define __KONA_COMMON_MISC_H + +#include <mmc.h> + +void hw_watchdog_disable(void); +int kona_sdhci_init(int dev_index, u32 min_clk, u32 quirks); +int kona_i2c_init(unsigned int dev_idx, unsigned long base_addr); + +void proc_on_wfi(void); + +#endif